Update mypy to 1.12.0 (#12859)

This commit is contained in:
Sebastian Rittau
2024-10-19 17:45:38 +02:00
committed by GitHub
parent 890a38f424
commit ebdd2c528d
8 changed files with 23 additions and 43 deletions

View File

@@ -1,6 +1,6 @@
# Type checkers that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible.
mypy==1.11.2
mypy==1.12.0
pyright==1.1.385
# pytype can be installed on Windows, but requires building wheels, let's not do that on the CI
pytype==2024.10.11; platform_system != "Windows" and python_version >= "3.10" and python_version < "3.13"

View File

@@ -74,8 +74,6 @@ _io.StringIO.truncate
_io.TextIOWrapper.truncate
ipaddress.IPv4Interface.hostmask
ipaddress.IPv6Interface.hostmask
ipaddress._BaseNetwork.broadcast_address
ipaddress._BaseNetwork.hostmask
ipaddress._BaseAddress.is_global
ipaddress._BaseAddress.is_link_local
ipaddress._BaseAddress.is_loopback

View File

@@ -181,7 +181,3 @@ codecs.xmlcharrefreplace_errors
# To match `dict`, we lie about the runtime, but use overloads to match the correct behavior
types.MappingProxyType.get
# `__replace__` is dynamically generated, and special-cased by type-checkers
pstats.FunctionProfile.__replace__
pstats.StatsProfile.__replace__

View File

@@ -1,4 +1 @@
flake8.__main__
# Can't reconcile @cached_property with @property.
flake8.processor.FileProcessor.file_tokens

View File

@@ -30,10 +30,3 @@ networkx\.algorithms\.bipartite\.(cluster\.)?clustering
# failing to account for explicitly passing in the default value."
# Which is true, but would require some way of concatenating `backend` to ParamSpec.kwargs
networkx\.(utils\.)?(backends\.)?_dispatchable\.__call__
# TODO: stubtest does not like @cached_property https://github.com/python/mypy/issues/17625
# "is inconsistent, cannot reconcile @property on stub with runtime object"
networkx(\.classes(\.graph)?)?\.Graph\.(adj|degree|edges|nodes)
networkx(\.classes(\.multigraph)?)?\.MultiGraph\.(adj|degree|edges)
networkx(\.classes(\.digraph)?)?\.DiGraph\.(adj|degree|edges|in_degree|in_edges|out_degree|out_edges|pred|succ)
networkx(\.classes(\.multidigraph)?)?\.MultiDiGraph\.(adj|degree|edges|in_degree|in_edges|out_degree|out_edges|pred|succ)

View File

@@ -159,7 +159,7 @@ WithDescriptorsStrict().descriptor = None
# Test getters
assert_type(with_descriptors.descriptor, str)
assert_type(with_descriptors.typed_not_none, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.typed_not_none, str)
assert_type(with_descriptors.typed_none, Union[str, None])
assert_type(with_descriptors.set_tuple, Union[Literal["a", 1], float]) # type: ignore[assert-type] # False-positive in mypy
@@ -172,9 +172,9 @@ assert_type(with_descriptors.noneset_list, Union[str, float, None]) # type: ign
assert_type(with_descriptors.length_tuple, Tuple[str, str])
assert_type(with_descriptors.length_list, List[str])
assert_type(with_descriptors.match_pattern_str, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.match_pattern_str, str)
assert_type(with_descriptors.match_pattern_str_none, Union[str, None])
assert_type(with_descriptors.match_pattern_bytes, ReadableBuffer) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.match_pattern_bytes, ReadableBuffer)
assert_type(with_descriptors.match_pattern_bytes_none, Union[ReadableBuffer, None])
assert_type(with_descriptors.convertible_not_none, int) # type: ignore[assert-type] # False-positive in mypy
@@ -208,7 +208,7 @@ with_descriptors.descriptor = 0 # type: ignore
with_descriptors.typed_not_none = ""
with_descriptors.typed_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.typed_not_none = None # type: ignore
with_descriptors.typed_not_none = 0 # type: ignore
with_descriptors.typed_none = ""
@@ -267,7 +267,7 @@ with_descriptors.length_list = "" # type: ignore
with_descriptors.match_pattern_str = ""
with_descriptors.match_pattern_str = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.match_pattern_str = None # type: ignore
with_descriptors.match_pattern_str = b"" # type: ignore
with_descriptors.match_pattern_str = 0 # type: ignore
@@ -277,7 +277,7 @@ with_descriptors.match_pattern_str_none = b"" # type: ignore
with_descriptors.match_pattern_str_none = 0 # type: ignore
with_descriptors.match_pattern_bytes = b""
with_descriptors.match_pattern_bytes = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.match_pattern_bytes = None # type: ignore
with_descriptors.match_pattern_bytes = "" # type: ignore
with_descriptors.match_pattern_bytes = 0 # type: ignore
@@ -340,7 +340,7 @@ with_descriptors.bool_none = object() # type: ignore
with_descriptors.datetime_not_none = datetime(0, 0, 0)
with_descriptors.datetime_not_none = ""
with_descriptors.datetime_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.datetime_not_none = None # type: ignore
with_descriptors.datetime_not_none = 0 # type: ignore
with_descriptors.datetime_not_none = date(0, 0, 0) # type: ignore
with_descriptors.datetime_not_none = time() # type: ignore

