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