Skip to content

Commit bc7b0e3

Browse files
committed
refactor: positional-only args are better than pragmas
Type checkers don't like the subclasses using different names for arguments, so mark the methods as positional-only to keep the names from mattering. They are called as positional as a parent class object anyway.
1 parent 52afd6b commit bc7b0e3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎coverage/files.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def __repr__(self) -> str:
237237
return f"<{self.__class__.__name__} {self.name} {self.strs!r}>"
238238

239239
@abc.abstractmethod
240-
def match(self, s: str) -> bool:
240+
def match(self, s: str, /) -> bool:
241241
"""Does this string match?"""
242242

243243
def info(self) -> list[str]:
@@ -270,7 +270,7 @@ def __init__(
270270
debug(f" Normalized {p!r} to {ap!r}")
271271
self.paths.append(ap)
272272

273-
def match(self, fpath: str) -> bool: # pylint: disable=arguments-renamed
273+
def match(self, fpath: str, /) -> bool:
274274
"""Does `fpath` indicate a file in one of our trees?"""
275275
fpath = abs_file(fpath)
276276
for p in self.paths:
@@ -297,7 +297,7 @@ def __init__(
297297
self.modules = list(module_names)
298298
super().__init__(self.modules, name=name, caption=caption, debug=debug)
299299

300-
def match(self, module_name: str) -> bool: # pylint: disable=arguments-renamed
300+
def match(self, module_name: str, /) -> bool:
301301
"""Does `module_name` indicate a module in one of our packages?"""
302302
if not module_name:
303303
return False
@@ -327,7 +327,7 @@ def __init__(
327327
super().__init__(self.pats, name=name, caption=caption, debug=debug)
328328
self.re = globs_to_regex(self.pats, case_insensitive=env.WINDOWS)
329329

330-
def match(self, fpath: str) -> bool: # pylint: disable=arguments-renamed
330+
def match(self, fpath: str, /) -> bool:
331331
"""Does `fpath` match one of our file name patterns?"""
332332
return self.re.match(fpath) is not None
333333

0 commit comments

Comments
 (0)