Skip to content

Commit

Permalink
fixing style refs #21
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 20, 2024
1 parent 14472eb commit 49c2f77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/complex/sumo/gui/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
import sys
import time
import warnings
warnings.simplefilter("ignore")

import pyautogui
warnings.simplefilter("ignore")

if "SUMO_HOME" in os.environ:
sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))
Expand All @@ -34,6 +33,7 @@
PLAY = os.path.join("data", "play.png")
STOP = os.path.join("data", "stop.png")


def findAndClick(obj):
positionOnScreen = pyautogui.locateOnScreen(obj, minSearchTime=3)
pyautogui.moveTo(positionOnScreen)
Expand Down
15 changes: 7 additions & 8 deletions tools/ptlines2flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ def __init__(self, ref, name, completeness, missingBefore, missingAfter,
self.stop_ids = stop_ids
self.vias = vias
# stop indices that need special handling
self.jumps = {} # stopIndex -> duration
self.jumps = {} # stopIndex -> duration
self.terminalIndices = []
self.repeat = None


def writeTypes(fout, prefix, options):
Expand Down Expand Up @@ -181,8 +180,8 @@ def createTrips(options):
if stop.name:
stopNames[stop.id] = stop.attr_name

tripList = [] # ids
trpMap = {} # ids->PTLine
tripList = [] # ids
trpMap = {} # ids->PTLine

departTimes = [options.begin for line in sumolib.output.parse_fast(options.ptlines, 'ptLine', ['id'])]
if options.randomBegin:
Expand Down Expand Up @@ -367,7 +366,6 @@ def joinTrips(options, tripList, trpMap):
ptl1.jumps[len(ptl1.stop_ids) - 1] = missingPart2 * options.jumpDuration
ptl1.terminalIndices.append(len(ptl1.stop_ids) - 1)


elif join2:
# only append ptl1 after ptl2
tripList.remove(tripIDs[0])
Expand Down Expand Up @@ -449,7 +447,6 @@ def createRoutes(options, trpMap, stopNames):
ft = formatTime if options.hrtime else lambda x: x

with codecs.open(options.outfile, 'w', encoding="UTF8") as foutflows:
joinedLines = set()
flows = []
actualDepart = {} # departure may be delayed when the edge is not yet empty
sumolib.writeXMLHeader(foutflows, root="routes", options=options)
Expand Down Expand Up @@ -520,8 +517,9 @@ def createRoutes(options, trpMap, stopNames):
if options.multistart and len(ptline.terminalIndices) == 2:
# vehicles stay in a continuous loop. We create a fixed number of vehicles with repeating routes
for i in range(number):
departEdge = int(i * routeSize[flowID] / float(number)) # this is a hack since edges could have very different lengths
foutflows.write(' <vehicle id="%s.%s" type="%s" route="%s" depart="%s" departEdge="%s" line="%s" %s>\n' % (
# this is a hack since edges could have very different lengths
departEdge = int(i * routeSize[flowID] / float(number))
foutflows.write(' <vehicle id="%s.%s" type="%s" route="%s" depart="%s" departEdge="%s" line="%s" %s>\n' % ( # noqa
flowID, i, type, flowID, ft(begin), departEdge, ptline.ref, options.flowattrs))
writeParams(foutflows, ptline)
foutflows.write(' </vehicle>\n')
Expand All @@ -540,6 +538,7 @@ def createRoutes(options, trpMap, stopNames):

print("done.")


def writeParams(foutflows, ptline):
if ptline.name is not None:
foutflows.write(' <param key="name" value=%s/>\n' % quoteattr(ptline.name))
Expand Down

0 comments on commit 49c2f77

Please sign in to comment.