mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
mark unused variables and arguments
This commit is contained in:
parent
40436ffb1f
commit
69e71097f7
@ -1,5 +1,8 @@
|
||||
max-line-length: 120
|
||||
pylint:
|
||||
options:
|
||||
dummy-variables-rgx: _$|.+_$|dummy_.+
|
||||
|
||||
disable:
|
||||
- missing-docstring
|
||||
- protected-access
|
||||
|
@ -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)
|
||||
|
@ -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(),
|
||||
"===============================================================",
|
||||
])
|
||||
|
@ -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(
|
||||
frm = frame.SettingsFrame(
|
||||
state=self,
|
||||
flags=frame.Frame.FLAG_ACK),
|
||||
hide)
|
||||
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):
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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.
|
||||
"""
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user