MCPcopy Index your code
hub / github.com/RustPython/RustPython / fsdecode

Function fsdecode

Lib/os.py:863–873  ·  view source on GitHub ↗

Decode filename (an os.PathLike, bytes, or str) from the filesystem encoding with 'surrogateescape' error handler, return str unchanged. On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding).

(filename)

Source from the content-addressed store, hash-verified

861 return filename
862
863 def fsdecode(filename):
864 """Decode filename (an os.PathLike, bytes, or str) from the filesystem
865 encoding with 'surrogateescape' error handler, return str unchanged. On
866 Windows, use 'strict' error handler if the file system encoding is
867 'mbcs' (which is the default encoding).
868 """
869 filename = fspath(filename) # Does type-checking of `filename`.
870 if isinstance(filename, bytes):
871 return filename.decode(encoding, errors)
872 else:
873 return filename
874
875 return fsencode, fsdecode
876

Callers 1

get_exec_pathFunction · 0.85

Calls 3

isinstanceFunction · 0.85
fspathFunction · 0.70
decodeMethod · 0.45

Tested by

no test coverage detected