repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_component_type | def parse_component_type(self, node):
"""
Parses <ComponentType>
@param node: Node containing the <ComponentType> element
@type node: xml.etree.Element
@raise ParseError: Raised when the component type does not have a
name.
"""
try:
name = n... | python | def parse_component_type(self, node):
"""
Parses <ComponentType>
@param node: Node containing the <ComponentType> element
@type node: xml.etree.Element
@raise ParseError: Raised when the component type does not have a
name.
"""
try:
name = n... | [
"def",
"parse_component_type",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<ComponentType> must specify a name'",
")",
"if",
"'extends'",
"in",
"no... | Parses <ComponentType>
@param node: Node containing the <ComponentType> element
@type node: xml.etree.Element
@raise ParseError: Raised when the component type does not have a
name. | [
"Parses",
"<ComponentType",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L552-L583 | train | Parses the component type element and adds it to the current component type list. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_constant | def parse_constant(self, node):
"""
Parses <Constant>
@param node: Node containing the <Constant> element
@type node: xml.etree.Element
"""
try:
name = node.lattrib['name']
except:
self.raise_error('<Constant> must specify a name.')
... | python | def parse_constant(self, node):
"""
Parses <Constant>
@param node: Node containing the <Constant> element
@type node: xml.etree.Element
"""
try:
name = node.lattrib['name']
except:
self.raise_error('<Constant> must specify a name.')
... | [
"def",
"parse_constant",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<Constant> must specify a name.'",
")",
"dimension",
"=",
"node",
".",
"latt... | Parses <Constant>
@param node: Node containing the <Constant> element
@type node: xml.etree.Element | [
"Parses",
"<Constant",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L585-L612 | train | Parses the Constant element and adds it to the current component type if it is not already there. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_data_display | def parse_data_display(self, node):
"""
Parses <DataDisplay>
@param node: Node containing the <DataDisplay> element
@type node: xml.etree.Element
"""
if 'title' in node.lattrib:
title = node.lattrib['title']
else:
self.raise_error('<DataD... | python | def parse_data_display(self, node):
"""
Parses <DataDisplay>
@param node: Node containing the <DataDisplay> element
@type node: xml.etree.Element
"""
if 'title' in node.lattrib:
title = node.lattrib['title']
else:
self.raise_error('<DataD... | [
"def",
"parse_data_display",
"(",
"self",
",",
"node",
")",
":",
"if",
"'title'",
"in",
"node",
".",
"lattrib",
":",
"title",
"=",
"node",
".",
"lattrib",
"[",
"'title'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<DataDisplay> must have a title.'"... | Parses <DataDisplay>
@param node: Node containing the <DataDisplay> element
@type node: xml.etree.Element | [
"Parses",
"<DataDisplay",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L614-L632 | train | Parses the data display element and adds it to the current simulation. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_data_writer | def parse_data_writer(self, node):
"""
Parses <DataWriter>
@param node: Node containing the <DataWriter> element
@type node: xml.etree.Element
"""
if 'path' in node.lattrib:
path = node.lattrib['path']
else:
self.raise_error('<DataWriter>... | python | def parse_data_writer(self, node):
"""
Parses <DataWriter>
@param node: Node containing the <DataWriter> element
@type node: xml.etree.Element
"""
if 'path' in node.lattrib:
path = node.lattrib['path']
else:
self.raise_error('<DataWriter>... | [
"def",
"parse_data_writer",
"(",
"self",
",",
"node",
")",
":",
"if",
"'path'",
"in",
"node",
".",
"lattrib",
":",
"path",
"=",
"node",
".",
"lattrib",
"[",
"'path'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<DataWriter> must specify a path.'",
... | Parses <DataWriter>
@param node: Node containing the <DataWriter> element
@type node: xml.etree.Element | [
"Parses",
"<DataWriter",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L634-L653 | train | Parses the data writer element and adds it to the current simulation. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_event_writer | def parse_event_writer(self, node):
"""
Parses <EventWriter>
@param node: Node containing the <EventWriter> element
@type node: xml.etree.Element
"""
if 'path' in node.lattrib:
path = node.lattrib['path']
else:
self.raise_error('<EventWri... | python | def parse_event_writer(self, node):
"""
Parses <EventWriter>
@param node: Node containing the <EventWriter> element
@type node: xml.etree.Element
"""
if 'path' in node.lattrib:
path = node.lattrib['path']
else:
self.raise_error('<EventWri... | [
"def",
"parse_event_writer",
"(",
"self",
",",
"node",
")",
":",
"if",
"'path'",
"in",
"node",
".",
"lattrib",
":",
"path",
"=",
"node",
".",
"lattrib",
"[",
"'path'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<EventWriter> must specify a path.'",... | Parses <EventWriter>
@param node: Node containing the <EventWriter> element
@type node: xml.etree.Element | [
"Parses",
"<EventWriter",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L655-L680 | train | Parses the event writer element and adds it to the simulation. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_derived_parameter | def parse_derived_parameter(self, node):
"""
Parses <DerivedParameter>
@param node: Node containing the <DerivedParameter> element
@type node: xml.etree.Element
"""
#if self.current_context.context_type != Context.COMPONENT_TYPE:
# self.raise_error('Dynamics ... | python | def parse_derived_parameter(self, node):
"""
Parses <DerivedParameter>
@param node: Node containing the <DerivedParameter> element
@type node: xml.etree.Element
"""
#if self.current_context.context_type != Context.COMPONENT_TYPE:
# self.raise_error('Dynamics ... | [
"def",
"parse_derived_parameter",
"(",
"self",
",",
"node",
")",
":",
"#if self.current_context.context_type != Context.COMPONENT_TYPE:",
"# self.raise_error('Dynamics must be defined inside a ' +",
"# 'component type')",
"if",
"'name'",
"in",
"node",
".",
"lat... | Parses <DerivedParameter>
@param node: Node containing the <DerivedParameter> element
@type node: xml.etree.Element | [
"Parses",
"<DerivedParameter",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L682-L715 | train | Parses the derived parameter element and adds it to the current component type |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_derived_variable | def parse_derived_variable(self, node):
"""
Parses <DerivedVariable>
@param node: Node containing the <DerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name of specified for the derived variable.
"""
if 'name' in node.lat... | python | def parse_derived_variable(self, node):
"""
Parses <DerivedVariable>
@param node: Node containing the <DerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name of specified for the derived variable.
"""
if 'name' in node.lat... | [
"def",
"parse_derived_variable",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"elif",
"'exposure'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node... | Parses <DerivedVariable>
@param node: Node containing the <DerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name of specified for the derived variable. | [
"Parses",
"<DerivedVariable",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L717-L739 | train | Parses the derived variable element and adds it to the current regime |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_conditional_derived_variable | def parse_conditional_derived_variable(self, node):
"""
Parses <ConditionalDerivedVariable>
@param node: Node containing the <ConditionalDerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name or value is specified for the conditional deriv... | python | def parse_conditional_derived_variable(self, node):
"""
Parses <ConditionalDerivedVariable>
@param node: Node containing the <ConditionalDerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name or value is specified for the conditional deriv... | [
"def",
"parse_conditional_derived_variable",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"elif",
"'exposure'",
"in",
"node",
".",
"lattrib",
":",
"name",
... | Parses <ConditionalDerivedVariable>
@param node: Node containing the <ConditionalDerivedVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when no name or value is specified for the conditional derived variable. | [
"Parses",
"<ConditionalDerivedVariable",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L742-L775 | train | Parses the conditional derived variable element and adds it to the registry |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_case | def parse_case(self, node):
"""
Parses <Case>
@param node: Node containing the <Case> element
@type node: xml.etree.Element
@raise ParseError: When no condition or value is specified
"""
try:
condition = node.lattrib['condition']
exc... | python | def parse_case(self, node):
"""
Parses <Case>
@param node: Node containing the <Case> element
@type node: xml.etree.Element
@raise ParseError: When no condition or value is specified
"""
try:
condition = node.lattrib['condition']
exc... | [
"def",
"parse_case",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"condition",
"=",
"node",
".",
"lattrib",
"[",
"'condition'",
"]",
"except",
":",
"condition",
"=",
"None",
"try",
":",
"value",
"=",
"node",
".",
"lattrib",
"[",
"'value'",
"]",
"e... | Parses <Case>
@param node: Node containing the <Case> element
@type node: xml.etree.Element
@raise ParseError: When no condition or value is specified | [
"Parses",
"<Case",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L778-L798 | train | Parses the case element containing the node containing the element
|
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_dimension | def parse_dimension(self, node):
"""
Parses <Dimension>
@param node: Node containing the <Dimension> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or if the
dimension is not a signed integer.
"""
try:
... | python | def parse_dimension(self, node):
"""
Parses <Dimension>
@param node: Node containing the <Dimension> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or if the
dimension is not a signed integer.
"""
try:
... | [
"def",
"parse_dimension",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<Dimension> must specify a name'",
")",
"description",
"=",
"node",
".",
"l... | Parses <Dimension>
@param node: Node containing the <Dimension> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or if the
dimension is not a signed integer. | [
"Parses",
"<Dimension",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L800-L822 | train | Parses the Dimension element and adds it to the internal dictionary. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_dynamics | def parse_dynamics(self, node):
"""
Parses <Dynamics>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element
"""
self.current_dynamics = self.current_component_type.dynamics
self.current_regime = self.current_dynamics
self.pro... | python | def parse_dynamics(self, node):
"""
Parses <Dynamics>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element
"""
self.current_dynamics = self.current_component_type.dynamics
self.current_regime = self.current_dynamics
self.pro... | [
"def",
"parse_dynamics",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"current_dynamics",
"=",
"self",
".",
"current_component_type",
".",
"dynamics",
"self",
".",
"current_regime",
"=",
"self",
".",
"current_dynamics",
"self",
".",
"process_nested_tags",
"(... | Parses <Dynamics>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element | [
"Parses",
"<Dynamics",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L824-L836 | train | Parses the Dynamics object from the xml. etree. Element node. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_event_connection | def parse_event_connection(self, node):
"""
Parses <EventConnection>
@param node: Node containing the <EventConnection> element
@type node: xml.etree.Element
"""
if 'from' in node.lattrib:
from_ = node.lattrib['from']
else:
self.raise_err... | python | def parse_event_connection(self, node):
"""
Parses <EventConnection>
@param node: Node containing the <EventConnection> element
@type node: xml.etree.Element
"""
if 'from' in node.lattrib:
from_ = node.lattrib['from']
else:
self.raise_err... | [
"def",
"parse_event_connection",
"(",
"self",
",",
"node",
")",
":",
"if",
"'from'",
"in",
"node",
".",
"lattrib",
":",
"from_",
"=",
"node",
".",
"lattrib",
"[",
"'from'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<EventConnection> must provide a... | Parses <EventConnection>
@param node: Node containing the <EventConnection> element
@type node: xml.etree.Element | [
"Parses",
"<EventConnection",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L838-L862 | train | Parses the EventConnection element and adds it to the event structure. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_event_out | def parse_event_out(self, node):
"""
Parses <EventOut>
@param node: Node containing the <EventOut> element
@type node: xml.etree.Element
"""
try:
port = node.lattrib['port']
except:
self.raise_error('<EventOut> must be specify a port.')
... | python | def parse_event_out(self, node):
"""
Parses <EventOut>
@param node: Node containing the <EventOut> element
@type node: xml.etree.Element
"""
try:
port = node.lattrib['port']
except:
self.raise_error('<EventOut> must be specify a port.')
... | [
"def",
"parse_event_out",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"port",
"=",
"node",
".",
"lattrib",
"[",
"'port'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<EventOut> must be specify a port.'",
")",
"action",
"=",
"EventOut",
"(",
... | Parses <EventOut>
@param node: Node containing the <EventOut> element
@type node: xml.etree.Element | [
"Parses",
"<EventOut",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L864-L879 | train | Parses the EventOut element and adds it to the event handler. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_event_port | def parse_event_port(self, node):
"""
Parses <EventPort>
@param node: Node containing the <EventPort> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error(('<EventPort> mu... | python | def parse_event_port(self, node):
"""
Parses <EventPort>
@param node: Node containing the <EventPort> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error(('<EventPort> mu... | [
"def",
"parse_event_port",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"(",
"'<EventPort> must specify a name.... | Parses <EventPort>
@param node: Node containing the <EventPort> element
@type node: xml.etree.Element | [
"Parses",
"<EventPort",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L881-L906 | train | Parses the EventPort element and adds it to the event_type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_exposure | def parse_exposure(self, node):
"""
Parses <Exposure>
@param node: Node containing the <Exposure> element
@type node: xml.etree.Element
@raise ParseError: Raised when the exposure name is not
being defined in the context of a component type.
"""
if self... | python | def parse_exposure(self, node):
"""
Parses <Exposure>
@param node: Node containing the <Exposure> element
@type node: xml.etree.Element
@raise ParseError: Raised when the exposure name is not
being defined in the context of a component type.
"""
if self... | [
"def",
"parse_exposure",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_component_type",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'Exposures must be defined in a component type'",
")",
"try",
":",
"name",
"=",
"node",
".",
"lattrib",... | Parses <Exposure>
@param node: Node containing the <Exposure> element
@type node: xml.etree.Element
@raise ParseError: Raised when the exposure name is not
being defined in the context of a component type. | [
"Parses",
"<Exposure",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L908-L935 | train | Parses the exposure element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_fixed | def parse_fixed(self, node):
"""
Parses <Fixed>
@param node: Node containing the <Fixed> element
@type node: xml.etree.Element
"""
try:
parameter = node.lattrib['parameter']
except:
self.raise_error('<Fixed> must specify a parameter to be... | python | def parse_fixed(self, node):
"""
Parses <Fixed>
@param node: Node containing the <Fixed> element
@type node: xml.etree.Element
"""
try:
parameter = node.lattrib['parameter']
except:
self.raise_error('<Fixed> must specify a parameter to be... | [
"def",
"parse_fixed",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"parameter",
"=",
"node",
".",
"lattrib",
"[",
"'parameter'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<Fixed> must specify a parameter to be fixed.'",
")",
"try",
":",
"value"... | Parses <Fixed>
@param node: Node containing the <Fixed> element
@type node: xml.etree.Element | [
"Parses",
"<Fixed",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L937-L957 | train | Parses the fixed element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_for_each | def parse_for_each(self, node):
"""
Parses <ForEach>
@param node: Node containing the <ForEach> element
@type node: xml.etree.Element
"""
if self.current_structure == None:
self.raise_error('<ForEach> can only be made within ' +
... | python | def parse_for_each(self, node):
"""
Parses <ForEach>
@param node: Node containing the <ForEach> element
@type node: xml.etree.Element
"""
if self.current_structure == None:
self.raise_error('<ForEach> can only be made within ' +
... | [
"def",
"parse_for_each",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_structure",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'<ForEach> can only be made within '",
"+",
"'a structure definition'",
")",
"if",
"'instances'",
"in",
"node"... | Parses <ForEach>
@param node: Node containing the <ForEach> element
@type node: xml.etree.Element | [
"Parses",
"<ForEach",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L959-L990 | train | Parses the ForEach element and adds it to the current structure. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_include | def parse_include(self, node):
"""
Parses <Include>
@param node: Node containing the <Include> element
@type node: xml.etree.Element
@raise ParseError: Raised when the file to be included is not specified.
"""
if not self.include_includes:
if self.m... | python | def parse_include(self, node):
"""
Parses <Include>
@param node: Node containing the <Include> element
@type node: xml.etree.Element
@raise ParseError: Raised when the file to be included is not specified.
"""
if not self.include_includes:
if self.m... | [
"def",
"parse_include",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"self",
".",
"include_includes",
":",
"if",
"self",
".",
"model",
".",
"debug",
":",
"print",
"(",
"\"Ignoring included LEMS file: %s\"",
"%",
"node",
".",
"lattrib",
"[",
"'file'",
"... | Parses <Include>
@param node: Node containing the <Include> element
@type node: xml.etree.Element
@raise ParseError: Raised when the file to be included is not specified. | [
"Parses",
"<Include",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L992-L1013 | train | Parses the include element and returns the class ID of the include element. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_kinetic_scheme | def parse_kinetic_scheme(self, node):
"""
Parses <KineticScheme>
@param node: Node containing the <KineticScheme> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Ki... | python | def parse_kinetic_scheme(self, node):
"""
Parses <KineticScheme>
@param node: Node containing the <KineticScheme> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Ki... | [
"def",
"parse_kinetic_scheme",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<KineticScheme> must specify a name... | Parses <KineticScheme>
@param node: Node containing the <KineticScheme> element
@type node: xml.etree.Element | [
"Parses",
"<KineticScheme",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1015-L1065 | train | Parses the kinetic scheme element and adds it to the current regime. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_link | def parse_link(self, node):
"""
Parses <Link>
@param node: Node containing the <Link> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Link> must specify a name')
... | python | def parse_link(self, node):
"""
Parses <Link>
@param node: Node containing the <Link> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Link> must specify a name')
... | [
"def",
"parse_link",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Link> must specify a name'",
")",
"if",
... | Parses <Link>
@param node: Node containing the <Link> element
@type node: xml.etree.Element | [
"Parses",
"<Link",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1067-L1087 | train | Parses the Link element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_multi_instantiate | def parse_multi_instantiate(self, node):
"""
Parses <MultiInstantiate>
@param node: Node containing the <MultiInstantiate> element
@type node: xml.etree.Element
"""
if 'component' in node.lattrib:
component = node.lattrib['component']
else:
... | python | def parse_multi_instantiate(self, node):
"""
Parses <MultiInstantiate>
@param node: Node containing the <MultiInstantiate> element
@type node: xml.etree.Element
"""
if 'component' in node.lattrib:
component = node.lattrib['component']
else:
... | [
"def",
"parse_multi_instantiate",
"(",
"self",
",",
"node",
")",
":",
"if",
"'component'",
"in",
"node",
".",
"lattrib",
":",
"component",
"=",
"node",
".",
"lattrib",
"[",
"'component'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<MultiInstantiate... | Parses <MultiInstantiate>
@param node: Node containing the <MultiInstantiate> element
@type node: xml.etree.Element | [
"Parses",
"<MultiInstantiate",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1089-L1108 | train | Parses the MultiInstantiate element and adds it to the current structure. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_on_condition | def parse_on_condition(self, node):
"""
Parses <OnCondition>
@param node: Node containing the <OnCondition> element
@type node: xml.etree.Element
"""
try:
test = node.lattrib['test']
except:
self.raise_error('<OnCondition> must specify a ... | python | def parse_on_condition(self, node):
"""
Parses <OnCondition>
@param node: Node containing the <OnCondition> element
@type node: xml.etree.Element
"""
try:
test = node.lattrib['test']
except:
self.raise_error('<OnCondition> must specify a ... | [
"def",
"parse_on_condition",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"test",
"=",
"node",
".",
"lattrib",
"[",
"'test'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<OnCondition> must specify a test.'",
")",
"event_handler",
"=",
"OnConditio... | Parses <OnCondition>
@param node: Node containing the <OnCondition> element
@type node: xml.etree.Element | [
"Parses",
"<OnCondition",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1110-L1129 | train | Parses the OnCondition element and sets the event handler and the event handler attribute. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_on_entry | def parse_on_entry(self, node):
"""
Parses <OnEntry>
@param node: Node containing the <OnEntry> element
@type node: xml.etree.Element
"""
event_handler = OnEntry()
self.current_event_handler = event_handler
self.current_regime.add_event_handler(event_ha... | python | def parse_on_entry(self, node):
"""
Parses <OnEntry>
@param node: Node containing the <OnEntry> element
@type node: xml.etree.Element
"""
event_handler = OnEntry()
self.current_event_handler = event_handler
self.current_regime.add_event_handler(event_ha... | [
"def",
"parse_on_entry",
"(",
"self",
",",
"node",
")",
":",
"event_handler",
"=",
"OnEntry",
"(",
")",
"self",
".",
"current_event_handler",
"=",
"event_handler",
"self",
".",
"current_regime",
".",
"add_event_handler",
"(",
"event_handler",
")",
"self",
".",
... | Parses <OnEntry>
@param node: Node containing the <OnEntry> element
@type node: xml.etree.Element | [
"Parses",
"<OnEntry",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1131-L1146 | train | Parses the OnEntry element and sets the event handler to the event handler that is added to the registry. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_on_event | def parse_on_event(self, node):
"""
Parses <OnEvent>
@param node: Node containing the <OnEvent> element
@type node: xml.etree.Element
"""
try:
port = node.lattrib['port']
except:
self.raise_error('<OnEvent> must specify a port.')
... | python | def parse_on_event(self, node):
"""
Parses <OnEvent>
@param node: Node containing the <OnEvent> element
@type node: xml.etree.Element
"""
try:
port = node.lattrib['port']
except:
self.raise_error('<OnEvent> must specify a port.')
... | [
"def",
"parse_on_event",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"port",
"=",
"node",
".",
"lattrib",
"[",
"'port'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<OnEvent> must specify a port.'",
")",
"event_handler",
"=",
"OnEvent",
"(",
... | Parses <OnEvent>
@param node: Node containing the <OnEvent> element
@type node: xml.etree.Element | [
"Parses",
"<OnEvent",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1148-L1167 | train | Parses the OnEvent element and sets the event handler attribute. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_on_start | def parse_on_start(self, node):
"""
Parses <OnStart>
@param node: Node containing the <OnStart> element
@type node: xml.etree.Element
"""
event_handler = OnStart()
self.current_regime.add_event_handler(event_handler)
self.current_event_handler = event_... | python | def parse_on_start(self, node):
"""
Parses <OnStart>
@param node: Node containing the <OnStart> element
@type node: xml.etree.Element
"""
event_handler = OnStart()
self.current_regime.add_event_handler(event_handler)
self.current_event_handler = event_... | [
"def",
"parse_on_start",
"(",
"self",
",",
"node",
")",
":",
"event_handler",
"=",
"OnStart",
"(",
")",
"self",
".",
"current_regime",
".",
"add_event_handler",
"(",
"event_handler",
")",
"self",
".",
"current_event_handler",
"=",
"event_handler",
"self",
".",
... | Parses <OnStart>
@param node: Node containing the <OnStart> element
@type node: xml.etree.Element | [
"Parses",
"<OnStart",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1169-L1183 | train | Parses the OnStart element and sets the event handler to the object that is passed to the event handler. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_parameter | def parse_parameter(self, node):
"""
Parses <Parameter>
@param node: Node containing the <Parameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the parameter does not have a name.
@raise ParseError: Raised when the parameter does not have a
... | python | def parse_parameter(self, node):
"""
Parses <Parameter>
@param node: Node containing the <Parameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the parameter does not have a name.
@raise ParseError: Raised when the parameter does not have a
... | [
"def",
"parse_parameter",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_component_type",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'Parameters can only be defined in '",
"+",
"'a component type'",
")",
"try",
":",
"name",
"=",
"node"... | Parses <Parameter>
@param node: Node containing the <Parameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the parameter does not have a name.
@raise ParseError: Raised when the parameter does not have a
dimension. | [
"Parses",
"<Parameter",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1185-L1214 | train | Parses the parameter element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_property | def parse_property(self, node):
"""
Parses <Property>
@param node: Node containing the <Property> element
@type node: xml.etree.Element
@raise ParseError: Raised when the property does not have a name.
@raise ParseError: Raised when the property does not have a
... | python | def parse_property(self, node):
"""
Parses <Property>
@param node: Node containing the <Property> element
@type node: xml.etree.Element
@raise ParseError: Raised when the property does not have a name.
@raise ParseError: Raised when the property does not have a
... | [
"def",
"parse_property",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_component_type",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'Property can only be defined in '",
"+",
"'a component type'",
")",
"try",
":",
"name",
"=",
"node",
... | Parses <Property>
@param node: Node containing the <Property> element
@type node: xml.etree.Element
@raise ParseError: Raised when the property does not have a name.
@raise ParseError: Raised when the property does not have a
dimension. | [
"Parses",
"<Property",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1216-L1247 | train | Parses the property from the xml. etree. Element node containing the property name and dimension. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_index_parameter | def parse_index_parameter(self, node):
"""
Parses <IndexParameter>
@param node: Node containing the <IndexParameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the IndexParameter does not have a name.
"""
if self.current_component_type... | python | def parse_index_parameter(self, node):
"""
Parses <IndexParameter>
@param node: Node containing the <IndexParameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the IndexParameter does not have a name.
"""
if self.current_component_type... | [
"def",
"parse_index_parameter",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_component_type",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'IndexParameters can only be defined in '",
"+",
"'a component type'",
")",
"try",
":",
"name",
"=... | Parses <IndexParameter>
@param node: Node containing the <IndexParameter> element
@type node: xml.etree.Element
@raise ParseError: Raised when the IndexParameter does not have a name. | [
"Parses",
"<IndexParameter",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1250-L1272 | train | Parses the index parameter element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_tunnel | def parse_tunnel(self, node):
"""
Parses <Tunnel>
@param node: Node containing the <Tunnel> element
@type node: xml.etree.Element
@raise ParseError: Raised when the Tunnel does not have a name.
"""
try:
name = node.lattrib['name']
except:
... | python | def parse_tunnel(self, node):
"""
Parses <Tunnel>
@param node: Node containing the <Tunnel> element
@type node: xml.etree.Element
@raise ParseError: Raised when the Tunnel does not have a name.
"""
try:
name = node.lattrib['name']
except:
... | [
"def",
"parse_tunnel",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'<Tunnel> must specify a name'",
")",
"try",
":",
"end_a",
"=",
"node",
".",
... | Parses <Tunnel>
@param node: Node containing the <Tunnel> element
@type node: xml.etree.Element
@raise ParseError: Raised when the Tunnel does not have a name. | [
"Parses",
"<Tunnel",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1275-L1309 | train | Parses the Tunnel element and adds it to the current structure. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_path | def parse_path(self, node):
"""
Parses <Path>
@param node: Node containing the <Path> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Path> must specify a name.')
... | python | def parse_path(self, node):
"""
Parses <Path>
@param node: Node containing the <Path> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Path> must specify a name.')
... | [
"def",
"parse_path",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Path> must specify a name.'",
")",
"desc... | Parses <Path>
@param node: Node containing the <Path> element
@type node: xml.etree.Element | [
"Parses",
"<Path",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1312-L1327 | train | Parses the path element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_record | def parse_record(self, node):
"""
Parses <Record>
@param node: Node containing the <Record> element
@type node: xml.etree.Element
"""
if self.current_simulation == None:
self.raise_error('<Record> must be only be used inside a ' +
... | python | def parse_record(self, node):
"""
Parses <Record>
@param node: Node containing the <Record> element
@type node: xml.etree.Element
"""
if self.current_simulation == None:
self.raise_error('<Record> must be only be used inside a ' +
... | [
"def",
"parse_record",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_simulation",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'<Record> must be only be used inside a '",
"+",
"'simulation specification'",
")",
"if",
"'quantity'",
"in",
"... | Parses <Record>
@param node: Node containing the <Record> element
@type node: xml.etree.Element | [
"Parses",
"<Record",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1329-L1350 | train | Parses the record element and adds it to the current simulation. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_event_record | def parse_event_record(self, node):
"""
Parses <EventRecord>
@param node: Node containing the <EventRecord> element
@type node: xml.etree.Element
"""
if self.current_simulation == None:
self.raise_error('<EventRecord> must be only be used inside a ' +
... | python | def parse_event_record(self, node):
"""
Parses <EventRecord>
@param node: Node containing the <EventRecord> element
@type node: xml.etree.Element
"""
if self.current_simulation == None:
self.raise_error('<EventRecord> must be only be used inside a ' +
... | [
"def",
"parse_event_record",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"current_simulation",
"==",
"None",
":",
"self",
".",
"raise_error",
"(",
"'<EventRecord> must be only be used inside a '",
"+",
"'simulation specification'",
")",
"if",
"'quantity'",
... | Parses <EventRecord>
@param node: Node containing the <EventRecord> element
@type node: xml.etree.Element | [
"Parses",
"<EventRecord",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1352-L1375 | train | Parses the event record element and adds it to the current simulation. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_regime | def parse_regime(self, node):
"""
Parses <Regime>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
name = ''
if 'initial' in node.... | python | def parse_regime(self, node):
"""
Parses <Regime>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
name = ''
if 'initial' in node.... | [
"def",
"parse_regime",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"name",
"=",
"''",
"if",
"'initial'",
"in",
"node",
".",
"lattrib",
... | Parses <Regime>
@param node: Node containing the <Behaviour> element
@type node: xml.etree.Element | [
"Parses",
"<Regime",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1377-L1402 | train | Parses the Regime element and adds it to the registry |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_requirement | def parse_requirement(self, node):
"""
Parses <Requirement>
@param node: Node containing the <Requirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Requireme... | python | def parse_requirement(self, node):
"""
Parses <Requirement>
@param node: Node containing the <Requirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Requireme... | [
"def",
"parse_requirement",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Requirement> must specify a name'",
... | Parses <Requirement>
@param node: Node containing the <Requirement> element
@type node: xml.etree.Element | [
"Parses",
"<Requirement",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1404-L1422 | train | Parses the requirement element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_component_requirement | def parse_component_requirement(self, node):
"""
Parses <ComponentRequirement>
@param node: Node containing the <ComponentRequirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
... | python | def parse_component_requirement(self, node):
"""
Parses <ComponentRequirement>
@param node: Node containing the <ComponentRequirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
... | [
"def",
"parse_component_requirement",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<ComponentRequirement> must ... | Parses <ComponentRequirement>
@param node: Node containing the <ComponentRequirement> element
@type node: xml.etree.Element | [
"Parses",
"<ComponentRequirement",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1424-L1437 | train | Parses the ComponentRequirement element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_instance_requirement | def parse_instance_requirement(self, node):
"""
Parses <InstanceRequirement>
@param node: Node containing the <InstanceRequirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
sel... | python | def parse_instance_requirement(self, node):
"""
Parses <InstanceRequirement>
@param node: Node containing the <InstanceRequirement> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
sel... | [
"def",
"parse_instance_requirement",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<InstanceRequirement> must sp... | Parses <InstanceRequirement>
@param node: Node containing the <InstanceRequirement> element
@type node: xml.etree.Element | [
"Parses",
"<InstanceRequirement",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1439-L1457 | train | Parses the instance requirement element and adds it to the current component type. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_run | def parse_run(self, node):
"""
Parses <Run>
@param node: Node containing the <Run> element
@type node: xml.etree.Element
"""
if 'component' in node.lattrib:
component = node.lattrib['component']
else:
self.raise_error('<Run> must specify ... | python | def parse_run(self, node):
"""
Parses <Run>
@param node: Node containing the <Run> element
@type node: xml.etree.Element
"""
if 'component' in node.lattrib:
component = node.lattrib['component']
else:
self.raise_error('<Run> must specify ... | [
"def",
"parse_run",
"(",
"self",
",",
"node",
")",
":",
"if",
"'component'",
"in",
"node",
".",
"lattrib",
":",
"component",
"=",
"node",
".",
"lattrib",
"[",
"'component'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Run> must specify a target com... | Parses <Run>
@param node: Node containing the <Run> element
@type node: xml.etree.Element | [
"Parses",
"<Run",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1459-L1489 | train | Parses the run element and adds it to the current simulation |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_simulation | def parse_simulation(self, node):
"""
Parses <Simulation>
@param node: Node containing the <Simulation> element
@type node: xml.etree.Element
"""
self.current_simulation = self.current_component_type.simulation
self.process_nested_tags(node)
self.curre... | python | def parse_simulation(self, node):
"""
Parses <Simulation>
@param node: Node containing the <Simulation> element
@type node: xml.etree.Element
"""
self.current_simulation = self.current_component_type.simulation
self.process_nested_tags(node)
self.curre... | [
"def",
"parse_simulation",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"current_simulation",
"=",
"self",
".",
"current_component_type",
".",
"simulation",
"self",
".",
"process_nested_tags",
"(",
"node",
")",
"self",
".",
"current_simulation",
"=",
"None"
... | Parses <Simulation>
@param node: Node containing the <Simulation> element
@type node: xml.etree.Element | [
"Parses",
"<Simulation",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1501-L1513 | train | Parses the simulation element and sets the current_simulation attribute to None. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_state_assignment | def parse_state_assignment(self, node):
"""
Parses <StateAssignment>
@param node: Node containing the <StateAssignment> element
@type node: xml.etree.Element
"""
if 'variable' in node.lattrib:
variable = node.lattrib['variable']
else:
sel... | python | def parse_state_assignment(self, node):
"""
Parses <StateAssignment>
@param node: Node containing the <StateAssignment> element
@type node: xml.etree.Element
"""
if 'variable' in node.lattrib:
variable = node.lattrib['variable']
else:
sel... | [
"def",
"parse_state_assignment",
"(",
"self",
",",
"node",
")",
":",
"if",
"'variable'",
"in",
"node",
".",
"lattrib",
":",
"variable",
"=",
"node",
".",
"lattrib",
"[",
"'variable'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<StateAssignment> mus... | Parses <StateAssignment>
@param node: Node containing the <StateAssignment> element
@type node: xml.etree.Element | [
"Parses",
"<StateAssignment",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1515-L1536 | train | Parses the state assignment element and adds it to the event handler. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_state_variable | def parse_state_variable(self, node):
"""
Parses <StateVariable>
@param node: Node containing the <StateVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when the state variable is not
being defined in the context of a component type.
"""... | python | def parse_state_variable(self, node):
"""
Parses <StateVariable>
@param node: Node containing the <StateVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when the state variable is not
being defined in the context of a component type.
"""... | [
"def",
"parse_state_variable",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<StateVariable> must specify a name... | Parses <StateVariable>
@param node: Node containing the <StateVariable> element
@type node: xml.etree.Element
@raise ParseError: Raised when the state variable is not
being defined in the context of a component type. | [
"Parses",
"<StateVariable",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1539-L1565 | train | Parses the state variable element and adds it to the current regime |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_structure | def parse_structure(self, node):
"""
Parses <Structure>
@param node: Node containing the <Structure> element
@type node: xml.etree.Element
"""
self.current_structure = self.current_component_type.structure
self.process_nested_tags(node)
self.current_stru... | python | def parse_structure(self, node):
"""
Parses <Structure>
@param node: Node containing the <Structure> element
@type node: xml.etree.Element
"""
self.current_structure = self.current_component_type.structure
self.process_nested_tags(node)
self.current_stru... | [
"def",
"parse_structure",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"current_structure",
"=",
"self",
".",
"current_component_type",
".",
"structure",
"self",
".",
"process_nested_tags",
"(",
"node",
")",
"self",
".",
"current_structure",
"=",
"None"
] | Parses <Structure>
@param node: Node containing the <Structure> element
@type node: xml.etree.Element | [
"Parses",
"<Structure",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1567-L1577 | train | Parses the structure node and sets the structure attribute to the object representation of the structure node. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_text | def parse_text(self, node):
"""
Parses <Text>
@param node: Node containing the <Text> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Text> must specify a name.')
... | python | def parse_text(self, node):
"""
Parses <Text>
@param node: Node containing the <Text> element
@type node: xml.etree.Element
"""
if 'name' in node.lattrib:
name = node.lattrib['name']
else:
self.raise_error('<Text> must specify a name.')
... | [
"def",
"parse_text",
"(",
"self",
",",
"node",
")",
":",
"if",
"'name'",
"in",
"node",
".",
"lattrib",
":",
"name",
"=",
"node",
".",
"lattrib",
"[",
"'name'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Text> must specify a name.'",
")",
"desc... | Parses <Text>
@param node: Node containing the <Text> element
@type node: xml.etree.Element | [
"Parses",
"<Text",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1589-L1604 | train | Parses the text element of the current component. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_time_derivative | def parse_time_derivative(self, node):
"""
Parses <TimeDerivative>
@param node: Node containing the <TimeDerivative> element
@type node: xml.etree.Element
@raise ParseError: Raised when the time derivative does not hava a variable
name of a value.
"""
i... | python | def parse_time_derivative(self, node):
"""
Parses <TimeDerivative>
@param node: Node containing the <TimeDerivative> element
@type node: xml.etree.Element
@raise ParseError: Raised when the time derivative does not hava a variable
name of a value.
"""
i... | [
"def",
"parse_time_derivative",
"(",
"self",
",",
"node",
")",
":",
"if",
"'variable'",
"in",
"node",
".",
"lattrib",
":",
"variable",
"=",
"node",
".",
"lattrib",
"[",
"'variable'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<TimeDerivative> must ... | Parses <TimeDerivative>
@param node: Node containing the <TimeDerivative> element
@type node: xml.etree.Element
@raise ParseError: Raised when the time derivative does not hava a variable
name of a value. | [
"Parses",
"<TimeDerivative",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1606-L1628 | train | Parses the time derivative element and adds it to the current regime. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_transition | def parse_transition(self, node):
"""
Parses <Transition>
@param node: Node containing the <Transition> element
@type node: xml.etree.Element
"""
if 'regime' in node.lattrib:
regime = node.lattrib['regime']
else:
self.raise_error('<Transi... | python | def parse_transition(self, node):
"""
Parses <Transition>
@param node: Node containing the <Transition> element
@type node: xml.etree.Element
"""
if 'regime' in node.lattrib:
regime = node.lattrib['regime']
else:
self.raise_error('<Transi... | [
"def",
"parse_transition",
"(",
"self",
",",
"node",
")",
":",
"if",
"'regime'",
"in",
"node",
".",
"lattrib",
":",
"regime",
"=",
"node",
".",
"lattrib",
"[",
"'regime'",
"]",
"else",
":",
"self",
".",
"raise_error",
"(",
"'<Transition> mut specify a regime... | Parses <Transition>
@param node: Node containing the <Transition> element
@type node: xml.etree.Element | [
"Parses",
"<Transition",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1630-L1645 | train | Parses the Transition element and adds it to the current event handler. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_unit | def parse_unit(self, node):
"""
Parses <Unit>
@param node: Node containing the <Unit> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or the unit
specfications are incorrect.
@raise ModelError: When the unit refers to an u... | python | def parse_unit(self, node):
"""
Parses <Unit>
@param node: Node containing the <Unit> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or the unit
specfications are incorrect.
@raise ModelError: When the unit refers to an u... | [
"def",
"parse_unit",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"symbol",
"=",
"node",
".",
"lattrib",
"[",
"'symbol'",
"]",
"dimension",
"=",
"node",
".",
"lattrib",
"[",
"'dimension'",
"]",
"except",
":",
"self",
".",
"raise_error",
"(",
"'Unit ... | Parses <Unit>
@param node: Node containing the <Unit> element
@type node: xml.etree.Element
@raise ParseError: When the name is not a string or the unit
specfications are incorrect.
@raise ModelError: When the unit refers to an undefined dimension. | [
"Parses",
"<Unit",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1647-L1686 | train | Parses the unit element and adds it to the model. |
LEMS/pylems | lems/parser/LEMS.py | LEMSFileParser.parse_with | def parse_with(self, node):
"""
Parses <With>
@param node: Node containing the <With> element
@type node: xml.etree.Element
"""
if 'instance' in node.lattrib:
instance = node.lattrib['instance']
list = None
index = None
elif '... | python | def parse_with(self, node):
"""
Parses <With>
@param node: Node containing the <With> element
@type node: xml.etree.Element
"""
if 'instance' in node.lattrib:
instance = node.lattrib['instance']
list = None
index = None
elif '... | [
"def",
"parse_with",
"(",
"self",
",",
"node",
")",
":",
"if",
"'instance'",
"in",
"node",
".",
"lattrib",
":",
"instance",
"=",
"node",
".",
"lattrib",
"[",
"'instance'",
"]",
"list",
"=",
"None",
"index",
"=",
"None",
"elif",
"'list'",
"in",
"node",
... | Parses <With>
@param node: Node containing the <With> element
@type node: xml.etree.Element | [
"Parses",
"<With",
">"
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/parser/LEMS.py#L1688-L1713 | train | Parses the with element and adds it to the current structure |
glormph/msstitch | src/app/readers/xml.py | generate_tags_multiple_files | def generate_tags_multiple_files(input_files, tag, ignore_tags, ns=None):
"""
Calls xmltag generator for multiple files.
"""
return itertools.chain.from_iterable([generate_xmltags(
fn, tag, ignore_tags, ns) for fn in input_files]) | python | def generate_tags_multiple_files(input_files, tag, ignore_tags, ns=None):
"""
Calls xmltag generator for multiple files.
"""
return itertools.chain.from_iterable([generate_xmltags(
fn, tag, ignore_tags, ns) for fn in input_files]) | [
"def",
"generate_tags_multiple_files",
"(",
"input_files",
",",
"tag",
",",
"ignore_tags",
",",
"ns",
"=",
"None",
")",
":",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"[",
"generate_xmltags",
"(",
"fn",
",",
"tag",
",",
"ignore_tags",
"... | Calls xmltag generator for multiple files. | [
"Calls",
"xmltag",
"generator",
"for",
"multiple",
"files",
"."
] | ded7e5cbd813d7797dc9d42805778266e59ff042 | https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L36-L41 | train | Generates xmltags for multiple files. |
glormph/msstitch | src/app/readers/xml.py | generate_tags_multiple_files_strings | def generate_tags_multiple_files_strings(input_files, ns, tag, ignore_tags):
"""
Creates stringified xml output of elements with certain tag.
"""
for el in generate_tags_multiple_files(input_files, tag, ignore_tags, ns):
yield formatting.string_and_clear(el, ns) | python | def generate_tags_multiple_files_strings(input_files, ns, tag, ignore_tags):
"""
Creates stringified xml output of elements with certain tag.
"""
for el in generate_tags_multiple_files(input_files, tag, ignore_tags, ns):
yield formatting.string_and_clear(el, ns) | [
"def",
"generate_tags_multiple_files_strings",
"(",
"input_files",
",",
"ns",
",",
"tag",
",",
"ignore_tags",
")",
":",
"for",
"el",
"in",
"generate_tags_multiple_files",
"(",
"input_files",
",",
"tag",
",",
"ignore_tags",
",",
"ns",
")",
":",
"yield",
"formatti... | Creates stringified xml output of elements with certain tag. | [
"Creates",
"stringified",
"xml",
"output",
"of",
"elements",
"with",
"certain",
"tag",
"."
] | ded7e5cbd813d7797dc9d42805778266e59ff042 | https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L44-L49 | train | Generates a stringified xml output of multiple elements with certain tag. |
glormph/msstitch | src/app/readers/xml.py | generate_xmltags | def generate_xmltags(fn, returntag, ignore_tags, ns=None):
"""
Base generator for percolator xml psm, peptide, protein output,
as well as for mzML, mzIdentML.
ignore_tags are the ones that are cleared when met by parser.
"""
xmlns = create_namespace(ns)
ns_ignore = ['{0}{1}'.format(xmlns, x)... | python | def generate_xmltags(fn, returntag, ignore_tags, ns=None):
"""
Base generator for percolator xml psm, peptide, protein output,
as well as for mzML, mzIdentML.
ignore_tags are the ones that are cleared when met by parser.
"""
xmlns = create_namespace(ns)
ns_ignore = ['{0}{1}'.format(xmlns, x)... | [
"def",
"generate_xmltags",
"(",
"fn",
",",
"returntag",
",",
"ignore_tags",
",",
"ns",
"=",
"None",
")",
":",
"xmlns",
"=",
"create_namespace",
"(",
"ns",
")",
"ns_ignore",
"=",
"[",
"'{0}{1}'",
".",
"format",
"(",
"xmlns",
",",
"x",
")",
"for",
"x",
... | Base generator for percolator xml psm, peptide, protein output,
as well as for mzML, mzIdentML.
ignore_tags are the ones that are cleared when met by parser. | [
"Base",
"generator",
"for",
"percolator",
"xml",
"psm",
"peptide",
"protein",
"output",
"as",
"well",
"as",
"for",
"mzML",
"mzIdentML",
".",
"ignore_tags",
"are",
"the",
"ones",
"that",
"are",
"cleared",
"when",
"met",
"by",
"parser",
"."
] | ded7e5cbd813d7797dc9d42805778266e59ff042 | https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/readers/xml.py#L52-L64 | train | Generator for percolator xml psm peptide protein output mzIdentML mzIDML mzIDML. |
LEMS/pylems | lems/model/model.py | Model.add_component_type | def add_component_type(self, component_type):
"""
Adds a component type to the model.
@param component_type: Component type to be added.
@type component_type: lems.model.fundamental.ComponentType
"""
name = component_type.name
# To handle colons in names... | python | def add_component_type(self, component_type):
"""
Adds a component type to the model.
@param component_type: Component type to be added.
@type component_type: lems.model.fundamental.ComponentType
"""
name = component_type.name
# To handle colons in names... | [
"def",
"add_component_type",
"(",
"self",
",",
"component_type",
")",
":",
"name",
"=",
"component_type",
".",
"name",
"# To handle colons in names in LEMS",
"if",
"':'",
"in",
"name",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"':'",
",",
"'_'",
")",
"c... | Adds a component type to the model.
@param component_type: Component type to be added.
@type component_type: lems.model.fundamental.ComponentType | [
"Adds",
"a",
"component",
"type",
"to",
"the",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L140-L154 | train | Adds a component type to the model. |
LEMS/pylems | lems/model/model.py | Model.add | def add(self, child):
"""
Adds a typed child object to the model.
@param child: Child object to be added.
"""
if isinstance(child, Include):
self.add_include(child)
elif isinstance(child, Dimension):
self.add_dimension(child)
elif isinsta... | python | def add(self, child):
"""
Adds a typed child object to the model.
@param child: Child object to be added.
"""
if isinstance(child, Include):
self.add_include(child)
elif isinstance(child, Dimension):
self.add_dimension(child)
elif isinsta... | [
"def",
"add",
"(",
"self",
",",
"child",
")",
":",
"if",
"isinstance",
"(",
"child",
",",
"Include",
")",
":",
"self",
".",
"add_include",
"(",
"child",
")",
"elif",
"isinstance",
"(",
"child",
",",
"Dimension",
")",
":",
"self",
".",
"add_dimension",
... | Adds a typed child object to the model.
@param child: Child object to be added. | [
"Adds",
"a",
"typed",
"child",
"object",
"to",
"the",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L186-L208 | train | Adds a typed child object to the internal list of the object. |
LEMS/pylems | lems/model/model.py | Model.include_file | def include_file(self, path, include_dirs = []):
"""
Includes a file into the current model.
@param path: Path to the file to be included.
@type path: str
@param include_dirs: Optional alternate include search path.
@type include_dirs: list(str)
"""
if s... | python | def include_file(self, path, include_dirs = []):
"""
Includes a file into the current model.
@param path: Path to the file to be included.
@type path: str
@param include_dirs: Optional alternate include search path.
@type include_dirs: list(str)
"""
if s... | [
"def",
"include_file",
"(",
"self",
",",
"path",
",",
"include_dirs",
"=",
"[",
"]",
")",
":",
"if",
"self",
".",
"include_includes",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"------------------ Including a file: %s\"",
"%",
"path"... | Includes a file into the current model.
@param path: Path to the file to be included.
@type path: str
@param include_dirs: Optional alternate include search path.
@type include_dirs: list(str) | [
"Includes",
"a",
"file",
"into",
"the",
"current",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L220-L258 | train | Include a file into the current model. |
LEMS/pylems | lems/model/model.py | Model.import_from_file | def import_from_file(self, filepath):
"""
Import a model from a file.
@param filepath: File to be imported.
@type filepath: str
"""
inc_dirs = self.include_directories[:]
inc_dirs.append(dirname(filepath))
parser = LEMSFi... | python | def import_from_file(self, filepath):
"""
Import a model from a file.
@param filepath: File to be imported.
@type filepath: str
"""
inc_dirs = self.include_directories[:]
inc_dirs.append(dirname(filepath))
parser = LEMSFi... | [
"def",
"import_from_file",
"(",
"self",
",",
"filepath",
")",
":",
"inc_dirs",
"=",
"self",
".",
"include_directories",
"[",
":",
"]",
"inc_dirs",
".",
"append",
"(",
"dirname",
"(",
"filepath",
")",
")",
"parser",
"=",
"LEMSFileParser",
"(",
"self",
",",
... | Import a model from a file.
@param filepath: File to be imported.
@type filepath: str | [
"Import",
"a",
"model",
"from",
"a",
"file",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L260-L273 | train | Imports a model from a file. |
LEMS/pylems | lems/model/model.py | Model.export_to_dom | def export_to_dom(self):
"""
Exports this model to a DOM.
"""
namespaces = 'xmlns="http://www.neuroml.org/lems/%s" ' + \
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + \
'xsi:schemaLocation="http://www.neuroml.org/lems/%s %s"'
... | python | def export_to_dom(self):
"""
Exports this model to a DOM.
"""
namespaces = 'xmlns="http://www.neuroml.org/lems/%s" ' + \
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + \
'xsi:schemaLocation="http://www.neuroml.org/lems/%s %s"'
... | [
"def",
"export_to_dom",
"(",
"self",
")",
":",
"namespaces",
"=",
"'xmlns=\"http://www.neuroml.org/lems/%s\" '",
"+",
"'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" '",
"+",
"'xsi:schemaLocation=\"http://www.neuroml.org/lems/%s %s\"'",
"namespaces",
"=",
"namespaces",
"%",... | Exports this model to a DOM. | [
"Exports",
"this",
"model",
"to",
"a",
"DOM",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L275-L311 | train | Exports this model to a DOM. |
LEMS/pylems | lems/model/model.py | Model.export_to_file | def export_to_file(self, filepath, level_prefix = ' '):
"""
Exports this model to a file.
@param filepath: File to be exported to.
@type filepath: str
"""
xmldom = self.export_to_dom()
xmlstr = xmldom.toprettyxml(level_prefix, '\n',)
f = open(filepath,... | python | def export_to_file(self, filepath, level_prefix = ' '):
"""
Exports this model to a file.
@param filepath: File to be exported to.
@type filepath: str
"""
xmldom = self.export_to_dom()
xmlstr = xmldom.toprettyxml(level_prefix, '\n',)
f = open(filepath,... | [
"def",
"export_to_file",
"(",
"self",
",",
"filepath",
",",
"level_prefix",
"=",
"' '",
")",
":",
"xmldom",
"=",
"self",
".",
"export_to_dom",
"(",
")",
"xmlstr",
"=",
"xmldom",
".",
"toprettyxml",
"(",
"level_prefix",
",",
"'\\n'",
",",
")",
"f",
"=",
... | Exports this model to a file.
@param filepath: File to be exported to.
@type filepath: str | [
"Exports",
"this",
"model",
"to",
"a",
"file",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L313-L326 | train | Exports this model to a file. |
LEMS/pylems | lems/model/model.py | Model.resolve | def resolve(self):
"""
Resolves references in this model.
"""
model = self.copy()
for ct in model.component_types:
model.resolve_component_type(ct)
for c in model.components:
if c.id not in model.fat_components:
model.add... | python | def resolve(self):
"""
Resolves references in this model.
"""
model = self.copy()
for ct in model.component_types:
model.resolve_component_type(ct)
for c in model.components:
if c.id not in model.fat_components:
model.add... | [
"def",
"resolve",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"copy",
"(",
")",
"for",
"ct",
"in",
"model",
".",
"component_types",
":",
"model",
".",
"resolve_component_type",
"(",
"ct",
")",
"for",
"c",
"in",
"model",
".",
"components",
":",
... | Resolves references in this model. | [
"Resolves",
"references",
"in",
"this",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L328-L347 | train | Resolves references in this model. |
LEMS/pylems | lems/model/model.py | Model.resolve_component_type | def resolve_component_type(self, component_type):
"""
Resolves references in the specified component type.
@param component_type: Component type to be resolved.
@type component_type: lems.model.component.ComponentType
"""
# Resolve component type from base types... | python | def resolve_component_type(self, component_type):
"""
Resolves references in the specified component type.
@param component_type: Component type to be resolved.
@type component_type: lems.model.component.ComponentType
"""
# Resolve component type from base types... | [
"def",
"resolve_component_type",
"(",
"self",
",",
"component_type",
")",
":",
"# Resolve component type from base types if present.",
"if",
"component_type",
".",
"extends",
":",
"try",
":",
"base_ct",
"=",
"self",
".",
"component_types",
"[",
"component_type",
".",
... | Resolves references in the specified component type.
@param component_type: Component type to be resolved.
@type component_type: lems.model.component.ComponentType | [
"Resolves",
"references",
"in",
"the",
"specified",
"component",
"type",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L349-L368 | train | Resolves references in the specified component type. |
LEMS/pylems | lems/model/model.py | Model.merge_component_types | def merge_component_types(self, ct, base_ct):
"""
Merge various maps in the given component type from a base
component type.
@param ct: Component type to be resolved.
@type ct: lems.model.component.ComponentType
@param base_ct: Component type to be resolved.
@t... | python | def merge_component_types(self, ct, base_ct):
"""
Merge various maps in the given component type from a base
component type.
@param ct: Component type to be resolved.
@type ct: lems.model.component.ComponentType
@param base_ct: Component type to be resolved.
@t... | [
"def",
"merge_component_types",
"(",
"self",
",",
"ct",
",",
"base_ct",
")",
":",
"#merge_maps(ct.parameters, base_ct.parameters)",
"for",
"parameter",
"in",
"base_ct",
".",
"parameters",
":",
"if",
"parameter",
".",
"name",
"in",
"ct",
".",
"parameters",
":",
"... | Merge various maps in the given component type from a base
component type.
@param ct: Component type to be resolved.
@type ct: lems.model.component.ComponentType
@param base_ct: Component type to be resolved.
@type base_ct: lems.model.component.ComponentType | [
"Merge",
"various",
"maps",
"in",
"the",
"given",
"component",
"type",
"from",
"a",
"base",
"component",
"type",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L370-L428 | train | Merge various maps in the given base enumeration component type into a single base enumeration component type. |
LEMS/pylems | lems/model/model.py | Model.fatten_component | def fatten_component(self, c):
"""
Fatten a component but resolving all references into the corresponding component type.
@param c: Lean component to be fattened.
@type c: lems.model.component.Component
@return: Fattened component.
@rtype: lems.model.component.FatCompon... | python | def fatten_component(self, c):
"""
Fatten a component but resolving all references into the corresponding component type.
@param c: Lean component to be fattened.
@type c: lems.model.component.Component
@return: Fattened component.
@rtype: lems.model.component.FatCompon... | [
"def",
"fatten_component",
"(",
"self",
",",
"c",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"Fattening %s\"",
"%",
"c",
".",
"id",
")",
"try",
":",
"ct",
"=",
"self",
".",
"component_types",
"[",
"c",
".",
"type",
"]",
"except",
":... | Fatten a component but resolving all references into the corresponding component type.
@param c: Lean component to be fattened.
@type c: lems.model.component.Component
@return: Fattened component.
@rtype: lems.model.component.FatComponent | [
"Fatten",
"a",
"component",
"but",
"resolving",
"all",
"references",
"into",
"the",
"corresponding",
"component",
"type",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L430-L560 | train | Fatten a component but resolving all references into the corresponding component type. |
LEMS/pylems | lems/model/model.py | Model.get_parent_component | def get_parent_component(self, fc):
"""
TODO: Replace with more efficient way to do this...
"""
if self.debug: print("Looking for parent of %s (%s)"%(fc.id, fc.parent_id))
parent_comp = None
for comp in self.components.values():
if self.debug: print(" - Check... | python | def get_parent_component(self, fc):
"""
TODO: Replace with more efficient way to do this...
"""
if self.debug: print("Looking for parent of %s (%s)"%(fc.id, fc.parent_id))
parent_comp = None
for comp in self.components.values():
if self.debug: print(" - Check... | [
"def",
"get_parent_component",
"(",
"self",
",",
"fc",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"Looking for parent of %s (%s)\"",
"%",
"(",
"fc",
".",
"id",
",",
"fc",
".",
"parent_id",
")",
")",
"parent_comp",
"=",
"None",
"for",
"com... | TODO: Replace with more efficient way to do this... | [
"TODO",
":",
"Replace",
"with",
"more",
"efficient",
"way",
"to",
"do",
"this",
"..."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L563-L585 | train | Get the parent component of a given component. |
LEMS/pylems | lems/model/model.py | Model.resolve_structure | def resolve_structure(self, fc, ct):
"""
Resolve structure specifications.
"""
if self.debug: print("++++++++ Resolving structure of (%s) with %s"%(fc, ct))
for w in ct.structure.withs:
try:
if w.instance == 'parent' or w.instance == 'this':
... | python | def resolve_structure(self, fc, ct):
"""
Resolve structure specifications.
"""
if self.debug: print("++++++++ Resolving structure of (%s) with %s"%(fc, ct))
for w in ct.structure.withs:
try:
if w.instance == 'parent' or w.instance == 'this':
... | [
"def",
"resolve_structure",
"(",
"self",
",",
"fc",
",",
"ct",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"++++++++ Resolving structure of (%s) with %s\"",
"%",
"(",
"fc",
",",
"ct",
")",
")",
"for",
"w",
"in",
"ct",
".",
"structure",
"."... | Resolve structure specifications. | [
"Resolve",
"structure",
"specifications",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L589-L726 | train | Resolve structure specifications. |
LEMS/pylems | lems/model/model.py | Model.resolve_simulation | def resolve_simulation(self, fc, ct):
"""
Resolve simulation specifications.
"""
for run in ct.simulation.runs:
try:
run2 = Run(fc.component_references[run.component].referenced_component,
run.variable,
fc... | python | def resolve_simulation(self, fc, ct):
"""
Resolve simulation specifications.
"""
for run in ct.simulation.runs:
try:
run2 = Run(fc.component_references[run.component].referenced_component,
run.variable,
fc... | [
"def",
"resolve_simulation",
"(",
"self",
",",
"fc",
",",
"ct",
")",
":",
"for",
"run",
"in",
"ct",
".",
"simulation",
".",
"runs",
":",
"try",
":",
"run2",
"=",
"Run",
"(",
"fc",
".",
"component_references",
"[",
"run",
".",
"component",
"]",
".",
... | Resolve simulation specifications. | [
"Resolve",
"simulation",
"specifications",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L728-L799 | train | Resolve simulation specifications. |
LEMS/pylems | lems/model/model.py | Model.get_numeric_value | def get_numeric_value(self, value_str, dimension = None):
"""
Get the numeric value for a parameter value specification.
@param value_str: Value string
@type value_str: str
@param dimension: Dimension of the value
@type dimension: str
"""
n = None
... | python | def get_numeric_value(self, value_str, dimension = None):
"""
Get the numeric value for a parameter value specification.
@param value_str: Value string
@type value_str: str
@param dimension: Dimension of the value
@type dimension: str
"""
n = None
... | [
"def",
"get_numeric_value",
"(",
"self",
",",
"value_str",
",",
"dimension",
"=",
"None",
")",
":",
"n",
"=",
"None",
"i",
"=",
"len",
"(",
"value_str",
")",
"while",
"n",
"is",
"None",
":",
"try",
":",
"part",
"=",
"value_str",
"[",
"0",
":",
"i",... | Get the numeric value for a parameter value specification.
@param value_str: Value string
@type value_str: str
@param dimension: Dimension of the value
@type dimension: str | [
"Get",
"the",
"numeric",
"value",
"for",
"a",
"parameter",
"value",
"specification",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/model/model.py#L802-L849 | train | Get the numeric value for a parameter value specification. |
glormph/msstitch | src/app/drivers/startup.py | start_msstitch | def start_msstitch(exec_drivers, sysargs):
"""Passed all drivers of executable, checks which command is passed to
the executable and then gets the options for a driver, parses them from
command line and runs the driver"""
parser = populate_parser(exec_drivers)
args = parser.parse_args(sysargs[1:])
... | python | def start_msstitch(exec_drivers, sysargs):
"""Passed all drivers of executable, checks which command is passed to
the executable and then gets the options for a driver, parses them from
command line and runs the driver"""
parser = populate_parser(exec_drivers)
args = parser.parse_args(sysargs[1:])
... | [
"def",
"start_msstitch",
"(",
"exec_drivers",
",",
"sysargs",
")",
":",
"parser",
"=",
"populate_parser",
"(",
"exec_drivers",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
"sysargs",
"[",
"1",
":",
"]",
")",
"args",
".",
"func",
"(",
"*",
"*",
"... | Passed all drivers of executable, checks which command is passed to
the executable and then gets the options for a driver, parses them from
command line and runs the driver | [
"Passed",
"all",
"drivers",
"of",
"executable",
"checks",
"which",
"command",
"is",
"passed",
"to",
"the",
"executable",
"and",
"then",
"gets",
"the",
"options",
"for",
"a",
"driver",
"parses",
"them",
"from",
"command",
"line",
"and",
"runs",
"the",
"driver... | ded7e5cbd813d7797dc9d42805778266e59ff042 | https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/drivers/startup.py#L47-L53 | train | Start the msstitch command line. |
TriOptima/tri.struct | lib/tri/struct/__init__.py | merged | def merged(*dicts, **kwargs):
"""
Merge dictionaries. Later keys overwrite.
.. code-block:: python
merged(dict(a=1), dict(b=2), c=3, d=1)
"""
if not dicts:
return Struct()
result = dict()
for d in dicts:
result.update(d)
result.update(kwargs)
struct_type = ... | python | def merged(*dicts, **kwargs):
"""
Merge dictionaries. Later keys overwrite.
.. code-block:: python
merged(dict(a=1), dict(b=2), c=3, d=1)
"""
if not dicts:
return Struct()
result = dict()
for d in dicts:
result.update(d)
result.update(kwargs)
struct_type = ... | [
"def",
"merged",
"(",
"*",
"dicts",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"dicts",
":",
"return",
"Struct",
"(",
")",
"result",
"=",
"dict",
"(",
")",
"for",
"d",
"in",
"dicts",
":",
"result",
".",
"update",
"(",
"d",
")",
"result",
"... | Merge dictionaries. Later keys overwrite.
.. code-block:: python
merged(dict(a=1), dict(b=2), c=3, d=1) | [
"Merge",
"dictionaries",
".",
"Later",
"keys",
"overwrite",
"."
] | 8886392da9cd77ce662e0781b0ff0bf82b38b56b | https://github.com/TriOptima/tri.struct/blob/8886392da9cd77ce662e0781b0ff0bf82b38b56b/lib/tri/struct/__init__.py#L60-L76 | train | Merge dictionaries. Later keys overwrite. |
LEMS/pylems | lems/sim/build.py | order_derived_parameters | def order_derived_parameters(component):
"""
Finds ordering of derived_parameters.
@param component: Component containing derived parameters.
@type component: lems.model.component.Component
@return: Returns ordered list of derived parameters.
@rtype: list(string)
@raise SimBuildError: Rai... | python | def order_derived_parameters(component):
"""
Finds ordering of derived_parameters.
@param component: Component containing derived parameters.
@type component: lems.model.component.Component
@return: Returns ordered list of derived parameters.
@rtype: list(string)
@raise SimBuildError: Rai... | [
"def",
"order_derived_parameters",
"(",
"component",
")",
":",
"if",
"len",
"(",
"component",
".",
"derived_parameters",
")",
"==",
"0",
":",
"return",
"[",
"]",
"ordering",
"=",
"[",
"]",
"dps",
"=",
"[",
"]",
"for",
"dp",
"in",
"component",
".",
"der... | Finds ordering of derived_parameters.
@param component: Component containing derived parameters.
@type component: lems.model.component.Component
@return: Returns ordered list of derived parameters.
@rtype: list(string)
@raise SimBuildError: Raised when a proper ordering of derived
parameters ... | [
"Finds",
"ordering",
"of",
"derived_parameters",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1059-L1107 | train | Finds ordering of derived parameters. |
LEMS/pylems | lems/sim/build.py | order_derived_variables | def order_derived_variables(regime):
"""
Finds ordering of derived_variables.
@param regime: Dynamics Regime containing derived variables.
@type regime: lems.model.dynamics.regime
@return: Returns ordered list of derived variables.
@rtype: list(string)
@raise SimBuildError: Raised when a ... | python | def order_derived_variables(regime):
"""
Finds ordering of derived_variables.
@param regime: Dynamics Regime containing derived variables.
@type regime: lems.model.dynamics.regime
@return: Returns ordered list of derived variables.
@rtype: list(string)
@raise SimBuildError: Raised when a ... | [
"def",
"order_derived_variables",
"(",
"regime",
")",
":",
"ordering",
"=",
"[",
"]",
"dvs",
"=",
"[",
"]",
"dvsnoexp",
"=",
"[",
"]",
"maxcount",
"=",
"5",
"for",
"dv",
"in",
"regime",
".",
"derived_variables",
":",
"if",
"dv",
".",
"expression_tree",
... | Finds ordering of derived_variables.
@param regime: Dynamics Regime containing derived variables.
@type regime: lems.model.dynamics.regime
@return: Returns ordered list of derived variables.
@rtype: list(string)
@raise SimBuildError: Raised when a proper ordering of derived
variables could no... | [
"Finds",
"ordering",
"of",
"derived_variables",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1110-L1177 | train | Returns a list of all derived variables in a single virtual machine. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build | def build(self):
"""
Build the simulation components from the model.
@return: A runnable simulation object
@rtype: lems.sim.sim.Simulation
"""
self.sim = Simulation()
for component_id in self.model.targets:
if component_id not in self.model.componen... | python | def build(self):
"""
Build the simulation components from the model.
@return: A runnable simulation object
@rtype: lems.sim.sim.Simulation
"""
self.sim = Simulation()
for component_id in self.model.targets:
if component_id not in self.model.componen... | [
"def",
"build",
"(",
"self",
")",
":",
"self",
".",
"sim",
"=",
"Simulation",
"(",
")",
"for",
"component_id",
"in",
"self",
".",
"model",
".",
"targets",
":",
"if",
"component_id",
"not",
"in",
"self",
".",
"model",
".",
"components",
":",
"raise",
... | Build the simulation components from the model.
@return: A runnable simulation object
@rtype: lems.sim.sim.Simulation | [
"Build",
"the",
"simulation",
"components",
"from",
"the",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L47-L66 | train | Builds the simulation components from the model. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_runnable | def build_runnable(self, component, parent = None, id_ = None):
"""
Build a runnable component from a component specification and add
it to the simulation.
@param component: Component specification
@type component: lems.model.component.FatComponent
@param parent: Parent... | python | def build_runnable(self, component, parent = None, id_ = None):
"""
Build a runnable component from a component specification and add
it to the simulation.
@param component: Component specification
@type component: lems.model.component.FatComponent
@param parent: Parent... | [
"def",
"build_runnable",
"(",
"self",
",",
"component",
",",
"parent",
"=",
"None",
",",
"id_",
"=",
"None",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"++++++++ Calling build_runnable of %s with parent %s\"",
"%",
"(",
"component",
",",
"paren... | Build a runnable component from a component specification and add
it to the simulation.
@param component: Component specification
@type component: lems.model.component.FatComponent
@param parent: Parent runnable component.
@type parent: lems.sim.runnable.Runnable
@para... | [
"Build",
"a",
"runnable",
"component",
"from",
"a",
"component",
"specification",
"and",
"add",
"it",
"to",
"the",
"simulation",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L68-L228 | train | Builds a runnable component from a component specification and add it to the simulation. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_event_connections | def build_event_connections(self, component, runnable, structure):
"""
Adds event connections to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.... | python | def build_event_connections(self, component, runnable, structure):
"""
Adds event connections to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.... | [
"def",
"build_event_connections",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"structure",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"\\n++++++++ Calling build_event_connections of %s with runnable %s, parent %s\"",
"%",
"(",
"component",
".",
... | Adds event connections to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatComponent
@param runnable: Runnable component to which structure ... | [
"Adds",
"event",
"connections",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"structure",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L231-L289 | train | Builds event connections for a given component and structure. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_structure | def build_structure(self, component, runnable, structure):
"""
Adds structure to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatCom... | python | def build_structure(self, component, runnable, structure):
"""
Adds structure to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatCom... | [
"def",
"build_structure",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"structure",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"\\n++++++++ Calling build_structure of %s with runnable %s, parent %s\"",
"%",
"(",
"component",
".",
"id",
",",
... | Adds structure to a runnable component based on the structure
specifications in the component model.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatComponent
@param runnable: Runnable component to which structure is to be... | [
"Adds",
"structure",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"structure",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L293-L334 | train | Builds the structure for a runnable component based on the structure specifications in the component model. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_foreach | def build_foreach(self, component, runnable, foreach, name_mappings = {}):
"""
Iterate over ForEach constructs and process nested elements.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatComponent
@param runnable:... | python | def build_foreach(self, component, runnable, foreach, name_mappings = {}):
"""
Iterate over ForEach constructs and process nested elements.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatComponent
@param runnable:... | [
"def",
"build_foreach",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"foreach",
",",
"name_mappings",
"=",
"{",
"}",
")",
":",
"if",
"self",
".",
"debug",
":",
"print",
"(",
"\"\\n++++++++ Calling build_foreach of %s with runnable %s, parent %s, name_mappings:... | Iterate over ForEach constructs and process nested elements.
@param component: Component model containing structure specifications.
@type component: lems.model.component.FatComponent
@param runnable: Runnable component to which structure is to be added.
@type runnable: lems.sim.runnabl... | [
"Iterate",
"over",
"ForEach",
"constructs",
"and",
"process",
"nested",
"elements",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L338-L394 | train | Iterate over ForEach constructs and process nested elements. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.add_dynamics_1 | def add_dynamics_1(self, component, runnable, regime, dynamics):
"""
Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics necessary for building child components.
@param component: Component model contain... | python | def add_dynamics_1(self, component, runnable, regime, dynamics):
"""
Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics necessary for building child components.
@param component: Component model contain... | [
"def",
"add_dynamics_1",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"regime",
",",
"dynamics",
")",
":",
"if",
"isinstance",
"(",
"regime",
",",
"Dynamics",
")",
"or",
"regime",
".",
"name",
"==",
"''",
":",
"suffix",
"=",
"''",
"else",
":",
... | Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics necessary for building child components.
@param component: Component model containing dynamics specifications.
@type component: lems.model.component.FatCompone... | [
"Adds",
"dynamics",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"dynamics",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L397-L519 | train | This method adds dynamics to a runnable component based on the dynamics specifications in the component model. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.add_dynamics_2 | def add_dynamics_2(self, component, runnable, regime, dynamics):
"""
Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics dependent on child components.
@param component: Component model containing dynami... | python | def add_dynamics_2(self, component, runnable, regime, dynamics):
"""
Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics dependent on child components.
@param component: Component model containing dynami... | [
"def",
"add_dynamics_2",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"regime",
",",
"dynamics",
")",
":",
"if",
"isinstance",
"(",
"regime",
",",
"Dynamics",
")",
"or",
"regime",
".",
"name",
"==",
"''",
":",
"suffix",
"=",
"''",
"else",
":",
... | Adds dynamics to a runnable component based on the dynamics
specifications in the component model.
This method builds dynamics dependent on child components.
@param component: Component model containing dynamics specifications.
@type component: lems.model.component.FatComponent
... | [
"Adds",
"dynamics",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"dynamics",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L521-L604 | train | This method adds dynamics to a runnable component based on the dynamics specifications in the component model. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.process_simulation_specs | def process_simulation_specs(self, component, runnable, simulation):
"""
Process simulation-related aspects to a runnable component based on the
dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component:... | python | def process_simulation_specs(self, component, runnable, simulation):
"""
Process simulation-related aspects to a runnable component based on the
dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component:... | [
"def",
"process_simulation_specs",
"(",
"self",
",",
"component",
",",
"runnable",
",",
"simulation",
")",
":",
"# Process runs",
"for",
"run",
"in",
"simulation",
".",
"runs",
":",
"cid",
"=",
"run",
".",
"component",
".",
"id",
"+",
"'_'",
"+",
"componen... | Process simulation-related aspects to a runnable component based on the
dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component: lems.model.component.FatComponent
@param runnable: Runnable component to which ... | [
"Process",
"simulation",
"-",
"related",
"aspects",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"dynamics",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L606-L640 | train | Processes the simulation - related aspects of a runnable component based on the dynamics specifications in the component model. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.convert_op | def convert_op(self, op):
"""
Converts NeuroML arithmetic/logical operators to python equivalents.
@param op: NeuroML operator
@type op: string
@return: Python operator
@rtype: string
"""
if op == '.gt.':
return '>'
elif op == '.ge.... | python | def convert_op(self, op):
"""
Converts NeuroML arithmetic/logical operators to python equivalents.
@param op: NeuroML operator
@type op: string
@return: Python operator
@rtype: string
"""
if op == '.gt.':
return '>'
elif op == '.ge.... | [
"def",
"convert_op",
"(",
"self",
",",
"op",
")",
":",
"if",
"op",
"==",
"'.gt.'",
":",
"return",
"'>'",
"elif",
"op",
"==",
"'.ge.'",
"or",
"op",
"==",
"'.geq.'",
":",
"return",
"'>='",
"elif",
"op",
"==",
"'.lt.'",
":",
"return",
"'<'",
"elif",
"... | Converts NeuroML arithmetic/logical operators to python equivalents.
@param op: NeuroML operator
@type op: string
@return: Python operator
@rtype: string | [
"Converts",
"NeuroML",
"arithmetic",
"/",
"logical",
"operators",
"to",
"python",
"equivalents",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L643-L676 | train | Converts NeuroML arithmetic or logical operator to python equivalents. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.convert_func | def convert_func(self, func):
"""
Converts NeuroML arithmetic/logical functions to python equivalents.
@param func: NeuroML function
@type func: string
@return: Python operator
@rtype: string
"""
if func == 'ln':
return 'log'
elif f... | python | def convert_func(self, func):
"""
Converts NeuroML arithmetic/logical functions to python equivalents.
@param func: NeuroML function
@type func: string
@return: Python operator
@rtype: string
"""
if func == 'ln':
return 'log'
elif f... | [
"def",
"convert_func",
"(",
"self",
",",
"func",
")",
":",
"if",
"func",
"==",
"'ln'",
":",
"return",
"'log'",
"elif",
"func",
"==",
"'random'",
":",
"return",
"'random.uniform'",
"elif",
"func",
"==",
"'H'",
":",
"def",
"heaviside_step",
"(",
"x",
")",
... | Converts NeuroML arithmetic/logical functions to python equivalents.
@param func: NeuroML function
@type func: string
@return: Python operator
@rtype: string | [
"Converts",
"NeuroML",
"arithmetic",
"/",
"logical",
"functions",
"to",
"python",
"equivalents",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L678-L701 | train | Converts NeuroML arithmetic or logical functions to python equivalents. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_expression_from_tree | def build_expression_from_tree(self, runnable, regime, tree_node):
"""
Recursively builds a Python expression from a parsed expression tree.
@param runnable: Runnable object to which this expression would be added.
@type runnable: lems.sim.runnable.Runnable
@param regime: Dynam... | python | def build_expression_from_tree(self, runnable, regime, tree_node):
"""
Recursively builds a Python expression from a parsed expression tree.
@param runnable: Runnable object to which this expression would be added.
@type runnable: lems.sim.runnable.Runnable
@param regime: Dynam... | [
"def",
"build_expression_from_tree",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"tree_node",
")",
":",
"component_type",
"=",
"self",
".",
"model",
".",
"component_types",
"[",
"runnable",
".",
"component",
".",
"type",
"]",
"dynamics",
"=",
"component_... | Recursively builds a Python expression from a parsed expression tree.
@param runnable: Runnable object to which this expression would be added.
@type runnable: lems.sim.runnable.Runnable
@param regime: Dynamics regime being built.
@type regime: lems.model.dynamics.Regime
@para... | [
"Recursively",
"builds",
"a",
"Python",
"expression",
"from",
"a",
"parsed",
"expression",
"tree",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L703-L767 | train | Recursively builds a Python expression from a parsed expression tree. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_event_handler | def build_event_handler(self, runnable, regime, event_handler):
"""
Build event handler code.
@param event_handler: Event handler object
@type event_handler: lems.model.dynamics.EventHandler
@return: Generated event handler code.
@rtype: list(string)
"""
... | python | def build_event_handler(self, runnable, regime, event_handler):
"""
Build event handler code.
@param event_handler: Event handler object
@type event_handler: lems.model.dynamics.EventHandler
@return: Generated event handler code.
@rtype: list(string)
"""
... | [
"def",
"build_event_handler",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"event_handler",
")",
":",
"if",
"isinstance",
"(",
"event_handler",
",",
"OnCondition",
")",
":",
"return",
"self",
".",
"build_on_condition",
"(",
"runnable",
",",
"regime",
",",... | Build event handler code.
@param event_handler: Event handler object
@type event_handler: lems.model.dynamics.EventHandler
@return: Generated event handler code.
@rtype: list(string) | [
"Build",
"event",
"handler",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L769-L789 | train | Builds the event handler code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_on_condition | def build_on_condition(self, runnable, regime, on_condition):
"""
Build OnCondition event handler code.
@param on_condition: OnCondition event handler object
@type on_condition: lems.model.dynamics.OnCondition
@return: Generated OnCondition code
@rtype: list(string)
... | python | def build_on_condition(self, runnable, regime, on_condition):
"""
Build OnCondition event handler code.
@param on_condition: OnCondition event handler object
@type on_condition: lems.model.dynamics.OnCondition
@return: Generated OnCondition code
@rtype: list(string)
... | [
"def",
"build_on_condition",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"on_condition",
")",
":",
"on_condition_code",
"=",
"[",
"]",
"on_condition_code",
"+=",
"[",
"'if {0}:'",
".",
"format",
"(",
"self",
".",
"build_expression_from_tree",
"(",
"runnabl... | Build OnCondition event handler code.
@param on_condition: OnCondition event handler object
@type on_condition: lems.model.dynamics.OnCondition
@return: Generated OnCondition code
@rtype: list(string) | [
"Build",
"OnCondition",
"event",
"handler",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L791-L814 | train | Build OnCondition event handler code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_on_event | def build_on_event(self, runnable, regime, on_event):
"""
Build OnEvent event handler code.
@param on_event: OnEvent event handler object
@type on_event: lems.model.dynamics.OnEvent
@return: Generated OnEvent code
@rtype: list(string)
"""
on_event_code =... | python | def build_on_event(self, runnable, regime, on_event):
"""
Build OnEvent event handler code.
@param on_event: OnEvent event handler object
@type on_event: lems.model.dynamics.OnEvent
@return: Generated OnEvent code
@rtype: list(string)
"""
on_event_code =... | [
"def",
"build_on_event",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"on_event",
")",
":",
"on_event_code",
"=",
"[",
"]",
"if",
"self",
".",
"debug",
":",
"on_event_code",
"+=",
"[",
"'print(\"Maybe handling something for %s (\"+str(id(self))+\")\")'",
"%",
... | Build OnEvent event handler code.
@param on_event: OnEvent event handler object
@type on_event: lems.model.dynamics.OnEvent
@return: Generated OnEvent code
@rtype: list(string) | [
"Build",
"OnEvent",
"event",
"handler",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L816-L844 | train | Build OnEvent event handler code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_on_start | def build_on_start(self, runnable, regime, on_start):
"""
Build OnStart start handler code.
@param on_start: OnStart start handler object
@type on_start: lems.model.dynamics.OnStart
@return: Generated OnStart code
@rtype: list(string)
"""
on_start_code ... | python | def build_on_start(self, runnable, regime, on_start):
"""
Build OnStart start handler code.
@param on_start: OnStart start handler object
@type on_start: lems.model.dynamics.OnStart
@return: Generated OnStart code
@rtype: list(string)
"""
on_start_code ... | [
"def",
"build_on_start",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"on_start",
")",
":",
"on_start_code",
"=",
"[",
"]",
"for",
"action",
"in",
"on_start",
".",
"actions",
":",
"code",
"=",
"self",
".",
"build_action",
"(",
"runnable",
",",
"regi... | Build OnStart start handler code.
@param on_start: OnStart start handler object
@type on_start: lems.model.dynamics.OnStart
@return: Generated OnStart code
@rtype: list(string) | [
"Build",
"OnStart",
"start",
"handler",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L846-L864 | train | Build OnStart handler code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_on_entry | def build_on_entry(self, runnable, regime, on_entry):
"""
Build OnEntry start handler code.
@param on_entry: OnEntry start handler object
@type on_entry: lems.model.dynamics.OnEntry
@return: Generated OnEntry code
@rtype: list(string)
"""
on_entry_code ... | python | def build_on_entry(self, runnable, regime, on_entry):
"""
Build OnEntry start handler code.
@param on_entry: OnEntry start handler object
@type on_entry: lems.model.dynamics.OnEntry
@return: Generated OnEntry code
@rtype: list(string)
"""
on_entry_code ... | [
"def",
"build_on_entry",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"on_entry",
")",
":",
"on_entry_code",
"=",
"[",
"]",
"on_entry_code",
"+=",
"[",
"'if self.current_regime != self.last_regime:'",
"]",
"on_entry_code",
"+=",
"[",
"' self.last_regime = self... | Build OnEntry start handler code.
@param on_entry: OnEntry start handler object
@type on_entry: lems.model.dynamics.OnEntry
@return: Generated OnEntry code
@rtype: list(string) | [
"Build",
"OnEntry",
"start",
"handler",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L866-L887 | train | Build OnEntry start handler code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_action | def build_action(self, runnable, regime, action):
"""
Build event handler action code.
@param action: Event handler action object
@type action: lems.model.dynamics.Action
@return: Generated action code
@rtype: string
"""
if isinstance(action, StateAssig... | python | def build_action(self, runnable, regime, action):
"""
Build event handler action code.
@param action: Event handler action object
@type action: lems.model.dynamics.Action
@return: Generated action code
@rtype: string
"""
if isinstance(action, StateAssig... | [
"def",
"build_action",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"action",
")",
":",
"if",
"isinstance",
"(",
"action",
",",
"StateAssignment",
")",
":",
"return",
"self",
".",
"build_state_assignment",
"(",
"runnable",
",",
"regime",
",",
"action",
... | Build event handler action code.
@param action: Event handler action object
@type action: lems.model.dynamics.Action
@return: Generated action code
@rtype: string | [
"Build",
"event",
"handler",
"action",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L889-L907 | train | Build event handler action code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_state_assignment | def build_state_assignment(self, runnable, regime, state_assignment):
"""
Build state assignment code.
@param state_assignment: State assignment object
@type state_assignment: lems.model.dynamics.StateAssignment
@return: Generated state assignment code
@rtype: string
... | python | def build_state_assignment(self, runnable, regime, state_assignment):
"""
Build state assignment code.
@param state_assignment: State assignment object
@type state_assignment: lems.model.dynamics.StateAssignment
@return: Generated state assignment code
@rtype: string
... | [
"def",
"build_state_assignment",
"(",
"self",
",",
"runnable",
",",
"regime",
",",
"state_assignment",
")",
":",
"return",
"[",
"'self.{0} = {1}'",
".",
"format",
"(",
"state_assignment",
".",
"variable",
",",
"self",
".",
"build_expression_from_tree",
"(",
"runna... | Build state assignment code.
@param state_assignment: State assignment object
@type state_assignment: lems.model.dynamics.StateAssignment
@return: Generated state assignment code
@rtype: string | [
"Build",
"state",
"assignment",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L909-L924 | train | Build state assignment code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_event_out | def build_event_out(self, event_out):
"""
Build event out code.
@param event_out: event out object
@type event_out: lems.model.dynamics.EventOut
@return: Generated event out code
@rtype: string
"""
event_out_code = ['if "{0}" in self.event_out_callbacks... | python | def build_event_out(self, event_out):
"""
Build event out code.
@param event_out: event out object
@type event_out: lems.model.dynamics.EventOut
@return: Generated event out code
@rtype: string
"""
event_out_code = ['if "{0}" in self.event_out_callbacks... | [
"def",
"build_event_out",
"(",
"self",
",",
"event_out",
")",
":",
"event_out_code",
"=",
"[",
"'if \"{0}\" in self.event_out_callbacks:'",
".",
"format",
"(",
"event_out",
".",
"port",
")",
",",
"' for c in self.event_out_callbacks[\\'{0}\\']:'",
".",
"format",
"(",... | Build event out code.
@param event_out: event out object
@type event_out: lems.model.dynamics.EventOut
@return: Generated event out code
@rtype: string | [
"Build",
"event",
"out",
"code",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L926-L941 | train | Build event out code. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.build_reduce_code | def build_reduce_code(self, result, select, reduce):
"""
Builds a reduce operation on the selected target range.
"""
select = select.replace('/', '.')
select = select.replace(' ', '')
if reduce == 'add':
reduce_op = '+'
acc_start = 0
else:... | python | def build_reduce_code(self, result, select, reduce):
"""
Builds a reduce operation on the selected target range.
"""
select = select.replace('/', '.')
select = select.replace(' ', '')
if reduce == 'add':
reduce_op = '+'
acc_start = 0
else:... | [
"def",
"build_reduce_code",
"(",
"self",
",",
"result",
",",
"select",
",",
"reduce",
")",
":",
"select",
"=",
"select",
".",
"replace",
"(",
"'/'",
",",
"'.'",
")",
"select",
"=",
"select",
".",
"replace",
"(",
"' '",
",",
"''",
")",
"if",
"reduce",... | Builds a reduce operation on the selected target range. | [
"Builds",
"a",
"reduce",
"operation",
"on",
"the",
"selected",
"target",
"range",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L956-L1015 | train | Builds a reduce code for the selected target range. |
LEMS/pylems | lems/sim/build.py | SimulationBuilder.add_recording_behavior | def add_recording_behavior(self, component, runnable):
"""
Adds recording-related dynamics to a runnable component based on
the dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component: lems.model.compo... | python | def add_recording_behavior(self, component, runnable):
"""
Adds recording-related dynamics to a runnable component based on
the dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component: lems.model.compo... | [
"def",
"add_recording_behavior",
"(",
"self",
",",
"component",
",",
"runnable",
")",
":",
"simulation",
"=",
"component",
".",
"simulation",
"for",
"rec",
"in",
"simulation",
".",
"records",
":",
"rec",
".",
"id",
"=",
"runnable",
".",
"id",
"self",
".",
... | Adds recording-related dynamics to a runnable component based on
the dynamics specifications in the component model.
@param component: Component model containing dynamics specifications.
@type component: lems.model.component.FatComponent runnable: Runnable component to which dynamics is to be a... | [
"Adds",
"recording",
"-",
"related",
"dynamics",
"to",
"a",
"runnable",
"component",
"based",
"on",
"the",
"dynamics",
"specifications",
"in",
"the",
"component",
"model",
"."
] | 4eeb719d2f23650fe16c38626663b69b5c83818b | https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/build.py#L1038-L1055 | train | Adds recording - related dynamics to a runnable component based on the dynamics specifications in the component model. |
Erotemic/utool | utool/util_inspect.py | get_internal_call_graph | def get_internal_call_graph(fpath, with_doctests=False):
"""
CommandLine:
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/ibeis/ibeis/init/main_helpers.py --show
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/dtool/dtool/depcache_table.p... | python | def get_internal_call_graph(fpath, with_doctests=False):
"""
CommandLine:
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/ibeis/ibeis/init/main_helpers.py --show
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/dtool/dtool/depcache_table.p... | [
"def",
"get_internal_call_graph",
"(",
"fpath",
",",
"with_doctests",
"=",
"False",
")",
":",
"import",
"utool",
"as",
"ut",
"fpath",
"=",
"ut",
".",
"truepath",
"(",
"fpath",
")",
"sourcecode",
"=",
"ut",
".",
"readfrom",
"(",
"fpath",
")",
"self",
"=",... | CommandLine:
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/ibeis/ibeis/init/main_helpers.py --show
python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/dtool/dtool/depcache_table.py --show
Example:
>>> # DISABLE_DOCTEST
>>> from... | [
"CommandLine",
":",
"python",
"-",
"m",
"utool",
".",
"util_inspect",
"get_internal_call_graph",
"--",
"show",
"--",
"modpath",
"=",
"~",
"/",
"code",
"/",
"ibeis",
"/",
"ibeis",
"/",
"init",
"/",
"main_helpers",
".",
"py",
"--",
"show",
"python",
"-",
"... | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L161-L187 | train | Get the internal call graph for a given file |
Erotemic/utool | utool/util_inspect.py | check_static_member_vars | def check_static_member_vars(class_, fpath=None, only_init=True):
"""
class_ can either be live object or a classname
# fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py')
# classname = 'AnnotGraphWidget'
"""
#import ast
#import astor
import utool as ut
if isinstance(class_... | python | def check_static_member_vars(class_, fpath=None, only_init=True):
"""
class_ can either be live object or a classname
# fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py')
# classname = 'AnnotGraphWidget'
"""
#import ast
#import astor
import utool as ut
if isinstance(class_... | [
"def",
"check_static_member_vars",
"(",
"class_",
",",
"fpath",
"=",
"None",
",",
"only_init",
"=",
"True",
")",
":",
"#import ast",
"#import astor",
"import",
"utool",
"as",
"ut",
"if",
"isinstance",
"(",
"class_",
",",
"six",
".",
"string_types",
")",
":",... | class_ can either be live object or a classname
# fpath = ut.truepath('~/code/ibeis/ibeis/viz/viz_graph2.py')
# classname = 'AnnotGraphWidget' | [
"class_",
"can",
"either",
"be",
"live",
"object",
"or",
"a",
"classname"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L194-L296 | train | Check static member variables of a live object. |
Erotemic/utool | utool/util_inspect.py | get_funcnames_from_modpath | def get_funcnames_from_modpath(modpath, include_methods=True):
"""
Get all functions defined in module
"""
import utool as ut
if True:
import jedi
source = ut.read_from(modpath)
#script = jedi.Script(source=source, source_path=modpath, line=source.count('\n') + 1)
def... | python | def get_funcnames_from_modpath(modpath, include_methods=True):
"""
Get all functions defined in module
"""
import utool as ut
if True:
import jedi
source = ut.read_from(modpath)
#script = jedi.Script(source=source, source_path=modpath, line=source.count('\n') + 1)
def... | [
"def",
"get_funcnames_from_modpath",
"(",
"modpath",
",",
"include_methods",
"=",
"True",
")",
":",
"import",
"utool",
"as",
"ut",
"if",
"True",
":",
"import",
"jedi",
"source",
"=",
"ut",
".",
"read_from",
"(",
"modpath",
")",
"#script = jedi.Script(source=sour... | Get all functions defined in module | [
"Get",
"all",
"functions",
"defined",
"in",
"module"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L311-L334 | train | Get all functions defined in a module |
Erotemic/utool | utool/util_inspect.py | check_module_usage | def check_module_usage(modpath_patterns):
"""
FIXME: not fully implmented
Desired behavior is ---
Given a set of modules specified by a list of patterns, returns how the
functions defined in the modules are called: a) with themselves and b) by
other files in the project not in the given set.
... | python | def check_module_usage(modpath_patterns):
"""
FIXME: not fully implmented
Desired behavior is ---
Given a set of modules specified by a list of patterns, returns how the
functions defined in the modules are called: a) with themselves and b) by
other files in the project not in the given set.
... | [
"def",
"check_module_usage",
"(",
"modpath_patterns",
")",
":",
"import",
"utool",
"as",
"ut",
"#dpath = '~/code/ibeis/ibeis/algo/hots'",
"modpaths",
"=",
"ut",
".",
"flatten",
"(",
"[",
"ut",
".",
"glob_projects",
"(",
"pat",
")",
"for",
"pat",
"in",
"modpath_p... | FIXME: not fully implmented
Desired behavior is ---
Given a set of modules specified by a list of patterns, returns how the
functions defined in the modules are called: a) with themselves and b) by
other files in the project not in the given set.
Args:
modpath_patterns (list):
Command... | [
"FIXME",
":",
"not",
"fully",
"implmented"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L338-L545 | train | This function checks the usage of a set of modules. |
Erotemic/utool | utool/util_inspect.py | get_object_methods | def get_object_methods(obj):
"""
Returns all methods belonging to an object instance specified in by the
__dir__ function
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>>> obj = ut.NiceRepr()
>>> methods1 = ut.... | python | def get_object_methods(obj):
"""
Returns all methods belonging to an object instance specified in by the
__dir__ function
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>>> obj = ut.NiceRepr()
>>> methods1 = ut.... | [
"def",
"get_object_methods",
"(",
"obj",
")",
":",
"import",
"utool",
"as",
"ut",
"attr_list",
"=",
"(",
"getattr",
"(",
"obj",
",",
"attrname",
")",
"for",
"attrname",
"in",
"dir",
"(",
"obj",
")",
")",
"methods",
"=",
"[",
"attr",
"for",
"attr",
"i... | Returns all methods belonging to an object instance specified in by the
__dir__ function
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>>> obj = ut.NiceRepr()
>>> methods1 = ut.get_object_methods()
>>> ut.injec... | [
"Returns",
"all",
"methods",
"belonging",
"to",
"an",
"object",
"instance",
"specified",
"in",
"by",
"the",
"__dir__",
"function"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L548-L566 | train | Returns all methods belonging to an object instance specified in by the
__dir__ |
Erotemic/utool | utool/util_inspect.py | help_members | def help_members(obj, use_other=False):
r"""
Inspects members of a class
Args:
obj (class or module):
CommandLine:
python -m utool.util_inspect help_members
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
... | python | def help_members(obj, use_other=False):
r"""
Inspects members of a class
Args:
obj (class or module):
CommandLine:
python -m utool.util_inspect help_members
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
... | [
"def",
"help_members",
"(",
"obj",
",",
"use_other",
"=",
"False",
")",
":",
"import",
"utool",
"as",
"ut",
"attrnames",
"=",
"dir",
"(",
"obj",
")",
"attr_list",
"=",
"[",
"getattr",
"(",
"obj",
",",
"attrname",
")",
"for",
"attrname",
"in",
"attrname... | r"""
Inspects members of a class
Args:
obj (class or module):
CommandLine:
python -m utool.util_inspect help_members
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>>> obj = ut.DynStruct
>>> res... | [
"r",
"Inspects",
"members",
"of",
"a",
"class"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L569-L621 | train | r Help for the members of a class or module. |
Erotemic/utool | utool/util_inspect.py | get_module_owned_functions | def get_module_owned_functions(module):
"""
Replace with iter_module_doctesable (but change that name to be something better)
returns functions actually owned by the module
module = vtool.distance
"""
import utool as ut
list_ = []
for key, val in ut.iter_module_doctestable(module):
... | python | def get_module_owned_functions(module):
"""
Replace with iter_module_doctesable (but change that name to be something better)
returns functions actually owned by the module
module = vtool.distance
"""
import utool as ut
list_ = []
for key, val in ut.iter_module_doctestable(module):
... | [
"def",
"get_module_owned_functions",
"(",
"module",
")",
":",
"import",
"utool",
"as",
"ut",
"list_",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"ut",
".",
"iter_module_doctestable",
"(",
"module",
")",
":",
"belongs",
"=",
"False",
"if",
"hasattr",
... | Replace with iter_module_doctesable (but change that name to be something better)
returns functions actually owned by the module
module = vtool.distance | [
"Replace",
"with",
"iter_module_doctesable",
"(",
"but",
"change",
"that",
"name",
"to",
"be",
"something",
"better",
")"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L863-L880 | train | Returns a list of functions actually owned by the module |
Erotemic/utool | utool/util_inspect.py | is_defined_by_module | def is_defined_by_module(item, module, parent=None):
"""
Check if item is directly defined by a module.
This check may be prone to errors.
"""
flag = False
if isinstance(item, types.ModuleType):
if not hasattr(item, '__file__'):
try:
# hack for cv2 and xfeatur... | python | def is_defined_by_module(item, module, parent=None):
"""
Check if item is directly defined by a module.
This check may be prone to errors.
"""
flag = False
if isinstance(item, types.ModuleType):
if not hasattr(item, '__file__'):
try:
# hack for cv2 and xfeatur... | [
"def",
"is_defined_by_module",
"(",
"item",
",",
"module",
",",
"parent",
"=",
"None",
")",
":",
"flag",
"=",
"False",
"if",
"isinstance",
"(",
"item",
",",
"types",
".",
"ModuleType",
")",
":",
"if",
"not",
"hasattr",
"(",
"item",
",",
"'__file__'",
"... | Check if item is directly defined by a module.
This check may be prone to errors. | [
"Check",
"if",
"item",
"is",
"directly",
"defined",
"by",
"a",
"module",
".",
"This",
"check",
"may",
"be",
"prone",
"to",
"errors",
"."
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1052-L1101 | train | Check if item is directly defined by a module. |
Erotemic/utool | utool/util_inspect.py | list_class_funcnames | def list_class_funcnames(fname, blank_pats=[' #']):
"""
list_class_funcnames
Args:
fname (str): filepath
blank_pats (list): defaults to ' #'
Returns:
list: funcname_list
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
... | python | def list_class_funcnames(fname, blank_pats=[' #']):
"""
list_class_funcnames
Args:
fname (str): filepath
blank_pats (list): defaults to ' #'
Returns:
list: funcname_list
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
... | [
"def",
"list_class_funcnames",
"(",
"fname",
",",
"blank_pats",
"=",
"[",
"' #'",
"]",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"file_",
":",
"lines",
"=",
"file_",
".",
"readlines",
"(",
")",
"funcname_list",
"=",
"[",
"]",
... | list_class_funcnames
Args:
fname (str): filepath
blank_pats (list): defaults to ' #'
Returns:
list: funcname_list
Example:
>>> # DISABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> fname = 'util_class.py'
>>> blank_pats = [' #']
... | [
"list_class_funcnames"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1153-L1187 | train | Function list_class_funcnames - List all functions in a class file |
Erotemic/utool | utool/util_inspect.py | inherit_kwargs | def inherit_kwargs(inherit_func):
"""
TODO move to util_decor
inherit_func = inspect_pdfs
func = encoder.visualize.im_func
"""
import utool as ut
keys, is_arbitrary = ut.get_kwargs(inherit_func)
if is_arbitrary:
keys += ['**kwargs']
kwargs_append = '\n'.join(keys)
#from s... | python | def inherit_kwargs(inherit_func):
"""
TODO move to util_decor
inherit_func = inspect_pdfs
func = encoder.visualize.im_func
"""
import utool as ut
keys, is_arbitrary = ut.get_kwargs(inherit_func)
if is_arbitrary:
keys += ['**kwargs']
kwargs_append = '\n'.join(keys)
#from s... | [
"def",
"inherit_kwargs",
"(",
"inherit_func",
")",
":",
"import",
"utool",
"as",
"ut",
"keys",
",",
"is_arbitrary",
"=",
"ut",
".",
"get_kwargs",
"(",
"inherit_func",
")",
"if",
"is_arbitrary",
":",
"keys",
"+=",
"[",
"'**kwargs'",
"]",
"kwargs_append",
"=",... | TODO move to util_decor
inherit_func = inspect_pdfs
func = encoder.visualize.im_func | [
"TODO",
"move",
"to",
"util_decor",
"inherit_func",
"=",
"inspect_pdfs",
"func",
"=",
"encoder",
".",
"visualize",
".",
"im_func"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1227-L1247 | train | inherit kwargs from base_func |
Erotemic/utool | utool/util_inspect.py | dummy_func | def dummy_func(arg1, arg2, arg3=None, arg4=[1, 2, 3], arg5={}, **kwargs):
"""
test func for kwargs parseing
"""
foo = kwargs.get('foo', None)
bar = kwargs.pop('bar', 4)
foo2 = kwargs['foo2']
foobar = str(foo) + str(bar) + str(foo2)
return foobar | python | def dummy_func(arg1, arg2, arg3=None, arg4=[1, 2, 3], arg5={}, **kwargs):
"""
test func for kwargs parseing
"""
foo = kwargs.get('foo', None)
bar = kwargs.pop('bar', 4)
foo2 = kwargs['foo2']
foobar = str(foo) + str(bar) + str(foo2)
return foobar | [
"def",
"dummy_func",
"(",
"arg1",
",",
"arg2",
",",
"arg3",
"=",
"None",
",",
"arg4",
"=",
"[",
"1",
",",
"2",
",",
"3",
"]",
",",
"arg5",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"foo",
"=",
"kwargs",
".",
"get",
"(",
"'foo'",
","... | test func for kwargs parseing | [
"test",
"func",
"for",
"kwargs",
"parseing"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1261-L1269 | train | test func for kwargs parseing
|
Erotemic/utool | utool/util_inspect.py | get_kwdefaults | def get_kwdefaults(func, parse_source=False):
r"""
Args:
func (func):
Returns:
dict:
CommandLine:
python -m utool.util_inspect get_kwdefaults
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>... | python | def get_kwdefaults(func, parse_source=False):
r"""
Args:
func (func):
Returns:
dict:
CommandLine:
python -m utool.util_inspect get_kwdefaults
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>... | [
"def",
"get_kwdefaults",
"(",
"func",
",",
"parse_source",
"=",
"False",
")",
":",
"#import utool as ut",
"#with ut.embed_on_exception_context:",
"argspec",
"=",
"inspect",
".",
"getargspec",
"(",
"func",
")",
"kwdefaults",
"=",
"{",
"}",
"if",
"argspec",
".",
"... | r"""
Args:
func (func):
Returns:
dict:
CommandLine:
python -m utool.util_inspect get_kwdefaults
Example:
>>> # ENABLE_DOCTEST
>>> from utool.util_inspect import * # NOQA
>>> import utool as ut
>>> func = dummy_func
>>> parse_source = Tr... | [
"r",
"Args",
":",
"func",
"(",
"func",
")",
":"
] | 3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L1276-L1314 | train | r Get keyword defaults for a function |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.