Skip to content

Commit

Permalink
Fix #70 incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Dec 3, 2022
1 parent 9adbcd2 commit 7865e9f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pathspec/gitignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Callable,
Collection,
Iterable,
TYPE_CHECKING,
Type,
TypeVar,
Union)

Expand All @@ -23,7 +23,11 @@
from .util import (
_is_iterable)

Self = TypeVar("Self")
Self = TypeVar("Self", bound="GitIgnoreSpec")
"""
:class:`GitIgnoreSpec` self type hint to support Python v<3.11 using PEP
673 recommendation.
"""


class GitIgnoreSpec(PathSpec):
Expand All @@ -47,7 +51,7 @@ def __eq__(self, other: object) -> bool:

@classmethod
def from_lines(
cls: type[Self],
cls: Type[Self],
lines: Iterable[AnyStr],
pattern_factory: Union[str, Callable[[AnyStr], Pattern], None] = None,
) -> Self:
Expand Down
10 changes: 7 additions & 3 deletions pathspec/pathspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Iterable,
Iterator,
Optional,
TYPE_CHECKING,
Type,
TypeVar,
Union)

Expand All @@ -30,7 +30,11 @@
match_file,
normalize_file)

Self = TypeVar("Self")
Self = TypeVar("Self", bound="PathSpec")
"""
:class:`PathSpec` self type hint to support Python v<3.11 using PEP 673
recommendation.
"""


class PathSpec(object):
Expand Down Expand Up @@ -94,7 +98,7 @@ def __iadd__(self: Self, other: "PathSpec") -> Self:

@classmethod
def from_lines(
cls: type[Self],
cls: Type[Self],
pattern_factory: Union[str, Callable[[AnyStr], Pattern]],
lines: Iterable[AnyStr],
) -> Self:
Expand Down

0 comments on commit 7865e9f

Please sign in to comment.