use six.add_metaclass

as suggested by OpenStack Style Guideline.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2014-02-10 18:30:15 +09:00 committed by FUJITA Tomonori
parent 6f59821b50
commit d5bb06a3f9
10 changed files with 26 additions and 35 deletions

View File

@ -16,6 +16,7 @@
import logging
from abc import ABCMeta, abstractmethod
import six
from ryu.lib.packet import packet
@ -36,9 +37,8 @@ def packet_in_filter(cls, args=None):
return _packet_in_filter
@six.add_metaclass(ABCMeta)
class PacketInFilterBase(object):
__metaclass__ = ABCMeta
def __init__(self, args):
self.args = args

View File

@ -23,6 +23,7 @@ RFC 4271 BGP-4
# - RFC 4364 BGP/MPLS IP Virtual Private Networks (VPNs)
import abc
import six
import struct
from ryu.ofproto.ofproto_parser import msg_pack_into
@ -137,8 +138,8 @@ def pad(bin, len_):
return bin + (len_ - len(bin)) * '\0'
@six.add_metaclass(abc.ABCMeta)
class _AddrPrefix(StringifyMixin):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!B' # length
def __init__(self, length, addr, prefixes=None):

View File

@ -15,6 +15,7 @@
import abc
import struct
import six
import sys
import array
import binascii
@ -387,10 +388,8 @@ class nd_router_advert(stringify.StringifyMixin):
return length
@six.add_metaclass(abc.ABCMeta)
class nd_option(stringify.StringifyMixin):
__metaclass__ = abc.ABCMeta
@classmethod
@abc.abstractmethod
def option_type(cls):

View File

@ -14,6 +14,7 @@
# limitations under the License.
import abc
import six
import struct
from . import packet_base
from . import icmpv6
@ -147,11 +148,9 @@ ipv6.register_packet_type(udp.udp, inet.IPPROTO_UDP)
ipv6.register_packet_type(sctp.sctp, inet.IPPROTO_SCTP)
@six.add_metaclass(abc.ABCMeta)
class header(stringify.StringifyMixin):
"""extension header abstract class."""
__metaclass__ = abc.ABCMeta
def __init__(self, nxt):
self.nxt = nxt

View File

@ -14,12 +14,13 @@
# limitations under the License.
import abc
import six
from ryu.lib import stringify
@six.add_metaclass(abc.ABCMeta)
class PacketBase(stringify.StringifyMixin):
"""A base class for a protocol (ethernet, ipv4, ...) header."""
__metaclass__ = abc.ABCMeta
_TYPES = {}
@classmethod

View File

@ -14,6 +14,7 @@
# limitations under the License.
import abc
import six
import struct
from ryu.lib import addrconv
@ -227,9 +228,8 @@ class sctp(packet_base.PacketBase):
# Chunk Types
#
#=======================================================================
@six.add_metaclass(abc.ABCMeta)
class chunk(stringify.StringifyMixin):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!BBH'
_MIN_LEN = struct.calcsize(_PACK_STR)
@ -252,9 +252,8 @@ class chunk(stringify.StringifyMixin):
return self.length
@six.add_metaclass(abc.ABCMeta)
class chunk_init_base(chunk):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!BBHIIHHI'
_MIN_LEN = struct.calcsize(_PACK_STR)
_class_prefixes = ['param_']
@ -304,9 +303,8 @@ class chunk_init_base(chunk):
return str(buf)
@six.add_metaclass(abc.ABCMeta)
class chunk_heartbeat_base(chunk):
__metaclass__ = abc.ABCMeta
_class_prefixes = ['param_']
def __init__(self, flags=0, length=0, info=None):
@ -338,10 +336,8 @@ class chunk_heartbeat_base(chunk):
return str(buf)
@six.add_metaclass(abc.ABCMeta)
class chunk_ack_base(chunk):
__metaclass__ = abc.ABCMeta
def __init__(self, flags=0, length=0):
super(chunk_ack_base, self).__init__(self.chunk_type(), length)
self.flags = flags
@ -360,9 +356,8 @@ class chunk_ack_base(chunk):
return buf
@six.add_metaclass(abc.ABCMeta)
class chunk_ecn_base(chunk):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!BBHI'
_MIN_LEN = struct.calcsize(_PACK_STR)
@ -1176,9 +1171,8 @@ class chunk_shutdown_complete(chunk):
# Cause Code
#
#=======================================================================
@six.add_metaclass(abc.ABCMeta)
class cause(stringify.StringifyMixin):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!HH'
_MIN_LEN = struct.calcsize(_PACK_STR)
@ -1210,10 +1204,8 @@ class cause(stringify.StringifyMixin):
return length
@six.add_metaclass(abc.ABCMeta)
class cause_with_value(cause):
__metaclass__ = abc.ABCMeta
def __init__(self, value=None, length=0):
super(cause_with_value, self).__init__(length)
self.value = value
@ -1777,9 +1769,8 @@ class cause_protocol_violation(cause_with_value):
# Chunk Parameter Types
#
#=======================================================================
@six.add_metaclass(abc.ABCMeta)
class param(stringify.StringifyMixin):
__metaclass__ = abc.ABCMeta
_PACK_STR = '!HH'
_MIN_LEN = struct.calcsize(_PACK_STR)

View File

@ -16,8 +16,10 @@
from abc import ABCMeta, abstractmethod
import six
@six.add_metaclass(ABCMeta)
class StreamParser(object):
"""Streaming parser base class.
@ -29,9 +31,6 @@ class StreamParser(object):
is TCP.
"""
__metaclass__ = ABCMeta
class TooSmallException(Exception):
pass

View File

@ -14,6 +14,7 @@
# limitations under the License.
import abc
import six
import struct
from . import packet_base
from . import arp
@ -26,9 +27,8 @@ from . import pbb
from ryu.ofproto import ether
@six.add_metaclass(abc.ABCMeta)
class _vlan(packet_base.PacketBase):
__metaclass__ = abc.ABCMeta
_PACK_STR = "!HH"
_MIN_LEN = struct.calcsize(_PACK_STR)

View File

@ -21,6 +21,7 @@ VRRPManager creates/deletes VRRPRounter instances dynamically.
"""
import abc
import six
from ryu.base import app_manager
from ryu.controller import event
@ -103,9 +104,8 @@ class VRRPParams(object):
return (3.0 * self.master_adver_interval) + self.skew_time
@six.add_metaclass(abc.ABCMeta)
class VRRPState(object):
__metaclass__ = abc.ABCMeta
def __init__(self, vrrp_router):
super(VRRPState, self).__init__()
self.vrrp_router = vrrp_router

View File

@ -5,4 +5,5 @@ netaddr
oslo.config
paramiko
routes
six
webob>=1.0.8