dulwich.ignore module¶
Parsing of gitignore files.
For details for the matching rules, see https://git-scm.com/docs/gitignore
- class dulwich.ignore.IgnoreFilter(patterns: Iterable[bytes], ignorecase: bool = False, path=None)¶
Bases:
object
- find_matching(path: Union[bytes, str]) Iterable[Pattern] ¶
Yield all matching patterns for path.
- Parameters
path – Path to match
- Returns
Iterator over iterators
- classmethod from_path(path, ignorecase: bool = False) IgnoreFilter ¶
- class dulwich.ignore.IgnoreFilterManager(top_path: str, global_filters: List[IgnoreFilter], ignorecase: bool)¶
Bases:
object
Ignore file manager.
- find_matching(path: str) Iterable[Pattern] ¶
Find matching patterns for path.
- Parameters
path – Path to check
- Returns
Iterator over Pattern instances
- classmethod from_repo(repo: Repo) IgnoreFilterManager ¶
Create a IgnoreFilterManager from a repository.
- Parameters
repo – Repository object
- Returns
A IgnoreFilterManager object
- class dulwich.ignore.IgnoreFilterStack(filters)¶
Bases:
object
Check for ignore status in multiple filters.
- class dulwich.ignore.Pattern(pattern: bytes, ignorecase: bool = False)¶
Bases:
object
A single ignore pattern.
- dulwich.ignore.default_user_ignore_filter_path(config: Config) str ¶
Return default user ignore filter path.
- Parameters
config – A Config object
- Returns
Path to a global ignore file
- dulwich.ignore.match_pattern(path: bytes, pattern: bytes, ignorecase: bool = False) bool ¶
Match a gitignore-style pattern against a path.
- Parameters
path – Path to match
pattern – Pattern to match
ignorecase – Whether to do case-sensitive matching
- Returns
bool indicating whether the pattern matched