From: Zbigniew Jędrzejewski-S. <zb...@in...> - 2014-04-01 21:11:23
|
--- python/moose/neuroml/ChannelML.py | 2 +- python/moose/neuroml/MorphML.py | 4 +- python/moose/neuroml/NetworkML.py | 2 +- .../NeuroMLUtils/NetworkMLSaxHandler.py | 72 +++++++++++----------- .../NeuroMLUtils/NetworkMLSaxHandler.py | 72 +++++++++++----------- 5 files changed, 76 insertions(+), 76 deletions(-) diff --git a/python/moose/neuroml/ChannelML.py b/python/moose/neuroml/ChannelML.py index 79ca6f9..830ee4b 100644 --- a/python/moose/neuroml/ChannelML.py +++ b/python/moose/neuroml/ChannelML.py @@ -405,7 +405,7 @@ class ChannelML(): allowed_locals['temp_adj_'+self.gate_name] = self.q10factor for i,parameter in enumerate(self.parameters): allowed_locals[parameter[0]] = self.parameters[i][1] - if kwargs.has_key('concdep'): + if 'concdep' in kwargs: concdep = kwargs['concdep'] ## ca should appear as neuroML defined 'variable_name' to eval() if concdep is not None: diff --git a/python/moose/neuroml/MorphML.py b/python/moose/neuroml/MorphML.py index 6982c87..08a20d4 100644 --- a/python/moose/neuroml/MorphML.py +++ b/python/moose/neuroml/MorphML.py @@ -131,7 +131,7 @@ class MorphML(): running_comp = moosecomp running_diameter = 0.0 running_dia_nums = 0 - if segment.attrib.has_key('parent'): + if 'parent' in segment.attrib: parentid = segment.attrib['parent'] # I assume the parent is created before the child so that I can immediately connect the child. parent = self.cellDictBySegmentId[cellname][1][parentid] ## It is always assumed that axial of parent is connected to raxial of moosesegment @@ -282,7 +282,7 @@ class MorphML(): for mechanism in cell.findall(".//{"+self.bio+"}mechanism"): mechanismname = mechanism.attrib["name"] passive = False - if mechanism.attrib.has_key("passive_conductance"): + if "passive_conductance" in mechanism.attrib: if mechanism.attrib['passive_conductance'] in ["true",'True','TRUE']: passive = True print("Loading mechanism ", mechanismname) diff --git a/python/moose/neuroml/NetworkML.py b/python/moose/neuroml/NetworkML.py index a521ed9..b671d66 100644 --- a/python/moose/neuroml/NetworkML.py +++ b/python/moose/neuroml/NetworkML.py @@ -115,7 +115,7 @@ class NetworkML(): population = target.attrib['population'] for site in target.findall(".//{"+nml_ns+"}site"): cell_id = site.attrib['cell_id'] - if site.attrib.has_key('segment_id'): segment_id = site.attrib['segment_id'] + if 'segment_id' in site.attrib: segment_id = site.attrib['segment_id'] else: segment_id = 0 # default segment_id is specified to be 0 ## population is populationname, self.populationDict[population][0] is cellname cell_name = self.populationDict[population][0] diff --git a/python/moose/xmls_to_network/twoNeurons/generatedNEURON/NeuroMLUtils/NetworkMLSaxHandler.py b/python/moose/xmls_to_network/twoNeurons/generatedNEURON/NeuroMLUtils/NetworkMLSaxHandler.py index 93ce0e0..e73b0b2 100644 --- a/python/moose/xmls_to_network/twoNeurons/generatedNEURON/NeuroMLUtils/NetworkMLSaxHandler.py +++ b/python/moose/xmls_to_network/twoNeurons/generatedNEURON/NeuroMLUtils/NetworkMLSaxHandler.py @@ -157,11 +157,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.currentProjectionName = attrs.get('name',"") self.log.debug("Found projection element: "+ self.currentProjectionName) - if attrs.has_key('source'): + if 'source' in attrs: self.currentProjectionSource = attrs.get('source',"") - if attrs.has_key('target'): + if 'target' in attrs: self.currentProjectionTarget = attrs.get('target',"") self.log.info("Projection: "+ self.currentProjectionName+" is from: "+ self.currentProjectionSource +" to: "+ self.currentProjectionTarget) @@ -171,7 +171,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.isSourceElement = 1 - elif name == 'target' and not attrs.has_key('cell_group') and not attrs.has_key('population'): + elif name == 'target' and 'cell_group' not in attrs and 'population' not in attrs: if self.currentProjectionName != "": self.isTargetElement = 1 @@ -197,27 +197,27 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.currentConnId = attrs.get('id',"") self.log.debug("Found connection element: "+ self.currentConnId) - if attrs.has_key('pre_cell_id'): + if 'pre_cell_id' in attrs: self.preCellId = attrs.get('pre_cell_id',"") - if attrs.has_key('pre_segment_id'): + if 'pre_segment_id' in attrs: self.preSegId = attrs.get('pre_segment_id',"") else: self.preSegId = 0 - if attrs.has_key('pre_fraction_along'): + if 'pre_fraction_along' in attrs: self.preFract = attrs.get('pre_fraction_along',"") else: self.preFract = 0.5 - if attrs.has_key('post_cell_id'): + if 'post_cell_id' in attrs: self.postCellId = attrs.get('post_cell_id',"") - if attrs.has_key('post_segment_id'): + if 'post_segment_id' in attrs: self.postSegId = attrs.get('post_segment_id',"") else: self.postSegId = 0 - if attrs.has_key('post_fraction_along'): + if 'post_fraction_along' in attrs: self.postFract = attrs.get('post_fraction_along',"") else: self.postFract = 0.5 @@ -232,11 +232,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'pre': if self.currentProjectionName != "": self.preCellId = attrs.get('cell_id',"") - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: self.preSegId = attrs.get('segment_id',"") else: self.preSegId = 0 - if attrs.has_key('fraction_along'): + if 'fraction_along' in attrs: self.preFract = attrs.get('fraction_along',"") else: self.preFract = 0.5 @@ -246,11 +246,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'post': if self.currentProjectionName != "": self.postCellId = attrs.get('cell_id',"") - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: self.postSegId = attrs.get('segment_id',"") else: self.postSegId = 0 - if attrs.has_key('fraction_along'): + if 'fraction_along' in attrs: self.postFract = attrs.get('fraction_along',"") else: self.postFract = 0.5 @@ -262,22 +262,22 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): if self.currentProjectionName != "": newSynapseProps = SynapseProperties() - if attrs.has_key('synapse_type'): + if 'synapse_type' in attrs: self.latestSynapseType = str(attrs.get('synapse_type')) self.log.debug("synapse_type is: "+self.latestSynapseType) - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: newSynapseProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: newSynapseProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: newSynapseProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: newSynapseProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: newSynapseProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: newSynapseProps.threshold = attrs.get('threshold',"") self.globalSynapseProps[self.latestSynapseType] = newSynapseProps @@ -295,17 +295,17 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): if self.currentProjectionName != "": newSynapseProps = SynapseProperties() - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: newSynapseProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: newSynapseProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: newSynapseProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: newSynapseProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: newSynapseProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: newSynapseProps.threshold = attrs.get('threshold',"") self.globalSynapseProps[self.latestSynapseType] = newSynapseProps @@ -319,7 +319,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): synapse_type = "" - if attrs.has_key('synapse_type'): + if 'synapse_type' in attrs: synapse_type = attrs.get('synapse_type',"") elif len(self.localSynapseProps) == 1: synapse_type = self.localSynapseProps.keys()[0] @@ -328,17 +328,17 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): synProps = self.localSynapseProps[synapse_type] self.log.debug("Changing values of local syn props of: "+ synapse_type+", was: "+ str(synProps)) - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: synProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: synProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: synProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: synProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: synProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: synProps.threshold = attrs.get('threshold',"") self.log.info("Changed vals of local syn props: "+ synapse_type+": "+ str(synProps)) @@ -367,7 +367,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'sites': size = -1 - if attrs.has_key('size'): + if 'size' in attrs: size = int(attrs.get('size',"")) @@ -378,10 +378,10 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): cell_id = int(attrs.get('cell_id',"")) segment_id = 0 fract = 0.5 - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: segment_id = int(attrs.get('segment_id',"")) - if attrs.has_key('fract'): + if 'fract' in attrs: fract = float(attrs.get('fract',"")) self.netHandler.handleSingleInput(self.currentInputName, cell_id, segment_id, fract) diff --git a/python/moose/xmls_to_network/twoNeurons/generatedPyNN/NeuroMLUtils/NetworkMLSaxHandler.py b/python/moose/xmls_to_network/twoNeurons/generatedPyNN/NeuroMLUtils/NetworkMLSaxHandler.py index 93ce0e0..e73b0b2 100644 --- a/python/moose/xmls_to_network/twoNeurons/generatedPyNN/NeuroMLUtils/NetworkMLSaxHandler.py +++ b/python/moose/xmls_to_network/twoNeurons/generatedPyNN/NeuroMLUtils/NetworkMLSaxHandler.py @@ -157,11 +157,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.currentProjectionName = attrs.get('name',"") self.log.debug("Found projection element: "+ self.currentProjectionName) - if attrs.has_key('source'): + if 'source' in attrs: self.currentProjectionSource = attrs.get('source',"") - if attrs.has_key('target'): + if 'target' in attrs: self.currentProjectionTarget = attrs.get('target',"") self.log.info("Projection: "+ self.currentProjectionName+" is from: "+ self.currentProjectionSource +" to: "+ self.currentProjectionTarget) @@ -171,7 +171,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.isSourceElement = 1 - elif name == 'target' and not attrs.has_key('cell_group') and not attrs.has_key('population'): + elif name == 'target' and 'cell_group' not in attrs and 'population' not in attrs: if self.currentProjectionName != "": self.isTargetElement = 1 @@ -197,27 +197,27 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): self.currentConnId = attrs.get('id',"") self.log.debug("Found connection element: "+ self.currentConnId) - if attrs.has_key('pre_cell_id'): + if 'pre_cell_id' in attrs: self.preCellId = attrs.get('pre_cell_id',"") - if attrs.has_key('pre_segment_id'): + if 'pre_segment_id' in attrs: self.preSegId = attrs.get('pre_segment_id',"") else: self.preSegId = 0 - if attrs.has_key('pre_fraction_along'): + if 'pre_fraction_along' in attrs: self.preFract = attrs.get('pre_fraction_along',"") else: self.preFract = 0.5 - if attrs.has_key('post_cell_id'): + if 'post_cell_id' in attrs: self.postCellId = attrs.get('post_cell_id',"") - if attrs.has_key('post_segment_id'): + if 'post_segment_id' in attrs: self.postSegId = attrs.get('post_segment_id',"") else: self.postSegId = 0 - if attrs.has_key('post_fraction_along'): + if 'post_fraction_along' in attrs: self.postFract = attrs.get('post_fraction_along',"") else: self.postFract = 0.5 @@ -232,11 +232,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'pre': if self.currentProjectionName != "": self.preCellId = attrs.get('cell_id',"") - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: self.preSegId = attrs.get('segment_id',"") else: self.preSegId = 0 - if attrs.has_key('fraction_along'): + if 'fraction_along' in attrs: self.preFract = attrs.get('fraction_along',"") else: self.preFract = 0.5 @@ -246,11 +246,11 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'post': if self.currentProjectionName != "": self.postCellId = attrs.get('cell_id',"") - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: self.postSegId = attrs.get('segment_id',"") else: self.postSegId = 0 - if attrs.has_key('fraction_along'): + if 'fraction_along' in attrs: self.postFract = attrs.get('fraction_along',"") else: self.postFract = 0.5 @@ -262,22 +262,22 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): if self.currentProjectionName != "": newSynapseProps = SynapseProperties() - if attrs.has_key('synapse_type'): + if 'synapse_type' in attrs: self.latestSynapseType = str(attrs.get('synapse_type')) self.log.debug("synapse_type is: "+self.latestSynapseType) - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: newSynapseProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: newSynapseProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: newSynapseProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: newSynapseProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: newSynapseProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: newSynapseProps.threshold = attrs.get('threshold',"") self.globalSynapseProps[self.latestSynapseType] = newSynapseProps @@ -295,17 +295,17 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): if self.currentProjectionName != "": newSynapseProps = SynapseProperties() - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: newSynapseProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: newSynapseProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: newSynapseProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: newSynapseProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: newSynapseProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: newSynapseProps.threshold = attrs.get('threshold',"") self.globalSynapseProps[self.latestSynapseType] = newSynapseProps @@ -319,7 +319,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): synapse_type = "" - if attrs.has_key('synapse_type'): + if 'synapse_type' in attrs: synapse_type = attrs.get('synapse_type',"") elif len(self.localSynapseProps) == 1: synapse_type = self.localSynapseProps.keys()[0] @@ -328,17 +328,17 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): synProps = self.localSynapseProps[synapse_type] self.log.debug("Changing values of local syn props of: "+ synapse_type+", was: "+ str(synProps)) - if attrs.has_key('internal_delay'): + if 'internal_delay' in attrs: synProps.internalDelay = attrs.get('internal_delay',"") - if attrs.has_key('pre_delay'): + if 'pre_delay' in attrs: synProps.preDelay = attrs.get('pre_delay',"") - if attrs.has_key('post_delay'): + if 'post_delay' in attrs: synProps.postDelay = attrs.get('post_delay',"") - if attrs.has_key('prop_delay'): + if 'prop_delay' in attrs: synProps.propDelay = attrs.get('prop_delay',"") - if attrs.has_key('weight'): + if 'weight' in attrs: synProps.weight = attrs.get('weight',"") - if attrs.has_key('threshold'): + if 'threshold' in attrs: synProps.threshold = attrs.get('threshold',"") self.log.info("Changed vals of local syn props: "+ synapse_type+": "+ str(synProps)) @@ -367,7 +367,7 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): elif name == 'sites': size = -1 - if attrs.has_key('size'): + if 'size' in attrs: size = int(attrs.get('size',"")) @@ -378,10 +378,10 @@ class NetworkMLSaxHandler(xml.sax.ContentHandler): cell_id = int(attrs.get('cell_id',"")) segment_id = 0 fract = 0.5 - if attrs.has_key('segment_id'): + if 'segment_id' in attrs: segment_id = int(attrs.get('segment_id',"")) - if attrs.has_key('fract'): + if 'fract' in attrs: fract = float(attrs.get('fract',"")) self.netHandler.handleSingleInput(self.currentInputName, cell_id, segment_id, fract) -- 1.8.5.3 |