Module to help with deprecating classes and modules
FutureWarningMixin(*args, **kwargs) | Insert FutureWarning for object creation |
ModuleProxy(module_name) | Proxy for module that may not yet have been imported |
Bases: object
Insert FutureWarning for object creation
Examples
>>> class C(object): pass
>>> class D(FutureWarningMixin, C):
... warn_message = "Please, don't use this class"
Record the warning
>>> with warnings.catch_warnings(record=True) as warns:
... d = D()
... warns[0].message
FutureWarning("Please, don't use this class",)
Bases: object
Proxy for module that may not yet have been imported
Parameters: | module_name : str
|
---|
Examples
So, the minc object is a proxy that will import the required module when you do attribute access and return the attributes of the imported module.