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])