Create separate entries for each component in mypy.ini (#50030)

This commit is contained in:
Ruslan Sayfutdinov 2021-05-03 17:45:38 +01:00 committed by GitHub
parent 982c12bcc9
commit 5fd8e7008e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1297 additions and 9 deletions

1290
mypy.ini

File diff suppressed because one or more lines are too long

View File

@ -350,10 +350,11 @@ def generate_and_validate(config: Config) -> str:
for key in STRICT_SETTINGS:
mypy_config.set(components_section, key, "false")
strict_section = "mypy-" + ",".join(strict_modules)
mypy_config.add_section(strict_section)
for key in STRICT_SETTINGS:
mypy_config.set(strict_section, key, "true")
for strict_module in strict_modules:
strict_section = f"mypy-{strict_module}"
mypy_config.add_section(strict_section)
for key in STRICT_SETTINGS:
mypy_config.set(strict_section, key, "true")
# Disable strict checks for tests
tests_section = "mypy-tests.*"
@ -361,9 +362,10 @@ def generate_and_validate(config: Config) -> str:
for key in STRICT_SETTINGS:
mypy_config.set(tests_section, key, "false")
ignored_section = "mypy-" + ",".join(IGNORED_MODULES)
mypy_config.add_section(ignored_section)
mypy_config.set(ignored_section, "ignore_errors", "true")
for ignored_module in IGNORED_MODULES:
ignored_section = f"mypy-{ignored_module}"
mypy_config.add_section(ignored_section)
mypy_config.set(ignored_section, "ignore_errors", "true")
with io.StringIO() as fp:
mypy_config.write(fp)