Example #1
0
 def __init__(self, component_class, expressions):
     BaseVisitor.__init__(self)
     # Expression can either be a single expression or an iterable of
     # expressions
     self.parameters = []
     self.ports = []
     self.constants = []
     self.random_variables = []
     self.expressions = []
     self._required_stack = []
     self._push_required_symbols(expressions)
     self.component_class = component_class
     self.visit(component_class)
Example #2
0
    def __init__(self, component_class, **kwargs):  # @UnusedVariable @IgnorePep8
        BaseVisitor.__init__(self)

        self.available_symbols = []
        self.aliases = []
        self.time_derivatives = []
        self.state_assignments = []
        self.component_class = component_class
        self.visit(component_class)

        # Check Aliases:
        for alias in self.aliases:
            for rhs_atom in alias.rhs_symbol_names:
                if rhs_atom in reserved_identifiers:
                    continue
                if rhs_atom not in self.available_symbols:
                    raise NineMLUsageError(
                        "Unresolved Symbol in Alias: {} [{}]"
                        .format(rhs_atom, alias))

        # Check TimeDerivatives:
        for timederivative in self.time_derivatives:
            for rhs_atom in timederivative.rhs_symbol_names:
                if (rhs_atom not in self.available_symbols and
                        rhs_atom not in reserved_identifiers):
                    raise NineMLUsageError(
                        "Unresolved Symbol in Time Derivative: {} [{}]"
                        .format(rhs_atom, timederivative))

        # Check StateAssignments
        for state_assignment in self.state_assignments:
            for rhs_atom in state_assignment.rhs_symbol_names:
                if (rhs_atom not in self.available_symbols and
                        rhs_atom not in reserved_identifiers):
                    raise NineMLUsageError(
                        'Unresolved Symbol in Assignment: {} [{}]'
                        .format(rhs_atom, state_assignment))
Example #3
0
 def __init__(self, component_class, **kwargs):  # @UnusedVariable
     BaseVisitor.__init__(self)
     self.dimensions = {}
     self.visit(component_class)
Example #4
0
 def __init__(self, component_class, **kwargs):  # @UnusedVariable
     BaseVisitor.__init__(self)
     self.symbols = []
     self.component_class = component_class
     self.visit(component_class)
Example #5
0
 def __init__(self, component_class, **kwargs):  # @UnusedVariable
     BaseVisitor.__init__(self)
     self.visit(component_class)
Example #6
0
 def __init__(self, component_class, as_class, **kwargs):
     BaseVisitor.__init__(self)
     self._dimensions = {}
     self.as_class = as_class
     self.visit(component_class, **kwargs)