Skip to content

Commit a5eef85

Browse files
committed
refactor: use more adequate parameter names in data_access.py
Now that the type is Execution, the corresponding parameters should be called the same. JIRA: CQ-1387 risk: low
1 parent f67ee61 commit a5eef85

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gooddata-pandas/gooddata_pandas/data_access.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,20 @@ def _compute(
299299
#
300300

301301

302-
def _extract_for_metrics_only(response: Execution, cols: list, col_to_metric_idx: dict) -> dict:
302+
def _extract_for_metrics_only(execution: Execution, cols: list, col_to_metric_idx: dict) -> dict:
303303
"""
304304
Internal function that extracts data for metrics-only columns when there are no attribute columns.
305305
306306
Args:
307-
response (Execution): The execution response to extract data from.
307+
execution (Execution): The execution response to extract data from.
308308
cols (list): A list of column names.
309309
col_to_metric_idx (dict): A mapping of pandas column names to metric dimension indices.
310310
311311
Returns:
312312
dict: A dictionary containing the extracted data.
313313
"""
314-
exec_def = response.exec_def
315-
result = response.read_result(len(exec_def.metrics))
314+
exec_def = execution.exec_def
315+
result = execution.read_result(len(exec_def.metrics))
316316
if len(result.data) == 0:
317317
return {col: [] for col in cols}
318318

@@ -345,7 +345,7 @@ def _typed_result(attributes: list[CatalogAttribute], attribute: Attribute, resu
345345

346346

347347
def _extract_from_attributes_and_maybe_metrics(
348-
response: Execution,
348+
execution: Execution,
349349
attributes: list[CatalogAttribute],
350350
cols: list[str],
351351
col_to_attr_idx: dict[str, int],
@@ -357,7 +357,7 @@ def _extract_from_attributes_and_maybe_metrics(
357357
optionally metrics columns.
358358
359359
Args:
360-
response (Execution): The execution response to extract data from.
360+
execution (Execution): The execution response to extract data from.
361361
attributes (list[CatalogAttribute]): The catalog of attributes.
362362
cols (list[str]): A list of column names.
363363
col_to_attr_idx (dict[str, int]): A mapping of pandas column names to attribute dimension indices.
@@ -370,11 +370,11 @@ def _extract_from_attributes_and_maybe_metrics(
370370
- dict: A dictionary containing the extracted data.
371371
- dict: A dictionary containing the extracted index data.
372372
"""
373-
exec_def = response.exec_def
373+
exec_def = execution.exec_def
374374
offset = [0 for _ in exec_def.dimensions]
375375
limit = [len(exec_def.metrics), _RESULT_PAGE_LEN] if exec_def.has_metrics() else [_RESULT_PAGE_LEN]
376376
attribute_dim = 1 if exec_def.has_metrics() else 0
377-
result = response.read_result(limit=limit, offset=offset)
377+
result = execution.read_result(limit=limit, offset=offset)
378378
safe_index_to_attr_idx = index_to_attr_idx if index_to_attr_idx is not None else dict()
379379

380380
# mappings from column name to Attribute
@@ -401,7 +401,7 @@ def _extract_from_attributes_and_maybe_metrics(
401401
break
402402

403403
offset[attribute_dim] = result.next_page_start(attribute_dim)
404-
result = response.read_result(limit=limit, offset=offset)
404+
result = execution.read_result(limit=limit, offset=offset)
405405

406406
return data, index
407407

@@ -442,20 +442,20 @@ def compute_and_extract(
442442
filter_by=filter_by,
443443
)
444444

445-
response, col_to_attr_idx, col_to_metric_idx, index_to_attr_idx = result
445+
execution, col_to_attr_idx, col_to_metric_idx, index_to_attr_idx = result
446446

447447
if on_execution_submitted is not None:
448-
on_execution_submitted(response)
448+
on_execution_submitted(execution)
449449

450-
exec_def = response.exec_def
450+
exec_def = execution.exec_def
451451
cols = list(columns.keys())
452452

453453
if not exec_def.has_attributes():
454-
return _extract_for_metrics_only(response, cols, col_to_metric_idx), dict()
454+
return _extract_for_metrics_only(execution, cols, col_to_metric_idx), dict()
455455
else:
456456
attributes = get_catalog_attributes_for_extract(sdk, workspace_id, exec_def.attributes)
457457
return _extract_from_attributes_and_maybe_metrics(
458-
response,
458+
execution,
459459
attributes,
460460
cols,
461461
col_to_attr_idx,

0 commit comments

Comments
 (0)