API
The currently documented publicly exposed API’s for usage in your project
are defined below.
Warning
External usage of internal utility functions and modules should be kept
to a minimum as they may be altered, refactored or moved to other
locations without notice (and without the typical deprecation cycle).
Helpers
-
debtcollector.deprecate(prefix, postfix=None, message=None, version=None, removal_version=None, stacklevel=3, category=<type 'exceptions.DeprecationWarning'>)[source]
Helper to deprecate some thing using generated message format.
Parameters: |
- prefix – prefix string used as the prefix of the output message
- postfix – postfix string used as the postfix of the output message
- message – message string used as ending contents of the deprecate
message
- version – version string (represents the version this
deprecation was created in)
- removal_version – version string (represents the version this
deprecation will be removed in); a string of ‘?’
will denote this will be removed in some future
unknown version
- stacklevel – stacklevel used in the warnings.warn() function
to locate where the users code is in the
warnings.warn() call
- category – the warnings category to use, defaults to
DeprecationWarning if not provided
|
Moves
-
debtcollector.moves.moved_method(new_method_name, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Decorates a instance method that was moved to another location.
-
debtcollector.moves.moved_property(new_attribute_name, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Decorates a instance property that was moved to another location.
-
debtcollector.moves.moved_class(new_class, old_class_name, old_module_name, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Deprecates a class that was moved to another location.
This creates a ‘new-old’ type that can be used for a
deprecation period that can be inherited from. This will emit warnings
when the old locations class is initialized, telling where the new and
improved location for the old class now is.
Renames
-
debtcollector.renames.renamed_kwarg(old_name, new_name, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Decorates a kwarg accepting function to deprecate a renamed kwarg.
Removals
-
debtcollector.removals.remove(f=None, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Decorates a function, method, or class to emit a deprecation warning
Parameters: |
- message (str) – A message to include in the deprecation warning
- version (str) – Specify what version the removed function is present in
- removal_version (str) – What version the function will be removed. If
‘?’ is used this implies an undefined future
version
- stacklevel (int) – How many entries deep in the call stack before
ignoring
- category (type) – warnings message category (this defaults to
DeprecationWarning when none is provided)
|
-
debtcollector.removals.removed_kwarg(old_name, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Decorates a kwarg accepting function to deprecate a removed kwarg.
-
debtcollector.removals.removed_module(module, replacement=None, message=None, version=None, removal_version=None, stacklevel=3, category=None)[source]
Helper to be called inside a module to emit a deprecation warning
Parameters: |
- replacment (str) – A location (or information about) of any potential
replacement for the removed module (if applicable)
- message (str) – A message to include in the deprecation warning
- version (str) – Specify what version the removed module is present in
- removal_version (str) – What version the module will be removed. If
‘?’ is used this implies an undefined future
version
- stacklevel (int) – How many entries deep in the call stack before
ignoring
- category (type) – warnings message category (this defaults to
DeprecationWarning when none is provided)
|