maketool 0.8.14__tar.gz → 0.8.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {maketool-0.8.14 → maketool-0.8.16}/PKG-INFO +1 -1
- {maketool-0.8.14 → maketool-0.8.16}/maketool/refscan.py +37 -18
- {maketool-0.8.14 → maketool-0.8.16}/maketool.egg-info/PKG-INFO +1 -1
- {maketool-0.8.14 → maketool-0.8.16}/pyproject.toml +1 -1
- {maketool-0.8.14 → maketool-0.8.16}/README.md +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/__init__.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/build.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/clean.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/compile.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/run.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool/sublime.py +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool.egg-info/SOURCES.txt +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool.egg-info/dependency_links.txt +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool.egg-info/entry_points.txt +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/maketool.egg-info/top_level.txt +0 -0
- {maketool-0.8.14 → maketool-0.8.16}/setup.cfg +0 -0
|
@@ -7,17 +7,16 @@ Usage:
|
|
|
7
7
|
|
|
8
8
|
Reports:
|
|
9
9
|
1) UNUSED files: filename/path tokens not found in scanned text sources
|
|
10
|
-
- Printed
|
|
10
|
+
- Printed grouped by extension (same extensions together)
|
|
11
11
|
2) MISSING imports: imports used by entry (and local-resolved siblings) but not installed
|
|
12
|
-
- Printed as plain module names (no headers). Prints nothing if none missing.
|
|
13
12
|
"""
|
|
14
13
|
|
|
15
14
|
from __future__ import annotations
|
|
16
15
|
|
|
17
16
|
import ast
|
|
18
17
|
import sys
|
|
19
|
-
from dataclasses import dataclass
|
|
20
18
|
from pathlib import Path
|
|
19
|
+
from dataclasses import dataclass
|
|
21
20
|
from typing import Dict, Iterable, List, Optional, Set
|
|
22
21
|
|
|
23
22
|
try:
|
|
@@ -97,10 +96,10 @@ def build_candidates(root: Path, files: list[Path]) -> list[Candidate]:
|
|
|
97
96
|
stem = p.stem.lower()
|
|
98
97
|
|
|
99
98
|
tokens = {
|
|
100
|
-
base,
|
|
101
|
-
stem,
|
|
102
|
-
rel_norm,
|
|
103
|
-
rel_norm.replace("/", "\\"),
|
|
99
|
+
base, # rat.ico
|
|
100
|
+
stem, # common
|
|
101
|
+
rel_norm, # icons/rat.ico
|
|
102
|
+
rel_norm.replace("/", "\\"), # icons\rat.ico
|
|
104
103
|
}
|
|
105
104
|
out.append(Candidate(p, rel, tuple(t for t in tokens if t)))
|
|
106
105
|
return out
|
|
@@ -113,13 +112,16 @@ def is_text_source(p: Path) -> bool:
|
|
|
113
112
|
return ext in DEFAULT_SCAN_EXTS
|
|
114
113
|
|
|
115
114
|
|
|
116
|
-
def
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
def print_group(title: str, rows: list[tuple[str, list[str]]]) -> None:
|
|
116
|
+
print(title)
|
|
117
|
+
print("-" * len(title))
|
|
118
|
+
for rel, refs in rows:
|
|
119
|
+
if refs:
|
|
120
|
+
preview = ", ".join(refs[:3]) + (" ..." if len(refs) > 3 else "")
|
|
121
|
+
print(f"{rel} <-- {preview}")
|
|
122
|
+
else:
|
|
123
|
+
print(rel)
|
|
124
|
+
print()
|
|
123
125
|
|
|
124
126
|
|
|
125
127
|
# ----------------------------
|
|
@@ -264,8 +266,11 @@ def compute_missing_used_imports(
|
|
|
264
266
|
|
|
265
267
|
|
|
266
268
|
def run_missing_imports_report(entry: Path, project_root: Path) -> None:
|
|
267
|
-
|
|
269
|
+
print("MISSING (used but not installed):")
|
|
270
|
+
print("------------------------------")
|
|
271
|
+
|
|
268
272
|
if packages_distributions is None:
|
|
273
|
+
print("(skipped: Python 3.8+ required for importlib.metadata.packages_distributions())\n")
|
|
269
274
|
return
|
|
270
275
|
|
|
271
276
|
std = stdlib_names()
|
|
@@ -281,8 +286,12 @@ def run_missing_imports_report(entry: Path, project_root: Path) -> None:
|
|
|
281
286
|
project_root=project_root,
|
|
282
287
|
)
|
|
283
288
|
|
|
289
|
+
if not missing:
|
|
290
|
+
return
|
|
291
|
+
|
|
284
292
|
for m in sorted(missing):
|
|
285
293
|
print(m)
|
|
294
|
+
print()
|
|
286
295
|
|
|
287
296
|
|
|
288
297
|
# ----------------------------
|
|
@@ -323,12 +332,22 @@ def main() -> int:
|
|
|
323
332
|
if any(tok in hay for tok in c.tokens):
|
|
324
333
|
references[c.rel].append(src_rel)
|
|
325
334
|
|
|
326
|
-
|
|
327
|
-
|
|
335
|
+
unused_rows: list[tuple[str, List[str]]] = []
|
|
336
|
+
for c in candidates:
|
|
337
|
+
if not references[c.rel]:
|
|
338
|
+
unused_rows.append((c.rel, references[c.rel]))
|
|
339
|
+
|
|
340
|
+
# Group-by-extension presentation: sort by extension, then by name
|
|
341
|
+
unused_rows.sort(key=lambda item: (Path(item[0]).suffix.lower(), item[0].lower()))
|
|
342
|
+
|
|
343
|
+
print_group("UNUSED files (no filename/path tokens found)", unused_rows)
|
|
328
344
|
|
|
329
|
-
# Second report: missing imports (only if entry is .py)
|
|
330
345
|
if entry.suffix.lower() == ".py":
|
|
331
346
|
run_missing_imports_report(entry=entry, project_root=root)
|
|
347
|
+
else:
|
|
348
|
+
print("MISSING (used but not installed):")
|
|
349
|
+
print("------------------------------")
|
|
350
|
+
print("(skipped: entry is not a .py file)\n")
|
|
332
351
|
|
|
333
352
|
return 0
|
|
334
353
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|