From 0f25585c043dc547d929596dcb9ea1e18fdce94f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 6 Mar 2026 10:53:01 -0500 Subject: [PATCH] fix(types): a few updates to typing Signed-off-by: Henry Schreiner --- pathspec/pattern.py | 2 +- pathspec/util.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pathspec/pattern.py b/pathspec/pattern.py index a1803a8..394958c 100644 --- a/pathspec/pattern.py +++ b/pathspec/pattern.py @@ -183,7 +183,7 @@ def __copy__(self: RegexPatternSelf) -> RegexPatternSelf: other.pattern = self.pattern return other - def __eq__(self, other: RegexPattern) -> bool: + def __eq__(self, other: object) -> bool: """ Tests the equality of this regex pattern with *other* (:class:`RegexPattern`) by comparing their :attr:`~Pattern.include` and :attr:`~RegexPattern.regex` diff --git a/pathspec/util.py b/pathspec/util.py index ea2dbee..9a3f2c1 100644 --- a/pathspec/util.py +++ b/pathspec/util.py @@ -146,10 +146,11 @@ def detailed_match_files( # Add files and record pattern. for result_file in result_files: if result_file in return_files: + # We know here that .patterns is a list, becasue we made it here if all_matches: - return_files[result_file].patterns.append(pattern) + return_files[result_file].patterns.append(pattern) # type: ignore[attr-defined] else: - return_files[result_file].patterns[0] = pattern + return_files[result_file].patterns[0] = pattern # type: ignore[index] else: return_files[result_file] = MatchDetail([pattern])