Commit b93c307c authored by Tom Niget's avatar Tom Niget Committed by Tom Niget

style: remove new-style class code from the Python2 days

parent 669df364
......@@ -11,7 +11,7 @@ from re6st.registry import RegistryServer
@apply
class proxy(object):
class proxy:
def __init__(self):
self.sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
......
......@@ -3,7 +3,7 @@ from itertools import chain
from .registry import RegistryClient
from . import utils, version, x509
class Cache(object):
class Cache:
def __init__(self, db_path, registry, cert: x509.Cert, db_size=200):
self._prefix = cert.prefix
......
......@@ -5,7 +5,7 @@ from . import utils
uint16 = struct.Struct("!H")
header = struct.Struct("!HI")
class Struct(object):
class Struct:
def __init__(self, format, *args):
if args:
......@@ -29,7 +29,7 @@ class Struct(object):
self.encode = encode
self.decode = decode
class Array(object):
class Array:
def __init__(self, item):
self._item = item
......@@ -49,7 +49,7 @@ class Array(object):
r.append(x)
return o, r
class String(object):
class String:
@staticmethod
def encode(buffer: bytes, value: str):
......@@ -61,7 +61,7 @@ class String(object):
return i + 1, buffer[offset:i].decode("utf-8")
class Buffer(object):
class Buffer:
def __init__(self):
self._buf = bytearray()
......@@ -114,7 +114,7 @@ class Buffer(object):
struct.pack_into(self._buf, offset, *args)
class Packet(object):
class Packet:
response_dict = {}
......@@ -167,7 +167,7 @@ class ConnectionClosed(BabelException):
return "connection to babeld closed (%s)" % self.args
class Babel(object):
class Babel:
_decode = None
......@@ -295,7 +295,7 @@ class Babel(object):
pass
class iterRoutes(object):
class iterRoutes:
_waiting = True
......
import errno, os, socket, stat, threading
class Socket(object):
class Socket:
def __init__(self, socket):
# In case that the default timeout is not None.
......@@ -45,7 +45,7 @@ class Socket(object):
return False
class Console(object):
class Console:
def __init__(self, path, pdb):
self.path = path
......
......@@ -43,7 +43,7 @@ freeifaddrs = libc.freeifaddrs
freeifaddrs.restype = None
freeifaddrs.argtypes = [POINTER(struct_ifaddrs)]
class unpacker(object):
class unpacker:
def __init__(self, buf):
self._buf = buf
......@@ -55,7 +55,7 @@ class unpacker(object):
self._offset += s.size
return result
class PimDm(object):
class PimDm:
def __init__(self):
s_netlink = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE)
......
......@@ -51,7 +51,7 @@ class HTTPError(Exception):
pass
class RegistryServer(object):
class RegistryServer:
peers = 0, ()
cert_duration = 365 * 86400
......@@ -795,7 +795,7 @@ class RegistryServer(object):
return json.dumps({k: list(v) for k, v in graph.items()})
class RegistryClient(object):
class RegistryClient:
_hmac = None
user_agent = "re6stnet/%s, %s" % (version.version, platform.platform())
......
......@@ -15,7 +15,7 @@ from re6st.tests import DEMO_PATH
DH_FILE = DEMO_PATH / "dh2048.pem"
class DummyNode(object):
class DummyNode:
"""fake node to reuse Re6stRegistry
error: node.Popen has destory method which not in subprocess.Popen
......
......@@ -50,7 +50,7 @@ class Node(nemu.Node):
if_s.add_v4_address(ip, prefix_len=prefix_len)
return if_s
class NetManager(object):
class NetManager:
"""contain all the nemu object created, so they can live more time"""
def __init__(self):
self.object = []
......
......@@ -37,7 +37,7 @@ def ip_to_serial(ip6):
return int(ip6, 16)
class Re6stRegistry(object):
class Re6stRegistry:
"""class run a re6st-registry service on a namespace"""
registry_seq = 0
......@@ -140,7 +140,7 @@ class Re6stRegistry(object):
pass
class Re6stNode(object):
class Re6stNode:
"""class run a re6stnet service on a namespace"""
node_seq = 0
......
......@@ -59,7 +59,7 @@ class MultiGatewayManager(dict):
except:
pass
class Connection(object):
class Connection:
_retry = 0
serial = None
......@@ -132,7 +132,7 @@ class Connection(object):
self.open()
return 0
class TunnelKiller(object):
class TunnelKiller:
state = None
......@@ -186,7 +186,7 @@ class TunnelKiller(object):
locked = unlocking = lambda _: None
class BaseTunnelManager(object):
class BaseTunnelManager:
# TODO: To minimize downtime when network parameters change, we should do
# our best to not restart any process. Ideally, this list should be
......
......@@ -7,7 +7,7 @@ class UPnPException(Exception):
pass
class Forwarder(object):
class Forwarder:
"""
External port is chosen randomly between 32768 & 49151 included.
"""
......
......@@ -120,7 +120,7 @@ class ArgParser(argparse.ArgumentParser):
ca /etc/re6stnet/ca.crt""", **kw)
class exit(object):
class exit:
status = None
......
......@@ -84,7 +84,7 @@ class NewSessionError(Exception):
pass
class Cert(object):
class Cert:
def __init__(self, ca, key, cert=None):
self.ca_path = ca
......@@ -176,7 +176,7 @@ class Cert(object):
PACKED_PROTOCOL = utils.packInteger(protocol)
class Peer(object):
class Peer:
"""
UDP: A ─────────────────────────────────────────────> B
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment