Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Jul 22, 2024

Update the type for all class-level dicts, lists and tuples that I found.
Reduces changes in #12400
Reduces bare Any (#9550)

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimming through this: LGTM

@github-actions

This comment has been minimized.

@Avasam
Copy link
Collaborator Author

Avasam commented Jul 22, 2024

mypy_primer looks like a true-positive due to runtime backwards compatibility (that requires a type: ignore)
and I think that the 3.13 stubtest failure is unrelated ? (looks like a Python 3.13 beta 4 update)

@srittau I reset your review since I included a few additional lines right afterward.

@Avasam Avasam requested a review from srittau July 22, 2024 17:52
@github-actions

This comment has been minimized.

class RegistryInfo:
HKEYS: Incomplete
if sys.platform == "win32":
HKEYS: ClassVar[tuple[int, int, int, int]]
Copy link
Contributor

@max-muoto max-muoto Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to use Final here? It would effectively interpreted as an immutable ClassVar here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be made Final. I doubt it's meant to be overridden by subclasses

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

setuptools (https://github.com/pypa/setuptools)
+ setuptools/command/__init__.py:6: error: No overload variant of "__setitem__" of "list" matches argument types "str", "Tuple[str, str]"  [call-overload]
+ setuptools/command/__init__.py:6: note: Possible overload variants:
+ setuptools/command/__init__.py:6: note:     def __setitem__(self, SupportsIndex, str, /) -> None
+ setuptools/command/__init__.py:6: note:     def __setitem__(self, slice, Iterable[str], /) -> None

@srittau srittau merged commit 0b1d358 into python:main Jul 23, 2024
@Avasam Avasam deleted the setuptools-&-distutils-ClassVar-mutables branch July 23, 2024 14:03
max-muoto pushed a commit to max-muoto/typeshed that referenced this pull request Sep 8, 2024
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.

3 participants