Beispiel #1
0
 def should_build(self):
     # see ModelPart.should_build()
     cond = self.model.condition
     if cond is None:
         return True
     cond = self._visitor.visit_cond(cond)
     try:
         return cond.as_py()
     except error.NonConstError:
         from bkl.interpreter.simplify import simplify
         cond = simplify(cond)
         raise error.CannotDetermineError("condition for building %s couldn't be resolved\n(condition \"%s\" set at %s)" %
                     (self.model, cond, cond.pos),
                     pos=self.model.source_pos)
Beispiel #2
0
 def should_build(self):
     # see ModelPart.should_build()
     cond = self.model.condition
     if cond is None:
         return True
     cond = self._visitor.visit_cond(cond)
     try:
         return cond.as_py()
     except error.NonConstError:
         from bkl.interpreter.simplify import simplify
         cond = simplify(cond)
         raise error.CannotDetermineError(
             "condition for building %s couldn't be resolved\n(condition \"%s\" set at %s)"
             % (self.model, cond, cond.pos),
             pos=self.model.source_pos)
Beispiel #3
0
 def should_build(self):
     """
     Evaluates the `condition` property on this part and returns True if it
     should be built or False otherwise. Throws NonConstError if it cannot
     be determined.
     """
     # see also ConfigurationProxy.should_build(), keep in sync!
     cond = self.condition
     if cond is None:
         return True
     try:
         return cond.as_py()
     except error.NonConstError:
         from bkl.interpreter.simplify import simplify
         cond = simplify(cond)
         raise error.CannotDetermineError("condition for building %s couldn't be resolved\n(condition \"%s\" set at %s)" %
                     (self, cond, cond.pos),
                     pos=self.source_pos)
Beispiel #4
0
 def should_build(self):
     """
     Evaluates the `condition` property on this part and returns True if it
     should be built or False otherwise. Throws NonConstError if it cannot
     be determined.
     """
     # see also ConfigurationProxy.should_build(), keep in sync!
     cond = self.condition
     if cond is None:
         return True
     try:
         return cond.as_py()
     except error.NonConstError:
         from bkl.interpreter.simplify import simplify
         cond = simplify(cond)
         raise error.CannotDetermineError(
             "condition for building %s couldn't be resolved\n(condition \"%s\" set at %s)"
             % (self, cond, cond.pos),
             pos=self.source_pos)