(filename, NORM_PATHS_CONTAINER=NORM_PATHS_CONTAINER)
| 436 | |
| 437 | # Returns tuple of absolute path and real path for given filename |
| 438 | def _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 | |
| 473 | def _get_relative_filename_abs_path(filename, func, os_path_exists=os_path_exists): |
no test coverage detected