schrodinger.application.matsci.qeschema.qeschema.utils module¶
- schrodinger.application.matsci.qeschema.qeschema.utils.set_logger(loglevel=1, logfile=None)[source]¶
Setup a basic logger with an handler and a formatter, using a corresponding numerical range [0..4], where a higher value means a more verbose logging. The loglevel value is mapped to correspondent logging module’s value:
LOG_CRIT=0 (syslog.h value is 2) ==> logging.CRITICAL LOG_ERR=1 (syslog.h value is 3) ==> logging.ERROR LOG_WARNING=2 (syslog.h value is 4) ==> logging.WARNING LOG_INFO=3 (syslog.h value is 6) ==> logging.INFO LOG_DEBUG=4 (syslog.h value is 7) ==> logging.DEBUG
If a logfile name is passed then writes logs to file, instead of send logs to the standard output.
- Parameters
loglevel – Simplified POSIX’s syslog like logging level index
logfile – Logfile name for non-scripts runs
- schrodinger.application.matsci.qeschema.qeschema.utils.etree_iter_path(elem, tag=None, path='.')[source]¶
Iterate an ElementTree structure giving back couples with an element and its path.
- Parameters
elem – root of the ElementTree
tag – Optional tag matching argument.
path – Argument element path
- schrodinger.application.matsci.qeschema.qeschema.utils.to_fortran(value)[source]¶
Translate a Python value to the equivalent literal representation for Fortran input. Leading and trailing spaces characters are removed from strings.
- class schrodinger.application.matsci.qeschema.qeschema.utils.BiunivocalMap(*args, **kwargs)[source]¶
Bases:
collections.abc.MutableMapping
A dictionary that implements a bijective correspondence, namely with constraints of uniqueness both on keys and on values. Both keys and values must be hashable.
- getkey(value, default=None)[source]¶
If value is in dictionary’s values, returns the key correspondent to the value, else returns the default argument.
- clear() None. Remove all items from D. ¶
- get(k[, d]) D[k] if k in D, else d. d defaults to None. ¶
- items() a set-like object providing a view on D’s items ¶
- keys() a set-like object providing a view on D’s keys ¶
- 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() (k, v), remove and return some (key, value) pair ¶
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D ¶
- update([E, ]**F) None. Update D from mapping/iterable E and F. ¶
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D’s values ¶