Skip to main content

pyaux

Project description

Collection of helpers and useful things for Python

pyaux

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:

  • bubble: syntactic sugar for super(…)

  • window: iterator over a ‘window’ of N adjacent elements

  • SmartDict: 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

  • interp, edi: two versions (simplified and format-supporting) of convenient string interpolation (or simplified templating)

  • 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)

    • make_manhole: init a Twisted SSH manhole with set up locals, key-based auth, etc.

  • twisted_aux: use_exc_log-equivalent for twisted (and a helper to remove the default logger).

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-2.10.0.tar.gz (86.6 kB view details)

Uploaded Source

Built Distribution

pyaux-2.10.0-py3-none-any.whl (101.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyaux-2.10.0.tar.gz
  • Upload date:
  • Size: 86.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.5

File hashes

Hashes for pyaux-2.10.0.tar.gz
Algorithm Hash digest
SHA256 5a08ab80ebe655f053a0182ed2f7c249bf78938f270928884b386609a31e149e
MD5 26ee33788b01a1f7108309111c7db209
BLAKE2b-256 8d5f05332f5da9e27e421e519b53d0ac7b339cf5ccda741dab62134d0ab67ffd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyaux-2.10.0-py3-none-any.whl
  • Upload date:
  • Size: 101.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.5

File hashes

Hashes for pyaux-2.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e6756653fd4d918f2b85bb256f0b27f831b29ccce7122f3ab8fce402ea17916
MD5 ad12b19047e0749f6465013609115202
BLAKE2b-256 6e5e174b7a0d695b29ad12425dc5a03f836f8e7b4f8d6437fdf8ed4852dd8632

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