_deprecated.py 876 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """Deprecated - New code should avoid these"""
  2. import warnings
  3. from ..compat.compat_utils import passthrough_module
  4. # XXX: Implement this the same way as other DeprecationWarnings without circular import
  5. passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
  6. DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6))
  7. del passthrough_module
  8. from ._utils import preferredencoding
  9. def encodeFilename(s, for_subprocess=False):
  10. assert isinstance(s, str)
  11. return s
  12. def decodeFilename(b, for_subprocess=False):
  13. return b
  14. def decodeArgument(b):
  15. return b
  16. def decodeOption(optval):
  17. if optval is None:
  18. return optval
  19. if isinstance(optval, bytes):
  20. optval = optval.decode(preferredencoding())
  21. assert isinstance(optval, str)
  22. return optval
  23. def error_to_compat_str(err):
  24. return str(err)