logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

_deprecated.py (735B)


  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. import re
  9. import struct
  10. def bytes_to_intlist(bs):
  11. if not bs:
  12. return []
  13. if isinstance(bs[0], int): # Python 3
  14. return list(bs)
  15. else:
  16. return [ord(c) for c in bs]
  17. def intlist_to_bytes(xs):
  18. if not xs:
  19. return b''
  20. return struct.pack('%dB' % len(xs), *xs)
  21. compiled_regex_type = type(re.compile(''))