mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
cleanup code with autoflake
run the following command: $ autoflake -r -i --remove-all-unused-imports --remove-unused-variables .
This commit is contained in:
parent
e3d390e036
commit
161bc2cfaa
@ -1,10 +1,6 @@
|
||||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
import struct
|
||||
import io
|
||||
|
||||
from .. import utils, odict, tcp
|
||||
from .. import utils
|
||||
from functools import reduce
|
||||
|
||||
|
||||
|
@ -1,8 +1,3 @@
|
||||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
import struct
|
||||
import io
|
||||
|
||||
# "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
|
||||
CLIENT_CONNECTION_PREFACE = '505249202a20485454502f322e300d0a0d0a534d0d0a0d0a'
|
||||
|
@ -16,7 +16,6 @@ class NullProxyAuth(object):
|
||||
"""
|
||||
Clean up authentication headers, so they're not passed upstream.
|
||||
"""
|
||||
pass
|
||||
|
||||
def authenticate(self, headers):
|
||||
"""
|
||||
|
@ -67,7 +67,6 @@ def _read_quoted_string(s, start):
|
||||
break
|
||||
elif s[i] == "\\":
|
||||
escaping = True
|
||||
pass
|
||||
else:
|
||||
ret.append(s[i])
|
||||
return "".join(ret), i + 1
|
||||
|
@ -7,7 +7,6 @@ import threading
|
||||
import time
|
||||
import traceback
|
||||
from OpenSSL import SSL
|
||||
import OpenSSL
|
||||
|
||||
from . import certutils
|
||||
|
||||
@ -650,4 +649,3 @@ class TCPServer(object):
|
||||
"""
|
||||
Called after server shutdown.
|
||||
"""
|
||||
pass
|
||||
|
@ -1,6 +1,5 @@
|
||||
import os
|
||||
from netlib import certutils, certffi
|
||||
import OpenSSL
|
||||
import tutils
|
||||
|
||||
# class TestDNTree:
|
||||
@ -57,13 +56,13 @@ class TestCertStore:
|
||||
|
||||
def test_add_cert(self):
|
||||
with tutils.tmpdir() as d:
|
||||
ca = certutils.CertStore.from_store(d, "test")
|
||||
certutils.CertStore.from_store(d, "test")
|
||||
|
||||
def test_sans(self):
|
||||
with tutils.tmpdir() as d:
|
||||
ca = certutils.CertStore.from_store(d, "test")
|
||||
c1 = ca.get_cert("foo.com", ["*.bar.com"])
|
||||
c2 = ca.get_cert("foo.bar.com", [])
|
||||
ca.get_cert("foo.bar.com", [])
|
||||
# assert c1 == c2
|
||||
c3 = ca.get_cert("bar.com", [])
|
||||
assert not c1 == c3
|
||||
@ -71,7 +70,7 @@ class TestCertStore:
|
||||
def test_sans_change(self):
|
||||
with tutils.tmpdir() as d:
|
||||
ca = certutils.CertStore.from_store(d, "test")
|
||||
_ = ca.get_cert("foo.com", ["*.bar.com"])
|
||||
ca.get_cert("foo.com", ["*.bar.com"])
|
||||
cert, key, chain_file = ca.get_cert("foo.bar.com", ["*.baz.com"])
|
||||
assert "*.baz.com" in cert.altnames
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
import binascii
|
||||
import cStringIO
|
||||
from netlib import odict, http_auth, http
|
||||
import mock
|
||||
import tutils
|
||||
|
||||
|
||||
@ -22,7 +19,7 @@ class TestPassManHtpasswd:
|
||||
pm = http_auth.PassManHtpasswd(tutils.test_data.path("data/htpasswd"))
|
||||
|
||||
vals = ("basic", "test", "test")
|
||||
p = http.assemble_http_basic_auth(*vals)
|
||||
http.assemble_http_basic_auth(*vals)
|
||||
assert pm.test("test", "test")
|
||||
assert not pm.test("test", "foo")
|
||||
assert not pm.test("foo", "test")
|
||||
|
@ -1,7 +1,6 @@
|
||||
import pprint
|
||||
import nose.tools
|
||||
|
||||
from netlib import http_cookies, odict
|
||||
from netlib import http_cookies
|
||||
|
||||
|
||||
def test_read_token():
|
||||
|
@ -1,3 +1 @@
|
||||
# These are actually tests!
|
||||
import netlib.http_status
|
||||
import netlib.version
|
||||
|
@ -56,7 +56,7 @@ class TestWSGI:
|
||||
f.request.host = "foo"
|
||||
f.request.port = 80
|
||||
wfile = cStringIO.StringIO()
|
||||
err = w.serve(f, wfile)
|
||||
w.serve(f, wfile)
|
||||
return wfile.getvalue()
|
||||
|
||||
def test_serve_empty_body(self):
|
||||
@ -72,7 +72,7 @@ class TestWSGI:
|
||||
try:
|
||||
raise ValueError("foo")
|
||||
except:
|
||||
ei = sys.exc_info()
|
||||
sys.exc_info()
|
||||
status = '200 OK'
|
||||
response_headers = [('Content-type', 'text/plain')]
|
||||
start_response(status, response_headers)
|
||||
|
Loading…
Reference in New Issue
Block a user