@@ -420,7 +420,7 @@ class CombinedSearcher(AbstractSearcher):
420420 # could walk once and only run the searchers that could possibly match
421421 # at a given point using an O(1) type lookup -- which would generally cut
422422 # down the number of results.
423- searchers = attr .ib (type = Tuple [AbstractSearcher , ... ], converter = tuple , )
423+ searchers = attr .ib (type = Sequence [AbstractSearcher ], converter = tuple )
424424
425425 def parse (self , data : Text , filename : str ):
426426 """Parses using each sub-searcher, returning the most specific parsed file.
@@ -630,7 +630,7 @@ def find_dicts_parsed(
630630 def key_span_for_dict (
631631 self ,
632632 parsed : parsed_file .ParsedFile ,
633- match_dict : Iterable [ Mapping [MatchKey , match .Match ] ],
633+ match_dict : Mapping [MatchKey , match .Match ],
634634 ) -> Optional [Tuple [int , int ]]:
635635 """Returns the ``key_span`` that the final ``Substitution`` will have."""
636636 return None
@@ -682,12 +682,10 @@ def __attrs_post_init__(self):
682682 missing_labels = formatting .template_variables (
683683 self .templates ) - pattern_labels
684684 if missing_labels :
685+ groups = ', ' .join (f'`{ g } `' for g in sorted (map (str , missing_labels )))
685686 raise ValueError (
686- 'The substitution template(s) referenced groups not available in the regex (`{self._compiled.pattern}`): {groups}'
687- .format (
688- self = self ,
689- groups = ', ' .join (
690- '`{}`' .format (g ) for g in sorted (map (str , missing_labels )))))
687+ f'The substitution template(s) referenced groups not available in the regex (`{ self ._compiled .pattern } `): { groups } '
688+ )
691689
692690 @classmethod
693691 def from_pattern (cls , pattern : str , templates : Optional [Dict [str , formatting .Template ]]):
@@ -734,7 +732,7 @@ class BasePythonRewritingSearcher(BasePythonSearcher, BaseRewritingSearcher):
734732 _matcher = attr .ib ()
735733
736734 @classmethod
737- def from_matcher (cls , matcher , templates : Optional [ Dict [str , formatting .Template ] ]):
735+ def from_matcher (cls , matcher , templates : Dict [str , formatting .Template ]):
738736 """Creates a searcher from an evaluated matcher, and adds a root label."""
739737 # We wrap the evaluated matcher in a SystemBind() that is sort of like
740738 # "group 0" for regexes.
0 commit comments