Skip to content

Commit

Permalink
Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jooste committed Oct 20, 2022
1 parent 85992c5 commit 15698cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions importlib_resources/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def joinpath(self, *descendants):
paths = []
if not descendants:
return self

for path in (p.joinpath(*descendants) for p in self._paths):
if path.exists():
if path.is_dir():
Expand All @@ -98,8 +98,13 @@ def joinpath(self, *descendants):
return path

# if it does not exist, construct it with the first path
return MultiplexedPath(*paths) if len(paths) > 1 else \
paths[0] if len(paths) == 1 else self._paths[0].joinpath(*descendants)
return (
MultiplexedPath(*paths)
if len(paths) > 1
else paths[0]
if len(paths) == 1
else self._paths[0].joinpath(*descendants)
)

def open(self, *args, **kwargs):
raise FileNotFoundError(f'{self} is not a file')
Expand Down
2 changes: 1 addition & 1 deletion importlib_resources/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_join_path_common_subdir(self):
self.assertIsInstance(path.joinpath('subdirectory'), MultiplexedPath)
self.assertEqual(
str(path.joinpath('subdirectory', 'subsubdir'))[len(prefix) + 1 :],
os.path.join('data02', 'subdirectory', 'subsubdir')
os.path.join('data02', 'subdirectory', 'subsubdir'),
)

def test_repr(self):
Expand Down

0 comments on commit 15698cc

Please sign in to comment.