MCPcopy
hub / github.com/psf/black / _bare_name_matches

Method _bare_name_matches

src/blib2to3/pytree.py:877–892  ·  view source on GitHub ↗

Special optimized matcher for bare_name.

(self, nodes)

Source from the content-addressed store, hash-verified

875 results = new_results
876
877 def _bare_name_matches(self, nodes) -> tuple[int, _Results]:
878 """Special optimized matcher for bare_name."""
879 count = 0
880 r = {} # type: _Results
881 done = False
882 max = len(nodes)
883 while not done and count < max:
884 done = True
885 for leaf in self.content:
886 if leaf[0].match(nodes[count], r):
887 count += 1
888 done = False
889 break
890 assert self.name is not None
891 r[self.name] = nodes[:count]
892 return count, r
893
894 def _recursive_matches(self, nodes, count) -> Iterator[tuple[int, _Results]]:
895 """Helper to recursively yield the matches."""

Callers 1

generate_matchesMethod · 0.95

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected