maketool 0.8.15__tar.gz → 0.8.17__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.15 → maketool-0.8.17}/PKG-INFO +1 -1
- {maketool-0.8.15 → maketool-0.8.17}/maketool/refscan.py +27 -41
- {maketool-0.8.15 → maketool-0.8.17}/maketool.egg-info/PKG-INFO +1 -1
- {maketool-0.8.15 → maketool-0.8.17}/pyproject.toml +1 -1
- {maketool-0.8.15 → maketool-0.8.17}/README.md +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/__init__.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/build.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/clean.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/compile.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/run.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool/sublime.py +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool.egg-info/SOURCES.txt +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool.egg-info/dependency_links.txt +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool.egg-info/entry_points.txt +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/maketool.egg-info/top_level.txt +0 -0
- {maketool-0.8.15 → maketool-0.8.17}/setup.cfg +0 -0
|
@@ -7,6 +7,7 @@ Usage:
|
|
|
7
7
|
|
|
8
8
|
Reports:
|
|
9
9
|
1) UNUSED files: filename/path tokens not found in scanned text sources
|
|
10
|
+
- Grouped by extension, with .py printed last and a blank line before the .py group
|
|
10
11
|
2) MISSING imports: imports used by entry (and local-resolved siblings) but not installed
|
|
11
12
|
"""
|
|
12
13
|
|
|
@@ -23,6 +24,7 @@ try:
|
|
|
23
24
|
except Exception:
|
|
24
25
|
packages_distributions = None # type: ignore
|
|
25
26
|
|
|
27
|
+
|
|
26
28
|
# ----------------------------
|
|
27
29
|
# Refscan settings
|
|
28
30
|
# ----------------------------
|
|
@@ -80,6 +82,7 @@ def safe_read_text(p: Path) -> Optional[str]:
|
|
|
80
82
|
except Exception:
|
|
81
83
|
return None
|
|
82
84
|
|
|
85
|
+
|
|
83
86
|
def norm(s: str) -> str:
|
|
84
87
|
return s.replace("\\", "/").lower()
|
|
85
88
|
|
|
@@ -109,36 +112,33 @@ def is_text_source(p: Path) -> bool:
|
|
|
109
112
|
return ext in DEFAULT_SCAN_EXTS
|
|
110
113
|
|
|
111
114
|
|
|
112
|
-
def
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
def print_unused_grouped(unused_rels: list[str]) -> None:
|
|
116
|
+
"""
|
|
117
|
+
Print unused files grouped by extension, with .py printed last and a blank
|
|
118
|
+
line inserted before the .py group.
|
|
119
|
+
"""
|
|
120
|
+
def sort_key(rel: str):
|
|
121
|
+
ext = Path(rel).suffix.lower()
|
|
122
|
+
is_py = (ext == ".py")
|
|
123
|
+
return (is_py, ext, rel.lower())
|
|
124
|
+
|
|
125
|
+
unused_sorted = sorted(unused_rels, key=sort_key)
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
print(f"{name} <-- {preview}")
|
|
122
|
-
else:
|
|
123
|
-
print(name)
|
|
124
|
-
print()
|
|
127
|
+
print("UNUSED files (no filename/path tokens found)")
|
|
128
|
+
print("--------------------------------------------")
|
|
125
129
|
|
|
130
|
+
printed_py_gap = False
|
|
131
|
+
for rel in unused_sorted:
|
|
132
|
+
if Path(rel).suffix.lower() == ".py" and not printed_py_gap:
|
|
133
|
+
print() # blank line before first .py file
|
|
134
|
+
printed_py_gap = True
|
|
135
|
+
print(rel)
|
|
126
136
|
|
|
127
|
-
def print_group(title: str, rows: list[tuple[str, list[str]]]) -> None:
|
|
128
|
-
print(title)
|
|
129
|
-
print("-" * len(title))
|
|
130
|
-
for rel, refs in rows:
|
|
131
|
-
# no markers; print plain filename/path
|
|
132
|
-
if refs:
|
|
133
|
-
preview = ", ".join(refs[:3]) + (" ..." if len(refs) > 3 else "")
|
|
134
|
-
print(f"{rel} <-- {preview}")
|
|
135
|
-
else:
|
|
136
|
-
print(rel)
|
|
137
137
|
print()
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
# ----------------------------
|
|
141
|
-
# Missing-import report
|
|
141
|
+
# Missing-import report
|
|
142
142
|
# ----------------------------
|
|
143
143
|
|
|
144
144
|
def stdlib_names() -> Set[str]:
|
|
@@ -222,7 +222,6 @@ def _index_local_modules_under(root: Path) -> Set[str]:
|
|
|
222
222
|
def index_local_modules(project_root: Path) -> Set[str]:
|
|
223
223
|
roots: List[Path] = [project_root]
|
|
224
224
|
|
|
225
|
-
# common extra roots (optional)
|
|
226
225
|
for name in ["src", "lib", "app", "python", "package", "packages"]:
|
|
227
226
|
p = project_root / name
|
|
228
227
|
if p.exists() and p.is_dir():
|
|
@@ -278,14 +277,6 @@ def compute_missing_used_imports(
|
|
|
278
277
|
missing.add(name)
|
|
279
278
|
return missing
|
|
280
279
|
|
|
281
|
-
def print_unused_grouped_by_ext(unused_rels: list[str]) -> None:
|
|
282
|
-
# Sort by: extension (lower), then full path (lower)
|
|
283
|
-
def key(rel: str):
|
|
284
|
-
ext = Path(rel).suffix.lower()
|
|
285
|
-
return (ext, rel.lower())
|
|
286
|
-
|
|
287
|
-
for rel in sorted(unused_rels, key=key):
|
|
288
|
-
print(rel)
|
|
289
280
|
|
|
290
281
|
def run_missing_imports_report(entry: Path, project_root: Path) -> None:
|
|
291
282
|
print("MISSING (used but not installed):")
|
|
@@ -308,7 +299,8 @@ def run_missing_imports_report(entry: Path, project_root: Path) -> None:
|
|
|
308
299
|
project_root=project_root,
|
|
309
300
|
)
|
|
310
301
|
|
|
311
|
-
if not missing:
|
|
302
|
+
if not missing:
|
|
303
|
+
return
|
|
312
304
|
|
|
313
305
|
for m in sorted(missing):
|
|
314
306
|
print(m)
|
|
@@ -353,15 +345,9 @@ def main() -> int:
|
|
|
353
345
|
if any(tok in hay for tok in c.tokens):
|
|
354
346
|
references[c.rel].append(src_rel)
|
|
355
347
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
refs = references[c.rel]
|
|
359
|
-
if not refs:
|
|
360
|
-
unused_rows.append((c.rel, refs))
|
|
361
|
-
|
|
362
|
-
print_group("UNUSED files (no filename/path tokens found)", unused_rows)
|
|
348
|
+
unused_rels = [c.rel for c in candidates if not references[c.rel]]
|
|
349
|
+
print_unused_grouped(unused_rels)
|
|
363
350
|
|
|
364
|
-
# Second report: missing imports (based on entry .py)
|
|
365
351
|
if entry.suffix.lower() == ".py":
|
|
366
352
|
run_missing_imports_report(entry=entry, project_root=root)
|
|
367
353
|
else:
|
|
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
|