Closed mdilena closed 5 months ago
Oh I didn't even know that was possible! The docs tend to specify when the string is meant to be an attribute vs an node, though I have a feeling there's gonna be a lot of edge cases in how that distinction is made in the docs
Yeah it was a completely random discovery 🙂 I wonder if something simple that catches a few cases could be the solution here, since args is always vague anyway: `args: Union[str, maya.api.OpenMaya.MDagPath, List[str], List[float], List[int]]` as different commands to different things (setAttr/getAttr are one example of multiple args).
I mean, these are nuances...I just started using strict typing in vscode and it's marking those cases as an error, but in the end even just with typed - and long named 🙏 - keyword arguments it's so much better already.
Yeah, I guess it wouldn't really hurt much to have more permissive annotations for *args
even if that leads to some inaccuracies
My goal for now is to have mostly accurate stubs that make it enjoyable to use cmds in a strictly typed environment and then refine more and more down the line to tend towards 100% type accurate stubs.
Hopefully maya's long gone before I get there haha
Just closing this as it's not really necessary I realize :slightly_smiling_face:
It looks like a lot of commands can accept a MDagPath other than a string, at least when it comes to Python API 2.0, so it could be nice to have something like:
*args: Union[str, maya.api.OpenMaya.MDagPath]
So far it's been pretty consistent with most commands that accept a node's name, but maybe it gets more complex to handle for commands that deal with attributes.