changeset 30970:683606a829e8

color: rework conditional 'valideffect' Not very important, but the full conditional is not that hard to follow and having it unified make the function role a bit clearer in my opinion.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2016 02:30:03 +0100
parents ddc80d1777a6
children bb6385882cfa
files mercurial/color.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/color.py	Thu Dec 22 02:26:50 2016 +0100
+++ b/mercurial/color.py	Thu Dec 22 02:30:03 2016 +0100
@@ -116,10 +116,6 @@
 
 def valideffect(effect):
     'Determine if the effect is valid or not.'
-    good = False
-    if not _terminfo_params and effect in _effects:
-        good = True
-    elif (effect in _terminfo_params
-          or effect[:-11] in _terminfo_params):
-        good = True
-    return good
+    return ((not _terminfo_params and effect in _effects)
+             or (effect in _terminfo_params
+                 or effect[:-11] in _terminfo_params))