MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / _abs_and_canonical_path

Function _abs_and_canonical_path

pydevd_file_utils.py:438–470  ·  view source on GitHub ↗
(filename, NORM_PATHS_CONTAINER=NORM_PATHS_CONTAINER)

Source from the content-addressed store, hash-verified

436
437# Returns tuple of absolute path and real path for given filename
438def _abs_and_canonical_path(filename, NORM_PATHS_CONTAINER=NORM_PATHS_CONTAINER):
439 try:
440 return NORM_PATHS_CONTAINER[filename]
441 except:
442 if filename.__class__ != str:
443 raise AssertionError("Paths passed to _abs_and_canonical_path must be str. Found: %s (%s)" % (filename, type(filename)))
444 if os is None: # Interpreter shutdown
445 return filename, filename
446
447 os_path = os.path
448 if os_path is None: # Interpreter shutdown
449 return filename, filename
450
451 os_path_abspath = os_path.abspath
452 os_path_isabs = os_path.isabs
453
454 if os_path_abspath is None or os_path_isabs is None or os_path_real_path is None: # Interpreter shutdown
455 return filename, filename
456
457 isabs = os_path_isabs(filename)
458
459 if _global_resolve_symlinks:
460 os_path_abspath = os_path_real_path
461
462 normalize = False
463 abs_path = _apply_func_and_normalize_case(filename, os_path_abspath, isabs, normalize)
464
465 normalize = True
466 real_path = _apply_func_and_normalize_case(filename, os_path_real_path, isabs, normalize)
467
468 # cache it for fast access later
469 NORM_PATHS_CONTAINER[filename] = abs_path, real_path
470 return abs_path, real_path
471
472
473def _get_relative_filename_abs_path(filename, func, os_path_exists=os_path_exists):

Calls 1

Tested by

no test coverage detected