OLD | NEW |
(Empty) | |
| 1 """ |
| 2 Compatibility Support for Python 2.6 and earlier |
| 3 """ |
| 4 |
| 5 import sys |
| 6 |
| 7 try: |
| 8 from urllib.parse import splittag |
| 9 except ImportError: |
| 10 from urllib import splittag |
| 11 |
| 12 |
| 13 def strip_fragment(url): |
| 14 """ |
| 15 In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and |
| 16 later was patched to disregard the fragment when making URL requests. |
| 17 Do the same for Python 2.6 and earlier. |
| 18 """ |
| 19 url, fragment = splittag(url) |
| 20 return url |
| 21 |
| 22 |
| 23 if sys.version_info >= (2, 7): |
| 24 strip_fragment = lambda x: x |
| 25 |
| 26 try: |
| 27 from importlib import import_module |
| 28 except ImportError: |
| 29 |
| 30 def import_module(module_name): |
| 31 return __import__(module_name, fromlist=['__name__']) |
OLD | NEW |