util¶
- snippets.util.get_first_docstring_paragraph(obj: Any) str¶
Get the first paragraph of the docstring of an object.
- Parameters:
obj – Object whose first docstring paragraph to get.
- Returns:
First paragraph of the object’s docstring.
- class snippets.util.raise_for_missing_modules¶
Helper class providing install instructions if a required package is missing.
Example
>>> from snippets.util import raise_for_missing_modules >>> with raise_for_missing_modules(): ... import xxx Traceback (most recent call last): ... RuntimeError: install module `xxx` to use the snippet at `...`