View File

@@ -154,23 +154,23 @@ assert_type(with_descriptors.set_tuple_none, Union[Literal["a", 1, None], float]
assert_type(with_descriptors.noneset_tuple, Union[Literal["a", 1], float, None]) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.noneset_list, Union[str, float, None]) # type: ignore[assert-type] # False-positive in mypy # int and float are merged in generic unions
assert_type(with_descriptors.convertible_not_none, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.convertible_not_none, int)
assert_type(with_descriptors.convertible_none, Union[int, None])
assert_type(with_descriptors.text_str_not_none, str) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.text_str_not_none, str)
assert_type(with_descriptors.text_str_none, Union[str, None])
assert_type(with_descriptors.text_int_not_none, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.text_int_not_none, int)
assert_type(with_descriptors.text_int_none, Union[int, None])
assert_type(with_descriptors.minmax_float, float) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.minmax_float, float)
assert_type(with_descriptors.minmax_float_none, Union[float, None])
assert_type(with_descriptors.minmax_int, int) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.minmax_int, int)
assert_type(with_descriptors.minmax_int_none, Union[int, None])
assert_type(with_descriptors.bool_not_none, bool) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.bool_none, Union[bool, None])
assert_type(with_descriptors.emptytag_not_none, bool) # type: ignore[assert-type] # False-positive in mypy
assert_type(with_descriptors.emptytag_not_none, bool)
assert_type(with_descriptors.emptytag_none, Union[bool, None])
assert_type(with_descriptors.string_not_none, str) # type: ignore[assert-type] # False-positive in mypy
@@ -301,16 +301,16 @@ with_descriptors.text_str_none = cast(_HasTagAndGet[object], _)
with_descriptors.text_int_not_none = 0
with_descriptors.text_int_not_none = "0"
with_descriptors.text_int_not_none = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = object() # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = None # type: ignore
with_descriptors.text_int_not_none = object() # type: ignore
# If expected type (_T) is not str, it's impossible to use an Element as the value
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[int], _
)
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[None], _
)
with_descriptors.text_int_not_none = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.text_int_not_none = cast( # type: ignore
_HasTagAndGet[str], _
)
@@ -333,10 +333,10 @@ with_descriptors.text_int_none = cast( # pyright: ignore[reportAttributeAccessI
with_descriptors.minmax_float = 0
with_descriptors.minmax_float = "0"
with_descriptors.minmax_float = 0.0
with_descriptors.minmax_float = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_float = None # type: ignore
with_descriptors.minmax_float = object() # type: ignore
with_descriptors.minmax_float = cast(_HasTagAndGet[float], _)
with_descriptors.minmax_float = cast( # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_float = cast( # type: ignore
_HasTagAndGet[None], _
)
with_descriptors.minmax_float = cast(_HasTagAndGet[object], _) # type: ignore
@@ -353,10 +353,10 @@ with_descriptors.minmax_float_none = cast(_HasTagAndGet[object], _) # type: ign
with_descriptors.minmax_int = 0
with_descriptors.minmax_int = "0"
with_descriptors.minmax_int = 0.0
with_descriptors.minmax_int = None # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_int = None # type: ignore
with_descriptors.minmax_int = object() # type: ignore
with_descriptors.minmax_int = cast(_HasTagAndGet[int], _)
with_descriptors.minmax_int = cast(_HasTagAndGet[None], _) # pyright: ignore[reportAttributeAccessIssue] # false negative in mypy
with_descriptors.minmax_int = cast(_HasTagAndGet[None], _) # type: ignore
with_descriptors.minmax_int = cast(_HasTagAndGet[object], _) # type: ignore
with_descriptors.minmax_int_none = 0

View File

@@ -1,7 +1,3 @@
# @cached_property that fail to get recognized as such by stubtest
pygit2.config.ConfigEntry.level
pygit2.config.ConfigEntry.raw_name
pygit2.config.ConfigEntry.raw_value
# Actual signatures enforced by C-level checks not visible to stubtest
pygit2.Mailmap.__init__
pygit2.OdbBackend.__init__