def find_by_component(self, component, complete=True): """Finds all entities that have the component. Arguments: complete: If True, will attempt to collect the component. """ query = entity_query.Query(expression.ComponentLiteral(component)) if complete: self.collect_for(query) return list(self.lookup_tables["components"].lookup(component))
def FlattenComponentLiteral(*args, **kwargs): if not isinstance(args[0], expression.Binding): raise ValueError( "'has component' must be followed by a component. Got %s." % ( args[0])) return expression.ComponentLiteral(args[0].value, **kwargs)
def testHasComponent(self): query = "has component Process" expected = expression.ComponentLiteral("Process") self.assertQueryMatches(query, expected)