Skip to content

Commit

Permalink
cleaned python code
Browse files Browse the repository at this point in the history
  • Loading branch information
ephii committed Jun 26, 2018
1 parent 3942cad commit 45d606f
Show file tree
Hide file tree
Showing 38 changed files with 147 additions and 140 deletions.
6 changes: 3 additions & 3 deletions tests/complex/scenario_generation/demand_models/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
for s in demand.streams:
vehicles1.extend(s.toVehicles(0, 86400))

#demand.build(0, 3600, 3600, "net.net.xml", "linear.rou.xml")
# demand.build(0, 3600, 3600, "net.net.xml", "linear.rou.xml")

demand = Demand()
demand.addStream(Stream(None, 0, 39600, 400, "from", "to", "passenger"))
Expand All @@ -41,15 +41,15 @@
vehicles2 = []
for s in demand.streams:
vehicles2.extend(s.toVehicles(0, 86400))
#demand.build(0, 3600, 3600, "net.net.xml", "linear.rou.xml")
# demand.build(0, 3600, 3600, "net.net.xml", "linear.rou.xml")

vehicles3 = [] # [600, 0, .000025, 14400]
demand = Demand()
demand.addStream(Stream(None, None, None, WaveComposition(
800, [[400, 0, .000025, 14400], [200, 0, .00001, 14400]]), "from", "to", "passenger"))
for s in demand.streams:
vehicles3.extend(s.toVehicles(0, 86400))
#demand.build(0, 3600, "net.net.xml", "linear.rou.xml")
# demand.build(0, 3600, "net.net.xml", "linear.rou.xml")

STEP = 300
d1 = [0] * (86400 / STEP)
Expand Down
2 changes: 1 addition & 1 deletion tests/complex/simpla/config/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def setUp(self):
<vTypeMap original="origVTypeID" leader="leaderVTypeID" follower="followerVTypeID" catchup="catchupVTypeID" catchupFollower="catchupFollowerVTypeID" />
"""
self.cfg_body1 =\
"""
"""
<controlRate value="0" />
<vehicleSelectors>empty</vehicleSelectors>
<maxPlatoonGap value="-1" />
Expand Down
2 changes: 1 addition & 1 deletion tests/complex/tutorial/city_mobil/agentManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(self):
self.cyberCars = []

def personArrived(self, personID, edge, target):
if not personID in self.agents:
if personID not in self.agents:
person = PersonAgent(personID)
self.agents[personID] = person
person.startRequest(edge.replace("footmain", "cyber"),
Expand Down
2 changes: 1 addition & 1 deletion tests/complex/tutorial/city_mobil/simpleManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self):
self.personsWaitingAt = {}

def personArrived(self, personID, edge, target):
if not edge in self.personsWaitingAt:
if edge not in self.personsWaitingAt:
self.personsWaitingAt[edge] = []
self.personsWaitingAt[edge].append((personID, target))

Expand Down
6 changes: 3 additions & 3 deletions tests/complex/tutorial/city_mobil/vehicleControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def getPosition(vehicleID):


def stopAt(vehicleID, edge, pos=None):
if pos == None:
if pos is None:
pos = STOP_POS
if edge.endswith("out") or edge.endswith("in"):
pos = 90.
Expand Down Expand Up @@ -154,7 +154,7 @@ def _rerouteCar(vehicleID):
for idx in range(SLOTS_PER_ROW):
for dir in ["l", "r"]:
slotEdge = "slot%s-%s%s" % (rowIdx, idx, dir)
if not slotEdge in occupancy:
if slotEdge not in occupancy:
occupancy[slotEdge] = vehicleID
stopAt(vehicleID, slotEdge, SLOT_LENGTH - 5.)
return
Expand Down Expand Up @@ -188,7 +188,7 @@ def _checkInitialPositions(vehicleID, edge, pos):
elif "foot" in edge:
traci.vehicle.setStop(vehicleID, "-" + edge)
parkEdge = edge.replace("foot", "slot")
if not parkEdge in persons:
if parkEdge not in persons:
persons[parkEdge] = []
persons[parkEdge].append(vehicleID)
vehicleStatus[vehicleID].parking = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# go to inspect mode
netedit.deleteMode()

#delete busStop
# delete busStop
netedit.leftClick(match, 420, 295)

# undo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,3 @@

# quit netedit
netedit.quit(neteditProcess)


Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@

# quit netedit
netedit.quit(neteditProcess)

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# move Acces 1
netedit.moveElement(match, -147, 163, 100, 163)

#move Acces 2
# move Acces 2
netedit.moveElement(match, 100, 163, -100, 163)

# Check undo redo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@
# create calibrator with a valid parameter in other lane
netedit.leftClick(match, 200, 230)

# change output with an invalid value
# change output with an invalid value
netedit.modifyAdditionalDefaultValue(5, "%%%%###!!!")

# create calibrator with a valid parameter in other lane
netedit.leftClick(match, 200, 230)

# change output with an valid value
# change output with an valid value
netedit.modifyAdditionalDefaultValue(5, "myOwnOutput")

# create calibrator with a valid parameter in other lane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
# set valid filename
netedit.modifyAdditionalDefaultValue(4, "myOwnFilename.txt")

#create E2 with valid filename
# create E2 with valid filename
netedit.leftClick(match, 400, 250)

# Change cont
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@
# create calibrator with a valid parameter in other lane
netedit.leftClick(match, 200, 230)

# change output with an invalid value
# change output with an invalid value
netedit.modifyAdditionalDefaultValue(5, "%%%%###!!!")

# create calibrator with a valid parameter in other lane
netedit.leftClick(match, 200, 230)

# change output with an valid value
# change output with an valid value
netedit.modifyAdditionalDefaultValue(5, "myOwnOutput")

# create calibrator with a valid parameter in other lane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,3 @@

# quit netedit
netedit.quit(neteditProcess)
"""
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,3 @@

