Simplify is_config() and normalize_string_keys() (#2305)

* Simplify is_config() and normalize_string_keys()

* Use __in__ to avoid the nested _ands_ and _ors_.
* Dict comprehension directly tracks with the doc string

* Keep more basic loop in normalize_string_keys

* Whitespace
This commit is contained in:
cclauss 2018-05-21 01:54:35 +02:00 committed by Matthew Honnibal
parent ff1082d8e4
commit f7dcaa1f6b

View File

@ -88,11 +88,11 @@ def symlink_to(orig, dest):
def is_config(python2=None, python3=None, windows=None, linux=None, osx=None): def is_config(python2=None, python3=None, windows=None, linux=None, osx=None):
return ((python2 is None or python2 == is_python2) and return (python2 in (None, is_python2) and
(python3 is None or python3 == is_python3) and python3 in (None, is_python3) and
(windows is None or windows == is_windows) and windows in (None, is_windows) and
(linux is None or linux == is_linux) and linux in (None, is_linux) and
(osx is None or osx == is_osx)) osx in (None, is_osx))
def normalize_string_keys(old): def normalize_string_keys(old):