Skip to content

Commit b22d42b

Browse files
committed
Unpin mypy, so we go from 1.13.0 => 1.14.1
Includes fixes for new findings + one suppression for later analysis. Change-Id: Ifb1b17bac4c931f2eb768c5ead55fa8bae000e4b
1 parent ba5ea65 commit b22d42b

File tree

7 files changed

+58
-47
lines changed

7 files changed

+58
-47
lines changed

MODULE.bazel.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmk/gui/dashboard/page_edit_dashlet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def dashlet_info_handler(dashlet_spec: DashletConfig) -> SingleInfos:
188188
type_properties = vs_type.from_html_vars("type")
189189
vs_type.validate_value(type_properties, "type")
190190
# We have to trust from_html_vars and validate_value for now
191-
new_dashlet_spec.update(type_properties) # type: ignore[typeddict-item]
191+
new_dashlet_spec.update(type_properties)
192192

193193
elif handle_input_func:
194194
# The returned dashlet must be equal to the parameter! It is not replaced/re-added

cmk/gui/watolib/backup_snapshots.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ def get_basic_tarinfo(name: str) -> tarfile.TarInfo:
224224

225225
for key in ("comment", "created_by", "type"):
226226
tarinfo = get_basic_tarinfo(key)
227-
# key is basically Literal["comment", "created_by", "type"] but
228-
# the assignment from the tuple confuses mypy
229-
encoded_value = data[key].encode("utf-8") # type: ignore[literal-required]
227+
encoded_value = data[key].encode("utf-8")
230228
tarinfo.size = len(encoded_value)
231229
tar_in_progress.addfile(tarinfo, io.BytesIO(encoded_value))
232230

@@ -320,8 +318,7 @@ def check_content() -> None:
320318
def handler(x: str | IO[bytes], entry: str = entry) -> str:
321319
return _get_file_content(x, entry).decode("utf-8")
322320

323-
# entry is assigned from a tuple, mypy does not get that this is Literal...
324-
status[entry] = access_snapshot(handler) # type: ignore[literal-required]
321+
status[entry] = access_snapshot(handler)
325322
else:
326323
raise MKGeneralException(_("Invalid snapshot (missing file: %s)") % entry)
327324

requirements_all_lock.txt

+39-33
Original file line numberDiff line numberDiff line change
@@ -1885,39 +1885,45 @@ multipart==1.2.1 \
18851885
--hash=sha256:829b909b67bc1ad1c6d4488fcdc6391c2847842b08323addf5200db88dbe9480 \
18861886
--hash=sha256:c03dc203bc2e67f6b46a599467ae0d87cf71d7530504b2c1ff4a9ea21d8b8c8c
18871887
# via -r requirements_dev.txt
1888-
mypy==1.13.0 \
1889-
--hash=sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc \
1890-
--hash=sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e \
1891-
--hash=sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f \
1892-
--hash=sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74 \
1893-
--hash=sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a \
1894-
--hash=sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2 \
1895-
--hash=sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b \
1896-
--hash=sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73 \
1897-
--hash=sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e \
1898-
--hash=sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d \
1899-
--hash=sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d \
1900-
--hash=sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6 \
1901-
--hash=sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca \
1902-
--hash=sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d \
1903-
--hash=sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5 \
1904-
--hash=sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62 \
1905-
--hash=sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a \
1906-
--hash=sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc \
1907-
--hash=sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7 \
1908-
--hash=sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb \
1909-
--hash=sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7 \
1910-
--hash=sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732 \
1911-
--hash=sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80 \
1912-
--hash=sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a \
1913-
--hash=sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc \
1914-
--hash=sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2 \
1915-
--hash=sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0 \
1916-
--hash=sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24 \
1917-
--hash=sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7 \
1918-
--hash=sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b \
1919-
--hash=sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372 \
1920-
--hash=sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8
1888+
mypy==1.14.1 \
1889+
--hash=sha256:07ba89fdcc9451f2ebb02853deb6aaaa3d2239a236669a63ab3801bbf923ef5c \
1890+
--hash=sha256:0c911fde686394753fff899c409fd4e16e9b294c24bfd5e1ea4675deae1ac6fd \
1891+
--hash=sha256:183cf0a45457d28ff9d758730cd0210419ac27d4d3f285beda038c9083363b1f \
1892+
--hash=sha256:1fb545ca340537d4b45d3eecdb3def05e913299ca72c290326be19b3804b39c0 \
1893+
--hash=sha256:27fc248022907e72abfd8e22ab1f10e903915ff69961174784a3900a8cba9ad9 \
1894+
--hash=sha256:2ae753f5c9fef278bcf12e1a564351764f2a6da579d4a81347e1d5a15819997b \
1895+
--hash=sha256:30ff5ef8519bbc2e18b3b54521ec319513a26f1bba19a7582e7b1f58a6e69f14 \
1896+
--hash=sha256:3888a1816d69f7ab92092f785a462944b3ca16d7c470d564165fe703b0970c35 \
1897+
--hash=sha256:44bf464499f0e3a2d14d58b54674dee25c031703b2ffc35064bd0df2e0fac319 \
1898+
--hash=sha256:46c756a444117c43ee984bd055db99e498bc613a70bbbc120272bd13ca579fbc \
1899+
--hash=sha256:499d6a72fb7e5de92218db961f1a66d5f11783f9ae549d214617edab5d4dbdbb \
1900+
--hash=sha256:52686e37cf13d559f668aa398dd7ddf1f92c5d613e4f8cb262be2fb4fedb0fcb \
1901+
--hash=sha256:553c293b1fbdebb6c3c4030589dab9fafb6dfa768995a453d8a5d3b23784af2e \
1902+
--hash=sha256:57961db9795eb566dc1d1b4e9139ebc4c6b0cb6e7254ecde69d1552bf7613f60 \
1903+
--hash=sha256:7084fb8f1128c76cd9cf68fe5971b37072598e7c31b2f9f95586b65c741a9d31 \
1904+
--hash=sha256:7d54bd85b925e501c555a3227f3ec0cfc54ee8b6930bd6141ec872d1c572f81f \
1905+
--hash=sha256:7ec88144fe9b510e8475ec2f5f251992690fcf89ccb4500b214b4226abcd32d6 \
1906+
--hash=sha256:8b21525cb51671219f5307be85f7e646a153e5acc656e5cebf64bfa076c50107 \
1907+
--hash=sha256:8b4e3413e0bddea671012b063e27591b953d653209e7a4fa5e48759cda77ca11 \
1908+
--hash=sha256:8c6d94b16d62eb3e947281aa7347d78236688e21081f11de976376cf010eb31a \
1909+
--hash=sha256:8edc07eeade7ebc771ff9cf6b211b9a7d93687ff892150cb5692e4f4272b0837 \
1910+
--hash=sha256:8f845a00b4f420f693f870eaee5f3e2692fa84cc8514496114649cfa8fd5e2c6 \
1911+
--hash=sha256:8fa2220e54d2946e94ab6dbb3ba0a992795bd68b16dc852db33028df2b00191b \
1912+
--hash=sha256:90716d8b2d1f4cd503309788e51366f07c56635a3309b0f6a32547eaaa36a64d \
1913+
--hash=sha256:92c3ed5afb06c3a8e188cb5da4984cab9ec9a77ba956ee419c68a388b4595255 \
1914+
--hash=sha256:ad3301ebebec9e8ee7135d8e3109ca76c23752bac1e717bc84cd3836b4bf3eae \
1915+
--hash=sha256:b66a60cc4073aeb8ae00057f9c1f64d49e90f918fbcef9a977eb121da8b8f1d1 \
1916+
--hash=sha256:ba24549de7b89b6381b91fbc068d798192b1b5201987070319889e93038967a8 \
1917+
--hash=sha256:bce23c7377b43602baa0bd22ea3265c49b9ff0b76eb315d6c34721af4cdf1d9b \
1918+
--hash=sha256:c99f27732c0b7dc847adb21c9d47ce57eb48fa33a17bc6d7d5c5e9f9e7ae5bac \
1919+
--hash=sha256:cb9f255c18052343c70234907e2e532bc7e55a62565d64536dbc7706a20b78b9 \
1920+
--hash=sha256:d4b19b03fdf54f3c5b2fa474c56b4c13c9dbfb9a2db4370ede7ec11a2c5927d9 \
1921+
--hash=sha256:d64169ec3b8461311f8ce2fd2eb5d33e2d0f2c7b49116259c51d0d96edee48d1 \
1922+
--hash=sha256:dbec574648b3e25f43d23577309b16534431db4ddc09fda50841f1e34e64ed34 \
1923+
--hash=sha256:e0fe0f5feaafcb04505bcf439e991c6d8f1bf8b15f12b05feeed96e9e7bf1427 \
1924+
--hash=sha256:f2a0ecc86378f45347f586e4163d1769dd81c5a223d577fe351f26b179e148b1 \
1925+
--hash=sha256:f995e511de847791c3b11ed90084a7a0aafdc074ab88c5a9711622fe4751138c \
1926+
--hash=sha256:fad79bfe3b65fe6a1efaed97b445c3d37f7be9fdc348bdb2d7cac75579607c89
19211927
# via
19221928
# -r requirements_dev.txt
19231929
# pylsp-mypy

requirements_dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jsonschema
2525
libcst # concrete syntax trees for plugin migration helpers
2626
msrest
2727
multipart # redfixh server mocker for integration tests
28-
mypy==1.13.0 # temporary pin # used by test/static/Makefile's test-mypy target--unpin after CMK-19779
28+
mypy # used by test/Makefile's test-mypy target
2929
mypy-protobuf # for mypy
3030
networkx # needed for py-import-cycles
3131
pexpect # used for update testing

tests/testlib/emails.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
import logging
88
import time
99
from collections.abc import Iterator
10+
from email.message import Message
1011
from email.policy import default
1112
from getpass import getuser
1213
from pathlib import Path
13-
from typing import Final
14+
from typing import Final, IO
1415

1516
from faker import Faker
1617

@@ -21,6 +22,13 @@
2122
logger = logging.getLogger(__name__)
2223

2324

25+
def message_from_file(f: IO[str]) -> Message[str, str]:
26+
# The typing of the email package is... "interesting". Here we have a mismatch between the
27+
# expected "Message[str, str]" and the actual "EmailMessage". Even the example on
28+
# https://docs.python.domainunion.de/3/library/email.examples.html has this typing problem. :-}
29+
return email.message_from_file(f, policy=default) # type: ignore[arg-type]
30+
31+
2432
class EmailManager:
2533
def __init__(self) -> None:
2634
self.temp_folder = Path("/tmp")
@@ -64,7 +72,7 @@ def find_email_by_subject(self, email_subject: str | None = None) -> Path | None
6472
for file_name in self.unread_folder.iterdir():
6573
file_path = self.unread_folder / file_name
6674
with open(file_path) as file:
67-
msg = email.message_from_file(file, policy=default)
75+
msg = message_from_file(file)
6876
logger.info("Email received, subject: '%s'", msg.get("Subject"))
6977
if email_subject is None or msg.get("Subject") == email_subject:
7078
return file_path
@@ -99,7 +107,7 @@ def check_email_content(
99107
) -> None:
100108
"""Check that the email has expected fields and text content."""
101109
with open(file_path) as file:
102-
msg = email.message_from_file(file, policy=default)
110+
msg = message_from_file(file)
103111
logger.info("Check that email fields have expected values")
104112
for field, expected_value in expected_fields.items():
105113
assert msg.get(field) == expected_value, f"Field '{field}' has unexpected value"
@@ -120,7 +128,7 @@ def check_email_content(
120128
def copy_html_content_into_file(self, file_path: Path) -> Path:
121129
"""Copy the html content of the email into a file and return the file path."""
122130
with open(file_path) as file:
123-
msg = email.message_from_file(file, policy=default)
131+
msg = message_from_file(file)
124132
for part in msg.walk():
125133
if part.get_content_type() == "text/html":
126134
payload = part.get_payload(decode=True)

tests/unit/cmk/gui/wsgi/test_wsgi_router.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import os
77
import os.path
88
import types
9-
from importlib._bootstrap_external import SourceFileLoader # type: ignore[import-not-found]
9+
from importlib._bootstrap_external import SourceFileLoader
1010

1111
import flask
1212
import pytest

0 commit comments

Comments
 (0)