File: filesystem.py

package info (click to toggle)
python-banal 1.0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 116 kB
  • sloc: python: 215; makefile: 17
file content (11 lines) | stat: -rw-r--r-- 312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import sys
from typing import Optional


def decode_path(file_path: Optional[str]) -> Optional[str]:
    """Turn a path name into unicode."""
    if file_path is None:
        return None
    if isinstance(file_path, bytes):
        file_path = file_path.decode(sys.getfilesystemencoding())
    return file_path