Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Show module attributes missing
  • Loading branch information
coolreader18 committed Jul 1, 2019
commit 3668250c127e4b537a70a5103a241154e37c5b25
27 changes: 22 additions & 5 deletions tests/generator/not_impl_modules_footer.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@

rustpymods = set(

rustpymods = list(
map(
lambda mod: mod[0],
filter(
lambda mod: mod[1] == "" or mod[1] == ".py",
lambda mod: (mod[1] == "" or mod[1] == ".py") and "LICENSE" not in mod[0],
map(os.path.splitext, os.listdir(libdir)),
),
)
)
rustpymods |= set(sys.builtin_module_names)
rustpymods += list(sys.builtin_module_names)

rustpymods = dict(map(
lambda mod: (
mod,
set(dir(__import__(mod)))
if mod not in ("this", "antigravity")
else None,
),
rustpymods
))

for mod in cpymods - rustpymods:
print(mod)
for modname, cpymod in cpymods.items():
if modname in rustpymods:
rustpymod = rustpymods[modname]
if rustpymod:
for item in cpymod - rustpymod:
print(f"{modname}.{item}")
else:
print(f"{modname} (entire module)")

14 changes: 13 additions & 1 deletion tests/not_impl_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,19 @@ def gen_methods(header, footer, output):
def gen_modules(header, footer, output):
output.write(header.read())

modules = set(map(lambda mod: mod.name, pkgutil.iter_modules()))
modules = dict(
map(
lambda mod: (
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,
),
pkgutil.iter_modules(),
)
)

print(
f"""
Expand Down
4 changes: 2 additions & 2 deletions whats_left.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd "$(dirname "$0")"

# show the building first, so people aren't confused why it's taking so long to
# run whats_left_to_implement
cargo build
cargo build --release

if [ $# -eq 0 ]; then
sections=(${ALL_SECTIONS[@]})
Expand All @@ -39,5 +39,5 @@ for section in "${sections[@]}"; do
continue
fi
h "$section" >&2
cargo run -q -- "$snippet"
cargo run --release -q -- "$snippet"
done