mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
pathod: remove six
This commit is contained in:
parent
8360f70024
commit
d60ef617e3
@ -3,7 +3,6 @@ from __future__ import absolute_import
|
||||
import itertools
|
||||
import time
|
||||
|
||||
from six.moves import range
|
||||
import pyparsing as pp
|
||||
|
||||
from . import http, http2, websockets, writer, exceptions
|
||||
|
@ -1,9 +1,9 @@
|
||||
import operator
|
||||
import os
|
||||
import abc
|
||||
import functools
|
||||
import pyparsing as pp
|
||||
|
||||
from six.moves import reduce
|
||||
from netlib import strutils
|
||||
from netlib import human
|
||||
|
||||
@ -171,14 +171,14 @@ class TokValueGenerate(Token):
|
||||
def expr(cls):
|
||||
e = pp.Literal("@").suppress() + v_integer
|
||||
|
||||
u = reduce(
|
||||
u = functools.reduce(
|
||||
operator.or_,
|
||||
[pp.Literal(i) for i in human.SIZE_UNITS.keys()]
|
||||
).leaveWhitespace()
|
||||
e = e + pp.Optional(u, default=None)
|
||||
|
||||
s = pp.Literal(",").suppress()
|
||||
s += reduce(
|
||||
s += functools.reduce(
|
||||
operator.or_,
|
||||
[pp.Literal(i) for i in generators.DATATYPES.keys()]
|
||||
)
|
||||
|
@ -2,7 +2,6 @@ import string
|
||||
import random
|
||||
import mmap
|
||||
|
||||
import six
|
||||
import sys
|
||||
|
||||
DATATYPES = dict(
|
||||
@ -52,8 +51,6 @@ def rand_byte(chars):
|
||||
"""
|
||||
# bytearray has consistent behaviour on both Python 2 and 3
|
||||
# while bytes does not
|
||||
if six.PY2:
|
||||
return random.choice(chars)
|
||||
return bytes([random.choice(chars)])
|
||||
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
import time
|
||||
|
||||
import six
|
||||
|
||||
from netlib import strutils, human
|
||||
|
||||
|
||||
@ -52,7 +50,7 @@ class LogCtx(object):
|
||||
timestamp = self.timestamp
|
||||
)
|
||||
if exc_value:
|
||||
six.reraise(exc_type, exc_value, traceback)
|
||||
raise exc_value
|
||||
|
||||
def suppress(self):
|
||||
self.suppressed = True
|
||||
|
@ -4,13 +4,12 @@ import sys
|
||||
import os
|
||||
import itertools
|
||||
import hashlib
|
||||
from six.moves import queue
|
||||
import queue
|
||||
import random
|
||||
import select
|
||||
import time
|
||||
|
||||
import OpenSSL.crypto
|
||||
import six
|
||||
import logging
|
||||
|
||||
from netlib.tutils import treq
|
||||
@ -250,9 +249,9 @@ class Pathoc(tcp.TCPClient):
|
||||
if resp.status_code != 200:
|
||||
raise exceptions.HttpException("Unexpected status code: %s" % resp.status_code)
|
||||
except exceptions.HttpException as e:
|
||||
six.reraise(PathocError, PathocError(
|
||||
raise PathocError(
|
||||
"Proxy CONNECT failed: %s" % repr(e)
|
||||
))
|
||||
)
|
||||
|
||||
def socks_connect(self, connect_to):
|
||||
try:
|
||||
|
@ -10,7 +10,7 @@ from netlib import certutils
|
||||
from netlib import websockets
|
||||
from netlib import version
|
||||
|
||||
from six.moves import urllib
|
||||
import urllib
|
||||
from netlib.exceptions import HttpException, HttpReadDisconnect, TcpTimeout, TcpDisconnect, \
|
||||
TlsException
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
from six.moves import cStringIO as StringIO
|
||||
import io
|
||||
import time
|
||||
|
||||
from six.moves import queue
|
||||
import queue
|
||||
|
||||
from . import pathod
|
||||
from netlib import basethread
|
||||
@ -12,7 +11,7 @@ class Daemon:
|
||||
|
||||
def __init__(self, ssl=None, **daemonargs):
|
||||
self.q = queue.Queue()
|
||||
self.logfp = StringIO()
|
||||
self.logfp = io.StringIO()
|
||||
daemonargs["logfp"] = self.logfp
|
||||
self.thread = _PaThread(self.IFACE, self.q, ssl, daemonargs)
|
||||
self.thread.start()
|
||||
|
Loading…
Reference in New Issue
Block a user