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

pyright 1.1.396: error: Argument of type "None" cannot be assigned ... #38

Open
Andrei-Pozolotin opened this issue Mar 1, 2025 · 0 comments

Comments

@Andrei-Pozolotin
Copy link

starting with pyright 1.1.396, stubs such as:

# DocumentPy.xml
class Document(FreeCAD.PropertyContainer):
    def findObjects(self, Type: str = 'App::DocumentObject', Name: str = None, Label: str = None) -> list[FreeCADGui.DocumentObjectPy]:

with invocations like:

            group_list = this_doc.findObjects(
                Type=type_consts.App.DocumentObjectGroup, Name=group_name
            )

results in error:

error: Argument of type "None" cannot be assigned to parameter "Label" of type "str" in function "findObjects"
    "None" is not assignable to "str" (reportArgumentType)

since:

Label: str = None

is now expected to be instead:

Label: str|None = None
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

No branches or pull requests

1 participant