Пример #1
0
    def __init__(self, component):
        ComponentValidatorPerNamespace.__init__(self,
                                     explicitly_require_action_overrides=False)

        self.output_analogports = defaultdict(list)
        self.available_symbols = defaultdict(list)

        self.visit(component)

        for namespace, analogports in self.output_analogports.iteritems():
            for ap in analogports:
                if not ap in self.available_symbols[namespace]:
                    raise NineMLRuntimeError(
                        'Unable to find an Alias or State variable for '
                        'analog-port: %s' % ap)
Пример #2
0
    def __init__(self, component):
        ComponentValidatorPerNamespace.__init__(self,
                                     explicitly_require_action_overrides=False)

        # Mapping component to list of events/eventports at that component
        self.events_ports = defaultdict(dict)
        self.output_events = defaultdict(list)
        self.input_events = defaultdict(list)

        self.visit(component)

        # Check that each output event has a corresponding event_port with a
        # send mode:
        for ns, output_events in self.output_events.iteritems():
            for output_event in output_events:

                assert output_event in self.events_ports[ns], \
                          ("Can't find port definition matching OP-Event: %s" %
                           output_event)
                assert self.events_ports[ns][output_event].mode == 'send'

        # Check that each input event has a corresponding event_port with a
        # recv/reduce mode:
        for ns, input_events in self.input_events.iteritems():
            for input_event in input_events:
                assert input_event in self.events_ports[ns]
                assert self.events_ports[ns][input_event].mode in ('recv',
                                                                   'reduce')

        # Check that each Event port emits/recieves at least one
        for ns, event_ports in self.events_ports.iteritems():
            for evt_port_name in event_ports.keys():

                op_evts_on_port = [ev for ev in self.output_events[ns]
                                   if ev == evt_port_name]
                ip_evts_on_port = [ev for ev in self.input_events[ns]
                                   if ev == evt_port_name]

                if len(op_evts_on_port) + len(ip_evts_on_port) == 0:
                    print ('Unable to find events generated for: ', ns,
                           evt_port_name)