@@ -25,14 +25,38 @@ def __init__(self):
25
25
)
26
26
27
27
def _format_class_name (self , code : str ) -> str :
28
+ """
29
+ Format the class name based on the `code` of the entity to follow Python snake case conventions.
30
+
31
+ Args:
32
+ code (str): The code of the entity.
33
+
34
+ Returns:
35
+ str: The formatted class name.
36
+ """
28
37
if "." in code :
29
38
code = code .split ("." )[- 1 ]
30
39
return code .title ().replace ("_" , "" ).replace ("$" , "" )
31
40
32
41
def determine_parent_class (
33
42
self , code : str , class_names : dict , default : str , lines : list
34
43
) -> tuple :
35
- # Determine parent class
44
+ """
45
+ Determine the parent class information of the entity based on its `code`. It returns
46
+ the `parent_code` and `parent class`, as well as the `class_name` of the entity. The
47
+ class will inherit from `parent_class`.
48
+
49
+ If the parent class does not exist, a note is added to the `lines` list for debugging purposes.
50
+
51
+ Args:
52
+ code (str): The code of the entity.
53
+ class_names (dict): A dictionary with the class names of the entities.
54
+ default (str): The default parent class if the parent class does not exist.
55
+ lines (list): A list of strings to be printed to the Python module.
56
+
57
+ Returns:
58
+ tuple: The parent code, parent class, and class name of the entity.
59
+ """
36
60
parent_code = ""
37
61
if "." in code :
38
62
parent_code = code .rsplit ("." , 1 )[0 ]
@@ -50,7 +74,19 @@ def determine_parent_class(
50
74
51
75
return parent_code , parent_class , class_name
52
76
53
- def add_properties (self , entities , parent_code , data , lines ):
77
+ def add_properties (
78
+ self , entities : dict , parent_code : str , data : str , lines : list
79
+ ) -> None :
80
+ """
81
+ Add the properties of the entity to the `lines` list. The properties are added as
82
+ `PropertyTypeAssignment` objects.
83
+
84
+ Args:
85
+ entities (dict): The dictionary of entities (objects, collections, datasets, vocabularies).
86
+ parent_code (code): The code of the parent class.
87
+ data (str): The data information for the entity as obtained from openBIS.
88
+ lines (list): A list of strings to be printed to the Python module.
89
+ """
54
90
parent_properties = entities .get (parent_code , {}).get ("properties" , {}).keys ()
55
91
for prop_code , prop_data in data .get ("properties" , {}).items ():
56
92
# Skip "UNKNOWN" properties
0 commit comments