tlslite.utils.deprecations module

Methods for deprecating old names for arguments or attributes.

tlslite.utils.deprecations.deprecated_attrs(names, warn="Attribute '{old_name}' is deprecated, please use '{new_name}'")[source]

Decorator to deprecate all specified attributes in class.

Translates all names in names to use new names and emits warnings if the translation was necessary.

Note: uses metaclass magic so is incompatible with other metaclass uses

Parameters:
  • names (dict) – dictionary with paris of new_name: old_name that will be used to translate the calls

  • warn (str) – DeprecationWarning format string for informing the user what is the current parameter name, uses ‘old_name’ for the deprecated keyword name and ‘new_name’ for the current one. Example: “Old name: {old_name}, use {new_name} instead”.

tlslite.utils.deprecations.deprecated_class_name(old_name, warn="Class name '{old_name}' is deprecated, please use '{new_name}'")[source]

Class decorator to deprecate a use of class.

Parameters:
  • old_name (str) – the deprecated name that will be registered, but will raise warnings if used.

  • warn (str) – DeprecationWarning format string for informing the user what is the current class name, uses ‘old_name’ for the deprecated keyword name and the ‘new_name’ for the current one. Example: “Old name: {old_nam}, use ‘{new_name}’ instead”.

tlslite.utils.deprecations.deprecated_instance_attrs(names, warn="Attribute '{old_name}' is deprecated, please use '{new_name}'")[source]

Decorator to deprecate class instance attributes.

Translates all names in names to use new names and emits warnings if the translation was necessary. Does apply only to instance variables and attributes (won’t modify behaviour of class variables, static methods, etc.

Parameters:
  • names (dict) – dictionary with paris of new_name: old_name that will be used to translate the calls

  • warn (str) – DeprecationWarning format string for informing the user what is the current parameter name, uses ‘old_name’ for the deprecated keyword name and ‘new_name’ for the current one. Example: “Old name: {old_name}, use {new_name} instead”.

tlslite.utils.deprecations.deprecated_method(message)[source]

Decorator for deprecating methods.

Parameters:

message (ste) – The message you want to display.

tlslite.utils.deprecations.deprecated_params(names, warn="Param name '{old_name}' is deprecated, please use '{new_name}'")[source]

Decorator to translate obsolete names and warn about their use.

Parameters:
  • names (dict) – dictionary with pairs of new_name: old_name that will be used for translating obsolete param names to new names

  • warn (str) – DeprecationWarning format string for informing the user what is the current parameter name, uses ‘old_name’ for the deprecated keyword name and ‘new_name’ for the current one. Example: “Old name: {old_name}, use {new_name} instead”.