From f7dcaa1f6b32a45afde456e3a854939fc2440daa Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 21 May 2018 01:54:35 +0200 Subject: [PATCH] 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 --- spacy/compat.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spacy/compat.py b/spacy/compat.py index dc0883542..d5eee8431 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -88,11 +88,11 @@ def symlink_to(orig, dest): def is_config(python2=None, python3=None, windows=None, linux=None, osx=None): - return ((python2 is None or python2 == is_python2) and - (python3 is None or python3 == is_python3) and - (windows is None or windows == is_windows) and - (linux is None or linux == is_linux) and - (osx is None or osx == is_osx)) + return (python2 in (None, is_python2) and + python3 in (None, is_python3) and + windows in (None, is_windows) and + linux in (None, is_linux) and + osx in (None, is_osx)) def normalize_string_keys(old):