This repository was archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Python code for methods #337
Copy link
Copy link
Closed
Labels
bug 🪲Something isn't workingSomething isn't working
Description
Describe the bug
Currently, the following code is generated for methods:
class Class_1_Module_1:
def __init__(self, only_param):
folder1.folder2.folder3.module_1.Class_1_Module_1.__init__(only_param)
def instance_method_1(self, only_param):
folder1.folder2.folder3.module_1.Class_1_Module_1.instance_method_1(only_param)
Calling the original method requires an instance of the original class, but here it is done as a static call on the class.
To Reproduce
Steps to reproduce the behavior:
- Import the minimal test data.
- Click on 'Infer'
Expected behavior
The following code should be generated:
class Class_1_Module_1:
def __init__(self, only_param):
self.instance = folder1.folder2.folder3.module_1.Class_1_Module_1(only_param)
def instance_method_1(self, only_param):
self.instance.instance_method_1(only_param)
Exception 1: Original method has @staticmethod
decorator
Then the generated code should look like this:
class Class_1_Module_1:
def __init__(only_param):
folder1.folder2.folder3.module_1.Class_1_Module_1(only_param)
@staticmethod # <--- only add this decorator
def static_method_1(only_param):
folder1.folder2.folder3.module_1.Class_1_Module_1.static_method_1(only_param)
Exception 2: Original method has @classmethod
decorator
Then the generated code should look like this:
class Class_1_Module_1:
def __init__(only_param):
folder1.folder2.folder3.module_1.Class_1_Module_1(only_param)
@staticmethod # <--- add this decorator (we don't support class methods directly)
def class_method_1(only_param): # <--- first parameter of original method is cls; it should be removed from the new interface
folder1.folder2.folder3.module_1.Class_1_Module_1.class_method_1(only_param)
Metadata
Metadata
Assignees
Labels
bug 🪲Something isn't workingSomething isn't working