path#

通用路径实用程序。

函数#

explode_directories(→ set[str])

get_all_directories(→ list[tuple[str, Ellipsis]])

get_leaf_directories(→ collections.abc.Sequence[str])

tokenized_startswith(test_iterable, startswith_iterable)

get_major_minor_version(string[, with_dot])

get_python_noarch_target_path(source_short_path, ...)

get_python_short_path([python_version])

get_python_site_packages_short_path(python_version)

missing_pyc_files(python_major_minor_version, files)

parse_entry_point_def(ep_definition)

pyc_path(py_path, python_major_minor_version)

这在 Windows 上不得返回反斜杠,因为那样会破坏

unix_path_to_win(→ str | tuple[str, Ellipsis] | None)

将 Unix 路径转换为 Windows 路径。

win_path_backout(path)

win_path_double_escape(path)

win_path_ok(path)

win_path_to_unix(→ str | tuple[str, Ellipsis] | None)

将 Windows 路径转换为 Unix 路径。

explode_directories(child_directories: collections.abc.Iterable[tuple[str, Ellipsis]]) set[str]#
get_all_directories(files: collections.abc.Iterable[str]) list[tuple[str, Ellipsis]]#
get_leaf_directories(files: collections.abc.Iterable[str]) collections.abc.Sequence[str]#
tokenized_startswith(test_iterable, startswith_iterable)#
get_major_minor_version(string, with_dot=True)#
get_python_noarch_target_path(source_short_path, target_site_packages_short_path)#
get_python_short_path(python_version=None)#
get_python_site_packages_short_path(python_version)#
missing_pyc_files(python_major_minor_version, files)#
parse_entry_point_def(ep_definition)#
pyc_path(py_path, python_major_minor_version)#

这在 Windows 上不得返回反斜杠,因为那样会破坏测试,并最终导致需要使 url_to_path 也返回反斜杠,而这最终可能会更改磁盘上的文件或与它们的内容进行比较的结果。

unix_path_to_win(paths: conda.common.path.PathType | conda.common.path.PathsType | None, prefix: conda.common.path.PathType | None = None, *, cygdrive: bool = False) str | tuple[str, Ellipsis] | None#

将 Unix 路径转换为 Windows 路径。

注意

在 Unix 上运行时产生意外结果。

参数:
  • paths -- 要转换的路径。

  • prefix -- 用于转换的前缀目录(Windows 路径样式)。如果未提供,则不会进行前缀路径检查。

  • cygdrive -- 未使用。存在是为了保持签名与 win_path_to_unix 一致。

win_path_backout(path)#
win_path_double_escape(path)#
win_path_ok(path)#
win_path_to_unix(paths: conda.common.path.PathType | conda.common.path.PathsType | None, prefix: conda.common.path.PathType | None = None, *, cygdrive: bool = False) str | tuple[str, Ellipsis] | None#

将 Windows 路径转换为 Unix 路径。

注意

在 Unix 上运行时产生意外结果。

参数:
  • paths -- 要转换的路径。

  • prefix -- 用于转换的前缀目录(Windows 路径样式)。如果未提供,则不会进行前缀路径检查。

  • cygdrive -- 是否使用 Cygwin 样式的驱动器前缀。