schrodinger.utils.deprecation module

Deprecation handling

Copyright Schrodinger LLC, All Rights Reserved.

exception schrodinger.utils.deprecation.DeprecationError[source]

Bases: RuntimeError

Exception indicating API deprecation

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

schrodinger.utils.deprecation.raise_deprecation_error(msg: str, to_remove_in: str)[source]

Raise a DeprecationError unless USE_DEPRECATED feature flag is set, which will issue a DeprecationWarning only.

Parameters
  • msg – deprecation message to isse

  • to_remove_in – Schrodinger core suite release version (XXXX-X)

schrodinger.utils.deprecation.deprecate_module(module_name: str, to_remove_in: str, replacement: str = None)[source]

Raises a deprecation error (or only prints a warning when USE_DEPRECATED is enabled), indicating to the caller that the import should be removed, and updated to a new module if applicable.

Parameters
  • module_name – name of module which is deprecated

  • to_remove_in – Schrodinger core suite release version (XXXX-X)

  • replacement – replacement module name

schrodinger.utils.deprecation.deprecated(func: Callable, to_remove_in: Optional[str] = None, replacement: Optional[Callable] = None, msg: Optional[str] = None, *args, **kwargs)[source]

Raises a deprecation error (or only prints a warning when USE_DEPRECATED is enabled), indicating to the caller that the decorated call should be removed, and updated to a new function/method call if applicable.

Parameters
  • func – deprecated function/method

  • to_remove_in – Schrodinger core suite release version (XXXX-X)

  • replacement – current function/method to use

  • msg – specific message if default message is not desired

schrodinger.utils.deprecation.enable_deprecated()[source]

Enables deprecated imports/functions within managed context