toolbox.py Documentation v1.6

View dated changelog · All module changelogs

Developer guide and API map for the current toolbox.py module. This page is aligned with __version__ = "1.6" and calls out optional dependencies, side effects, and compatibility behavior. The Matching section explains the algorithm selectors and compatibility defaults introduced in v1.6. Signatures in the complete source API are generated from the active module.

Contents

Overview

toolbox.py is a general-purpose utility module containing:

It is designed as a broad utility library for rapid Python development, especially in backend, data, and tooling workflows.

Import: the module is a single file, so consumers normally use import toolbox or import selected names directly. Several integrations require optional third-party packages or local data files; see the relevant section before deploying a feature.

Core Concepts

The module combines unrelated but commonly useful utilities into a single file. Key themes include:

Runtime Requirements and Side Effects

The standard library covers only part of the module. Dependencies are loaded at different times, so a successful import toolbox does not prove that every feature is ready to use.

DependencyUsed byLoading behavior
requests, urllib3Synchronous downloads and updater requestsrequests is deferred until first attribute access.
aiohttp, multidictAsync HTTP, service plugins, URL query dataWrapped by DelayModuleLoad; a missing package may fail only when the feature is first used.
rapidfuzzMatching algorithms 2–5Optional import at module startup. RAPIDFUZZ_IMPORTED reports availability; pure-Python fallbacks are used when unavailable. Methods 0 and 1 do not use RapidFuzz.
matplotlibStatistical plottingOptional and deferred.
jsondb2, sqliteObj, aiosqliteObjQueue/cache/database-backed features and plugins.UserManagerImported conditionally. Missing aiosqliteObj no longer triggers installation at startup; UserManager may request it when used. sqliteObj may still be installed through the updater during import.
pygmentsHTML source/traceback formattingOptional; formatter classes exist only when it imports.
Local data filesCountry, Android-device, and user-agent helpersSome lookups depend on resources available beside the application.

Important: importing this module currently enables AUTO_UPDATER and calls pmblue_update.self_update(). If pmblue_update is missing, the import path attempts to download it. The missing-updater bootstrap still uses its legacy HTTP URL. Provision pmblue_update before import to avoid that bootstrap. Account for this network and file-write side effect in offline builds, tests, and restricted production environments.

DelayModuleLoad

Purpose

Defers module import until the module is actually used.

Constructor

DelayModuleLoad(module_name, name_as=None, module_to_globals=True)

Behavior

Important Method

__getattr__(self, name)

Loads the real module, optionally replaces the placeholder, then resolves the requested attribute.

Example

asyncio = DelayModuleLoad("asyncio")
await asyncio.sleep(1)

Async HTTP Wrapper

AiohttpResponse

Defined in the aiohttp feature block. Because aiohttp is represented by a deferred loader, a missing installation can surface on first request rather than at module import.

Purpose

Wraps aiohttp responses in a more requests-like interface.

Constructor

AiohttpResponse(response, elapsed, data)

Key Properties

PropertyDescription
contentRaw response bytes
textDecoded text using response encoding
json()Parses JSON from content
status / status_codeHTTP status code
headersResponse headers
cookiesCookie dictionary
urlResolved response URL
elapsedRequest duration

Async Request Methods

await AiohttpResponse.get(...)
await AiohttpResponse.post(...)
await AiohttpResponse.delete(...)
await AiohttpResponse.ping(...)

Download Utilities

download_file_async

async def download_file_async(url, dest_path, chunk_size=1024*1024, verbose=False, as_gzip=False): ...

When as_gzip=True, pass a destination without a .gz suffix; the current implementation appends it.

download_file

def download_file(url, dest_path, chunk_size=1024*1024): ...

Formatting Utilities

FunctionDescription
dec_amt(n)Applies variable decimal rounding based on magnitude
format_time_sec(sec)Formats seconds or timedelta into ps/ns/us/ms/s/m/h/d/w
format_size(size)Formats bytes into b/kb/mb/gb
format_number(number)Adds commas and trims unnecessary decimals
format_currency(number)Formats as $1,234.56
format_name(name)Normalizes capitalization for names

Benchmarking

TestManager

Measures performance across a fixed number of iterations or a fixed time window.

Examples

tm = TestManager(trial_amt=1000)

@tm.test_func
def test():
    pass

tm.run()
tm.print_results()

Key Options

ArgumentDescription
trial_amtNumber of iterations to run
trial_timeHow long to keep iterating
test_trialWhether to subtract loop overhead estimate

Important Methods

MethodDescription
test_func(func)Registers a test function
run()Runs the registered test function
start_trial()Starts manual timing
end_trial()Ends manual timing
print_results()Prints trial count, total duration, and average duration
txt_results()Returns a text summary

Statistical Utilities

FunctionDescription
remove_outliers(data)Removes values outside 1.5 × IQR
get_sd_dev(data)Computes mean absolute deviation-like value, not a classic standard deviation
get_total(data)Sums values
get_median(data)Median for sorted sequences
is_even(amt)Returns parity boolean

DataInfo and DataInfoMisc

DataInfo

Analyzes numeric datasets and exposes cached summary statistics.

Constructor

DataInfo(data)

Main Properties

PropertyDescription
lenDataset size
totalSum of values
avgAverage
medianMedian
modeMost frequent value
iqrFirst and third quartile pair
range(min, max)
sd_devSample standard deviation
avg_devAverage absolute deviation from mean
skewedSkew approximation using mean, median, and sd

Main Methods

MethodDescription
sorted_data()Sorts and returns dataset
avg_no_outliers()Average excluding outliers
is_outlier(n)IQR-based outlier test
get_zscore(n)Returns z-score
get_item(n)Returns DataInfo.Item for a value
get_percentile(n)Returns percentile, including interpolation in some cases
info_txt()Full text summary
basic_info_txt()Reduced summary
print()Prints full summary
basic_print()Prints reduced summary

Nested Type: DataInfo.Item

Represents a distinct numeric value in the dataset.

AttributeDescription
numberThe numeric value
frequencyCount of occurrences
zscoreCached z-score
is_outlierCached outlier status
percentileCached percentile

DataInfoMisc

Similar in structure to DataInfo, but designed for more general sortable values and supports reverse sorting.

Filesystem Utilities

dir_size(dir_path)

Recursively computes total directory size.

FileInfo

FileInfo(x)

x may be a path-like value, an os.DirEntry, or a directory entry with callable is_dir()/stat(). Pass an existing FileInfo's path to construct fresh metadata. Paths are normalized to forward slashes, but relative inputs remain relative.

PropertyDescription
nameFilename
pathSupplied path with forward-slash separators
is_dirWhether entry is a directory
sizeFile size or recursive directory size
modifiedModification timestamp
created_atPlatform-dependent ctime, converted to local datetime

FileInfo Methods

MethodDescription
all_files()Returns non-recursive file list
all_files_recursive()Returns recursive file list

scan_for_file(file)

Checks whether the given path exists and returns its FileInfo, or None.

Table and TxtTable

Table

Simple ASCII table builder.

MethodDescription
add_column(name, length=None)Adds a column
add_row(*args)Adds a row
print(limit=None, send=True)Renders the table as text

Support Classes

TxtTable

Enhanced table builder supporting text output, HTML export, searching, sorting, and Flask-friendly pagination.

Important Methods

MethodDescription
add_column(...)Adds a column, optionally with computed/default values
insert_column(...)Inserts a column at a position
add_row(...)Adds a row
remove_column(col_num)Removes a column
print(...)Renders text table
to_html(...)Renders table as HTML
flask_pagination(...)Builds paginated, searchable, sortable output for Flask requests

HTML Export

table.to_html(max_len=100, condensed=True)

Flask Pagination Notes

flask_pagination() reads request args like page, rows_per_page, search, sort_by, case, and adv, then filters and formats the selected rows.

Dictionary Utilities

FunctionDescription
iter_dict(d)Generator yielding (key, value)
sort_dict(d, key=None, reverse=False)Sorts dictionary items into a new ordered dictionary

Conversion Utilities

to_numb(s)

Attempts string-to-number conversion:

CSV and Collection Utilities

CSVReader

Static helpers for reading, writing, and condensing CSV data. The default result is a ListTable with header-indexed Row objects; as_list=True returns raw row lists, and row.dict() converts a row.

MethodUse
read(arg, has_headers=True, as_list=False)CSV-aware parser; accepts the file-like inputs supported by the file conversion helpers.
basic_read(arg, has_headers=True, as_list=False, forgiving=False, by_line=None)Fast parser. forgiving tolerates malformed row widths; by_line supports large inputs without reading the entire file first.
basic_read_threaded(..., amt_per_thread=20000, max_workers=None)Splits parsing work across a thread pool.
no_quotes_read(...)Optimized path for data known not to contain quoted fields.
condense(fp, has_headers=True, unique_only=False, remove_func=None, remove_columns=[])Reduces a CSV while optionally removing rows/columns and duplicate rows.
write(rows) / write_file(fp, rows)Serialize rows to CSV text or a destination.

Avoid reusing and mutating the default list passed to remove_columns; pass an explicit list in new code.

Indexed and constrained collections

TypeBehavior
ListTable(rows, has_headers=True, read_only=True)Wraps row data with header-based access and exports individual rows with row.dict(); use a list comprehension for all rows.
CacheList(max_cache_size=100)List plus a lookup cache. Use get(key, default); mutating methods keep the cache synchronized.
Unique(max_items=None)List-like collection that prevents duplicates and can cap retained items.
UniqueDict()Stores unique values by type and exposes the flattened values through all().
ListIndex(d, key=str, f_idx=0, nested_indexes=None)Binary-search-backed index with exact, case-insensitive, list, and index-returning lookups.
SortedList(d, key=str, reverse=False)Maintains sorted order when values are appended.
AttrDict(data={})Intended dictionary wrapper with attribute access and get(); current constructor recursively accesses its unset storage and can raise RecursionError. Use a normal dict until repaired.
merge_iters(*args)Iterates several input iterables as one sequence.
ReverseListIter(item)Reverse iterator for list-like data.
IterLoop(i)Cycles repeatedly over an iterable.

Related helpers are randomize_list, count_dict, count_print, make_json_parsable, and dict_print.

Descriptors and Caching

DescriptorBehavior
AsyncPropertyAllows an async method to be awaited through property syntax.
CachedProperty(func=None, expire=None)Caches an async or sync property per instance; supports expiration, explicit cache inspection, and replacement by assignment.
ClassPropertyEvaluates a getter against the class rather than an instance.
CachedClassProperty(func=None, expire=None)Class-level cached property with optional expiration.
class Service:
    @CachedProperty(expire=60)
    async def status(self):
        return await load_status()

service = Service()
status = await service.status

These are custom descriptors. Async values use await obj.property, not a method call.

Text, URL, and Matching Utilities

APIPurpose
StringInfo(s)String inspection, character counts, average word length, checks, and URL discovery.
LinkInfo(url)URL decomposition, base URL, query-string parsing, hashing, and link discovery.
TxtParser(format_txt, ..., handle_not_found=False, possible_chars=['[', ']'])Extracts named variables from format patterns; supports optional segments and regex-backed parsing.
TxtParserExpExperimental parser variant with the same pattern-oriented interface.
TxtParserBasicSmaller parser without optional-character configuration.
split / split_multiCurrent regex-optimized case-sensitive or case-insensitive splitting functions.
split_old / split_multi_oldCompatibility implementations retained for callers that depend on the previous behavior.
MatchingNormalization-aware match/within and fuzzy equivalents with configurable thresholds. See the dedicated guide below.

Additional small helpers include get_between, get_all_between, extract_int, place_suffix, bytes_to_str, word_to_digit, name_to_normal, convert_to_normal, convert_to_single_letters, and the intentionally misspelled compatibility function equivilency_convert.

RandomString

get* methods use the ordinary random source. Prefer secure_get, secure_get_alpha, secure_get_num, or secure_get_alphanum for tokens and credentials.

Timestamp IDs and Base Conversion

These helpers are available in the current 1.6 source. The ID format combines a base62 Unix-millisecond timestamp prefix with a random alphanumeric suffix.

APIReturn and behavior
base10_to_base36(n)Integer to text using 0–9A–Z.
base10_to_base62(n)Integer to text using 0–9A–Za–z.
peyton_day_timestamp(dt=None)Integer millionths of a day since 2000-01-01 00:00:00 UTC. Uses current time when dt is omitted.
peyton_id_prefix(dt=None, leading_zeros=True, granularity_level=0)Base62 Unix-millisecond timestamp text, padded to eight characters by default.
peyton_id_prefix_to_timestamp(prefix, granularity_level=0)Decodes a 1–8-character base62 prefix to a naive local datetime, despite its timestamp-oriented name.
peyton_id(dt=None, length=16, leading_zeros=True, granularity_level=0)Timestamp prefix plus ordinary random suffix.
peyton_id_secure(dt=None, length=16, leading_zeros=True, granularity_level=0)Timestamp prefix plus a suffix generated with secrets.
import datetime
import toolbox

created_at = datetime.datetime.now(datetime.timezone.utc)
record_id = toolbox.peyton_id(dt=created_at, length=24)
decoded_local_time = toolbox.peyton_id_prefix_to_timestamp(record_id[:8])

print(toolbox.base10_to_base36(35))  # Z
print(toolbox.base10_to_base62(61))  # z
secure_record_id = toolbox.peyton_id_secure(length=32)

granularity_level selects milliseconds (0, eight-character padding), 100 seconds (1, five-character padding), or 100000 seconds (2, three-character padding). Pass the same level when decoding; invalid levels raise ValueError. With leading_zeros=False, padding is omitted and the random suffix fills the requested total length.

The timestamp prefix is predictable and reveals approximate creation time; the secure variant only makes the suffix cryptographically random. Neither function checks for collisions or validates requested length. Supply an integer length greater than eight when randomness is required. The conversion functions require integers; negative values currently produce an empty string. Use timezone-aware datetime inputs when the intended epoch must be unambiguous.

For an opaque random token without a timestamp, use the existing RandomString.secure_get_alphanum(size) helper.

Matching

Matching compares complete strings or searches within longer text. Version 1.6 adds numbered algorithms and window modes. Both defaults remain 0 for legacy behavior; selecting an edit-distance algorithm does not automatically change the substring-search mode.

Algorithm selection (v1.6)

matching_methodAlgorithmScore behavior
0 (default)Legacy positionalFuzzy comparisons count equal paired positions and ignore unmatched trailing characters. The high-level exact path retains its original equality/wildcard behavior.
1PositionalCounts mismatched positions and unmatched trailing characters.
2LevenshteinCounts insertions, deletions, and substitutions.
3Optimal String Alignment (OSA)Also allows adjacent swaps, with restrictions on overlapping edits.
4Damerau-LevenshteinAllows adjacent swaps and overlapping edits.
5Jaro-WinklerCharacter similarity with a shared-prefix bonus.

Matching.Methods.select(str1, str2, matching_method=0) returns similarity between 0 and 1, where 1 means identical under the selected comparison. Methods 1–4 use 1 - distance / max(len(str1), len(str2)). Method 5 uses Jaro-Winkler similarity. Method 0 lowercases; methods 1–5 are case-sensitive at this low level. All six full-string methods score two empty strings as 1 and one empty string as 0.

When RAPIDFUZZ_IMPORTED is true, methods 2–5 use RapidFuzz. Otherwise they use the module's pure-Python implementations. No optional package is needed for the fallback path.

within_methodWindow selection
0 (default)Original substring behavior, always using legacy positional matching regardless of matching_method.
1Fixed character windows with the query's length, scored using matching_method.
2Consecutive word windows with the query's word count, ranked by normalized similarity using matching_method. Splits whitespace and rejoins with single spaces. Word boundaries are retained before optional space removal for scoring; extra middle names are not skipped.

Matching.Methods.select_within(str1, str2, matching_method=0, within_method=0, ignore_spaces=False, match_asterisk=False) returns the best window similarity, or None if no window fits. An empty query returns 1. It does not apply the high-level normalization pipeline. Fixed character windows do not search variable-length substrings even when using an edit-distance algorithm.

Settings and defaults

Matching.Settings(
    normalize=True,
    extraneous_characters=False,
    ignore_spaces=False,
    match_asterisk=False,
    fuzzy_threshold=1,
    phonetic=False,
    matching_method=None,
    within_method=None,
)

Omitted or None method arguments resolve Matching.DEFAULT_MATCHING_METHOD and Matching.DEFAULT_WITHIN_METHOD when settings are created. Both initially equal 0. Existing settings keep their selections after class defaults change; pass explicit zeros to pin legacy behavior. Selectors accept integers 0–5 and 0–2 respectively; other values, including booleans, raise ValueError.

Calls to match() or within() without settings create fresh settings from the current method defaults and copy the other options from Matching.default_settings. Changing method fields on that template does not change the class method defaults.

SettingDefaultBehavior
normalizeTrueRuns Unicode normalization and the module's transliteration rules; also lowercases.
extraneous_charactersFalseCollapses consecutive duplicate characters; does not remove punctuation.
ignore_spacesFalseRemoves ordinary spaces. Token mode preserves word boundaries until candidate scoring.
match_asteriskFalseTreats an asterisk in either input as a positional wildcard. Nonlegacy paths mask paired positions per candidate and preserve unmatched tails; this is not an arbitrary-length glob.
fuzzy_threshold1Minimum accepted similarity for nonlegacy paths. Legacy mode uses its original exact path at 1 and positional fuzzy comparison otherwise. Thresholds are not validated; normally use 0–1.
phoneticFalseApplies ordered sound substitutions, such as ph → f. Can increase false positives.

High-level and fuzzy APIs

APIBehavior
Matching.match(txt1, txt2, settings=None)Transforms both inputs and compares them using the selected matching method.
Matching.within(txt1, txt2, settings=None)Transforms both inputs and searches using the selected within method.
Matching.fuzzy_match(txt1, txt2, threshold=.8, matching_method=None)Lowercases and compares selector similarity with the threshold. Omitted method uses the class default; does not apply Unicode, phonetic, or interchange transformations.
Matching.fuzzy_within(txt1, txt2, threshold=.8, matching_method=None, within_method=None)Compares the best window similarity with the threshold. Omitted methods use class defaults; comparisons are case-insensitive without the high-level normalization pipeline.

The high-level transformation order is Unicode normalization, optional space removal, interchange substitutions (0 → o, @ → a, $ → s, 1 → i, z → 2, + → t), optional repeated-character collapse, optional phonetic substitutions, then wildcard handling and comparison. Token mode delays space removal until scoring. within() always lowercases; with normalize=False, nonlegacy match() can remain case-sensitive.

Examples

from toolbox import Matching

assert Matching.match("Héllô", "hello")
assert Matching.match("0scar", "Oscar")

# OSA counts the adjacent swap as one edit: similarity = 0.8.
names = Matching.Settings(matching_method=3, within_method=2,
                          fuzzy_threshold=.8)
assert Matching.match("Maria", "Maira", names)
assert Matching.within("Maria", "Member Maira Active", names)

# Similarities and raw distances have opposite directions.
assert Matching.Methods.select("kitten", "sitting", 2) == 1 - 3 / 7
assert Matching.Methods.levenshtein_local("kitten", "sitting") == 3
assert Matching.Methods.fuzzy_local("abc", "abcd") == 1

# Explicitly retain legacy behavior even if class defaults change.
legacy = Matching.Settings(matching_method=0, within_method=0,
                           fuzzy_threshold=.8)
assert Matching.match("abc", "abcd", legacy)  # trailing suffix ignored
assert not Matching.match("abc", "abcd",
    Matching.Settings(matching_method=1, fuzzy_threshold=.8))

Raw distance and window helpers

These helpers do not normalize inputs, lowercase, apply wildcards, or apply acceptance thresholds. Distances are smaller for closer matches, with zero meaning identical.

Matching.Methods APIReturn value
fuzzy_local(txt1, txt2)Integer positional differences, including unmatched trailing characters.
levenshtein_local(s1, s2)Integer Levenshtein edit distance.
osa_local(s1, s2)Integer OSA edit distance.
damerau_levenshtein_local(s1, s2)Integer unrestricted Damerau-Levenshtein edit distance.
jaro_winkler_local(s1, s2, prefix_weight=0.1)Fractional distance in 0–1, not an edit count. Prefix weight must be 0–0.25.
fuzzy_local_within(query, text)Minimum positional differences over query-length character windows; 0 for an empty query, None if the query is longer than the text.
token_window_within(query, text, distance_method=None, extra_words=0)Best window as a dict with text, differences, start_word, and exclusive end_word; None for empty inputs or no fitting window. Defaults to raw OSA distance. A nonnegative integer extra_words expands sizes above and below the query's word count. Ties favor smaller windows, then earlier positions.

