路径

(类来自 pyomo.common.config)

class pyomo.common.config.Path(basePath=None, expandPath=None)[源代码]

基础类:object

用于验证path-like object的域验证器。

这将接受一个类似路径的对象,并通过os.fsdecode获取对象的文件系统表示。然后,在连接基本路径和值之前,它将扩展出现在值或基本路径中的任何环境变量和前导用户名(例如,“~myuser”或“~/”),将路径扩展为绝对路径,并规范化路径。

Parameters:
  • basePath (None, str, ConfigValue) – 将添加到任何非绝对路径值前的基础路径。如果为None,则默认为 Path.BasePath

  • expandPath (bool) – 如果为True,则值将被扩展并规范化。如果为False,则返回值的字符串表示形式不变。如果为None,expandPath将遵循Path.SuppressPathExpansion的(否定)值。

__init__(basePath=None, expandPath=None)[source]

方法

__init__([basePath, expandPath])

domain_name()

属性

BasePath

SuppressPathExpansion

成员文档