| 1 |
""" |
| 2 |
.. version-deprecated: 1.0.0 |
| 3 |
This module is superseded by :module:`pathspec.patterns.gitignore`. |
| 4 |
""" |
| 5 |
|
| 6 |
from pathspec import util |
| 7 |
from pathspec._typing import ( |
| 8 |
deprecated, # Added in 3.13. |
| 9 |
override) # Added in 3.12. |
| 10 |
|
| 11 |
from .gitignore.spec import ( |
| 12 |
GitIgnoreSpecPattern) |
| 13 |
|
| 14 |
# DEPRECATED: Deprecated since version 1.0.0. Expose GitWildMatchPatternError |
| 15 |
# in this module for backward compatibility. |
| 16 |
from .gitignore import ( |
| 17 |
GitIgnorePatternError as GitWildMatchPatternError) |
| 18 |
|
| 19 |
|
| 20 |
class GitWildMatchPattern(GitIgnoreSpecPattern): |
| 21 |
""" |
| 22 |
.. version-deprecated:: 1.0.0 |
| 23 |
This class is superseded by :class:`GitIgnoreSpecPattern` and |
| 24 |
:class:`~pathspec.patterns.gitignore.basic.GitIgnoreBasicPattern`. |
| 25 |
""" |
| 26 |
|
| 27 |
@deprecated(( |
| 28 |
"GitWildMatchPattern ('gitwildmatch') is deprecated. Use 'gitignore' for " |
| 29 |
"GitIgnoreBasicPattern or GitIgnoreSpecPattern instead." |
| 30 |
)) |
| 31 |
def __init__(self, *args, **kw) -> None: |
| 32 |
""" |
| 33 |
Warn about deprecation. |
| 34 |
""" |
| 35 |
super().__init__(*args, **kw) |
| 36 |
|
| 37 |
@override |
| 38 |
@classmethod |
| 39 |
@deprecated(( |
| 40 |
"GitWildMatchPattern ('gitwildmatch') is deprecated. Use 'gitignore' for " |
| 41 |
"GitIgnoreBasicPattern or GitIgnoreSpecPattern instead." |
| 42 |
)) |
| 43 |
def pattern_to_regex(cls, *args, **kw): |
| 44 |
""" |
| 45 |
Warn about deprecation. |
| 46 |
""" |
| 47 |
return super().pattern_to_regex(*args, **kw) |
| 48 |
|
| 49 |
|
| 50 |
# DEPRECATED: Deprecated since version 1.0.0. Register GitWildMatchPattern as |
| 51 |
# "gitwildmatch" for backward compatibility. |
| 52 |
util.register_pattern('gitwildmatch', GitWildMatchPattern) |