Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pathspec/patterns/gitignore/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ def pattern_to_regex(
"""
Convert the pattern into a regular expression.

Raises :class:`~pathspec.patterns.gitignore.base.GitIgnorePatternError`
for invalid patterns, including a bare ``!`` (also when followed by
unescaped trailing spaces) or an unmatched trailing backslash. Unlike
blank lines and comments, these inputs do not return ``(None, None)``.
Git accepts these lines without a diagnostic, so callers reading ignore
files must be prepared to handle this exception even when Git accepts
the file.

*pattern* (:class:`str` or :class:`bytes`) is the pattern to convert into a
regular expression.

Expand Down
8 changes: 8 additions & 0 deletions pathspec/patterns/gitignore/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ def pattern_to_regex(
"""
Convert the pattern into a regular expression.

Raises :class:`~pathspec.patterns.gitignore.base.GitIgnorePatternError`
for invalid patterns, including a bare ``!`` (also when followed by
unescaped trailing spaces) or an unmatched trailing backslash. Unlike
blank lines and comments, these inputs do not return ``(None, None)``.
Git accepts these lines without a diagnostic, so callers reading ignore
files must be prepared to handle this exception even when Git accepts
the file.

*pattern* (:class:`str` or :class:`bytes`) is the pattern to convert into a
regular expression.

Expand Down