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 typing in baseObject.ScriptableType #17809

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

SaschaCowley
Copy link
Member

Link to issue number:

Follow-up to 17744

Summary of the issue:

As pointed out in #17744 (comment), the type hint for the dict argument to baseObject.ScriptableType.__new__ is incorrectly [str, Any] since #17744 was merged.

Description of user facing changes

None.

Description of development approach

Corrected the type annotation to dict[str, Any].

Testing strategy:

Automated tests via CI.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@SaschaCowley SaschaCowley requested a review from a team as a code owner March 11, 2025 03:28
@SaschaCowley SaschaCowley requested a review from seanbudd March 11, 2025 03:28
@@ -183,7 +183,7 @@ def invalidateCaches(cls):
class ScriptableType(AutoPropertyType):
"""A metaclass used for collecting and caching gestures on a ScriptableObject"""

def __new__(cls, name: str, bases: tuple[type, ...], dict: [str, Any], /, **kwargs: Any):
def __new__(cls, name: str, bases: tuple[type, ...], dict: dict[str, Any], /, **kwargs: Any):
Copy link
Collaborator

@LeonarddeR LeonarddeR Mar 11, 2025

Choose a reason for hiding this comment

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

Could we rename dict to dct while at it? dict is shadowing the type here:

Suggested change
def __new__(cls, name: str, bases: tuple[type, ...], dict: dict[str, Any], /, **kwargs: Any):
def __new__(cls, name: str, bases: tuple[type, ...], dct: dict[str, Any], /, **kwargs: Any):

And how about the type of **kwargs, can we have something better than Any?

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