MWPath

class lsst.daf.butler.cli.utils.MWPath(exists: Optional[bool, None] = None, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: Optional[type, None] = None)

Bases: click.types.Path

Overrides click.Path to implement file-does-not-exist checking.

Changes the definition of exists` so that `True` indicates the location (file or directory) must exist, `False` indicates the location must *not* exist, and `None` indicates that the file may exist or not. The standard definition for the `click.Path` ``exists parameter is that for True a location must exist, but False means it is not required to exist (not that it is required to not exist).

Parameters:
exists : True, False, or None

If True, the location (file or directory) indicated by the caller must exist. If False the location must not exist. If None, the location may exist or not.

For other parameters see `click.Path`.

Attributes Summary

envvar_list_splitter
is_composite
name

Methods Summary

__call__(value[, param, ctx]) Call self as a function.
coerce_path_result(rv)
convert(value, param, None], ctx, None]) Called by click.ParamType to “convert values through types”.
fail(message[, param, ctx]) Helper method to fail with an invalid value message.
get_metavar(param) Returns the metavar default for this param if it provides one.
get_missing_message(param) Optionally might return extra information about a missing parameter.
split_envvar_value(rv) Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

Attributes Documentation

envvar_list_splitter = ':'
is_composite = False
name = None

Methods Documentation

__call__(value, param=None, ctx=None)

Call self as a function.

coerce_path_result(rv)
convert(value: str, param: click.core.Parameter | None[click.core.Parameter, None], ctx: click.core.Context | None[click.core.Context, None]) → Any

Called by click.ParamType to “convert values through types”. click.Path uses this step to verify Path conditions.

fail(message, param=None, ctx=None)

Helper method to fail with an invalid value message.

get_metavar(param)

Returns the metavar default for this param if it provides one.

get_missing_message(param)

Optionally might return extra information about a missing parameter.

New in version 2.0.

split_envvar_value(rv)

Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

If the splitter is set to None, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included.