Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return result
def urlcleanup():
for temp_file in _url_tempfiles:
try:
os.unlink(temp_file)
except EnvironmentError:
pass
del _url_tempfiles[:]
global _opener
if _opener:
_opener = None
if PY3:
_cut_port_re = re.compile(r":\d+$", re.ASCII)
else:
_cut_port_re = re.compile(r":\d+$")
def request_host(request):
"""Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
"""
url = request.full_url
host = urlparse(url)[1]
if host == "":
host = request.get_header("Host", "")
from __future__ import absolute_import
from future.utils import PY3
if not PY3:
__future_module__ = True
return result
def urlcleanup():
for temp_file in _url_tempfiles:
try:
os.unlink(temp_file)
except EnvironmentError:
pass
del _url_tempfiles[:]
global _opener
if _opener:
_opener = None
if PY3:
_cut_port_re = re.compile(r":\d+$", re.ASCII)
else:
_cut_port_re = re.compile(r":\d+$")
def request_host(request):
"""Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
"""
url = request.full_url
host = urlparse(url)[1]
if host == "":
host = request.get_header("Host", "")
import string
import copy
from future.utils import istext, isbytes, PY2, PY3, with_metaclass
from future.types import no, issubset
from future.types.newobject import newobject
if PY2:
from collections import Iterable
else:
from collections.abc import Iterable
_builtin_bytes = bytes
if PY3:
# We'll probably never use newstr on Py3 anyway...
unicode = str
class BaseNewBytes(type):
def __instancecheck__(cls, instance):
if cls == newbytes:
return isinstance(instance, _builtin_bytes)
else:
return issubclass(instance.__class__, cls)
def _newchr(x):
if isinstance(x, str): # this happens on pypy
return x.encode('ascii')
else:
def bind_processor(self, dialect):
if PY3:
def process(value):
return self.python_type(
b"" if not value else utils.ip2bin(value)
)
else:
def process(value):
if not value:
return self.python_type(b"")
if isinstance(value, str) and INTERNAL_IP_PY2.search(value):
return self.python_type(value)
return self.python_type(utils.encode_hex(utils.ip2bin(value)))
return process
from __future__ import absolute_import
from future.standard_library import suspend_hooks
from future.utils import PY3
if PY3:
from urllib.parse import *
else:
__future_module__ = True
from urlparse import (ParseResult, SplitResult, parse_qs, parse_qsl,
urldefrag, urljoin, urlparse, urlsplit,
urlunparse, urlunsplit)
# we use this method to get at the original py2 urllib before any renaming
# quote = sys.py2_modules['urllib'].quote
# quote_plus = sys.py2_modules['urllib'].quote_plus
# unquote = sys.py2_modules['urllib'].unquote
# unquote_plus = sys.py2_modules['urllib'].unquote_plus
# urlencode = sys.py2_modules['urllib'].urlencode
# splitquery = sys.py2_modules['urllib'].splitquery
with suspend_hooks():
from __future__ import absolute_import
from future.utils import PY3
if PY3:
from http.server import *
else:
__future_module__ = True
from BaseHTTPServer import *
from CGIHTTPServer import *
from SimpleHTTPServer import *
try:
from CGIHTTPServer import _url_collapse_path # needed for a test
except ImportError:
try:
# Python 2.7.0 to 2.7.3
from CGIHTTPServer import (
_url_collapse_path_split as _url_collapse_path)
except ImportError:
# Doesn't exist on Python 2.6.x. Ignore it.
pass
from __future__ import absolute_import
from future.utils import PY3
if PY3:
from tkinter.font import *
else:
try:
from tkFont import *
except ImportError:
raise ImportError('The tkFont module is missing. Does your Py2 '
'installation include tkinter?')
def __str__(self):
if PY3:
return repr(self)
return self.__bytes__()
from __future__ import absolute_import
from future.utils import PY3
if PY3:
from pickle import *
else:
__future_module__ = True
try:
from cPickle import *
except ImportError:
from pickle import *