Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.paths

Module Contents

DOTFILE_PATTERN

roboto.paths.DOTFILE_PATTERN = '.**'#View Source

Git wildmatch pattern for a path with any component that starts with a dot, e.g. .env or .cache/run.bag. Triggers never run on these files, and file listings leave them out.

excludespec_from_patterns()

roboto.paths.excludespec_from_patterns(exclude_patterns=None)#View Source

Transform a list of Git wildmatch patterns into a pathspec.PathSpec.

Parameters

exclude_patterns Optional[collections.abc.Iterable[str]]

Return type

Optional[pathspec.PathSpec]

is_dotfile_path()

roboto.paths.is_dotfile_path(path)#View Source

Whether path matches DOTFILE_PATTERN.

Parameters

path str

Return type

bool

join_within()

roboto.paths.join_within(directory, relative_path)#View Source

Return directory / relative_path, refusing a path that resolves outside directory.

A file’s stored path comes from the server and is not trusted to stay inside the directory it is written to.

Parameters

directory pathlib.Path
relative_path str

Raises

relative_path is absolute or climbs out of directory.

Return type

pathlib.Path

path_matches()

roboto.paths.path_matches(path, include_patterns=None, exclude_patterns=None)#View Source

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

path_matches_specs()

roboto.paths.path_matches_specs(path, include_spec=None, exclude_spec=None)#View Source

path_matches() for patterns already compiled with pathspec_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

path_to_pattern()

roboto.paths.path_to_pattern(path)#View Source

Transform a literal path into a Git wildmatch pattern that matches that literal path.

Parameters

path str

Return type

str

pathspec_from_patterns()

roboto.paths.pathspec_from_patterns(patterns)#View Source

Transform a list of Git wildmatch patterns into a pathspec.PathSpec.

Parameters

patterns collections.abc.Iterable[str]

Return type

pathspec.PathSpec

pattern_to_like_value()

roboto.paths.pattern_to_like_value(pattern)#View Source

Parameters

pattern str

Return type

str

patterns_to_condition_group()

roboto.paths.patterns_to_condition_group(patterns, path_field_name, comparator, operator)#View Source

Transform a list of Git wildmatch patterns into a ConditionGroup.

patterns must be non-empty. An empty iterable yields a zero-condition group, which ConditionGroup rejects with a ValueError; 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

Was this page helpful?