MCPcopy Create free account
hub / github.com/twisted/twisted / _coerceToFilesystemEncoding

Function _coerceToFilesystemEncoding

src/twisted/python/filepath.py:734–747  ·  view source on GitHub ↗

Return a C{newpath} that is suitable for joining to C{path}. @param path: The path that it should be suitable for joining to. @param newpath: The new portion of the path to be coerced if needed. @param encoding: If coerced, the encoding that will be used.

(
    path: AnyStr, newpath: bytes | str, encoding: str | None = None
)

Source from the content-addressed store, hash-verified

732
733
734def _coerceToFilesystemEncoding(
735 path: AnyStr, newpath: bytes | str, encoding: str | None = None
736) -> AnyStr:
737 """
738 Return a C{newpath} that is suitable for joining to C{path}.
739
740 @param path: The path that it should be suitable for joining to.
741 @param newpath: The new portion of the path to be coerced if needed.
742 @param encoding: If coerced, the encoding that will be used.
743 """
744 if isinstance(path, bytes):
745 return _asFilesystemBytes(newpath, encoding=encoding)
746 else:
747 return _asFilesystemText(newpath, encoding=encoding)
748
749
750@comparable

Callers 15

__init__Method · 0.90
__repr__Method · 0.90
sepMethod · 0.90
parentMethod · 0.90
childMethod · 0.90
listdirMethod · 0.90
openMethod · 0.90
getsizeMethod · 0.90
getModificationTimeMethod · 0.90
__init__Method · 0.90
zipitFunction · 0.90
setUpMethod · 0.90

Calls 2

_asFilesystemBytesFunction · 0.85
_asFilesystemTextFunction · 0.85

Tested by 3

zipitFunction · 0.72
setUpMethod · 0.72
connectedMethod · 0.72