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:
parent
6f59821b50
commit
d5bb06a3f9
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
import six
|
||||||
|
|
||||||
from ryu.lib.packet import packet
|
from ryu.lib.packet import packet
|
||||||
|
|
||||||
@ -36,9 +37,8 @@ def packet_in_filter(cls, args=None):
|
|||||||
return _packet_in_filter
|
return _packet_in_filter
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(ABCMeta)
|
||||||
class PacketInFilterBase(object):
|
class PacketInFilterBase(object):
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ RFC 4271 BGP-4
|
|||||||
# - RFC 4364 BGP/MPLS IP Virtual Private Networks (VPNs)
|
# - RFC 4364 BGP/MPLS IP Virtual Private Networks (VPNs)
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from ryu.ofproto.ofproto_parser import msg_pack_into
|
from ryu.ofproto.ofproto_parser import msg_pack_into
|
||||||
@ -137,8 +138,8 @@ def pad(bin, len_):
|
|||||||
return bin + (len_ - len(bin)) * '\0'
|
return bin + (len_ - len(bin)) * '\0'
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class _AddrPrefix(StringifyMixin):
|
class _AddrPrefix(StringifyMixin):
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!B' # length
|
_PACK_STR = '!B' # length
|
||||||
|
|
||||||
def __init__(self, length, addr, prefixes=None):
|
def __init__(self, length, addr, prefixes=None):
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
import struct
|
import struct
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
import array
|
import array
|
||||||
import binascii
|
import binascii
|
||||||
@ -387,10 +388,8 @@ class nd_router_advert(stringify.StringifyMixin):
|
|||||||
return length
|
return length
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class nd_option(stringify.StringifyMixin):
|
class nd_option(stringify.StringifyMixin):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def option_type(cls):
|
def option_type(cls):
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
import struct
|
import struct
|
||||||
from . import packet_base
|
from . import packet_base
|
||||||
from . import icmpv6
|
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)
|
ipv6.register_packet_type(sctp.sctp, inet.IPPROTO_SCTP)
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class header(stringify.StringifyMixin):
|
class header(stringify.StringifyMixin):
|
||||||
"""extension header abstract class."""
|
"""extension header abstract class."""
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, nxt):
|
def __init__(self, nxt):
|
||||||
self.nxt = nxt
|
self.nxt = nxt
|
||||||
|
|
||||||
|
@ -14,12 +14,13 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
from ryu.lib import stringify
|
from ryu.lib import stringify
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class PacketBase(stringify.StringifyMixin):
|
class PacketBase(stringify.StringifyMixin):
|
||||||
"""A base class for a protocol (ethernet, ipv4, ...) header."""
|
"""A base class for a protocol (ethernet, ipv4, ...) header."""
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_TYPES = {}
|
_TYPES = {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from ryu.lib import addrconv
|
from ryu.lib import addrconv
|
||||||
@ -227,9 +228,8 @@ class sctp(packet_base.PacketBase):
|
|||||||
# Chunk Types
|
# Chunk Types
|
||||||
#
|
#
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class chunk(stringify.StringifyMixin):
|
class chunk(stringify.StringifyMixin):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!BBH'
|
_PACK_STR = '!BBH'
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
|
|
||||||
@ -252,9 +252,8 @@ class chunk(stringify.StringifyMixin):
|
|||||||
return self.length
|
return self.length
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class chunk_init_base(chunk):
|
class chunk_init_base(chunk):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!BBHIIHHI'
|
_PACK_STR = '!BBHIIHHI'
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
_class_prefixes = ['param_']
|
_class_prefixes = ['param_']
|
||||||
@ -304,9 +303,8 @@ class chunk_init_base(chunk):
|
|||||||
return str(buf)
|
return str(buf)
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class chunk_heartbeat_base(chunk):
|
class chunk_heartbeat_base(chunk):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_class_prefixes = ['param_']
|
_class_prefixes = ['param_']
|
||||||
|
|
||||||
def __init__(self, flags=0, length=0, info=None):
|
def __init__(self, flags=0, length=0, info=None):
|
||||||
@ -338,10 +336,8 @@ class chunk_heartbeat_base(chunk):
|
|||||||
return str(buf)
|
return str(buf)
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class chunk_ack_base(chunk):
|
class chunk_ack_base(chunk):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, flags=0, length=0):
|
def __init__(self, flags=0, length=0):
|
||||||
super(chunk_ack_base, self).__init__(self.chunk_type(), length)
|
super(chunk_ack_base, self).__init__(self.chunk_type(), length)
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
@ -360,9 +356,8 @@ class chunk_ack_base(chunk):
|
|||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class chunk_ecn_base(chunk):
|
class chunk_ecn_base(chunk):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!BBHI'
|
_PACK_STR = '!BBHI'
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
|
|
||||||
@ -1176,9 +1171,8 @@ class chunk_shutdown_complete(chunk):
|
|||||||
# Cause Code
|
# Cause Code
|
||||||
#
|
#
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class cause(stringify.StringifyMixin):
|
class cause(stringify.StringifyMixin):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!HH'
|
_PACK_STR = '!HH'
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
|
|
||||||
@ -1210,10 +1204,8 @@ class cause(stringify.StringifyMixin):
|
|||||||
return length
|
return length
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class cause_with_value(cause):
|
class cause_with_value(cause):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, value=None, length=0):
|
def __init__(self, value=None, length=0):
|
||||||
super(cause_with_value, self).__init__(length)
|
super(cause_with_value, self).__init__(length)
|
||||||
self.value = value
|
self.value = value
|
||||||
@ -1777,9 +1769,8 @@ class cause_protocol_violation(cause_with_value):
|
|||||||
# Chunk Parameter Types
|
# Chunk Parameter Types
|
||||||
#
|
#
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class param(stringify.StringifyMixin):
|
class param(stringify.StringifyMixin):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = '!HH'
|
_PACK_STR = '!HH'
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
|
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
|
import six
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(ABCMeta)
|
||||||
class StreamParser(object):
|
class StreamParser(object):
|
||||||
"""Streaming parser base class.
|
"""Streaming parser base class.
|
||||||
|
|
||||||
@ -29,9 +31,6 @@ class StreamParser(object):
|
|||||||
is TCP.
|
is TCP.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__metaclass__ = ABCMeta
|
|
||||||
|
|
||||||
class TooSmallException(Exception):
|
class TooSmallException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
import struct
|
import struct
|
||||||
from . import packet_base
|
from . import packet_base
|
||||||
from . import arp
|
from . import arp
|
||||||
@ -26,9 +27,8 @@ from . import pbb
|
|||||||
from ryu.ofproto import ether
|
from ryu.ofproto import ether
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class _vlan(packet_base.PacketBase):
|
class _vlan(packet_base.PacketBase):
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
_PACK_STR = "!HH"
|
_PACK_STR = "!HH"
|
||||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ VRRPManager creates/deletes VRRPRounter instances dynamically.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
|
|
||||||
from ryu.base import app_manager
|
from ryu.base import app_manager
|
||||||
from ryu.controller import event
|
from ryu.controller import event
|
||||||
@ -103,9 +104,8 @@ class VRRPParams(object):
|
|||||||
return (3.0 * self.master_adver_interval) + self.skew_time
|
return (3.0 * self.master_adver_interval) + self.skew_time
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class VRRPState(object):
|
class VRRPState(object):
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
def __init__(self, vrrp_router):
|
def __init__(self, vrrp_router):
|
||||||
super(VRRPState, self).__init__()
|
super(VRRPState, self).__init__()
|
||||||
self.vrrp_router = vrrp_router
|
self.vrrp_router = vrrp_router
|
||||||
|
@ -5,4 +5,5 @@ netaddr
|
|||||||
oslo.config
|
oslo.config
|
||||||
paramiko
|
paramiko
|
||||||
routes
|
routes
|
||||||
|
six
|
||||||
webob>=1.0.8
|
webob>=1.0.8
|
||||||
|
Loading…
Reference in New Issue
Block a user