-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use union types instead of join in binder #18538
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
OK, so 90% of the new errors are because class Base:
def foo(self, x: Any): ...
class C1(Base):
def foo(self, x: int): ...
class C2(Base):
def foo(self, x: str): ...
b: Base
x: str | int
if isinstance(x, int):
b = C1()
else:
b = C2()
b.foo(x) This used to work when using joins, but not anymore, since binder doesn't support "lock step" assignments. Coming back to |
This comment has been minimized.
This comment has been minimized.
OK, the fallout is much larger now, but IMO it looks very promising. I will slowly go though the |
@@ -631,11 +631,12 @@ class Child(Parent): | |||
def bar(self) -> int: | |||
if 1: | |||
self = super(Child, self).something() | |||
reveal_type(self) # N: Revealed type is "__main__.Child" | |||
reveal_type(self) # N: Revealed type is "Any" | |||
# TODO: we should probably make this unreachable similar to above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is #18386 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit more tricky than that. In that example:
x: int
if x is None: ...
the branch is obviously unreachable. But if I say:
x: Any
if x is None: ...
then technically it is reachable because x: Any = None
is valid, but (highly) unlikely.
Thanks for working on this @ilevkivskyi! I did a full mypy run for Home Assistant with these changes. Unfortunately, out of the 53 new errors, only 2 seem to be helpful. The most common reason for false positives is that explicit assignments seem to get lost after an # mypy: warn-return-any, allow-empty-bodies
from typing import Any
def process_config(config):
# Untyped function in a dependency
...
def f1(config: dict[str, Any]) -> dict[str, Any]:
config = process_config(config)
reveal_type(config) # dict[str, Any] -> Any
return config
# --
def f2(config: dict[str, Any]) -> int:
res: int
res = config["key"]
reveal_type(res) # int -> Any
return res
# --
class A3:
y: int = 2
def f3(x: A3) -> int:
res: int
res = getattr(x, "y")
reveal_type(res) # int -> Any
return res
# --
def get_devices() -> list[dict[str, list[str] | str]]: ...
class A4:
devices: list[dict[str, Any]] | None
def update_devices(self) -> dict[str, str]:
if self.devices is None:
self.devices = get_devices()
data: dict[str, str] = {}
for device in self.devices:
id_ = str(device["id"])
name = device["name"]
reveal_type(name) # Any -> list[str] | str | Any
data[id_] = name
return data
# --
def expect_str(var: str) -> None: ...
def f5(x: Any) -> None:
state: str | None = None
state = x
expect_str(state) # arg-type error -> fine (false-positive)
def f6(x: Any) -> float:
state: float
state = x
reveal_type(state) # float -> Any
return round(state)
# --
def f7(config: dict[str, Any] | None, x: Any) -> None:
config = x
config.copy() # union-attr error -> fine (false-positive) |
@cdce8p First of all it seems to me you may be using false-positive wrong in some examples. To be clear, false-positive means that the code is actually correct, but mypy erroneously complains (so it is like in medical tests: positive means bad). That said, I actually think in all the examples you posted previous behavior was wrong, and the new behavior is correct. Moreover, I would say it is as correct as it can be. To show a bit more, consider this: def untyped(): ...
x = 42
x = untyped()
reveal_type(x) here the reveal type must be for all intents and purposes be def untyped(): ...
x0 = 42
x1 = untyped()
reveal_type(x1) Whether that is convenient or not is different question. IMO previous behavior only gave you false sense of security. To this point, can you try to find an actual runtime error with your examples that would have been caught before, but not with this PR? (Unless I am missing something I think you can't). Also don't worry, types are not "completely lost" after x: int
x = untyped()
x = "no way" # E: Incompatible types in assignment (expression has type "str", variable has type "int") Btw the example with def get_devices() -> list[dict[str, list[str] | str]]:
return [{"id": "1", "name": ["foo", "bar"]}] which is valid for the type. Then if you do: a4 = A4()
a4.devices = None
a4.update_devices()["1"].lower() you will get |
You're right. Those are errors which are no longer emitted but maybe still should, so false-negative. Unless I've mixed them up again 😅
It's true, that the initial type assignment was more a hack than anything else. However, the alternative would be to use def f2(config: dict[str, Any]) -> int:
res: int
res = config["key"]
reveal_type(res) # int -> Any
res.lower() # attr-defined -> no error
return res
Correct. However, in this example the value type |
Can the change where assigning an My longer-term plan/hope is to allow each assignment to infer a separate type for a variable (see #18516), which would also enable inferring This example illustrates how my change would (likely) work: def a() -> Any: ...
def f1() -> None:
x: int = 1
x = a()
reveal_type(x) # "int", since 'x' has an explicit type annotation and won't be renamed
def f2() -> None:
x = 1
# ... do something with x
x = a()
reveal_type(x) # "Any", since the two definitions are treated as two separate variables |
@JukkaL I would rather not do this. For three reasons:
@cdce8p You know I don't share many of the pyright's design choices, and this is no exception. Btw I am wondering maybe this one was actually influenced by current mypy's behavior. Anyway coming back to your example, IMO the only form that may be special-cased (and actually currently is, even with this PR) is class B: ...
class C(B): ...
def test() -> list[B]:
x: B = C()
res = [x]
return res # If we would narrow the type of x, this would be an error This is an even older discussion however, see #2008 |
I know. There are quite a few I don't like as well.
Don't think so. My guess would be that pyright whats to provide the best experience from a language server perspective. I.e. if the user declares a type to be To extend on one of my initial examples: def f2(config: dict[str, Any]) -> int:
res: int
res = config["key"]
reveal_type(res) # int -> Any
return res.upper() # <-- this will fail Say, we can't adjust the type of If the type is instead In the end it's just my experience, but I still think that changing the type to |
Actually after some more thinking and reading old PRs it seems to me we can try the idea by @JukkaL (undo the last commit + don't assign
The second rule will roughly match the current special-casing, but is much simpler to remember. |
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
+ src/check_jsonschema/schema_loader/main.py:190: error: Unexpected keyword argument "registry" for "Validator" [call-arg]
+ note: "Validator" defined here
+ src/check_jsonschema/schema_loader/main.py:195: error: Redundant cast to "Validator" [redundant-cast]
arviz (https://github.com/arviz-devs/arviz)
+ arviz/data/inference_data.py:442: error: Argument 2 to "InferenceData" has incompatible type "**dict[Any, Dataset]"; expected "bool" [arg-type]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/pack.py: note: In function "find_run":
+ cwltool/pack.py:35:22: error: Argument 1 to "find_run" has incompatible type "str | int | float | MutableSequence[CWLOutputType] | MutableMapping[str, CWLOutputType] | Any | None"; expected "CWLObjectType | int | float | str | CommentedMap | CommentedSeq | None" [arg-type]
+ cwltool/main.py: note: In function "load_job_order":
+ cwltool/main.py:377:41: error: Unsupported right operand type for in ("Any | int | float | str | CommentedMap | CommentedSeq") [operator]
+ cwltool/main.py:379:49: error: Argument 1 to "resolve_overrides" has incompatible type "Any | int | float | str | CommentedMap | CommentedSeq"; expected "CommentedMap | CommentedSeq | str | None" [arg-type]
+ cwltool/main.py:380:9: error: Item "int" of "Any | int | float | str | CommentedMap | CommentedSeq" has no attribute "__delitem__" [union-attr]
+ cwltool/main.py:380:9: error: Item "float" of "Any | int | float | str | CommentedMap | CommentedSeq" has no attribute "__delitem__" [union-attr]
+ cwltool/main.py:380:9: error: Item "str" of "Any | int | float | str | CommentedMap | CommentedSeq" has no attribute "__delitem__" [union-attr]
pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/fields.py:607: error: Argument 1 to "is_literal_type" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:609: error: Argument 1 to "is_typeddict" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:612: error: Argument 1 to "is_finalvar" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:618: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:623: error: Argument 1 to "get_origin" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:626: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:644: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:668: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:692: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:702: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:712: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:715: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:718: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:722: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:723: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:726: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:727: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:730: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:734: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:735: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:740: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/fields.py:749: error: Argument 1 to "get_args" has incompatible type "Any | <typing special form> | type[Any]"; expected "type[Any]" [arg-type]
+ pydantic/v1/main.py:577: error: Argument 2 to "validate_model" has incompatible type "dict[Any, Any] | GetterDict"; expected "dict[str, Any]" [arg-type]
+ pydantic/v1/main.py:901: error: Set comprehension has incompatible type Set[int | str]; expected Set[str | None] [misc]
+ pydantic/v1/main.py:901: note: Left operand is of type "set[str] | dict_keys[str, Any]"
manticore (https://github.com/trailofbits/manticore)
- manticore/core/workspace.py:220: error: Argument 1 to "exists" has incompatible type "str | None"; expected "int | str | bytes | PathLike[str] | PathLike[bytes]" [arg-type]
- manticore/core/workspace.py:221: error: Argument 1 to "isdir" has incompatible type "str | None"; expected "int | str | bytes | PathLike[str] | PathLike[bytes]" [arg-type]
- manticore/core/workspace.py:223: error: Argument 1 to "mkdir" has incompatible type "str | None"; expected "str | bytes | PathLike[str] | PathLike[bytes]" [arg-type]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/client/orchestration/__init__.py:1419: error: "str" has no attribute "major" [attr-defined]
- src/prefect/client/orchestration/__init__.py:1759: error: "str" has no attribute "major" [attr-defined]
- src/prefect/server/models/task_runs.py:138: error: Item "None" of "TaskRun | None" has no attribute "created" [union-attr]
- src/prefect/server/models/task_runs.py:141: error: Item "None" of "TaskRun | None" has no attribute "id" [union-attr]
- src/prefect/server/models/task_runs.py:147: error: Incompatible return value type (got "TaskRun | None", expected "TaskRun") [return-value]
- src/prefect/locking/filesystem.py:63: error: Unsupported target for indexed assignment ("_LockInfo | None") [index]
- src/prefect/locking/filesystem.py:64: error: Item "None" of "_LockInfo | None" has no attribute "get" [union-attr]
- src/prefect/locking/filesystem.py:65: error: Unsupported target for indexed assignment ("_LockInfo | None") [index]
- src/prefect/locking/filesystem.py:68: error: Incompatible types in assignment (expression has type "_LockInfo | None", target has type "_LockInfo") [assignment]
- src/prefect/locking/filesystem.py:85: error: Unsupported target for indexed assignment ("_LockInfo | None") [index]
- src/prefect/locking/filesystem.py:86: error: Item "None" of "_LockInfo | None" has no attribute "get" [union-attr]
- src/prefect/locking/filesystem.py:87: error: Unsupported target for indexed assignment ("_LockInfo | None") [index]
- src/prefect/locking/filesystem.py:90: error: Incompatible types in assignment (expression has type "_LockInfo | None", target has type "_LockInfo") [assignment]
- src/prefect/cli/config.py:70: error: "str" has no attribute "name" [attr-defined]
- src/prefect/infrastructure/provisioners/container_instance.py:344: error: Item "None" of "str | dict[str, Any] | None" has no attribute "__iter__" (not iterable) [union-attr]
- src/prefect/infrastructure/provisioners/container_instance.py:374: error: Value of type "str | dict[str, Any] | None" is not indexable [index]
- src/prefect/infrastructure/provisioners/container_instance.py:374: error: Invalid index type "str" for "str"; expected type "SupportsIndex | slice[Any, Any, Any]" [index]
- src/prefect/cli/deploy.py:677: error: Argument "actions" to "_generate_default_pull_action" has incompatible type "dict[str, Any]"; expected "list[dict[str, Any]]" [arg-type]
+ src/prefect/cli/deploy.py:677: error: Argument "actions" to "_generate_default_pull_action" has incompatible type "dict[str, list[dict[str, Any]]] | dict[str, Any]"; expected "list[dict[str, Any]]" [arg-type]
altair (https://github.com/vega/altair)
+ altair/vegalite/v5/schema/channels.py:245: error: Unused "type: ignore" comment [unused-ignore]
+ altair/vegalite/v5/api.py:3979: error: Item "super" of "super | type[TopLevelMixin]" has no attribute "from_dict" [union-attr]
+ altair/vegalite/v5/api.py:3979: error: Item "type" of "super | type[TopLevelMixin]" has no attribute "from_dict" [union-attr]
SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
+ rolemanagement/core.py:420: error: Item "str" of "Union[Any, str]" has no attribute "id" [union-attr]
+ rolemanagement/core.py:492: error: Item "str" of "Union[Any, str]" has no attribute "id" [union-attr]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/dtypes.py:800: error: Argument 1 to "tz_standardize" has incompatible type "tzinfo | None"; expected "tzinfo" [arg-type]
+ pandas/core/dtypes/dtypes.py:1058: error: "BaseOffset" has no attribute "_period_dtype_code" [attr-defined]
+ pandas/core/dtypes/dtypes.py:1323: error: Incompatible types in assignment (expression has type "dtype[Any] | ExtensionDtype", variable has type "dtype[Any] | None") [assignment]
+ pandas/core/util/hashing.py:347: error: Incompatible return value type (got "Any | ndarray[tuple[int, ...], dtype[signedinteger[Any]]]", expected "ndarray[tuple[int, ...], dtype[unsignedinteger[_64Bit]]]") [return-value]
+ pandas/core/nanops.py:641: error: Incompatible return value type (got "ndarray[Any, Any] | float | NaTType", expected "float") [return-value]
+ pandas/core/arrays/period.py:821: error: "BaseOffset" has no attribute "_period_dtype_code" [attr-defined]
+ pandas/core/arrays/period.py:900: error: "BaseOffset" has no attribute "_period_dtype_code" [attr-defined]
+ pandas/core/arrays/period.py:1336: error: Item "ExtensionArray" of "ExtensionArray | ndarray[Any, Any]" has no attribute "freq" [union-attr]
+ pandas/core/arrays/period.py:1336: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "freq" [union-attr]
+ pandas/core/arrays/period.py:1345: error: "BaseOffset" has no attribute "_period_dtype_code" [attr-defined]
+ pandas/_testing/_io.py:84: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/_testing/_io.py:85: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/_testing/_io.py:141: error: No overload variant of "ZipFile" matches argument types "Any", "str" [call-overload]
+ pandas/_testing/_io.py:141: note: Possible overload variants:
+ pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | IO[bytes], mode: Literal['r', 'w', 'x', 'a'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: str | None = ...) -> ZipFile
+ pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipReadable, mode: Literal['r'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: str | None = ...) -> ZipFile
+ pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipWritable, mode: Literal['w', 'x'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: None = ...) -> ZipFile
+ pandas/_testing/_io.py:141: note: def __init__(self, file: str | PathLike[str] | _ZipReadableTellable, mode: Literal['a'] = ..., compression: int = ..., allowZip64: bool = ..., compresslevel: int | None = ..., *, strict_timestamps: bool = ..., metadata_encoding: None = ...) -> ZipFile
+ pandas/_testing/_io.py:141: error: No overload variant of "BZ2File" matches argument types "Any", "str" [call-overload]
+ pandas/_testing/_io.py:141: note: def __init__(self, filename: _WritableFileobj, mode: Literal['w', 'wb', 'x', 'xb', 'a', 'ab'], *, compresslevel: int = ...) -> BZ2File
+ pandas/_testing/_io.py:141: note: def __init__(self, filename: _ReadableFileobj, mode: Literal['', 'r', 'rb'] = ..., *, compresslevel: int = ...) -> BZ2File
+ pandas/_testing/_io.py:141: note: def __init__(self, filename: str | bytes | PathLike[str] | PathLike[bytes], mode: Literal['', 'r', 'rb'] | Literal['w', 'wb', 'x', 'xb', 'a', 'ab'] = ..., *, compresslevel: int = ...) -> BZ2File
+ pandas/_testing/_io.py:141: error: Argument "mode" to "TarFile" has incompatible type "str"; expected "Literal['r', 'a', 'w', 'x']" [arg-type]
+ pandas/core/computation/expr.py:679: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/computation/expr.py:679: error: Item "Attribute" of "Attribute | Name" has no attribute "id" [union-attr]
+ pandas/core/computation/expr.py:679: note: Error code "union-attr" not covered by "type: ignore" comment
+ pandas/core/computation/expr.py:701: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/computation/expr.py:701: error: Item "Attribute" of "Attribute | Name" has no attribute "id" [union-attr]
+ pandas/core/computation/expr.py:701: note: Error code "union-attr" not covered by "type: ignore" comment
+ pandas/core/common.py:295: error: Incompatible return value type (got "ndarray[Any, Any] | Iterable[Any]", expected "ndarray[Any, Any]") [return-value]
+ pandas/core/algorithms.py:453: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "unique" [union-attr]
+ pandas/core/algorithms.py:460: error: Argument 1 to "_get_hashtable_algo" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]" [arg-type]
+ pandas/core/algorithms.py:905: error: Incompatible types in assignment (expression has type "ndarray[Any, Any] | DatetimeArray | TimedeltaArray | PeriodArray | Any", variable has type "ndarray[tuple[int, ...], dtype[Any]]") [assignment]
+ pandas/core/algorithms.py:909: error: Argument 1 to "value_counts_arraylike" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]" [arg-type]
+ pandas/core/arrays/timedeltas.py:1115: error: Item "ExtensionArray" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_mask" [union-attr]
+ pandas/core/arrays/timedeltas.py:1115: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_mask" [union-attr]
+ pandas/core/arrays/timedeltas.py:1116: error: Item "ExtensionArray" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_data" [union-attr]
+ pandas/core/arrays/timedeltas.py:1116: error: Item "ndarray[Any, Any]" of "ExtensionArray | ndarray[Any, Any]" has no attribute "_data" [union-attr]
+ pandas/core/arrays/timedeltas.py:1129: error: Argument 1 to "astype_overflowsafe" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]" [arg-type]
+ pandas/core/arrays/masked.py:706: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/arrays/masked.py:722: error: "ndarray[Any, Any]" has no attribute "_mask" [attr-defined]
+ pandas/core/arrays/masked.py:809: error: "ndarray[Any, Any]" has no attribute "_mask" [attr-defined]
+ pandas/core/arrays/numeric.py:155: error: "ndarray[Any, Any]" has no attribute "_mask" [attr-defined]
+ pandas/core/arrays/boolean.py:180: error: "ndarray[Any, Any]" has no attribute "_mask" [attr-defined]
+ pandas/core/arrays/boolean.py:378: error: "ndarray[Any, Any]" has no attribute "_mask" [attr-defined]
+ pandas/core/arrays/interval.py:253: error: Argument 1 to "intervals_to_interval_bounds" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]" [arg-type]
+ pandas/core/computation/align.py:176: error: Value of type variable "F" of "_align_core" cannot be "list[Any]" [type-var]
+ pandas/io/pytables.py:3352: error: Incompatible return value type (got "list[Any]", expected "tuple[int, ...] | None") [return-value]
+ pandas/io/parsers/arrow_parser_wrapper.py:169: error: No overload variant of "__add__" of "list" matches argument type "range" [operator]
+ pandas/io/parsers/arrow_parser_wrapper.py:169: note: Possible overload variants:
+ pandas/io/parsers/arrow_parser_wrapper.py:169: note: def __add__(self, list[str], /) -> list[str]
+ pandas/io/parsers/arrow_parser_wrapper.py:169: note: def [_S] __add__(self, list[_S], /) -> list[_S | str]
+ pandas/io/parsers/arrow_parser_wrapper.py:169: note: Right operand is of type "range | Any"
+ pandas/io/formats/format.py:1702: error: "Timedelta" has no attribute "_repr_base" [attr-defined]
+ pandas/io/excel/_base.py:494: error: Argument "sheet_name" to "parse" of "ExcelFile" has incompatible type "str | int | list[IntStrT] | None"; expected "str | int | list[int] | list[str] | None" [arg-type]
+ pandas/io/excel/_base.py:497: error: Argument "index_col" to "parse" of "ExcelFile" has incompatible type "int | str | Sequence[int] | None"; expected "int | Sequence[int] | None" [arg-type]
+ pandas/io/excel/_base.py:521: error: Incompatible return value type (got "DataFrame | dict[str, DataFrame] | dict[int, DataFrame]", expected "DataFrame | dict[IntStrT, DataFrame]") [return-value]
+ pandas/core/series.py:2833: error: Argument 2 to "diff" has incompatible type "float | int | integer[Any]"; expected "int" [arg-type]
+ pandas/core/indexing.py:1408: error: No overload variant of "list" matches argument type "object" [call-overload]
+ pandas/core/indexing.py:1408: note: Possible overload variants:
+ pandas/core/indexing.py:1408: note: def [_T] __init__(self) -> list[_T]
+ pandas/core/indexing.py:1408: note: def [_T] __init__(self, Iterable[_T], /) -> list[_T]
+ pandas/core/generic.py:4600: error: Incompatible types in assignment (expression has type "Index", variable has type "MultiIndex") [assignment]
+ pandas/core/generic.py:9745: error: Argument 1 to "reshape" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]" [arg-type]
+ pandas/core/generic.py:9747: error: Argument 1 to "reshape" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]" [arg-type]
+ pandas/core/frame.py:4375: error: Argument 1 to "tile" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]]" [arg-type]
+ pandas/core/apply.py:1872: error: Argument 2 to "relabel_result" has incompatible type "Callable[..., Any] | str | list[Callable[..., Any] | str] | MutableMapping[Hashable, Callable[..., Any] | str | list[Callable[..., Any] | str]]"; expected "dict[str, list[Callable[..., Any] | str]]" [arg-type]
+ pandas/core/apply.py:1911: error: "partial[Any]" has no attribute "__name__"; maybe "__new__"? [attr-defined]
+ pandas/core/window/rolling.py:668: error: Unused "type: ignore" comment [unused-ignore]
+ pandas/core/internals/managers.py:972: error: Incompatible types in assignment (expression has type "signedinteger[_32Bit | _64Bit]", variable has type "int") [assignment]
+ pandas/core/internals/construction.py:252: error: Argument 1 to "_ensure_2d" has incompatible type "Any | ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any]" [arg-type]
+ pandas/core/internals/construction.py:969: error: Argument 1 to "maybe_infer_to_datetimelike" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[tuple[int, ...], dtype[object_]]" [arg-type]
+ pandas/core/internals/construction.py:990: error: Argument 1 to "maybe_cast_to_datetime" has incompatible type "ExtensionArray | ndarray[Any, Any]"; expected "ndarray[Any, Any] | list[Any]" [arg-type]
+ pandas/core/indexes/interval.py:1273: error: Unsupported left operand type for - ("str") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("str" and "float") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("str" and "bool") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("str" and "Timedelta") [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__rsub__" of "Interval" matches argument type "str" [operator]
+ pandas/core/indexes/interval.py:1273: note: Possible overload variants:
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, Timedelta, /) -> Interval[Any]
+ pandas/core/indexes/interval.py:1273: note: def [_OrderableScalarT: (int, float)] __rsub__(self, _OrderableScalarT, /) -> Interval[_OrderableScalarT]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, float, /) -> Interval[float]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__rsub__" of "datetime64" matches argument type "str" [operator]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, int | integer[Any] | numpy.bool[builtins.bool], /) -> datetime64[date | int | None]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, date | int | None, /) -> timedelta
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, datetime64[None], /) -> timedelta64[None]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, datetime64[date | int | None], /) -> timedelta64[timedelta | int | None]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__rsub__" of "timedelta64" matches argument type "str" [operator]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, timedelta64[timedelta | int | None] | int | integer[Any] | builtins.bool | numpy.bool[builtins.bool], /) -> timedelta64[timedelta | int | None]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, timedelta64[None], /) -> timedelta64[None]
+ pandas/core/indexes/interval.py:1273: note: def __rsub__(self, datetime64[None], /) -> datetime64[None]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "str") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "Period") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "Timedelta") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "datetime64[date | int | None]") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "timedelta64[timedelta | int | None]") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("float" and "date") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("bool" and "str") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("bool" and "Period") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("bool" and "Timedelta") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("bool" and "date") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "str") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "float") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "bool") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "Period") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "datetime64[date | int | None]") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "timedelta64[timedelta | int | None]") [operator]
+ pandas/core/indexes/interval.py:1273: error: Unsupported operand types for - ("Timedelta" and "date") [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "str" [operator]
+ pandas/core/indexes/interval.py:1273: note: def __sub__(self, Timedelta, /) -> Interval[Any]
+ pandas/core/indexes/interval.py:1273: note: def [_OrderableScalarT: (int, float)] __sub__(self, _OrderableScalarT, /) -> Interval[_OrderableScalarT]
+ pandas/core/indexes/interval.py:1273: note: def __sub__(self, float, /) -> Interval[float]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "Period" [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "Interval[Any]" [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "datetime64[date | int | None]" [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "timedelta64[timedelta | int | None]" [operator]
+ pandas/core/indexes/interval.py:1273: error: No overload variant of "__sub__" of "Interval" matches argument type "date" [operator]
... (truncated 54 lines) ...
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/settings/_config.py:895: error: Incompatible types in assignment (expression has type "str", target has type "None") [assignment]
+ ddtrace/internal/remoteconfig/client.py:520: error: Set comprehension has incompatible type Set[ConfigMetadata]; expected Set[str] [misc]
spark (https://github.com/apache/spark)
+ python/pyspark/sql/udf.py:683: error: "UserDefinedFunctionLike" has no attribute "_unwrapped" [attr-defined]
+ python/pyspark/sql/functions/builtin.py:2615: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:2669: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:3056: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:7802: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:7858: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:8889: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:8944: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/functions/builtin.py:8999: error: Unused "type: ignore" comment [unused-ignore]
- python/pyspark/pandas/generic.py:2681: error: PandasDataFrameLike? has no attribute "iloc" [attr-defined]
+ python/pyspark/pandas/groupby.py:3701: error: Item "tuple[Any, ...]" of "Series[Any] | tuple[Any, ...]" has no attribute "rename" [union-attr]
+ python/pyspark/pandas/groupby.py:3701: error: Argument 3 to "align_diff_frames" has incompatible type "Series[Any] | Any"; expected "DataFrame[Any]" [arg-type]
+ python/pyspark/pandas/groupby.py:3713: error: Item "tuple[Any, ...]" of "Series[Any] | tuple[Any, ...]" has no attribute "name" [union-attr]
+ python/pyspark/pandas/indexes/multi.py:1180: error: Argument 1 to "_index_fields_for_union_like" of "Index" has incompatible type "DataFrame[Any] | Series[Any] | Index | list[Any]"; expected "Index" [arg-type]
+ python/pyspark/sql/connect/functions/builtin.py:578: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:597: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:609: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:691: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:826: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:1571: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:1585: error: Unused "type: ignore" comment [unused-ignore]
+ python/pyspark/sql/connect/functions/builtin.py:1599: error: Unused "type: ignore" comment [unused-ignore]
pylint (https://github.com/pycqa/pylint)
+ pylint/checkers/deprecated.py:155: error: Argument 2 to "check_deprecated_class" of "DeprecatedMixin" has incompatible type "str | None"; expected "str" [arg-type]
boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/globals.py:91: error: Invalid index type "Union[Tuple[Any, ...], Any]" for "Dict[T, Any]"; expected type "T" [index]
+ boostedblob/globals.py:92: error: Invalid index type "Union[Tuple[Any, ...], Any]" for "Dict[T, float]"; expected type "T" [index]
black (https://github.com/psf/black)
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "_addtoken" of "Parser" has incompatible type "*list[object]"; expected "int" [arg-type]
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "_addtoken" of "Parser" has incompatible type "*list[object]"; expected "str" [arg-type]
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "_addtoken" of "Parser" has incompatible type "*list[object]"; expected "tuple[str, tuple[int, int]]" [arg-type]
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "addtoken" of "Parser" has incompatible type "*list[object]"; expected "int" [arg-type]
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "addtoken" of "Parser" has incompatible type "*list[object]"; expected "str" [arg-type]
+ src/blib2to3/pgen2/parse.py:103:23: error: Argument 1 to "addtoken" of "Parser" has incompatible type "*list[object]"; expected "tuple[str, tuple[int, int]]" [arg-type]
+ src/black/cache.py:45:5: error: Returning Any from function declared to return "Path" [no-any-return]
sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/transforms/i18n.py:502:17: error: "Never" has no attribute "apply_translated_message" [attr-defined]
+ sphinx/cmd/quickstart.py: note: In function "main":
+ sphinx/cmd/quickstart.py:803:21: error: Item "object" of "object | Any" has no attribute "__iter__" (not iterable) [union-attr]
xarray (https://github.com/pydata/xarray)
+ xarray/core/indexing.py: note: In function "_decompose_outer_indexer":
+ xarray/core/indexing.py:1259: error: Argument 1 to "_decompose_slice" has incompatible type "number[Any, int | float | complex]"; expected "slice[Any, Any, Any]" [arg-type]
+ xarray/core/indexing.py:1297: error: Argument 1 to "_decompose_slice" has incompatible type "number[Any, int | float | complex]"; expected "slice[Any, Any, Any]" [arg-type]
+ xarray/core/computation.py: note: In function "apply_variable_ufunc":
+ xarray/core/computation.py:848: error: "Never" has no attribute "ndim" [attr-defined]
+ xarray/core/computation.py:851: error: "Never" has no attribute "ndim" [attr-defined]
+ xarray/core/dataarray.py: note: In member "__init__" of class "DataArray":
+ xarray/core/dataarray.py:484: error: "Never" has no attribute "shape" [attr-defined]
+ xarray/core/dataarray.py: note: At top level:
+ xarray/tests/test_coding_times.py: note: In function "test_cf_timedelta":
+ xarray/tests/test_coding_times.py:622: error: Incompatible types in assignment (expression has type "timedelta64[None]", variable has type "ndarray[tuple[int, ...], dtype[Any]]") [assignment]
+ xarray/tests/test_coding_times.py: note: At top level:
beartype (https://github.com/beartype/beartype)
+ beartype/_conf/confcls.py:852: error: Incompatible types in assignment (expression has type "object", variable has type "BeartypeDecorationPosition") [assignment]
+ beartype/_conf/confcls.py:854: error: Incompatible types in assignment (expression has type "object", variable has type "BeartypeDecorationPosition") [assignment]
+ beartype/_conf/confcls.py:856: error: Incompatible types in assignment (expression has type "object", variable has type "bool") [assignment]
+ beartype/_conf/confcls.py:857: error: Incompatible types in assignment (expression has type "object", variable has type "Collection[str]") [assignment]
+ beartype/_conf/confcls.py:859: error: Incompatible types in assignment (expression has type "object", variable has type "BeartypeHintOverrides") [assignment]
+ beartype/_conf/confcls.py:860: error: Incompatible types in assignment (expression has type "object", variable has type "bool | None") [assignment]
+ beartype/_conf/confcls.py:861: error: Incompatible types in assignment (expression has type "object", variable has type "bool") [assignment]
+ beartype/_conf/confcls.py:862: error: Incompatible types in assignment (expression has type "object", variable has type "bool") [assignment]
+ beartype/_conf/confcls.py:863: error: Incompatible types in assignment (expression has type "object", variable has type "BeartypeStrategy") [assignment]
+ beartype/_conf/confcls.py:864: error: Incompatible types in assignment (expression has type "object", variable has type "type[Exception]") [assignment]
+ beartype/_conf/confcls.py:865: error: Incompatible types in assignment (expression has type "object", variable has type "type[Exception]") [assignment]
+ beartype/_conf/confcls.py:866: error: Incompatible types in assignment (expression has type "object", variable has type "type[Exception]") [assignment]
+ beartype/_conf/confcls.py:867: error: Incompatible types in assignment (expression has type "object", variable has type "type[Exception] | None") [assignment]
+ beartype/_conf/confcls.py:868: error: Incompatible types in assignment (expression has type "object", variable has type "BeartypeViolationVerbosity") [assignment]
+ beartype/_util/hint/pep/proposal/pep585.py:384: error: Item "type" of "type | None" has no attribute "__orig_bases__" [union-attr]
+ beartype/_util/hint/pep/proposal/pep585.py:384: error: Item "None" of "type | None" has no attribute "__orig_bases__" [union-attr]
+ beartype/_util/hint/pep/proposal/pep484/pep484generic.py:410: error: Item "None" of "type | None" has no attribute "__mro__" [union-attr]
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- backend/api/tournament_scheduler_api.py:327: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
- backend/api/tournament_scheduler_api.py:327: note: Possible overload variants:
- backend/api/tournament_scheduler_api.py:327: note: def __getitem__(self, SupportsIndex, /) -> Any
- backend/api/tournament_scheduler_api.py:327: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
- backend/api/tournament_scheduler_api.py:331: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
- backend/api/tournament_scheduler_api.py:331: note: Possible overload variants:
- backend/api/tournament_scheduler_api.py:331: note: def __getitem__(self, SupportsIndex, /) -> Any
- backend/api/tournament_scheduler_api.py:331: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
- backend/api/tournament_scheduler_api.py:335: error: No overload variant of "__getitem__" of "list" matches argument type "str" [call-overload]
- backend/api/tournament_scheduler_api.py:335: note: Possible overload variants:
- backend/api/tournament_scheduler_api.py:335: note: def __getitem__(self, SupportsIndex, /) -> Any
- backend/api/tournament_scheduler_api.py:335: note: def __getitem__(self, slice[Any, Any, Any], /) -> list[Any]
sympy (https://github.com/sympy/sympy)
+ sympy/core/evalf.py:629: error: Argument 1 to "scaled_zero" has incompatible type "tuple[int, int, int, int] | tuple[list[int], int, int, int] | None"; expected "tuple[list[int], int, int, int]" [arg-type]
+ sympy/core/evalf.py:631: error: Argument 1 to "scaled_zero" has incompatible type "tuple[int, int, int, int] | tuple[list[int], int, int, int] | None"; expected "tuple[list[int], int, int, int]" [arg-type]
+ sympy/core/evalf.py:917: error: Argument 1 to "evalf" has incompatible type "Expr | None"; expected "Expr" [arg-type]
+ sympy/integrals/manualintegrate.py:1568: error: Unused "type: ignore" comment [unused-ignore]
+ sympy/tensor/array/expressions/from_array_to_matrix.py:787: error: Unused "type: ignore" comment [unused-ignore]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/synchronous/cursor.py:1002: error: Invalid index type "int | Any | Pattern[Any]" for "list[Any]"; expected type "SupportsIndex" [index]
+ pymongo/asynchronous/cursor.py:1004: error: Invalid index type "int | Any | Pattern[Any]" for "list[Any]"; expected type "SupportsIndex" [index]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/config/__init__.py:342: error: Returning Any from function declared to return "Config" [no-any-return]
+ src/_pytest/fixtures.py:1107: error: Returning Any from function declared to return "FixtureValue" [no-any-return]
openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/core/imports.py: note: At top level:
+ openlibrary/core/imports.py:234: error: Unused "type: ignore" comment [unused-ignore]
+ openlibrary/core/imports.py:235: error: Unused "type: ignore" comment [unused-ignore]
scrapy (https://github.com/scrapy/scrapy)
+ scrapy/core/downloader/handlers/http11.py:393: error: Argument "proxyConf" has incompatible type "tuple[str | None, int, bytes | None]"; expected "tuple[str, int, bytes | None]" [arg-type]
materialize (https://github.com/MaterializeInc/materialize)
- ci/mkpipeline.py:691: error: Unsupported right operand type for in ("PipelineStep | None") [operator]
- ci/mkpipeline.py:692: error: Unsupported target for indexed assignment ("PipelineStep | None") [index]
- ci/mkpipeline.py:694: error: Item "PipelineStep" of "PipelineStep | None" has no attribute "get" [union-attr]
- ci/mkpipeline.py:694: error: Item "None" of "PipelineStep | None" has no attribute "get" [union-attr]
paroxython (https://github.com/laowantong/paroxython)
+ paroxython/derived_labels_db.py:189: error: Invalid index type "str | Any" for "dict[LabelName, dict[Span, Any]]"; expected type "LabelName" [index]
vision (https://github.com/pytorch/vision)
+ torchvision/datasets/video_utils.py:389: error: Unused "type: ignore" comment [unused-ignore]
Expression (https://github.com/cognitedata/Expression)
+ expression/core/tagged_union.py:55: error: Incompatible types in assignment (expression has type "Callable[[Any], dict[str, Any]]", variable has type "Callable[[], object]") [assignment]
+ expression/core/tagged_union.py:109: error: Incompatible types in assignment (expression has type "Callable[[Any, str, Any], None]", variable has type "Callable[[str, Any], None]") [assignment]
+ expression/core/tagged_union.py:110: error: Incompatible types in assignment (expression has type "Callable[[Any, str], None]", variable has type "Callable[[str], None]") [assignment]
+ expression/core/tagged_union.py:111: error: Incompatible types in assignment (expression has type "Callable[[Any], int]", variable has type "Callable[[], int]") [assignment]
+ expression/core/tagged_union.py:121: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], bool]", variable has type "Callable[[object], bool]") [assignment]
+ expression/core/tagged_union.py:134: error: Incompatible types in assignment (expression has type "Callable[[Any], str]", variable has type "Callable[[], str]") [assignment]
sockeye (https://github.com/awslabs/sockeye)
+ sockeye/data_io.py:771: error: Value of type "Iterable[Any]" is not indexable [index]
+ sockeye/data_io.py:772: error: Value of type "Iterable[Any]" is not indexable [index]
mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/utils/meta.py:71: error: Unused "type: ignore" comment [unused-ignore]
trio (https://github.com/python-trio/trio)
+ src/trio/_core/_run.py:2738: error: Argument 1 to "run" of "Context" has incompatible type "Optional[Callable[[Any], object]]"; expected "Callable[[Union[Outcome[Any], BaseException, None]], object]" [arg-type]
+ src/trio/_tests/test_exports.py:395: error: "str" has no attribute "get" [attr-defined]
+ src/trio/_tests/test_exports.py:397: error: Invalid index type "str" for "str"; expected type "Union[SupportsIndex, slice[Any, Any, Any]]" [index]
+ src/trio/_tests/test_exports.py:400: error: "str" has no attribute "get" [attr-defined]
pyppeteer (https://github.com/pyppeteer/pyppeteer)
+ pyppeteer/page.py:836: error: Unused "type: ignore" comment [unused-ignore]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/enhance.py:185: error: Unused "type: ignore" comment [unused-ignore]
+ pwndbg/enhance.py:187: error: Unused "type: ignore" comment [unused-ignore]
ibis (https://github.com/ibis-project/ibis)
+ ibis/formats/polars.py:143: error: "Sequence[Any]" has no attribute "dtype" [attr-defined]
- ibis/expr/types/relations.py:3994: error: "list[Any]" has no attribute "unnest" [attr-defined]
+ ibis/expr/types/relations.py:4914: error: Argument "column" to "TableUnnest" has incompatible type "ibis.expr.types.generic.Value"; expected "ibis.expr.operations.core.Value[Array[Any], Any]" [arg-type]
+ ibis/expr/types/joins.py:355: error: Argument "predicates" to "JoinLink" has incompatible type "list[Any]"; expected "tuple[Value[Boolean, Any], ...]" [arg-type]
- ibis/expr/types/temporal_windows.py:68: error: Argument 1 to "unwrap_aliases" has incompatible type "str | Value | Sequence[str] | Sequence[Value] | None"; expected "Iterator[Value]" [arg-type]
+ ibis/expr/types/temporal_windows.py:68: error: Argument 1 to "unwrap_aliases" has incompatible type "Any | Value | Sequence[str] | Sequence[Value]"; expected "Iterator[Value]" [arg-type]
- ibis/expr/types/temporal_windows.py:69: error: Argument 1 to "unwrap_aliases" has incompatible type "Sequence[Scalar] | None"; expected "Iterator[Value]" [arg-type]
+ ibis/expr/types/temporal_windows.py:69: error: Argument 1 to "unwrap_aliases" has incompatible type "Sequence[Scalar] | Any"; expected "Iterator[Value]" [arg-type]
- ibis/expr/types/temporal_windows.py:72: error: Argument 1 to "update" of "MutableMapping" has incompatible type "str | Value | Sequence[str] | Sequence[Value] | None"; expected "Iterable[tuple[Any, Any]]" [arg-type]
+ ibis/expr/types/temporal_windows.py:72: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Any | Value | Sequence[str] | Sequence[Value]"; expected "SupportsKeysAndGetItem[Any, Any]" [arg-type]
- ibis/expr/types/temporal_windows.py:79: error: Argument "metrics" to "WindowAggregate" has incompatible type "Sequence[ibis.expr.types.generic.Scalar] | None"; expected "FrozenOrderedDict[str, Value[Any, ibis.expr.datashape.Scalar]]" [arg-type]
+ ibis/expr/types/temporal_windows.py:79: error: Argument "metrics" to "WindowAggregate" has incompatible type "Sequence[ibis.expr.types.generic.Scalar] | Any"; expected "FrozenOrderedDict[str, Value[Any, ibis.expr.datashape.Scalar]]" [arg-type]
- ibis/backends/sql/compilers/trino.py:639: error: "int" has no attribute "as_" [attr-defined]
+ ibis/backends/sql/compilers/trino.py:639: error: Item "int" of "int | Any" has no attribute "as_" [union-attr]
- ibis/backends/sql/compilers/trino.py:639: error: Unsupported operand types for - ("None" and "int") [operator]
- ibis/backends/sql/compilers/trino.py:639: note: Left operand is of type "str | None"
+ ibis/backends/sql/compilers/trino.py:639: note: Left operand is of type "str | Any"
- ibis/backends/sql/compilers/postgres.py:783: error: "int" has no attribute "as_" [attr-defined]
+ ibis/backends/sql/compilers/postgres.py:783: error: Item "int" of "int | Any" has no attribute "as_" [union-attr]
- ibis/backends/sql/compilers/postgres.py:783: error: Unsupported operand types for - ("None" and "int") [operator]
- ibis/backends/sql/compilers/postgres.py:783: note: Left operand is of type "str | None"
+ ibis/backends/sql/compilers/postgres.py:783: note: Left operand is of type "str | Any"
+ ibis/tests/benchmarks/benchfuncs.py:112: error: Unsupported operand types for & ("BooleanValue" and "bool") [operator]
- ibis/tests/benchmarks/benchfuncs.py:296: error: Unsupported operand types for & ("BooleanValue" and "Value") [operator]
- ibis/tests/benchmarks/benchfuncs.py:314: error: Incompatible return value type (got "tuple[Any, Any, Value]", expected "tuple[StringColumn, StringColumn, StringColumn]") [return-value]
- ibis/backends/mssql/__init__.py:711: error: Item "Mapping[str, str | DataType]" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
+ ibis/backends/mssql/__init__.py:711: error: Item "Mapping[str, str | DataType]" of "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/mssql/__init__.py:711: error: Item "Iterable[tuple[str, str | DataType]]" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
+ ibis/backends/mssql/__init__.py:711: error: Item "Iterable[tuple[str, str | DataType]]" of "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/mssql/__init__.py:711: error: Item "None" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/mssql/__init__.py:758: error: Argument "schema" to "DatabaseTable" has incompatible type "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]"; expected "Schema" [arg-type]
+ ibis/backends/mssql/__init__.py:758: error: Argument "schema" to "DatabaseTable" has incompatible type "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]"; expected "Schema" [arg-type]
+ ibis/backends/sqlite/__init__.py:497: error: Item "Expr" of "Any | Expr | None" has no attribute "schema" [union-attr]
- ibis/backends/sqlite/__init__.py:497: error: Item "None" of "Any | Any | Any | Any | Any | None" has no attribute "schema" [union-attr]
+ ibis/backends/sqlite/__init__.py:497: error: Item "None" of "Any | Expr | None" has no attribute "schema" [union-attr]
- ibis/backends/risingwave/__init__.py:223: error: Item "tuple[str, ...]" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/risingwave/__init__.py:223: error: Item "str" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/risingwave/__init__.py:227: error: Item "tuple[str, ...]" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/risingwave/__init__.py:227: error: Item "str" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/risingwave/__init__.py:600: error: Item "Mapping[str, str | DataType]" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
+ ibis/backends/risingwave/__init__.py:600: error: Item "Mapping[str, str | DataType]" of "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/risingwave/__init__.py:600: error: Item "Iterable[tuple[str, str | DataType]]" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
+ ibis/backends/risingwave/__init__.py:600: error: Item "Iterable[tuple[str, str | DataType]]" of "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/risingwave/__init__.py:600: error: Item "None" of "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]] | None" has no attribute "to_sqlglot" [union-attr]
- ibis/backends/risingwave/__init__.py:640: error: Argument "schema" to "DatabaseTable" has incompatible type "Schema | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]"; expected "Schema" [arg-type]
+ ibis/backends/risingwave/__init__.py:640: error: Argument "schema" to "DatabaseTable" has incompatible type "Schema | Any | Mapping[str, str | DataType] | Iterable[tuple[str, str | DataType]]"; expected "Schema" [arg-type]
- ibis/backends/postgres/__init__.py:323: error: Item "tuple[str, ...]" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/postgres/__init__.py:323: error: Item "str" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/postgres/__init__.py:327: error: Item "tuple[str, ...]" of "tuple[str, str] | str" has no attribute "args" [union-attr]
- ibis/backends/postgres/__init__.py:327: error: Item "str" of "tuple[str, str] | str" has no attribute "args" [union-attr]
... (truncated 191 lines) ...``` |
For those who are following here, after a discussion with @JukkaL we came up with some compromise behavior that replaces all previous ad-hoc special-casing of
The |
This would be more consistent with what we already do for ternary expressions. Note the change in match test results from match logic not handling well the situation when initial type is a union. A possible workaround would be to force "collapsing" union of tuples back into a tuple with union, but it is not easy and was planning to do some cleanup in the match handling as well (in particular it uses joins instead of unions in a way that will be inconsistent with new binder behavior). I want to put the switch from join to union for match statement in a separate PR.
Note I also remove a bunch of special-casing around
Any
in the binder that existed only becausejoin(Any, X) == Any
.