contextl 1.2.45 → 1.2.46
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.
- package/package.json +1 -1
- package/python/import_parser.py +13 -3
- package/python/scanner.py +1 -1
package/package.json
CHANGED
package/python/import_parser.py
CHANGED
|
@@ -593,10 +593,20 @@ def _find_file_in_repo(
|
|
|
593
593
|
py_idx = cand + "/__init__.py"
|
|
594
594
|
if py_idx in file_index:
|
|
595
595
|
return py_idx
|
|
596
|
-
|
|
596
|
+
|
|
597
|
+
suffix_ext = "/" + py_ext
|
|
598
|
+
suffix_idx = "/" + py_idx
|
|
599
|
+
matches = []
|
|
600
|
+
|
|
597
601
|
for path in file_index:
|
|
598
|
-
if path.endswith(
|
|
599
|
-
|
|
602
|
+
if path.endswith(suffix_ext) or path == py_ext:
|
|
603
|
+
matches.append(path)
|
|
604
|
+
elif path.endswith(suffix_idx) or path == py_idx:
|
|
605
|
+
matches.append(path)
|
|
606
|
+
|
|
607
|
+
if matches:
|
|
608
|
+
matches.sort(key=lambda p: (p.count("/"), 0 if p.endswith("__init__.py") else 1))
|
|
609
|
+
return matches[0]
|
|
600
610
|
|
|
601
611
|
# Fallback for Python cross-language imports (e.g. from tests to .ts/.js core logic)
|
|
602
612
|
for ext in [".ts", ".tsx", ".js", ".jsx", ".java", ".go", ".rs", ".cpp", ".cc", ".cxx", ".h", ".hpp", ".c"]:
|
package/python/scanner.py
CHANGED
|
@@ -18,7 +18,7 @@ ignore_dirs = {
|
|
|
18
18
|
".git", "node_modules", "__pycache__", "venv", ".venv",
|
|
19
19
|
"env", ".env", ".next", ".nuxt", "out", "build", "dist",
|
|
20
20
|
"coverage", ".nyc_output", ".pytest_cache", "npm", "pypi",
|
|
21
|
-
"vendor", "target", ".cargo", "Pods", "third_party"
|
|
21
|
+
"vendor", "target", ".cargo", "Pods", "third_party", "deps"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
def _should_ignore(path: str) -> bool:
|