summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-07-26 10:20:52 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-07-26 14:37:04 +0900
commit2970634bbb9f47789d781036c9a6cfa21b1dfb8d (patch)
treeee995e50dce5eac7c725ca7fd1884aedfe9469c3 /tools
parent484bb4d0ebbce21630557ef8f558029683997ad1 (diff)
pyang_plugins: Replace map() with list comprehension
Mostly, using the list comprehension is more efficiently than map() with "lambda". This patch replaces map() + "lambda" by the list comprehension. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py
index f3e42368..c2ebc7c9 100644
--- a/tools/pyang_plugins/bgpyang2golang.py
+++ b/tools/pyang_plugins/bgpyang2golang.py
@@ -733,15 +733,13 @@ def translate_type(key):
# 'hoge-hoge' -> 'HogeHoge'
def convert_to_golang(type_string):
a = type_string.split('.')
- a = map(lambda x: x.capitalize(), a) # XXX locale sensitive
- return '.'.join( ''.join(t.capitalize() for t in x.split('-')) for x in a)
+ a = [x.capitalize() for x in a] # XXX locale sensitive
+ return '.'.join(''.join(t.capitalize() for t in x.split('-')) for x in a)
# 'hoge-hoge' -> 'HOGE_HOGE'
def convert_const_prefix(type_string):
- a = type_string.split('-')
- a = map(lambda x: x.upper(), a) # XXX locale sensitive
- return '_'.join(a)
+ return type_string.replace('-', '_').upper()
def chop_suf(s, suf):