From 2970634bbb9f47789d781036c9a6cfa21b1dfb8d Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Wed, 26 Jul 2017 10:20:52 +0900 Subject: 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 --- tools/pyang_plugins/bgpyang2golang.py | 8 +++----- 1 file 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): -- cgit v1.2.3