ofproto/ofproto_parser: pylint
************* Module ryu.ofproto.ofproto_parser W:155,4:MsgBase.__init__: __init__ method from base class 'StringifyMixin' is not called W:186,8:MsgBase.parser: Redefining name 'msg' from outer scope (line 48) W:240,14:ofp_attrs: Redefining name 'msg' from outer scope (line 48) W:268,17:msg_str_attr: Redefining name 'msg' from outer scope (line 48) E:270,20:msg_str_attr: Undefined variable 'ofp_attr' Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
d86f04015a
commit
77effb29a6
@ -76,6 +76,7 @@ class StringifyMixin(object):
|
|||||||
class MsgBase(StringifyMixin):
|
class MsgBase(StringifyMixin):
|
||||||
@create_list_of_base_attributes
|
@create_list_of_base_attributes
|
||||||
def __init__(self, datapath):
|
def __init__(self, datapath):
|
||||||
|
super(MsgBase, self).__init__()
|
||||||
self.datapath = datapath
|
self.datapath = datapath
|
||||||
self.version = None
|
self.version = None
|
||||||
self.msg_type = None
|
self.msg_type = None
|
||||||
@ -106,10 +107,10 @@ class MsgBase(StringifyMixin):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
|
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
|
||||||
msg = cls(datapath)
|
msg_ = cls(datapath)
|
||||||
msg.set_headers(version, msg_type, msg_len, xid)
|
msg_.set_headers(version, msg_type, msg_len, xid)
|
||||||
msg.set_buf(buf)
|
msg_.set_buf(buf)
|
||||||
return msg
|
return msg_
|
||||||
|
|
||||||
def _serialize_pre(self):
|
def _serialize_pre(self):
|
||||||
assert self.version is None
|
assert self.version is None
|
||||||
@ -160,7 +161,7 @@ def msg_pack_into(fmt, buf, offset, *args):
|
|||||||
struct.pack_into(fmt, buf, offset, *args)
|
struct.pack_into(fmt, buf, offset, *args)
|
||||||
|
|
||||||
|
|
||||||
def ofp_attrs(msg):
|
def ofp_attrs(msg_):
|
||||||
base = getattr(msg, '_base_attributes', [])
|
base = getattr(msg, '_base_attributes', [])
|
||||||
for k, v in inspect.getmembers(msg):
|
for k, v in inspect.getmembers(msg):
|
||||||
if k.startswith('_'):
|
if k.startswith('_'):
|
||||||
@ -169,16 +170,16 @@ def ofp_attrs(msg):
|
|||||||
continue
|
continue
|
||||||
if k in base:
|
if k in base:
|
||||||
continue
|
continue
|
||||||
if hasattr(msg.__class__, k):
|
if hasattr(msg_.__class__, k):
|
||||||
continue
|
continue
|
||||||
yield (k, v)
|
yield (k, v)
|
||||||
|
|
||||||
|
|
||||||
def msg_str_attr(msg, buf, attr_list=None):
|
def msg_str_attr(msg_, buf, attr_list=None):
|
||||||
if attr_list is None:
|
if attr_list is None:
|
||||||
attr_list = ofp_attr(msg)
|
attr_list = ofp_attrs(msg_)
|
||||||
for attr in attr_list:
|
for attr in attr_list:
|
||||||
val = getattr(msg, attr, None)
|
val = getattr(msg_, attr, None)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
buf += ' %s %s' % (attr, val)
|
buf += ' %s %s' % (attr, val)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user