API Documentation

Stdlib Replacements

Alternative implementations or wrappers of stdlib functions and constants. In some cases their default is changed to return an fsnative path (mkdtemp() with default arguments) or Unicode support for Windows is added (sys.argv)

environ os.environ replacement
argv sys.argv replacement
sep os.sep replacement
pathsep os.pathsep replacement
curdir os.curdir replacement
pardir os.pardir replacement
altsep os.altsep replacement
extsep os.extsep replacement
devnull os.devnull replacement
defpath os.defpath replacement
getcwd() os.getcwd replacement
getenv() os.getenv replacement
putenv() os.putenv replacement
unsetenv() os.unsetenv replacement
print_() print() replacement
input_() input() replacement
expanduser() os.path.expanduser() replacement
expandvars() os.path.expandvars() replacement
gettempdir() tempfile.gettempdir() replacement
gettempprefix() tempfile.gettempprefix() replacement
mkstemp() tempfile.mkstemp() replacement
mkdtemp() tempfile.mkdtemp() replacement

Documentation Types

These types only exist for documentation purposes and represent different types depending on the Python version and platform used.

class senf.text

Represents unicode under Python 2 and str under Python 3. Does not include surrogates.

class senf.bytes

Represents str under Python 2 and bytes under Python 3.

class senf.pathlike

Anything the Python stdlib allows as a path. In addition to fsnative this allows

  • bytes encoded with the default file system encoding (usually mbcs) on Windows.
  • bytes under Python 3 + Unix.
  • unicode under Python 2 + Unix if it can be encoded with the default file system encoding.
  • (Python 3.6+) Instances where its type implements the __fspath__ protocol. See PEP 519 for details.