aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-17 17:29:45 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-17 17:37:08 +1300
commita647b30365593a4a3056fcf6936f5441ab9eda88 (patch)
tree079b18790be5dfcc9a88f19e282b57088574d223
parentfb22f2ff4f75783ba786935c93b75f372ede21f5 (diff)
downloadmitmproxy-a647b30365593a4a3056fcf6936f5441ab9eda88.tar.gz
mitmproxy-a647b30365593a4a3056fcf6936f5441ab9eda88.tar.bz2
mitmproxy-a647b30365593a4a3056fcf6936f5441ab9eda88.zip
python3: clean up class brackets
-rw-r--r--examples/mitmproxywrapper.py2
-rw-r--r--examples/tls_passthrough.py2
-rw-r--r--mitmproxy/addons.py2
-rw-r--r--mitmproxy/builtins/dumper.py2
-rw-r--r--mitmproxy/builtins/script.py2
-rw-r--r--mitmproxy/builtins/serverplayback.py2
-rw-r--r--mitmproxy/console/grideditor/col_text.py2
-rw-r--r--mitmproxy/contentviews.py2
-rw-r--r--mitmproxy/controller.py10
-rw-r--r--mitmproxy/flow/modules.py2
-rw-r--r--mitmproxy/flow/state.py2
-rw-r--r--mitmproxy/flowfilter.py2
-rw-r--r--mitmproxy/optmanager.py2
-rw-r--r--mitmproxy/platform/linux.py2
-rw-r--r--mitmproxy/platform/osx.py2
-rw-r--r--mitmproxy/platform/windows.py4
-rw-r--r--mitmproxy/protocol/base.py4
-rw-r--r--mitmproxy/protocol/http.py2
-rw-r--r--mitmproxy/protocol/tls.py2
-rw-r--r--mitmproxy/proxy/config.py2
-rw-r--r--mitmproxy/proxy/root_context.py2
-rw-r--r--mitmproxy/proxy/server.py2
-rw-r--r--mitmproxy/web/app.py2
-rw-r--r--netlib/certutils.py4
-rw-r--r--netlib/exceptions.py2
-rw-r--r--netlib/http/authentication.py4
-rw-r--r--netlib/http/message.py2
-rw-r--r--netlib/socks.py10
-rw-r--r--netlib/tcp.py10
-rw-r--r--netlib/tutils.py2
-rw-r--r--netlib/utils.py4
-rw-r--r--netlib/websockets/frame.py4
-rw-r--r--netlib/websockets/masker.py2
-rw-r--r--netlib/wsgi.py8
-rw-r--r--pathod/language/base.py4
-rw-r--r--pathod/language/generators.py6
-rw-r--r--pathod/language/http.py2
-rw-r--r--pathod/language/http2.py2
-rw-r--r--pathod/language/message.py2
-rw-r--r--pathod/log.py2
-rw-r--r--pathod/pathoc.py2
-rw-r--r--pathod/pathod.py2
-rw-r--r--pathod/protocols/http.py2
-rw-r--r--pathod/protocols/http2.py6
-rw-r--r--pathod/utils.py2
-rw-r--r--test/mitmproxy/console/test_pathedit.py2
-rw-r--r--test/mitmproxy/protocol/test_http1.py2
-rw-r--r--test/mitmproxy/protocol/test_http2.py2
-rw-r--r--test/mitmproxy/protocol/test_websockets.py2
-rw-r--r--test/mitmproxy/test_controller.py10
-rw-r--r--test/mitmproxy/test_examples.py2
-rw-r--r--test/mitmproxy/test_flow.py2
-rw-r--r--test/mitmproxy/test_flow_export.py12
-rw-r--r--test/mitmproxy/test_proxy.py2
-rw-r--r--test/mitmproxy/tservers.py2
-rw-r--r--test/netlib/http/http1/test_read.py4
-rw-r--r--test/netlib/http/test_headers.py2
-rw-r--r--test/netlib/http/test_message.py8
-rw-r--r--test/netlib/http/test_request.py6
-rw-r--r--test/netlib/http/test_response.py6
-rw-r--r--test/netlib/test_multidict.py10
-rw-r--r--test/netlib/tservers.py2
-rw-r--r--test/netlib/websockets/test_frame.py4
-rw-r--r--test/netlib/websockets/test_masker.py2
-rw-r--r--test/netlib/websockets/test_utils.py2
-rw-r--r--test/pathod/test_language_base.py2
-rw-r--r--test/pathod/test_pathod.py2
-rw-r--r--test/pathod/test_protocols_http2.py12
-rw-r--r--test/pathod/tutils.py2
69 files changed, 122 insertions, 122 deletions
diff --git a/examples/mitmproxywrapper.py b/examples/mitmproxywrapper.py
index a3d831ac..eade0fe2 100644
--- a/examples/mitmproxywrapper.py
+++ b/examples/mitmproxywrapper.py
@@ -15,7 +15,7 @@ import os
import sys
-class Wrapper():
+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 eaf78026..79d5fa00 100644
--- a/examples/tls_passthrough.py
+++ b/examples/tls_passthrough.py
@@ -38,7 +38,7 @@ class InterceptionResult(Enum):
skipped = None
-class _TlsStrategy():
+class _TlsStrategy:
"""
Abstract base class for interception strategies.
"""
diff --git a/mitmproxy/addons.py b/mitmproxy/addons.py
index 1d4f3835..1802da68 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():
+class Addons:
def __init__(self, master):
self.chain = []
self.master = master
diff --git a/mitmproxy/builtins/dumper.py b/mitmproxy/builtins/dumper.py
index e5d6e04d..ecaa05ec 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():
+class Dumper:
def __init__(self):
self.filter = None # type: flowfilter.TFilter
self.flow_detail = None # type: int
diff --git a/mitmproxy/builtins/script.py b/mitmproxy/builtins/script.py
index 9bf25703..a77ca32a 100644
--- a/mitmproxy/builtins/script.py
+++ b/mitmproxy/builtins/script.py
@@ -215,7 +215,7 @@ class Script:
self.dead = True
-class ScriptLoader():
+class ScriptLoader:
"""
An addon that manages loading scripts from options.
"""
diff --git a/mitmproxy/builtins/serverplayback.py b/mitmproxy/builtins/serverplayback.py
index 5ace1afe..9d551511 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():
+class ServerPlayback:
def __init__(self):
self.options = None
diff --git a/mitmproxy/console/grideditor/col_text.py b/mitmproxy/console/grideditor/col_text.py
index d94e41f9..9962c7b1 100644
--- a/mitmproxy/console/grideditor/col_text.py
+++ b/mitmproxy/console/grideditor/col_text.py
@@ -26,7 +26,7 @@ class Column(col_bytes.Column):
# This is the same for both edit and display.
-class EncodingMixin():
+class EncodingMixin:
def __init__(self, data, encoding_args):
# type: (str) -> TDisplay
self.encoding_args = encoding_args
diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py
index 38f6c094..8569067f 100644
--- a/mitmproxy/contentviews.py
+++ b/mitmproxy/contentviews.py
@@ -93,7 +93,7 @@ def format_text(text):
yield [("text", line)]
-class View():
+class View:
name = None
prompt = ()
content_types = []
diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py
index 397c906d..09b7abed 100644
--- a/mitmproxy/controller.py
+++ b/mitmproxy/controller.py
@@ -41,13 +41,13 @@ Events = frozenset([
])
-class LogEntry():
+class LogEntry:
def __init__(self, msg, level):
self.msg = msg
self.level = level
-class Log():
+class Log:
"""
The central logger, exposed to scripts as mitmproxy.ctx.log.
"""
@@ -82,7 +82,7 @@ class Log():
self.master.add_log(text, level)
-class Master():
+class Master:
"""
The master handles mitmproxy's main event loop.
"""
@@ -185,7 +185,7 @@ class ServerThread(basethread.BaseThread):
self.server.serve_forever()
-class Channel():
+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():
+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 40c5a3a5..d6d45ce6 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():
+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 5f8e9404..69dcd1d2 100644
--- a/mitmproxy/flow/state.py
+++ b/mitmproxy/flow/state.py
@@ -177,7 +177,7 @@ class FlowStore(FlowList):
f.kill(master)
-class State():
+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 fca81c9b..64c0a9fc 100644
--- a/mitmproxy/flowfilter.py
+++ b/mitmproxy/flowfilter.py
@@ -58,7 +58,7 @@ def only(*types):
return decorator
-class _Token():
+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 7b9a22ae..c62dc448 100644
--- a/mitmproxy/optmanager.py
+++ b/mitmproxy/optmanager.py
@@ -11,7 +11,7 @@ from mitmproxy import exceptions
"""
-class OptManager():
+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 4c206a50..8dfd2f81 100644
--- a/mitmproxy/platform/linux.py
+++ b/mitmproxy/platform/linux.py
@@ -5,7 +5,7 @@ import struct
SO_ORIGINAL_DST = 80
-class Resolver():
+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 97b74a12..4b74f62b 100644
--- a/mitmproxy/platform/osx.py
+++ b/mitmproxy/platform/osx.py
@@ -15,7 +15,7 @@ from . import pf
"""
-class Resolver():
+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 e1d2ef7c..01f20dc1 100644
--- a/mitmproxy/platform/windows.py
+++ b/mitmproxy/platform/windows.py
@@ -16,7 +16,7 @@ import socketserver
PROXY_API_PORT = 8085
-class Resolver():
+class Resolver:
def __init__(self):
TransparentProxy.setup()
@@ -111,7 +111,7 @@ def MIB_TCPTABLE2(size):
return _MIB_TCPTABLE2()
-class TransparentProxy():
+class TransparentProxy:
"""
Transparent Windows Proxy for mitmproxy based on WinDivert/PyDivert.
diff --git a/mitmproxy/protocol/base.py b/mitmproxy/protocol/base.py
index d635e4f7..dea6b3d1 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():
+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():
+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 49faee29..3c17670e 100644
--- a/mitmproxy/protocol/http.py
+++ b/mitmproxy/protocol/http.py
@@ -61,7 +61,7 @@ class _HttpTransmissionLayer(base.Layer):
raise NotImplementedError()
-class ConnectServerConnection():
+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 3e1659a1..dbc83401 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():
+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 467cbe56..e2dc5d26 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():
+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 e6715c66..fe981f50 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():
+class RootContext:
"""
The outermost context provided to the root layer.
diff --git a/mitmproxy/proxy/server.py b/mitmproxy/proxy/server.py
index 4edbe9a0..3719ae62 100644
--- a/mitmproxy/proxy/server.py
+++ b/mitmproxy/proxy/server.py
@@ -62,7 +62,7 @@ class ProxyServer(tcp.TCPServer):
h.handle()
-class ConnectionHandler():
+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 570a6c56..82ccf3fb 100644
--- a/mitmproxy/web/app.py
+++ b/mitmproxy/web/app.py
@@ -73,7 +73,7 @@ class APIError(tornado.web.HTTPError):
pass
-class BasicAuth():
+class BasicAuth:
def set_auth_headers(self):
self.set_status(401)
diff --git a/netlib/certutils.py b/netlib/certutils.py
index 6f834466..340376d7 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():
+class CertStoreEntry:
def __init__(self, cert, privatekey, chain_file):
self.cert = cert
@@ -163,7 +163,7 @@ class CertStoreEntry():
self.chain_file = chain_file
-class CertStore():
+class CertStore:
"""
Implements an in-memory certificate store.
diff --git a/netlib/exceptions.py b/netlib/exceptions.py
index 2cef77cb..1787cb72 100644
--- a/netlib/exceptions.py
+++ b/netlib/exceptions.py
@@ -16,7 +16,7 @@ class NetlibException(Exception):
super(NetlibException, self).__init__(message)
-class Disconnect():
+class Disconnect:
"""Immediate EOF"""
diff --git a/netlib/http/authentication.py b/netlib/http/authentication.py
index ea24f754..efaa7f53 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():
+class NullProxyAuth:
"""
No proxy auth at all (returns empty challange headers)
@@ -90,7 +90,7 @@ class BasicProxyAuth(BasicAuth):
AUTH_HEADER = 'Proxy-Authorization'
-class PassMan():
+class PassMan:
def test(self, username_, password_token_):
return False
diff --git a/netlib/http/message.py b/netlib/http/message.py
index 9927daee..e693db1d 100644
--- a/netlib/http/message.py
+++ b/netlib/http/message.py
@@ -283,7 +283,7 @@ class Message(basetypes.Serializable):
self.content = body
-class decoded():
+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 41fde1cc..5b28a8cd 100644
--- a/netlib/socks.py
+++ b/netlib/socks.py
@@ -52,7 +52,7 @@ USERNAME_PASSWORD_VERSION = utils.BiDi(
)
-class ClientGreeting():
+class ClientGreeting:
__slots__ = ("ver", "methods")
def __init__(self, ver, methods):
@@ -89,7 +89,7 @@ class ClientGreeting():
f.write(self.methods.tostring())
-class ServerGreeting():
+class ServerGreeting:
__slots__ = ("ver", "method")
def __init__(self, ver, method):
@@ -117,7 +117,7 @@ class ServerGreeting():
f.write(struct.pack("!BB", self.ver, self.method))
-class UsernamePasswordAuth():
+class UsernamePasswordAuth:
__slots__ = ("ver", "username", "password")
def __init__(self, ver, username, password):
@@ -147,7 +147,7 @@ class UsernamePasswordAuth():
f.write(self.password.encode())
-class UsernamePasswordAuthResponse():
+class UsernamePasswordAuthResponse:
__slots__ = ("ver", "status")
def __init__(self, ver, status):
@@ -170,7 +170,7 @@ class UsernamePasswordAuthResponse():
f.write(struct.pack("!BB", self.ver, self.status))
-class Message():
+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 a0e0b69d..05ceef5a 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -72,7 +72,7 @@ sslversion_choices = {
}
-class SSLKeyLogger():
+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():
+class _FileLike:
BLOCKSIZE = 1024 * 32
def __init__(self, o):
@@ -426,7 +426,7 @@ def close_socket(sock):
sock.close()
-class _Connection():
+class _Connection:
rbufsize = -1
wbufsize = -1
@@ -574,7 +574,7 @@ class _Connection():
return context
-class ConnectionCloser():
+class ConnectionCloser:
def __init__(self, conn):
self.conn = conn
self._canceled = False
@@ -888,7 +888,7 @@ class Counter:
self._count -= 1
-class TCPServer():
+class TCPServer:
request_queue_size = 20
def __init__(self, address):
diff --git a/netlib/tutils.py b/netlib/tutils.py
index 3fbe58b9..d22fdd1c 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():
+class RaisesContext:
def __init__(self, expected_exception):
self.expected_exception = expected_exception
diff --git a/netlib/utils.py b/netlib/utils.py
index 190dda83..1a18dfcd 100644
--- a/netlib/utils.py
+++ b/netlib/utils.py
@@ -20,7 +20,7 @@ def getbit(byte, offset):
return bool(byte & mask)
-class BiDi():
+class BiDi:
"""
A wee utility class for keeping bi-directional mappings, like field
@@ -49,7 +49,7 @@ class BiDi():
return self.values.get(n, default)
-class Data():
+class Data:
def __init__(self, name):
m = importlib.import_module(name)
diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py
index e2ff8906..eb7d9ccd 100644
--- a/netlib/websockets/frame.py
+++ b/netlib/websockets/frame.py
@@ -43,7 +43,7 @@ CLOSE_REASON = utils.BiDi(
)
-class FrameHeader():
+class FrameHeader:
def __init__(
self,
@@ -193,7 +193,7 @@ class FrameHeader():
return False
-class Frame():
+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 66407df6..f4f489a6 100644
--- a/netlib/websockets/masker.py
+++ b/netlib/websockets/masker.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
-class Masker():
+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 86b5ce40..07e0c9db 100644
--- a/netlib/wsgi.py
+++ b/netlib/wsgi.py
@@ -8,20 +8,20 @@ import io
from netlib import http, tcp, strutils
-class ClientConn():
+class ClientConn:
def __init__(self, address):
self.address = tcp.Address.wrap(address)
-class Flow():
+class Flow:
def __init__(self, address, request):
self.client_conn = ClientConn(address)
self.request = request
-class Request():
+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():
+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 4483c3df..11f0899d 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():
+class Settings:
def __init__(
self,
@@ -60,7 +60,7 @@ v_naked_literal = pp.MatchFirst(
)
-class Token():
+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 6a543907..4e19ecd9 100644
--- a/pathod/language/generators.py
+++ b/pathod/language/generators.py
@@ -18,7 +18,7 @@ DATATYPES = dict(
)
-class TransformGenerator():
+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():
+class RandomGenerator:
def __init__(self, dtype, length):
self.dtype = dtype
@@ -73,7 +73,7 @@ class RandomGenerator():
return "%s random from %s" % (self.length, self.dtype)
-class FileGenerator():
+class FileGenerator:
def __init__(self, path):
self.path = path
diff --git a/pathod/language/http.py b/pathod/language/http.py
index 1f1a3db3..8b5fa828 100644
--- a/pathod/language/http.py
+++ b/pathod/language/http.py
@@ -53,7 +53,7 @@ class Method(base.OptionsOrValue):
]
-class _HeaderMixin():
+class _HeaderMixin:
unique_name = None
def format_header(self, key, value):
diff --git a/pathod/language/http2.py b/pathod/language/http2.py
index 7cb82916..35fc5ba8 100644
--- a/pathod/language/http2.py
+++ b/pathod/language/http2.py
@@ -40,7 +40,7 @@ def get_header(val, headers):
return None
-class _HeaderMixin():
+class _HeaderMixin:
unique_name = None
def values(self, settings):
diff --git a/pathod/language/message.py b/pathod/language/message.py
index 7a8594d6..03b4a2cf 100644
--- a/pathod/language/message.py
+++ b/pathod/language/message.py
@@ -5,7 +5,7 @@ from netlib import strutils
LOG_TRUNCATE = 1024
-class Message():
+class Message:
__metaclass__ = abc.ABCMeta
logattrs = []
diff --git a/pathod/log.py b/pathod/log.py
index 05934fd3..37100bb1 100644
--- a/pathod/log.py
+++ b/pathod/log.py
@@ -13,7 +13,7 @@ def write_raw(fp, lines, timestamp=True):
fp.flush()
-class LogCtx():
+class LogCtx:
def __init__(self, fp, hex, timestamp, rfile, wfile):
self.lines = []
diff --git a/pathod/pathoc.py b/pathod/pathoc.py
index 008308ca..1f81ed59 100644
--- a/pathod/pathoc.py
+++ b/pathod/pathoc.py
@@ -34,7 +34,7 @@ class PathocError(Exception):
pass
-class SSLInfo():
+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 f67ad04e..fe8635ea 100644
--- a/pathod/pathod.py
+++ b/pathod/pathod.py
@@ -30,7 +30,7 @@ class PathodError(Exception):
pass
-class SSLOptions():
+class SSLOptions:
def __init__(
self,
confdir=CONFDIR,
diff --git a/pathod/protocols/http.py b/pathod/protocols/http.py
index 5ac8516f..17930320 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():
+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 42f1a1a0..dcd17eba 100644
--- a/pathod/protocols/http2.py
+++ b/pathod/protocols/http2.py
@@ -15,14 +15,14 @@ import netlib.http.request
from .. import language
-class TCPHandler():
+class TCPHandler:
def __init__(self, rfile, wfile=None):
self.rfile = rfile
self.wfile = wfile
-class HTTP2StateProtocol():
+class HTTP2StateProtocol:
ERROR_CODES = utils.BiDi(
NO_ERROR=0x0,
@@ -403,7 +403,7 @@ class HTTP2StateProtocol():
return stream_id, headers, body
-class HTTP2Protocol():
+class HTTP2Protocol:
def __init__(self, pathod_handler):
self.pathod_handler = pathod_handler
diff --git a/pathod/utils.py b/pathod/utils.py
index 07b6933e..2d077c48 100644
--- a/pathod/utils.py
+++ b/pathod/utils.py
@@ -3,7 +3,7 @@ import sys
import netlib.utils
-class MemBool():
+class MemBool:
"""
Truth-checking with a memory, for use in chained if statements.
diff --git a/test/mitmproxy/console/test_pathedit.py b/test/mitmproxy/console/test_pathedit.py
index ff6ef846..45c69a38 100644
--- a/test/mitmproxy/console/test_pathedit.py
+++ b/test/mitmproxy/console/test_pathedit.py
@@ -51,7 +51,7 @@ class TestPathCompleter:
assert c.final == s
-class TestPathEdit():
+class TestPathEdit:
def test_keypress(self):
diff --git a/test/mitmproxy/protocol/test_http1.py b/test/mitmproxy/protocol/test_http1.py
index 3bf1210e..d2c473d7 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():
+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 c0f7007d..3a222c10 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():
+class _Http2TestBase:
@classmethod
def setup_class(cls):
diff --git a/test/mitmproxy/protocol/test_websockets.py b/test/mitmproxy/protocol/test_websockets.py
index f7756f25..094d9298 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():
+class _WebSocketsTestBase:
@classmethod
def setup_class(cls):
diff --git a/test/mitmproxy/test_controller.py b/test/mitmproxy/test_controller.py
index bd3dfe4e..84f762e6 100644
--- a/test/mitmproxy/test_controller.py
+++ b/test/mitmproxy/test_controller.py
@@ -15,7 +15,7 @@ class TMsg:
pass
-class TestMaster():
+class TestMaster:
def test_simple(self):
class DummyMaster(controller.Master):
@controller.handler
@@ -44,7 +44,7 @@ class TestMaster():
m.shutdown()
-class TestServerThread():
+class TestServerThread:
def test_simple(self):
m = Mock()
t = controller.ServerThread(m)
@@ -52,7 +52,7 @@ class TestServerThread():
assert m.serve_forever.called
-class TestChannel():
+class TestChannel:
def test_tell(self):
q = queue.Queue()
channel = controller.Channel(q, Event())
@@ -86,7 +86,7 @@ class TestChannel():
channel.ask("test", Mock(name="test_ask_shutdown"))
-class TestReply():
+class TestReply:
def test_simple(self):
reply = controller.Reply(42)
assert reply.state == "unhandled"
@@ -179,7 +179,7 @@ class TestReply():
reply.commit()
-class TestDummyReply():
+class TestDummyReply:
def test_simple(self):
reply = controller.DummyReply()
for _ in range(2):
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 81e8801c..05b7544f 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -99,7 +99,7 @@ class TestScripts(mastertest.MasterTest):
assert f.request.host == "mitmproxy.org"
-class TestHARDump():
+class TestHARDump:
def flow(self, resp_content=b'message'):
times = dict(
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index b4052c62..38d61afe 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():
+class TestHTTPFlow:
def test_copy(self):
f = tutils.tflow(resp=True)
diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py
index 86ff937d..920f538b 100644
--- a/test/mitmproxy/test_flow_export.py
+++ b/test/mitmproxy/test_flow_export.py
@@ -31,7 +31,7 @@ def req_patch():
return netlib.tutils.treq(method=b'PATCH', path=b"/path?query=param")
-class TestExportCurlCommand():
+class TestExportCurlCommand:
def test_get(self):
flow = tutils.tflow(req=req_get())
result = """curl -H 'header:qvalue' -H 'content-length:7' 'http://address/path?a=foo&a=bar&b=baz'"""
@@ -48,7 +48,7 @@ class TestExportCurlCommand():
assert export.curl_command(flow) == result
-class TestExportPythonCode():
+class TestExportPythonCode:
def test_get(self):
flow = tutils.tflow(req=req_get())
python_equals("data/test_flow_export/python_get.py", export.python_code(flow))
@@ -69,7 +69,7 @@ class TestExportPythonCode():
python_equals("data/test_flow_export/python_patch.py", export.python_code(flow))
-class TestExportLocustCode():
+class TestExportLocustCode:
def test_get(self):
flow = tutils.tflow(req=req_get())
python_equals("data/test_flow_export/locust_get.py", export.locust_code(flow))
@@ -86,7 +86,7 @@ class TestExportLocustCode():
python_equals("data/test_flow_export/locust_patch.py", export.locust_code(flow))
-class TestExportLocustTask():
+class TestExportLocustTask:
def test_get(self):
flow = tutils.tflow(req=req_get())
python_equals("data/test_flow_export/locust_task_get.py", export.locust_task(flow))
@@ -100,7 +100,7 @@ class TestExportLocustTask():
python_equals("data/test_flow_export/locust_task_patch.py", export.locust_task(flow))
-class TestIsJson():
+class TestIsJson:
def test_empty(self):
assert export.is_json(None, None) is False
@@ -119,7 +119,7 @@ class TestIsJson():
assert isinstance(j, dict)
-class TestURL():
+class TestURL:
def test_url(self):
flow = tutils.tflow()
assert export.url(flow) == "http://address:22/path"
diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py
index 48bb94ca..5904ce5b 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():
+class TestServerConnection:
def test_simple(self):
self.d = test.Daemon()
diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py
index e597570e..6796e243 100644
--- a/test/mitmproxy/tservers.py
+++ b/test/mitmproxy/tservers.py
@@ -74,7 +74,7 @@ class ProxyThread(threading.Thread):
self.tmaster.shutdown()
-class ProxyTestBase():
+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 fb27857b..a768a722 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():
+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():
+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 d214ca02..63f16897 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():
+class TestHeaders:
def _2host(self):
return Headers(
(
diff --git a/test/netlib/http/test_message.py b/test/netlib/http/test_message.py
index 9a5b80ed..dd08e018 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():
+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():
assert data != 0
-class TestMessage():
+class TestMessage:
def test_init(self):
resp = tresp()
@@ -108,7 +108,7 @@ class TestMessage():
assert r.content == b"ggfootoo"
-class TestMessageContentEncoding():
+class TestMessageContentEncoding:
def test_simple(self):
r = tresp()
assert r.raw_content == b"message"
@@ -186,7 +186,7 @@ class TestMessageContentEncoding():
assert "content-encoding" not in r.headers
-class TestMessageText():
+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 bcb1cc43..e091f280 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():
+class TestRequestData:
def test_init(self):
with raises(ValueError):
treq(headers="foobar")
@@ -14,7 +14,7 @@ class TestRequestData():
assert isinstance(treq(headers=()).headers, Headers)
-class TestRequestCore():
+class TestRequestCore:
"""
Tests for builtins and the attributes that are directly proxied from the data structure
"""
@@ -92,7 +92,7 @@ class TestRequestCore():
assert request.headers["Host"] == "example.org"
-class TestRequestUtils():
+class TestRequestUtils:
"""
Tests for additional convenience methods.
"""
diff --git a/test/netlib/http/test_response.py b/test/netlib/http/test_response.py
index 6ab043c1..66d6e307 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():
+class TestResponseData:
def test_init(self):
with raises(ValueError):
tresp(headers="foobar")
@@ -19,7 +19,7 @@ class TestResponseData():
assert isinstance(tresp(headers=()).headers, Headers)
-class TestResponseCore():
+class TestResponseCore:
"""
Tests for builtins and the attributes that are directly proxied from the data structure
"""
@@ -60,7 +60,7 @@ class TestResponseCore():
_test_decoded_attr(tresp(), "reason")
-class TestResponseUtils():
+class TestResponseUtils:
"""
Tests for additional convenience methods.
"""
diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py
index bad5e2b4..a9523fd9 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():
+class _TMulti:
@staticmethod
def _kconv(key):
return key.lower()
@@ -16,7 +16,7 @@ class TImmutableMultiDict(_TMulti, ImmutableMultiDict):
pass
-class TestMultiDict():
+class TestMultiDict:
@staticmethod
def _multi():
return TMultiDict((
@@ -194,7 +194,7 @@ class TestMultiDict():
assert md == md2
-class TestImmutableMultiDict():
+class TestImmutableMultiDict:
def test_modify(self):
md = TImmutableMultiDict()
with tutils.raises(TypeError):
@@ -224,7 +224,7 @@ class TestImmutableMultiDict():
assert md.with_insert(0, "foo", "bar").fields == (("foo", "bar"),)
-class TParent():
+class TParent:
def __init__(self):
self.vals = tuple()
@@ -235,7 +235,7 @@ class TParent():
return self.vals
-class TestMultiDictView():
+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 d22be413..fdf40ff3 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():
+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 265d2513..a039dcb1 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():
+class TestFrameHeader:
@pytest.mark.parametrize("input,expected", [
(0, '0100'),
@@ -123,7 +123,7 @@ class TestFrameHeader():
assert f.masking_key
-class TestFrame():
+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 a06fd079..23a9b876 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():
+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 7e3f02f9..f6f1e40a 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():
+class TestUtils:
def test_client_handshake_headers(self):
h = websockets.client_handshake_headers(version='42')
diff --git a/test/pathod/test_language_base.py b/test/pathod/test_language_base.py
index 12a235e4..b8abc9ba 100644
--- a/test/pathod/test_language_base.py
+++ b/test/pathod/test_language_base.py
@@ -343,7 +343,7 @@ def test_unique_name():
assert b.unique_name
-class test_boolean():
+class test_boolean:
e = TBoolean.expr()
assert e.parseString("test")[0].value
assert not e.parseString("-test")[0].value
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py
index 69b7a604..89d7c562 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():
+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 24353927..7300cc1d 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():
+class TestClientStreamIds:
c = tcp.TCPClient(("127.0.0.1", 0))
protocol = HTTP2StateProtocol(c)
@@ -183,7 +183,7 @@ class TestClientStreamIds():
assert self.protocol.current_stream_id == 5
-class TestserverstreamIds():
+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():
+class TestCreateHeaders:
c = tcp.TCPClient(("127.0.0.1", 0))
def test_create_headers(self):
@@ -267,7 +267,7 @@ class TestCreateHeaders():
assert bytes[2] == codecs.decode('00000209040000000163d5', 'hex_codec')
-class TestCreateBody():
+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():
+class TestAssembleRequest:
c = tcp.TCPClient(("127.0.0.1", 0))
def test_request_simple(self):
@@ -476,7 +476,7 @@ class TestAssembleRequest():
codecs.decode('000006000100000001666f6f626172', 'hex_codec')
-class TestAssembleResponse():
+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 6ebf25a8..c2243578 100644
--- a/test/pathod/tutils.py
+++ b/test/pathod/tutils.py
@@ -23,7 +23,7 @@ def treader(bytes):
return tcp.Reader(fp)
-class DaemonTests():
+class DaemonTests:
nohang = False
ssl = False
timeout = None