MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / translate

Method translate

problem.py:97–108  ·  view source on GitHub ↗
(self, mapping: dict[str, str])

Source from the content-addressed store, hash-verified

95 self.constructions = constructions
96
97 def translate(self, mapping: dict[str, str]) -> Clause:
98 points0 = []
99 for p in self.points:
100 pcount = len(mapping) + 1
101 name = chr(96 + pcount)
102 if name > 'z': # pcount = 26 -> name = 'z'
103 name = chr(97 + (pcount - 1) % 26) + str((pcount - 1) // 26)
104
105 p0 = mapping.get(p, name)
106 mapping[p] = p0
107 points0.append(p0)
108 return Clause(points0, [c.translate(mapping) for c in self.constructions])
109
110 def add(self, name: str, args: list[str]) -> None:
111 self.constructions.append(Construction(name, args))

Callers 1

translateMethod · 0.45

Calls 2

ClauseClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected