diff options
author | Timothy Edmund Crosley <timothy.crosley@gmail.com> | 2019-04-26 22:46:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 22:46:35 -0700 |
commit | 493c02a1a000fe782cec56f1f43262bacb316381 (patch) | |
tree | 7a052779d81f9790e7daa0245974814056c91740 | |
parent | b8c2f922aadbd23be8f543ead7a826214d04b9c7 (diff) | |
parent | 7565116c8b326757d13582af788464e1a26994a6 (diff) | |
download | isort-493c02a1a000fe782cec56f1f43262bacb316381.tar.gz |
Merge pull request #935 from mkurnikov/mypy-strict-optional
Add strict_optional = True for some files
-rw-r--r-- | isort/compat.py | 2 | ||||
-rw-r--r-- | isort/isort.py | 2 | ||||
-rw-r--r-- | isort/natural.py | 2 | ||||
-rw-r--r-- | isort/settings.py | 2 | ||||
-rw-r--r-- | setup.cfg | 8 |
5 files changed, 11 insertions, 5 deletions
diff --git a/isort/compat.py b/isort/compat.py index 6ea27d90..d3ea4ced 100644 --- a/isort/compat.py +++ b/isort/compat.py @@ -42,7 +42,7 @@ def read_file_contents(file_path: str, encoding: str, fallback_encoding: str) -> return None, None -def get_settings_path(settings_path: Optional[str], current_file_path: str) -> str: +def get_settings_path(settings_path: Optional[str], current_file_path: Optional[str]) -> str: if settings_path: return settings_path diff --git a/isort/isort.py b/isort/isort.py index a240a015..880952e0 100644 --- a/isort/isort.py +++ b/isort/isort.py @@ -193,7 +193,7 @@ class _SortImports(object): def _add_comments( self, - comments: Sequence[str], + comments: Optional[Sequence[str]], original_string: str = "" ) -> str: """ diff --git a/isort/natural.py b/isort/natural.py index 480e6ebf..7398d94d 100644 --- a/isort/natural.py +++ b/isort/natural.py @@ -46,6 +46,6 @@ def nsorted( key_callback = _natural_keys else: def key_callback(text: str) -> List[Any]: - return _natural_keys(key(text)) + return _natural_keys(key(text)) # type: ignore return sorted(to_sort, key=key_callback) diff --git a/isort/settings.py b/isort/settings.py index f7f20176..e0bf72ac 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -38,7 +38,7 @@ from .utils import difference, union try: import toml except ImportError: - toml = None + toml = None # type: ignore try: import appdirs @@ -16,9 +16,15 @@ license_file = LICENSE [mypy] follow_imports = silent ignore_missing_imports = True -strict_optional = False +strict_optional = True warn_no_return = False check_untyped_defs = True +[mypy-test_isort] +strict_optional = False + +[mypy-isort.isort] +strict_optional = False + [tool:pytest] testpaths = test_isort.py |