diff --git a/pathod/language/__init__.py b/pathod/language/__init__.py index a43424eaf..15c2895bf 100644 --- a/pathod/language/__init__.py +++ b/pathod/language/__init__.py @@ -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 diff --git a/pathod/language/base.py b/pathod/language/base.py index 3446f74c1..bdcc6d2fa 100644 --- a/pathod/language/base.py +++ b/pathod/language/base.py @@ -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()] ) diff --git a/pathod/language/generators.py b/pathod/language/generators.py index 68705941a..4040e099f 100644 --- a/pathod/language/generators.py +++ b/pathod/language/generators.py @@ -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)]) diff --git a/pathod/log.py b/pathod/log.py index 478371010..1a709dc60 100644 --- a/pathod/log.py +++ b/pathod/log.py @@ -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 diff --git a/pathod/pathoc.py b/pathod/pathoc.py index 59ae5fba8..f122c14f8 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -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: diff --git a/pathod/pathod.py b/pathod/pathod.py index 4f6c3d380..e882b73ef 100644 --- a/pathod/pathod.py +++ b/pathod/pathod.py @@ -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 diff --git a/pathod/test.py b/pathod/test.py index 4992945d2..c92cc50b1 100644 --- a/pathod/test.py +++ b/pathod/test.py @@ -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()