Skip to content

Commit 0b07cdf

Browse files
authored
Merge pull request #40 from KotlinIsland/basedmypy-1.3
bump basedmypy to 1.3.0a1
2 parents 3945f0c + f40ad45 commit 0b07cdf

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

basedtyping/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from typing import _collect_type_vars, _tp_cache, _type_convert
2323

2424
if TYPE_CHECKING:
25-
Function = Callable[..., object] # type: ignore[misc]
25+
Function = Callable[..., object] # type: ignore[dynamic]
2626
"""Any ``Callable``. useful when using mypy with ``disallow-any-explicit``
2727
due to https://github.com/python/mypy/issues/9496
2828
@@ -143,11 +143,11 @@ def _is_subclass(cls, subclass: object) -> TypeGuard[_ReifiedGenericMetaclass]:
143143
"origin" type (ie. without the generics) is a subclass of this reified generic
144144
"""
145145
# could be any random instance, check it's a reified generic first:
146-
return type.__instancecheck__( # type: ignore[misc]
147-
_ReifiedGenericMetaclass, # type: ignore[misc]
146+
return type.__instancecheck__( # type: ignore[dynamic]
147+
_ReifiedGenericMetaclass, # type: ignore[dynamic]
148148
subclass,
149149
# then check that the instance is an instance of this particular reified generic:
150-
) and type.__subclasscheck__( # type: ignore[misc]
150+
) and type.__subclasscheck__( # type: ignore[dynamic]
151151
cls._orig_class(),
152152
# https://github.com/python/mypy/issues/11671
153153
cast( # pylint:disable=protected-access
@@ -204,7 +204,7 @@ def __call__(cls, *args: object, **kwargs: object) -> object:
204204
"foo = Foo[int]() # correct"
205205
)
206206
cls._check_generics_reified()
207-
return super().__call__(*args, **kwargs) # type: ignore[misc]
207+
return super().__call__(*args, **kwargs) # type: ignore[dynamic]
208208

209209

210210
GenericItems = Union[type, TypeVar, tuple[type | TypeVar, ...]]
@@ -248,14 +248,14 @@ class ReifiedGeneric(Generic[T], metaclass=_ReifiedGenericMetaclass):
248248
__type_vars__: tuple[TypeVar, ...]
249249
"""``TypeVar``\\s that have not yet been reified. so this tuple should always be empty by the time the ``ReifiedGeneric`` is instantiated"""
250250

251-
@_tp_cache # type: ignore[name-defined,misc]
252-
def __class_getitem__( # type: ignore[misc]
251+
@_tp_cache # type: ignore[name-defined,dynamic,misc]
252+
def __class_getitem__( # type: ignore[dynamic]
253253
cls, item: GenericItems
254254
) -> type[ReifiedGeneric[T]]:
255255
# when defining the generic (ie. `class Foo(ReifiedGeneric[T]):`) we want the normal behavior
256256
if cls is ReifiedGeneric:
257257
# https://github.com/KotlinIsland/basedtypeshed/issues/7
258-
return super().__class_getitem__(item) # type: ignore[misc,no-any-return]
258+
return super().__class_getitem__(item) # type: ignore[dynamic,misc,no-any-return]
259259

260260
items = item if isinstance(item, tuple) else (item,)
261261

@@ -265,7 +265,7 @@ def __class_getitem__( # type: ignore[misc]
265265
for generic in (
266266
cls.__reified_generics__ if hasattr(cls, "__reified_generics__") else ()
267267
)
268-
if not isinstance(generic, TypeVar) # type: ignore[misc]
268+
if not isinstance(generic, TypeVar) # type: ignore[dynamic]
269269
)
270270

271271
# normal generics use __parameters__, we use __type_vars__ because the Generic base class deletes properties
@@ -295,10 +295,10 @@ def __class_getitem__( # type: ignore[misc]
295295
# TODO: proper type
296296
dict[str, object](
297297
__reified_generics__=tuple(
298-
_type_convert(t) for t in items # type: ignore[name-defined,misc]
298+
_type_convert(t) for t in items # type: ignore[name-defined,dynamic]
299299
),
300300
_orig_type_vars=orig_type_vars,
301-
__type_vars__=_collect_type_vars( # type: ignore[name-defined,misc]
301+
__type_vars__=_collect_type_vars( # type: ignore[name-defined,dynamic]
302302
items, cast(type, TypeVar)
303303
),
304304
),

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ python = "^3.10"
1313
[tool.poetry.dev-dependencies]
1414
black = "^21.12b0"
1515
flake8 = "^4.0.1"
16-
basedmypy = "^1.2.2"
16+
basedmypy = "^1.3.0a1"
1717
pylint = "^2.11.2"
1818
pytest = "^7.0.0rc1"
1919
isort = "^5.10.1"

tests/test_function_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ def test_method_descriptor() -> None:
3434

3535
def test_class_method_descriptor() -> None:
3636
# method signature contains `Any`
37-
assert_function(dict.fromkeys) # type: ignore[misc]
37+
assert_function(dict.fromkeys) # type: ignore[dynamic]

tests/test_reified_generics/test_not_enough_type_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class Reified2(ReifiedGeneric[tuple[T, U]]):
1313

1414
def test_not_enough_type_params() -> None:
1515
with raises(NotEnoughTypeParametersError):
16-
Reified2[int]() # type: ignore[misc]
16+
Reified2[int]() # type: ignore[dynamic,misc]

tests/test_reified_generics/test_reified_generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class Normal(Generic[T, T2]):
2525

2626
def test_class_args_and_params_class() -> None:
2727
assert (
28-
Normal[int, str].__args__ # type: ignore[attr-defined,misc]
28+
Normal[int, str].__args__ # type: ignore[attr-defined,dynamic]
2929
== Reified[int, str].__reified_generics__
3030
)
3131
assert (
32-
Normal[int, str].__parameters__ # type: ignore[attr-defined,misc]
32+
Normal[int, str].__parameters__ # type: ignore[attr-defined,dynamic]
3333
== Reified[int, str].__type_vars__
3434
)
3535

tests/test_reified_generics/test_typevars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Reified(ReifiedGeneric[T]):
88
pass
99

1010

11-
@fixture # type: ignore[misc]
11+
@fixture # type: ignore[dynamic]
1212
def _value() -> int:
1313
return 1
1414

0 commit comments

Comments
 (0)