Provides a wide range of useful classes and functions.
Likely abandoned. No release or commit for years (last release over 5 years ago).
pip install pymiscutilsPLEASE NOTE:
This library is currently still under development. The API will likely undergo significant changes that may break any code you write with it. The documentation will fall out of sync with the updates regularly until development slows down. Use it at your own risk.
Overview
Provides a wide range of useful classes and functions:
The NestedParser class
- Parse a string by user-specified opening/closing tokens, recursively
- Can ignore tokens between specific tags (for example, within string quotation marks)
- Return an object tree (currently traversal methods are limited)
Context manager classes
SysTrayApphides the console and runs a system tray app which can have its options customized with callbacksTimercounts the time since it was instanciated, and prints it on exiting contextSuppressorsupresses all console output and warnings on enter and resores it on exitingPrintRedirectorredirects stdout to a given fileNullContextwill always return itself on attribute access or when called, and does nothing when used as a context manager or when attributes are set on it
Other misc classes
Counteris an object-oriented replacement for manipulating an integer var for iteration purposesWhoCalledMecan be dropped in to print out the call stackEnvironmentVariablescan be used on Windows to get and set environment variables permanentlyBeepproduces a beeping sound of variable duration on WindowsVersionobject to represent versions, with comparator magic methods and wildcard support
Misc functions
is_running_in_ipythonreturnsTrueif in an ipython session, elseFalseissubclass_safeis a version of the built-inissubclassthat doesn't raise an error if the candidate is an instance rather than a class, just returnsFalse
Installation
To install use pip:
$ pip install pymiscutils
Or clone the repo:
$ git clone https://github.com/matthewgdv/miscutils.git
$ python setup.py install
Usage
Usage examples coming soon.