compat.py 695 B

1234567891011121314151617181920212223242526272829
  1. try:
  2. from urllib.parse import urljoin
  3. except ImportError:
  4. from urlparse import urljoin
  5. try:
  6. import cPickle as pickle
  7. except ImportError:
  8. import pickle
  9. # Handle the case where the requests module has been patched to not have
  10. # urllib3 bundled as part of its source.
  11. try:
  12. from pip._vendor.requests.packages.urllib3.response import HTTPResponse
  13. except ImportError:
  14. from pip._vendor.urllib3.response import HTTPResponse
  15. try:
  16. from pip._vendor.requests.packages.urllib3.util import is_fp_closed
  17. except ImportError:
  18. from pip._vendor.urllib3.util import is_fp_closed
  19. # Replicate some six behaviour
  20. try:
  21. text_type = unicode
  22. except NameError:
  23. text_type = str