Skip to content

Commit

Permalink
Extract variable for optional names.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 18, 2023
1 parent a3c066d commit 6610368
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,8 @@ def _top_level_declared(dist):


def _top_level_inferred(dist):
return filter(
None,
{
inspect.getmodulename(f) if len(f.parts) == 1 else f.parts[0]
for f in always_iterable(dist.files)
},
)
opt_names = {
inspect.getmodulename(f) if len(f.parts) == 1 else f.parts[0]
for f in always_iterable(dist.files)
}
return filter(None, opt_names)

0 comments on commit 6610368

Please sign in to comment.