Skip to content

Allow skipping of unknown modules in whats_left.sh #1105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/not_impl_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def gen_methods(header, footer, output):
output.write("}\n\n")
output.write(footer.read())

def get_module_methods(name):
try:
return set(dir(__import__(name))) if name not in ("this", "antigravity") else None
except ModuleNotFoundError:
return None


def gen_modules(header, footer, output):
output.write(header.read())
Expand All @@ -70,9 +76,7 @@ def gen_modules(header, footer, output):
mod.name,
# check name b/c modules listed have side effects on import,
# e.g. printing something or opening a webpage
set(dir(__import__(mod.name)))
if mod.name not in ("this", "antigravity")
else None,
get_module_methods(mod.name)
),
pkgutil.iter_modules(),
)
Expand Down