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

Method copy

src/blib2to3/pgen2/grammar.py:131–151  ·  view source on GitHub ↗

Copy the grammar.

(self: _P)

Source from the content-addressed store, hash-verified

129 self._update(pickle.loads(pkl))
130
131 def copy(self: _P) -> _P:
132 """
133 Copy the grammar.
134 """
135 new = self.__class__()
136 for dict_attr in (
137 "symbol2number",
138 "number2symbol",
139 "dfas",
140 "keywords",
141 "soft_keywords",
142 "tokens",
143 "symbol2label",
144 ):
145 setattr(new, dict_attr, getattr(self, dict_attr).copy())
146 new.labels = self.labels[:]
147 new.states = self.states[:]
148 new.start = self.start
149 new.version = self.version
150 new.async_keywords = self.async_keywords
151 return new
152
153 def report(self) -> None:
154 """Dump the grammar tables to standard output, for debugging."""

Callers 5

__init__Method · 0.80
do_transformMethod · 0.80
initializeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected