diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2016-08-08 16:49:39 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-19 17:49:00 +0900 |
commit | 61544504949b1d86d8919da98090c2f43390ef2a (patch) | |
tree | da0a978a7f0c7126b2c84c7a6064fdd66ba3af67 | |
parent | 016ec1c644e7fd691322e0013e4252d0ac5c8d19 (diff) |
stringify: Fix to utilise six.moves.builtins
To improve Pylint results, this patch fixes to utilise six.moves.builtins
instead of using __builtin__ on Python2 or builtins on Python3.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/stringify.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/ryu/lib/stringify.py b/ryu/lib/stringify.py index 8fb2c967..21b0d9de 100644 --- a/ryu/lib/stringify.py +++ b/ryu/lib/stringify.py @@ -21,10 +21,10 @@ from __future__ import print_function import base64 import collections import inspect -import six +import six -# Some arguments to __init__ is mungled in order to avoid name conflicts +# Some arguments to __init__ is mangled in order to avoid name conflicts # with builtin names. # The standard mangling is to append '_' in order to avoid name clashes # with reserved keywords. @@ -40,15 +40,8 @@ import six # grep __init__ *.py | grep '[^_]_\>' showed that # 'len', 'property', 'set', 'type' # A bit more generic way is adopted -try: - # Python 2 - import __builtin__ -except ImportError: - # Python 3 - import builtins as __builtin__ - -_RESERVED_KEYWORD = dir(__builtin__) +_RESERVED_KEYWORD = dir(six.moves.builtins) _mapdict = lambda f, d: dict([(k, f(v)) for k, v in d.items()]) _mapdict_key = lambda f, d: dict([(f(k), v) for k, v in d.items()]) |