Skip to content

Commit 3668250

Browse files
committed
Show module attributes missing
1 parent 9262585 commit 3668250

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11

2-
rustpymods = set(
2+
3+
rustpymods = list(
34
map(
45
lambda mod: mod[0],
56
filter(
6-
lambda mod: mod[1] == "" or mod[1] == ".py",
7+
lambda mod: (mod[1] == "" or mod[1] == ".py") and "LICENSE" not in mod[0],
78
map(os.path.splitext, os.listdir(libdir)),
89
),
910
)
1011
)
11-
rustpymods |= set(sys.builtin_module_names)
12+
rustpymods += list(sys.builtin_module_names)
13+
14+
rustpymods = dict(map(
15+
lambda mod: (
16+
mod,
17+
set(dir(__import__(mod)))
18+
if mod not in ("this", "antigravity")
19+
else None,
20+
),
21+
rustpymods
22+
))
1223

13-
for mod in cpymods - rustpymods:
14-
print(mod)
24+
for modname, cpymod in cpymods.items():
25+
if modname in rustpymods:
26+
rustpymod = rustpymods[modname]
27+
if rustpymod:
28+
for item in cpymod - rustpymod:
29+
print(f"{modname}.{item}")
30+
else:
31+
print(f"{modname} (entire module)")
1532

tests/not_impl_gen.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,19 @@ def gen_methods(header, footer, output):
6464
def gen_modules(header, footer, output):
6565
output.write(header.read())
6666

67-
modules = set(map(lambda mod: mod.name, pkgutil.iter_modules()))
67+
modules = dict(
68+
map(
69+
lambda mod: (
70+
mod.name,
71+
# check name b/c modules listed have side effects on import,
72+
# e.g. printing something or opening a webpage
73+
set(dir(__import__(mod.name)))
74+
if mod.name not in ("this", "antigravity")
75+
else None,
76+
),
77+
pkgutil.iter_modules(),
78+
)
79+
)
6880

6981
print(
7082
f"""

whats_left.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cd "$(dirname "$0")"
2323

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

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

0 commit comments

Comments
 (0)