tpcp.misc: Miscellaneous helper and utility functions#

Some general utilities for tpcp.

Classes#

BaseTypedIterator(data_type[, aggregations])

A Base class to implement custom typed iterators.

TypedIterator(data_type[, aggregations])

Helper to iterate over data and collect results.

WarningErrorContext(name[, context, ...])

A warning/error context and its persistent event records.

WarningErrorContextRecord(type, context, message)

A warning, error, or contextual print captured by an active context.

Functions#

custom_hash(obj[, hash_name, coerce_mmap])

Quick calculation of a hash to identify uniquely Python objects containing numpy arrays and torch models.

classproperty([method])

A decorator that converts a class method into a class property.

iter_with_warning_error_context(iterable)

Pair every item with a warning/error context creator.

print_with_context(*values[, sep, end, ...])

Print values with the active context and retain the original message.

set_defaults(**defaults)

Set the default values of a function's parameters.

warning_error_context(name[, context, ...])

Add structured context information to warnings and exceptions raised in the context.