token_window_within() ranks raw distances, whereas select_within(..., within_method=2) ranks normalized similarities and uses exactly the query's word count. These APIs can choose different windows. The in-module notes attribute the new raw helpers to 1.5.6; they are present in the reviewed 1.6 source.

Rough speed comparison (Toolbox 1.6)

Measured 2026-11-08 on CPython 3.11.6, an AMD EPYC-Rome CPU (one CPU available to the process), Linux x86-64, with RapidFuzz 3.13.0. Values are median microseconds per comparison/search (1,000 µs = 1 ms), so lower is faster. These are reference measurements on a shared host, not guaranteed application throughput.

Complete-string comparison: Methods.select()

Each length uses the same 48 deterministic ASCII pairs across all algorithms: equal strings, substitutions, insertions, deletions, adjacent transpositions, and unrelated strings in equal proportions. Length refers to the first string; the second differs by at most one character. The timings include Toolbox selector dispatch.

MethodPython 16 charsRapidFuzz 16 charsPython 64 charsRapidFuzz 64 charsPython 256 charsRapidFuzz 256 chars
0: Legacy positional1.191.142.742.689.218.26
1: Positional + tails1.151.162.382.377.287.30
2: Levenshtein45.521.11678.091.1710,783.642.04
3: OSA11.401.0855.361.22285.702.58
4: Damerau-Levenshtein95.161.361,338.774.0720,827.2248.96
5: Jaro-Winkler8.571.1344.881.27374.022.59

Methods 0 and 1 still execute Python code when RapidFuzz is installed; differences between those columns are measurement noise. For methods 2–5, the optional backend substantially reduces cost on this workload. The Python Levenshtein and full Damerau-Levenshtein implementations become particularly expensive at longer lengths. Algorithms have different semantics; the faster method is not necessarily appropriate for the same matching decision.

Searching longer text: Methods.select_within()

Sixteen 15-character, two-word queries searched in 159-character, 20-word texts, evenly mixing an early exact match, a late exact match, a late transposition, and no planted match. Character mode 1 considers up to 145 windows; token mode 2 considers up to 19. Perfect-match early exits remain enabled. No Unicode/phonetic normalization, space removal, or wildcard processing is enabled.

Matching methodPython character windowsRapidFuzz character windowsPython token windowsRapidFuzz token windows
0: Legacy positional123.73122.4019.6718.99
1: Positional + tails140.01140.2921.6621.08
2: Levenshtein4,374.24131.54589.9020.11
3: OSA933.85128.33131.4421.09
4: Damerau-Levenshtein8,863.83233.171,158.7733.21
5: Jaro-Winkler1,116.71135.48150.8819.72

Legacy within mode 0, which always uses matching method 0, measured 119.51 µs/search without RapidFuzz and 132.03 µs/search with it installed. Token mode scans fewer candidates here, but searches word boundaries rather than arbitrary character positions; its speed and results are not interchangeable with character mode.

Method and limits: seven timing rounds in shuffled order after warm-up, with each case calibrated to at least 25 ms per sample. Each value is the median of batch-average timings; individual calls can vary more. Only the exact Matching class was loaded from source, avoiding Toolbox startup and updater side effects. High-level normalization, imports, and network work are excluded. All 1,072 accelerated/fallback score comparisons on these inputs agreed within absolute tolerance 1e-12. This checks this corpus, not every possible input or matching accuracy.

Reproduce: run python3 tools/benchmark_matching_1_6.py from the repository, with rapidfuzz==3.13.0 installed in the benchmark environment to include both backends. The script also works without RapidFuzz. Repository files benchmarks/matching_1_6.md and benchmarks/matching_1_6.json contain the full report, sample ranges, exact input corpus, source SHA-256, and environment. Hardware, load, Python/backend version, string length, and match location all affect these rough numbers.

Compatibility caveats

Network, IP, and Request Utilities

TypePurpose and important behavior
CountryInfo(key=None, compressed_requests=False)Country metadata lookup.
IpInfo(ip=None, data=None)Synchronous IP metadata with IPv4/IPv6 validation, dictionary output, reverse DNS, and a process cache.
AsyncIpInfo(ip=None, data=None)Async IP lookup with memory/file/SQLite cache modes. Cache records expire after one week by default and can be configured through class settings.
WebRequestInfo(user_agent, ip)Combines user-agent and IP context and can confirm major crawler networks with forward/reverse DNS checks.
StandardRequest(request)Normalizes request objects from supported web frameworks into common path, scheme, query, IP, body, and user-agent accessors.
UserAgent(txt)Parses device, OS, browser, versions, mobile/tablet state, and bot identity.

Request-aware user-agent parsing

request = StandardRequest(framework_request)
ua = UserAgent.from_request(request)
if ua and ua.is_mobile:
    print(ua.browser, ua.browser_version)

UserAgent.from_request considers Client Hints as well as the User-Agent header and accepts both a native request object and StandardRequest. Current parsing includes modern iPhone Safari formats, tolerates malformed version strings, and adds the UserAgent.Formats.bot6 pattern for ClaudeBot-style crawler headers.

ZF_REQ and run_code(code, **kwargs) are specialized internal-facing helpers; inspect their implementation before exposing them to untrusted input. Never pass untrusted code to run_code.

AsyncLock

Added in toolbox v1.5.4; verified unchanged in v1.5.5. An async context manager that limits concurrent blocks globally and by hashable index. Share one lock among the tasks you want to coordinate, on one event loop.

Constructor

AsyncLock(task_timeout=30, max_concurrent=1,
          max_concurrent_by_index=1, timeout_behavior=0)
ParameterMeaning
task_timeoutSeconds allowed after acquisition (default 30); queue waiting time is excluded. Use None to disable the timeout. Otherwise, supply a finite positive real number.
max_concurrentMaximum active blocks across this lock (default 1). Must be a positive integer.
max_concurrent_by_indexMaximum active blocks for each individual index (default 1). Must be a positive integer. The global limit still applies.
timeout_behavior0 / "raise", 1 / "suppress", or 2 / "release"; see below. The property returns the numeric mode and accepts either form when assigned. Each block captures the mode at acquisition.

Invalid constructor values raise ValueError; booleans are not accepted as numbers for these settings.

Acquiring slots

UsageReservation
async with lock:One global slot only; does not reserve any index.
async with lock["account-1"]:One global slot and one slot for that index.
async with lock["account-1", "account-2"]:One global slot and one slot for each distinct index, acquired together. A list of indexes also works: lock[["account-1", "account-2"]].

Repeated indexes count once. Indexes must be hashable; unhashable indexes raise TypeError. A tuple or list passed to lock[...] is interpreted as a collection of indexes. To use a tuple as a single key, wrap it in a list: lock[[("account", 1)]]. An empty collection reserves only a global slot. Both plain and indexed contexts return the lock itself through as.

Multi-index requests never hold a partial reservation while waiting. Waiting requests are considered in arrival order, but a request blocked on an index can be bypassed by a later request whose indexes are available. This is not strict FIFO ordering or a guarantee against starvation.

Per-block timeouts: scope() (v1.5.4.1)

lock.scope(*indexes, task_timeout=...)

Returns an async context manager using the same lock and reservations as lock[index]. Set a timeout for one block without changing lock.task_timeout or creating an independent lock. With no indexes, it reserves only a global slot; multiple indexes are acquired atomically and duplicates count once. Entering the context returns the parent lock.

UsageTimeout after acquisition
lock.scope("account-1")Inherits the lock's default at acquisition, not when the scope is created. Explicit task_timeout=... has the same meaning.
lock.scope("account-1", task_timeout=1)Uses a one-second timeout for this block only.
lock.scope("account-1", task_timeout=None)Disables the timeout for this block only.
lock.scope(task_timeout=1)Uses a one-second timeout with only a global reservation.

The override must be a finite positive real number, None, or the default ... sentinel. Invalid values, including booleans, raise ValueError when scope() is called. Queue waiting is still excluded. The scope uses the parent lock's timeout_behavior at acquisition; this method overrides only the duration.

Pass indexes as separate arguments: lock.scope("a", "b", task_timeout=1). To unpack a list, use lock.scope(*indexes, task_timeout=1); passing the list itself raises TypeError because it is unhashable. Unlike lock["a", "b"], lock.scope(("a", "b")) treats the tuple as one index.

Example: override one block's timeout

async def scope_example():
    lock = AsyncLock(task_timeout=30, max_concurrent=2)

    try:
        async with lock.scope("account-1", task_timeout=0.01):
            await asyncio.sleep(1)
    except asyncio.TimeoutError:
        print("This block exceeded its shorter timeout")

    async with lock.scope("account-1", "account-2", task_timeout=None):
        await asyncio.sleep(0.01)  # Both indexes reserved, no block timeout.

    async with lock["account-1"]:
        await asyncio.sleep(0.01)  # Still uses the original 30-second default.

Timeouts and cancellation

ModeAt the deadline
0 / "raise" (default)Cancels the block cooperatively. Once cleanup completes, releases its slots and raises asyncio.TimeoutError.
1 / "suppress"Cancels the block cooperatively, then releases its slots after cleanup and continues after async with, suppressing the lock's timeout error. Unfinished statements inside the block are skipped.
2 / "release"Releases slots without cancelling the block. Later work can overlap the still-running block, including work using the same indexes. This mode does not preserve mutual exclusion after the deadline.

Cancellation is cooperative: blocking the event loop delays timers, and catching cancellation inside the block can prevent the expected timeout outcome. Let cancellation propagate and perform cleanup in finally. Ordinary block exceptions and external cancellation propagate; "suppress" does not generally swallow them. Cancelling a waiting task removes its request or releases a reservation already granted to it.

The lock is not reentrant: nested acquisition gets no special allowance for slots already held by the same task and can wait indefinitely. Queue waiting has no built-in timeout. Do not share a lock across event loops; attempting to acquire it from another loop raises RuntimeError. This class coordinates tasks; it does not create workers or schedule jobs.

Example: parallel accounts, serialized work per account

import asyncio
from toolbox import AsyncLock

async def main():
    lock = AsyncLock(task_timeout=None, max_concurrent=3,
                     max_concurrent_by_index=1)

    async def update_account(account_id):
        async with lock[account_id]:
            print("Starting", account_id)
            await asyncio.sleep(0.01)  # Replace with async account work.
            print("Finished", account_id)

    await asyncio.gather(update_account("a"), update_account("a"),
                         update_account("b"))

    # Reserve both accounts together for an operation touching both.
    async with lock["a", "b"]:
        await asyncio.sleep(0.01)

asyncio.run(main())

The two updates for "a" run sequentially, while "b" may run alongside either. With the default max_concurrent=1, all blocks would run sequentially regardless of index.

Example: handle a block timeout

async def timeout_example():
    lock = AsyncLock(task_timeout=0.01, timeout_behavior="raise")
    try:
        async with lock["account-1"]:
            await asyncio.sleep(1)
    except asyncio.TimeoutError:
        print("Timed out; slots have been released")

Time, Queues, and Interchange Formats

APIPurpose
Timeto_min, parse_datetime, parse_time, parse_date, and date-format generation.
epoch(epoch_timestamp=None)Converts between epoch-oriented values and the module's datetime representation.
TimeEstimate(amt=None, print_every=None, ...)Tracks completed work, elapsed/average duration, percent complete, and estimated completion.
ActionQueue(queue_file='queue.json', queue_file_type=None, loop_interval=60, remove_on_err=True)Persists scheduled actions and runs registered handlers. create_action accepts datetime, date, timedelta, and supported numeric activation values.
iCalendar(name, uid, ...)Adds events and generates iCalendar text.
vCard(first_name, last_name, ...)Adds phone/email/address/organization metadata and generates a contact card.
Version(v_str)Comparable, normalized dotted-version value used by compatibility checks.

Time parsing (v1.5.5.1)

Call these methods on Time directly. parse_datetime and parse_date return datetime.datetime objects or None; parse_time returns duration seconds, with 0 for invalid input.

Time.parse_datetime(txt, day_first=None, tzinfo=None)

Accepts strings containing ISO dates/timestamps, compact YYYYMMDD dates, numeric dates, named months (including ordinal days), 12/24-hour times, fractional seconds, and signed Unix seconds or milliseconds. Non-string, empty, and invalid date/time inputs return None.

Default timezone (v1.5.5.1)

tzinfo=None preserves the previous behavior. Supply a datetime.tzinfo instance, such as datetime.timezone.utc or zoneinfo.ZoneInfo("America/New_York"), to give otherwise naive parsed dates and times a timezone. The parsed clock values stay the same; this attaches a timezone rather than converting a local clock reading. Explicit zones in the input are preserved, even when a different default is supplied. Unix timestamps instead represent an instant and are converted into the supplied zone.

Missing date fields still use the current UTC date, even with a default timezone. A timezone name string such as "UTC" is not accepted for this argument; non-None values that are not datetime.tzinfo instances raise TypeError. This argument belongs to parse_datetime; parse_date retains its existing signature.

from datetime import timezone, timedelta
from toolbox import Time

utc = timezone.utc
west = timezone(timedelta(hours=-4))
assert Time.parse_datetime("2026-10-24 14:30", tzinfo=utc).isoformat() == "2026-10-24T14:30:00+00:00"
assert Time.parse_datetime("2026-10-24T14:30:00-04:00", tzinfo=utc).utcoffset() == timedelta(hours=-4)
assert Time.parse_datetime("0", tzinfo=west).isoformat() == "1969-12-31T20:00:00-04:00"
assert Time.parse_datetime("2026-10-24").tzinfo is None

Time.parse_time(txt)

Parses durations such as 1h30m, 1 hour, 30 minutes, and 1 hour and 30 minutes. A leading + or - applies to the entire duration. Fractional amounts and existing unit aliases are supported; weeks are seven days and years are 365 days.

Every amount must have a recognized unit, and the entire input must be valid. Unknown units, trailing text, malformed numbers, non-string inputs, and incomplete components return 0, rather than a partial total. Bare numbers and clock notation such as 01:30 are not duration syntax. A valid zero duration also returns zero, so this result alone cannot distinguish zero from invalid input.

Time.parse_date(txt)

Tries the formats in Time.date_formats using datetime.strptime, returning the first successful datetime or None. These include numeric, named-month, ordinal-day, and compact dates. Unlike parse_datetime, this method uses strptime's defaults for omitted fields (for example, year 1900 for a yearless date); it has no day_first argument.

Examples

from toolbox import Time

assert Time.parse_datetime("2026-10-24T14:30:00Z").isoformat() == "2026-10-24T14:30:00+00:00"
assert Time.parse_datetime("03/04/2026").isoformat() == "2026-03-04T00:00:00"
assert Time.parse_datetime("03/04/2026", day_first=True).isoformat() == "2026-04-03T00:00:00"
assert Time.parse_datetime("October 24th, 2026 at 2:30 PM").hour == 14
assert Time.parse_datetime("2026-02-30") is None
assert Time.parse_time("-1h30m") == -5400
assert Time.parse_time("1.5 hours") == 5400
assert Time.parse_time("1h junk") == 0
assert Time.parse_date("2026-10-24").isoformat() == "2026-10-24T00:00:00"
assert Time.parse_date("not a date") is None
calendar = iCalendar("Support rota", "[email protected]")
calendar.add_event("On call", "event-1", starts_at, ends_at)
ics_text = calendar.generate()

Address, Phone, and Identity Types

Address

Address(d, correct_address=True, parse_address=True) accepts a string, mapping, or supported address-like value. It normalizes street suffixes, state abbreviations, ZIP/postal codes, and common misplaced fields. Use Address.parse_address(text) for direct parsing, to_dict() for serialization, and compare_address for normalized comparison. Aliases include street, street2, zip_code, and postal_code. Version 1.5 uses precomputed street-suffix and state-name lookups to speed up parsing.

PhoneNumber

PhoneNumber(number) normalizes a phone number and exposes e164, domestic_format, and international_format.

Other domain types

TypePurpose
AndroidDevice / AgentFormatDevice catalog and user-agent format support.
Permission.evaluate_permission(primary, evaluate)Checks exact, prefix, suffix, and wildcard-style permission relationships.
Extra(...)Manages encoded non-standard database-column data, with dictionary or list-like mutations followed by save().
BivariateData(data) / Slope(slope, yint)Correlation, regression slope, and linear equation representation.

Service Plugins

Integrations are grouped under the lowercase plugins namespace; instantiate a nested class directly.

Mailgun

mailgun = plugins.Mailgun(api_key, domain,
    default_from="Support <[email protected]>",
    default_archive_to="[email protected]")

response = await mailgun.send_email(
    "Welcome", "[email protected]", html="<p>Hello</p>"
)

send_email accepts one of text, html, or template, plus CC/BCC, reply-to, template variables, and per-message archive_to. The per-message value overrides the constructor default.

Twilio

twilio = plugins.Twilio(account_sid, auth_token, default_from="+15551234567")
await twilio.send_sms("+15557654321", body="Hello")

lookup = await twilio.lookup(
    "+15557654321",
    ["line_status", "line_type_intelligence"]
)
active = lookup.line_status.is_line_active if lookup.line_status else None

lookup(phone_number, lookup_fields, **params) accepts a field string or list and forwards additional query parameters. It returns plugins.Twilio.LookupNumber, which retains response-style properties such as status_code, headers, text, json(), and raise_for_status(), while also exposing parsed caller_name, identity_match, line_status, and line_type_intelligence objects.

identity_match(..., **params) formats supported birth dates as YYYYMMDD and accepts an Address, mapping, or string. Convenience methods line_status(phone) and is_line_active(phone) return parsed status; the latter is tri-state: True, False, or None when unknown.

UserManager

plugins.UserManager(dbm, tbl_name='users', mfa_tbl=None, session_validator=None) integrates with aiosqliteObj. It creates required user/session columns, hashes passwords, caches users, and manages persisted sessions. Nested types include User, UserSession, UserSession.Validation, and MFA.

Function and Class Glossary

Alphabetical glossary of the public toolbox API. “Conditional” entries exist only when their optional dependency is available.

Classes

NameDefinition
AsyncLockAsync context manager with global and per-index concurrency limits, atomic multi-index acquisition, and configurable timeouts.
ActionQueuePersistent scheduler that maps named actions to handlers and executes them when activated.
AddressParses, normalizes, serializes, and compares postal addresses.
AgentFormatAssociates a text parser with user-agent OS, device, mobile, and tablet metadata.
AiohttpResponseRequests-like wrapper around a fully read aiohttp response; conditional on aiohttp support.
AndroidDeviceRepresents and looks up Android device metadata from the module's device catalog.
AsyncIpInfoAsynchronous IP metadata lookup with configurable memory, file, or SQLite caching.
AsyncPropertyDescriptor that exposes an async getter through property syntax.
AttrDictDictionary wrapper whose keys are also accessible as attributes.
BivariateDataCalculates correlation and a fitted slope from paired numeric observations.
CachedClassPropertyClass-level cached descriptor with optional time-based expiration.
CachedPropertyInstance-level cached descriptor supporting async values, expiration, inspection, and replacement by assignment.
CacheListList-like collection with an auxiliary lookup cache for fast retrieval.
CellTyped cell value used internally by Table.
ClassPropertyDescriptor that evaluates a property getter against the class.
CodeFormatPygments-backed HTML formatter for Python, console, and traceback text; conditional on Pygments.
ColumnColumn metadata, width, and totals support for Table.
CountryInfoLoads country metadata and resolves countries from supported keys.
CSVReaderNamespace for standard, fast, threaded, streaming, and quote-free CSV parsing and writing.
DataInfoCached descriptive statistics for numeric datasets, including quartiles, outliers, and z-scores.
DataInfoMiscDescriptive-statistics variant for broader sortable values and reverse ordering.
DelayModuleLoadProxy that imports a module the first time an attribute is accessed.
ExtraReads and mutates encoded list/dictionary data stored in a database column.
FileInfoNormalized file/directory metadata with child and recursive file enumeration.
iCalendarBuilder for events and serialized iCalendar content.
IpInfoSynchronous IP metadata, validation, serialization, reverse DNS, and caching.
IterLoopIterator that restarts at the beginning whenever its input sequence is exhausted.
LinkInfoParses URLs into host, path, query, domain, and link-discovery information.
ListIndexBinary-search-oriented index over a list, including exact and case-insensitive lookups.
ListTableHeader-aware wrapper for rows with dictionary export.
MatchingConfigurable normalized, positional-wildcard, phonetic, exact, containment, and fuzzy text matching; includes nested Settings.
merge_itersIterator class that yields several iterables as a single sequence.
PermissionNamespace for evaluating exact and wildcard-like permission strings.
PhoneNumberNormalized phone number with E.164, domestic, and international formatting.
pluginsNamespace containing the Mailgun, Twilio, and UserManager integrations and their response/session types.
RandomStringNamespace for ordinary and cryptographically secure random strings by character set.
ReqInfoSerializable request snapshot with parsed URL, user-agent, IP, location, and crawler checks.
ReverseListIterIterator that traverses a list-like value in reverse.
RowRow container used internally by Table.
ServerAnalyticsMinimal analytics state container retaining a bounded set of recent requests.
SlopeValue object for a linear slope and y-intercept.
SortedListList that inserts appended values while preserving configured sort order.
StandardRequestAdapter exposing common request fields across supported web frameworks.
StringInfoString analysis helper for character, word, pattern, and link inspection.
TableBasic fixed-width text table composed of columns, rows, and cells.
TestManagerBenchmark runner supporting fixed iteration counts, time windows, and manual trials.
TimeNamespace for duration conversion and flexible date/time parsing.
TimeEstimateProgress tracker that estimates remaining time, completion time, and average duration.
TxtParserPattern parser that extracts named values and supports optional sections.
TxtParserBasicReduced named-value pattern parser without optional-section configuration.
TxtParserExpExperimental variant of the named-value text parser.
TxtTableEnhanced text table with CSV/HTML output and Flask-oriented filtering, sorting, and pagination.
UniqueList-like collection that rejects duplicates and can cap retained items.
UniqueDictType-grouped unique-value collection with flattened access.
UserAgentParses browser, OS, device, version, mobility, and crawler identity from headers.
vCardBuilder for contact details serialized as vCard text.
VersionNormalized, comparable dotted-version value.
WebRequestInfoCombines an IP and user agent and confirms known crawler networks through DNS.
ZF_REQSpecialized proxy downloader that requests compressed remote content and unwraps the ZIP response.

