Version 3 (modified by 7 weeks ago) ( diff ) | ,
---|
Python version of utilities.
installation
Check utilitiespy/dist for latest version info. Typically you need something like this in your requirements.txt
https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/314/utilitiespy/dist/utilities-1.0.5.tar.gz
and this in your install_requires in setup.py:
"utilities@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/314/utilitiespy/dist/utilities-1.0.5.tar.gz"
immutablelist
This is a partial translation of the java immutablelist.
listener
This is a translation of the java Listener
Tools
Tools contains a set of small tools for python.
enum
enum is a tool to support 'classic enums' in python. The classic way was to just put enumeration values inside a class. For example, math.pi equals the number 3.1415 etc. We refer to pi in math.pi as an enum item in the math class. We call this the "classic" enumeration, to distinguish it from the more complex Enum type in python.
This tool assumes that all enum items in the class are actual instances of that class. So for example, this SimpleEnum class contains enum items P and Q:
class SimpleEnum: def val(self) -> str: return "$" @staticmethod def _static_init_(): SimpleEnum.P = SimpleEnum() SimpleEnum.Q = SimpleEnum() SimpleEnum._static_init_()
the enum method enumValues(claz) returns all the enum items contained in that claz. So in the above example, enumValues(SimpleEnum) -> [SimpleEnum.P, SimpleEnum.Q]
.
The enum method enumToString(item) returns the string representation. So in the above example, enumToString(SimpleEnum.P) returns "P".