cleanup imports

This commit is contained in:
Thomas Kriechbaumer 2016-01-27 10:10:14 +01:00
parent 299c7fa34c
commit c2bb29f669
23 changed files with 20 additions and 43 deletions

View File

@ -9,7 +9,6 @@ def maybe_timestamp(base, attr):
return utils.format_timestamp_with_milli(getattr(base, attr))
else:
return "active"
pass
def flowdetails(state, flow):

View File

@ -1,7 +1,6 @@
from __future__ import absolute_import
import urwid
from netlib import http
import netlib.utils
from . import common, signals

View File

@ -1,5 +1,4 @@
import urwid
import signals
class Tab(urwid.WidgetWrap):

View File

@ -15,7 +15,6 @@ BLACKLIST = ['jsbeautifier.unpackers.evalbased']
class UnpackingError(Exception):
"""Badly packed source or general error. Argument is a
meaningful description."""
pass
def getunpackers():
"""Scans the unpackers dir, finds unpackers and add them to UNPACKERS list.

View File

@ -13,7 +13,6 @@
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
import re
import string
from . import UnpackingError
PRIORITY = 1

View File

@ -1,6 +1,4 @@
from __future__ import absolute_import, print_function
import sys
import os
import traceback
import click
@ -10,7 +8,6 @@ from netlib.http import CONTENT_MISSING
import netlib.utils
from . import flow, filt, contentviews
from .exceptions import ContentViewException
from .models import HTTPRequest
class DumpError(Exception):
pass

View File

@ -652,7 +652,6 @@ class FlowMaster(controller.Master):
"""
level: debug, info, error
"""
pass
def unload_scripts(self):
for s in self.scripts[:]:

View File

@ -21,7 +21,7 @@ class Resolver(object):
peer = csock.getpeername()
try:
stxt = subprocess.check_output(self.STATECMD, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError, e:
except subprocess.CalledProcessError as e:
if "sudo: a password is required" in e.output:
insufficient_priv = True
else:

View File

@ -28,12 +28,14 @@ as late as possible; this makes server replay without any outgoing connections p
from __future__ import (absolute_import, print_function, division)
from .base import Layer, ServerConnectionMixin, Kill
from .http import Http1Layer, UpstreamConnectLayer, Http2Layer
from .tls import TlsLayer, is_tls_record_magic, TlsClientHello
from .tls import TlsLayer
from .tls import is_tls_record_magic
from .tls import TlsClientHello
from .rawtcp import RawTCPLayer
__all__ = [
"Layer", "ServerConnectionMixin", "Kill",
"Http1Layer", "UpstreamConnectLayer", "Http2Layer",
"TlsLayer", "is_tls_record_magic", "TlsClientHello"
"RawTCPLayer"
"TlsLayer", "is_tls_record_magic", "TlsClientHello",
"RawTCPLayer",
]

View File

@ -3,7 +3,6 @@ import sys
import six
from netlib import tcp
from ..models import ServerConnection
from ..exceptions import ProtocolException
from netlib.exceptions import TcpException

View File

@ -1,6 +1,5 @@
from __future__ import (absolute_import, print_function, division)
import socket
import select
import six
import sys

View File

@ -5,7 +5,8 @@ import sys
from construct import ConstructError
import six
from netlib.exceptions import InvalidCertificateException, TcpException, TlsException
from netlib.exceptions import InvalidCertificateException
from netlib.exceptions import TlsException
from ..contrib.tls._constructs import ClientHello
from ..exceptions import ProtocolException, TlsProtocolException, ClientHandshakeException

View File

@ -2,7 +2,6 @@ from __future__ import absolute_import, print_function
import collections
import tornado.ioloop
import tornado.httpserver
import os
from .. import controller, flow
from . import app

View File

@ -1,11 +1,11 @@
[flake8]
max-line-length = 80
max-complexity = 15
max-line-length = 120
max-complexity = 20
[pep8]
max-line-length = 80
max-line-length = 120
exclude = */contrib/*
ignore = E251,E309
ignore = E251
[pytest]
testpaths = test
testpaths = test

View File

@ -1,10 +1,3 @@
import mock
import socket
import os
import time
from libmproxy import dump
from netlib import certutils, tcp
from libpathod.pathoc import Pathoc
import tutils
import tservers

View File

@ -1,9 +1,4 @@
import os
import sys
import mock
import gc
from os.path import normpath
import mock_urwid
import netlib.tutils
from libmproxy import console
@ -89,7 +84,7 @@ class TestConsoleState:
f = self._add_request(c)
c.add_flow_setting(f, "foo", "bar")
assert c.get_flow_setting(f, "foo") == "bar"
assert c.get_flow_setting(f, "oink") == None
assert c.get_flow_setting(f, "oink") is None
assert c.get_flow_setting(f, "oink", "foo") == "foo"
assert len(c.flowsettings) == 1
c.delete_flow(f)

View File

@ -1,4 +1,3 @@
from libmproxy import script, flow
import libmproxy.contentviews as cv
from netlib.http import Headers

View File

@ -1,5 +1,5 @@
import cStringIO
from libmproxy import filt, flow
from libmproxy import filt
from libmproxy.protocol import http
from libmproxy.models import Error
from netlib.http import Headers

View File

@ -10,7 +10,11 @@ import netlib.utils
from netlib import odict
from netlib.http import CONTENT_MISSING, Headers
from libmproxy import filt, controller, tnetstring, flow
from libmproxy.models import Error, Flow, HTTPRequest, HTTPResponse, HTTPFlow, decoded
from libmproxy.models import Error
from libmproxy.models import Flow
from libmproxy.models import HTTPFlow
from libmproxy.models import HTTPRequest
from libmproxy.models import HTTPResponse
from libmproxy.proxy.config import HostMatcher
from libmproxy.proxy import ProxyConfig
from libmproxy.proxy.server import DummyServer

View File

@ -1,4 +1,3 @@
import socket
from io import BytesIO
from netlib.exceptions import HttpSyntaxException
from netlib.http import http1

View File

@ -10,7 +10,6 @@ from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
from netlib.exceptions import TcpDisconnect
import tutils
from libpathod import test
from netlib import http, tcp
from netlib.http import http1

View File

@ -1,5 +1,4 @@
import SocketServer
from threading import Thread
from time import sleep

View File

@ -1,6 +1,5 @@
import os.path
import threading
import shutil
import tempfile
import flask
import mock
@ -11,7 +10,6 @@ import libpathod.test
import libpathod.pathoc
from libmproxy import flow, controller
from libmproxy.cmdline import APP_HOST, APP_PORT
import tutils
testapp = flask.Flask(__name__)