Functions

NameDefinition
base10_to_base36, base10_to_base62Convert a nonnegative integer to the documented base alphabet.
peyton_day_timestampReturns integer millionths of a day since the start of 2000 UTC.
peyton_id_prefixEncodes the Unix-millisecond timestamp as a base62 prefix.
peyton_id_prefix_to_timestampDecodes a prefix into a naive local datetime.
peyton_id, peyton_id_secureBuild timestamp-prefixed IDs using ordinary or secure random suffixes.
bytes_to_strDecodes bytes by trying the module's supported encodings.
convert_to_normalApplies Unicode NFKD decomposition and custom character-name replacements, returning lowercase text. Phonetic conversion is a separate function.
convert_to_single_lettersCollapses consecutive duplicate characters.
count_dictBuilds a frequency mapping, optionally using custom comparison or estimation.
count_printPrints frequency information with an optional output-line limit.
dec_amtChooses a decimal precision based on numeric magnitude.
dict_printPrints a dictionary as formatted JSON-like text.
dir_sizeReturns the recursive byte size of a directory.
download_fileStreams a URL to disk synchronously, with a legacy-TLS retry path.
download_file_asyncStreams a URL to disk asynchronously with progress and optional gzip output; conditional on aiohttp.
epochReturns the current epoch, converts an epoch to datetime, or converts a datetime to epoch.
equivilency_convertApplies phonetic-equivalence substitutions; the misspelling is part of the public API.
extract_intExtracts digit characters from a value and returns them as a string.
file_arg_to_bufferNormalizes supported path, byte, string, or file-like inputs to a binary buffer.
file_arg_to_fileNormalizes supported inputs to an opened file-like object.
file_arg_to_fpResolves a supported file argument to its filesystem path when possible.
file_arg_to_strReads or converts a supported file argument to text.
format_currencyFormats a numeric value as dollar currency.
format_nameApplies person-name capitalization rules.
format_numberAdds grouping separators and removes unnecessary decimal zeros.
format_sizeFormats a byte count with a human-readable unit.
format_time_secFormats seconds or a timedelta using an appropriate duration unit.
get_all_betweenReturns every substring bounded by start and end delimiters.
get_betweenReturns the first substring bounded by start and end delimiters.
get_medianReturns the middle value (or midpoint pair) and assumes the supplied sequence is already sorted.
get_sd_devCalculates the module's deviation metric; see the statistics caveat above.
get_totalSums the supplied data.
haversineCalculates great-circle distance between two latitude/longitude points.
is_class_instanceTests whether a value appears to be an instantiated class object.
is_evenReturns whether a numeric amount is even.
is_json_parsableRecursively checks whether a value can be represented by the module's JSON rules.
iter_dictYields dictionary key/value pairs.
make_json_parsableRecursively converts common non-JSON values into serializable representations.
name_to_normalMaps a Unicode character-name string to a custom replacement; returns None when no mapping exists.
obj_attr_printPrints selected attributes from an object.
obj_attr_txtReturns selected object attributes as text.
place_suffixReturns an English ordinal suffix such as st, nd, rd, or th.
quick_saveWrites data to a path or supported file destination with minimal setup.
randomize_listReturns a randomly reordered copy of a list.
remove_outliersReturns data inside the module's 1.5-IQR outlier bounds.
run_codeExecutes Python code while capturing stdout or a traceback; unsafe for untrusted input.
scan_for_fileReturns FileInfo for an existing path, or None.
sort_dictReturns a dictionary ordered by key or a supplied sort callback.
splitCurrent optimized split implementation with count and case-sensitivity controls.
split_multiSplits text on any of several delimiters.
split_multi_oldCompatibility implementation of multi-delimiter splitting.
split_oldCompatibility implementation of single-delimiter splitting.
to_numbConverts numeric-looking strings to int or float and leaves other inputs unchanged.
word_to_digitConverts a supported written number word to a digit value.

Public API Index

This index lists every non-underscore top-level function and class in version 1.5.1.1. Some classes are support types normally created by a higher-level API.

AreaPublic symbols
Loading and HTTPDelayModuleLoad, AiohttpResponse (when aiohttp is available), download_file_async (when aiohttp is available), download_file
Formatting and numbersdec_amt, format_time_sec, format_size, format_number, format_currency, format_name, to_numb, place_suffix, extract_int
Statistics and measurementTestManager, remove_outliers, get_sd_dev, get_total, get_median, is_even, DataInfo, DataInfoMisc, BivariateData, Slope, TimeEstimate
Files and serializationdir_size, FileInfo, scan_for_file, bytes_to_str, file_arg_to_str, file_arg_to_buffer, file_arg_to_file, file_arg_to_fp, quick_save, make_json_parsable, is_json_parsable
Tables and CSVTable, Column, Row, Cell, TxtTable, CSVReader, ListTable
Collectionsiter_dict, sort_dict, merge_iters, randomize_list, IterLoop, CacheList, Unique, UniqueDict, count_dict, ReverseListIter, ListIndex, SortedList, AttrDict, count_print, dict_print
DescriptorsAsyncProperty, CachedProperty, ClassProperty, CachedClassProperty
Text and parsingRandomString, get_all_between, get_between, StringInfo, LinkInfo, obj_attr_print, obj_attr_txt, TxtParserExp, TxtParser, TxtParserBasic, split_multi_old, split_old, split_multi, split, word_to_digit, name_to_normal, convert_to_normal, convert_to_single_letters, equivilency_convert, Matching, CodeFormat (when Pygments is available)
Network and requestsZF_REQ, CountryInfo, IpInfo, AsyncIpInfo, AndroidDevice, AgentFormat, UserAgent, WebRequestInfo, StandardRequest, ServerAnalytics, ReqInfo
Timestamp IDs and basespeyton_day_timestamp, peyton_id_prefix, peyton_id_prefix_to_timestamp, peyton_id, peyton_id_secure, base10_to_base36, base10_to_base62
Async coordinationAsyncLock
Time and formatsTime, epoch, ActionQueue, iCalendar, vCard, Version
Domain and integrationsAddress, Extra, PhoneNumber, Permission, plugins, haversine, is_class_instance, run_code

Changes Since the Previous Docs

This guide describes the distributed source at 1.5.1.1. Recent additions and retained features include:

Design Notes

Examples

DataInfo

di = DataInfo([1, 2, 3, 4, 100])
print(di.info_txt())

Table

t = Table()
t.add_column("Name")
t.add_column("Value")
t.add_row("A", 100)
t.add_row("B", 200)
t.print()

AiohttpResponse

resp = await AiohttpResponse.get("https://example.com")
print(resp.text)

Object and function guide

Most toolbox APIs fit one of three calling styles: plain functions return converted values, namespace classes such as CSVReader expose functions called directly on the class, and stateful objects such as TxtTable hold data across method calls. Async methods must be awaited; custom async properties use await object.property.

FamilyInput and resultState or side effect
Formatting functionsformat_number, format_currency, format_size, and format_time_sec return display strings. place_suffix(21) returns only "st".Use the original numeric value for calculations. to_numb only converts recognized numeric-looking strings and may return the original input.
FileInfo(path)Metadata object with name, path, is_dir, byte size, and datetime modified/created_at.Reads filesystem metadata immediately; directory construction calculates recursive size. Timestamps are naive local datetimes; created_at uses platform-dependent stat ctime.
DataInfo(data)Numeric collection summary with cached len, total, avg, median, range, and other statistics. get_item(value) returns a DataInfo.Item with frequency and lazy statistics.Keeps your input list and may sort it in place. Pass a copy if ordering matters. Cached results do not automatically refresh after arbitrary mutation; create a new DataInfo for changed data.
TxtTable(...)add_column returns Column, add_row returns Row, and a Row's data contains Cell objects with underlying/display values.print(send=False) returns text; the default also prints. CSV and HTML exports return strings. Add columns before rows and pass one value per column.
CSVReader → ListTable → ListTable.RowRead methods return a ListTable by default. Index a row with a column name or integer, or call row.dict(). as_list=True returns raw row lists, including the header row.Reads consume file-like inputs. Parsers materialize the result even when input reading is line-oriented. Use [row.dict() for row in table]; current ListTable.dict() references a nonexistent attribute.
TxtParser(format_txt, ...)Callable parser object. Named placeholders such as <name> become dictionary keys; calling it returns a dictionary or None when no match is found.Compiles its pattern during construction. handle_not_found=True uses looser matching and can return None-valued fields. It is a pattern helper, not an input-validation schema.
CacheList(max_cache_size=100)get(key, default=None) retrieves a stored object; pop(index=-1) removes and returns one; append/add/remove return None.Uses a key dictionary plus an eviction queue. Set stringify_func(callable) before adding values. Re-appending an existing key refreshes eviction order but retains the original object.

scan_for_file(path) returns a FileInfo when the path exists, otherwise None. FileInfo.all_files() and all_files_recursive() return filename strings, not FileInfo objects or reliable full paths; recursive results can contain the same basename from different subdirectories.

Many namespace methods omit self; call CSVReader.read(...), Time.parse_time(...), and Matching.match(...) on the class. Constructing and calling them as ordinary instance methods may pass an unexpected argument.

Worked example: CSV to a formatted report

The default CSV result is a ListTable. Its rows support header-based indexing; the report creates separate typed cells so numeric display formatting can apply. No external file or service is required after the import-time updater setup.

import io
import toolbox

csv_input = io.StringIO("name,amount\nAda,1200\nGrace,85.5\n")
data = toolbox.CSVReader.basic_read(csv_input)
report = toolbox.TxtTable(format_numbers=True)
report.add_column("Name")
report.add_column("Amount")

for row in data:
    report.add_row(row["name"], toolbox.to_numb(row["amount"]))

print(report.print(send=False))
plain_records = [row.dict() for row in data]
print(plain_records[0]["name"])  # Ada
csv_output = toolbox.CSVReader.write([
    ["name", "amount"],
    *[[record["name"], record["amount"]] for record in plain_records],
])
print(csv_output)

CSVReader.write(rows) expects an iterable of row sequences and returns text. write_file(path, rows) also writes/closes its destination. condense() rewrites its input file. The custom serializer quotes commas and quotes but does not cover every multiline CSV case; use Python's standard csv module when general CSV interoperability is required.

Worked example: indexed cache and cached properties

CacheList stores objects by the key returned by your callback. Looking up a key does not refresh its eviction position. In this example, adding a third distinct key evicts the first because the capacity is two.

import toolbox

cache = toolbox.CacheList(max_cache_size=2)
cache.stringify_func(lambda item: item["id"])
cache.append({"id": "a", "name": "Ada"})
cache.append({"id": "b", "name": "Grace"})
print(cache.get("a")["name"])  # Ada
cache.append({"id": "c", "name": "Linus"})
print(cache.get("a"))  # None
print(cache.pop()["name"])  # Linus

class Report:
    def __init__(self, values):
        self.values = list(values)
        self.calculations = 0

    @toolbox.CachedProperty(expire=60)
    def total(self):
        self.calculations += 1
        return sum(self.values)

report = Report([10, 20])
print(report.total, report.total, report.calculations)  # 30 30 1
print(Report.total.is_cached(report))  # True
report.total = 40  # Explicitly replace the cached value.
print(report.total)  # 40

CachedProperty accepts an expiry in seconds or a timedelta. Read the descriptor through the class, as in Report.total.is_cached(report) and get_cached(report). Assignment replaces the cached value and resets its expiry; a decorated setter may transform the assigned value. There is no public cache-clear method. A changed underlying list does not invalidate the property automatically.

Worked example: parse and normalize contact fields

TxtParser captures strings; convert each field explicitly. PhoneNumber strips nondigits, assumes +1 for ten digits, and treats extra leading digits as a country code. It formats values but does not validate real numbering-plan assignments.

import toolbox

parser = toolbox.TxtParser("<name> ; <phone>")
fields = parser("Ada Lovelace ; (212) 555-0100")
if fields is None:
    raise ValueError("Expected name ; phone")

phone = toolbox.PhoneNumber(fields["phone"])
print(phone.e164)  # +12125550100
print(phone.domestic_format)  # (212) 555-0100
print(phone.country_code, phone.area_code)  # +1 212

address = toolbox.Address({
    "address1": "10 Main Street",
    "address2": None,
    "city": "New York",
    "state": "NY",
    "zip": "10001",
}, correct_address=False)
print(address.street)
print(address.to_dict()["zip"])
print(toolbox.Matching.match("Héloise", "HELOISE"))  # True

Address owns mutable address1, address2, city, state, and zip fields. street, street2, zip_code, and postal_code are read aliases. to_dict() returns those five fields; parsed_address and compare_address are cached string properties, not methods. Construct a new Address after changing fields if fresh cached normalization is required. Address normalization does not verify postal deliverability.

Worked example: asynchronous HTTP response

This example requires aiohttp and network access. The response helpers consume the response body before returning AiohttpResponse. Then content, text, and json() are synchronous byte/string/decoded-JSON accessors; await the request, not those accessors.

import asyncio
import aiohttp
import toolbox

async def main():
    response = await toolbox.AiohttpResponse.get(
        "https://example.com/",
        timeout=aiohttp.ClientTimeout(total=10),
    )
    response.raise_for_status()
    print(response.status_code, response.url)
    print(len(response.content), response.elapsed.total_seconds())
    print(response.text[:80])

asyncio.run(main())

get, post, and delete forward arguments to aiohttp requests and return AiohttpResponse. headers, cookies, status_code/status, url, encoding, and elapsed provide response metadata. raise_for_status() raises for HTTP errors; methods do not call it automatically. ping() issues a GET, closes the response without loading its body, and returns None.

Complete source API

Generated from modules/toolbox.py; version 1.6. Includes public functions, classes, directly declared methods, properties, and Python protocol methods. Conditional APIs may require optional dependencies. Inherited members and dynamically assigned attributes are explained in the guide where relevant.

Signatures and docstrings are extracted without importing or running the module. A property or AsyncProperty decorator changes how a member is accessed; see its decorators and the guide.

Classes and objects

Module functions

class DelayModuleLoad

Source line 16

Construct: DelayModuleLoad(module_name, name_as=None, module_to_globals=True)

Declared functions, properties, and nested objects:

DelayModuleLoad.__init__(self, module_name, name_as=None, module_to_globals=True)

Source line 18

ParameterPassing conventionDefault / required
module_namepositional or keywordrequired
name_aspositional or keywordNone
module_to_globalspositional or keywordTrue
DelayModuleLoad.__getattr__(self, name)

Source line 45

ParameterPassing conventionDefault / required
namepositional or keywordrequired
class AiohttpResponse

Source line 305

Allows for requests to be done similar to
requests module w/ aiohttp, with response object being

Construct: AiohttpResponse(r, elapsed, data)

Fields assigned by the constructor: content, elapsed. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AiohttpResponse.__init__(self, r, elapsed, data)

Source line 310

ParameterPassing conventionDefault / required
rpositional or keywordrequired
elapsedpositional or keywordrequired
datapositional or keywordrequired
AiohttpResponse.raise_for_status(self)

Source line 338

No caller-supplied parameters are declared.

AiohttpResponse.json(self)

Source line 340

Get json content as a dictionary.

No caller-supplied parameters are declared.

AiohttpResponse.text(self)

Source line 344

Decorators: @property

Get content as a string

No caller-supplied parameters are declared.

async AiohttpResponse.get(*args, **kwargs)

Source line 349

Make a GET request via aiohttp.
ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async AiohttpResponse.post(*args, **kwargs)

Source line 359

Make a POST request via aiohttp.
ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async AiohttpResponse.delete(*args, **kwargs)

Source line 369

Make a DELETE request via aiohttp.
ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async AiohttpResponse.ping(*args, **kwargs)

Source line 379

Make a GET request without loading all of page content.
ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async download_file_async(url, dest_path, chunk_size=1024 * 1024, verbose=False, as_gzip=False)

Source line 387

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
dest_pathpositional or keywordrequired
chunk_sizepositional or keyword1024 * 1024
verbosepositional or keywordFalse
as_gzippositional or keywordFalse

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

download_file(url, dest_path, chunk_size=1024 * 1024)

Source line 426

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
dest_pathpositional or keywordrequired
chunk_sizepositional or keyword1024 * 1024
dec_amt(n)

Source line 466

ParameterPassing conventionDefault / required
npositional or keywordrequired
format_time_sec(sec)

Source line 479

ParameterPassing conventionDefault / required
secpositional or keywordrequired
format_size(size)

Source line 537

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
format_number(number)

Source line 555

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
format_currency(number)

Source line 574

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
format_name(name)

Source line 578

ParameterPassing conventionDefault / required
namepositional or keywordrequired
class TestManager

Source line 592

Construct: TestManager(**kwargs)

Fields assigned by the constructor: end, start, test_trial, trial_amt, trial_time, trial_type. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TestManager.__init__(self, **kwargs)

Source line 593

ParameterPassing conventionDefault / required
kwargsextra keyword arguments (**kwargs)optional collection
TestManager.__iter__(self)

Source line 618

No caller-supplied parameters are declared.

TestManager.__next__(self)

Source line 627

No caller-supplied parameters are declared.

TestManager.empty_trial_iter(**kwargs)

Source line 662

ParameterPassing conventionDefault / required
kwargsextra keyword arguments (**kwargs)optional collection
TestManager.empty_trial_run(trial_count)

Source line 667

ParameterPassing conventionDefault / required
trial_countpositional or keywordrequired
TestManager.empty_trial_manual(trial_count)

Source line 674

ParameterPassing conventionDefault / required
trial_countpositional or keywordrequired
TestManager.duration(self)

Source line 683

Decorators: @property

No caller-supplied parameters are declared.

TestManager.duration_str(self)

Source line 691

Decorators: @property

No caller-supplied parameters are declared.

TestManager.avg_duration(self)

Source line 694

Decorators: @property

No caller-supplied parameters are declared.

TestManager.avg_duration_str(self)

Source line 697

Decorators: @property

No caller-supplied parameters are declared.

TestManager.test_func(self, func)

Source line 699

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
TestManager.run(self)

Source line 701

No caller-supplied parameters are declared.

TestManager.start_trial(self)

Source line 713

No caller-supplied parameters are declared.

TestManager.end_trial(self)

Source line 716

No caller-supplied parameters are declared.

TestManager.print_results(self)

Source line 723

No caller-supplied parameters are declared.

TestManager.txt_results(self)

Source line 727

No caller-supplied parameters are declared.

