Skip to content

Commit 9afeb05

Browse files
committed
Merge branch 'main' into feature/228-directory-of-resources
2 parents 92666d2 + b8da844 commit 9afeb05

File tree

11 files changed

+47
-14
lines changed

11 files changed

+47
-14
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tidelift: pypi/importlib-resources

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 22.1.0
3+
rev: 22.6.0
44
hooks:
55
- id: black

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ v5.9.0
55
representing a directory and (when needed) renders the
66
full tree to a temporary directory.
77

8+
v5.8.1
9+
======
10+
11+
* #253: In ``MultiplexedPath``, restore expectation that
12+
a compound path with a non-existent directory does not
13+
raise an exception.
14+
815
v5.8.0
916
======
1017

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
.. image:: https://img.shields.io/badge/skeleton-2022-informational
2121
:target: https://blog.jaraco.com/skeleton
2222

23+
.. image:: https://tidelift.com/badges/package/pypi/importlib-resources
24+
:target: https://tidelift.com/subscription/pkg/pypi-importlib-resources?utm_source=pypi-importlib-resources&utm_medium=readme
25+
2326
``importlib_resources`` is a backport of Python standard library
2427
`importlib.resources
2528
<https://docs.python.org/3/library/importlib.html#module-importlib.resources>`_
@@ -53,3 +56,19 @@ were contributed to different versions in the standard library:
5356
- 3.9
5457
* - 0.5 (?)
5558
- 3.7
59+
60+
For Enterprise
61+
==============
62+
63+
Available as part of the Tidelift Subscription.
64+
65+
This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
66+
67+
`Learn more <https://tidelift.com/subscription/pkg/pypi-importlib-resources?utm_source=pypi-importlib-resources&utm_medium=referral&utm_campaign=github>`_.
68+
69+
Security Contact
70+
================
71+
72+
To report a security vulnerability, please use the
73+
`Tidelift security contact <https://tidelift.com/security>`_.
74+
Tidelift will coordinate the fix and disclosure.

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@
3838
intersphinx_mapping = {
3939
'python': ('https://docs.python.org/3', None),
4040
}
41+
42+
extensions += ['jaraco.tidelift']

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ The documentation here includes a general :ref:`usage <using>` guide and a
3131
migration.rst
3232
history.rst
3333

34+
.. tidelift-referral-banner::
35+
3436

3537
Indices and tables
3638
==================

docs/migration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ a package is a directory or not::
148148

149149
The ``importlib_resources`` equivalent is straightforward::
150150

151-
if importlib_resources.files('my.package').joinpath('resource').isdir():
151+
if importlib_resources.files('my.package').joinpath('resource').is_dir():
152152
print('A directory')
153153

154154

importlib_resources/readers.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,10 @@ def is_file(self):
8585
def joinpath(self, *descendants):
8686
try:
8787
return super().joinpath(*descendants)
88-
except abc.TraversalError as exc:
89-
# One of the paths didn't resolve.
90-
msg, target, names = exc.args
91-
if names: # pragma: nocover
92-
raise
93-
# It was the last; construct result with the first path.
94-
return self._paths[0].joinpath(target)
88+
except abc.TraversalError:
89+
# One of the paths did not resolve (a directory does not exist).
90+
# Just return something that will not exist.
91+
return self._paths[0].joinpath(*descendants)
9592

9693
def open(self, *args, **kwargs):
9794
raise FileNotFoundError(f'{self} is not a file')

importlib_resources/tests/test_reader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def test_join_path(self):
7777
)
7878
self.assertEqual(path.joinpath(), path)
7979

80+
def test_join_path_compound(self):
81+
path = MultiplexedPath(self.folder)
82+
assert not path.joinpath('imaginary/foo.py').exists()
83+
8084
def test_repr(self):
8185
self.assertEqual(
8286
repr(MultiplexedPath(self.folder)),

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ skip-string-normalization = true
77

88
[tool.setuptools_scm]
99

10-
[pytest.enabler.black]
10+
[tool.pytest-enabler.black]
1111
addopts = "--black"
1212

13-
[pytest.enabler.mypy]
13+
[tool.pytest-enabler.mypy]
1414
addopts = "--mypy"
1515

16-
[pytest.enabler.flake8]
16+
[tool.pytest-enabler.flake8]
1717
addopts = "--flake8"
1818

19-
[pytest.enabler.cov]
19+
[tool.pytest-enabler.cov]
2020
addopts = "--cov"

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ testing =
4141
pytest-mypy >= 0.9.1; \
4242
# workaround for jaraco/skeleton#22
4343
python_implementation != "PyPy"
44-
pytest-enabler >= 1.0.1
44+
pytest-enabler >= 1.3
4545

4646
# local
4747

@@ -50,5 +50,6 @@ docs =
5050
sphinx
5151
jaraco.packaging >= 9
5252
rst.linker >= 1.9
53+
jaraco.tidelift >= 1.4
5354

5455
# local

0 commit comments

Comments
 (0)