Skip to content

Commit

Permalink
fixing style eclipse-sumo#22
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Oct 12, 2022
1 parent d7843bc commit 3dfb534
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tools/import/osm/osmTaxiStop.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def main(options):
random.shuffle(places)
places = places[:fleet_size]
for idx, stopID in enumerate(places):
print(u' <trip id="taxi_%s_%s" type="taxi" depart="0.00"><stop busStop="%s" triggered="person"/></trip>' % # noqa
(stopID, idx, stopID), file=fleet_out)
print(u' <trip id="taxi_%s_%s" type="taxi" depart="0.00">' % (stopID, idx), end='', file=fleet_out)
print(u'<stop busStop="%s" triggered="person"/></trip>' % stopID, file=fleet_out)
print(u"</additional>", file=fleet_out)


Expand Down
10 changes: 6 additions & 4 deletions tools/sumolib/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
'toLane': int,
}


def supports_comments():
return sys.version_info[0] >= 3 and sys.version_info[1] >= 8


def _prefix_keyword(name, warn=False):
result = name
Expand Down Expand Up @@ -172,7 +173,7 @@ def setText(self, text):
self._text = text

def isComment(self):
return "function Comment" in str(self.name)
return "function Comment" in str(self.name)

def getComments(self):
if not supports_comments:
Expand Down Expand Up @@ -223,7 +224,7 @@ def toXML(self, initialIndent="", indent=" ", withComments=False):
'{' not in self._original_fields[i]]
if self.isComment():
if withComments:
return initialIndent + "<!-- %s -->\n" % self._text
return initialIndent + "<!-- %s -->\n" % self._text
else:
return ""
if not self._child_dict and self._text is None:
Expand Down Expand Up @@ -257,6 +258,7 @@ def parselines(xmlline, element_name, element_attrs=None, attr_conversions=None,
heterogeneous, warn):
yield x


def parse(xmlfile, element_names, element_attrs=None, attr_conversions=None,
heterogeneous=True, warn=False):
"""
Expand Down Expand Up @@ -289,7 +291,7 @@ def parse(xmlfile, element_names, element_attrs=None, attr_conversions=None,
if attr_conversions is None:
attr_conversions = {}
element_types = {}
kwargs = {'parser' : ET.XMLParser(target=ET.TreeBuilder(insert_comments=True))} if supports_comments() else {}
kwargs = {'parser': ET.XMLParser(target=ET.TreeBuilder(insert_comments=True))} if supports_comments() else {}
for _, parsenode in ET.iterparse(_open(xmlfile, None), **kwargs):
if parsenode.tag in element_names:
yield _get_compound_object(parsenode, element_types,
Expand Down
2 changes: 1 addition & 1 deletion tools/traci/_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def setAngle(self, viewID, angle):
"""
self._setCmd(tc.VAR_ANGLE, viewID, "d", angle)

def addView(self, viewID, schemeName="", in3D=False ):
def addView(self, viewID, schemeName="", in3D=False):
"""addView(string, string, bool) -> None
Adds new view and sets it to the given settings scheme (optionally as a 3D view)
"""
Expand Down

0 comments on commit 3dfb534

Please sign in to comment.