From Spreadsheet
src.worksheets.from_spreadsheet
Attributes
gsheet_range_default
module-attribute
gsheet_range_default = 'A1:AD1007'
FORM_PREDICATE
module-attribute
FORM_PREDICATE = 0
FORM_NAME
module-attribute
FORM_NAME = 1
FIELD_PREDICATE
module-attribute
FIELD_PREDICATE = 2
KIND
module-attribute
KIND = 3
FIELD_TYPE
module-attribute
FIELD_TYPE = 4
FIELD_NAME
module-attribute
FIELD_NAME = 5
VARIABLE_ENUMS
module-attribute
VARIABLE_ENUMS = 6
FIELD_DESCRIPTION
module-attribute
FIELD_DESCRIPTION = 7
DONT_ASK
module-attribute
DONT_ASK = 8
REQUIRED
module-attribute
REQUIRED = 9
FIELD_CONFIRMATION
module-attribute
FIELD_CONFIRMATION = 10
FIELD_ACTION
module-attribute
FIELD_ACTION = 11
FORM_ACTION
module-attribute
FORM_ACTION = 12
FIELD_VALIDATION
module-attribute
FIELD_VALIDATION = 13
EMPTY_COL
module-attribute
EMPTY_COL = 14
str_to_type
module-attribute
str_to_type = {'str': str, 'int': int, 'float': float, 'bool': bool, 'date': date, 'time': time}
Functions
gsheet_to_classes
gsheet_to_classes(gsheet_id, gsheet_range=gsheet_range_default)
Convert Google Sheets data to Genie classes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gsheet_id
|
str
|
The ID of the Google Sheet. |
required |
gsheet_range
|
str
|
The range of cells to retrieve. |
gsheet_range_default
|
Yields:
Type | Description |
---|---|
Tuple[str, type]: The type of the class and the class itself. |
Source code in src/worksheets/from_spreadsheet.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
create_class
create_class(class_name, fields, genie_type, form_predicate, form_action, backend_api, outputs)
Create a class dynamically based on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the class to create. |
required |
fields
|
list
|
A list of field dictionaries. |
required |
genie_type
|
str
|
The type of the Genie class (worksheet, db, type). |
required |
form_predicate
|
str
|
The predicate for the form. |
required |
form_action
|
Action
|
The action associated with the form. |
required |
backend_api
|
str
|
The backend API associated with the form. |
required |
outputs
|
list
|
A list of output dictionaries. |
required |
Returns:
Type | Description |
---|---|
Tuple[str, type]: The type of the class and the class itself. |
Source code in src/worksheets/from_spreadsheet.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
create_enum_class
create_enum_class(class_name, enums)
Create an Enum class dynamically
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the Enum class. |
required |
enums
|
list
|
A list of enum values. |
required |
Returns:
Name | Type | Description |
---|---|---|
Enum |
The created Enum class. |
Source code in src/worksheets/from_spreadsheet.py
181 182 183 184 185 186 187 188 189 190 191 192 |
|
convert_snake_to_camel_case
convert_snake_to_camel_case(snake_str: str)
Convert a snake_case string to camelCase.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
snake_str
|
str
|
The snake_case string to convert. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
The converted camelCase string. |
Source code in src/worksheets/from_spreadsheet.py
195 196 197 198 199 200 201 202 203 204 205 |
|
gsheet_to_genie
gsheet_to_genie(gsheet_id, gsheet_range=gsheet_range_default)
Convert Google Sheets data to Genie componenets that are used to create the agent
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gsheet_id
|
str
|
The ID of the Google Sheet. |
required |
gsheet_range
|
str
|
The range of cells to retrieve. |
gsheet_range_default
|
Returns:
Type | Description |
---|---|
Tuple[List[GenieWorksheet], List[GenieDB], List[GenieType]]: The lists of Genie components. |
Source code in src/worksheets/from_spreadsheet.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|