Skip to content

Commit

Permalink
Use try-else block
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Jun 22, 2024
1 parent 864aa3b commit a37fd21
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pdoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,13 @@ def __init__(self, module: Union[ModuleType, str], *,
for name in self.obj.__all__:
try:
obj = getattr(self.obj, name)
if not _is_blacklisted(name, self):
obj = inspect.unwrap(obj)
public_objs.append((name, obj))
except AttributeError:
warn(f"Module {self.module!r} doesn't contain identifier `{name}` "
"exported in `__all__`")
else:
if not _is_blacklisted(name, self):
obj = inspect.unwrap(obj)
public_objs.append((name, obj))
else:
def is_from_this_module(obj):
mod = inspect.getmodule(inspect.unwrap(obj))
Expand Down

0 comments on commit a37fd21

Please sign in to comment.