Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyaux-3.3.0.tar.gz (85.4 kB view details)

Uploaded Source

Built Distribution

pyaux-3.3.0-py3-none-any.whl (96.8 kB view details)

Uploaded Python 3

File details

Details for the file pyaux-3.3.0.tar.gz.

File metadata

  • Download URL: pyaux-3.3.0.tar.gz
  • Upload date:
  • Size: 85.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for pyaux-3.3.0.tar.gz
Algorithm Hash digest
SHA256 544ab64c1859d0849b972f2ca3ae5d3cad0b4d858998621c02b99621335da989
MD5 820abbe12ecacafc9a72455754fc9014
BLAKE2b-256 0a698e9b592864f837e1b2bdd2c8490ba433df88dfe5c3985facb84d139db109

See more details on using hashes here.

File details

Details for the file pyaux-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyaux-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 96.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for pyaux-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f968035af3b61a5fd46d0f0f558e8579c91cb8c25828276b38b85700082c171
MD5 bd8515320271fc4c50fcf7adc2323eea
BLAKE2b-256 fd0de2d5998d7a9b201a2acd231d435cae02c039268e132c552cbb9fd1786cff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page