dolor.util.misc¶
Miscellaneous utilities.
- get_subclasses(*args)[source]¶
Gets the subclasses of the parameters.
- Parameters
*args (
type) – The types to get the subclasses of.- Returns
The subclasses of
*args.- Return type
set
- default(value, default)[source]¶
Defaults a variable.
- Parameters
value – The value to potentially default.
default – The default value.
- Returns
If
valueisNone, thendefaultis returned, elsevalueis returned.- Return type
any
- arg_annotations(func, *args, **kwargs)[source]¶
Maps function arguments to their annotations.
- Parameters
func (
function) – The function to take annotations from.*args – The arguments to map annotations to.
**kwargs – The arguments to map annotations to.
- Returns
args_annotations (
list) – The annotations for*args, of the form[(value, annotation)].kwargs_annotations (
dict) – The annotations for*args, of the form{name: (value, annotation)}.
- class ZlibDecompressFile(f, *args, **kwargs)[source]¶
Bases:
io.IOBaseA simple read-only file object for decompressing zlib data.
- Parameters
f – The file object to wrap.
*args – Forwarded to
zlib.decompressobj().**kwargs – Forwarded to
zlib.decompressobj().