remove_outliers(data)

Source line 733

ParameterPassing conventionDefault / required
datapositional or keywordrequired
get_sd_dev(data)

Source line 781

ParameterPassing conventionDefault / required
datapositional or keywordrequired
get_total(data)

Source line 800

ParameterPassing conventionDefault / required
datapositional or keywordrequired
get_median(data)

Source line 811

ParameterPassing conventionDefault / required
datapositional or keywordrequired
is_even(amt)

Source line 833

ParameterPassing conventionDefault / required
amtpositional or keywordrequired
dir_size(dir_path)

Source line 840

ParameterPassing conventionDefault / required
dir_pathpositional or keywordrequired
class FileInfo

Source line 854

Construct: FileInfo(x)

Fields assigned by the constructor: created_at, is_dir, modified, name, path, size. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

FileInfo.__init__(self, x)

Source line 855

ParameterPassing conventionDefault / required
xpositional or keywordrequired
FileInfo.all_files_recursive(self)

Source line 879

No caller-supplied parameters are declared.

FileInfo.all_files(self)

Source line 893

No caller-supplied parameters are declared.

FileInfo.__str__(self)

Source line 903

No caller-supplied parameters are declared.

FileInfo.__repr__(self)

Source line 905

No caller-supplied parameters are declared.

scan_for_file(file)

Source line 910

ParameterPassing conventionDefault / required
filepositional or keywordrequired
class DataInfo

Source line 916

Construct: DataInfo(data)

Fields assigned by the constructor: data, data_sorted. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class DataInfo.Item

Source line 917

Construct: DataInfo.Item(n, di)

Fields assigned by the constructor: data_info, frequency, number. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

DataInfo.Item.__init__(self, n, di)

Source line 918

ParameterPassing conventionDefault / required
npositional or keywordrequired
dipositional or keywordrequired
DataInfo.Item.zscore(self)

Source line 926

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.Item.is_outlier(self)

Source line 931

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.Item.percentile(self)

Source line 936

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.Item.load(self)

Source line 940

No caller-supplied parameters are declared.

DataInfo.Item.__repr__(self)

Source line 944

No caller-supplied parameters are declared.

DataInfo.__init__(self, data)

Source line 946

ParameterPassing conventionDefault / required
datapositional or keywordrequired
DataInfo.sorted_data(self)

Source line 960

No caller-supplied parameters are declared.

DataInfo.len(self)

Source line 965

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.total(self)

Source line 970

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.range(self)

Source line 975

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.item_dict(self)

Source line 1016

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.mode(self)

Source line 1021

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.iqr(self)

Source line 1026

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.avg(self)

Source line 1031

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.avg_no_outliers(self)

Source line 1038

No caller-supplied parameters are declared.

DataInfo.even_len(self)

Source line 1048

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.median(self)

Source line 1051

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.skewed(self)

Source line 1056

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.sd_dev(self)

Source line 1065

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.avg_dev(self)

Source line 1074

Decorators: @property

No caller-supplied parameters are declared.

DataInfo.load(self)

Source line 1082

No caller-supplied parameters are declared.

DataInfo.is_outlier(self, n)

Source line 1150

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfo.get_zscore(self, n)

Source line 1158

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfo.get_item(self, n)

Source line 1160

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfo.get_percentile(self, n)

Source line 1163

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfo.info_txt(self)

Source line 1196

No caller-supplied parameters are declared.

DataInfo.print(self)

Source line 1214

No caller-supplied parameters are declared.

DataInfo.basic_info_txt(self)

Source line 1218

No caller-supplied parameters are declared.

DataInfo.basic_print(self)

Source line 1228

No caller-supplied parameters are declared.

DataInfo.__len__(self)

Source line 1233

No caller-supplied parameters are declared.

DataInfo.__iter__(self)

Source line 1235

No caller-supplied parameters are declared.

DataInfo.__next__(self)

Source line 1238

No caller-supplied parameters are declared.

class DataInfoMisc

Source line 1242

Construct: DataInfoMisc(data, reverse=False)

Fields assigned by the constructor: data, data_sorted, reverse. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class DataInfoMisc.Item

Source line 1243

Construct: DataInfoMisc.Item(n, di)

Fields assigned by the constructor: data_info, frequency, value. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

DataInfoMisc.Item.__init__(self, n, di)

Source line 1244

ParameterPassing conventionDefault / required
npositional or keywordrequired
dipositional or keywordrequired
DataInfoMisc.Item.zscore(self)

Source line 1252

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.Item.is_outlier(self)

Source line 1257

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.Item.percentile(self)

Source line 1262

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.Item.load(self)

Source line 1266

No caller-supplied parameters are declared.

DataInfoMisc.Item.__repr__(self)

Source line 1270

No caller-supplied parameters are declared.

DataInfoMisc.__init__(self, data, reverse=False)

Source line 1272

ParameterPassing conventionDefault / required
datapositional or keywordrequired
reversepositional or keywordFalse
DataInfoMisc.sorted_data(self)

Source line 1285

No caller-supplied parameters are declared.

DataInfoMisc.len(self)

Source line 1290

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.total(self)

Source line 1295

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.range(self)

Source line 1300

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.item_dict(self)

Source line 1339

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.mode(self)

Source line 1344

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.iqr(self)

Source line 1349

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.avg(self)

Source line 1354

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.even_len(self)

Source line 1359

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.median(self)

Source line 1362

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.sd_dev(self)

Source line 1367

Decorators: @property

No caller-supplied parameters are declared.

DataInfoMisc.load(self)

Source line 1376

No caller-supplied parameters are declared.

DataInfoMisc.is_outlier(self, n)

Source line 1453

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfoMisc.get_zscore(self, n)

Source line 1461

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfoMisc.get_item(self, n)

Source line 1463

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfoMisc.get_percentile(self, n)

Source line 1466

ParameterPassing conventionDefault / required
npositional or keywordrequired
DataInfoMisc.__len__(self)

Source line 1499

No caller-supplied parameters are declared.

DataInfoMisc.__iter__(self)

Source line 1501

No caller-supplied parameters are declared.

DataInfoMisc.__next__(self)

Source line 1504

No caller-supplied parameters are declared.

iter_dict(d)

Source line 1507

ParameterPassing conventionDefault / required
dpositional or keywordrequired
sort_dict(d, key=None, reverse=False)

Source line 1512

ParameterPassing conventionDefault / required
dpositional or keywordrequired
keypositional or keywordNone
reversepositional or keywordFalse
class Table

Source line 1530

Construct: Table(format_numbers=False, totals=False)

Fields assigned by the constructor: col_amt, columns, format_int, row_amt, rows, totals. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Table.row(txt, rl=8)

Source line 1531

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
rlpositional or keyword8
Table.numbFormat(number)

Source line 1541

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
Table.formattedToNumb(number)

Source line 1547

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
Table.__init__(self, format_numbers=False, totals=False)

Source line 1549

ParameterPassing conventionDefault / required
format_numberspositional or keywordFalse
totalspositional or keywordFalse
Table.add_column(self, name, length=None)

Source line 1556

ParameterPassing conventionDefault / required
namepositional or keywordrequired
lengthpositional or keywordNone
Table.add_row(self, *args)

Source line 1561

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
Table.print(self, limit=None, send=True)

Source line 1568

ParameterPassing conventionDefault / required
limitpositional or keywordNone
sendpositional or keywordTrue
class Column

Source line 1599

Construct: Column(name, length, table, col_num)

Fields assigned by the constructor: col_num, length, name, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Column.__init__(self, name, length, table, col_num)

Source line 1600

ParameterPassing conventionDefault / required
namepositional or keywordrequired
lengthpositional or keywordrequired
tablepositional or keywordrequired
col_numpositional or keywordrequired
Column.__len__(self)

Source line 1605

No caller-supplied parameters are declared.

Column.__repr__(self)

Source line 1618

No caller-supplied parameters are declared.

Column.total(self)

Source line 1620

No caller-supplied parameters are declared.

class Row

Source line 1645

Construct: Row(row_number, format_numbs, *args)

Fields assigned by the constructor: data, format_numbs, row_num. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Row.__init__(self, row_number, format_numbs, *args)

Source line 1646

ParameterPassing conventionDefault / required
row_numberpositional or keywordrequired
format_numbspositional or keywordrequired
argsextra positional arguments (*args)optional collection
class Cell

Source line 1655

Construct: Cell(value, col_num, row_num, format_numbs)

Fields assigned by the constructor: col_num, format_numbs, row_num, type, value. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Cell.__init__(self, value, col_num, row_num, format_numbs)

Source line 1656

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
col_numpositional or keywordrequired
row_numpositional or keywordrequired
format_numbspositional or keywordrequired
Cell.__len__(self)

Source line 1672

No caller-supplied parameters are declared.

Cell.__str__(self)

Source line 1674

No caller-supplied parameters are declared.

Cell.__repr__(self)

Source line 1679

No caller-supplied parameters are declared.

to_numb(s)

Source line 1687

ParameterPassing conventionDefault / required
spositional or keywordrequired
class TxtTable

Source line 1705

Construct: TxtTable(format_numbers=False, totals=False, len_limit=100)

Fields assigned by the constructor: col_amt, columns, format_int, len_limit, row_amt, rows, totals. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtTable.row(txt, rl=8)

Source line 1706

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
rlpositional or keyword8
TxtTable.numbFormat(number)

Source line 1716

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
TxtTable.formattedToNumb(number)

Source line 1725

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
TxtTable.__init__(self, format_numbers=False, totals=False, len_limit=100)

Source line 1727

ParameterPassing conventionDefault / required
format_numberspositional or keywordFalse
totalspositional or keywordFalse
len_limitpositional or keyword100
TxtTable.add_column(self, name, length=None, str_convert=None, value=None)

Source line 1735

ParameterPassing conventionDefault / required
namepositional or keywordrequired
lengthpositional or keywordNone
str_convertpositional or keywordNone
valuepositional or keywordNone
TxtTable.insert_column(self, name, loc, length=None, str_convert=None, value=None)

Source line 1752

ParameterPassing conventionDefault / required
namepositional or keywordrequired
locpositional or keywordrequired
lengthpositional or keywordNone
str_convertpositional or keywordNone
valuepositional or keywordNone
TxtTable.add_row(self, *args)

Source line 1779

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
TxtTable.remove_column(self, col_num)

Source line 1787

ParameterPassing conventionDefault / required
col_numpositional or keywordrequired
TxtTable.print(self, limit=None, send=True)

Source line 1798

ParameterPassing conventionDefault / required
limitpositional or keywordNone
sendpositional or keywordTrue
TxtTable.to_html(self, max_len=100, condensed=True, row_range=None, to_body_top='', to_body_bottom='', to_head='', own_rows=None, table_only=False, row_colors=[['#f0eceb', '#000000'], ['#e6e2e1', '#000000']], background_color='#f7f2f2', header_color='#000000', table_border='1px solid black')

Source line 1838

ParameterPassing conventionDefault / required
max_lenpositional or keyword100
condensedpositional or keywordTrue
row_rangepositional or keywordNone
to_body_toppositional or keyword''
to_body_bottompositional or keyword''
to_headpositional or keyword''
own_rowspositional or keywordNone
table_onlypositional or keywordFalse
row_colorspositional or keyword[['#f0eceb', '#000000'], ['#e6e2e1', '#000000']]
background_colorpositional or keyword'#f7f2f2'
header_colorpositional or keyword'#000000'
table_borderpositional or keyword'1px solid black'
TxtTable.flask_pagination(self, request, per_page=50, max_len=100, page_colors=['#ffffff', '#000000'], to_body_top='', querystring='', search_ignore=None, custom_sort={}, **kwargs)

Source line 1992

ParameterPassing conventionDefault / required
requestpositional or keywordrequired
per_pagepositional or keyword50
max_lenpositional or keyword100
page_colorspositional or keyword['#ffffff', '#000000']
to_body_toppositional or keyword''
querystringpositional or keyword''
search_ignorepositional or keywordNone
custom_sortpositional or keyword{}
kwargsextra keyword arguments (**kwargs)optional collection
TxtTable.to_csv(self)

Source line 2353

No caller-supplied parameters are declared.

TxtTable.__repr__(self)

Source line 2388

No caller-supplied parameters are declared.

class TxtTable.Column

Source line 2391

Construct: TxtTable.Column(name, length, table, col_num, str_convert=None)

Fields assigned by the constructor: col_num, length, name, str_convert, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtTable.Column.__init__(self, name, length, table, col_num, str_convert=None)

Source line 2392

ParameterPassing conventionDefault / required
namepositional or keywordrequired
lengthpositional or keywordrequired
tablepositional or keywordrequired
col_numpositional or keywordrequired
str_convertpositional or keywordNone
TxtTable.Column.__len__(self)

Source line 2398

No caller-supplied parameters are declared.

TxtTable.Column.rows_len(self, rows)

Source line 2415

ParameterPassing conventionDefault / required
rowspositional or keywordrequired
TxtTable.Column.__repr__(self)

Source line 2432

No caller-supplied parameters are declared.

TxtTable.Column.total(self)

Source line 2434

No caller-supplied parameters are declared.

TxtTable.Column.is_numb(self)

Source line 2458

No caller-supplied parameters are declared.

TxtTable.Column.is_datetime(self)

Source line 2464

No caller-supplied parameters are declared.

TxtTable.Column.cells(self)

Source line 2470

No caller-supplied parameters are declared.

class TxtTable.Row

Source line 2480

Construct: TxtTable.Row(row_number, format_numbs, table, *args)

Fields assigned by the constructor: data, format_numbs, row_num, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtTable.Row.__init__(self, row_number, format_numbs, table, *args)

Source line 2481

ParameterPassing conventionDefault / required
row_numberpositional or keywordrequired
format_numbspositional or keywordrequired
tablepositional or keywordrequired
argsextra positional arguments (*args)optional collection
TxtTable.Row.remove_column(self, col_num)

Source line 2495

ParameterPassing conventionDefault / required
col_numpositional or keywordrequired
TxtTable.Row.__repr__(self)

Source line 2505

No caller-supplied parameters are declared.

TxtTable.Row.__eq__(self, other)

Source line 2507

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
TxtTable.Row.__contains__(self, other)

Source line 2511

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
TxtTable.Row.__len__(self)

Source line 2513

No caller-supplied parameters are declared.

TxtTable.Row.__iter__(self)

Source line 2515

No caller-supplied parameters are declared.

TxtTable.Row.__next__(self)

Source line 2518

No caller-supplied parameters are declared.

TxtTable.Row.__getitem__(self, item)

Source line 2520

ParameterPassing conventionDefault / required
itempositional or keywordrequired
class TxtTable.Cell

Source line 2540

Construct: TxtTable.Cell(value, print_value, col_num, row_num, format_numbs)

Fields assigned by the constructor: col_num, format_numbs, print_value, row_num, type, value. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtTable.Cell.__init__(self, value, print_value, col_num, row_num, format_numbs)

Source line 2541

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
print_valuepositional or keywordrequired
col_numpositional or keywordrequired
row_numpositional or keywordrequired
format_numbspositional or keywordrequired
TxtTable.Cell.__len__(self)

Source line 2558

No caller-supplied parameters are declared.

TxtTable.Cell.__str__(self)

Source line 2560

No caller-supplied parameters are declared.

TxtTable.Cell.__contains__(self, other)

Source line 2566

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
TxtTable.Cell.__eq__(self, other)

Source line 2568

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
TxtTable.Cell.__repr__(self)

Source line 2570

No caller-supplied parameters are declared.

TxtTable.to_numb(s)

Source line 2575

ParameterPassing conventionDefault / required
spositional or keywordrequired
place_suffix(n)

Source line 2593

ParameterPassing conventionDefault / required
npositional or keywordrequired
peyton_day_timestamp(dt=None)

Source line 2608

ParameterPassing conventionDefault / required
dtpositional or keywordNone
base10_to_base36(n)

Source line 2619

ParameterPassing conventionDefault / required
npositional or keywordrequired
base10_to_base62(n)

Source line 2630

ParameterPassing conventionDefault / required
npositional or keywordrequired
peyton_id_prefix(dt=None, leading_zeros=True, granularity_level=0)

Source line 2643

ParameterPassing conventionDefault / required
dtpositional or keywordNone
leading_zerospositional or keywordTrue
granularity_levelpositional or keyword0
peyton_id_prefix_to_timestamp(prefix, granularity_level=0)

Source line 2669

ParameterPassing conventionDefault / required
prefixpositional or keywordrequired
granularity_levelpositional or keyword0
peyton_id(dt=None, length=16, leading_zeros=True, granularity_level=0)

Source line 2689

ParameterPassing conventionDefault / required
dtpositional or keywordNone
lengthpositional or keyword16
leading_zerospositional or keywordTrue
granularity_levelpositional or keyword0
peyton_id_secure(dt=None, length=16, leading_zeros=True, granularity_level=0)

Source line 2693

ParameterPassing conventionDefault / required
dtpositional or keywordNone
lengthpositional or keyword16
leading_zerospositional or keywordTrue
granularity_levelpositional or keyword0
class RandomString

Source line 2699

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

RandomString.get(size)

Source line 2705

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.get_alpha(size)

Source line 2710

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.get_num(size)

Source line 2715

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.get_alphanum(size)

Source line 2720

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.secure_get(size)

Source line 2725

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.secure_get_alpha(size)

Source line 2730

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.secure_get_num(size)

Source line 2735

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
RandomString.secure_get_alphanum(size)

Source line 2740

ParameterPassing conventionDefault / required
sizepositional or keywordrequired
get_all_between(txt, start, end)

Source line 2779

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
startpositional or keywordrequired
endpositional or keywordrequired
get_between(txt, start, end)

Source line 2785

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
startpositional or keywordrequired
endpositional or keywordrequired
bytes_to_str(b)

Source line 2792

ParameterPassing conventionDefault / required
bpositional or keywordrequired
file_arg_to_str(arg)

Source line 2813

ParameterPassing conventionDefault / required
argpositional or keywordrequired
file_arg_to_buffer(arg, mode='wb', must_exist=True)

Source line 2847

ParameterPassing conventionDefault / required
argpositional or keywordrequired
modepositional or keyword'wb'
must_existpositional or keywordTrue
file_arg_to_file(arg, mode='r')

Source line 2864

ParameterPassing conventionDefault / required
argpositional or keywordrequired
modepositional or keyword'r'
file_arg_to_fp(arg)

Source line 2877

ParameterPassing conventionDefault / required
argpositional or keywordrequired
extract_int(s)

Source line 2885

ParameterPassing conventionDefault / required
spositional or keywordrequired
class merge_iters

Source line 2896

Construct: merge_iters(*args)

Declared functions, properties, and nested objects:

merge_iters.__init__(self, *args)

Source line 2898

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
merge_iters.__iter__(self)

Source line 2903

No caller-supplied parameters are declared.

merge_iters.__next__(self)

Source line 2907

No caller-supplied parameters are declared.

class CSVReader

Source line 2917

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class CSVReader.CharsAfterQuoted(Exception)

Source line 2918

Construct: CSVReader.CharsAfterQuoted(line_number, char_on_line, char, rows_found)

Declared functions, properties, and nested objects:

CSVReader.CharsAfterQuoted.__init__(self, line_number, char_on_line, char, rows_found)

Source line 2919

ParameterPassing conventionDefault / required
line_numberpositional or keywordrequired
char_on_linepositional or keywordrequired
charpositional or keywordrequired
rows_foundpositional or keywordrequired
class CSVReader.RowCountMismatch(Exception)

Source line 2922

Construct: CSVReader.RowCountMismatch(line_number, amt, expected)

Declared functions, properties, and nested objects:

CSVReader.RowCountMismatch.__init__(self, line_number, amt, expected)

Source line 2923

ParameterPassing conventionDefault / required
line_numberpositional or keywordrequired
amtpositional or keywordrequired
expectedpositional or keywordrequired
CSVReader.condense(fp, has_headers=True, unique_only=False, remove_func=None, remove_columns=[])

Source line 2926

ParameterPassing conventionDefault / required
fppositional or keywordrequired
has_headerspositional or keywordTrue
unique_onlypositional or keywordFalse
remove_funcpositional or keywordNone
remove_columnspositional or keyword[]
CSVReader.write(rows)

Source line 2974

ParameterPassing conventionDefault / required
rowspositional or keywordrequired
CSVReader.write_file(fp, rows)

Source line 2996

ParameterPassing conventionDefault / required
fppositional or keywordrequired
rowspositional or keywordrequired
CSVReader.read(arg, has_headers=True, as_list=False)

