Repository navigation
Update typeshed to 7030b265d887eeacee07e47aa2cca412b07950c4 - #11915
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4b5fccb8-2031-4188-bdc6-cf3405acbc3f
Classification A/C: typeshed commit 0d9b1926fc75ea33c643171b83cea73e3dd9990c (python/typeshed#15712) removes builtins.ellipsis, which never existed at runtime. Use types.EllipsisType to retain exact narrowing expectations, update the builtins symbol list, and remove the obsolete pseudo-type runtime-check case. No reveal expectations are weakened. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4b5fccb8-2031-4188-bdc6-cf3405acbc3f
|
🔒 Automated review in progress — Heejae Chang (@heejaechang) is auto-reviewing this PR. |
| @overload | ||
| def __get__( | ||
| self: Callable[Concatenate[_WrapperSelfT, _PBound], _RWrapper], instance: _WrapperSelfT, owner: type | None = None, / | ||
| ) -> Callable[_PBound, _RWrapper]: ... |
There was a problem hiding this comment.
Warning · Non-blocking recommendation
Could this descriptor overload distinguish function wrappers from callable-instance wrappers? functools.wraps can return a callable instance that is stored on a class but is not a runtime descriptor; declaring __get__ here can make an access such as Holder().callback(3) report an attribute-access error and infer Unknown despite working at runtime. Please verify that case before importing this upstream change.
Keep typeshed 7030b265 and its newer percent-formatting signatures, preserve upstream builtins and logging adjustments, and retain upstream's ellipsis diagnostic test and matching error count. The PR now needs no test changes relative to main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4b5fccb8-2031-4188-bdc6-cf3405acbc3f
|
/benchmark |
|
Diff from mypy_primer, showing the effect of this PR on open source code: ibis (https://github.com/ibis-project/ibis)
- .../projects/ibis/ibis/expr/types/relations.py:3733:20 - error: Argument of type "str | Sequence[str | BooleanColumn | tuple[str | Column | Deferred, str | Column | Deferred] | BooleanValue | bool]" cannot be assigned to parameter "right" of type "Table" in function "__call__"
- Type "str | Sequence[str | BooleanColumn | tuple[str | Column | Deferred, str | Column | Deferred] | BooleanValue | bool]" is not assignable to type "Table"
- "Sequence[str | BooleanColumn | tuple[str | Column | Deferred, str | Column | Deferred] | BooleanValue | bool]" is not assignable to "Table" (reportArgumentType)
- .../projects/ibis/ibis/expr/types/relations.py:3860:16 - error: Expected 1 more positional argument (reportCallIssue)
- 7236 errors, 247 warnings, 0 informations
+ 7234 errors, 247 warnings, 0 informations
werkzeug (https://github.com/pallets/werkzeug)
- .../projects/werkzeug/src/werkzeug/http.py:1316:28 - error: Operator "%" not supported for types "Literal[b"\%03o"]" and "int" (reportOperatorIssue)
- 312 errors, 5 warnings, 0 informations
+ 311 errors, 5 warnings, 0 informations
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:643:22 - error: Cannot access attribute "shape" for class "_Wrapped[..., Unknown, ..., Unknown]"
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:643:22 - error: Cannot access attribute "shape" for class "FunctionType"
- Attribute "shape" is unknown (reportAttributeAccessIssue)
+ Attribute "shape" is unknown (reportFunctionMemberAccess)
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:644:22 - error: Cannot access attribute "shape" for class "_Wrapped[..., Unknown, ..., Unknown]"
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:644:22 - error: Cannot access attribute "shape" for class "FunctionType"
- Attribute "shape" is unknown (reportAttributeAccessIssue)
+ Attribute "shape" is unknown (reportFunctionMemberAccess)
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2182:20 - error: Cannot access attribute "shape" for class "_Wrapped[..., Unknown, ..., Unknown]"
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2182:20 - error: Cannot access attribute "shape" for class "FunctionType"
- Attribute "shape" is unknown (reportAttributeAccessIssue)
+ Attribute "shape" is unknown (reportFunctionMemberAccess)
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2186:21 - error: Argument of type "type | Unknown | _Wrapped[..., Unknown, ..., Unknown]" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2186:21 - error: Argument of type "type | Unknown | ((...) -> Unknown)" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
- Type "type | Unknown | _Wrapped[..., Unknown, ..., Unknown]" is not assignable to type "_NumericArrayLike"
+ Type "type | Unknown | ((...) -> Unknown)" is not assignable to type "_NumericArrayLike"
- Type "type" is not assignable to type "_NumericArrayLike"
+ Type "(...) -> Unknown" is not assignable to type "_NumericArrayLike"
- "type" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+ "FunctionType" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
- "type" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+ "FunctionType" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2186:30 - error: "__getitem__" method not defined on type "_Wrapped[..., Unknown, ..., Unknown]" (reportIndexIssue)
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2186:30 - error: Object of type "(...) -> Unknown" is not subscriptable (reportIndexIssue)
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2238:21 - error: Argument of type "type | Unknown | _Wrapped[..., Unknown, ..., Unknown]" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2238:21 - error: Argument of type "type | Unknown | ((...) -> Unknown)" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
- Type "type | Unknown | _Wrapped[..., Unknown, ..., Unknown]" is not assignable to type "_NumericArrayLike"
+ Type "type | Unknown | ((...) -> Unknown)" is not assignable to type "_NumericArrayLike"
- Type "type" is not assignable to type "_NumericArrayLike"
+ Type "(...) -> Unknown" is not assignable to type "_NumericArrayLike"
- "type" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+ "FunctionType" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
- "type" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+ "FunctionType" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
- .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2238:30 - error: "__getitem__" method not defined on type "_Wrapped[..., Unknown, ..., Unknown]" (reportIndexIssue)
+ .../projects/scikit-learn/sklearn/linear_model/tests/test_logistic.py:2238:30 - error: Object of type "(...) -> Unknown" is not subscriptable (reportIndexIssue)
- .../projects/scikit-learn/sklearn/utils/estimator_checks.py:4029:63 - error: "property" is not iterable
- "__iter__" method not defined (reportGeneralTypeIssues)
- 17620 errors, 470 warnings, 0 informations
+ 17619 errors, 470 warnings, 0 informations
pyodide (https://github.com/pyodide/pyodide)
- .../projects/pyodide/src/tests/test_python_socket.py:273:31 - error: Operator "%" not supported for types "Literal[b"line%02d\x0a"]" and "int" (reportOperatorIssue)
- .../projects/pyodide/src/tests/test_python_socket.py:296:35 - error: Operator "%" not supported for types "Literal[b"line%02d\x0a"]" and "int" (reportOperatorIssue)
- 855 errors, 24 warnings, 0 informations
+ 853 errors, 24 warnings, 0 informations
mkdocs (https://github.com/mkdocs/mkdocs)
- .../projects/mkdocs/mkdocs/livereload/__init__.py
- .../projects/mkdocs/mkdocs/livereload/__init__.py:283:29 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/mkdocs/mkdocs/tests/livereload_tests.py:434:49 - error: Operator "%" not supported for types "Literal[b"[%d]"]" and "int" (reportOperatorIssue)
- 166 errors, 16 warnings, 0 informations
+ 164 errors, 16 warnings, 0 informations
vision (https://github.com/pytorch/vision)
- .../projects/vision/references/detection/coco_eval.py:35:54 - error: Argument of type "list[Unknown]" cannot be assigned to parameter "resFile" of type "str" in function "loadRes"
- "list[Unknown]" is not assignable to "str" (reportArgumentType)
- 1519 errors, 47 warnings, 0 informations
+ 1518 errors, 47 warnings, 0 informations
static-frame (https://github.com/static-frame/static-frame)
+ .../projects/static-frame/static_frame/core/frame.py:760:17 - error: Argument of type "Iterator[Tuple[TLabel, IndexBase]]" cannot be assigned to parameter "value" of type "TIndexInitOrAuto" in function "index_from_optional_constructor"
+ Type "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to type "TIndexInitOrAuto"
+ "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to "IndexBase"
+ "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to "Iterable[TLabel]"
+ Type parameter "_T_co@Iterable" is covariant, but "Tuple[TLabel, IndexBase]" is not a subtype of "TLabel"
+ Type "Tuple[TLabel, IndexBase]" is not assignable to type "TLabel"
+ "Tuple[TLabel, IndexBase]" is incompatible with protocol "Hashable"
+ "Tuple[TLabel, IndexBase]" is not assignable to "int"
+ "Tuple[TLabel, IndexBase]" is not assignable to "integer[Any]"
+ ... (reportArgumentType)
+ .../projects/static-frame/static_frame/core/frame.py:772:17 - error: Argument of type "Iterator[Tuple[TLabel, IndexBase]]" cannot be assigned to parameter "value" of type "TIndexInitOrAuto" in function "index_from_optional_constructor"
+ Type "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to type "TIndexInitOrAuto"
+ "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to "IndexBase"
+ "Iterator[Tuple[TLabel, IndexBase]]" is not assignable to "Iterable[TLabel]"
+ Type parameter "_T_co@Iterable" is covariant, but "Tuple[TLabel, IndexBase]" is not a subtype of "TLabel"
+ Type "Tuple[TLabel, IndexBase]" is not assignable to type "TLabel"
+ "Tuple[TLabel, IndexBase]" is incompatible with protocol "Hashable"
+ "Tuple[TLabel, IndexBase]" is not assignable to "int"
+ "Tuple[TLabel, IndexBase]" is not assignable to "integer[Any]"
+ ... (reportArgumentType)
+ .../projects/static-frame/static_frame/core/frame.py:5558:54 - error: Argument of type "TLocSelectorCompound" cannot be assigned to parameter "key" of type "TLocSelector" in function "_loc_to_iloc"
+ Type "TLocSelectorCompound" is not assignable to type "TLocSelector"
+ Type "Tuple[TLocSelector, TLocSelector]" is not assignable to type "TLocSelector"
+ "Tuple[TLocSelector, TLocSelector]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "Tuple[TLocSelector, TLocSelector]" is not assignable to parameter "self"
+ "Tuple[TLocSelector, TLocSelector]" is not assignable to "tuple[Hashable, ...]"
+ "Tuple[TLocSelector, TLocSelector]" is not assignable to "int"
+ "Tuple[TLocSelector, TLocSelector]" is not assignable to "integer[Any]"
+ "Tuple[TLocSelector, TLocSelector]" is not assignable to "bool"
+ ... (reportArgumentType)
+ .../projects/static-frame/static_frame/core/hloc.py:11:19 - error: Type "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to declared type "TLocSelector"
+ Type "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to type "TLocSelector"
+ "tuple[TLocSelector | tuple[Unknown, ...]]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to parameter "self"
+ "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to "int"
+ "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to "integer[Any]"
+ "tuple[TLocSelector | tuple[Unknown, ...]]" is not assignable to "bool"
+ ... (reportAssignmentType)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:2183:19 - error: Type "tuple[TLocSelector, ...]" is not assignable to declared type "TLocSelector | ILoc | HLoc"
+ Type "tuple[TLocSelector, ...]" is not assignable to type "TLocSelector | ILoc | HLoc"
+ "tuple[TLocSelector, ...]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[TLocSelector, ...]" is not assignable to parameter "self"
+ "tuple[TLocSelector, ...]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[TLocSelector, ...]" is not assignable to "int"
+ "tuple[TLocSelector, ...]" is not assignable to "integer[Any]"
+ "tuple[TLocSelector, ...]" is not assignable to "bool"
+ ... (reportAssignmentType)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:2184:20 - error: Argument of type "TLocSelector | ILoc | HLoc" cannot be assigned to parameter "obj" of type "Sized" in function "len"
+ Type "TLocSelector | ILoc | HLoc" is not assignable to type "Sized"
+ "Hashable" is incompatible with protocol "Sized"
+ "__len__" is not present (reportArgumentType)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3200:21 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3200:21 - error: Argument of type "tuple[slice[None, None, None], Literal[0]]" cannot be assigned to parameter "key" of type "TLabel" in function "__getitem__"
+ Type "tuple[slice[None, None, None], Literal[0]]" is not assignable to type "TLabel"
+ "tuple[slice[None, None, None], Literal[0]]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[slice[None, None, None], Literal[0]]" is not assignable to parameter "self"
+ "tuple[slice[None, None, None], Literal[0]]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[slice[None, None, None], Literal[0]]" is not assignable to "int"
+ "tuple[slice[None, None, None], Literal[0]]" is not assignable to "integer[Any]"
+ "tuple[slice[None, None, None], Literal[0]]" is not assignable to "bool" (reportArgumentType)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3220:17 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3220:17 - error: Argument of type "tuple[slice[None, None, None], Literal[-1]]" cannot be assigned to parameter "key" of type "TLabel" in function "__getitem__"
+ Type "tuple[slice[None, None, None], Literal[-1]]" is not assignable to type "TLabel"
+ "tuple[slice[None, None, None], Literal[-1]]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[slice[None, None, None], Literal[-1]]" is not assignable to parameter "self"
+ "tuple[slice[None, None, None], Literal[-1]]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[slice[None, None, None], Literal[-1]]" is not assignable to "int"
+ "tuple[slice[None, None, None], Literal[-1]]" is not assignable to "integer[Any]"
+ "tuple[slice[None, None, None], Literal[-1]]" is not assignable to "bool" (reportArgumentType)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3229:20 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue)
+ .../projects/static-frame/static_frame/core/index_hierarchy.py:3229:20 - error: Argument of type "tuple[slice[None, None, None], slice[int, None, None]]" cannot be assigned to parameter "key" of type "TLabel" in function "__getitem__"
+ Type "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to type "TLabel"
+ "tuple[slice[None, None, None], slice[int, None, None]]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to parameter "self"
+ "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to "int"
+ "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to "integer[Any]"
+ "tuple[slice[None, None, None], slice[int, None, None]]" is not assignable to "bool" (reportArgumentType)
+ .../projects/static-frame/static_frame/core/quilt.py:1172:67 - error: Argument of type "tuple[TLabel, slice[Any, Any, Any]]" cannot be assigned to parameter "key" of type "TLocSelector" in function "__getitem__"
+ Type "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to type "TLocSelector"
+ "tuple[TLabel, slice[Any, Any, Any]]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to parameter "self"
+ "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to "tuple[Hashable, ...]"
+ Tuple entry 1 is incorrect type
+ "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to "int"
+ "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to "integer[Any]"
+ "tuple[TLabel, slice[Any, Any, Any]]" is not assignable to "bool" (reportArgumentType)
+ .../projects/static-frame/static_frame/core/quilt.py:1280:54 - error: Argument of type "TLocSelectorCompound" cannot be assigned to parameter "key" of type "TLocSelector" in function "_loc_to_iloc"
+ Type "TLocSelectorCompound" is not assignable to type "TLocSelector"
+ Type "Tuple[TLocSelector, TLocSelector]" is not assignable to type "TLocSelector"
+ "Tuple[TLocSelector, TLocSelector]" is incompatible with protocol "Hashable"
+ Could not bind method "__hash__" because "Tuple[TLocSelector, TLocSelector]" is not assignable to parameter "self"
... (truncated 87 lines) ...
mypy (https://github.com/python/mypy)
- .../projects/mypy/mypyc/codegen/literals.py
- .../projects/mypy/mypyc/codegen/literals.py:253:19 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- 1075 errors, 79 warnings, 0 informations
+ 1074 errors, 79 warnings, 0 informations
urllib3 (https://github.com/urllib3/urllib3)
- .../projects/urllib3/src/urllib3/connection.py:596:31 - error: Operator "%" not supported for types "Literal[b"%x\x0d\x0a%b\x0d\x0a"]" and "tuple[int, bytes]" (reportOperatorIssue)
- .../projects/urllib3/src/urllib3/util/url.py
- .../projects/urllib3/src/urllib3/util/url.py:318:34 - error: Operator "%" not supported for types "Literal[b"%%%02X"]" and "int" (reportOperatorIssue)
- .../projects/urllib3/test/with_dummyserver/test_socketlevel.py
- .../projects/urllib3/test/with_dummyserver/test_socketlevel.py:1315:16 - error: Operator "%" not supported for types "Literal[b"Host: %s\x0d\x0a"]" and "bytes | None"
- Operator "%" not supported for types "Literal[b"Host: %s\x0d\x0a"]" and "None" (reportOperatorIssue)
- .../projects/urllib3/test/with_dummyserver/test_socketlevel.py:2127:17 - error: Operator "%" not supported for types "Literal[b"HTTP/1.1 200 OK\x0d\x0aContent-Type: text/plain\x0d\x0aContent\x26"]" and "Literal[2147483648]" (reportOperatorIssue)
- .../projects/urllib3/test/with_dummyserver/test_socketlevel.py:2541:17 - error: Operator "%" not supported for types "Literal[b"HTTP/1.1 200 OK\x0d\x0aContent-Length: %d\x0d\x0aContent-Encod\x26"]" and "tuple[int]" (reportOperatorIssue)
- 169 errors, 15 warnings, 0 informations
+ 164 errors, 15 warnings, 0 informations
scrapy (https://github.com/scrapy/scrapy)
- .../projects/scrapy/tests/test_linkextractors.py:843:27 - error: Operator "%" not supported for types "Literal[b"<a href=\"/p?b=2&a=1#f%d\">x</a>"]" and "int" (reportOperatorIssue)
- 839 errors, 52 warnings, 0 informations
+ 838 errors, 52 warnings, 0 informations
psycopg (https://github.com/psycopg/psycopg)
- .../projects/psycopg/psycopg/psycopg/_queries.py
- .../projects/psycopg/psycopg/psycopg/_queries.py:220:27 - error: Operator "%" not supported for types "Literal[b"$%d"]" and "int" (reportOperatorIssue)
- .../projects/psycopg/psycopg/psycopg/_queries.py:230:22 - error: Operator "%" not supported for types "Literal[b"$%d"]" and "int" (reportOperatorIssue)
- .../projects/psycopg/psycopg/psycopg/_tstrings.py
- .../projects/psycopg/psycopg/psycopg/_tstrings.py:108:29 - error: Operator "%" not supported for types "Literal[b"$%d"]" and "int" (reportOperatorIssue)
- .../projects/psycopg/psycopg/psycopg/types/datetime.py:216:16 - error: Operator "%" not supported for types "Literal[b"%+d day %+d second %+d microsecond"]" and "tuple[int, int, int]" (reportOperatorIssue)
- .../projects/psycopg/psycopg/psycopg/types/uuid.py
- .../projects/psycopg/psycopg/psycopg/types/uuid.py:28:16 - error: Operator "%" not supported for types "Literal[b"%032x"]" and "int" (reportOperatorIssue)
- .../projects/psycopg/tests/pq/test_escaping.py:175:15 - error: Operator "%" not supported for types "Literal[b"\x%02x"]" and "int" (reportOperatorIssue)
- 1988 errors, 113 warnings, 0 informations
+ 1982 errors, 113 warnings, 0 informations
mitmproxy (https://github.com/mitmproxy/mitmproxy)
- .../projects/mitmproxy/mitmproxy/net/http/http1/assemble.py
- .../projects/mitmproxy/mitmproxy/net/http/http1/assemble.py:41:23 - error: Operator "%" not supported for types "Literal[b"%x\x0d\x0a%s\x0d\x0a"]" and "tuple[int, Unknown]" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/net/http/url.py:151:20 - error: Operator "%" not supported for types "Literal[b"%s:%d"]" and "tuple[bytes*, int]" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/proxy/layers/http/_http1.py:254:23 - error: Operator "%" not supported for types "Literal[b"%x\x0d\x0a%s\x0d\x0a"]" and "tuple[int, bytes]" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/proxy/layers/http/_http1.py:382:23 - error: Operator "%" not supported for types "Literal[b"%x\x0d\x0a%s\x0d\x0a"]" and "tuple[int, bytes]" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/proxy/layers/http/_http2.py:152:46 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/proxy/layers/http/_http2.py:395:22 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/mitmproxy/mitmproxy/proxy/layers/http/_http3.py:94:46 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- 2336 errors, 321 warnings, 0 informations
+ 2329 errors, 321 warnings, 0 informations
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- .../projects/dd-trace-py/benchmarks/bm/iast_fixtures/str_methods.py:912:12 - error: Operator "%" not supported for types "Literal[b"INSERT INTO \"show_client\" (\"username\") VALUES (%(n\x26"]" and "dict[Unknown, Unknown]" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/contrib_appsec/aiohttp_app/app.py:120:30 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/aspects/test_modulo_aspect_fixtures.py:271:13 - error: Operator "%" not supported for types "Literal[b"INSERT INTO \"show_client\" (\"username\") VALUES (%s)\x26"]" and "tuple[Literal[1]]" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/aspects/test_modulo_aspect_fixtures.py:277:13 - error: Operator "%" not supported for types "Literal[b"INSERT INTO \"show_client\" (\"username\") VALUES (%(n\x26"]" and "dict[str, Any | Unknown]" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/taint_tracking/test_native_taint_range.py:172:28 - error: Operator "%" not supported for types "Literal[b"N%04d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/taint_tracking/test_native_taint_range.py:177:13 - error: Operator "%" not supported for types "Literal[b"T%04d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/taint_tracking/test_native_taint_range.py:241:28 - error: Operator "%" not supported for types "Literal[b"N%04d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/appsec/iast/taint_tracking/test_native_taint_range.py:246:13 - error: Operator "%" not supported for types "Literal[b"T%04d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:33:15 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:42:19 - error: Operator "%" not supported for types "Literal[b"%d"]" and "int" (reportOperatorIssue)
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:110:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:110:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:129:30 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:129:30 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:200:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:200:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:220:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:220:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:245:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:245:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:261:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:261:36 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:276:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:276:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:292:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:292:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
- .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:324:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[Unknown, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
+ .../projects/dd-trace-py/tests/contrib/wsgi/test_wsgi.py:324:40 - error: Argument of type "(environ: Unknown, start_response: Unknown) -> (Generator[bytes, Any, None] | list[bytes] | None)" cannot be assigned to parameter "application" of type "Iterable[Any]" in function "__init__"
... (truncated 82 lines) ...``` |
|
Compared candidate View the full release history charts with the base and PR results. Execution time historyPeak memory historyType checker benchmark🟢 No performance regressions detected. Regression threshold:
Pyright stats
|
Heejae Chang (heejaechang)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
Upstream typeshed update
Updates bundled typeshed from
6dcbc4c3b0efddc3cb46daa4e5bbe7520979bd1a(current main) to7030b265d887eeacee07e47aa2cca412b07950c4.Upstream compare: python/typeshed@6dcbc4c...7030b26
Initially generated using
python build/updateTypeshed.py; merged latest upstream main to preserve its existing Pyright-specific builtins and logging stub adjustments. Retains the newer bytes/bytearray percent-formatting signatures from python/typeshed#16529.Failure classification summary
No failures in the affected evaluator suites after merging main. Earlier ellipsis-related failures against the original base are already handled by current main (python/typeshed#15712); the final PR has no test changes relative to main. Initial environment setup required
pnpm install --frozen-lockfileafter missing worktree dependencies.Pyright fixes
None. No analyzer implementation changes. Existing upstream main stub adjustments are preserved.
Test updates
None relative to current main. Preserve upstream's ellipsis diagnostic case and matching expected error count.
Precision report
No test
reveal_typeexpectations are weakened. However, the update includes a deliberate upstream precision tradeoff: python/typeshed#16529 changes the bytes/bytearray percent-formatting operand toAny. This fixes legitimate numeric and mapping formatting but also stops rejecting some invalid operands. For example,b"%s" % Noneis now inferred asbyteseven though it raisesTypeErrorat runtime. The primer diff includes a lostNonecheck in urllib3'stest/with_dummyserver/test_socketlevel.py:1315.Separately, python/typeshed#15852 restricts tuple hashability to hashable elements, causing downstream annotation compatibility changes. These are not merely diagnostic text churn. See the review and migration guidance below.
mypy_primer review and downstream impact
Reviewed all eight untruncated artifacts from primer run 39863469669, rather than relying on the shortened bot comment. The run compares candidate merge
f729179d0af88767f51d1d53094c8de79838baac(PR head915392a812f0780403039086e36273e2743d29b6) against basee04be03129cdfbe589f14e0ca8bdff3d5a48d8bf.Across 20 affected projects: 58 diagnostic occurrences removed, 30 added, and 31 replacements at existing diagnostic locations; net 28 fewer errors. A successful primer check means the comparison completed, not that every behavioral change is benign.
9755c8ba0d2265431d2ecbde6da9527171a33a36). The project's Python 3.11 target and selector unions containing slices, lists, arrays, or containers make this a real compatibility change. Representative repros confirm the tighter behavior; the entire downstream project was not rerun locally.541803c22d1286dfbd7497518d3c9eaa6517dcbe) permits legitimate numeric formatting, but also loses some invalid-operand checks as documented above.Unknowntobytes. Existing errors remain. A bounded wrapped-method repro improves from a missing-argument error/Unknownto the correct bound signature andintresult.COCO.loadResinputs (python/typeshed#16570), and correctedtype.__mro__modeling (python/typeshed#16549).No Pyright evaluator regression was demonstrated by this investigation. This does not eliminate the intentional upstream permissiveness or downstream migration impact.
User workarounds and migration guidance
Tuple hashability and selector annotations
Hashable.tuple[AxisSelector, AxisSelector]explicitly where two-axis selection is supported, instead of relying onHashableto admit arbitrary tuples. This can require a fix in the dependency's annotations, not in user application code.pythonVersiononly if the project's actual supported runtime baseline permits it; this does not make tuples containing lists or arrays hashable.Bytes percent-formatting
Ordinary numeric formatting such as
b"%d" % 42now works without a workaround. Because the new operand isAny, users should not rely on%to reject optional or incompatible operands statically. Narrow optional values explicitly, and use typed boundaries or simple bytes concatenation when operand checking matters. For example:For a missing value, choose the application's intended error/omission behavior explicitly rather than silently coercing
None. This example rejects it and keeps the concatenation operands statically checked. A format-aware checker enhancement would be separate work; this PR does not implement one.These are migration options, not additional patches included in this PR.
Validation
After merging current main:
pnpm --dir packages\pyright-internal run test:norebuild --runInBand --runTestsByPath src/tests/typeEvaluator1.test.ts src/tests/typeEvaluator5.test.ts: 2 suites passed; 241 tests passed.pnpm run check:eslint: passed.upstream/main: passed. An unrelated whitespace issue inherited from main is unchanged.Before the main merge, the full suite passed: 96 suites passed, 1 skipped; 3427 tests passed, 12 skipped. The full suite has not been rerun after the merge.