pyoneering

class pyoneering.DevUtils(current_version, stages=None, used_in_production=False, preset=None)[source]

This class contains the decorators to annotate objects in a deprecation cycle.

deprecated(*version_identifiers, details=None)[source]

Decorator to mark a class, function, staticmethod, classmethod or instancemethod as deprecated

  • Inserts information to the docstring describing the current (and next) deprecation stage.
  • Generates a DeprecationWarning if the decorator gets called.
Parameters:
  • version_identifiers – Specify versions at which the decorated object enters next stage.
  • details – Additional information to integrate in docstring
Raises:

TypeError – If stages not in ascending order.

refactored(*version_identifiers, parameter_map, details=None)[source]

Decorator to mark keyword arguments as deprecated

  • Replaces old keywords with new ones.
  • Generates a DeprecationWarning with if a deprecated keyword argument was passed.
Parameters:
  • version_identifiers – Specify versions at which the decorated object enters next stage.
  • parameter_map – If keyword arguments got renamed, pass a dict with (old_keyword=new_keyword) items. Otherwise pass a function with old_keywords and their default values as parameter which returns a dict of new_keywords mapped to new values.
  • details – Additional information to integrate in docstring
Raises:

TypeError – If stages not in ascending order.