class documentation

Filter to apply gitignore patterns.

Important: When checking if directories are ignored, include a trailing slash. For example, use is_ignored("dir/") instead of is_ignored("dir").

Class Method from_path Create an IgnoreFilter from a file path.
Method __init__ Initialize an IgnoreFilter with a set of patterns.
Method __repr__ Return string representation of IgnoreFilter.
Method append_pattern Add a pattern to the set.
Method find_matching Yield all matching patterns for path.
Method is_ignored Check whether a path is ignored using Git-compliant logic.
Method _apply_parent_exclusion_rule Apply Git's parent directory exclusion rule.
Instance Variable _ignorecase Undocumented
Instance Variable _path Undocumented
Instance Variable _patterns Undocumented
def from_path(cls, path: str | os.PathLike[str], ignorecase: bool = False) -> IgnoreFilter:

Create an IgnoreFilter from a file path.

Parameters
path:str | os.PathLike[str]Path to the ignore file.
ignorecase:boolWhether to perform case-insensitive matching.
Returns
IgnoreFilterAn IgnoreFilter instance with patterns loaded from the file.
def __init__(self, patterns: Iterable[bytes], ignorecase: bool = False, path: str | None = None):

Initialize an IgnoreFilter with a set of patterns.

Parameters
patterns:Iterable[bytes]An iterable of gitignore patterns as bytes.
ignorecase:boolWhether to perform case-insensitive matching.
path:str | NoneOptional path to the ignore file for debugging purposes.
def __repr__(self) -> str:

Return string representation of IgnoreFilter.

def append_pattern(self, pattern: bytes):

Add a pattern to the set.

def find_matching(self, path: bytes | str) -> Iterable[Pattern]:

Yield all matching patterns for path.

Parameters
path:bytes | strPath to match
Returns
Iterable[Pattern]Iterator over iterators
def is_ignored(self, path: bytes | str) -> bool | None:

Check whether a path is ignored using Git-compliant logic.

For directories, include a trailing slash.

Returns: status is None if file is not mentioned, True if it is
included, False if it is explicitly excluded.
def _apply_parent_exclusion_rule(self, path: str, matching_patterns: list[Pattern]) -> bool:

Apply Git's parent directory exclusion rule.

"It is not possible to re-include a file if a parent directory of that file is excluded."

_ignorecase =

Undocumented

_path =

Undocumented

_patterns: list[Pattern] =

Undocumented