sumolib.miscutils
index
/home/delphi/gcc/sumo/tools/sumolib/miscutils.py

# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2012-2024 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)
    Colorgen(hsv, cycleLength=10.67)
 

 
  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)
    
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 the dictionary has the specified key, 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.
__ior__(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.
__or__(self, value, /)
Return self|value.
__repr__(self, /)
Return repr(self).
__reversed__(self, /)
Return a reverse iterator over the dict keys.
__ror__(self, value, /)
Return value|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
get(self, key, default=None, /)
Return the value for key if key is in the dictionary, else default.
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 the key is not found, return the default if given; otherwise,
raise a KeyError.
popitem(self, /)
Remove and return a (key, value) pair as a 2-tuple.
 
Pairs are returned in LIFO (last-in, first-out) order.
Raises KeyError if the dict is empty.
values(...)
D.values() -> an object providing a view on D's values

Class methods inherited from builtins.dict:
__class_getitem__(...) from builtins.type
See PEP 585
fromkeys(iterable, value=None, /) from builtins.type
Create a new dictionary with keys from iterable and values set to value.

Static methods inherited from builtins.dict:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

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

 
class working_dir(builtins.object)
    working_dir(dir)
 
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)
short_names(filenames, noEmpty)

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