MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / prepare_path

Function prepare_path

src/commoncode/fileutils.py:132–139  ·  view source on GitHub ↗

Return the `pth` path string either as encoded bytes if on Linux and using Python 2 or as a unicode/text otherwise.

(pth)

Source from the content-addressed store, hash-verified

130
131
132def prepare_path(pth):
133 """
134 Return the `pth` path string either as encoded bytes if on Linux and using
135 Python 2 or as a unicode/text otherwise.
136 """
137 if not isinstance(pth, str):
138 return fsdecode(pth)
139 return pth
140
141
142def is_posixpath(location):

Callers 2

as_posixpathFunction · 0.85
as_winpathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected