Closed ManuelZ closed 7 months ago
This may look like a confusion, but is done by design. The interface requires a dictionary. However, usually, you are not creating the dictionary, but you are using an interface class such as ObjectRigidBody. This class provides a conversion to a dictionary, which includes type checks and alleviates the interfacing between Python and C++. In order to catch errors of the users easier when they provide something else than a dictionary, we take the most general py::object which then can give a "readable" error message.
I understand that this may confuse the very interested reader of the code, but this is done by design. So, I will change the type hint to py::object which should resolve the typing errors.
A short request: could you try to change pyObject: dict into pyObject: Any in the .pyi file of your site-packages for a trial? This should resolve the issue and it would not cause a major confusion for the user, as users should know what args to use in AddObject, AddNode, etc.
If this works for PyLance (and on my local version), I would just change this in the repo ...
I've tested it and it works when I replace the types and make them Any
in exudyn\__init__.pyi
.
ok, will be done within version 1.8.19. Thanks for your help!
Thanks. You're welcome!
AddMarker
supposedly receives adict
:Source
But it really receives a Python object:
Source
Source
Indeed, there exists a method that adds a marker when passed a dict, but when I search for it in the codebase, I don't see it being used.
Source
The same seems to happen with
AddObject
,AddNode
,AddLoad
andAddSensor
.This is the typing error that I'm seeing:
I guess a better type could be the
object
type.