From 542f02b138466597ad1ebd5f916c8eaad4309537 Mon Sep 17 00:00:00 2001 From: Ekin Dursun Date: Thu, 19 Sep 2019 00:57:36 +0300 Subject: [PATCH 1/3] Remove new_semantic_analyzer from config parameters --- mypy/config_parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index b48c23587d1b..f7ff3b43825f 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -178,7 +178,11 @@ def parse_section(prefix: str, template: Options, if key in config_types: ct = config_types[key] else: - dv = getattr(template, key, None) + dv = None + # We have to keep new_semantic_analyzer in Options + # for plugin compatibility but it is not a valid option anymore. + if key != 'new_semantic_analyzer': + dv = getattr(template, key, None) if dv is None: if key.endswith('_report'): report_type = key[:-7].replace('_', '-') From f1dc856ac2b18f0eff81cc19c521e05d2220504b Mon Sep 17 00:00:00 2001 From: Ekin Dursun Date: Thu, 19 Sep 2019 23:12:49 +0300 Subject: [PATCH 2/3] Change string comparison to member comparison --- mypy/config_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index f7ff3b43825f..b23e1d5c53dd 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -178,11 +178,11 @@ def parse_section(prefix: str, template: Options, if key in config_types: ct = config_types[key] else: - dv = None + dv = getattr(template, key, None) # We have to keep new_semantic_analyzer in Options # for plugin compatibility but it is not a valid option anymore. - if key != 'new_semantic_analyzer': - dv = getattr(template, key, None) + if dv is template.new_semantic_analyzer: + dv = None if dv is None: if key.endswith('_report'): report_type = key[:-7].replace('_', '-') From 301c63ed2f0a6fd7607e93fb8a8dcb8fdd3c9833 Mon Sep 17 00:00:00 2001 From: Ekin Dursun Date: Fri, 20 Sep 2019 09:26:56 +0300 Subject: [PATCH 3/3] Change member comparison to string comparison again --- mypy/config_parser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index b23e1d5c53dd..6a94757f58ed 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -178,11 +178,12 @@ def parse_section(prefix: str, template: Options, if key in config_types: ct = config_types[key] else: - dv = getattr(template, key, None) + dv = None # We have to keep new_semantic_analyzer in Options # for plugin compatibility but it is not a valid option anymore. - if dv is template.new_semantic_analyzer: - dv = None + assert hasattr(template, 'new_semantic_analyzer') + if key != 'new_semantic_analyzer': + dv = getattr(template, key, None) if dv is None: if key.endswith('_report'): report_type = key[:-7].replace('_', '-')