API reference

See modules for a short description of each modules. For a full listing of the contents of all modules, see the module contents overview.

The API reference makes heavy use of a type language; for example, to describe exactly what arguments can be passed to a function.

Modules

algorithms
asyncio Extensions to asyncio.
click click utilities
configuration
data_frame
debug
dict
exceptions Exception classes: UserException and InvalidOperationError.
function Function manipulation, like functools.
hashlib hashlib additions
http HTTP utilities.
inspect Similar to inspect module.
iterable Utility functions for working with iterables.
logging Logging utilities.
multi_dict multi-dict utilities. Multi-dicts can map keys to multiple values.
observable Observable collections.
path Extensions to pathlib.
pymysql
series
set Set utilities.
sqlalchemy
test Test utilities.

Module contents overview

algorithms

multi_way_partitioning
spread_points_in_hypercube
toset_from_tosets

asyncio

stubborn_gather Stubbornly wait for awaitables, despite some of them raising

click

argument Like click.argument, but by default required=True
assert_runs Invoke click command and assert it completes successfully
option Like click.option, but by default show_default=True, required=True
password_option Like click.option, but by default prompt=True, hide_input=True, show_default=False, required=True.

configuration

ConfigurationLoader

data_frame

assert_equals
equals
replace_na_with_none
split_array_like

debug

pretty_memory_info

dict

pretty_print_head
DefaultDict
invert
assign

exceptions

exc_info Get exc_info tuple from exception
UserException Exception with message to show the user.
InvalidOperationError When an operation is illegal/invalid (in the current state), regardless of what arguments you throw at it.

function

compose Compose functions

hashlib

base85_digest Get base 85 encoded digest of hash

http

download Download an HTTP resource to a file

inspect

call_args Get function call arguments as a single dict

iterable

sliding_window Iterate using a sliding window
partition Split iterable into partitions
is_sorted Get whether iterable is sorted ascendingly
flatten Flatten shallowly zero or more times

logging

configure Configure root logger to log INFO to stderr and DEBUG to log file.
set_level Temporarily change log level of logger

multi_dict

MultiDict A multi-dict view of a {hashable => {hashable}} dict.

observable

Set Observable set

path

assert_equals Assert 2 files are equal
assert_mode Assert last 3 octal mode digits match given mode exactly
chmod Change file mode bits
hash Hash file or directory
read Get file contents
remove Remove file or directory (recursively), unless it’s missing
write Create or overwrite file with contents

pymysql

patch

series

assert_equals
equals
invert
split

set

merge_by_overlap Of a list of sets, merge those that overlap, in place.

sqlalchemy

log_sql
pretty_sql

test

assert_text_contains Assert long string contains given string
assert_text_equals Assert long strings are equal
assert_matches
assert_search_matches
temp_dir_cwd pytest fixture that sets current working directory to a temporary directory