1717from coverage import env
1818from coverage .exceptions import ConfigError
1919from coverage .misc import human_sorted , isolate_module , join_regex
20+ from coverage .types import TMatcher
2021
2122os = isolate_module (os )
2223
@@ -214,7 +215,7 @@ def prep_patterns(patterns: Iterable[str]) -> list[str]:
214215 return prepped
215216
216217
217- class TreeMatcher :
218+ class TreeMatcher ( TMatcher ) :
218219 """A matcher for files in a tree.
219220
220221 Construct with a list of paths, either files or directories. Paths match
@@ -235,7 +236,7 @@ def info(self) -> list[str]:
235236 """A list of strings for displaying when dumping state."""
236237 return self .original_paths
237238
238- def match (self , fpath : str ) -> bool :
239+ def match (self , fpath : str ) -> bool : # pylint: disable=arguments-renamed
239240 """Does `fpath` indicate a file in one of our trees?"""
240241 fpath = os .path .normcase (fpath )
241242 for p in self .paths :
@@ -249,7 +250,7 @@ def match(self, fpath: str) -> bool:
249250 return False
250251
251252
252- class ModuleMatcher :
253+ class ModuleMatcher ( TMatcher ) :
253254 """A matcher for modules in a tree."""
254255
255256 def __init__ (self , module_names : Iterable [str ], name : str = "unknown" ) -> None :
@@ -263,7 +264,7 @@ def info(self) -> list[str]:
263264 """A list of strings for displaying when dumping state."""
264265 return self .modules
265266
266- def match (self , module_name : str ) -> bool :
267+ def match (self , module_name : str ) -> bool : # pylint: disable=arguments-renamed
267268 """Does `module_name` indicate a module in one of our packages?"""
268269 if not module_name :
269270 return False
@@ -279,7 +280,7 @@ def match(self, module_name: str) -> bool:
279280 return False
280281
281282
282- class GlobMatcher :
283+ class GlobMatcher ( TMatcher ) :
283284 """A matcher for files by file name pattern."""
284285
285286 def __init__ (self , pats : Iterable [str ], name : str = "unknown" ) -> None :
@@ -294,7 +295,7 @@ def info(self) -> list[str]:
294295 """A list of strings for displaying when dumping state."""
295296 return self .pats
296297
297- def match (self , fpath : str ) -> bool :
298+ def match (self , fpath : str ) -> bool : # pylint: disable=arguments-renamed
298299 """Does `fpath` match one of our file name patterns?"""
299300 return self .re .match (fpath ) is not None
300301
0 commit comments