Source line 3002

ParameterPassing conventionDefault / required
argpositional or keywordrequired
has_headerspositional or keywordTrue
as_listpositional or keywordFalse
async CSVReader.basic_read_threaded(arg, amt_per_thread=20000, has_headers=True, as_list=False, max_workers=None)

Source line 3227

ParameterPassing conventionDefault / required
argpositional or keywordrequired
amt_per_threadpositional or keyword20000
has_headerspositional or keywordTrue
as_listpositional or keywordFalse
max_workerspositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

CSVReader.basic_read(arg, has_headers=True, as_list=False, forgiving=False, by_line=None)

Source line 3309

ParameterPassing conventionDefault / required
argpositional or keywordrequired
has_headerspositional or keywordTrue
as_listpositional or keywordFalse
forgivingpositional or keywordFalse
by_linepositional or keywordNone
CSVReader.no_quotes_read(arg, has_headers=True, as_list=False)

Source line 3410

ParameterPassing conventionDefault / required
argpositional or keywordrequired
has_headerspositional or keywordTrue
as_listpositional or keywordFalse
class ListTable

Source line 3475

Construct: ListTable(rows, has_headers=True, read_only=True)

Fields assigned by the constructor: has_headers, headers, read_only, rows. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ListTable.__init__(self, rows, has_headers=True, read_only=True)

Source line 3476

ParameterPassing conventionDefault / required
rowspositional or keywordrequired
has_headerspositional or keywordTrue
read_onlypositional or keywordTrue
ListTable.dict(self)

Source line 3505

No caller-supplied parameters are declared.

ListTable.__del__(self)

Source line 3512

No caller-supplied parameters are declared.

ListTable.__getitem__(self, key)

Source line 3520

ParameterPassing conventionDefault / required
keypositional or keywordrequired
ListTable.__len__(self)

Source line 3524

No caller-supplied parameters are declared.

ListTable.__iter__(self)

Source line 3526

No caller-supplied parameters are declared.

ListTable.__next__(self)

Source line 3529

No caller-supplied parameters are declared.

ListTable.__repr__(self)

Source line 3531

No caller-supplied parameters are declared.

class ListTable.Row

Source line 3533

Construct: ListTable.Row(row, table)

Fields assigned by the constructor: row, table. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ListTable.Row.__init__(self, row, table)

Source line 3534

ParameterPassing conventionDefault / required
rowpositional or keywordrequired
tablepositional or keywordrequired
ListTable.Row.dict(self)

Source line 3537

No caller-supplied parameters are declared.

ListTable.Row.__getitem__(self, key)

Source line 3544

ParameterPassing conventionDefault / required
keypositional or keywordrequired
ListTable.Row.__eq__(self, other)

Source line 3553

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
ListTable.Row.__len__(self)

Source line 3559

No caller-supplied parameters are declared.

ListTable.Row.__iter__(self)

Source line 3561

No caller-supplied parameters are declared.

ListTable.Row.__next__(self)

Source line 3564

No caller-supplied parameters are declared.

ListTable.Row.__repr__(self)

Source line 3566

No caller-supplied parameters are declared.

class AsyncLock

Source line 3572

Limit concurrent blocks globally and per hashable index.

Waiting requests are considered in arrival order; a blocked request does not
prevent a later request for available indexes from proceeding. Multi-index
requests never hold a partial reservation. Repeated indexes count once.
Like an asyncio.Lock, this lock is not reentrant.
Bare contexts take only a global slot; indexed contexts also take one
slot for each distinct hashable index. Use one lock per event loop.

    lock = AsyncLock(max_concurrent=2, max_concurrent_by_index=1)
    async with lock["a", "b"]:  # lock[["a", "b"]] also works
        await do_work()

Construct: AsyncLock(task_timeout=30, max_concurrent=1, max_concurrent_by_index=1, timeout_behavior=0)

Fields assigned by the constructor: max_concurrent, max_concurrent_by_index, task_timeout, timeout_behavior. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AsyncLock.__init__(self, task_timeout=30, max_concurrent=1, max_concurrent_by_index=1, timeout_behavior=0)

Source line 3587

Configure concurrency limits and behavior when a block times out.

task_timeout is measured in seconds after acquisition; None disables it.
timeout_behavior accepts a number or its string alias:
    0 ("raise", default): Cancel the block, then raise asyncio.TimeoutError
        after cleanup and release of its global and index slots.
    1 ("suppress"): Cancel the block, then continue after async with once
        cleanup finishes and slots are released, suppressing only the
        lock's timeout error.
    2 ("release"): Release slots at the deadline without cancelling the
        block. Later work may overlap it, even under the same indexes.

Cancellation in modes 0 and 1 is cooperative; blocking code or suppressed
cancellation can delay release. Queue wait does not count toward timeout.
ParameterPassing conventionDefault / required
task_timeoutpositional or keyword30
max_concurrentpositional or keyword1
max_concurrent_by_indexpositional or keyword1
timeout_behaviorpositional or keyword0
AsyncLock.timeout_behavior(self)

Source line 3624

Decorators: @property

Timeout mode: 0 raises, 1 suppresses, 2 releases without cancellation.

No caller-supplied parameters are declared.

AsyncLock.timeout_behavior(self, value)

Source line 3629

Decorators: @timeout_behavior.setter

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
AsyncLock.scope(self, *indexes, task_timeout=...)

Source line 3638

Create a shared-lock context with an optional per-block timeout.

async with lock.scope(task_timeout=1): ...
async with lock.scope("client-id", task_timeout=None): ...

Omission inherits the lock default at acquisition; None disables the
timeout for this block. Indexes share reservations with lock[index].
Queue waiting remains outside the timeout.
ParameterPassing conventionDefault / required
indexesextra positional arguments (*args)optional collection
task_timeoutkeyword only...
AsyncLock.__getitem__(self, indexes)

Source line 3655

ParameterPassing conventionDefault / required
indexespositional or keywordrequired
async AsyncLock.__aenter__(self)

Source line 3661

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async AsyncLock.__aexit__(self, exc_type, exc_value, traceback)

Source line 3667

ParameterPassing conventionDefault / required
exc_typepositional or keywordrequired
exc_valuepositional or keywordrequired
tracebackpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class AsyncProperty

Source line 3795

Construct: AsyncProperty(func)

Fields assigned by the constructor: coro, func. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AsyncProperty.__init__(self, func)

Source line 3796

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
AsyncProperty.__await__(self)

Source line 3800

No caller-supplied parameters are declared.

AsyncProperty.__get__(self, instance, owner)

Source line 3802

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
ownerpositional or keywordrequired
AsyncProperty.__set__(self, instance, value)

Source line 3805

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
valuepositional or keywordrequired
AsyncProperty.setter(self, func)

Source line 3807

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
class CachedProperty

Source line 3811

Construct: CachedProperty(func=None, expire=None)

Fields assigned by the constructor: func, is_coro, name, set_func. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

CachedProperty.__init__(self, func=None, expire=None)

Source line 3812

ParameterPassing conventionDefault / required
funcpositional or keywordNone
expirepositional or keywordNone
CachedProperty.setter(self, func)

Source line 3828

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
CachedProperty.expire(self)

Source line 3832

Decorators: @property

No caller-supplied parameters are declared.

CachedProperty.expire(self, expire)

Source line 3835

Decorators: @expire.setter

ParameterPassing conventionDefault / required
expirepositional or keywordrequired
CachedProperty.get_cached(self, instance)

Source line 3844

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
CachedProperty.is_cached(self, instance)

Source line 3848

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
CachedProperty.__get__(self, instance, owner)

Source line 3852

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
ownerpositional or keywordrequired
CachedProperty.__set__(self, instance, value)

Source line 3905

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
valuepositional or keywordrequired
CachedProperty.__call__(self, func)

Source line 3916

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
CachedProperty.__repr__(self)

Source line 3924

No caller-supplied parameters are declared.

class ClassProperty

Source line 3928

Construct: ClassProperty(func)

Fields assigned by the constructor: func, name, set_func. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ClassProperty.__init__(self, func)

Source line 3929

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
ClassProperty.__get__(self, instance, owner)

Source line 3933

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
ownerpositional or keywordrequired
ClassProperty.__set__(self, instance, value)

Source line 3935

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
valuepositional or keywordrequired
ClassProperty.__call__(self, func)

Source line 3937

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
ClassProperty.setter(self, func)

Source line 3943

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
class CachedClassProperty

Source line 3947

Construct: CachedClassProperty(func=None, expire=None)

Fields assigned by the constructor: func, is_coro, name. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

CachedClassProperty.__init__(self, func=None, expire=None)

Source line 3948

ParameterPassing conventionDefault / required
funcpositional or keywordNone
expirepositional or keywordNone
CachedClassProperty.expire(self)

Source line 3964

Decorators: @property

No caller-supplied parameters are declared.

CachedClassProperty.expire(self, expire)

Source line 3967

Decorators: @expire.setter

ParameterPassing conventionDefault / required
expirepositional or keywordrequired
CachedClassProperty.get_cached(self, instance)

Source line 3976

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
CachedClassProperty.__get__(self, instance, owner)

Source line 3979

ParameterPassing conventionDefault / required
instancepositional or keywordrequired
ownerpositional or keywordrequired
CachedClassProperty.__call__(self, func)

Source line 4012

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
CachedClassProperty.__repr__(self)

Source line 4020

No caller-supplied parameters are declared.

class StringInfo

Source line 4024

Construct: StringInfo(s)

Fields assigned by the constructor: alpha_count, char_array, digit_count, is_float, is_int, lower_count, most_common, most_common_count, str, upper_count, word_array, word_list. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

StringInfo.indexes(l, v)

Source line 4030

ParameterPassing conventionDefault / required
lpositional or keywordrequired
vpositional or keywordrequired
StringInfo.__getattr__(self, name)

Source line 4038

ParameterPassing conventionDefault / required
namepositional or keywordrequired
StringInfo.__init__(self, s)

Source line 4040

ParameterPassing conventionDefault / required
spositional or keywordrequired
StringInfo.__len__(self)

Source line 4096

No caller-supplied parameters are declared.

StringInfo.lower(self)

Source line 4098

No caller-supplied parameters are declared.

StringInfo.char_count(self, c)

Source line 4100

ParameterPassing conventionDefault / required
cpositional or keywordrequired
StringInfo.avg_word_len(self)

Source line 4104

No caller-supplied parameters are declared.

StringInfo.check(self, *args)

Source line 4112

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
StringInfo.check_alt(self, i)

Source line 4127

ParameterPassing conventionDefault / required
ipositional or keywordrequired
StringInfo.regex_links(self)

Source line 4140

No caller-supplied parameters are declared.

StringInfo.links(self)

Source line 4142

No caller-supplied parameters are declared.

class LinkInfo

Source line 4146

Construct: LinkInfo(url)

Fields assigned by the constructor: domain_name, fragment, hostname, path, port, qs, qs_raw, scheme, sld, subdomains, text_url, tld, url. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

LinkInfo.qs_parse(qs)

Source line 4148

ParameterPassing conventionDefault / required
qspositional or keywordrequired
LinkInfo.base_url(self)

Source line 4167

Decorators: @property

No caller-supplied parameters are declared.

LinkInfo.__init__(self, url)

Source line 4177

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
LinkInfo.hash(self)

Source line 4246

Decorators: @CachedProperty

No caller-supplied parameters are declared.

LinkInfo.__str__(self)

Source line 4254

No caller-supplied parameters are declared.

LinkInfo.__len__(self)

Source line 4256

No caller-supplied parameters are declared.

LinkInfo.__eq__(self, other)

Source line 4258

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
LinkInfo.__repr__(self)

Source line 4264

No caller-supplied parameters are declared.

LinkInfo.regex_find(string)

Source line 4267

ParameterPassing conventionDefault / required
stringpositional or keywordrequired
LinkInfo.find(string)

Source line 4274

ParameterPassing conventionDefault / required
stringpositional or keywordrequired
class ZF_REQ

Source line 4357

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class ZF_REQ._data

Source line 4358

Construct: ZF_REQ._data(b, r)

Fields assigned by the constructor: compress_sizes, content, encoding, ratio, request. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ZF_REQ._data.__init__(self, b, r)

Source line 4359

ParameterPassing conventionDefault / required
bpositional or keywordrequired
rpositional or keywordrequired
ZF_REQ._data.json(self)

Source line 4365

No caller-supplied parameters are declared.

ZF_REQ._data.text(self)

Source line 4368

Decorators: @property

No caller-supplied parameters are declared.

ZF_REQ._data.__getattr__(self, name)

Source line 4370

ParameterPassing conventionDefault / required
namepositional or keywordrequired
ZF_REQ._data.__repr__(self)

Source line 4372

No caller-supplied parameters are declared.

ZF_REQ.request(url, params=None, headers=None, timeout=600)

Source line 4377

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
paramspositional or keywordNone
headerspositional or keywordNone
timeoutpositional or keyword600
ZF_REQ.download(fp, url, *args, **kwargs)

Source line 4398

ParameterPassing conventionDefault / required
fppositional or keywordrequired
urlpositional or keywordrequired
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection
randomize_list(l)

Source line 4421

ParameterPassing conventionDefault / required
lpositional or keywordrequired
class IterLoop

Source line 4429

Construct: IterLoop(i)

Fields assigned by the constructor: l. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

IterLoop.__init__(self, i)

Source line 4430

ParameterPassing conventionDefault / required
ipositional or keywordrequired
IterLoop.next(self)

Source line 4435

No caller-supplied parameters are declared.

IterLoop.__contains__(self, item)

Source line 4437

ParameterPassing conventionDefault / required
itempositional or keywordrequired
IterLoop.__len__(self)

Source line 4439

No caller-supplied parameters are declared.

IterLoop.__iter__(self)

Source line 4441

No caller-supplied parameters are declared.

IterLoop.__next__(self)

Source line 4444

No caller-supplied parameters are declared.

class CountryInfo

Source line 4487

Construct: CountryInfo(key=None, compressed_requests=False)

Fields assigned by the constructor: compressed_requests, key. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

CountryInfo.__init__(self, key=None, compressed_requests=False)

Source line 4488

ParameterPassing conventionDefault / required
keypositional or keywordNone
compressed_requestspositional or keywordFalse
CountryInfo.request(self, url, **kwargs)

Source line 4491

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
kwargsextra keyword arguments (**kwargs)optional collection
CountryInfo.countries(self)

Source line 4511

Decorators: @CachedProperty

No caller-supplied parameters are declared.

class IpInfo

Source line 4523

Construct: IpInfo(ip=None, data=None)

Fields assigned by the constructor: asn, city, country, hostname, ip, location, org, postal, raw_org, region. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

IpInfo.ip_list(cls)

Source line 4534

Decorators: @ClassProperty

No caller-supplied parameters are declared.

IpInfo.get_ip(ip=None)

Source line 4698

ParameterPassing conventionDefault / required
ippositional or keywordNone
IpInfo.is_ipv4(ip)

Source line 4722

ParameterPassing conventionDefault / required
ippositional or keywordrequired
IpInfo.is_ipv6(ip)

Source line 4747

ParameterPassing conventionDefault / required
ippositional or keywordrequired
IpInfo.__repr__(self)

Source line 4757

No caller-supplied parameters are declared.

IpInfo.__init__(self, ip=None, data=None)

Source line 4759

ParameterPassing conventionDefault / required
ippositional or keywordNone
datapositional or keywordNone
IpInfo.dict(self)

Source line 4804

No caller-supplied parameters are declared.

IpInfo.__hash__(self)

Source line 4816

No caller-supplied parameters are declared.

IpInfo.fqdn(self)

Source line 4821

No caller-supplied parameters are declared.

IpInfo.__eq__(self, other)

Source line 4823

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
class AsyncIpInfo

Source line 4835

Construct: AsyncIpInfo(ip=None, data=None)

Fields assigned by the constructor: asn, city, country, hostname, ip, loaded, location, org, postal, raw_org, region, timestamp. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AsyncIpInfo.ip_list(cls)

Source line 4846

Decorators: @ClassProperty

No caller-supplied parameters are declared.

async AsyncIpInfo.get_ip(ip=None)

Source line 5071

ParameterPassing conventionDefault / required
ippositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

AsyncIpInfo.is_ipv4(ip)

Source line 5096

ParameterPassing conventionDefault / required
ippositional or keywordrequired
AsyncIpInfo.is_ipv6(ip)

Source line 5121

ParameterPassing conventionDefault / required
ippositional or keywordrequired
AsyncIpInfo.__repr__(self)

Source line 5131

No caller-supplied parameters are declared.

AsyncIpInfo.__init__(self, ip=None, data=None)

Source line 5133

ParameterPassing conventionDefault / required
ippositional or keywordNone
datapositional or keywordNone
AsyncIpInfo.__await__(self)

Source line 5192

No caller-supplied parameters are declared.

AsyncIpInfo.dict(self)

Source line 5194

No caller-supplied parameters are declared.

AsyncIpInfo.__hash__(self)

Source line 5207

No caller-supplied parameters are declared.

AsyncIpInfo.fqdn(self)

Source line 5212

No caller-supplied parameters are declared.

AsyncIpInfo.__eq__(self, other)

Source line 5214

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
quick_save(fp, data, *args, **kwargs)

Source line 5230

ParameterPassing conventionDefault / required
fppositional or keywordrequired
datapositional or keywordrequired
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection
obj_attr_print(obj, no_methods=True, no_class_attrs=False, show_type=False, ignore=[])

Source line 5241

ParameterPassing conventionDefault / required
objpositional or keywordrequired
no_methodspositional or keywordTrue
no_class_attrspositional or keywordFalse
show_typepositional or keywordFalse
ignorepositional or keyword[]
obj_attr_txt(obj, no_methods=True, no_class_attrs=False, show_type=False, ignore=[])

Source line 5257

ParameterPassing conventionDefault / required
objpositional or keywordrequired
no_methodspositional or keywordTrue
no_class_attrspositional or keywordFalse
show_typepositional or keywordFalse
ignorepositional or keyword[]
class BivariateData

Source line 5277

Construct: BivariateData(data)

Fields assigned by the constructor: data, data_points, x, x_info, y, y_info. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class BivariateData.DataPoint

Source line 5278

Construct: BivariateData.DataPoint(x, y, bd)

Fields assigned by the constructor: bd, x, y. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

BivariateData.DataPoint.__init__(self, x, y, bd)

Source line 5279

ParameterPassing conventionDefault / required
xpositional or keywordrequired
ypositional or keywordrequired
bdpositional or keywordrequired
BivariateData.DataPoint.residual(self)

Source line 5284

Decorators: @CachedProperty

No caller-supplied parameters are declared.

BivariateData.__init__(self, data)

Source line 5287

ParameterPassing conventionDefault / required
datapositional or keywordrequired
BivariateData.slope(self)

Source line 5300

Decorators: @CachedProperty

No caller-supplied parameters are declared.

BivariateData.correlation(self)

Source line 5305

Decorators: @CachedProperty

No caller-supplied parameters are declared.

BivariateData.plot(self, format='png', show_slope=True, show_residual_lines=False)

Source line 5345

ParameterPassing conventionDefault / required
formatpositional or keyword'png'
show_slopepositional or keywordTrue
show_residual_linespositional or keywordFalse
BivariateData.plot_residuals(self, format='png', show_line=True)

Source line 5351

ParameterPassing conventionDefault / required
formatpositional or keyword'png'
show_linepositional or keywordTrue
BivariateData.show(self, show_slope=True, show_residual_lines=False)

Source line 5357

ParameterPassing conventionDefault / required
show_slopepositional or keywordTrue
show_residual_linespositional or keywordFalse
BivariateData.show_residuals(self, show_line=True)

Source line 5360

ParameterPassing conventionDefault / required
show_linepositional or keywordTrue
class Slope

Source line 5364

Construct: Slope(slope, yint)

Fields assigned by the constructor: slope, yint. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Slope.__init__(self, slope, yint)

Source line 5365

ParameterPassing conventionDefault / required
slopepositional or keywordrequired
yintpositional or keywordrequired
Slope.__str__(self)

Source line 5368

No caller-supplied parameters are declared.

Slope.__call__(self, x=None, y=None)

Source line 5373

ParameterPassing conventionDefault / required
xpositional or keywordNone
ypositional or keywordNone
class CacheList

Source line 5380

Construct: CacheList(max_cache_size=100)

Fields assigned by the constructor: idx, max_cache_size, queue, stringify. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

CacheList.__init__(self, max_cache_size=100)

Source line 5381

ParameterPassing conventionDefault / required
max_cache_sizepositional or keyword100
CacheList.stringify_func(self, func)

Source line 5388

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
CacheList.append(self, item)

Source line 5393

ParameterPassing conventionDefault / required
itempositional or keywordrequired
CacheList.add(self, item)

Source line 5406

ParameterPassing conventionDefault / required
itempositional or keywordrequired
CacheList.remove(self, item)

Source line 5408

ParameterPassing conventionDefault / required
itempositional or keywordrequired
CacheList.pop(self, index=-1)

Source line 5413

ParameterPassing conventionDefault / required
indexpositional or keyword-1
CacheList.get(self, key, default=None)

Source line 5419

ParameterPassing conventionDefault / required
keypositional or keywordrequired
defaultpositional or keywordNone
CacheList.__len__(self)

Source line 5424

No caller-supplied parameters are declared.

CacheList.__getitem__(self, key)

Source line 5426

ParameterPassing conventionDefault / required
keypositional or keywordrequired
CacheList.__iter__(self)

Source line 5428

No caller-supplied parameters are declared.

CacheList.__contains__(self, value)

Source line 5430

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
class Unique

Source line 5435

Construct: Unique(max_items=None)

Fields assigned by the constructor: max_items, v. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Unique.__init__(self, max_items=None)

Source line 5436

ParameterPassing conventionDefault / required
max_itemspositional or keywordNone
Unique.append(self, item)

Source line 5441

ParameterPassing conventionDefault / required
itempositional or keywordrequired
Unique.remove(self, item)

Source line 5443

ParameterPassing conventionDefault / required
itempositional or keywordrequired
Unique.pop(self, index=-1)

Source line 5446

ParameterPassing conventionDefault / required
indexpositional or keyword-1
Unique.purge_func(self, func)

Source line 5449

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
Unique.__call__(self, v)

Source line 5454

ParameterPassing conventionDefault / required
vpositional or keywordrequired
Unique.__len__(self)

Source line 5463

No caller-supplied parameters are declared.

Unique.__getitem__(self, key)

Source line 5465

ParameterPassing conventionDefault / required
keypositional or keywordrequired
Unique.__iter__(self)

Source line 5467

No caller-supplied parameters are declared.

Unique.__contains__(self, value)

Source line 5469

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
class UniqueDict

Source line 5472

Construct: UniqueDict()

Fields assigned by the constructor: v. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

UniqueDict.__init__(self)

Source line 5473

No caller-supplied parameters are declared.

UniqueDict.__call__(self, v)

Source line 5475

ParameterPassing conventionDefault / required
vpositional or keywordrequired
UniqueDict.__getitem__(self, key)

Source line 5480

ParameterPassing conventionDefault / required
keypositional or keywordrequired
UniqueDict.__setitem__(self, key, value)

Source line 5482

ParameterPassing conventionDefault / required
keypositional or keywordrequired
valuepositional or keywordrequired
UniqueDict.__iter__(self)

Source line 5487

No caller-supplied parameters are declared.

UniqueDict.__next__(self)

Source line 5490

No caller-supplied parameters are declared.

UniqueDict.all(self)

Source line 5492

No caller-supplied parameters are declared.

count_dict(l, compare=None, estimate=False)

Source line 5497

ParameterPassing conventionDefault / required
lpositional or keywordrequired
comparepositional or keywordNone
estimatepositional or keywordFalse
class TimeEstimate

Source line 5523

Construct: TimeEstimate(amt=None, print_every=None, print_format='<done>/<t> (<p>) | ~<e> Remaining | <a>/trial', over_time_est=None)

Fields assigned by the constructor: amt, over_time_est, print_every, print_format, trial_count. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TimeEstimate.__init__(self, amt=None, print_every=None, print_format='<done>/<t> (<p>) | ~<e> Remaining | <a>/trial', over_time_est=None)

Source line 5524

ParameterPassing conventionDefault / required
amtpositional or keywordNone
print_everypositional or keywordNone
print_formatpositional or keyword'<done>/<t> (<p>) | ~<e> Remaining | <a>/trial'
over_time_estpositional or keywordNone
TimeEstimate.__iter__(self)

Source line 5532

No caller-supplied parameters are declared.

TimeEstimate.__next__(self)

Source line 5541

No caller-supplied parameters are declared.

TimeEstimate.format(self, format_str)

Source line 5566

ParameterPassing conventionDefault / required
format_strpositional or keywordrequired
TimeEstimate.remaining(self)

Source line 5590

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.percent_done(self)

Source line 5593

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.percent_done_str(self)

Source line 5596

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.estimate(self)

Source line 5599

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.estimate_str(self)

Source line 5602

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.duration(self)

Source line 5605

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.end_duration_estimate(self)

Source line 5611

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.duration_str(self)

Source line 5617

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.avg_duration(self)

Source line 5620

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.avg_duration_str(self)

Source line 5629

Decorators: @property

No caller-supplied parameters are declared.

TimeEstimate.print_results(self)

Source line 5631

No caller-supplied parameters are declared.

TimeEstimate.txt_results(self)

Source line 5635

No caller-supplied parameters are declared.

class ReverseListIter

Source line 5641

Construct: ReverseListIter(item)

Declared functions, properties, and nested objects:

ReverseListIter.__init__(self, item)

Source line 5642

ParameterPassing conventionDefault / required
itempositional or keywordrequired
ReverseListIter.__iter__(self)

Source line 5646

No caller-supplied parameters are declared.

ReverseListIter.__next__(self)

Source line 5649

No caller-supplied parameters are declared.

make_json_parsable(d)

Source line 5656

ParameterPassing conventionDefault / required
dpositional or keywordrequired
dict_print(d, indent=2, parse=True)

Source line 5692

ParameterPassing conventionDefault / required
dpositional or keywordrequired
indentpositional or keyword2
parsepositional or keywordTrue
class TxtParserExp

Source line 5704

Construct: TxtParserExp(format_txt, var_chars=['<', '>'], handle_not_found=False, possible_chars=['[', ']'])

Fields assigned by the constructor: format_txt, formats, handle_not_found, possible_chars, var_chars. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtParserExp.__init__(self, format_txt, var_chars=['<', '>'], handle_not_found=False, possible_chars=['[', ']'])

Source line 5705

ParameterPassing conventionDefault / required
format_txtpositional or keywordrequired
var_charspositional or keyword['<', '>']
handle_not_foundpositional or keywordFalse
possible_charspositional or keyword['[', ']']
TxtParserExp.__call__(self, txt, **kwargs)

Source line 5794

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
kwargsextra keyword arguments (**kwargs)optional collection
class TxtParser

Source line 5861

Construct: TxtParser(format_txt, var_chars=['<', '>'], handle_not_found=False, possible_chars=['[', ']'])

Fields assigned by the constructor: format_txt, formats, handle_not_found, possible_chars, regex_format, var_chars. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtParser.__init__(self, format_txt, var_chars=['<', '>'], handle_not_found=False, possible_chars=['[', ']'])

Source line 5867

ParameterPassing conventionDefault / required
format_txtpositional or keywordrequired
var_charspositional or keyword['<', '>']
handle_not_foundpositional or keywordFalse
possible_charspositional or keyword['[', ']']
TxtParser.__call__(self, txt, **kwargs)

Source line 5933

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
kwargsextra keyword arguments (**kwargs)optional collection
class TxtParserBasic

Source line 6024

Construct: TxtParserBasic(format_txt, var_chars=['<', '>'], handle_not_found=False)

Fields assigned by the constructor: format_txt, formats, handle_not_found, var_chars. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

TxtParserBasic.__init__(self, format_txt, var_chars=['<', '>'], handle_not_found=False)

Source line 6025

ParameterPassing conventionDefault / required
format_txtpositional or keywordrequired
var_charspositional or keyword['<', '>']
handle_not_foundpositional or keywordFalse
TxtParserBasic.__call__(self, txt, **kwargs)

Source line 6060

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
kwargsextra keyword arguments (**kwargs)optional collection
split_multi_old(txt, *items, amt=None, cap_sensitive=True)

Source line 6111

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
itemsextra positional arguments (*args)optional collection
amtkeyword onlyNone
cap_sensitivekeyword onlyTrue
split_old(txt, item, amt=None, cap_sensitive=True)

Source line 6168

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
itempositional or keywordrequired
amtpositional or keywordNone
cap_sensitivepositional or keywordTrue
split_multi(txt, *items, amt=None, cap_sensitive=True)

Source line 6199

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
itemsextra positional arguments (*args)optional collection
amtkeyword onlyNone
cap_sensitivekeyword onlyTrue
split(txt, item, amt=None, cap_sensitive=True)

Source line 6226

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
itempositional or keywordrequired
amtpositional or keywordNone
cap_sensitivepositional or keywordTrue
class AndroidDevice

Source line 6235

Construct: AndroidDevice(r)

Fields assigned by the constructor: device, marketing_name, model, retail_branding. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class AndroidDevice._DeviceIndex

Source line 6239

Construct: AndroidDevice._DeviceIndex(d, attr, f_idx=0)

Fields assigned by the constructor: attr, d, f_idx, index. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AndroidDevice._DeviceIndex.__init__(self, d, attr, f_idx=0)

Source line 6240

ParameterPassing conventionDefault / required
dpositional or keywordrequired
attrpositional or keywordrequired
f_idxpositional or keyword0
AndroidDevice._DeviceIndex.get(self, i)

Source line 6276

ParameterPassing conventionDefault / required
ipositional or keywordrequired
AndroidDevice.model_index(cls)

Source line 6295

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

AndroidDevice.opt_models(cls)

Source line 6299

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

AndroidDevice.devices(cls)

Source line 6310

Decorators: @ClassProperty

No caller-supplied parameters are declared.

AndroidDevice.data(cls)

Source line 6318

Decorators: @ClassProperty

No caller-supplied parameters are declared.

AndroidDevice.__init__(self, r)

Source line 6375

ParameterPassing conventionDefault / required
rpositional or keywordrequired
AndroidDevice.__str__(self)

Source line 6380

No caller-supplied parameters are declared.

AndroidDevice.__contains__(self, value)

Source line 6391

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
AndroidDevice.get_model(model)

Source line 6393

ParameterPassing conventionDefault / required
modelpositional or keywordrequired
AndroidDevice.__repr__(self)

Source line 6406

No caller-supplied parameters are declared.

class AgentFormat

Source line 6409

Construct: AgentFormat(parser, os, device=None, is_mobile=None, is_tablet=None)

Fields assigned by the constructor: device, is_mobile, is_tablet, os, parser. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

AgentFormat.__init__(self, parser, os, device=None, is_mobile=None, is_tablet=None)

Source line 6410

ParameterPassing conventionDefault / required
parserpositional or keywordrequired
ospositional or keywordrequired
devicepositional or keywordNone
is_mobilepositional or keywordNone
is_tabletpositional or keywordNone
AgentFormat.__call__(self, *args, **kwargs)

Source line 6416

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
kwargsextra keyword arguments (**kwargs)optional collection
AgentFormat.__str__(self)

Source line 6418

No caller-supplied parameters are declared.

class UserAgent

Source line 6420

Construct: UserAgent(txt)

Fields assigned by the constructor: device, extra_info, os, os_version, txt. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

UserAgent.from_request(cls, request)

Source line 6486

Decorators: @classmethod

ParameterPassing conventionDefault / required
requestpositional or keywordrequired
class UserAgent.Formats

Source line 6553

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class UserAgent.Formats._opt_iter

Source line 6554

Construct: UserAgent.Formats._opt_iter(opt, remove=[])

Fields assigned by the constructor: l, opt. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

UserAgent.Formats._opt_iter.__init__(self, opt, remove=[])

Source line 6555

ParameterPassing conventionDefault / required
optpositional or keywordrequired
removepositional or keyword[]
UserAgent.Formats._opt_iter.__iter__(self)

Source line 6568

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iter.__next__(self)

Source line 6571

No caller-supplied parameters are declared.

class UserAgent.Formats._opt_iters

Source line 6573

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

UserAgent.Formats._opt_iters.i1(cls)

Source line 6575

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i2(cls)

Source line 6580

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i3(cls)

Source line 6585

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i4(cls)

Source line 6590

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i5(cls)

Source line 6595

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i6(cls)

Source line 6600

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i7(cls)

Source line 6605

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i8(cls)

Source line 6610

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats._opt_iters.i9(cls)

Source line 6615

Decorators: @CachedClassProperty

No caller-supplied parameters are declared.

UserAgent.Formats.opt(text, base)

Source line 6644

ParameterPassing conventionDefault / required
textpositional or keywordrequired
basepositional or keywordrequired
class UserAgent.Version

Source line 6816

Construct: UserAgent.Version(v_str)

Fields assigned by the constructor: extra, major, minor, patch, raw, short. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

UserAgent.Version.__init__(self, v_str)

Source line 6817

ParameterPassing conventionDefault / required
v_strpositional or keywordrequired
UserAgent.Version.__lt__(self, other)

Source line 6858

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
UserAgent.Version.__gt__(self, other)

Source line 6872

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
UserAgent.Version.__eq__(self, other: object) -> bool

Source line 6874

ParameterPassing conventionDefault / required
other: objectpositional or keywordrequired

Return annotation: bool.

UserAgent.Version.__str__(self)

Source line 6879

No caller-supplied parameters are declared.

UserAgent.Version.__repr__(self)

Source line 6881

No caller-supplied parameters are declared.

UserAgent.__init__(self, txt)

Source line 6900

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
UserAgent.base(self)

Source line 6954

Decorators: @CachedProperty

No caller-supplied parameters are declared.

UserAgent.is_mobile(self)

Source line 6963

Decorators: @CachedProperty

No caller-supplied parameters are declared.

UserAgent.is_crawler(self)

Source line 6973

Decorators: @property

No caller-supplied parameters are declared.

UserAgent.browser_version(self)

Source line 6980

Decorators: @CachedProperty

No caller-supplied parameters are declared.

UserAgent.browser(self)

Source line 6986

Decorators: @CachedProperty

No caller-supplied parameters are declared.

UserAgent.is_google(self)

Source line 7097

Decorators: @CachedProperty

No caller-supplied parameters are declared.

UserAgent.is_bing(self)

Source line 7104

Decorators: @property

No caller-supplied parameters are declared.

UserAgent.is_bot(self)

Source line 7107

Decorators: @CachedProperty

No caller-supplied parameters are declared.

class Time

Source line 7169

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class Time._TimestampFormat

Source line 7170

Construct: Time._TimestampFormat(name, parser=None)

Fields assigned by the constructor: name, parser, to_datetime. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Time._TimestampFormat.__init__(self, name, parser=None)

Source line 7187

ParameterPassing conventionDefault / required
namepositional or keywordrequired
parserpositional or keywordNone
Time._TimestampFormat.datetime_convert(self, func)

Source line 7191

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
Time._TimestampFormat.parser_func(self, func)

Source line 7193

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
Time._TimestampFormat.__call__(self, timestamp_str)

Source line 7195

ParameterPassing conventionDefault / required
timestamp_strpositional or keywordrequired
class Time._Measure

Source line 7201

Construct: Time._Measure(name, short, char, seconds, *aliases)

Fields assigned by the constructor: aliases, char, name, seconds, short. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Time._Measure.__init__(self, name, short, char, seconds, *aliases)

Source line 7202

ParameterPassing conventionDefault / required
namepositional or keywordrequired
shortpositional or keywordrequired
charpositional or keywordrequired
secondspositional or keywordrequired
aliasesextra positional arguments (*args)optional collection
Time._Measure.__float__(self)

Source line 7208

No caller-supplied parameters are declared.

Time._Measure.__str__(self)

Source line 7210

No caller-supplied parameters are declared.

Time._Measure.__repr__(self)

Source line 7212

No caller-supplied parameters are declared.

Time._Measure.__contains__(self, other)

Source line 7214

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
Time.to_min(amt, dur_str)

Source line 7301

ParameterPassing conventionDefault / required
amtpositional or keywordrequired
dur_strpositional or keywordrequired
Time.parse_datetime(txt, day_first=None, tzinfo=None)

Source line 7336

Parse common timestamps, returning None for invalid input.

Numeric dates default to month-first unless the first field exceeds
12. True enforces day-first; False enforces month-first. Year-first
dates are unambiguous.
Missing date fields use today's UTC date; missing times use midnight.
tzinfo supplies the timezone for inputs without an explicit zone.
Explicit timezone offsets are preserved. Unix timestamps convert into
tzinfo, or local time when omitted; other inputs remain naive when
tzinfo is omitted.
Eight unsigned digits are reserved for YYYYMMDD calendar dates.
Two-part dotted numbers retain fractional Unix-second semantics.
ParameterPassing conventionDefault / required
txtpositional or keywordrequired
day_firstpositional or keywordNone
tzinfopositional or keywordNone
Time.parse_time(txt)

Source line 7480

Return duration seconds, or 0 for invalid input.

A leading sign applies to the entire duration. Weeks are seven days;
years are 365 days. Every numeric component must have a known unit.
ParameterPassing conventionDefault / required
txtpositional or keywordrequired
Time.date_formats(*args)

Source line 7522

Decorators: @CachedClassProperty

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
Time.parse_date(txt)

Source line 7545

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
is_class_instance(t)

Source line 7587

ParameterPassing conventionDefault / required
tpositional or keywordrequired
class WebRequestInfo

Source line 7594

Construct: WebRequestInfo(user_agent, ip)

Fields assigned by the constructor: ip_raw, ua, ua_raw. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

WebRequestInfo.__init__(self, user_agent, ip)

Source line 7595

ParameterPassing conventionDefault / required
user_agentpositional or keywordrequired
ippositional or keywordrequired
WebRequestInfo.ip(self)

Source line 7600

Decorators: @CachedProperty

No caller-supplied parameters are declared.

WebRequestInfo.is_google_confirm(self, two_way_confirm=True)

Source line 7602

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
WebRequestInfo.is_bing_confirm(self, two_way_confirm=True)

Source line 7605

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
WebRequestInfo.is_baidu_confirm(self, two_way_confirm=True)

Source line 7608

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
WebRequestInfo.is_yahoo_confirm(self, two_way_confirm=True)

Source line 7611

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
WebRequestInfo.is_yandex_confirm(self, two_way_confirm=True)

Source line 7614

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
WebRequestInfo.is_crawler_confirm(self, two_way_confirm=True)

Source line 7617

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
is_json_parsable(d)

Source line 7667

ParameterPassing conventionDefault / required
dpositional or keywordrequired
epoch(epoch_timestamp=None)

Source line 7713

ParameterPassing conventionDefault / required
epoch_timestamppositional or keywordNone
class ActionQueue

Source line 7720

Construct: ActionQueue(queue_file='queue.json', queue_file_type=None, loop_interval=60, remove_on_err=True)

Fields assigned by the constructor: actions, logger, loop_count, loop_interval, queue_db, queue_file, queue_file_type, remove_on_err, run_queue. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class ActionQueue.Item

Source line 7723

Construct: ActionQueue.Item(d, q)

Fields assigned by the constructor: action, activate, created, d, data, id, q. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ActionQueue.Item.__init__(self, d, q)

Source line 7724

ParameterPassing conventionDefault / required
dpositional or keywordrequired
qpositional or keywordrequired
async ActionQueue.Item.remove(self)

Source line 7732

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

ActionQueue.Item.hash(self)

Source line 7754

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ActionQueue.Item.__repr__(self)

Source line 7759

No caller-supplied parameters are declared.

ActionQueue.__init__(self, queue_file='queue.json', queue_file_type=None, loop_interval=60, remove_on_err=True)

Source line 7761

ParameterPassing conventionDefault / required
queue_filepositional or keyword'queue.json'
queue_file_typepositional or keywordNone
loop_intervalpositional or keyword60
remove_on_errpositional or keywordTrue
async ActionQueue.items(self)

Source line 7817

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class ActionQueue._check_iter

Source line 7874

Construct: ActionQueue._check_iter(i, q)

Fields assigned by the constructor: i, q. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ActionQueue._check_iter.__init__(self, i, q)

Source line 7875

ParameterPassing conventionDefault / required
ipositional or keywordrequired
qpositional or keywordrequired
ActionQueue._check_iter.hash(self)

Source line 7878

No caller-supplied parameters are declared.

ActionQueue._check_iter.__iter__(self)

Source line 7883

No caller-supplied parameters are declared.

ActionQueue._check_iter.__next__(self)

Source line 7888

No caller-supplied parameters are declared.

