diff options
Diffstat (limited to 'netlib')
30 files changed, 21 insertions, 47 deletions
diff --git a/netlib/__init__.py b/netlib/__init__.py index 9b4faa33..e69de29b 100644 --- a/netlib/__init__.py +++ b/netlib/__init__.py @@ -1 +0,0 @@ -from __future__ import (absolute_import, print_function, division) diff --git a/netlib/basethread.py b/netlib/basethread.py index 7963eb7e..a3c81d19 100644 --- a/netlib/basethread.py +++ b/netlib/basethread.py @@ -4,7 +4,7 @@ import threading class BaseThread(threading.Thread): def __init__(self, name, *args, **kwargs): - super(BaseThread, self).__init__(name=name, *args, **kwargs) + super().__init__(name=name, *args, **kwargs) self._thread_started = time.time() def _threadinfo(self): diff --git a/netlib/certutils.py b/netlib/certutils.py index 340376d7..6a97f99e 100644 --- a/netlib/certutils.py +++ b/netlib/certutils.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import os import ssl import time diff --git a/netlib/debug.py b/netlib/debug.py index 450b058a..2f6e8770 100644 --- a/netlib/debug.py +++ b/netlib/debug.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import gc import os diff --git a/netlib/encoding.py b/netlib/encoding.py index a6ae9a96..e123a033 100644 --- a/netlib/encoding.py +++ b/netlib/encoding.py @@ -1,7 +1,6 @@ """ Utility functions for decoding response bodies. """ -from __future__ import absolute_import import codecs import collections diff --git a/netlib/exceptions.py b/netlib/exceptions.py index 1787cb72..d0b15d27 100644 --- a/netlib/exceptions.py +++ b/netlib/exceptions.py @@ -5,7 +5,6 @@ Every Exception netlib raises shall be a subclass of NetlibException. See also: http://lucumr.pocoo.org/2014/10/16/on-error-handling/ """ -from __future__ import absolute_import, print_function, division class NetlibException(Exception): @@ -13,7 +12,7 @@ class NetlibException(Exception): Base class for all exceptions thrown by netlib. """ def __init__(self, message=None): - super(NetlibException, self).__init__(message) + super().__init__(message) class Disconnect: diff --git a/netlib/http/__init__.py b/netlib/http/__init__.py index 436b5965..315f61ac 100644 --- a/netlib/http/__init__.py +++ b/netlib/http/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from netlib.http.request import Request from netlib.http.response import Response from netlib.http.message import Message diff --git a/netlib/http/authentication.py b/netlib/http/authentication.py index efaa7f53..a65279e4 100644 --- a/netlib/http/authentication.py +++ b/netlib/http/authentication.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import argparse import binascii diff --git a/netlib/http/headers.py b/netlib/http/headers.py index 7d46a88e..b620c2c7 100644 --- a/netlib/http/headers.py +++ b/netlib/http/headers.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import re @@ -77,7 +76,7 @@ class Headers(multidict.MultiDict): If ``**headers`` contains multiple keys that have equal ``.lower()`` s, the behavior is undefined. """ - super(Headers, self).__init__(fields) + super().__init__(fields) for key, value in self.fields: if not isinstance(key, bytes) or not isinstance(value, bytes): @@ -108,10 +107,10 @@ class Headers(multidict.MultiDict): def __delitem__(self, key): key = _always_bytes(key) - super(Headers, self).__delitem__(key) + super().__delitem__(key) def __iter__(self): - for x in super(Headers, self).__iter__(): + for x in super().__iter__(): yield _native(x) def get_all(self, name): @@ -123,7 +122,7 @@ class Headers(multidict.MultiDict): name = _always_bytes(name) return [ _native(x) for x in - super(Headers, self).get_all(name) + super().get_all(name) ] def set_all(self, name, values): @@ -133,12 +132,12 @@ class Headers(multidict.MultiDict): """ name = _always_bytes(name) values = [_always_bytes(x) for x in values] - return super(Headers, self).set_all(name, values) + return super().set_all(name, values) def insert(self, index, key, value): key = _always_bytes(key) value = _always_bytes(value) - super(Headers, self).insert(index, key, value) + super().insert(index, key, value) def items(self, multi=False): if multi: @@ -147,7 +146,7 @@ class Headers(multidict.MultiDict): for k, v in self.fields ) else: - return super(Headers, self).items() + return super().items() def replace(self, pattern, repl, flags=0, count=0): """ diff --git a/netlib/http/http1/__init__.py b/netlib/http/http1/__init__.py index 2aa7e26a..e4bf01c5 100644 --- a/netlib/http/http1/__init__.py +++ b/netlib/http/http1/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from .read import ( read_request, read_request_head, read_response, read_response_head, diff --git a/netlib/http/http1/assemble.py b/netlib/http/http1/assemble.py index e74732d2..737a4ec9 100644 --- a/netlib/http/http1/assemble.py +++ b/netlib/http/http1/assemble.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import netlib.http.url from netlib import exceptions diff --git a/netlib/http/http1/read.py b/netlib/http/http1/read.py index 70fffbd4..4c00a96a 100644 --- a/netlib/http/http1/read.py +++ b/netlib/http/http1/read.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import time import sys import re diff --git a/netlib/http/http2/__init__.py b/netlib/http/http2/__init__.py index 7f84a1ab..c99eb6cb 100644 --- a/netlib/http/http2/__init__.py +++ b/netlib/http/http2/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from netlib.http.http2.framereader import read_raw_frame, parse_frame from netlib.http.http2.utils import parse_headers diff --git a/netlib/http/message.py b/netlib/http/message.py index e693db1d..aa37cc58 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import re import warnings diff --git a/netlib/http/request.py b/netlib/http/request.py index 7a83894b..a9896ec7 100644 --- a/netlib/http/request.py +++ b/netlib/http/request.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import re import urllib @@ -65,7 +64,7 @@ class Request(message.Message): An HTTP request. """ def __init__(self, *args, **kwargs): - super(Request, self).__init__() + super().__init__() self.data = RequestData(*args, **kwargs) def __repr__(self): @@ -92,7 +91,7 @@ class Request(message.Message): if isinstance(repl, str): repl = strutils.escaped_str_to_bytes(repl) - c = super(Request, self).replace(pattern, repl, flags, count) + c = super().replace(pattern, repl, flags, count) self.path, pc = re.subn( pattern, repl, self.data.path, flags=flags, count=count ) diff --git a/netlib/http/response.py b/netlib/http/response.py index 02a93fa7..81beb81d 100644 --- a/netlib/http/response.py +++ b/netlib/http/response.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import time from email.utils import parsedate_tz, formatdate, mktime_tz @@ -49,7 +48,7 @@ class Response(message.Message): An HTTP response. """ def __init__(self, *args, **kwargs): - super(Response, self).__init__() + super().__init__() self.data = ResponseData(*args, **kwargs) def __repr__(self): diff --git a/netlib/http/status_codes.py b/netlib/http/status_codes.py index 8a4dc1f5..55d337be 100644 --- a/netlib/http/status_codes.py +++ b/netlib/http/status_codes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division CONTINUE = 100 SWITCHING = 101 diff --git a/netlib/http/user_agents.py b/netlib/http/user_agents.py index e8681908..4fd02e89 100644 --- a/netlib/http/user_agents.py +++ b/netlib/http/user_agents.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) """ A small collection of useful user-agent header strings. These should be diff --git a/netlib/multidict.py b/netlib/multidict.py index b8626731..72d88122 100644 --- a/netlib/multidict.py +++ b/netlib/multidict.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from abc import ABCMeta, abstractmethod @@ -163,7 +162,7 @@ class _MultiDict(MutableMapping, basetypes.Serializable, metaclass=ABCMeta): if multi: return self.fields else: - return super(_MultiDict, self).items() + return super().items() def collect(self): """ @@ -215,7 +214,7 @@ class _MultiDict(MutableMapping, basetypes.Serializable, metaclass=ABCMeta): class MultiDict(_MultiDict): def __init__(self, fields=()): - super(MultiDict, self).__init__() + super().__init__() self.fields = tuple( tuple(i) for i in fields ) @@ -244,6 +243,7 @@ class ImmutableMultiDict(MultiDict, metaclass=ABCMeta): An updated ImmutableMultiDict. The original object will not be modified. """ ret = self.copy() + # FIXME: This is filthy... super(ImmutableMultiDict, ret).__delitem__(key) return ret @@ -253,6 +253,7 @@ class ImmutableMultiDict(MultiDict, metaclass=ABCMeta): An updated ImmutableMultiDict. The original object will not be modified. """ ret = self.copy() + # FIXME: This is filthy... super(ImmutableMultiDict, ret).set_all(key, values) return ret @@ -262,6 +263,7 @@ class ImmutableMultiDict(MultiDict, metaclass=ABCMeta): An updated ImmutableMultiDict. The original object will not be modified. """ ret = self.copy() + # FIXME: This is filthy... super(ImmutableMultiDict, ret).insert(index, key, value) return ret @@ -275,7 +277,7 @@ class MultiDictView(_MultiDict): def __init__(self, getter, setter): self._getter = getter self._setter = setter - super(MultiDictView, self).__init__() + super().__init__() @staticmethod def _kconv(key): diff --git a/netlib/socks.py b/netlib/socks.py index 5b28a8cd..9f1adb98 100644 --- a/netlib/socks.py +++ b/netlib/socks.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import struct import array import ipaddress @@ -8,7 +7,7 @@ from netlib import tcp, utils class SocksError(Exception): def __init__(self, code, message): - super(SocksError, self).__init__(message) + super().__init__(message) self.code = code VERSION = utils.BiDi( diff --git a/netlib/strutils.py b/netlib/strutils.py index 1f7db949..57cfbc79 100644 --- a/netlib/strutils.py +++ b/netlib/strutils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import re import codecs diff --git a/netlib/tcp.py b/netlib/tcp.py index 05ceef5a..aeb1d447 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import os import select import socket @@ -597,7 +596,7 @@ class ConnectionCloser: class TCPClient(_Connection): def __init__(self, address, source_address=None, spoof_source_address=None): - super(TCPClient, self).__init__(None) + super().__init__(None) self.address = address self.source_address = source_address self.cert = None @@ -769,7 +768,7 @@ class BaseHandler(_Connection): """ def __init__(self, connection, address, server): - super(BaseHandler, self).__init__(connection) + super().__init__(connection) self.address = Address.wrap(address) self.server = server self.clientcert = None diff --git a/netlib/utils.py b/netlib/utils.py index 1a18dfcd..8cd9ba6e 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import os.path import re import importlib diff --git a/netlib/version.py b/netlib/version.py index eea70484..c7ca8d01 100644 --- a/netlib/version.py +++ b/netlib/version.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) IVERSION = (0, 19) VERSION = ".".join(str(i) for i in IVERSION) diff --git a/netlib/version_check.py b/netlib/version_check.py index 7091146d..547c031c 100644 --- a/netlib/version_check.py +++ b/netlib/version_check.py @@ -3,7 +3,6 @@ Having installed a wrong version of pyOpenSSL or netlib is unfortunately a very common source of error. Check before every start that both versions are somewhat okay. """ -from __future__ import division, absolute_import, print_function import sys import inspect import os.path diff --git a/netlib/websockets/__init__.py b/netlib/websockets/__init__.py index e14e8a7d..06c8f9bc 100644 --- a/netlib/websockets/__init__.py +++ b/netlib/websockets/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from .frame import FrameHeader from .frame import Frame diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index eb7d9ccd..b58fa289 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import import os import struct import io diff --git a/netlib/websockets/masker.py b/netlib/websockets/masker.py index f4f489a6..1c8330b1 100644 --- a/netlib/websockets/masker.py +++ b/netlib/websockets/masker.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import class Masker: diff --git a/netlib/websockets/utils.py b/netlib/websockets/utils.py index aa0d39a1..fdec074e 100644 --- a/netlib/websockets/utils.py +++ b/netlib/websockets/utils.py @@ -3,7 +3,6 @@ Collection of WebSockets Protocol utility functions (RFC6455) Spec: https://tools.ietf.org/html/rfc6455 """ -from __future__ import absolute_import import base64 import hashlib diff --git a/netlib/wsgi.py b/netlib/wsgi.py index 07e0c9db..8e8445f6 100644 --- a/netlib/wsgi.py +++ b/netlib/wsgi.py @@ -1,4 +1,3 @@ -from __future__ import (absolute_import, print_function, division) import time import traceback |