__init__.py |
Read resources contained within a package.
This codebase is shared between importlib.resources in the stdlib
and importlib_resources in PyPI. See
https://github.com/python/importlib_metadata/wiki/Development-Methodology
for more detail.
|
703 |
_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
Remove this compatibility in Python 3.14.
|
5624 |
_functional.py |
Simplified function-based API for importlib.resources |
2651 |
_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 |
abc.py |
Abstract base class for loaders to provide resource reading support. |
5162 |
compat |
|
|
future |
|
|
py.typed |
|
0 |
readers.py |
Return the file system path to prevent
`resources.path()` from creating a temporary
copy.
|
6251 |
simple.py |
Interface adapters for low-level readers.
|
2590 |