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.

packages.py 957B

12345678910111213141516171819202122232425262728
  1. import sys
  2. try:
  3. import chardet
  4. except ImportError:
  5. import warnings
  6. import charset_normalizer as chardet
  7. warnings.filterwarnings("ignore", "Trying to detect", module="charset_normalizer")
  8. # This code exists for backwards compatibility reasons.
  9. # I don't like it either. Just look the other way. :)
  10. for package in ("urllib3", "idna"):
  11. locals()[package] = __import__(package)
  12. # This traversal is apparently necessary such that the identities are
  13. # preserved (requests.packages.urllib3.* is urllib3.*)
  14. for mod in list(sys.modules):
  15. if mod == package or mod.startswith(f"{package}."):
  16. sys.modules[f"requests.packages.{mod}"] = sys.modules[mod]
  17. target = chardet.__name__
  18. for mod in list(sys.modules):
  19. if mod == target or mod.startswith(f"{target}."):
  20. target = target.replace(target, "chardet")
  21. sys.modules[f"requests.packages.{target}"] = sys.modules[mod]
  22. # Kinda cool, though, right?