param.resolve_path#

class param.resolve_path(*, path_to_file, search_paths, name)[source]#

Find the path to an existing file, searching the paths specified in the search_paths parameter if the filename is not absolute, and converting a UNIX-style path to the current OS’s format if necessary.

To turn a supplied relative path into an absolute one, the path is appended to paths in the search_paths parameter, in order, until the file is found.

An IOError is raised if the file is not found.

Similar to Python’s os.path.abspath(), except more search paths than just os.getcwd() can be used, and the file must exist.

Parameter Definitions


search_paths = List(bounds=(0, None), default=['/home/runner/work/param/param/doc'], label='Search paths')

Prepended to a non-relative path, in order, until a file is found.

path_to_file = Boolean(allow_None=True, default=True, label='Path to file')

String specifying whether the path refers to a ‘File’ or a ‘Folder’. If None, the path may point to either a ‘File’ or a ‘Folder’.

__init__(**params)[source]#

Initialize a Parameterized instance with optional Parameter values.

Optional Parameter values must be supplied as keyword arguments (param_name=value), overriding their default values for this one instance. Any parameters not explicitly set will retain their defined default values.

If no name parameter is provided, the instance’s name attribute will default to an identifier string composed of the class name followed by an incremental 5-digit number.

Parameters:

**params – Optional keyword arguments mapping Parameter names to values.

Raises:

TypeError – If one of the keywords of params is not a Parameter name.

Examples

>>> import param
>>> class MyClass(param.Parameterized):
...     value = param.Number(default=10, bounds=(0, 20))
>>> obj = MyClass(value=15)

The value parameter is set to 15 for this instance, overriding the default.

Methods

__init__(**params)

Initialize a Parameterized instance with optional Parameter values.

instance(**params)

Create and return an instance of this class.

Attributes

name

param

path_to_file

search_paths