Skip to content

Make strict in config a boolean #8636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def split_and_match_files(paths: str) -> List[str]:
'package_root': lambda s: [p.strip() for p in s.split(',')],
'cache_dir': expand_path,
'python_executable': expand_path,
'strict': bool,
} # type: Final


Expand Down Expand Up @@ -208,7 +209,7 @@ def parse_section(prefix: str, template: Options,
options_key = key[3:]
invert = True
elif key == 'strict':
set_strict_flags()
pass # Special handling below
else:
print("%sUnrecognized option: %s = %s" % (prefix, key, section[key]),
file=stderr)
Expand Down Expand Up @@ -239,6 +240,10 @@ def parse_section(prefix: str, template: Options,
except ValueError as err:
print("%s%s: %s" % (prefix, key, err), file=stderr)
continue
if key == 'strict':
if v:
set_strict_flags()
continue
if key == 'silent_imports':
print("%ssilent_imports has been replaced by "
"ignore_missing_imports=True; follow_imports=skip" % prefix, file=stderr)
Expand Down
16 changes: 16 additions & 0 deletions test-data/unit/check-flags.test
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,22 @@ def f(c: A) -> None: # E: Missing type parameters for generic type "A"
strict = True
[out]

[case testStrictFalseInConfigAnyGeneric]
# flags: --config-file tmp/mypy.ini
from typing import TypeVar, Generic

T = TypeVar('T')

class A(Generic[T]):
pass

def f(c: A) -> None:
pass
[file mypy.ini]
\[mypy]
strict = False
[out]

[case testStrictAndStrictEquality]
# flags: --strict
x = 0
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy