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)
| 880 | return filename |
| 881 | |
| 882 | def fsdecode(filename): |
| 883 | """Decode filename (an os.PathLike, bytes, or str) from the filesystem |
| 884 | encoding with 'surrogateescape' error handler, return str unchanged. On |
| 885 | Windows, use 'strict' error handler if the file system encoding is |
| 886 | 'mbcs' (which is the default encoding). |
| 887 | """ |
| 888 | filename = fspath(filename) # Does type-checking of `filename`. |
| 889 | if isinstance(filename, bytes): |
| 890 | return filename.decode(encoding, errors) |
| 891 | else: |
| 892 | return filename |
| 893 | |
| 894 | return fsencode, fsdecode |
| 895 |
no test coverage detected
searching dependent graphs…