roboto.paths#
Module Contents#
- roboto.paths.DOTFILE_PATTERN = '.**'#
Git wildmatch pattern for a path with any component that starts with a dot, e.g.
.envor.cache/run.bag. Triggers never run on these files, and file listings leave them out.
- roboto.paths.excludespec_from_patterns(exclude_patterns=None)#
Transform a list of Git wildmatch patterns into a pathspec.PathSpec.
- Parameters:
exclude_patterns (Optional[collections.abc.Iterable[str]])
- Return type:
Optional[pathspec.PathSpec]
- roboto.paths.is_dotfile_path(path)#
Whether
pathmatchesDOTFILE_PATTERN.- Parameters:
path (str)
- Return type:
bool
- roboto.paths.join_within(directory, relative_path)#
Return
directory / relative_path, refusing a path that resolves outsidedirectory.A file’s stored path comes from the server and is not trusted to stay inside the directory it is written to.
- Raises:
RobotoIllegalArgumentException –
relative_pathis absolute or climbs out ofdirectory.- Parameters:
directory (pathlib.Path)
relative_path (str)
- Return type:
pathlib.Path
- roboto.paths.path_matches(path, include_patterns=None, exclude_patterns=None)#
Does the given path match the given include pattern(s) and not match the given exclude pattern(s)?
- Parameters:
path (str)
include_patterns (Optional[collections.abc.Iterable[str]])
exclude_patterns (Optional[collections.abc.Iterable[str]])
- Return type:
bool
- roboto.paths.path_matches_specs(path, include_spec=None, exclude_spec=None)#
path_matches()for patterns already compiled withpathspec_from_patterns(), for callers that match many paths against the same patterns.- Parameters:
path (str)
include_spec (Optional[pathspec.PathSpec])
exclude_spec (Optional[pathspec.PathSpec])
- Return type:
bool
- roboto.paths.path_to_pattern(path)#
Transform a literal path into a Git wildmatch pattern that matches that literal path.
- Parameters:
path (str)
- Return type:
str
- roboto.paths.pathspec_from_patterns(patterns)#
Transform a list of Git wildmatch patterns into a pathspec.PathSpec.
- Parameters:
patterns (collections.abc.Iterable[str])
- Return type:
pathspec.PathSpec
- roboto.paths.pattern_to_like_value(pattern)#
- Parameters:
pattern (str)
- Return type:
str
- roboto.paths.patterns_to_condition_group(patterns, path_field_name, comparator, operator)#
Transform a list of Git wildmatch patterns into a ConditionGroup.
patternsmust be non-empty. An empty iterable yields a zero-condition group, whichConditionGrouprejects with aValueError; callers treat an empty pattern list as no filter and skip this call rather than passing it through.- Parameters:
patterns (collections.abc.Iterable[str])
path_field_name (str)
comparator (roboto.query.Comparator)
operator (roboto.query.ConditionOperator)
- Return type: