Esempio n. 1
0
 def requires_emit(self, resolver: Resolver,
                   queue: QueueScheduler) -> Dict[object, ResultVariable]:
     # FIXME: may be done more efficient?
     out = {
         self.name: resolver.lookup(self.full_name)
     }  # type : Dict[object, ResultVariable]
     return out
Esempio n. 2
0
 def requires_emit_gradual(
     self, resolver: Resolver, queue: QueueScheduler, resultcollector: ResultCollector
 ) -> Dict[object, ResultVariable]:
     var = resolver.lookup(self.full_name)
     var.listener(resultcollector, self.location)
     out = {self.name: var}  # type : Dict[object, ResultVariable]
     return out
Esempio n. 3
0
    def fetch_variable(
        self, requires: Dict[object, ResultVariable], resolver: Resolver, queue_scheduler: QueueScheduler
    ) -> ResultVariable:
        """
        Fetches the referred variable
        """
        if self.instance:
            # get the Instance
            obj = self.instance.execute({k: v.get_value() for k, v in requires.items()}, resolver, queue_scheduler)

            if isinstance(obj, list):
                raise RuntimeException(self, "can not get a attribute %s, %s is a list" % (self.attribute, obj))
            if not isinstance(obj, Instance):
                raise RuntimeException(self, "can not get a attribute %s, %s not an entity" % (self.attribute, obj))

            # get the attribute result variable
            return obj.get_attribute(self.attribute)
        else:
            return resolver.lookup(self.attribute)
Esempio n. 4
0
 def emit(self, resolver: Resolver, queue: QueueScheduler) -> None:
     target = resolver.lookup(self.name)
     reqs = self.value.requires_emit(resolver, queue)
     ExecutionUnit(queue, resolver, target, reqs, self.value)
Esempio n. 5
0
 def emit(self, resolver: Resolver, queue: QueueScheduler) -> None:
     self._add_to_dataflow_graph(resolver.dataflow_graph)
     target = resolver.lookup(str(self.name))
     assert isinstance(target, ResultVariable)
     reqs = self.value.requires_emit(resolver, queue)
     ExecutionUnit(queue, resolver, target, reqs, self.value, owner=self)