Package: mhelper
A collection of utility packages.Contentsansiansi_format_helperansi_helperarray_helperbatch_listscolourscomponent_helperdata_storedebug_helperdispatch_helperdisposal_helperdocumentation_helperemoji_helperevent_helperexception_helperfile_helperio_helperipc_helperlambda_helperlog_helpermaths_helperpassword_helperprogress_helperproperty_helperproxy_helperqt_resource_objectsreflection_helperserialisablespecial_typesstring_helpersubprocess_helpersvg_helperutf_helperutf_tableansiThis package contains constants for ANSI-terminal escape sequences for colour
and font formatting.
There are also functions for generating 24-bit colour codes.Please note that this package only defines the codes, it does not guarantee
support for their correct interpretation in the terminal.ansi_format_helperContains functions for printing error tracebacks to an ANSI terminal using
colour highlighting, as well as a function to replace the default Python handler
with a colour version.ansi_helperUsing a string containing ANSI colour codes is problematic in that __len__, etc.
return the length of the full text, including the codes.This class provides functions for dealing with such strings, as well as a classAnsiStr, that behaves likestr, but accounts for colour codes.array_helperThis package includes a variety of utility functions for dealing with arrays
(lists, tuples, iterables, etc.)batch_listsContains a class and function for dealing with workloads split into batches.coloursContains constants and a class for dealing with 24 bit colours.component_helperAllows one to find connected components given a graph-like data-set without
having to actually construct a graph.data_storeContains a class for generating proxies for settings objects, committing changes
to disk when their attributes are modified.debug_helperContains a terminal based object inspectorview, which is similar to Python’s
inbuilthelp, but prettier.When passed a raw function, this display hook includes the documentation,
arguments, and PEP-484 annotations.When passed a type, the documentation and available methods are included.When passed a list, tuple, or dict, the contents are of the iterable are
included, one per line.When passed any object, the fields of the object are listed, if available,
alongside the object repr.dispatch_helperContains a multithreaded dispatch queue class, for dispatching function calls
into worker threads.This can be easily converted into a multiprocessed queue, by having the threads
make a system call.disposal_helperContains theManagedWithclass, which allows a function to generate an object
compatible withwith ….This may be more convenient than generating a separate class implementing__enter__and__exit__for simple functions.documentation_helperManages and creates a documentationdictfrom docstrings.This handles extracting:param:tags, etc.emoji_helperHelper class that contains definitions for all emoji.Names should be identical to those defined in Unicode, with the exceptions:All names are in upper caseNames beginning 1st, 2nd, 3rd are replaced with FIRST, SECOND, THIRDSpecial symbols &, # and * are replaced with AND, HASH and ASTERISKevent_helperContains the multiple dispatchEventclass, which is designed to behave
the same as the one in C#.exception_helperContains various assertion functions, generic exception classes and functions
to generate error messages which actually try to be helpful.Notable examples includeSwitchError,NotSupportedErrorandsafe_cast.This package also includes functions for more easily parsing exception
tracebacks.file_helperVarious functions for parsing and generating filenames and enumerating
directories.io_helperConvenience functions for reading and writing files of different types: text,
pickle, json, etc.ipc_helperProvides an interprocess mutex.Uses theposix_ipc.Semaphore.lambda_helperProvides classes with lambda based dunders.log_helperLogging helpers.Includes:A logging handler that formats for the terminal, including thread and process information.A logger which highlights variadic values, contains helpers for dealing with progress bars, iteration, enumeration and timing.A function to iterate information on existing loggers.maths_helperContains a few simple math functions.password_helperFixes issues with thekeyringlibrary on Ubuntu - see theget_keyringfunction.Contains aManagedPasswordclass, which wraps thekeyringmodule.progress_helperContains functions for generating the information required for progress-bar
type reports, notably the estimated time to completion.property_helperVarious property related helpers:Indexable propertiesFrozen classesClass propertiesproxy_helperContains the classSimpleProxyand its dependencies.qt_resource_objectsWraps Qt resource paths into an object which extracts that resource, caching
it if necessary.reflection_helperVarious helpers for reflection.serialisableDynamically generates both__getstate__and__setstate__based on a single
definition of the serialisable (or non-serialisable) attributes.special_typesDefines a Sentinel class, as well as a typicalNOT_PROVIDEDsentinel value.string_helperFunctions for parsing strings into objects and generating strings from objects.Also containsTStrfunctions that replicate several of Python’sstrmethods.
Unlikestr,TStrpermits an duck-typed object behavinglikeastr,
rather than enforcing astrspecificly.subprocess_helperWraps a subprocess, creating threads to monitor its output, allowing a
process’s output to be recorded and displayed in real-time.svg_helperFunctions for writing SVG images to disk.utf_helperFunctions for generating UTF-formatted text (e.g. bold, italic, small-caps,
etc.)utf_tableThis is a package for drawing ASCII boxes and tables.A variety of box drawing character sets are specified, and table drawing
supports wrapping and text spanning multiple columns.Unlike most other available tools, the direction of lines is honoured and
UTF characters can be used.To draw a table, please see theTextTableclass documentation.