utils
pleat.utils ¶
Miscellaneous utility functions and timing helpers.
VerboseTimer ¶
Bases: IdObject
Logger-backed stopwatch that prints intervals between :meth:round calls.
Source code in pleat/utils.py
round ¶
Record an interval since the last :meth:round (or :meth:__init__) call.
Source code in pleat/utils.py
invert_mapping ¶
Return {value: key for key, value in mapping.items()}.
The input is assumed to be injective; otherwise some keys are dropped.
random_directed_set ¶
Pick exactly one half-edge from each undirected pair.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
HalfEdgeGraph | Iterable[HalfEdge]
|
An iterable of :class: |
required |
Returns:
| Type | Description |
|---|---|
set[HalfEdge]
|
A set containing one half-edge per |
set[HalfEdge]
|
order of the input determines which side of each pair is kept; the |
set[HalfEdge]
|
result is therefore deterministic only for ordered inputs. |
Source code in pleat/utils.py
print_attribute_info ¶
Log per-attribute counts for a collection of :class:AttributeObject s.
For each attribute name found on any object in objs, logs the number of
objects carrying it and the number of distinct hashable values seen. When
given a :class:HalfEdgeGraph, recurses into its vertices, half-edges and
faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
objs
|
HalfEdgeGraph | Iterable[AttributeObject]
|
A :class: |
required |