diff options
65 files changed, 115 insertions, 114 deletions
diff --git a/examples/mitmproxywrapper.py b/examples/mitmproxywrapper.py index 6841d05f..a3d831ac 100644 --- a/examples/mitmproxywrapper.py +++ b/examples/mitmproxywrapper.py @@ -15,7 +15,7 @@ import os import sys -class Wrapper(object): +class Wrapper(): def __init__(self, port, extra_arguments=None): self.port = port self.extra_arguments = extra_arguments diff --git a/examples/tls_passthrough.py b/examples/tls_passthrough.py index 20e8f9be..eaf78026 100644 --- a/examples/tls_passthrough.py +++ b/examples/tls_passthrough.py @@ -38,7 +38,7 @@ class InterceptionResult(Enum): skipped = None -class _TlsStrategy(object): +class _TlsStrategy(): """ Abstract base class for interception strategies. """ diff --git a/mitmproxy/addons.py b/mitmproxy/addons.py index b575b607..1d4f3835 100644 --- a/mitmproxy/addons.py +++ b/mitmproxy/addons.py @@ -7,7 +7,7 @@ def _get_name(itm): return getattr(itm, "name", itm.__class__.__name__.lower()) -class Addons(object): +class Addons(): def __init__(self, master): self.chain = [] self.master = master diff --git a/mitmproxy/builtins/dumper.py b/mitmproxy/builtins/dumper.py index 109059b8..e5d6e04d 100644 --- a/mitmproxy/builtins/dumper.py +++ b/mitmproxy/builtins/dumper.py @@ -20,7 +20,7 @@ def indent(n, text): return "\n".join(pad + i for i in l) -class Dumper(object): +class Dumper(): def __init__(self): self.filter = None # type: flowfilter.TFilter self.flow_detail = None # type: int diff --git a/mitmproxy/builtins/serverplayback.py b/mitmproxy/builtins/serverplayback.py index b495bc27..5ace1afe 100644 --- a/mitmproxy/builtins/serverplayback.py +++ b/mitmproxy/builtins/serverplayback.py @@ -6,7 +6,7 @@ from netlib import strutils from mitmproxy import exceptions, flow, ctx -class ServerPlayback(object): +class ServerPlayback(): def __init__(self): self.options = None diff --git a/mitmproxy/console/grideditor/base.py b/mitmproxy/console/grideditor/base.py index de1c0cf6..ecbbd0f9 100644 --- a/mitmproxy/console/grideditor/base.py +++ b/mitmproxy/console/grideditor/base.py @@ -35,7 +35,7 @@ class Cell(urwid.WidgetWrap): return True -class Column(object, metaclass=abc.ABCMeta): +class Column(metaclass=abc.ABCMeta): subeditor = None def __init__(self, heading): diff --git a/mitmproxy/console/grideditor/col_text.py b/mitmproxy/console/grideditor/col_text.py index 29c1abac..d94e41f9 100644 --- a/mitmproxy/console/grideditor/col_text.py +++ b/mitmproxy/console/grideditor/col_text.py @@ -26,8 +26,9 @@ class Column(col_bytes.Column): # This is the same for both edit and display. -class EncodingMixin(object): - def __init__(self, data: str, encoding_args): +class EncodingMixin(): + def __init__(self, data, encoding_args): + # type: (str) -> TDisplay self.encoding_args = encoding_args data = data.encode(*self.encoding_args) super(EncodingMixin, self).__init__(data) diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py index 24c4d396..38f6c094 100644 --- a/mitmproxy/contentviews.py +++ b/mitmproxy/contentviews.py @@ -93,7 +93,7 @@ def format_text(text): yield [("text", line)] -class View(object): +class View(): name = None prompt = () content_types = [] diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py index 579cf92d..397c906d 100644 --- a/mitmproxy/controller.py +++ b/mitmproxy/controller.py @@ -41,13 +41,13 @@ Events = frozenset([ ]) -class LogEntry(object): +class LogEntry(): def __init__(self, msg, level): self.msg = msg self.level = level -class Log(object): +class Log(): """ The central logger, exposed to scripts as mitmproxy.ctx.log. """ @@ -82,7 +82,7 @@ class Log(object): self.master.add_log(text, level) -class Master(object): +class Master(): """ The master handles mitmproxy's main event loop. """ @@ -185,7 +185,7 @@ class ServerThread(basethread.BaseThread): self.server.serve_forever() -class Channel(object): +class Channel(): """ The only way for the proxy server to communicate with the master is to use the channel it has been given. @@ -272,7 +272,7 @@ def handler(f): NO_REPLY = object() # special object we can distinguish from a valid "None" reply. -class Reply(object): +class Reply(): """ Messages sent through a channel are decorated with a "reply" attribute. This object is used to respond to the message through the return diff --git a/mitmproxy/flow/modules.py b/mitmproxy/flow/modules.py index 7d8a282e..40c5a3a5 100644 --- a/mitmproxy/flow/modules.py +++ b/mitmproxy/flow/modules.py @@ -32,7 +32,7 @@ class AppRegistry: return self.apps.get((host, request.port), None) -class StreamLargeBodies(object): +class StreamLargeBodies(): def __init__(self, max_size): self.max_size = max_size diff --git a/mitmproxy/flow/state.py b/mitmproxy/flow/state.py index f6395c79..5f8e9404 100644 --- a/mitmproxy/flow/state.py +++ b/mitmproxy/flow/state.py @@ -177,7 +177,7 @@ class FlowStore(FlowList): f.kill(master) -class State(object): +class State(): def __init__(self): self.flows = FlowStore() self.view = FlowView(self.flows, None) diff --git a/mitmproxy/flowfilter.py b/mitmproxy/flowfilter.py index cdbaf316..fca81c9b 100644 --- a/mitmproxy/flowfilter.py +++ b/mitmproxy/flowfilter.py @@ -58,7 +58,7 @@ def only(*types): return decorator -class _Token(object): +class _Token(): def dump(self, indent=0, fp=sys.stdout): print("{spacing}{name}{expr}".format( diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py index 92d32b2d..7b9a22ae 100644 --- a/mitmproxy/optmanager.py +++ b/mitmproxy/optmanager.py @@ -11,7 +11,7 @@ from mitmproxy import exceptions """ -class OptManager(object): +class OptManager(): """ .changed is a blinker Signal that triggers whenever options are updated. If any handler in the chain raises an exceptions.OptionsError diff --git a/mitmproxy/platform/linux.py b/mitmproxy/platform/linux.py index 38bfbe42..4c206a50 100644 --- a/mitmproxy/platform/linux.py +++ b/mitmproxy/platform/linux.py @@ -5,7 +5,7 @@ import struct SO_ORIGINAL_DST = 80 -class Resolver(object): +class Resolver(): def original_addr(self, csock): odestdata = csock.getsockopt(socket.SOL_IP, SO_ORIGINAL_DST, 16) diff --git a/mitmproxy/platform/osx.py b/mitmproxy/platform/osx.py index 6a555f32..97b74a12 100644 --- a/mitmproxy/platform/osx.py +++ b/mitmproxy/platform/osx.py @@ -15,7 +15,7 @@ from . import pf """ -class Resolver(object): +class Resolver(): STATECMD = ("sudo", "-n", "/sbin/pfctl", "-s", "state") def original_addr(self, csock): diff --git a/mitmproxy/platform/windows.py b/mitmproxy/platform/windows.py index 54d29c72..e1d2ef7c 100644 --- a/mitmproxy/platform/windows.py +++ b/mitmproxy/platform/windows.py @@ -16,7 +16,7 @@ import socketserver PROXY_API_PORT = 8085 -class Resolver(object): +class Resolver(): def __init__(self): TransparentProxy.setup() @@ -111,7 +111,7 @@ def MIB_TCPTABLE2(size): return _MIB_TCPTABLE2() -class TransparentProxy(object): +class TransparentProxy(): """ Transparent Windows Proxy for mitmproxy based on WinDivert/PyDivert. diff --git a/mitmproxy/protocol/base.py b/mitmproxy/protocol/base.py index b280ec35..d635e4f7 100644 --- a/mitmproxy/protocol/base.py +++ b/mitmproxy/protocol/base.py @@ -5,7 +5,7 @@ from mitmproxy import exceptions from mitmproxy import models -class _LayerCodeCompletion(object): +class _LayerCodeCompletion(): """ Dummy class that provides type hinting in PyCharm, which simplifies development a lot. @@ -88,7 +88,7 @@ class Layer(_LayerCodeCompletion): return type(self).__name__ -class ServerConnectionMixin(object): +class ServerConnectionMixin(): """ Mixin that provides a layer with the capabilities to manage a server connection. diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py index 54b61199..49faee29 100644 --- a/mitmproxy/protocol/http.py +++ b/mitmproxy/protocol/http.py @@ -61,7 +61,7 @@ class _HttpTransmissionLayer(base.Layer): raise NotImplementedError() -class ConnectServerConnection(object): +class ConnectServerConnection(): """ "Fake" ServerConnection to represent state after a CONNECT request to an upstream proxy. diff --git a/mitmproxy/protocol/tls.py b/mitmproxy/protocol/tls.py index 203d9c29..3e1659a1 100644 --- a/mitmproxy/protocol/tls.py +++ b/mitmproxy/protocol/tls.py @@ -248,7 +248,7 @@ def get_client_hello(client_conn): return client_hello -class TlsClientHello(object): +class TlsClientHello(): def __init__(self, raw_client_hello): self._client_hello = _constructs.ClientHello.parse(raw_client_hello) diff --git a/mitmproxy/proxy/config.py b/mitmproxy/proxy/config.py index bd1c3f62..467cbe56 100644 --- a/mitmproxy/proxy/config.py +++ b/mitmproxy/proxy/config.py @@ -20,7 +20,7 @@ from netlib.http import url CONF_BASENAME = "mitmproxy" -class HostMatcher(object): +class HostMatcher(): def __init__(self, patterns=tuple()): self.patterns = list(patterns) diff --git a/mitmproxy/proxy/root_context.py b/mitmproxy/proxy/root_context.py index d3f3c6df..e6715c66 100644 --- a/mitmproxy/proxy/root_context.py +++ b/mitmproxy/proxy/root_context.py @@ -7,7 +7,7 @@ from mitmproxy import protocol from mitmproxy.proxy import modes -class RootContext(object): +class RootContext(): """ The outermost context provided to the root layer. diff --git a/mitmproxy/proxy/server.py b/mitmproxy/proxy/server.py index 0fedaa74..4edbe9a0 100644 --- a/mitmproxy/proxy/server.py +++ b/mitmproxy/proxy/server.py @@ -62,7 +62,7 @@ class ProxyServer(tcp.TCPServer): h.handle() -class ConnectionHandler(object): +class ConnectionHandler(): def __init__(self, client_conn, client_address, config, channel): self.config = config diff --git a/mitmproxy/web/app.py b/mitmproxy/web/app.py index ea2203ee..570a6c56 100644 --- a/mitmproxy/web/app.py +++ b/mitmproxy/web/app.py @@ -73,7 +73,7 @@ class APIError(tornado.web.HTTPError): pass -class BasicAuth(object): +class BasicAuth(): def set_auth_headers(self): self.set_status(401) diff --git a/netlib/certutils.py b/netlib/certutils.py index 23836cb5..6f834466 100644 --- a/netlib/certutils.py +++ b/netlib/certutils.py @@ -155,7 +155,7 @@ def dummy_cert(privkey, cacert, commonname, sans): # return current.value -class CertStoreEntry(object): +class CertStoreEntry(): def __init__(self, cert, privatekey, chain_file): self.cert = cert @@ -163,7 +163,7 @@ class CertStoreEntry(object): self.chain_file = chain_file -class CertStore(object): +class CertStore(): """ Implements an in-memory certificate store. diff --git a/netlib/exceptions.py b/netlib/exceptions.py index dec79c22..2cef77cb 100644 --- a/netlib/exceptions.py +++ b/netlib/exceptions.py @@ -16,7 +16,7 @@ class NetlibException(Exception): super(NetlibException, self).__init__(message) -class Disconnect(object): +class Disconnect(): """Immediate EOF""" diff --git a/netlib/http/authentication.py b/netlib/http/authentication.py index 58fc9bdc..ea24f754 100644 --- a/netlib/http/authentication.py +++ b/netlib/http/authentication.py @@ -23,7 +23,7 @@ def assemble_http_basic_auth(scheme, username, password): return scheme + " " + v -class NullProxyAuth(object): +class NullProxyAuth(): """ No proxy auth at all (returns empty challange headers) @@ -90,7 +90,7 @@ class BasicProxyAuth(BasicAuth): AUTH_HEADER = 'Proxy-Authorization' -class PassMan(object): +class PassMan(): def test(self, username_, password_token_): return False diff --git a/netlib/http/message.py b/netlib/http/message.py index e44faf18..9927daee 100644 --- a/netlib/http/message.py +++ b/netlib/http/message.py @@ -283,7 +283,7 @@ class Message(basetypes.Serializable): self.content = body -class decoded(object): +class decoded(): """ Deprecated: You can now directly use :py:attr:`content`. :py:attr:`raw_content` has the encoded content. diff --git a/netlib/socks.py b/netlib/socks.py index 8d7c5279..41fde1cc 100644 --- a/netlib/socks.py +++ b/netlib/socks.py @@ -52,7 +52,7 @@ USERNAME_PASSWORD_VERSION = utils.BiDi( ) -class ClientGreeting(object): +class ClientGreeting(): __slots__ = ("ver", "methods") def __init__(self, ver, methods): @@ -89,7 +89,7 @@ class ClientGreeting(object): f.write(self.methods.tostring()) -class ServerGreeting(object): +class ServerGreeting(): __slots__ = ("ver", "method") def __init__(self, ver, method): @@ -117,7 +117,7 @@ class ServerGreeting(object): f.write(struct.pack("!BB", self.ver, self.method)) -class UsernamePasswordAuth(object): +class UsernamePasswordAuth(): __slots__ = ("ver", "username", "password") def __init__(self, ver, username, password): @@ -147,7 +147,7 @@ class UsernamePasswordAuth(object): f.write(self.password.encode()) -class UsernamePasswordAuthResponse(object): +class UsernamePasswordAuthResponse(): __slots__ = ("ver", "status") def __init__(self, ver, status): @@ -170,7 +170,7 @@ class UsernamePasswordAuthResponse(object): f.write(struct.pack("!BB", self.ver, self.status)) -class Message(object): +class Message(): __slots__ = ("ver", "msg", "atyp", "addr") def __init__(self, ver, msg, atyp, addr): diff --git a/netlib/tcp.py b/netlib/tcp.py index e4e134c4..a0e0b69d 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -72,7 +72,7 @@ sslversion_choices = { } -class SSLKeyLogger(object): +class SSLKeyLogger(): def __init__(self, filename): self.filename = filename @@ -111,7 +111,7 @@ log_ssl_key = SSLKeyLogger.create_logfun( os.getenv("MITMPROXY_SSLKEYLOGFILE") or os.getenv("SSLKEYLOGFILE")) -class _FileLike(object): +class _FileLike(): BLOCKSIZE = 1024 * 32 def __init__(self, o): @@ -426,7 +426,7 @@ def close_socket(sock): sock.close() -class _Connection(object): +class _Connection(): rbufsize = -1 wbufsize = -1 @@ -574,7 +574,7 @@ class _Connection(object): return context -class ConnectionCloser(object): +class ConnectionCloser(): def __init__(self, conn): self.conn = conn self._canceled = False @@ -888,7 +888,7 @@ class Counter: self._count -= 1 -class TCPServer(object): +class TCPServer(): request_queue_size = 20 def __init__(self, address): diff --git a/netlib/tutils.py b/netlib/tutils.py index 5f598fa9..3fbe58b9 100644 --- a/netlib/tutils.py +++ b/netlib/tutils.py @@ -72,7 +72,7 @@ def raises(expected_exception, obj=None, *args, **kwargs): raise AssertionError("No exception raised. Return value: {}".format(ret)) -class RaisesContext(object): +class RaisesContext(): def __init__(self, expected_exception): self.expected_exception = expected_exception diff --git a/netlib/utils.py b/netlib/utils.py index 8a8b15ea..190dda83 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -20,7 +20,7 @@ def getbit(byte, offset): return bool(byte & mask) -class BiDi(object): +class BiDi(): """ A wee utility class for keeping bi-directional mappings, like field @@ -49,7 +49,7 @@ class BiDi(object): return self.values.get(n, default) -class Data(object): +class Data(): def __init__(self, name): m = importlib.import_module(name) diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index 2b36d461..e2ff8906 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -43,7 +43,7 @@ CLOSE_REASON = utils.BiDi( ) -class FrameHeader(object): +class FrameHeader(): def __init__( self, @@ -193,7 +193,7 @@ class FrameHeader(object): return False -class Frame(object): +class Frame(): """ Represents a single WebSockets frame. Constructor takes human readable forms of the frame components. diff --git a/netlib/websockets/masker.py b/netlib/websockets/masker.py index 03b8f435..66407df6 100644 --- a/netlib/websockets/masker.py +++ b/netlib/websockets/masker.py @@ -1,7 +1,7 @@ from __future__ import absolute_import -class Masker(object): +class Masker(): """ Data sent from the server must be masked to prevent malicious clients from sending data over the wire in predictable patterns. diff --git a/netlib/wsgi.py b/netlib/wsgi.py index 17cbbf00..86b5ce40 100644 --- a/netlib/wsgi.py +++ b/netlib/wsgi.py @@ -8,20 +8,20 @@ import io from netlib import http, tcp, strutils -class ClientConn(object): +class ClientConn(): def __init__(self, address): self.address = tcp.Address.wrap(address) -class Flow(object): +class Flow(): def __init__(self, address, request): self.client_conn = ClientConn(address) self.request = request -class Request(object): +class Request(): def __init__(self, scheme, method, path, http_version, headers, content): self.scheme, self.method, self.path = scheme, method, path @@ -47,7 +47,7 @@ def date_time_string(): return s -class WSGIAdaptor(object): +class WSGIAdaptor(): def __init__(self, app, domain, port, sversion): self.app, self.domain, self.port, self.sversion = app, domain, port, sversion diff --git a/pathod/language/base.py b/pathod/language/base.py index bdcc6d2f..4483c3df 100644 --- a/pathod/language/base.py +++ b/pathod/language/base.py @@ -10,7 +10,7 @@ from netlib import human from . import generators, exceptions -class Settings(object): +class Settings(): def __init__( self, @@ -60,7 +60,7 @@ v_naked_literal = pp.MatchFirst( ) -class Token(object): +class Token(): """ A token in the specification language. Tokens are immutable. The token diff --git a/pathod/language/generators.py b/pathod/language/generators.py index 4040e099..6a543907 100644 --- a/pathod/language/generators.py +++ b/pathod/language/generators.py @@ -18,7 +18,7 @@ DATATYPES = dict( ) -class TransformGenerator(object): +class TransformGenerator(): """ Perform a byte-by-byte transform another generator - that is, for each @@ -54,7 +54,7 @@ def rand_byte(chars): return bytes([random.choice(chars)]) -class RandomGenerator(object): +class RandomGenerator(): def __init__(self, dtype, length): self.dtype = dtype @@ -73,7 +73,7 @@ class RandomGenerator(object): return "%s random from %s" % (self.length, self.dtype) -class FileGenerator(object): +class FileGenerator(): def __init__(self, path): self.path = path diff --git a/pathod/language/http.py b/pathod/language/http.py index 46027ca3..1f1a3db3 100644 --- a/pathod/language/http.py +++ b/pathod/language/http.py @@ -53,7 +53,7 @@ class Method(base.OptionsOrValue): ] -class _HeaderMixin(object): +class _HeaderMixin(): unique_name = None def format_header(self, key, value): diff --git a/pathod/language/http2.py b/pathod/language/http2.py index 519ee699..7cb82916 100644 --- a/pathod/language/http2.py +++ b/pathod/language/http2.py @@ -40,7 +40,7 @@ def get_header(val, headers): return None -class _HeaderMixin(object): +class _HeaderMixin(): unique_name = None def values(self, settings): diff --git a/pathod/language/message.py b/pathod/language/message.py index fea4f4de..7a8594d6 100644 --- a/pathod/language/message.py +++ b/pathod/language/message.py @@ -5,7 +5,7 @@ from netlib import strutils LOG_TRUNCATE = 1024 -class Message(object): +class Message(): __metaclass__ = abc.ABCMeta logattrs = [] diff --git a/pathod/log.py b/pathod/log.py index 1a709dc6..05934fd3 100644 --- a/pathod/log.py +++ b/pathod/log.py @@ -13,7 +13,7 @@ def write_raw(fp, lines, timestamp=True): fp.flush() -class LogCtx(object): +class LogCtx(): def __init__(self, fp, hex, timestamp, rfile, wfile): self.lines = [] diff --git a/pathod/pathoc.py b/pathod/pathoc.py index f122c14f..008308ca 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -34,7 +34,7 @@ class PathocError(Exception): pass -class SSLInfo(object): +class SSLInfo(): def __init__(self, certchain, cipher, alp): self.certchain, self.cipher, self.alp = certchain, cipher, alp diff --git a/pathod/pathod.py b/pathod/pathod.py index e882b73e..f67ad04e 100644 --- a/pathod/pathod.py +++ b/pathod/pathod.py @@ -30,7 +30,7 @@ class PathodError(Exception): pass -class SSLOptions(object): +class SSLOptions(): def __init__( self, confdir=CONFDIR, diff --git a/pathod/protocols/http.py b/pathod/protocols/http.py index 2ede2591..5ac8516f 100644 --- a/pathod/protocols/http.py +++ b/pathod/protocols/http.py @@ -4,7 +4,7 @@ from netlib.http import http1 from .. import language -class HTTPProtocol(object): +class HTTPProtocol(): def __init__(self, pathod_handler): self.pathod_handler = pathod_handler diff --git a/pathod/protocols/http2.py b/pathod/protocols/http2.py index 78fe6111..42f1a1a0 100644 --- a/pathod/protocols/http2.py +++ b/pathod/protocols/http2.py @@ -15,14 +15,14 @@ import netlib.http.request from .. import language -class TCPHandler(object): +class TCPHandler(): def __init__(self, rfile, wfile=None): self.rfile = rfile self.wfile = wfile -class HTTP2StateProtocol(object): +class HTTP2StateProtocol(): ERROR_CODES = utils.BiDi( NO_ERROR=0x0, @@ -403,7 +403,7 @@ class HTTP2StateProtocol(object): return stream_id, headers, body -class HTTP2Protocol(object): +class HTTP2Protocol(): def __init__(self, pathod_handler): self.pathod_handler = pathod_handler diff --git a/pathod/utils.py b/pathod/utils.py index 9b220e9a..07b6933e 100644 --- a/pathod/utils.py +++ b/pathod/utils.py @@ -3,7 +3,7 @@ import sys import netlib.utils -class MemBool(object): +class MemBool(): """ Truth-checking with a memory, for use in chained if statements. diff --git a/test/mitmproxy/protocol/test_http1.py b/test/mitmproxy/protocol/test_http1.py index 2fc4ac63..3bf1210e 100644 --- a/test/mitmproxy/protocol/test_http1.py +++ b/test/mitmproxy/protocol/test_http1.py @@ -6,7 +6,7 @@ from netlib.tutils import treq from .. import tutils, tservers -class TestHTTPFlow(object): +class TestHTTPFlow(): def test_repr(self): f = tutils.tflow(resp=True, err=True) diff --git a/test/mitmproxy/protocol/test_http2.py b/test/mitmproxy/protocol/test_http2.py index c4bd2049..c0f7007d 100644 --- a/test/mitmproxy/protocol/test_http2.py +++ b/test/mitmproxy/protocol/test_http2.py @@ -89,7 +89,7 @@ class _Http2ServerBase(netlib_tservers.ServerTestBase): raise NotImplementedError() -class _Http2TestBase(object): +class _Http2TestBase(): @classmethod def setup_class(cls): diff --git a/test/mitmproxy/protocol/test_websockets.py b/test/mitmproxy/protocol/test_websockets.py index e2361d89..f7756f25 100644 --- a/test/mitmproxy/protocol/test_websockets.py +++ b/test/mitmproxy/protocol/test_websockets.py @@ -44,7 +44,7 @@ class _WebSocketsServerBase(netlib_tservers.ServerTestBase): traceback.print_exc() -class _WebSocketsTestBase(object): +class _WebSocketsTestBase(): @classmethod def setup_class(cls): diff --git a/test/mitmproxy/test_controller.py b/test/mitmproxy/test_controller.py index 660ce111..bd3dfe4e 100644 --- a/test/mitmproxy/test_controller.py +++ b/test/mitmproxy/test_controller.py @@ -15,7 +15,7 @@ class TMsg: pass -class TestMaster(object): +class TestMaster(): def test_simple(self): class DummyMaster(controller.Master): @controller.handler @@ -44,7 +44,7 @@ class TestMaster(object): m.shutdown() -class TestServerThread(object): +class TestServerThread(): def test_simple(self): m = Mock() t = controller.ServerThread(m) @@ -52,7 +52,7 @@ class TestServerThread(object): assert m.serve_forever.called -class TestChannel(object): +class TestChannel(): def test_tell(self): q = queue.Queue() channel = controller.Channel(q, Event()) @@ -86,7 +86,7 @@ class TestChannel(object): channel.ask("test", Mock(name="test_ask_shutdown")) -class TestReply(object): +class TestReply(): def test_simple(self): reply = controller.Reply(42) assert reply.state == "unhandled" @@ -179,7 +179,7 @@ class TestReply(object): reply.commit() -class TestDummyReply(object): +class TestDummyReply(): def test_simple(self): reply = controller.DummyReply() for _ in range(2): diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py index cc9d2691..b4052c62 100644 --- a/test/mitmproxy/test_flow.py +++ b/test/mitmproxy/test_flow.py @@ -37,7 +37,7 @@ def test_app_registry(): assert ar.get(r) -class TestHTTPFlow(object): +class TestHTTPFlow(): def test_copy(self): f = tutils.tflow(resp=True) diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py index f7c64e50..48bb94ca 100644 --- a/test/mitmproxy/test_proxy.py +++ b/test/mitmproxy/test_proxy.py @@ -14,7 +14,7 @@ from netlib.http import http1 from . import tutils -class TestServerConnection(object): +class TestServerConnection(): def test_simple(self): self.d = test.Daemon() diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index d3806a99..e597570e 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -74,7 +74,7 @@ class ProxyThread(threading.Thread): self.tmaster.shutdown() -class ProxyTestBase(object): +class ProxyTestBase(): # Test Configuration ssl = None ssloptions = False diff --git a/test/netlib/http/http1/test_read.py b/test/netlib/http/http1/test_read.py index 44eff2ee..fb27857b 100644 --- a/test/netlib/http/http1/test_read.py +++ b/test/netlib/http/http1/test_read.py @@ -104,7 +104,7 @@ def test_read_response_head(): assert rfile.read() == b"skip" -class TestReadBody(object): +class TestReadBody(): def test_chunked(self): rfile = BytesIO(b"3\r\nfoo\r\n0\r\n\r\nbar") body = b"".join(read_body(rfile, None)) @@ -289,7 +289,7 @@ def test_check_http_version(): _check_http_version(b"HTTP/1.b") -class TestReadHeaders(object): +class TestReadHeaders(): @staticmethod def _read(data): return _read_headers(BytesIO(data)) diff --git a/test/netlib/http/test_headers.py b/test/netlib/http/test_headers.py index e8752c52..d214ca02 100644 --- a/test/netlib/http/test_headers.py +++ b/test/netlib/http/test_headers.py @@ -4,7 +4,7 @@ from netlib.http.headers import Headers, parse_content_type, assemble_content_ty from netlib.tutils import raises -class TestHeaders(object): +class TestHeaders(): def _2host(self): return Headers( ( diff --git a/test/netlib/http/test_message.py b/test/netlib/http/test_message.py index 5d533ad7..9a5b80ed 100644 --- a/test/netlib/http/test_message.py +++ b/test/netlib/http/test_message.py @@ -36,7 +36,7 @@ def _test_decoded_attr(message, attr): assert getattr(message.data, attr) == b"FOO\xBF\x00BAR" -class TestMessageData(object): +class TestMessageData(): def test_eq_ne(self): data = tresp(timestamp_start=42, timestamp_end=42).data same = tresp(timestamp_start=42, timestamp_end=42).data @@ -50,7 +50,7 @@ class TestMessageData(object): assert data != 0 -class TestMessage(object): +class TestMessage(): def test_init(self): resp = tresp() @@ -108,7 +108,7 @@ class TestMessage(object): assert r.content == b"ggfootoo" -class TestMessageContentEncoding(object): +class TestMessageContentEncoding(): def test_simple(self): r = tresp() assert r.raw_content == b"message" @@ -186,7 +186,7 @@ class TestMessageContentEncoding(object): assert "content-encoding" not in r.headers -class TestMessageText(object): +class TestMessageText(): def test_simple(self): r = tresp(content=b'\xfc') assert r.raw_content == b"\xfc" diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py index 1f01d29d..bcb1cc43 100644 --- a/test/netlib/http/test_request.py +++ b/test/netlib/http/test_request.py @@ -6,7 +6,7 @@ from netlib.tutils import treq, raises from .test_message import _test_decoded_attr, _test_passthrough_attr -class TestRequestData(object): +class TestRequestData(): def test_init(self): with raises(ValueError): treq(headers="foobar") @@ -14,7 +14,7 @@ class TestRequestData(object): assert isinstance(treq(headers=()).headers, Headers) -class TestRequestCore(object): +class TestRequestCore(): """ Tests for builtins and the attributes that are directly proxied from the data structure """ @@ -92,7 +92,7 @@ class TestRequestCore(object): assert request.headers["Host"] == "example.org" -class TestRequestUtils(object): +class TestRequestUtils(): """ Tests for additional convenience methods. """ diff --git a/test/netlib/http/test_response.py b/test/netlib/http/test_response.py index e97cc419..6ab043c1 100644 --- a/test/netlib/http/test_response.py +++ b/test/netlib/http/test_response.py @@ -11,7 +11,7 @@ from netlib.tutils import raises, tresp from .test_message import _test_passthrough_attr, _test_decoded_attr -class TestResponseData(object): +class TestResponseData(): def test_init(self): with raises(ValueError): tresp(headers="foobar") @@ -19,7 +19,7 @@ class TestResponseData(object): assert isinstance(tresp(headers=()).headers, Headers) -class TestResponseCore(object): +class TestResponseCore(): """ Tests for builtins and the attributes that are directly proxied from the data structure """ @@ -60,7 +60,7 @@ class TestResponseCore(object): _test_decoded_attr(tresp(), "reason") -class TestResponseUtils(object): +class TestResponseUtils(): """ Tests for additional convenience methods. """ diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py index 58ae0f98..bad5e2b4 100644 --- a/test/netlib/test_multidict.py +++ b/test/netlib/test_multidict.py @@ -2,7 +2,7 @@ from netlib import tutils from netlib.multidict import MultiDict, ImmutableMultiDict, MultiDictView -class _TMulti(object): +class _TMulti(): @staticmethod def _kconv(key): return key.lower() @@ -16,7 +16,7 @@ class TImmutableMultiDict(_TMulti, ImmutableMultiDict): pass -class TestMultiDict(object): +class TestMultiDict(): @staticmethod def _multi(): return TMultiDict(( @@ -194,7 +194,7 @@ class TestMultiDict(object): assert md == md2 -class TestImmutableMultiDict(object): +class TestImmutableMultiDict(): def test_modify(self): md = TImmutableMultiDict() with tutils.raises(TypeError): @@ -224,7 +224,7 @@ class TestImmutableMultiDict(object): assert md.with_insert(0, "foo", "bar").fields == (("foo", "bar"),) -class TParent(object): +class TParent(): def __init__(self): self.vals = tuple() @@ -235,7 +235,7 @@ class TParent(object): return self.vals -class TestMultiDictView(object): +class TestMultiDictView(): def test_modify(self): p = TParent() tv = MultiDictView(p.getter, p.setter) diff --git a/test/netlib/tservers.py b/test/netlib/tservers.py index 10a6f70a..d22be413 100644 --- a/test/netlib/tservers.py +++ b/test/netlib/tservers.py @@ -85,7 +85,7 @@ class _TServer(tcp.TCPServer): self.q.put(s.getvalue()) -class ServerTestBase(object): +class ServerTestBase(): ssl = None handler = None addr = ("localhost", 0) diff --git a/test/netlib/websockets/test_frame.py b/test/netlib/websockets/test_frame.py index cce39454..265d2513 100644 --- a/test/netlib/websockets/test_frame.py +++ b/test/netlib/websockets/test_frame.py @@ -6,7 +6,7 @@ from netlib import websockets from netlib import tutils -class TestFrameHeader(object): +class TestFrameHeader(): @pytest.mark.parametrize("input,expected", [ (0, '0100'), @@ -123,7 +123,7 @@ class TestFrameHeader(object): assert f.masking_key -class TestFrame(object): +class TestFrame(): def test_equality(self): f = websockets.Frame(payload=b'1234') f2 = websockets.Frame(payload=b'1234') diff --git a/test/netlib/websockets/test_masker.py b/test/netlib/websockets/test_masker.py index 528fce71..a06fd079 100644 --- a/test/netlib/websockets/test_masker.py +++ b/test/netlib/websockets/test_masker.py @@ -4,7 +4,7 @@ import pytest from netlib import websockets -class TestMasker(object): +class TestMasker(): @pytest.mark.parametrize("input,expected", [ ([b"a"], '00'), diff --git a/test/netlib/websockets/test_utils.py b/test/netlib/websockets/test_utils.py index 34765e04..7e3f02f9 100644 --- a/test/netlib/websockets/test_utils.py +++ b/test/netlib/websockets/test_utils.py @@ -4,7 +4,7 @@ from netlib import http from netlib import websockets -class TestUtils(object): +class TestUtils(): def test_client_handshake_headers(self): h = websockets.client_handshake_headers(version='42') diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py index d119348a..69b7a604 100644 --- a/test/pathod/test_pathod.py +++ b/test/pathod/test_pathod.py @@ -7,7 +7,7 @@ from netlib.exceptions import HttpException, TlsException from . import tutils -class TestPathod(object): +class TestPathod(): def test_logging(self): s = io.StringIO() diff --git a/test/pathod/test_protocols_http2.py b/test/pathod/test_protocols_http2.py index 7f65c0eb..24353927 100644 --- a/test/pathod/test_protocols_http2.py +++ b/test/pathod/test_protocols_http2.py @@ -169,7 +169,7 @@ class TestPerformClientConnectionPreface(netlib_tservers.ServerTestBase): assert protocol.connection_preface_performed -class TestClientStreamIds(object): +class TestClientStreamIds(): c = tcp.TCPClient(("127.0.0.1", 0)) protocol = HTTP2StateProtocol(c) @@ -183,7 +183,7 @@ class TestClientStreamIds(object): assert self.protocol.current_stream_id == 5 -class TestserverstreamIds(object): +class TestserverstreamIds(): c = tcp.TCPClient(("127.0.0.1", 0)) protocol = HTTP2StateProtocol(c, is_server=True) @@ -230,7 +230,7 @@ class TestApplySettings(netlib_tservers.ServerTestBase): hyperframe.frame.SettingsFrame.INITIAL_WINDOW_SIZE] == 'deadbeef' -class TestCreateHeaders(object): +class TestCreateHeaders(): c = tcp.TCPClient(("127.0.0.1", 0)) def test_create_headers(self): @@ -267,7 +267,7 @@ class TestCreateHeaders(object): assert bytes[2] == codecs.decode('00000209040000000163d5', 'hex_codec') -class TestCreateBody(object): +class TestCreateBody(): c = tcp.TCPClient(("127.0.0.1", 0)) def test_create_body_empty(self): @@ -422,7 +422,7 @@ class TestReadEmptyResponse(netlib_tservers.ServerTestBase): assert resp.content == b'' -class TestAssembleRequest(object): +class TestAssembleRequest(): c = tcp.TCPClient(("127.0.0.1", 0)) def test_request_simple(self): @@ -476,7 +476,7 @@ class TestAssembleRequest(object): codecs.decode('000006000100000001666f6f626172', 'hex_codec') -class TestAssembleResponse(object): +class TestAssembleResponse(): c = tcp.TCPClient(("127.0.0.1", 0)) def test_simple(self): diff --git a/test/pathod/tutils.py b/test/pathod/tutils.py index 518485ba..6ebf25a8 100644 --- a/test/pathod/tutils.py +++ b/test/pathod/tutils.py @@ -23,7 +23,7 @@ def treader(bytes): return tcp.Reader(fp) -class DaemonTests(object): +class DaemonTests(): nohang = False ssl = False timeout = None |