Module zut
Reusable Python utilities (top-level API).
Functions
|
Add the given function or module as a command. |
|
Add all sub modules of the given package as commands. |
|
|
|
|
|
Improve message in case of subprocess error, to ease debugging. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dump an object (if data is not an iterable) or a an iterable of dicts or iterables (if data is an iterable). |
|
Export any data object, in JSON format, or using pretty print. |
|
|
Erase text written using |
|
|
|
|
Read an environment variable as a boolean value. |
|
|
|
|
|
|
|
Read an environment variable as an integer value. |
|
Return current locale lang, for example: fr_FR. |
|
Read an environment variable as a list value. |
|
|
|
Read a secret value from an environment variable if given, or from the file indicated by environment variable {name}_FILE if given, or from the file /run/secrets/{name} if the application is running in a Docker container. |
|
Read an environment variable. |
|
Convert from bytes to GigiBytes. |
|
|
|
Get a human-readable representation of a number of bytes. |
|
Get a human-readable representation of a number. |
Indicate whether the application is running in a Docker container. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Convert from bytes to KiliBytes. |
|
|
|
Make a datetime aware in timezone tz (use tz=None or tz='localtime' for the system local timezone). |
|
Make a datetime naive and expressed in timezone tz (use tz=None or tz='localtime' for the system local timezone). |
|
Convert from bytes to MegiBytes. |
|
Get the current datetime in the timezone tz (use tz=None or tz='localtime' for the system local timezone). |
|
Get the current datetime in expressed as a naive UTC. |
|
|
|
|
|
|
|
|
|
Check if the given string is a valid IP address, if yes, return the IPv4Address or IPv6Address object, otherwise return None. |
|
|
|
|
|
Check if the given string is a valid UUID, if yes, return the UUID object, otherwise return None. |
|
Register a locale for the entire application (system default locale if argument value is None). |
|
Make a DNS resolution with a timeout. |
|
|
|
Skip UTF8 byte order mark, if any. |
|
Generate a slug. |
|
CamèlCase => camel_case |
|
Export tabular data, in CSV format, or using tabulate. |
|
|
|
|
|
Perform a topological sort. |
|
Use a locale temporary (in the following thread-local block/context). |
|
Write text to stdout, keeping track of what was written, so that it can be erased next time. |
Classes
|
|
|
|
|
|
|
|
|
|
|
|
A logging handler that counts warnings and errors. |
|
|
|
|
Adapted from: django.core.serializers.json.DjangoJSONEncoder |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Exceptions
|
|
|
An error that should result to only an error message being printed on the console, without a stack trace. |