relocated_module_attribute

(函数来自 pyomo.common.deprecation)

pyomo.common.deprecation.relocated_module_attribute(local, target, version, remove_in=None, msg=None, f_globals=None)[source]

为移动/重命名的模块属性提供弃用路径

此函数声明一个本地模块属性已被移动到另一个位置。对于Python 3.7+,它利用module.__getattr__方法来管理从新位置(按需)延迟导入对象,并发出弃用警告。

Parameters:
  • local (str) – 重定位属性的原始(本地)名称

  • target (str) – 重新定位属性的新绝对导入名称

  • version (str) – 发布此版本时的Pyomo版本 (传递给deprecation_warning)

  • remove_in (str) – 此弃用路径将被移除的Pyomo版本 (传递给deprecation_warning)

  • msg (str) – 如果不为None,则指定从原始位置访问属性时要发出的自定义弃用消息。