Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compat.py 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. """
  2. requests.compat
  3. ~~~~~~~~~~~~~~~
  4. This module previously handled import compatibility issues
  5. between Python 2 and Python 3. It remains for backwards
  6. compatibility until the next major version.
  7. """
  8. try:
  9. import chardet
  10. except ImportError:
  11. import charset_normalizer as chardet
  12. import sys
  13. # -------
  14. # Pythons
  15. # -------
  16. # Syntax sugar.
  17. _ver = sys.version_info
  18. #: Python 2.x?
  19. is_py2 = _ver[0] == 2
  20. #: Python 3.x?
  21. is_py3 = _ver[0] == 3
  22. # json/simplejson module import resolution
  23. has_simplejson = False
  24. try:
  25. import simplejson as json
  26. has_simplejson = True
  27. except ImportError:
  28. import json
  29. if has_simplejson:
  30. from simplejson import JSONDecodeError
  31. else:
  32. from json import JSONDecodeError
  33. # Keep OrderedDict for backwards compatibility.
  34. from collections import OrderedDict
  35. from collections.abc import Callable, Mapping, MutableMapping
  36. from http import cookiejar as cookielib
  37. from http.cookies import Morsel
  38. from io import StringIO
  39. # --------------
  40. # Legacy Imports
  41. # --------------
  42. from urllib.parse import (
  43. quote,
  44. quote_plus,
  45. unquote,
  46. unquote_plus,
  47. urldefrag,
  48. urlencode,
  49. urljoin,
  50. urlparse,
  51. urlsplit,
  52. urlunparse,
  53. )
  54. from urllib.request import (
  55. getproxies,
  56. getproxies_environment,
  57. parse_http_list,
  58. proxy_bypass,
  59. proxy_bypass_environment,
  60. )
  61. builtin_str = str
  62. str = str
  63. bytes = bytes
  64. basestring = (str, bytes)
  65. numeric_types = (int, float)
  66. integer_types = (int,)