summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2013-05-27 18:15:27 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-05-31 17:41:14 +0900
commit77effb29a69eeb6d320dd9a7554924b2578c3c95 (patch)
tree973894868e72d58e9c186b4b742c37f6de4ab6bf
parentd86f04015a3c81ea7df909588b4cc22253d56dbc (diff)
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>
-rw-r--r--ryu/ofproto/ofproto_parser.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/ryu/ofproto/ofproto_parser.py b/ryu/ofproto/ofproto_parser.py
index 148507b1..0db2fd71 100644
--- a/ryu/ofproto/ofproto_parser.py
+++ b/ryu/ofproto/ofproto_parser.py
@@ -76,6 +76,7 @@ class StringifyMixin(object):
class MsgBase(StringifyMixin):
@create_list_of_base_attributes
def __init__(self, datapath):
+ super(MsgBase, self).__init__()
self.datapath = datapath
self.version = None
self.msg_type = None
@@ -106,10 +107,10 @@ class MsgBase(StringifyMixin):
@classmethod
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
- msg = cls(datapath)
- msg.set_headers(version, msg_type, msg_len, xid)
- msg.set_buf(buf)
- return msg
+ msg_ = cls(datapath)
+ msg_.set_headers(version, msg_type, msg_len, xid)
+ msg_.set_buf(buf)
+ return msg_
def _serialize_pre(self):
assert self.version is None
@@ -160,7 +161,7 @@ def msg_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', [])
for k, v in inspect.getmembers(msg):
if k.startswith('_'):
@@ -169,16 +170,16 @@ def ofp_attrs(msg):
continue
if k in base:
continue
- if hasattr(msg.__class__, k):
+ if hasattr(msg_.__class__, k):
continue
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:
- attr_list = ofp_attr(msg)
+ attr_list = ofp_attrs(msg_)
for attr in attr_list:
- val = getattr(msg, attr, None)
+ val = getattr(msg_, attr, None)
if val is not None:
buf += ' %s %s' % (attr, val)