Name Description Size
__init__.py Read resources contained within a package. 506
_adapters.py Adapt a package spec to adapt the underlying loader. 4482
_common.py Replace 'package' parameter as 'anchor' and warn about the change. Other errors should fall through. >>> files('a', 'b') Traceback (most recent call last): TypeError: files() takes from 0 to 1 positional arguments but 2 were given 5457
_compat.py Adapt loaders to provide TraversableResources and other compatibility. Used primarily for Python 3.9 and earlier where the native loaders do not yet implement TraversableResources. 2935
_itertools.py If *iterable* has only one item, return it. If it has zero items, return *default*. If it has more than one item, raise the exception given by *too_long*, which is ``ValueError`` by default. >>> only([], default='missing') 'missing' >>> only([1]) 1 >>> only([1, 2]) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... ValueError: Expected exactly one item in iterable, but got 1, 2, and perhaps more.' >>> only([1, 2], too_long=TypeError) # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... TypeError Note that :func:`only` attempts to advance *iterable* twice to ensure there is only one item. See :func:`spy` or :func:`peekable` to check iterable contents less destructively. 1277
_legacy.py Normalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. 3481
abc.py Abstract base class for loaders to provide resource reading support. 5140
py.typed 0
readers.py Return the file system path to prevent `resources.path()` from creating a temporary copy. 4312
simple.py Interface adapters for low-level readers. 2576