sumolib.miscutils
index
/usr/src/packages/BUILD/tools/sumolib/miscutils.py

# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2012-2023 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

 
Modules
       
codecs
colorsys
gzip
io
math
os
random
socket
sys
time

 
Classes
       
builtins.dict(builtins.object)
priorityDictionary
builtins.object
Colorgen
working_dir

 
class Colorgen(builtins.object)
     Methods defined here:
__call__(self)
return constant or randomized rgb-color string
__init__(self, hsv, cycleLength=10.67)
Initialize self.  See help(type(self)) for accurate signature.
byteTuple(self)
return color as a tuple of bytes each in [0,255]
floatTuple(self)
return color as a tuple of floats each in [0,1]
get_value(self, opt, index)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
DISTINCT = [(0.17, 1.0, 0.5), (0.0, 0.9, 1.0), (0.35, 0.67, 0.71), (0.14, 0.9, 1.0), (0.56, 1.0, 0.78), (0.07, 0.8, 0.96), (0.79, 0.83, 0.71), (0.5, 0.71, 0.94), (0.84, 0.79, 0.94), (0.2, 0.76, 0.96), (0.0, 0.24, 0.98), (0.5, 1.0, 0.5), (0.77, 0.25, 1.0), (0.09, 0.76, 0.67), (0.15, 0.22, 1.0), (0.0, 1.0, 0.5), (0.38, 0.33, 1.0), (0.67, 1.0, 0.5)]

 
class priorityDictionary(builtins.dict)
    dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
    (key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
    d = {}
    for k, v in iterable:
        d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
    in the keyword argument list.  For example:  dict(one=1, two=2)
 
 
Method resolution order:
priorityDictionary
builtins.dict
builtins.object

Methods defined here:
__init__(self)
Initialize priorityDictionary by creating binary heap
of pairs (value,key).  Note that changing or removing a dict entry will
not remove the old pair from the heap until it is found by smallest() or
until the heap is rebuilt.
__iter__(self)
Create destructive sorted iterator of priorityDictionary.
__setitem__(self, key, val)
Change value stored in dictionary and add corresponding
pair to heap.  Rebuilds the heap if the number of deleted items grows
too large, to avoid memory leakage.
setdefault(self, key, val)
Reimplement setdefault to call our customized __setitem__.
smallest(self)
Find smallest item after removing deleted items from heap.
update(self, other)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from builtins.dict:
__contains__(self, key, /)
True if D has a key k, else False.
__delitem__(self, key, /)
Delete self[key].
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(self, value, /)
Return self>value.
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.
__repr__(self, /)
Return repr(self).
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(iterable, value=None, /) from builtins.type
Returns a new dict with keys from iterable and values equal to value.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
items(...)
D.items() -> a set-like object providing a view on D's items
keys(...)
D.keys() -> a set-like object providing a view on D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
values(...)
D.values() -> an object providing a view on D's values

Data and other attributes inherited from builtins.dict:
__hash__ = None

 
class working_dir(builtins.object)
    temporarily change working directory using 'with' statement
 
  Methods defined here:
__enter__(self)
__exit__(self, type, value, traceback)
__init__(self, dir)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
benchmark(func)
decorator for timing a function
euclidean(a, b)
# euclidean distance between two coordinates in the plane
getFlowNumber(flow)
interpret number of vehicles from a flow parsed by sumolib.xml.parse
getFreeSocketPort(numTries=10)
getSocketStream(port, mode='rb')
humanReadableTime(seconds)
intIfPossible(val)
openz(fileOrURL, mode='r', **kwargs)
Opens transparently files, URLs and gzipped files for reading and writing.
Special file names "stdout" and "stderr" are handled as well.
Also enforces UTF8 on text output / input.
Should be compatible with python 2 and 3.
parseBool(val)
parseTime(t, factor=1)

 
Data
        SPECIAL_TIME_STRINGS = ['triggered', 'containerTriggered', 'split', 'begin']
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 16384)
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 65536)
uMax = uMax
uMin = uMin