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
)
| 732 | |
| 733 | |
| 734 | def _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 |