From fb18dea585742f11edf3f20017966698239e7a81 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Fri, 9 Feb 2018 02:28:57 +0100 Subject: Simplify tri_value_str() in oldconfig.py --- examples/oldconfig.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'examples') diff --git a/examples/oldconfig.py b/examples/oldconfig.py index 570e9f9..d8b21c7 100644 --- a/examples/oldconfig.py +++ b/examples/oldconfig.py @@ -134,18 +134,8 @@ def default_value_str(sym): For string/int/hex, returns the default value as-is. """ if sym.type in (BOOL, TRISTATE): - res = [] - - if 0 in sym.assignable: - res.append("N" if sym.tri_value == 0 else "n") - - if 1 in sym.assignable: - res.append("M" if sym.tri_value == 1 else "m") - - if 2 in sym.assignable: - res.append("Y" if sym.tri_value == 2 else "y") - - return "/".join(res) + return "/".join(("nmy" if sym.tri_value != tri else "NMY")[tri] + for tri in sym.assignable) # string/int/hex return sym.str_value -- cgit v1.2.3