MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / _apply_func_and_normalize_case

Function _apply_func_and_normalize_case

pydevd_file_utils.py:487–526  ·  view source on GitHub ↗
(filename, func, isabs, normalize_case, os_path_exists=os_path_exists, join=join)

Source from the content-addressed store, hash-verified

485
486
487def _apply_func_and_normalize_case(filename, func, isabs, normalize_case, os_path_exists=os_path_exists, join=join):
488 if filename.startswith("<"):
489 # Not really a file, rather a synthetic name like <string> or <ipython-...>;
490 # shouldn't be normalized.
491 return filename
492
493 r = func(filename)
494
495 if not isabs:
496 if not os_path_exists(r):
497 r = _get_relative_filename_abs_path(filename, func)
498
499 ind = r.find(".zip")
500 if ind == -1:
501 ind = r.find(".egg")
502 if ind != -1:
503 ind += 4
504 zip_path = r[:ind]
505 inner_path = r[ind:]
506 if inner_path.startswith("!"):
507 # Note (fabioz): although I can replicate this by creating a file ending as
508 # .zip! or .egg!, I don't really know what's the real-world case for this
509 # (still kept as it was added by @jetbrains, but it should probably be reviewed
510 # later on).
511 # Note 2: it goes hand-in-hand with 'exists'.
512 inner_path = inner_path[1:]
513 zip_path = zip_path + "!"
514
515 if inner_path.startswith("/") or inner_path.startswith("\\"):
516 inner_path = inner_path[1:]
517 if inner_path:
518 if normalize_case:
519 r = join(normcase(zip_path), inner_path)
520 else:
521 r = join(zip_path, inner_path)
522 return r
523
524 if normalize_case:
525 r = normcase(r)
526 return r
527
528
529_ZIP_SEARCH_CACHE = {}

Callers 1

_abs_and_canonical_pathFunction · 0.85

Calls 4

joinFunction · 0.85
normcaseFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected