contextl 1.2.46 → 1.2.47
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
CHANGED
package/python/import_parser.py
CHANGED
|
@@ -605,7 +605,10 @@ def _find_file_in_repo(
|
|
|
605
605
|
matches.append(path)
|
|
606
606
|
|
|
607
607
|
if matches:
|
|
608
|
-
|
|
608
|
+
if source_file:
|
|
609
|
+
matches.sort(key=lambda p: (p.count("/"), _path_distance(source_file, p), 0 if p.endswith("__init__.py") else 1))
|
|
610
|
+
else:
|
|
611
|
+
matches.sort(key=lambda p: (p.count("/"), 0 if p.endswith("__init__.py") else 1))
|
|
609
612
|
return matches[0]
|
|
610
613
|
|
|
611
614
|
# Fallback for Python cross-language imports (e.g. from tests to .ts/.js core logic)
|
package/python/query_engine.py
CHANGED
|
@@ -111,10 +111,14 @@ COMMON_ABBREVS = {
|
|
|
111
111
|
"mid": "middleware"
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
REVERSE_ABBREVS = {v: k for k, v in COMMON_ABBREVS.items()}
|
|
115
|
+
|
|
114
116
|
def _is_match(term: str, target: str) -> bool:
|
|
115
117
|
term_canon = COMMON_ABBREVS.get(term, term)
|
|
116
118
|
if term_canon in target or target in term_canon or target.startswith(term_canon) or term_canon.startswith(target):
|
|
117
119
|
return True
|
|
120
|
+
if target == REVERSE_ABBREVS.get(term_canon):
|
|
121
|
+
return True
|
|
118
122
|
return False
|
|
119
123
|
|
|
120
124
|
|