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

Fixed bug that results in incorrect evaluation of class variables ass… #9381

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

erictraut
Copy link
Collaborator

…igned in an __init_subclass__ or __class_getitem__ method. These methods are implicitly class methods even though they are not decorated with @classmethod. This addresses microsoft/pylance-release#2781.

…igned in an `__init_subclass__` or `__class_getitem__` method. These methods are implicitly class methods even though they are not decorated with `@classmethod`. This addresses microsoft/pylance-release#2781.
Copy link
Contributor

github-actions bot commented Nov 4, 2024

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

ibis (https://github.com/ibis-project/ibis)
-   /tmp/mypy_primer/projects/ibis/ibis/common/tests/test_grounds.py:1072:17 - error: Cannot assign to attribute "kwargs" for class "type[Test]*"
-     Attribute "kwargs" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/ibis/ibis/common/tests/test_grounds.py:1077:18 - error: Cannot access attribute "kwargs" for class "type[Test2]"
-     Attribute "kwargs" is unknown (reportAttributeAccessIssue)
- 7298 errors, 126 warnings, 0 informations 
+ 7296 errors, 126 warnings, 0 informations 

scikit-learn (https://github.com/scikit-learn/scikit-learn)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/_set_output.py:371:17 - error: Cannot assign to attribute "_sklearn_auto_wrap_output_keys" for class "type[_SetOutputMixin]*"
-     Attribute "_sklearn_auto_wrap_output_keys" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/_set_output.py:379:13 - error: Cannot assign to attribute "_sklearn_auto_wrap_output_keys" for class "type[_SetOutputMixin]*"
-     Attribute "_sklearn_auto_wrap_output_keys" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/_set_output.py:384:17 - error: Cannot access attribute "_sklearn_auto_wrap_output_keys" for class "type[_SetOutputMixin]*"
-     Attribute "_sklearn_auto_wrap_output_keys" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/tests/test_set_output.py:313:13 - error: Cannot assign to attribute "custom_parameter" for class "type[AnotherMixin]*"
-     Attribute "custom_parameter" is unknown (reportAttributeAccessIssue)
- 13584 errors, 16 warnings, 0 informations 
+ 13580 errors, 16 warnings, 0 informations 

attrs (https://github.com/python-attrs/attrs)
- /tmp/mypy_primer/projects/attrs/tests/test_init_subclass.py
-   /tmp/mypy_primer/projects/attrs/tests/test_init_subclass.py:20:17 - error: Cannot assign to attribute "param" for class "type[Base]*"
-     Attribute "param" is unknown (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/attrs/tests/test_init_subclass.py:37:17 - error: Cannot assign to attribute "param" for class "type[Base]*"
-     Attribute "param" is unknown (reportAttributeAccessIssue)
- 996 errors, 44 warnings, 5 informations 
+ 994 errors, 44 warnings, 5 informations 

@erictraut erictraut merged commit 6fb940a into main Nov 4, 2024
18 checks passed
@erictraut erictraut deleted the issue-2781-2 branch November 4, 2024 17:00
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.

1 participant