MWPath#
- class lsst.daf.butler.cli.utils.MWPath(exists: 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: type | None = None)#
Bases:
PathOverrides
click.Pathto implement file-does-not-exist checking.Changes the definition of
existsso thatTrueindicates the location (file or directory) must exist,Falseindicates the location must not exist, andNoneindicates that the file may exist or not. The standard definition for theclick.Pathexistsparameter is that forTruea location must exist, butFalsemeans it is not required to exist (not that it is required to not exist).Parameters#
- exists
boolorNone, optional If
True, the location (file or directory) indicated by the caller must exist. IfFalsethe location must not exist. IfNone, the location may exist or not.- file_okay
bool, optional Allow a file as a value.
- dir_okay
bool, optional Allow a directory as a value.
- writable
bool, optional If
True, a writable check is performed.- readable
bool, optional If
True, a readable check is performed.- resolve_path
bool, optional Resolve the path.
- allow_dash
bool, optional Allow single dash as value to mean a standard stream.
- path_type
typeorNone, optional Convert the incoming value to this type.
Notes#
All parameters other than
existscome directly fromclick.Path.Methods Summary
convert(value, param, ctx)Convert values through types.
Methods Documentation
- convert(value: str | PathLike[str], param: Parameter | None, ctx: Context | None) Any#
Convert values through types.
Called by
click.ParamTypeto “convert values through types”.click.Pathuses this step to verify Path conditions.Parameters#
- value
stroros.PathLike File path.
- param
click.Parameter Parameters provided by Click.
- ctx
click.Context Context provided by Click.
- value
- exists