_compat.py 494 B

12345678910111213141516171819202122232425
  1. import sys
  2. if sys.version_info[0] == 2:
  3. PY2 = True
  4. from StringIO import StringIO
  5. BytesIO = StringIO
  6. from urllib import pathname2url
  7. _cOrd = ord
  8. # File open mode for reading (univeral newlines)
  9. _READ_MODE = "rU"
  10. else:
  11. PY2 = False
  12. from urllib.request import pathname2url
  13. from io import BytesIO, StringIO
  14. _cOrd = int
  15. _READ_MODE = "r"
  16. if sys.version_info < (3,):
  17. from dis3 import get_instructions
  18. else:
  19. from dis import get_instructions