pysys.utils.misc¶
Miscellanous utilities such as pysys.utils.misc.compareVersions
, pysys.utils.misc.setInstanceVariablesFromDict
,
and pysys.utils.misc.quoteString
.
quoteString¶
-
pysys.utils.misc.
quoteString
(s)[source]¶ Adds double quotation marks around the specified character or byte string, and additional escaping only if needed to make the meaning clear, but trying to avoid double-slashes unless actually needed since it makes paths harder to read.
If a byte string is provided then the
repr()
representation is used instead.
compareVersions¶
-
pysys.utils.misc.
compareVersions
(v1, v2)[source]¶ Compares two alphanumeric dotted version strings to see which is more recent.
See
pysys.process.user.ProcessUser.compareVersions
for more details.
setInstanceVariablesFromDict¶
-
pysys.utils.misc.
setInstanceVariablesFromDict
(obj, d, errorOnMissingVariables=False)[source]¶ Sets an instance variable for each item in the specified dictionary, with automatic conversion of bool/int/float/list[str] values from strings if a default value of that type was provided as a static variable on the object.
New in version 1.6.0.
- Parameters
obj (object) – Any Python object.
d (dict[str,str]) – The properties to set
errorOnMissingVariables (bool) – Set this to True if you want an exception to be raised if the dictionary contains a key for which is there no corresponding variable on obj.