Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
'''

import traceback as _traceback
from contextlib import contextmanager
from contextlib import nested
from html import HTML
from numpy import array
from numpy import where
Expand All @@ -53,6 +51,11 @@
_tmgTPB = _MODELLER.module('tmg.common.TMG_tool_page_builder')
EMME_VERSION = _util.getEmmeVersion(float)

# import six library for python2 to python3 conversion
import six
# initalize python3 types
_util.initalizeModellerTypes(_m)

##########################################################################################################

class CheckNetworkConnectivity(_m.Tool()):
Expand Down Expand Up @@ -264,9 +267,9 @@ def _CheckAutoConnectivity(self, demandMatrixId, dataTuples):
for i, modeId in enumerate(self.AutoModeIds):
classInfo.append((modeId, timesMatrices[i].id))

print "Auto assignment prepared."
print("Auto assignment prepared.")
self._RunAutoAssignment(demandMatrixId, classInfo)
print "Auto assignment complete."
print("Auto assignment complete.")

bank = _MODELLER.emmebank
for modeId, matrixId in classInfo:
Expand All @@ -276,7 +279,7 @@ def _CheckAutoConnectivity(self, demandMatrixId, dataTuples):
fountains, sinks, orphans = self._GetDisconnectedNodes(matrix)
dataTuples.append(("Auto", [modeId], fountains, sinks, orphans))

print "Processed auto mode %s" %modeId
print("Processed auto mode %s" %modeId)

def _RunAutoAssignment(self, demandMatrixId, classInfo):

Expand Down Expand Up @@ -330,13 +333,13 @@ def _CheckTransitConnectivity(self, demandMatrixId, dataTuples):
with _util.tempMatrixMANAGER(description="Transit times matrix") as timesMatrix:

self._RunTransitAssignment(demandMatrixId, timesMatrix.id)
print "Transit assignment complete."
print("Transit assignment complete.")

matrix = _MODELLER.emmebank.matrix(timesMatrix.id)
fountains, sinks, orphans = self._GetDisconnectedNodes(matrix)

dataTuples.append(("Transit", self.TransitModeIds, fountains, sinks, orphans))
print "Processed transit connectivity."
print("Processed transit connectivity.")

def _RunTransitAssignment(self, demandMatrixId, timesMatrixId):
spec = {
Expand Down Expand Up @@ -491,7 +494,7 @@ def preload_auto_modes(self):
options.append(str(h.option(text, value= id)))
return "\n".join(options)

@_m.method(return_type=unicode)
@_m.method(return_type=six.u)
def preload_transit_modes(self):
options = []
h = HTML()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ def _Execute(self):

if self.LinkFlagAttributeId is not None:
for link in network.links(): link[self.LinkFlagAttributeId] = 0
print ("Reset link extra attribute '%s' to 0") %self.LinkFlagAttributeId
print ("Reset link extra attribute '%s' to 0" %self.LinkFlagAttributeId)
if self.LineFlagAttributeId is not None:
for line in network.transit_lines(): link[self.LineFlagAttributeId] = 0
print ("Reset transit line extra attribute '%s' to 0") %self.LineFlagAttributeId
print ("Reset transit line extra attribute '%s' to 0" %self.LineFlagAttributeId)
if self.SegmentFlagAttributeId is not None:
for seg in network.transit_segments(): seg[self.SegmentFlagAttributeId] = 0
print ("Reset transit segment extra attribute '%s' to 0") %self.SegmentFlagAttributeId
print ("Reset transit segment extra attribute '%s' to 0" %self.SegmentFlagAttributeId)

print ("Checking links")
self.TRACKER.startProcess(network.element_totals['links'])
Expand Down