# quit netedit
netedit.quit(neteditProcess)

Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,3 @@

# quit netedit
netedit.quit(neteditProcess)

Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,3 @@

# quit netedit
netedit.quit(neteditProcess)

Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@

# quit netedit
netedit.quit(neteditProcess)

2 changes: 1 addition & 1 deletion tests/netedit/basic/open_configuration/test.sikuli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import neteditTestFunctions as netedit # noqa

# Open netedit without search the pink square reference
neteditProcess, match= netedit.setupAndStart(neteditTestRoot, ['--configuration-file', 'input_net.netccfg'])
neteditProcess, match = netedit.setupAndStart(neteditTestRoot, ['--configuration-file', 'input_net.netccfg'])

# save loaded network as (for texttest comparing)
netedit.saveNetwork()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
netedit.selectMode()

# select node 1
netedit.leftClick(match, 315, 220)
netedit.leftClick(match, 315, 220)

# select node 2
netedit.leftClick(match, 415, 220)
Expand Down
1 change: 0 additions & 1 deletion tests/netedit/bugs/ticket3900/test.sikuli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@

# quit netedit
netedit.quit(neteditProcess, True, True, True, False)

3 changes: 2 additions & 1 deletion tests/netedit/netElements/edges/inspectB/test.sikuli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
netedit.modifyAttribute(10, "")

# Change parameter 10 with a valid value (empty)
netedit.modifyAttribute(10, "emergency authority army vip passenger hov bus coach tram rail_urban rail rail_electric motorcycle moped pedestrian custom1")
netedit.modifyAttribute(
10, "emergency authority army vip passenger hov bus coach tram rail_urban rail rail_electric motorcycle moped pedestrian custom1")

# Change parameter 11 with an non valid value (dummy)
netedit.modifyAttribute(11, "dummyShape")
Expand Down
Loading

0 comments on commit 45d606f

Please sign in to comment.