Skip to content

Commit 7b1a378

Browse files
authored
Merge pull request #2334 from matthewhughes934/updates-round3
Updates round 3
2 parents c85b575 + 0eaafa0 commit 7b1a378

File tree

11 files changed

+66
-56
lines changed

11 files changed

+66
-56
lines changed

isort/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def sort_stream(
193193
if config.atomic:
194194
try:
195195
file_content = input_stream.read()
196-
compile(file_content, content_source, "exec", 0, 1)
196+
compile(file_content, content_source, "exec", flags=0, dont_inherit=True)
197197
except SyntaxError:
198198
if extension not in CYTHON_EXTENSIONS:
199199
raise ExistingSyntaxErrors(content_source)
@@ -220,7 +220,7 @@ def sort_stream(
220220
if config.atomic:
221221
_internal_output.seek(0)
222222
try:
223-
compile(_internal_output.read(), content_source, "exec", 0, 1)
223+
compile(_internal_output.read(), content_source, "exec", flags=0, dont_inherit=True)
224224
_internal_output.seek(0)
225225
except SyntaxError: # pragma: no cover
226226
if extension not in CYTHON_EXTENSIONS:

isort/deprecated/finders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from pip_api import parse_requirements # type: ignore
3030

3131
except ImportError:
32-
parse_requirements = None
32+
parse_requirements = None # type: ignore[assignment]
3333

3434

3535
@contextmanager

isort/literal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def wrap(
8686

8787
@register_type("dict", dict)
8888
def _dict(value: Dict[Any, Any], printer: ISortPrettyPrinter) -> str:
89-
return printer.pformat(dict(sorted(value.items(), key=lambda item: item[1]))) # type: ignore
89+
return printer.pformat(dict(sorted(value.items(), key=lambda item: item[1])))
9090

9191

9292
@register_type("list", list)

isort/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,8 @@ def _get_config_data(file_path: str, sections: Tuple[str, ...]) -> Dict[str, Any
858858
and config_key.endswith("}")
859859
and extension
860860
in map(
861-
lambda text: text.strip(), config_key[len("*.{") : -1].split(",") # type: ignore # noqa
861+
lambda text: text.strip(),
862+
config_key[len("*.{") : -1].split(","), # noqa
862863
)
863864
):
864865
settings.update(config.items(config_key))

isort/sorting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def naturally(
117117
else:
118118

119119
def key_callback(text: str) -> List[Any]:
120-
return _natural_keys(key(text)) # type: ignore
120+
return _natural_keys(key(text))
121121

122122
return sorted(to_sort, key=key_callback, reverse=reverse)
123123

poetry.lock

Lines changed: 52 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ cruft = ">=2.12.0"
5757
example-isort-sorting-plugin = ">=0.1.0"
5858
example-shared-isort-profile = ">=0.1.0"
5959
flake8 = ">=3.8.4"
60-
flake8-bugbear = ">=22.12.6,<23.0.0"
60+
flake8-bugbear = ">=22.12.12"
6161
httpx = ">=0.13.3"
6262
hypothesis = ">=6.10.1"
6363
hypothesmith = ">=0.1.3"
6464
libcst = ">=0.3.18"
65-
mypy = ">=0.902,<1.0.0"
65+
mypy = ">=1.14.1"
6666
mypy-extensions = ">=0.4.3"
6767
pep8-naming = ">=0.8.2"
6868
pip = ">=21.1.1"

tests/integration/test_hypothesmith.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def configs(**force_strategies: st.SearchStrategy) -> st.SearchStrategy:
6666
"py_version": st.sampled_from(("auto",) + isort.settings.VALID_PY_TARGETS),
6767
}
6868
kwargs = {**inferred_kwargs, **specific, **force_strategies}
69-
return st.fixed_dictionaries({}, optional=kwargs).map(_as_config) # type: ignore
69+
return st.fixed_dictionaries({}, optional=kwargs).map(_as_config)
7070

7171

7272
st.register_type_strategy(isort.Config, configs())

tests/integration/test_setting_combinations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def configs() -> st.SearchStrategy:
6161
"py_version": st.sampled_from(("auto",) + isort.settings.VALID_PY_TARGETS),
6262
}
6363
kwargs = {**inferred_kwargs, **specific}
64-
return st.fixed_dictionaries({}, optional=kwargs).map(_as_config) # type:ignore
64+
return st.fixed_dictionaries({}, optional=kwargs).map(_as_config)
6565

6666

6767
st.register_type_strategy(isort.Config, configs())

tests/unit/test_isort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5551,7 +5551,7 @@ def test_find_imports_in_stream() -> None:
55515551
"""Ensure that find_imports_in_stream can work with nonseekable streams like STDOUT"""
55525552

55535553
class NonSeekableTestStream(StringIO):
5554-
def seek(self, position):
5554+
def seek(self, offset: int, whence: int = os.SEEK_SET, /) -> int:
55555555
raise OSError("Stream is not seekable")
55565556

55575557
def seekable(self):

0 commit comments

Comments
 (0)