mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-01-24 01:52:23 +01:00
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>
This commit is contained in:
parent
016ec1c644
commit
6154450494
@ -21,10 +21,10 @@ from __future__ import print_function
|
||||
import base64
|
||||
import collections
|
||||
import inspect
|
||||
|
||||
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()])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user