ActionQueue._check_iter.sort(self)

Source line 7908

No caller-supplied parameters are declared.

ActionQueue.start(self)

Source line 7949

No caller-supplied parameters are declared.

async ActionQueue.run(self)

Source line 7951

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

ActionQueue.to_thread(self)

Source line 7953

No caller-supplied parameters are declared.

ActionQueue.action(self, func)

Source line 7966

ParameterPassing conventionDefault / required
funcpositional or keywordrequired
async ActionQueue.create_action(self, action, data=None, activate=None)

Source line 7973

ParameterPassing conventionDefault / required
actionpositional or keywordrequired
datapositional or keywordNone
activatepositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class iCalendar

Source line 8070

Construct: iCalendar(name, uid, default_organizer_name=None, default_organizer_email=None)

Fields assigned by the constructor: default_organizer_email, default_organizer_name, events, name, uid, url. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

iCalendar.property_formatter(name, value, properties={})

Source line 8071

ParameterPassing conventionDefault / required
namepositional or keywordrequired
valuepositional or keywordrequired
propertiespositional or keyword{}
iCalendar.date_formatter(dt)

Source line 8078

ParameterPassing conventionDefault / required
dtpositional or keywordrequired
iCalendar.datetime_formatter(dt)

Source line 8091

ParameterPassing conventionDefault / required
dtpositional or keywordrequired
class iCalendar.Event

Source line 8118

Construct: iCalendar.Event(ical, name, uid, dt_start, dt_end=None, description=None, organizer_name=None, organizer_email=None, location=None)

Fields assigned by the constructor: description, dt_end, dt_start, ical, location, name, organizer_email, organizer_name, uid. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

iCalendar.Event.__init__(self, ical, name, uid, dt_start, dt_end=None, description=None, organizer_name=None, organizer_email=None, location=None)

Source line 8119

ParameterPassing conventionDefault / required
icalpositional or keywordrequired
namepositional or keywordrequired
uidpositional or keywordrequired
dt_startpositional or keywordrequired
dt_endpositional or keywordNone
descriptionpositional or keywordNone
organizer_namepositional or keywordNone
organizer_emailpositional or keywordNone
locationpositional or keywordNone
iCalendar.Event.generate(self)

Source line 8129

No caller-supplied parameters are declared.

iCalendar.__init__(self, name, uid, default_organizer_name=None, default_organizer_email=None)

Source line 8154

ParameterPassing conventionDefault / required
namepositional or keywordrequired
uidpositional or keywordrequired
default_organizer_namepositional or keywordNone
default_organizer_emailpositional or keywordNone
iCalendar.add_event(self, name, uid, dt_start, dt_end=None, description=None, organizer_name=None, organizer_email=None, location=None)

Source line 8161

ParameterPassing conventionDefault / required
namepositional or keywordrequired
uidpositional or keywordrequired
dt_startpositional or keywordrequired
dt_endpositional or keywordNone
descriptionpositional or keywordNone
organizer_namepositional or keywordNone
organizer_emailpositional or keywordNone
locationpositional or keywordNone
iCalendar.generate(self)

Source line 8180

No caller-supplied parameters are declared.

class vCard

Source line 8196

Construct: vCard(first_name, last_name, address=None, organization=None, title=None, url=None)

Fields assigned by the constructor: address, address_types, emails, first_name, full_name, last_name, organization, phones, title, url. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

vCard.property_formatter(name, value, properties={})

Source line 8197

ParameterPassing conventionDefault / required
namepositional or keywordrequired
valuepositional or keywordrequired
propertiespositional or keyword{}
vCard.date_formatter(dt)

Source line 8204

ParameterPassing conventionDefault / required
dtpositional or keywordrequired
vCard.datetime_formatter(dt)

Source line 8217

ParameterPassing conventionDefault / required
dtpositional or keywordrequired
vCard.__init__(self, first_name, last_name, address=None, organization=None, title=None, url=None)

Source line 8244

ParameterPassing conventionDefault / required
first_namepositional or keywordrequired
last_namepositional or keywordrequired
addresspositional or keywordNone
organizationpositional or keywordNone
titlepositional or keywordNone
urlpositional or keywordNone
vCard.add_phone(self, phone, phone_types=['HOME', 'VOICE'])

Source line 8255

ParameterPassing conventionDefault / required
phonepositional or keywordrequired
phone_typespositional or keyword['HOME', 'VOICE']
vCard.add_email(self, email, email_types=['INTERNET', 'WORK'])

Source line 8272

ParameterPassing conventionDefault / required
emailpositional or keywordrequired
email_typespositional or keyword['INTERNET', 'WORK']
vCard.set_organization(self, organization)

Source line 8286

ParameterPassing conventionDefault / required
organizationpositional or keywordrequired
vCard.set_address(self, address, address_types=['HOME'])

Source line 8293

ParameterPassing conventionDefault / required
addresspositional or keywordrequired
address_typespositional or keyword['HOME']
vCard.set_title(self, title)

Source line 8316

ParameterPassing conventionDefault / required
titlepositional or keywordrequired
vCard.set_url(self, url)

Source line 8323

ParameterPassing conventionDefault / required
urlpositional or keywordrequired
vCard.__str__(self)

Source line 8330

No caller-supplied parameters are declared.

vCard.generate(self)

Source line 8332

No caller-supplied parameters are declared.

class Address

Source line 9244

Represents an address with properties for address line 1, address line 2, city, state, and zip code.

Construct: Address(d, correct_address=True, parse_address=True)

Fields assigned by the constructor: address1, address2, city, parsed_address, state, zip. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Address.__init__(self, d, correct_address=True, parse_address=True)

Source line 9253

ParameterPassing conventionDefault / required
dpositional or keywordrequired
correct_addresspositional or keywordTrue
parse_addresspositional or keywordTrue
Address.__str__(self)

Source line 9409

No caller-supplied parameters are declared.

Address.to_dict(self)

Source line 9414

No caller-supplied parameters are declared.

Address.get_dict(self)

Source line 9422

No caller-supplied parameters are declared.

Address.parsed_address(self)

Source line 9426

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Address.compare_address(self)

Source line 9430

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Address.street(self)

Source line 9434

Decorators: @property

No caller-supplied parameters are declared.

Address.address(self)

Source line 9437

Decorators: @property

No caller-supplied parameters are declared.

Address.address2_int(self)

Source line 9440

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Address.street2(self)

Source line 9443

Decorators: @property

No caller-supplied parameters are declared.

Address.zip_code(self)

Source line 9446

Decorators: @property

No caller-supplied parameters are declared.

Address.postal_code(self)

Source line 9449

Decorators: @property

No caller-supplied parameters are declared.

Address.__repr__(self)

Source line 9452

No caller-supplied parameters are declared.

Address.__eq__(self, value: object) -> bool

Source line 9455

Check if the current Address object is equal to another object.

Args:
    value (object): The object to compare with.

Returns:
    bool: True if the objects are equal, False otherwise.
ParameterPassing conventionDefault / required
value: objectpositional or keywordrequired

Return annotation: bool.

Address.parse_address(txt)

Source line 9489

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
async run_code(code, **kwargs)

Source line 9657

ParameterPassing conventionDefault / required
codepositional or keywordrequired
kwargsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class CodeFormat

Source line 9711

Construct: CodeFormat()

Fields assigned by the constructor: con_lexer, formatter, lexer, trace_lexer. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

CodeFormat.__init__(self)

Source line 9712

No caller-supplied parameters are declared.

CodeFormat.styling(self)

Source line 9717

No caller-supplied parameters are declared.

CodeFormat.code_format(self, txt, linenos=False)

Source line 9722

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
linenospositional or keywordFalse
CodeFormat.console_format(self, txt, linenos=False)

Source line 9724

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
linenospositional or keywordFalse
CodeFormat.traceback_format(self, txt, linenos=False)

Source line 9726

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
linenospositional or keywordFalse
class StandardRequest

Source line 9790

Construct: StandardRequest(request)

Fields assigned by the constructor: cookies, headers, method, remote, request, url, user_agent. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

StandardRequest.__init__(self, request)

Source line 9791

ParameterPassing conventionDefault / required
requestpositional or keywordrequired
StandardRequest.path(self)

Source line 9876

Decorators: @CachedProperty

No caller-supplied parameters are declared.

StandardRequest.scheme(self)

Source line 9880

Decorators: @CachedProperty

No caller-supplied parameters are declared.

StandardRequest.query_string(self)

Source line 9884

Decorators: @CachedProperty

No caller-supplied parameters are declared.

StandardRequest.query(self)

Source line 9888

Decorators: @CachedProperty

No caller-supplied parameters are declared.

StandardRequest.args(self)

Source line 9892

Decorators: @property

No caller-supplied parameters are declared.

StandardRequest.ip(self)

Source line 9895

Decorators: @property

No caller-supplied parameters are declared.

async StandardRequest.ip_info(self)

Source line 9898

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

StandardRequest.body(self)

Source line 9902

Decorators: @CachedProperty

No caller-supplied parameters are declared.

async StandardRequest.load(self)

Source line 9909

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

StandardRequest.__await__(self)

Source line 9915

No caller-supplied parameters are declared.

class ListIndex

Source line 9919

Construct: ListIndex(d, key=str, f_idx=0, nested_indexes=None)

Fields assigned by the constructor: d, f_idx, index, key, nested_indexes. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ListIndex.__init__(self, d, key=str, f_idx=0, nested_indexes=None)

Source line 9920

ParameterPassing conventionDefault / required
dpositional or keywordrequired
keypositional or keywordstr
f_idxpositional or keyword0
nested_indexespositional or keywordNone
ListIndex.get(self, i, case_insensitive=False)

Source line 9963

ParameterPassing conventionDefault / required
ipositional or keywordrequired
case_insensitivepositional or keywordFalse
ListIndex.get_ci(self, i)

Source line 9984

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.get_list(self, i, case_insensitive=False)

Source line 10004

ParameterPassing conventionDefault / required
ipositional or keywordrequired
case_insensitivepositional or keywordFalse
ListIndex.get_ci_list(self, i)

Source line 10027

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.get_index(self, i, case_insensitive=False)

Source line 10049

ParameterPassing conventionDefault / required
ipositional or keywordrequired
case_insensitivepositional or keywordFalse
ListIndex.get_index_ci(self, i)

Source line 10070

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.add(self, i)

Source line 10160

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.append(self, i)

Source line 10179

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.count(self, i)

Source line 10181

ParameterPassing conventionDefault / required
ipositional or keywordrequired
ListIndex.__contains__(self, other)

Source line 10183

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
ListIndex.__iter__(self)

Source line 10185

No caller-supplied parameters are declared.

ListIndex.__getitem__(self, value)

Source line 10187

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
ListIndex.__len__(self)

Source line 10193

No caller-supplied parameters are declared.

class SortedList

Source line 10199

Construct: SortedList(d, key=str, reverse=False)

Fields assigned by the constructor: d, key, reverse. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

SortedList.__init__(self, d, key=str, reverse=False)

Source line 10200

ParameterPassing conventionDefault / required
dpositional or keywordrequired
keypositional or keywordstr
reversepositional or keywordFalse
SortedList.append(self, new)

Source line 10207

ParameterPassing conventionDefault / required
newpositional or keywordrequired
SortedList.add(self, new_value)

Source line 10209

ParameterPassing conventionDefault / required
new_valuepositional or keywordrequired
SortedList.__contains__(self, other)

Source line 10275

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
SortedList.__iter__(self)

Source line 10277

No caller-supplied parameters are declared.

SortedList.__getitem__(self, value)

Source line 10279

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
SortedList.__len__(self)

Source line 10281

No caller-supplied parameters are declared.

class AttrDict

Source line 10284

Construct: AttrDict(data={})

Declared functions, properties, and nested objects:

AttrDict.__init__(self, data={})

Source line 10285

ParameterPassing conventionDefault / required
datapositional or keyword{}
AttrDict.__getattr__(self, name)

Source line 10287

ParameterPassing conventionDefault / required
namepositional or keywordrequired
AttrDict.__setattr__(self, name, value)

Source line 10293

ParameterPassing conventionDefault / required
namepositional or keywordrequired
valuepositional or keywordrequired
AttrDict.__getitem__(self, key)

Source line 10296

ParameterPassing conventionDefault / required
keypositional or keywordrequired
AttrDict.__setitem__(self, key, value)

Source line 10299

ParameterPassing conventionDefault / required
keypositional or keywordrequired
valuepositional or keywordrequired
AttrDict.__delitem__(self, key)

Source line 10302

ParameterPassing conventionDefault / required
keypositional or keywordrequired
AttrDict.get(self, name, default=None)

Source line 10305

ParameterPassing conventionDefault / required
namepositional or keywordrequired
defaultpositional or keywordNone
count_print(v, max_lines=None)

Source line 10310

ParameterPassing conventionDefault / required
vpositional or keywordrequired
max_linespositional or keywordNone
class ServerAnalytics

Source line 10326

Construct: ServerAnalytics()

Fields assigned by the constructor: recent_requests. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ServerAnalytics.__init__(self)

Source line 10327

No caller-supplied parameters are declared.

class ReqInfo

Source line 10331

Construct: ReqInfo(*args)

Fields assigned by the constructor: ip, method, time, url, user_agent. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

ReqInfo.__init__(self, *args)

Source line 10332

ParameterPassing conventionDefault / required
argsextra positional arguments (*args)optional collection
ReqInfo.to_dict(self)

Source line 10349

No caller-supplied parameters are declared.

ReqInfo.get_id(self)

Source line 10357

No caller-supplied parameters are declared.

ReqInfo.link_info(self)

Source line 10367

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.path(self)

Source line 10370

Decorators: @property

No caller-supplied parameters are declared.

ReqInfo.ua_raw(self)

Source line 10373

Decorators: @property

No caller-supplied parameters are declared.

ReqInfo.user_agent_info(self)

Source line 10376

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.device(self)

Source line 10379

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.browser(self)

Source line 10383

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.os(self)

Source line 10386

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.is_mobile(self)

Source line 10389

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.browser(self)

Source line 10392

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.ip_info(self)

Source line 10396

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.country(self)

Source line 10404

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.region(self)

Source line 10407

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.city(self)

Source line 10410

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.asn(self)

Source line 10413

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.org(self)

Source line 10416

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.location(self)

Source line 10419

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.hostname(self)

Source line 10422

Decorators: @CachedProperty

No caller-supplied parameters are declared.

ReqInfo.is_google_confirm(self, two_way_confirm=True)

Source line 10426

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
ReqInfo.is_bing_confirm(self, two_way_confirm=True)

Source line 10429

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
ReqInfo.is_baidu_confirm(self, two_way_confirm=True)

Source line 10432

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
ReqInfo.is_yahoo_confirm(self, two_way_confirm=True)

Source line 10435

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
ReqInfo.is_yandex_confirm(self, two_way_confirm=True)

Source line 10438

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
ReqInfo.is_crawler_confirm(self, two_way_confirm=True)

Source line 10441

ParameterPassing conventionDefault / required
two_way_confirmpositional or keywordTrue
class Version

Source line 10498

Construct: Version(v_str)

Fields assigned by the constructor: extra, major, minor, patch, raw, short. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Version.__init__(self, v_str)

Source line 10499

ParameterPassing conventionDefault / required
v_strpositional or keywordrequired
Version.__lt__(self, other)

Source line 10535

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
Version.__gt__(self, other)

Source line 10551

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
Version.__le__(self, other)

Source line 10553

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
Version.__ge__(self, other)

Source line 10555

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
Version.__eq__(self, other: object) -> bool

Source line 10557

ParameterPassing conventionDefault / required
other: objectpositional or keywordrequired

Return annotation: bool.

Version.__str__(self)

Source line 10564

No caller-supplied parameters are declared.

Version.__repr__(self)

Source line 10566

No caller-supplied parameters are declared.

class Extra

Source line 10585

Construct: Extra(data, identifier, db, table_name, column_name='extra', identifier_column='id', as_dict=False)

Fields assigned by the constructor: as_dict. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Extra.__init__(self, data, identifier, db, table_name, column_name='extra', identifier_column='id', as_dict=False)

Source line 10588

ParameterPassing conventionDefault / required
datapositional or keywordrequired
identifierpositional or keywordrequired
dbpositional or keywordrequired
table_namepositional or keywordrequired
column_namepositional or keyword'extra'
identifier_columnpositional or keyword'id'
as_dictpositional or keywordFalse
Extra.encoded(self)

Source line 10621

Decorators: @property

No caller-supplied parameters are declared.

Extra.__getitem__(self, key)

Source line 10630

ParameterPassing conventionDefault / required
keypositional or keywordrequired
Extra.__setitem__(self, key, value)

Source line 10632

ParameterPassing conventionDefault / required
keypositional or keywordrequired
valuepositional or keywordrequired
Extra.__delitem__(self, key)

Source line 10634

ParameterPassing conventionDefault / required
keypositional or keywordrequired
Extra.__iter__(self)

Source line 10636

No caller-supplied parameters are declared.

Extra.__len__(self)

Source line 10638

No caller-supplied parameters are declared.

Extra.__str__(self)

Source line 10640

No caller-supplied parameters are declared.

Extra.__contains__(self, key)

Source line 10642

ParameterPassing conventionDefault / required
keypositional or keywordrequired
Extra.get(self, key, default=None)

Source line 10644

ParameterPassing conventionDefault / required
keypositional or keywordrequired
defaultpositional or keywordNone
Extra.set(self, key, value)

Source line 10646

ParameterPassing conventionDefault / required
keypositional or keywordrequired
valuepositional or keywordrequired
Extra.append(self, value)

Source line 10648

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
Extra.add(self, value)

Source line 10650

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
Extra.remove(self, value)

Source line 10652

ParameterPassing conventionDefault / required
valuepositional or keywordrequired
async Extra.save(self)

Source line 10654

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class PhoneNumber

Source line 10658

Construct: PhoneNumber(number)

Fields assigned by the constructor: area_code, country_code, number. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

PhoneNumber.__init__(self, number)

Source line 10659

ParameterPassing conventionDefault / required
numberpositional or keywordrequired
PhoneNumber.e164(self)

Source line 10673

Decorators: @property

No caller-supplied parameters are declared.

PhoneNumber.domestic_format(self)

Source line 10676

Decorators: @property

No caller-supplied parameters are declared.

PhoneNumber.international_format(self)

Source line 10679

Decorators: @property

No caller-supplied parameters are declared.

PhoneNumber.__str__(self)

Source line 10681

No caller-supplied parameters are declared.

PhoneNumber.__eq__(self, other)

Source line 10683

ParameterPassing conventionDefault / required
otherpositional or keywordrequired
PhoneNumber.__len__(self)

Source line 10700

No caller-supplied parameters are declared.

PhoneNumber.__getattr__(self, name)

Source line 10702

ParameterPassing conventionDefault / required
namepositional or keywordrequired
class Permission

Source line 10707

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

Permission.evaluate_permission(primary, evaluate)

Source line 10708

ParameterPassing conventionDefault / required
primarypositional or keywordrequired
evaluatepositional or keywordrequired
class plugins

Source line 10726

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class plugins.Mailgun

Source line 10727

Construct: plugins.Mailgun(api_key, domain, default_from=None, default_archive_to=None)

Fields assigned by the constructor: api_key, default_archive_to, default_from, domain. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Mailgun.__init__(self, api_key, domain, default_from=None, default_archive_to=None)

Source line 10728

ParameterPassing conventionDefault / required
api_keypositional or keywordrequired
domainpositional or keywordrequired
default_frompositional or keywordNone
default_archive_topositional or keywordNone
async plugins.Mailgun.send_email(self, subject, to, from_email=None, text=None, html=None, template=None, cc=None, bcc=None, reply_to=None, template_variables=None, archive_to=None)

Source line 10733

ParameterPassing conventionDefault / required
subjectpositional or keywordrequired
topositional or keywordrequired
from_emailpositional or keywordNone
textpositional or keywordNone
htmlpositional or keywordNone
templatepositional or keywordNone
ccpositional or keywordNone
bccpositional or keywordNone
reply_topositional or keywordNone
template_variablespositional or keywordNone
archive_topositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.Twilio

Source line 10780

Construct: plugins.Twilio(account_sid, auth_token, default_from=None)

Fields assigned by the constructor: account_sid, auth_token, default_from. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Twilio.__init__(self, account_sid, auth_token, default_from=None)

Source line 10781

