Skip to content

Commit ed45991

Browse files
authored
Issue 1181 (#1182)
* chore: Bump mypy==0.920 * Resolve issue-1181 * Bump mypy==0.920 * Dont pin mypy * Update pytest-mypy-plugins
1 parent 7641ecd commit ed45991

File tree

49 files changed

+196
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+196
-162
lines changed

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pygments==2.10.0
1313

1414
# Dependencies of our project:
1515
typing-extensions==4.0.1
16-
mypy==0.910
16+
mypy==0.920
1717
pytest==6.2.5
1818
hypothesis==6.31.6
1919

poetry.lock

Lines changed: 30 additions & 33 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
@@ -65,7 +65,7 @@ trio = "^0.19"
6565
attrs = "^21.2"
6666
httpx = "^0.21"
6767

68-
mypy = "^0.910"
68+
mypy = "^0.920"
6969
wemake-python-styleguide = "^0.16"
7070
flake8-pytest-style = "^1.5"
7171
flake8-pyi = "^20.10"
@@ -79,7 +79,7 @@ safety = "^1.10"
7979
pytest = "^6.2"
8080
pytest-cov = "^3.0"
8181
pytest-randomly = "^3.10"
82-
pytest-mypy-plugins = "^1.9"
82+
pytest-mypy-plugins = "^1.9.2"
8383
pytest-subtests = "^0.5"
8484
pytest-xdist = "^2.5"
8585
hypothesis = "^6.31"

returns/contrib/mypy/_features/curry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _build_overloads_from_argtree(self, argtree: _ArgTree) -> None:
154154
) and ret_type.type_of_any == TypeOfAny.implementation_artifact
155155
argtree.case = Intermediate(argtree.case).with_ret_type(
156156
child.case if temp_any else Overloaded(
157-
[child.case, *cast(FunctionLike, ret_type).items()],
157+
[child.case, *cast(FunctionLike, ret_type).items],
158158
),
159159
)
160160
else: # Root is reached, we need to save the result:

returns/contrib/mypy/_features/partial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def new_partial(self) -> MypyType:
127127
where each overloaded spec is processed inducidually.
128128
Then we combine everything back together removing unfit parts.
129129
"""
130-
for case_function in self._original.items():
130+
for case_function in self._original.items:
131131
fallback, intermediate = self._create_intermediate(case_function)
132132
self._fallbacks.append(fallback)
133133

returns/contrib/mypy/_features/pipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _unify_type(
110110
) -> MypyType:
111111
return UnionType.make_union([
112112
fetch_type(case)
113-
for case in function.items()
113+
for case in function.items
114114
])
115115

116116

returns/contrib/mypy/_structures/args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import namedtuple
22
from typing import List, Optional
33

4-
from mypy.nodes import Context, TempNode
4+
from mypy.nodes import ArgKind, Context, TempNode
55
from mypy.types import CallableType
66
from mypy.types import Type as MypyType
77
from typing_extensions import final
@@ -16,7 +16,7 @@ class FuncArg(_FuncArgStruct):
1616

1717
name: Optional[str]
1818
type: MypyType # noqa: WPS125
19-
kind: int
19+
kind: ArgKind
2020

2121
def expression(self, context: Context) -> TempNode:
2222
"""Hack to pass unexisting `Expression` to typechecker."""

returns/contrib/mypy/_typeops/analtype.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ def safe_translate_to_function(
8888
This function also resolves all type arguments.
8989
"""
9090
checker = ctx.api.expr_checker # type: ignore
91-
checker.msg.disable_errors()
92-
_return_type, function_def = checker.check_call(
93-
function_def, [], [], ctx.context, [],
94-
)
95-
checker.msg.enable_errors()
91+
with checker.msg.disable_errors():
92+
_return_type, function_def = checker.check_call(
93+
function_def, [], [], ctx.context, [],
94+
)
9695
return function_def
9796

9897

returns/contrib/mypy/_typeops/inference.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from mypy.argmap import map_actuals_to_formals
44
from mypy.constraints import infer_constraints_for_callable
55
from mypy.expandtype import expand_type
6-
from mypy.nodes import ARG_POS
6+
from mypy.nodes import ARG_POS, ArgKind
77
from mypy.plugin import FunctionContext
88
from mypy.types import CallableType, FunctionLike
99
from mypy.types import Type as MypyType
@@ -86,6 +86,7 @@ def _infer_constraints(
8686
[arg.type for arg in applied_args],
8787
kinds,
8888
formal_to_actual,
89+
checker.argument_infer_context(),
8990
)
9091
return {
9192
constraint.type_var: constraint.target
@@ -109,7 +110,7 @@ def __init__(self, instance: MypyType) -> None:
109110
def from_callable_sequence(
110111
self,
111112
pipeline_types: Tuple[MypyType, ...],
112-
pipeline_kinds: List[int],
113+
pipeline_kinds: List[ArgKind],
113114
ctx: CallableContext,
114115
) -> MypyType:
115116
"""Pass pipeline functions to infer them one by one."""

returns/contrib/mypy/_typeops/transform_callable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import ClassVar, FrozenSet, List
22

33
from mypy.checker import detach_callable
4-
from mypy.nodes import ARG_OPT, ARG_POS, ARG_STAR, ARG_STAR2
4+
from mypy.nodes import ARG_OPT, ARG_POS, ARG_STAR, ARG_STAR2, ArgKind
55
from mypy.types import CallableType, FunctionLike, Overloaded
66
from mypy.types import Type as MypyType
77
from typing_extensions import final
@@ -28,7 +28,7 @@ class Intermediate(object):
2828
"""
2929

3030
#: Positional arguments can be of this kind.
31-
_positional_kinds: ClassVar[FrozenSet[int]] = frozenset((
31+
_positional_kinds: ClassVar[FrozenSet[ArgKind]] = frozenset((
3232
ARG_POS,
3333
ARG_OPT,
3434
ARG_STAR,

0 commit comments

Comments
 (0)