Silence pyflakes

And pick up one bug as a consequence.
This commit is contained in:
Aldo Cortesi 2014-01-19 18:16:24 +13:00
parent cabd848b1e
commit 7ddc941116
8 changed files with 15 additions and 20 deletions

View File

@ -1,8 +1,6 @@
import proxy
import re, filt
import argparse
import shlex
import os
APP_HOST = "mitm"
APP_PORT = 80

View File

@ -1,7 +1,7 @@
import mailcap, mimetypes, tempfile, os, subprocess, glob, time, shlex, stat
import os.path, sys, weakref
import urwid
from .. import controller, utils, flow
from .. import controller, utils, flow, script
import flowlist, flowview, help, common, grideditor, palettes, contentview, flowdetailview
EVENTLOG_SIZE = 500

View File

@ -490,7 +490,7 @@ def get_content_view(viewmode, hdrItems, content, limit, logfunc):
try:
ret = viewmode(hdrs, content, limit)
# Third-party viewers can fail in unexpected ways...
except Exception, e:
except Exception:
s = traceback.format_exc()
s = "Content viewer failed: \n" + s
logfunc(s)

View File

@ -334,7 +334,7 @@ bnf = _make()
def parse(s):
try:
return bnf.parseString(s, parseAll=True)[0]
except pp.ParseException, v:
except pp.ParseException:
return None
except ValueError:
return None

View File

@ -2,7 +2,7 @@
This module provides more sophisticated flow tracking. These match requests
with their responses, and provide filtering and interception facilities.
"""
import hashlib, Cookie, cookielib, copy, re, urlparse, os, threading
import hashlib, Cookie, cookielib, copy, re, urlparse, threading
import time, urllib
import tnetstring, filt, script, utils, encoding, proxy
from email.utils import parsedate_tz, formatdate, mktime_tz
@ -1395,9 +1395,9 @@ class FlowMaster(controller.Master):
pass
def unload_scripts(self):
for script in self.scripts[:]:
script.unload()
self.scripts.remove(script)
for s in self.scripts[:]:
s.unload()
self.scripts.remove(s)
def load_script(self, command):
"""

View File

@ -1,4 +1,4 @@
import socket, struct, fcntl
import socket, struct
# Python socket module does not have this constant
SO_ORIGINAL_DST = 80

View File

@ -1,8 +1,7 @@
import sys, os, string, socket, time
import shutil, tempfile, threading
import SocketServer
import os, socket, time
import threading
from OpenSSL import SSL
from netlib import odict, tcp, http, certutils, http_status, http_auth
from netlib import tcp, http, certutils, http_status, http_auth
import utils, flow, version, platform, controller
@ -91,7 +90,6 @@ class RequestReplayThread(threading.Thread):
server = ServerConnection(self.config, r.scheme, r.host, r.port, r.host)
server.connect()
server.send(r)
tsstart = utils.timestamp()
httpversion, code, msg, headers, content = http.read_response(
server.rfile, r.method, self.config.body_size_limit
)
@ -123,7 +121,7 @@ class HandleSNI:
self.handler.sni = sn.decode("utf8").encode("idna")
# An unhandled exception in this method will core dump PyOpenSSL, so
# make dang sure it doesn't happen.
except Exception, e: # pragma: no cover
except Exception: # pragma: no cover
pass
@ -240,7 +238,6 @@ class ProxyHandler(tcp.BaseHandler):
request.ssl_setup_timestamp = sc.ssl_setup_timestamp
sc.rfile.reset_timestamps()
try:
tsstart = utils.timestamp()
peername = sc.connection.getpeername()
if peername:
request.ip = peername[0]
@ -249,13 +246,13 @@ class ProxyHandler(tcp.BaseHandler):
request.method,
self.config.body_size_limit
)
except http.HttpErrorConnClosed, v:
except http.HttpErrorConnClosed:
self.del_server_connection()
if sc.requestcount > 1:
continue
else:
raise
except http.HttpError, v:
except http.HttpError:
raise ProxyError(502, "Invalid server response.")
else:
break

View File

@ -1,4 +1,4 @@
import os, datetime, urlparse, string, urllib, re
import os, datetime, urllib, re
import time, functools, cgi
import json
from netlib import http