A collection of small useful helpers.
Project description
Personal collection of helpers and often-useful snippets for Python
Install the latest version with pip install -U “git+https://gitlab.com/hoverhell/pyaux.git#egg=pyaux”
Contains:
window: iterator over a ‘window’ of N adjacent elements
dotdict: attr→item dict subclass (e.g. for d.key instead of d[‘key’])
DebugPlug: recursive duck-object for debug and testing purposes
repr_call: convenient syntactically-appropriate representation of call arguments (also used in DebugPlug)
fxrange, frange, dxrange, drange: xrange() / range() equivalents for float (without error accumulation) and Decimal
dict_fget, dict_fsetdefault: versions of dict.get and dict.setdefault with lazy-computation of the default value
split_list: simple one-pass splitting of list into two by a condition
use_cdecimal: forced instance-wide use (by monkey-hack) of cdecimal instead of decimal (for performance)
use_exc_ipdb: set unhandled exception handler to run ipdb.pm()
use_exc_log: set unhandled exception handler to log (by logging) the exception and the stack trace including (when possible) the local variables.
use_colorer: monkey-patch logging for colored logging
obj2dict: recursive converter of tree-structure of classes into a tree-structure of dicts, e.g. for pretty-printing the result
mk_logging_property: make a property that debug-logs the value and caller info when set
Some other things that are too minor to be listed here.
Also, in separate submodules:
psql: helpers for saving Django ORM objects into an SQL ‘COPY’-like file and loading it in one SQL command (for high-performance loading of large amounts of data into the database)
lzmah: lzma compress (as function and as an executable file); also provides a function unjsllzma to stream-read (json) lines from a pylzma-compressed file
lzcat: lzcat for pylzma-specific format (as function and as an executale file)
runlib: various things for runscripts:
init_logging: logging.basicConfig with useful defaults (for development runscripts).
sigeventer: list-based signal handler for SIGINT and SIGTERM (for appending handler functions, similarly to atexit)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyaux-3.0.0.tar.gz
.
File metadata
- Download URL: pyaux-3.0.0.tar.gz
- Upload date:
- Size: 84.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d14105378c3d63963f5a5a02b9977030514160bb6e2dd560dddbd9bf495e23f |
|
MD5 | f86bf6fab91a353f9b3fed5d42f37dce |
|
BLAKE2b-256 | 7c17d70ebd9cd805755098e3b25725aa2d1f391b1f2452ede27505347f490a1b |
File details
Details for the file pyaux-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyaux-3.0.0-py3-none-any.whl
- Upload date:
- Size: 95.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f91a1c393afc2aa5c03d7fd1e595c70ee1220647e0317e6a6422ccc7689e0ef |
|
MD5 | 97b2d1ad2e3d668f8b2701ed3ca2328b |
|
BLAKE2b-256 | b11d231f9efe8d63308e50509371ed72e4ed168bc3b4b5fca570372726f46bec |