Exemple #1
0
 def from_xml(cls, element, document, **kwargs):  # @UnusedVariable
     # The only supported op at this stage
     dynamics_properties = from_child_xml(
         element, DynamicsProperties, document, **kwargs)
     analog_port_connections = from_child_xml(
         element, AnalogPortConnection, document, multiple=True,
         allow_none=True, **kwargs)
     event_port_connections = from_child_xml(
         element, EventPortConnection, document, multiple=True,
         allow_none=True, **kwargs)
     return cls(get_xml_attr(element, 'name', document, **kwargs),
                dynamics_properties, chain(analog_port_connections,
                                           event_port_connections))
Exemple #2
0
 def from_xml(cls, element, document, **kwargs):  # @UnusedVariable
     # The only supported op at this stage
     dynamics = from_child_xml(
         element, cls.wrapped_class, document, within='Cell',
         allow_reference=True, **kwargs)
     synapses = from_child_xml(
         element, Synapse, document, multiple=True, allow_none=True,
         **kwargs)
     parameter_sets = from_child_xml(
         element, ConnectionParameterSet, document, multiple=True,
         allow_none=True, **kwargs)
     name = get_xml_attr(element, 'name', document, **kwargs)
     return cls(name, dynamics, synapses, parameter_sets)
Exemple #3
0
 def from_xml(cls, element, document, **kwargs):  # @UnusedVariable @IgnorePep8
     # FIXME: Ideally Parameter should have from_xml method that calls
     #        the ComponentClassXMLLoader. To do this, the BaseALObject
     #        should be split into
     #        BaseDynamicsObject/BaseConnectionRuleObject/... and then they
     #        can each have a generic from_xml method that calls the right
     #        visitor
     # parameters = from_child_xml(
     #     element, Parameter, document, multiple=True, **kwargs)
     loader = ComponentClassXMLLoader(document, **kwargs)
     xmlns = extract_xmlns(element.tag)
     parameters = []
     for param_elem in element.findall(xmlns + Parameter.nineml_type):
         parameters.append(loader.load_parameter(param_elem))
     return cls(get_xml_attr(element, 'port', document, **kwargs),
                parameters)