aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-18 15:32:52 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-18 17:14:38 +0200
commit69e71097f7a9633a43d566b2a46aab370f07dce3 (patch)
tree117f58730fc647e219b362691f0365250b92c04f
parent40436ffb1f8293dde9217e2a0167e6c66b11d1f1 (diff)
downloadmitmproxy-69e71097f7a9633a43d566b2a46aab370f07dce3.tar.gz
mitmproxy-69e71097f7a9633a43d566b2a46aab370f07dce3.tar.bz2
mitmproxy-69e71097f7a9633a43d566b2a46aab370f07dce3.zip
mark unused variables and arguments
-rw-r--r--.landscape.yml3
-rw-r--r--netlib/certutils.py2
-rw-r--r--netlib/http2/frame.py3
-rw-r--r--netlib/http2/protocol.py15
-rw-r--r--netlib/http_auth.py9
-rw-r--r--netlib/http_cookies.py9
-rw-r--r--netlib/tcp.py10
-rw-r--r--netlib/wsgi.py2
8 files changed, 27 insertions, 26 deletions
diff --git a/.landscape.yml b/.landscape.yml
index 5926e7bf..ccaa5fc3 100644
--- a/.landscape.yml
+++ b/.landscape.yml
@@ -1,5 +1,8 @@
max-line-length: 120
pylint:
+ options:
+ dummy-variables-rgx: _$|.+_$|dummy_.+
+
disable:
- missing-docstring
- protected-access
diff --git a/netlib/certutils.py b/netlib/certutils.py
index ade61bb5..c6f0e628 100644
--- a/netlib/certutils.py
+++ b/netlib/certutils.py
@@ -333,7 +333,7 @@ class CertStore(object):
return entry.cert, entry.privatekey, entry.chain_file
- def gen_pkey(self, cert):
+ def gen_pkey(self, cert_):
# FIXME: We should do something with cert here?
from . import certffi
certffi.set_flags(self.default_privatekey, 1)
diff --git a/netlib/http2/frame.py b/netlib/http2/frame.py
index b4783a02..f7e60471 100644
--- a/netlib/http2/frame.py
+++ b/netlib/http2/frame.py
@@ -116,7 +116,8 @@ class Frame(object):
self.length = len(self.payload_bytes())
return "\n".join([
- "%s: %s | length: %d | flags: %#x | stream_id: %d" % (direction, self.__class__.__name__, self.length, self.flags, self.stream_id),
+ "%s: %s | length: %d | flags: %#x | stream_id: %d" % (
+ direction, self.__class__.__name__, self.length, self.flags, self.stream_id),
self.payload_human_readable(),
"===============================================================",
])
diff --git a/netlib/http2/protocol.py b/netlib/http2/protocol.py
index ac89bac4..8e5f5429 100644
--- a/netlib/http2/protocol.py
+++ b/netlib/http2/protocol.py
@@ -59,8 +59,8 @@ class HTTP2Protocol(object):
while True:
frm = self.read_frame(hide)
if isinstance(frm, frame.SettingsFrame):
- assert settings_ack_frame.flags & frame.Frame.FLAG_ACK
- assert len(settings_ack_frame.settings) == 0
+ assert frm.flags & frame.Frame.FLAG_ACK
+ assert len(frm.settings) == 0
break
def perform_server_connection_preface(self, force=False):
@@ -118,11 +118,10 @@ class HTTP2Protocol(object):
old_value = '-'
self.http2_settings[setting] = value
- self.send_frame(
- frame.SettingsFrame(
- state=self,
- flags=frame.Frame.FLAG_ACK),
- hide)
+ frm = frame.SettingsFrame(
+ state=self,
+ flags=frame.Frame.FLAG_ACK)
+ self.send_frame(frm, hide)
# be liberal in what we expect from the other end
# to be more strict use: self._read_settings_ack(hide)
@@ -188,7 +187,7 @@ class HTTP2Protocol(object):
self._create_body(body, stream_id)))
def read_response(self):
- stream_id, headers, body = self._receive_transmission()
+ stream_id_, headers, body = self._receive_transmission()
return headers[':status'], headers, body
def read_request(self):
diff --git a/netlib/http_auth.py b/netlib/http_auth.py
index 0143760c..adab4aed 100644
--- a/netlib/http_auth.py
+++ b/netlib/http_auth.py
@@ -12,12 +12,13 @@ class NullProxyAuth(object):
def __init__(self, password_manager):
self.password_manager = password_manager
- def clean(self, headers):
+ def clean(self, headers_):
"""
Clean up authentication headers, so they're not passed upstream.
"""
+ pass
- def authenticate(self, headers):
+ def authenticate(self, headers_):
"""
Tests that the user is allowed to use the proxy
"""
@@ -62,7 +63,7 @@ class BasicProxyAuth(NullProxyAuth):
class PassMan(object):
- def test(self, username, password_token):
+ def test(self, username_, password_token_):
return False
@@ -72,7 +73,7 @@ class PassManNonAnon(PassMan):
Ensure the user specifies a username, accept any password.
"""
- def test(self, username, password_token):
+ def test(self, username, password_token_):
if username:
return True
return False
diff --git a/netlib/http_cookies.py b/netlib/http_cookies.py
index b7311714..e91ee5c0 100644
--- a/netlib/http_cookies.py
+++ b/netlib/http_cookies.py
@@ -87,7 +87,7 @@ def _read_value(s, start, delims):
return _read_until(s, start, delims)
-def _read_pairs(s, off=0, specials=()):
+def _read_pairs(s, off=0):
"""
Read pairs of lhs=rhs values.
@@ -151,10 +151,7 @@ def _parse_set_cookie_pairs(s):
For Set-Cookie, we support multiple cookies as described in RFC2109.
This function therefore returns a list of lists.
"""
- pairs, off = _read_pairs(
- s,
- specials=("expires", "path")
- )
+ pairs, off_ = _read_pairs(s)
return pairs
@@ -185,7 +182,7 @@ def parse_cookie_header(line):
Parse a Cookie header value.
Returns a (possibly empty) ODict object.
"""
- pairs, off = _read_pairs(line)
+ pairs, off_ = _read_pairs(line)
return odict.ODict(pairs)
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 65075776..77eb7b52 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -403,7 +403,7 @@ class _Connection(object):
# Verify Options (NONE/PEER/PEER|FAIL_IF_... and trusted CAs)
if verify_options is not None and verify_options is not SSL.VERIFY_NONE:
- def verify_cert(conn, cert, errno, err_depth, is_cert_verified):
+ def verify_cert(conn_, cert_, errno, err_depth, is_cert_verified):
if is_cert_verified:
return True
raise NetLibError(
@@ -439,7 +439,7 @@ class _Connection(object):
context.set_alpn_protos(alpn_protos)
elif alpn_select is not None:
# select application layer protocol
- def alpn_select_callback(conn, options):
+ def alpn_select_callback(conn_, options):
if alpn_select in options:
return bytes(alpn_select)
else: # pragma no cover
@@ -601,7 +601,7 @@ class BaseHandler(_Connection):
context.set_tlsext_servername_callback(handle_sni)
if request_client_cert:
- def save_cert(conn, cert, errno, depth, preverify_ok):
+ def save_cert(conn_, cert, errno_, depth_, preverify_ok_):
self.clientcert = certutils.SSLCert(cert)
# Return true to prevent cert verification error
return True
@@ -676,7 +676,7 @@ class TCPServer(object):
try:
while not self.__shutdown_request:
try:
- r, w, e = select.select(
+ r, w_, e_ = select.select(
[self.socket], [], [], poll_interval)
except select.error as ex: # pragma: no cover
if ex[0] == EINTR:
@@ -708,7 +708,7 @@ class TCPServer(object):
self.socket.close()
self.handle_shutdown()
- def handle_error(self, connection, client_address, fp=sys.stderr):
+ def handle_error(self, connection_, client_address, fp=sys.stderr):
"""
Called when handle_client_connection raises an exception.
"""
diff --git a/netlib/wsgi.py b/netlib/wsgi.py
index 827cf6f0..ad43dc19 100644
--- a/netlib/wsgi.py
+++ b/netlib/wsgi.py
@@ -35,7 +35,7 @@ def date_time_string():
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
now = time.time()
- year, month, day, hh, mm, ss, wd, y, z = time.gmtime(now)
+ year, month, day, hh, mm, ss, wd, y_, z_ = time.gmtime(now)
s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
WEEKS[wd],
day, MONTHS[month], year,