已弃用
(函数来自 pyomo.common.deprecation)
- pyomo.common.deprecation.deprecated(msg=None, logger=None, version=None, remove_in=None)[source]
装饰器,用于指示某个函数、方法或类已弃用。
此装饰器将在调用被包装的函数或方法时,或在构建已弃用的类时记录警告。此装饰器还会更新目标对象的文档字符串,以指示其已被弃用。
- Parameters:
示例
>>> from pyomo.common.deprecation import deprecated >>> @deprecated(version='1.2.3') ... def sample_function(x): ... return 2*x >>> sample_function(5) WARNING: DEPRECATED: This function (sample_function) has been deprecated and may be removed in a future release. (deprecated in 1.2.3) ... 10