A bug that should be fixed in your Python API code generation (Applies to all recent versions)
-
The argument self should not appear in any of the following static method declarations that are part of the generated Python C4D API skeletal/placeholder code, since any good Python IDE will complain and/or flag correct user code that use these methods.
In the future, you guys can do something like the following in
...resource\modules\python\libs
:# You can also add the -n flag to the first grep in the pipe chain below, to add line number info after the file name grep -R -A2 -H "@staticmethod" * 2>&1 | grep -v "MAXON_" | grep -PB2 "def.*?self"
I am not sure if the above grep comprehensively captures every one of these issues, but 99-100% of them should have been caught:
python39/c4d/bitmaps/__init__.py: @staticmethod python39/c4d/bitmaps/__init__.py- def AllocWrapper(self, bmp): -- python39/c4d/modules/mograph/__init__.py: @staticmethod python39/c4d/modules/mograph/__init__.py- def Create(self, flags, thread, doc, currentThreadIndex, threadCount, inputs, callers): -- python39/c4d/utils/__init__.py: @staticmethod python39/c4d/utils/__init__.py- def PickObject(self, bd, doc, x, y, rad, flags): -- python39/c4d/__init__.py: @staticmethod python39/c4d/__init__.py- def GetDistance(self, v1, v2): -- python39/maxon/decorators.py: @staticmethod python39/maxon/decorators.py- @wraps(fn) python39/maxon/decorators.py- def Auto(self, *args): -- python39/maxon/decorators.py: @staticmethod python39/maxon/decorators.py- @wraps(fn) python39/maxon/decorators.py- def ReferenceConvert(self, *args): -- python39/maxon/decorators.py: @staticmethod python39/maxon/decorators.py- @wraps(fn) python39/maxon/decorators.py- def Wrap(self, *args): -- python39/maxon/decorators.py: @staticmethod python39/maxon/decorators.py- @wraps(fn) python39/maxon/decorators.py- def NativeDataOrBuiltin(self, *args): -- python39/maxon/decorators.py: @staticmethod python39/maxon/decorators.py- @wraps(fn) python39/maxon/decorators.py- def _MaxonConvertOrFail(self, *args): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def Free(self): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def GetLocal(self): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def AllocEmpty(self): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def AllocFromUuid(self, uuid): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def AllocFromString(self, uuidStr): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def DescribeIO(self): -- python39/maxon/interface.py: @staticmethod python39/maxon/interface.py- def CreateUuidString(self): -- python39.win64.framework/lib/pathlib.py: @staticmethod python39.win64.framework/lib/pathlib.py- def link_to(self, target):
Also, for all of the following, the
@classmethod
attribute should be changed to@staticmethod
and theself
argument should be removed, just like for the above cases:python39.win64.framework/lib/importlib/_bootstrap.py- @classmethod python39.win64.framework/lib/importlib/_bootstrap.py: def create_module(self, spec): -- python39.win64.framework/lib/importlib/_bootstrap.py- @classmethod python39.win64.framework/lib/importlib/_bootstrap.py: def exec_module(self, module): -- python39.win64.framework/lib/_collections_abc.py- @classmethod python39.win64.framework/lib/_collections_abc.py: def _from_iterable(self, it): -- python39.win64.framework/lib/_collections_abc.py- @classmethod python39.win64.framework/lib/_collections_abc.py: def _from_iterable(self, it):
-
Thanks a lot some are false positive or even coming from the standard library.
But I will fix the one that are wrong and update the doc
Cheers,
Maxime. -
Hi, Maxime, great!
if I come across any additional issues of a similar nature, I'll update this post.