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

Method names2points_or_int

graph.py:565–582  ·  view source on GitHub ↗

Return Point objects given names.

(self, pnames: list[str])

Source from the content-addressed store, hash-verified

563 return result
564
565 def names2points_or_int(self, pnames: list[str]) -> list[Point]:
566 """Return Point objects given names."""
567 result = []
568 for name in pnames:
569 if name.isdigit():
570 result += [int(name)]
571 elif 'pi/' in name:
572 n, d = name.split('pi/')
573 ang, _ = self.get_or_create_const_ang(int(n), int(d))
574 result += [ang]
575 elif '/' in name:
576 n, d = name.split('/')
577 rat, _ = self.get_or_create_const_rat(int(n), int(d))
578 result += [rat]
579 else:
580 result += [self._name2point[name]]
581
582 return result
583
584 def get(self, pointname: str, default_fn: Callable[str, Point]) -> Point:
585 if pointname in self._name2point:

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected