Skip to content

Commit

Permalink
Refactor to avoid missed coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 10, 2023
1 parent 8818432 commit 3d7ee19
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import functools
import itertools
import posixpath
import contextlib
import collections
import inspect

Expand Down Expand Up @@ -513,16 +514,14 @@ def _read_files_egginfo_installed(self):
# But this subdir is only available in the PathDistribution's self._path
# which is not easily accessible from this base class...
subdir = getattr(self, '_path', None)
try:
if text and subdir:
ret = [
str((subdir / line).resolve().relative_to(self.locate_file('')))
for line in text.splitlines()
]
return map('"{}"'.format, ret)
except Exception:
pass
return None
if not text or not subdir:
return
with contextlib.suppress(Exception):
ret = [
str((subdir / line).resolve().relative_to(self.locate_file('')))
for line in text.splitlines()
]
return map('"{}"'.format, ret)

def _read_files_egginfo_sources(self):
"""
Expand Down

0 comments on commit 3d7ee19

Please sign in to comment.