string_utils
camel_to_snake(text)
¶
Converts a camel case string to snake case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text | str | The camel case string to be converted. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The snake case version of the input string. |
Source code in exe_kg_lib/utils/string_utils.py
17 18 19 20 21 22 23 24 25 26 27 28 |
|
class_name_to_method_name(class_name)
¶
Converts a class name to a method name by removing the word "Method" from the end of the class name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name | str | The class name to convert. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The converted method name. |
Source code in exe_kg_lib/utils/string_utils.py
61 62 63 64 65 66 67 68 69 70 71 72 |
|
class_name_to_module_name(class_name)
¶
Converts a class name to a module name by removing the "Module" suffix and converting it to snake case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name | str | The class name to convert. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The converted module name. |
Source code in exe_kg_lib/utils/string_utils.py
47 48 49 50 51 52 53 54 55 56 57 58 |
|
concat_paths(*paths)
¶
Concatenates multiple paths into a single path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*paths | Union[str, Path] | Variable number of paths to be concatenated. | () |
Returns:
Name | Type | Description |
---|---|---|
str | str | The concatenated path. |
Example
concat_paths('path1', 'path2', 'path3') 'path1/path2/path3'
Source code in exe_kg_lib/utils/string_utils.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
get_instance_name(instance_type, instance_number, pipeline_name)
¶
Generates a unique instance name based on the instance type and number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance_type | str | The type of the instance. | required |
instance_number | int | The number of the instance for this type. | required |
pipeline_name | str | The name of the pipeline. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The generated instance name. |
Source code in exe_kg_lib/utils/string_utils.py
103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
get_task_output_name(output_type, task_instance_name, method_type)
¶
Generates the name for a task's output based on the output type, task instance name, and method type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_type | str | The type of the output. | required |
task_instance_name | str | The name of the task instance. | required |
method_type | str | The type of the method. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The generated task output name that follows the format "DataOutNameEx_TaskTypeEx1_PipelineName_MethodEx" (see TASK_OUTPUT_NAME_REGEX above for details). |
Source code in exe_kg_lib/utils/string_utils.py
118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
prettify_data_entity_name(data_entity_name)
¶
Prettifies the given data entity name by removing unnecessary prefixes and components.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_entity_name | str | The name of the data entity. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The prettified data entity name. |
Source code in exe_kg_lib/utils/string_utils.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
property_iri_to_field_name(property_iri)
¶
Converts a property IRI to a Python field name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
property_iri | str | The property IRI. | required |
Returns:
Name | Type | Description |
---|---|---|
str | str | The converted field name. |
Source code in exe_kg_lib/utils/string_utils.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|