ParameterPassing conventionDefault / required
account_sidpositional or keywordrequired
auth_tokenpositional or keywordrequired
default_frompositional or keywordNone
async plugins.Twilio.send_sms(self, to, from_phone=None, body=None, media_url=None)

Source line 10786

ParameterPassing conventionDefault / required
topositional or keywordrequired
from_phonepositional or keywordNone
bodypositional or keywordNone
media_urlpositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.Twilio.LookupNumber(PhoneNumber)

Source line 10819

A parsed Twilio Lookup response with PhoneNumber behavior.

Construct: plugins.Twilio.LookupNumber(phone_number, lookup_fields, raw_response)

Fields assigned by the constructor: caller_name, calling_country_code, identity_match, iso_country_code, line_status, line_type_intelligence, lookup_fields, national_format, payload, raw_response, requested_fields, url, valid, validation_errors. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class plugins.Twilio.LookupNumber.CallerName

Source line 10822

Construct: plugins.Twilio.LookupNumber.CallerName(data)

Fields assigned by the constructor: caller_name, caller_type, error_code, payload. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Twilio.LookupNumber.CallerName.__init__(self, data)

Source line 10823

ParameterPassing conventionDefault / required
datapositional or keywordrequired
class plugins.Twilio.LookupNumber.IdentityMatch

Source line 10829

Construct: plugins.Twilio.LookupNumber.IdentityMatch(data)

Fields assigned by the constructor: address_country_match, address_line_match, address_lines_match, city_match, date_of_birth_match, error_code, error_message, first_name_match, last_name_match, national_id_match, payload, postal_code_match, state_match, summary_score. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Twilio.LookupNumber.IdentityMatch.__init__(self, data)

Source line 10830

ParameterPassing conventionDefault / required
datapositional or keywordrequired
class plugins.Twilio.LookupNumber.LineStatus

Source line 10847

Construct: plugins.Twilio.LookupNumber.LineStatus(data)

Fields assigned by the constructor: error_code, payload, status. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Twilio.LookupNumber.LineStatus.__init__(self, data)

Source line 10848

ParameterPassing conventionDefault / required
datapositional or keywordrequired
plugins.Twilio.LookupNumber.LineStatus.is_line_active(self)

Source line 10854

Decorators: @property

True when active/reachable, False when inactive/unreachable, otherwise None.

No caller-supplied parameters are declared.

class plugins.Twilio.LookupNumber.LineTypeIntelligence

Source line 10863

Construct: plugins.Twilio.LookupNumber.LineTypeIntelligence(data)

Fields assigned by the constructor: carrier_name, error_code, mobile_country_code, mobile_network_code, payload, type. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.Twilio.LookupNumber.LineTypeIntelligence.__init__(self, data)

Source line 10864

ParameterPassing conventionDefault / required
datapositional or keywordrequired
plugins.Twilio.LookupNumber.__init__(self, phone_number, lookup_fields, raw_response)

Source line 10872

ParameterPassing conventionDefault / required
phone_numberpositional or keywordrequired
lookup_fieldspositional or keywordrequired
raw_responsepositional or keywordrequired
plugins.Twilio.LookupNumber.phone_number(self)

Source line 10909

Decorators: @property

No caller-supplied parameters are declared.

plugins.Twilio.LookupNumber.text(self)

Source line 10913

Decorators: @property

No caller-supplied parameters are declared.

plugins.Twilio.LookupNumber.json(self)

Source line 10916

No caller-supplied parameters are declared.

plugins.Twilio.LookupNumber.raise_for_status(self)

Source line 10921

No caller-supplied parameters are declared.

async plugins.Twilio.lookup(self, phone_number, lookup_fields, **params)

Source line 10934

Look up a phone number and return a LookupNumber. Fields listed below:
- caller_name = name of a caller if available ($.01)
- identity_match = match of a phone number to a person ($.10)
- line_status = line status of a phone number ($.007)
- line_type_intelligence = line type intelligence of a phone number ($.008)

Docs:    https://www.twilio.com/docs/lookup/v2-api
Pricing: https://www.twilio.com/en-us/user-authentication-identity/pricing/lookup
ParameterPassing conventionDefault / required
phone_numberpositional or keywordrequired
lookup_fieldspositional or keywordrequired
paramsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.Twilio.identity_match(self, phone_number, first_name=None, last_name=None, address=None, date_of_birth=None, lookup_fields='identity_match', **params)

Source line 10967

ParameterPassing conventionDefault / required
phone_numberpositional or keywordrequired
first_namepositional or keywordNone
last_namepositional or keywordNone
addresspositional or keywordNone
date_of_birthpositional or keywordNone
lookup_fieldspositional or keyword'identity_match'
paramsextra keyword arguments (**kwargs)optional collection

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.Twilio.line_status(self, phone)

Source line 11013

ParameterPassing conventionDefault / required
phonepositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.Twilio.is_line_active(self, phone)

Source line 11015

Returns True if the line is active, False if inactive, and None if unknown. 
ParameterPassing conventionDefault / required
phonepositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.UserManager

Source line 11022

Construct: plugins.UserManager(dbm, tbl_name='users', mfa_tbl=None, session_validator=None)

Fields assigned by the constructor: db, dbm, hash_func, mfa_tbl, session_validator, tbl_name. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.UserManager.__init__(self, dbm, tbl_name='users', mfa_tbl=None, session_validator=None) -> None

Source line 11028

ParameterPassing conventionDefault / required
dbmpositional or keywordrequired
tbl_namepositional or keyword'users'
mfa_tblpositional or keywordNone
session_validatorpositional or keywordNone

Return annotation: None.

async plugins.UserManager.mfa(self)

Source line 11105

Decorators: @AsyncProperty

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.users(self)

Source line 11114

Decorators: @CachedProperty

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.add_user(self, username, password)

Source line 11120

ParameterPassing conventionDefault / required
usernamepositional or keywordrequired
passwordpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.get_user(self, d)

Source line 11136

ParameterPassing conventionDefault / required
dpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.get_session(self, token)

Source line 11145

ParameterPassing conventionDefault / required
tokenpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.UserManager.User

Source line 11150

Construct: plugins.UserManager.User(data, um)

Fields assigned by the constructor: data, id, password, salt, sessions, username. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.UserManager.User.__init__(self, data, um)

Source line 11151

ParameterPassing conventionDefault / required
datapositional or keywordrequired
umpositional or keywordrequired
plugins.UserManager.User.check_password(self, password)

Source line 11162

ParameterPassing conventionDefault / required
passwordpositional or keywordrequired
async plugins.UserManager.User.update_password(self, password)

Source line 11164

ParameterPassing conventionDefault / required
passwordpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.User.get_session(self, token)

Source line 11173

ParameterPassing conventionDefault / required
tokenpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.User.save_sessions(self)

Source line 11177

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.User.add_session(self, req, extra=None)

Source line 11183

ParameterPassing conventionDefault / required
reqpositional or keywordrequired
extrapositional or keywordNone

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.User.set_username(self, username)

Source line 11200

ParameterPassing conventionDefault / required
usernamepositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.UserManager.UserSession

Source line 11203

Construct: plugins.UserManager.UserSession(base_data, u)

Fields assigned by the constructor: created, extra, ip, token, user, user_agent. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

class plugins.UserManager.UserSession.Validation

Source line 11236

Construct: plugins.UserManager.UserSession.Validation(max_duration=None, ip=None, check_user_agent=False, max_distance=None, function=None)

Fields assigned by the constructor: check_user_agent, function, ip, max_distance, max_duration. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.UserManager.UserSession.Validation.__init__(self, max_duration=None, ip=None, check_user_agent=False, max_distance=None, function=None)

Source line 11237

ParameterPassing conventionDefault / required
max_durationpositional or keywordNone
ippositional or keywordNone
check_user_agentpositional or keywordFalse
max_distancepositional or keywordNone
functionpositional or keywordNone
plugins.UserManager.UserSession.Validation.__call__(self, session, req)

Source line 11245

ParameterPassing conventionDefault / required
sessionpositional or keywordrequired
reqpositional or keywordrequired
plugins.UserManager.UserSession.__init__(self, base_data, u)

Source line 11283

ParameterPassing conventionDefault / required
base_datapositional or keywordrequired
upositional or keywordrequired
async plugins.UserManager.UserSession.delete(self)

Source line 11304

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

plugins.UserManager.UserSession.raw_data(self)

Source line 11308

Decorators: @property

No caller-supplied parameters are declared.

plugins.UserManager.UserSession.encoded(self)

Source line 11319

Decorators: @property

No caller-supplied parameters are declared.

async plugins.UserManager.UserSession.ip_info(self)

Source line 11322

Decorators: @CachedProperty(expire=20000)

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

async plugins.UserManager.UserSession.location(self)

Source line 11325

Decorators: @CachedProperty(expire=3600)

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

plugins.UserManager.UserSession.time_since_created(self)

Source line 11328

Decorators: @property

No caller-supplied parameters are declared.

async plugins.UserManager.UserSession.validate(self, req)

Source line 11330

ParameterPassing conventionDefault / required
reqpositional or keywordrequired

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

class plugins.UserManager.MFA

Source line 11332

Construct: plugins.UserManager.MFA(data, um)

Fields assigned by the constructor: created_at, data, id, type, user_id. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

plugins.UserManager.MFA.__init__(self, data, um)

Source line 11333

ParameterPassing conventionDefault / required
datapositional or keywordrequired
umpositional or keywordrequired
async plugins.UserManager.MFA.delete(self)

Source line 11340

No caller-supplied parameters are declared.

Declared with async def. Normal calls return an awaitable, or an async generator if the body yields. Decorated properties may be accessed differently; follow the object guide.

haversine(lat1, lon1, lat2, lon2, use_miles=False)

Source line 11346

ParameterPassing conventionDefault / required
lat1positional or keywordrequired
lon1positional or keywordrequired
lat2positional or keywordrequired
lon2positional or keywordrequired
use_milespositional or keywordFalse
word_to_digit(word)

Source line 11373

ParameterPassing conventionDefault / required
wordpositional or keywordrequired
name_to_normal(name)

Source line 11405

ParameterPassing conventionDefault / required
namepositional or keywordrequired
convert_to_normal(txt)

Source line 11799

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
convert_to_single_letters(txt)

Source line 11908

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
equivilency_convert(txt)

Source line 11924

ParameterPassing conventionDefault / required
txtpositional or keywordrequired
class Matching

Source line 11954

Configurable string matching with numbered algorithm selections.

Settings.matching_method:
    0 = Legacy positional matching (default; ignores trailing characters
        for fuzzy comparisons and retains the original exact-match behavior).
    1 = Positional mismatches, including unmatched trailing characters.
    2 = Levenshtein: insertions, deletions, and substitutions.
    3 = Optimal String Alignment (OSA): also permits adjacent swaps,
        with restrictions on overlapping edits.
    4 = Full Damerau-Levenshtein: permits overlapping edits and adjacent swaps.
    5 = Jaro-Winkler: character similarity with a shared-prefix bonus.

Settings.within_method:
    0 = Legacy substring matching (default; uses the original algorithm
        regardless of matching_method).
    1 = Query-length character windows, scored with matching_method.
    2 = Consecutive word windows with the query's word count, scored with
        matching_method. Word boundaries are retained before scoring even
        when ignore_spaces=True. Extra middle names are not ignored.

DEFAULT_MATCHING_METHOD and DEFAULT_WITHIN_METHOD initially equal 0.
Settings resolves omitted method arguments from these class attributes at
creation time; existing settings retain their selections. Passing 0 explicitly
always selects legacy behavior. Calls without settings create a fresh default
configuration, retaining the other defaults from Matching.default_settings.

Methods.select returns similarity from 0.0 to 1.0 (1.0 means identical),
suitable for comparison with Settings.fuzzy_threshold. Methods 1 through 4
use 1 - differences / max(lengths); method 5 uses Jaro-Winkler similarity.
RapidFuzz accelerates methods 2 through 5 when RAPIDFUZZ_IMPORTED is True;
otherwise the pure-Python implementations are used. The underlying *_local
methods return distances instead of similarity and do not normalize inputs.

Example:
    settings = Matching.Settings(
        matching_method=3, within_method=2, fuzzy_threshold=.8
    )
    Matching.within("Maria", "Member Maira Active", settings)  # True

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

class Matching.Methods

Source line 11998

No constructor is declared here. Some utility classes group functions for direct class access; use the call style shown in the guide.

Declared functions, properties, and nested objects:

Matching.Methods.select(cls, str1, str2, matching_method=0)

Source line 12000

Decorators: @classmethod

Return similarity from 0 to 1 (1 means identical).

Methods: 0 legacy positional, 1 positional including trailing text,
2 Levenshtein, 3 OSA, 4 unrestricted DL, 5 Jaro-Winkler.
Method 0 lowercases and ignores trailing characters. Other methods
are case-sensitive; callers apply normalization before selection.
Empty pairs score 1; one empty string scores 0 for every method.
ParameterPassing conventionDefault / required
str1positional or keywordrequired
str2positional or keywordrequired
matching_methodpositional or keyword0
Matching.Methods.select_within(cls, str1, str2, matching_method=0, within_method=0, ignore_spaces=False, match_asterisk=False)

Source line 12047

Decorators: @classmethod

Return the best window similarity, or None if no window fits.

0 uses legacy fixed character windows and positional scoring,
1 uses fixed character windows and matching_method,
2 uses equal-word-count token windows and matching_method.
Tokenization happens before optional space removal for scoring.
Wildcards mask characters at the same position within each window.
ParameterPassing conventionDefault / required
str1positional or keywordrequired
str2positional or keywordrequired
matching_methodpositional or keyword0
within_methodpositional or keyword0
ignore_spacespositional or keywordFalse
match_asteriskpositional or keywordFalse
Matching.Methods.fuzzy_local(txt1, txt2)

Source line 12101

Decorators: @staticmethod

Return case-sensitive positional differences, including extra characters.

Uses the original fuzzy_match positional comparison without normalization
or a threshold. Returns an integer distance, like the other methods.
ParameterPassing conventionDefault / required
txt1positional or keywordrequired
txt2positional or keywordrequired
Matching.Methods.levenshtein_local(s1, s2)

Source line 12116

ParameterPassing conventionDefault / required
s1positional or keywordrequired
s2positional or keywordrequired
Matching.Methods.osa_local(s1, s2)

Source line 12163

Decorators: @staticmethod

Return case-sensitive Optimal String Alignment edit distance.

Adapted from RapidFuzz 3.13.0, _osa_distance_hyrroe2003:
https://github.com/rapidfuzz/RapidFuzz/blob/v3.13.0/src/rapidfuzz/distance/OSA_py.py
Returns an integer distance; performs no normalization.
ParameterPassing conventionDefault / required
s1positional or keywordrequired
s2positional or keywordrequired
Matching.Methods.damerau_levenshtein_local(s1, s2)

Source line 12212

Decorators: @staticmethod

Return case-sensitive unrestricted Damerau-Levenshtein edit distance.

Adapted from RapidFuzz 3.13.0, _damerau_levenshtein_distance_zhao:
https://github.com/rapidfuzz/RapidFuzz/blob/v3.13.0/src/rapidfuzz/distance/DamerauLevenshtein_py.py
Returns an integer distance; performs no normalization.
ParameterPassing conventionDefault / required
s1positional or keywordrequired
s2positional or keywordrequired
Matching.Methods.jaro_winkler_local(s1, s2, prefix_weight=0.1)

Source line 12264

Decorators: @staticmethod

Return case-sensitive Jaro-Winkler distance in the range 0.0 to 1.0.

Zero means identical. This is a fractional distance, not an edit count.
No normalization or acceptance threshold is applied. prefix_weight must
be between 0 and 0.25; up to four shared prefix characters are rewarded
when Jaro similarity exceeds 0.7.

Adapted from RapidFuzz 3.13.0, Jaro and JaroWinkler similarity:
https://github.com/rapidfuzz/RapidFuzz/blob/v3.13.0/src/rapidfuzz/distance/Jaro_py.py
https://github.com/rapidfuzz/RapidFuzz/blob/v3.13.0/src/rapidfuzz/distance/JaroWinkler_py.py
ParameterPassing conventionDefault / required
s1positional or keywordrequired
s2positional or keywordrequired
prefix_weightpositional or keyword0.1
Matching.Methods.fuzzy_local_within(query, text)

Source line 12338

Decorators: @staticmethod

Return minimum positional differences over query-length windows.

Uses the existing fuzzy_within window selection with raw difference
counts instead of a threshold. Case-sensitive; no normalization.
An empty query returns 0. Returns None if the query exceeds text length.
ParameterPassing conventionDefault / required
querypositional or keywordrequired
textpositional or keywordrequired
Matching.Methods.token_window_within(query, text, distance_method=None, extra_words=0)

Source line 12364

Decorators: @staticmethod

Return the closest consecutive word window and its difference count.

Defaults to OSA with the query's word count. extra_words expands the
window sizes in both directions; it must be a nonnegative integer.
Splits on whitespace and rejoins with single spaces. Other casing,
accent, and punctuation normalization is the caller's responsibility.
Returns None for empty inputs or when no window fits. Ties favor the
smaller window, then the earliest position. end_word is exclusive.
ParameterPassing conventionDefault / required
querypositional or keywordrequired
textpositional or keywordrequired
distance_methodpositional or keywordNone
extra_wordspositional or keyword0
class Matching.Settings

Source line 12412

normalize: convert to normalized form (ex. "héllô" -> "hello")
extraneous_characters: convert to single letters (ex. "hello" -> "helo")
ignore_spaces: ignore spaces (ex. "he llo" == "hello")
match_asterisk: match '*' as a wildcard (ex. "h*llo" == "hello")
fuzzy_threshold: how close (in % of characters) the strings must be to be considered a match (ex. "12345" == "12344" with threshold .8)
phonetic: convert text to a phonetic form (ex. "Derrick" == "Derrik")
matching_method: 0 legacy, 1 positional, 2 Levenshtein, 3 OSA,
    4 Damerau-Levenshtein, 5 Jaro-Winkler
within_method: 0 legacy, 1 character windows, 2 token windows
None resolves the corresponding class default when settings are created.

Construct: Matching.Settings(normalize=True, extraneous_characters=False, ignore_spaces=False, match_asterisk=False, fuzzy_threshold=1, phonetic=False, matching_method=None, within_method=None)

Fields assigned by the constructor: extraneous_characters, fuzzy_threshold, ignore_spaces, match_asterisk, matching_method, normalize, phonetic, within_method. Some assignments may be conditional; see the object guide for meaning and lifecycle.

Declared functions, properties, and nested objects:

Matching.Settings.__init__(self, normalize=True, extraneous_characters=False, ignore_spaces=False, match_asterisk=False, fuzzy_threshold=1, phonetic=False, matching_method=None, within_method=None)

Source line 12423

ParameterPassing conventionDefault / required
normalizepositional or keywordTrue
extraneous_characterspositional or keywordFalse
ignore_spacespositional or keywordFalse
match_asteriskpositional or keywordFalse
fuzzy_thresholdpositional or keyword1
phoneticpositional or keywordFalse
matching_methodpositional or keywordNone
within_methodpositional or keywordNone
Matching.fuzzy_match(txt1, txt2, threshold=0.8, matching_method=None)

Source line 12485

Compare case-insensitive selector similarity against threshold.

Omitted matching_method uses DEFAULT_MATCHING_METHOD. Method 0 retains
the original empty-input ZeroDivisionError for backwards compatibility.
ParameterPassing conventionDefault / required
txt1positional or keywordrequired
txt2positional or keywordrequired
thresholdpositional or keyword0.8
matching_methodpositional or keywordNone
Matching.fuzzy_within(txt1, txt2, threshold=0.8, matching_method=None, within_method=None)

Source line 12498

Compare the best selector window similarity against threshold.

Omitted methods use the corresponding class defaults. Nonlegacy windows
are case-insensitive. Method 0 retains original character-window behavior,
including the empty-query ZeroDivisionError.
ParameterPassing conventionDefault / required
txt1positional or keywordrequired
txt2positional or keywordrequired
thresholdpositional or keyword0.8
matching_methodpositional or keywordNone
within_methodpositional or keywordNone
Matching.match(txt1, txt2, settings=None)

Source line 12520

ParameterPassing conventionDefault / required
txt1positional or keywordrequired
txt2positional or keywordrequired
settingspositional or keywordNone
Matching.within(txt1, txt2, settings=None)

Source line 12562

Check if txt1 is within txt2 based on settings
ParameterPassing conventionDefault / required
txt1positional or keywordrequired
txt2positional or keywordrequired
settingspositional or keywordNone