Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion remold/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def whereis(
"For each fragment, the attribute paths where LibCST keeps it, deepest node first"
mod = cst.parse_module(src)
def _hit(n, frag):
c = _render(n).strip()
try: c = _render(n).strip()
except Exception: return False
return frag in c if contains else c==frag
return {frag: [p for p,n in sorted(((p,n) for p,n in _walk(mod) if p and _hit(n, frag)), key=lambda o: -len(o[0]))]
for frag in frags}