************* 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 <[email protected]> --- ryu/ofproto/ofproto_parser.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ryu/ofproto/ofproto_parser.py b/ryu/ofproto/ofproto_parser.py index 148507b..0db2fd7 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) -- 1.7.10.4 ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
