Module Utilities¶
pcapkit.utilities holds the cross-cutting services pcapkit is
built with, and imports nothing from pcapkit outside itself (see
Choosing Between utilities and corekit):
user-refined exceptions and warnings, and logging;
the tunable limits of
config;a compatibility layer, timestamp conversion and pickle reductions;
the
context variablesits modules share,lazy importsfor a package’s exports, and anabstract-class checkthat reads no interpreter flag;wrappers around third-party libraries.
- User Defined Exceptions
- Loud and Quiet Errors
TypeErrorCategoryAttributeErrorCategoryIOErrorCategoryFileExistsErrorCategoryFileNotFoundErrorCategoryIndexErrorCategoryValueErrorCategoryNotImplementedErrorCategorystruct.errorCategoryEOFErrorCategoryKeyErrorCategoryModuleNotFoundErrorCategoryio.UnsupportedOperationCategory- Error Handling Utilities
- User Defined Warnings
- Logging System
- Configuration
- Character Set Detection
- Timestamp Conversion
- Pickle Reductions
- Shared Context Variables
- Lazy Imports
- Abstract Classes
Version Compatibility¶
pcapkit.utilities.compat covers these objects on interpreters older than
the version listed:
Compatibility Target |
Minimal Required Version |
|---|---|
Python 3.9 |
|
Python 3.9 |
|
Python 3.9 |
|
Python 3.9 |
|
Python 3.9 |
|
Python 3.11 |
|
Python 3.11 |
|
Python 3.11 |
|
Python 3.11 |
|
Python 3.10 |
|
|
Python 3.10 |
|
Python 3.10 |
|
Python 3.10 |
It also exports pathlib, ModuleNotFoundError,
collections.abc.Collection and functools.cached_property()
straight from the standard library, since 1.5.0 requires Python 3.8 or later
(#2051).
- pcapkit.utilities.compat.final(f)[source]¶
typing.final()from Python 3.11 on, andtyping_extensions.finalbelow it. Both record__final__ = Trueon the decorated object at runtime, whichInfoandSchemaread to refuse a class marked@finalwithoutinfo_final()orschema_final(). Plaintyping.final()records nothing below 3.11 (gh-90500).Changed in version 1.5.0: Taken from
typing_extensionsbelow Python 3.11 rather than 3.8, so that__final__is recorded on every supported version (#778).
- pcapkit.utilities.compat.unquote(string, encoding='utf-8', errors='replace')[source]¶
urllib.parse.unquote(), which acceptsbytesfrom Python 3.9 on. Below 3.9, abytesstringis unquoted to octets withurllib.parse.unquote_to_bytes()and then decoded withencodinganderrors.
- pcapkit.utilities.compat.default_threading_excepthook¶
The interpreter’s own default thread exception hook, even when
threading.excepthook()has been replaced:threading.__excepthook__from Python 3.10 on, and_thread._excepthookon 3.8 and 3.9.
- class pcapkit.utilities.compat.cached_property(func)[source]¶
functools.cached_property()itself.Changed in version 1.5.0: No longer a backport below Python 3.8, which 1.5.0 does not install on (#2051).