Skip to content

Commit 2590e4a

Browse files
authored
Update mypy to 1.14 (#2468)
1 parent 4c12420 commit 2590e4a

File tree

6 files changed

+83
-11
lines changed

6 files changed

+83
-11
lines changed

django-stubs/db/models/enums.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ else:
1717
_enum_property = property
1818
EnumType = enum.EnumMeta
1919

20-
class ReprEnum(enum.Enum): ...
21-
class IntEnum(int, ReprEnum): ...
22-
class StrEnum(str, ReprEnum): ...
20+
class ReprEnum(enum.Enum): ... # type: ignore[misc]
21+
class IntEnum(int, ReprEnum): ... # type: ignore[misc]
22+
class StrEnum(str, ReprEnum): ... # type: ignore[misc]
2323

2424
@deprecated("ChoicesMeta is deprecated in favor of ChoicesType and will be removed in Django 6.0.")
2525
class ChoicesMeta(EnumType):
@@ -42,7 +42,7 @@ class ChoicesMeta(EnumType):
4242

4343
ChoicesType: TypeAlias = ChoicesMeta
4444

45-
class Choices(enum.Enum, metaclass=ChoicesType):
45+
class Choices(enum.Enum, metaclass=ChoicesType): # type: ignore[misc]
4646
@property
4747
def label(self) -> str: ...
4848
@_enum_property
@@ -61,7 +61,7 @@ class _IntegerChoicesMeta(ChoicesType):
6161
# In reality, the `__init__` overloads provided below should also support
6262
# all the arguments of `int.__new__`/`str.__new__` (e.g. `base`, `encoding`).
6363
# They are omitted on purpose to avoid having convoluted stubs for these enums:
64-
class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesMeta):
64+
class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesMeta): # type: ignore[misc]
6565
@overload
6666
def __init__(self, x: ConvertibleToInt) -> None: ...
6767
@overload
@@ -77,7 +77,7 @@ class _TextChoicesMeta(ChoicesType):
7777
@property
7878
def values(self) -> list[str]: ...
7979

80-
class TextChoices(Choices, StrEnum, metaclass=_TextChoicesMeta):
80+
class TextChoices(Choices, StrEnum, metaclass=_TextChoicesMeta): # type: ignore[misc]
8181
@overload
8282
def __init__(self, object: str) -> None: ...
8383
@overload

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ Django==5.1.4; python_version >= '3.10'
1212
-e .[redis,compatible-mypy,oracle]
1313

1414
# Overrides:
15-
mypy==1.13.0
15+
mypy==1.14.0
1616
pyright==1.1.391

scripts/stubtest/allowlist_todo.txt

+72
Original file line numberDiff line numberDiff line change
@@ -1302,3 +1302,75 @@ django.db.models.expressions.rhs
13021302
django.db.models.expressions.result
13031303
django.db.models.expressions.lhs
13041304
django.db.backends.postgresql.base.Cursor
1305+
1306+
# mypy 1.14.0 new issues:
1307+
django.apps.__all__
1308+
django.conf.urls.__all__
1309+
django.contrib.admin.__all__
1310+
django.contrib.gis.admin.__all__
1311+
django.contrib.gis.db.models.__all__
1312+
django.contrib.gis.db.models.aggregates.__all__
1313+
django.contrib.gis.db.models.sql.__all__
1314+
django.contrib.gis.gdal.__all__
1315+
django.contrib.gis.geoip2.__all__
1316+
django.contrib.gis.geos.io.__all__
1317+
django.contrib.gis.geos.prototypes.misc.__all__
1318+
django.contrib.gis.measure.__all__
1319+
django.contrib.gis.sitemaps.__all__
1320+
django.contrib.gis.utils.__all__
1321+
django.contrib.messages.api.__all__
1322+
django.contrib.postgres.aggregates.general.__all__
1323+
django.contrib.postgres.aggregates.statistics.__all__
1324+
django.contrib.postgres.constraints.__all__
1325+
django.contrib.postgres.fields.array.__all__
1326+
django.contrib.postgres.fields.citext.__all__
1327+
django.contrib.postgres.fields.hstore.__all__
1328+
django.contrib.postgres.fields.jsonb.__all__
1329+
django.contrib.postgres.fields.ranges.__all__
1330+
django.contrib.postgres.forms.hstore.__all__
1331+
django.contrib.postgres.forms.ranges.__all__
1332+
django.contrib.postgres.indexes.__all__
1333+
django.core.cache.__all__
1334+
django.core.checks.__all__
1335+
django.core.files.locks.__all__
1336+
django.core.files.move.__all__
1337+
django.core.files.storage.memory.__all__
1338+
django.core.files.temp.__all__
1339+
django.core.files.uploadedfile.__all__
1340+
django.core.files.uploadhandler.__all__
1341+
django.core.mail.__all__
1342+
django.core.servers.basehttp.__all__
1343+
django.db.__all__
1344+
django.db.migrations.operations.__all__
1345+
django.db.models.__all__
1346+
django.db.models.aggregates.__all__
1347+
django.db.models.constraints.__all__
1348+
django.db.models.enums.__all__
1349+
django.db.models.fields.__all__
1350+
django.db.models.fields.generated.__all__
1351+
django.db.models.fields.json.__all__
1352+
django.db.models.functions.__all__
1353+
django.db.models.functions.window.__all__
1354+
django.db.models.indexes.__all__
1355+
django.db.models.sql.__all__
1356+
django.db.models.sql.query.__all__
1357+
django.db.models.sql.subqueries.__all__
1358+
django.forms.boundfield.__all__
1359+
django.forms.fields.__all__
1360+
django.forms.forms.__all__
1361+
django.forms.formsets.__all__
1362+
django.forms.models.__all__
1363+
django.forms.widgets.__all__
1364+
django.http.__all__
1365+
django.http.multipartparser.__all__
1366+
django.template.__all__
1367+
django.test.__all__
1368+
django.test.client.__all__
1369+
django.test.testcases.__all__
1370+
django.test.utils.__all__
1371+
django.urls.__all__
1372+
django.utils.choices.__all__
1373+
django.utils.timezone.__all__
1374+
django.utils.translation.__all__
1375+
django.views.__all__
1376+
django.views.generic.__all__

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def find_stub_files(name: str) -> list[str]:
3131

3232
# Keep compatible-mypy major.minor version pinned to what we use in CI (requirements.txt)
3333
extras_require = {
34-
"compatible-mypy": ["mypy>=1.12,<1.14"],
34+
"compatible-mypy": ["mypy>=1.12,<1.15"],
3535
"redis": ["redis"],
3636
"oracle": ["oracledb"],
3737
}

tests/typecheck/fields/test_base.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
booking = Booking()
2828
reveal_type(booking.id) # N: Revealed type is "builtins.int"
2929
reveal_type(booking.time_range) # N: Revealed type is "Any"
30-
reveal_type(booking.some_decimal) # N: Revealed type is "_decimal.Decimal"
30+
reveal_type(booking.some_decimal) # N: Revealed type is "decimal.Decimal"
3131
installed_apps:
3232
- myapp
3333
files:

tests/typecheck/managers/test_managers.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@
680680
installed_apps:
681681
- myapp
682682
out: |
683-
main:2: note: Revealed type is "myapp.models.MyModel.MyManager"
684-
main:3: note: Revealed type is "Any"
683+
main:2: note: Revealed type is "myapp.models.MyModel.MyManager[myapp.models.MyModel]"
684+
main:3: note: Revealed type is "myapp.models.MyModel"
685685
files:
686686
- path: myapp/__init__.py
687687
- path: myapp/models.py

0 commit comments

Comments
 (0)