MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / _can_run

Method _can_run

misc/python/materialize/zippy/framework.py:287–301  ·  view source on GitHub ↗
(self, action: ActionOrFactory)

Source from the content-addressed store, hash-verified

285 return random.choices(actions_or_factories, weights=class_weights, k=1)[0]
286
287 def _can_run(self, action: ActionOrFactory) -> bool:
288 if any(
289 self._capabilities.provides(dislike)
290 for dislike in action.incompatible_with()
291 ):
292 return False
293
294 requires = action.requires()
295 if isinstance(requires, set):
296 return all(self._capabilities.provides(req) for req in requires)
297 else:
298 for one_alternative in requires:
299 if all(self._capabilities.provides(req) for req in one_alternative):
300 return True
301 return False
302
303 def _all_subclasses(self, cls: type[Action]) -> list[ActionOrFactory]:
304 """Return all Actions that are a subclass of the given cls."""

Callers 1

Calls 5

anyFunction · 0.85
allFunction · 0.85
providesMethod · 0.45
incompatible_withMethod · 0.45
requiresMethod · 0.45

Tested by

no test coverage detected