MCPcopy
hub / github.com/google-deepmind/mathematics_dataset / pop

Method pop

mathematics_dataset/util/composition.py:284–294  ·  view source on GitHub ↗

Returns an unused symbol (and keeps track of it being used).

(self)

Source from the content-addressed store, hash-verified

282 return self._child_entities[:]
283
284 def pop(self):
285 """Returns an unused symbol (and keeps track of it being used)."""
286 allowed = (_ALLOWED_SYMBOLS
287 .difference(self._relation_symbols)
288 .difference(self._self_symbols)
289 .difference(self._child_symbols))
290 if not allowed:
291 raise ValueError('Ran out of symbols')
292 symbol = random.choice(list(allowed))
293 self._self_symbols.add(symbol)
294 return symbol
295
296 def mark_used(self, symbol):
297 """Marks a given symbol as used."""

Callers 13

polynomial_rootsFunction · 0.95
_solve_linear_systemFunction · 0.95
sequence_next_termFunction · 0.95
sequence_nth_termFunction · 0.95
coefficient_namedFunction · 0.95
addFunction · 0.95
expandFunction · 0.95
collectFunction · 0.95
composeFunction · 0.95
simplify_powerFunction · 0.95
_polynomial_entityFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected