Skip to main content

annotations

superduper.misc.annotations

Source code

merge_docstrings​

merge_docstrings(cls)
ParameterDescription
clsClass to merge docstrings for.

Decorator that merges Sphinx-styled class docstrings.

Decorator merges doc-strings from parent to child classes, ensuring no duplicate parameters and correct indentation.

deprecated​

deprecated(f)
ParameterDescription
ffunction to deprecate

Decorator to mark a function as deprecated.

This will result in a warning being emitted when the function is used.

component​

component(*schema: Dict)
ParameterDescription
schemaschema for the component

Decorator for creating a component.

requires_packages​

requires_packages(*packages,
warn=False)
ParameterDescription
packageslist of tuples of packages each tuple of the form (import_name, lower_bound/None, upper_bound/None, install_name/None)
warnif True, warn instead of raising an exception

Require the packages to be installed.

E.g. ('sklearn', '0.1.0', '0.2.0', 'scikit-learn')

extract_parameters​

extract_parameters(doc)
ParameterDescription
docSphinx-styled docstring. Docstring may have multiple lines

Extracts and organizes parameter descriptions from a Sphinx-styled docstring.

replace_parameters​

replace_parameters(doc,
placeholder: str = '!!!')
ParameterDescription
docSphinx-styled docstring.
placeholderPlaceholder to replace parameters with.

Replace parameters in a doc-string with a placeholder.

superduperDeprecationWarning​

superduperDeprecationWarning(self,
/,
*args,
**kwargs)
ParameterDescription
args*args of DeprecationWarning
kwargs**kwargs of DeprecationWarning

Specialized Deprecation Warning for fine grained filtering control.