Skip to content

Commit 0f25585

Browse files
committed
fix(types): a few updates to typing
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
1 parent 361b535 commit 0f25585

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

pathspec/pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __copy__(self: RegexPatternSelf) -> RegexPatternSelf:
183183
other.pattern = self.pattern
184184
return other
185185

186-
def __eq__(self, other: RegexPattern) -> bool:
186+
def __eq__(self, other: object) -> bool:
187187
"""
188188
Tests the equality of this regex pattern with *other* (:class:`RegexPattern`)
189189
by comparing their :attr:`~Pattern.include` and :attr:`~RegexPattern.regex`

pathspec/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ def detailed_match_files(
146146
# Add files and record pattern.
147147
for result_file in result_files:
148148
if result_file in return_files:
149+
# We know here that .patterns is a list, becasue we made it here
149150
if all_matches:
150-
return_files[result_file].patterns.append(pattern)
151+
return_files[result_file].patterns.append(pattern) # type: ignore[attr-defined]
151152
else:
152-
return_files[result_file].patterns[0] = pattern
153+
return_files[result_file].patterns[0] = pattern # type: ignore[index]
153154
else:
154155
return_files[result_file] = MatchDetail([pattern])
155156

0 commit comments

Comments
 (0)