Lines Matching +full:path +full:- +full:key
16 if not all(map(os.path.isabs, tzpaths)):
36 new_tzpath = tuple(filter(os.path.isabs, raw_tzpath))
54 invalid_paths = (path for path in tzpaths if not os.path.isabs(path))
65 def find_tzfile(key): argument
66 """Retrieve the path to a TZif file from a key."""
67 _validate_tzfile_path(key)
69 filepath = os.path.join(search_path, key)
70 if os.path.isfile(filepath):
76 _TEST_PATH = os.path.normpath(os.path.join("_", "_"))[:-1]
79 def _validate_tzfile_path(path, _base=_TEST_PATH): argument
80 if os.path.isabs(path):
82 f"ZoneInfo keys may not be absolute paths, got: {path}"
85 # We only care about the kinds of path normalizations that would change the
86 # length of the key - e.g. a/../b -> a/b, or a/b/ -> a/b. On Windows,
89 new_path = os.path.normpath(path)
90 if len(new_path) != len(path):
92 f"ZoneInfo keys must be normalized relative paths, got: {path}"
95 resolved = os.path.normpath(os.path.join(_base, new_path))
98 f"ZoneInfo keys must refer to subdirectories of TZPATH, got: {path}"
111 determine if a given file on the time zone search path is to open it
119 # pre-assembled list of zones that only requires opening one file.
137 if not os.path.exists(tz_root):
150 fpath = os.path.join(root, file)
152 key = os.path.relpath(fpath, start=tz_root)
154 key = key.replace(os.sep, "/")
156 if not key or key in valid_zones:
160 valid_zones.add(key)
163 # posixrules is a special symlink-only time zone where it exists, it
171 """Warning raised if an invalid path is specified in PYTHONTZPATH."""