Skip to content

Commit

Permalink
fixing style #22
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Oct 16, 2024
1 parent d2aa78e commit 3c360a3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tools/build_config/setup-traci.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
## Contributing
If you find a bug in TraCI or have a suggestion for a new feature, please report it on the SUMO issue tracker at
[https://github.com/eclipse-sumo/sumo/issues](https://github.com/eclipse-sumo/sumo/issues). If you would like to contribute
code to TraCI, please submit a pull request to the SUMO repository at
[https://github.com/eclipse-sumo/sumo/issues](https://github.com/eclipse-sumo/sumo/issues).
If you would like to contribute code to TraCI, please submit a pull request to the SUMO repository at
[https://github.com/eclipse-sumo/sumo](https://github.com/eclipse-sumo/sumo).
## License
Expand Down
8 changes: 4 additions & 4 deletions tools/createScreenshotSequence.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def getOptions(args=None):
argParser.add_argument("--zoom",
help="linear interpolation of zoom values given the key frames syntax t1:v1[;t2:v2 ...]")
argParser.add_argument("--rotate",
help="linear interpolation to rotation values in degrees (around Z axis) given the key frames \
syntax t1:v1[;t2:v2 ...]")
help="linear interpolation to rotation values in degrees (around Z axis) "
"given the key frames syntax t1:v1[;t2:v2 ...]")
argParser.add_argument("--translate",
help="linear interpolation to the given view center points with the key frames syntax \
t1:p1[;t2:p2 ...] where p1 is \"x,y\"")
help="linear interpolation to the given view center points "
"with the key frames syntax t1:p1[;t2:p2 ...] where p1 is \"x,y\"")
argParser.add_argument("--include-time", dest="includeTime", category="processing", action="store_true",
default=False,
help="whether to include the system time at simulation begin in the file name")
Expand Down
2 changes: 1 addition & 1 deletion tools/generateRailSignalConstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ def writeConstraint(options, outf, tag, c):
comment += "busStop=%s " % c.busStop
commentParams.append(("busStop", c.busStop))
if c.busStop2 is not None:
if type(c.busStop2) == list:
if isinstance(c.busStop2, list):
for k, v in c.busStop2:
comment += "%s=%s " % (k, v)
commentParams.append((k, v))
Expand Down
6 changes: 3 additions & 3 deletions tools/net/abstractRail.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def transform(coord):
def getEdgeOrdering(edgeIDs, ordering, useOutgoing):
result = []
for vN in ordering:
if type(vN) == sumolib.net.edge.Edge:
if isinstance(vN, sumolib.net.edge.Edge):
result.append(vN.getID())
else:
edges = vN.getOutgoing() if useOutgoing else vN.getIncoming()
Expand Down Expand Up @@ -312,9 +312,9 @@ def computeTrackOrdering(options, mainLine, edges, nodeCoords, edgeShapes):

def optimizeTrackOrder(options, edges, nodes, orderings, nodeCoords):
constrainedEdges = set()
for nodeID, ordering in orderings:
for _, ordering in orderings:
for vNode in ordering:
if type(vNode) == sumolib.net.edge.Edge:
if isinstance(vNode, sumolib.net.edge.Edge):
constrainedEdges.add(vNode)

# every node and every edge is assigned a single y-values
Expand Down
3 changes: 2 additions & 1 deletion tools/traci/_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def setLineWidth(self, polygonID, lineWidth):
self._setCmd(tc.VAR_WIDTH, polygonID, "d", lineWidth)

def add(self, polygonID, shape, color, fill=False, polygonType="", layer=0, lineWidth=1):
"""add(string, list((double, double)), (integer, integer, integer, integer), bool, string, integer, double) -> None
"""add(string, list((double, double)), (integer, integer, integer, integer),
bool, string, integer, double) -> None
Adds a new polygon.
"""
self._setCmd(tc.ADD, polygonID, "tscBipd", 6, polygonType, color, fill, layer, shape, lineWidth)
Expand Down
4 changes: 2 additions & 2 deletions tools/traci/_trafficlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def setNemaSplits(self, tlsID, splits):
Time 0 must be used of the phase does not exists.
Example: “11.0 34.0 15.0 20.0 11.0 34.0 15.0 20.0" (gives total cycle length of 80s)
"""
if type(splits) == list:
if isinstance(splits, list):
splits = ' '.join(map(str, splits))
self.setParameter(tlsID, "NEMA.splits", splits)

Expand All @@ -381,7 +381,7 @@ def setNemaMaxGreens(self, tlsID, maxGreens):
Time 0 must be used of the phase does not exists.
Example: “11.0 34.0 15.0 20.0 11.0 34.0 15.0 20.0"
"""
if type(maxGreens) == list:
if isinstance(maxGreens, list):
maxGreens = ' '.join(map(str, maxGreens))
self.setParameter(tlsID, "NEMA.maxGreens", maxGreens)

Expand Down
2 changes: 1 addition & 1 deletion tools/traci/_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ def setAdaptedTraveltime(self, vehID, edgeID, time=None, begTime=None, endTime=N
If begTime or endTime are not specified the value is set for the whole
simulation duration.
"""
if type(edgeID) != str and type(begTime) == str:
if not isinstance(edgeID, str) and isinstance(begTime, str):
# legacy handling
warnings.warn(
"Parameter order has changed for setAdaptedTraveltime(). Attempting legacy ordering. " +
Expand Down

0 comments on commit 3c360a3

Please sign in to comment.