Skip to content
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

fix: from_pylist covariance #73

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Conversation

Flamefork
Copy link
Contributor

Pyright reports the following correct code as an error:

a = [{"asd": 1}]
pa.Table.from_pylist(a)
error: Argument of type "list[dict[str, int]]" cannot be assigned to parameter "mapping" of type "list[Mapping[str, Any]]" in function "from_pylist"
    "list[dict[str, int]]" is not assignable to "list[Mapping[str, Any]]"
      Type parameter "_T@list" is invariant, but "dict[str, int]" is not the same as "Mapping[str, Any]"
      Consider switching from "list" to "Sequence" which is covariant (reportArgumentType)

This PR fixes this error by following the suggestion in the error report.

@zen-xu zen-xu enabled auto-merge (squash) September 9, 2024 12:33
@zen-xu zen-xu merged commit 0156025 into zen-xu:main Sep 9, 2024
2 checks passed
@Flamefork Flamefork deleted the covariant_from_pylist branch September 9, 2024 13:18
@Flamefork Flamefork restored the covariant_from_pylist branch September 9, 2024 13:23
@Flamefork Flamefork deleted the covariant_from_pylist branch October 22, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants