Skip to content

Commit 9a00fc2

Browse files
committed
fix: convert RST-style docstrings to Google style for docs generation
The docs json_builder.py script expects Google-style docstrings but several functions used RST-style (:param/:return:), had missing summary lines before Args sections, or had improperly indented continuation lines — all causing "Invalid docstring" warnings during docs generation. jira: TRIVIAL risk: low
1 parent b95ca11 commit 9a00fc2

File tree

7 files changed

+75
-65
lines changed

7 files changed

+75
-65
lines changed

packages/gooddata-pandas/src/gooddata_pandas/data_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def build_execution_definition(self, filter_by: Union[Filter, list[Filter]] | No
230230
231231
Args:
232232
filter_by (Optional[Union[Filter, list[Filter]]]): A filter or a list of filters to be applied to the
233-
execution definition. If it's not provided or None, then the current filter configuration is used.
233+
execution definition. If it's not provided or None, then the current filter configuration is used.
234234
235235
Returns:
236236
ExecutionDefinition: An ExecutionDefinition instance containing attributes, metrics, filters,

packages/gooddata-pandas/src/gooddata_pandas/dataframe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class DataFrameFactory:
6060
"""
6161

6262
def __init__(self, sdk: GoodDataSdk, workspace_id: str) -> None:
63-
"""
63+
"""Create a new DataFrameFactory.
64+
6465
Args:
6566
sdk (GoodDataSdk): GoodData SDK instance.
6667
workspace_id (str): Workspace identifier.

packages/gooddata-pandas/src/gooddata_pandas/series.py

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,26 @@ def indexed(
3838
of the index labels. The elements of the index labels will be used to construct simple or hierarchical index.
3939
4040
Args:
41-
index_by (IndexDef): label to index by; specify either:
42-
43-
- string with id: ``some_label_id``,
44-
- object identifier: ``ObjId(id='some_label_id', type='label')``,
45-
- string representation of object identifier: ``label/some_label_id``
46-
- or an Attribute object used in the compute model: ``Attribute(local_id=..., label='some_label_id')``
47-
- dict containing mapping of index name to label to use for indexing (in one of the ways listed above)
48-
49-
data_by (Union[SimpleMetric, str, ObjId, Attribute]): label, fact or metric to that will provide data
50-
(metric values or label elements); specify either:
51-
52-
- object identifier: ``ObjId(id='some_id', type='<type>')`` - where type is either ``label``, ``fact``
53-
or ``metric``
54-
- string representation of object identifier: ``<type>/some_id`` - where type is either ``label``, ``fact``
55-
or ``metric``
56-
- Attribute object used in the compute model: ``Attribute(local_id=..., label='some_label_id')``
57-
- SimpleMetric object used in the compute model: ``SimpleMetric(local_id=..., item=..., aggregation=...)``
58-
59-
filter_by (Optional[Union[Filter, list[Filter]]]): optionally specify filter to apply during computation on
60-
the server, reference to filtering column can be one of:
61-
62-
- string reference to index key
63-
- object identifier in string form
64-
- object identifier: ``ObjId(id='some_label_id', type='<type>')``
65-
- Attribute or Metric depending on type of filter
66-
41+
index_by (IndexDef): label to index by; specify either
42+
a string with id (``some_label_id``),
43+
an object identifier (``ObjId(id='some_label_id', type='label')``),
44+
a string representation of object identifier (``label/some_label_id``),
45+
an Attribute object used in the compute model
46+
(``Attribute(local_id=..., label='some_label_id')``),
47+
or a dict containing mapping of index name to label to use for indexing.
48+
data_by (Union[SimpleMetric, str, ObjId, Attribute]): label, fact or metric that will provide data
49+
(metric values or label elements); specify either an object identifier
50+
(``ObjId(id='some_id', type='<type>')``), a string representation
51+
(``<type>/some_id``), an Attribute object, or a SimpleMetric object.
52+
filter_by (Optional[Union[Filter, list[Filter]]]): optionally specify filter to apply during
53+
computation on the server, reference to filtering column can be a string reference to
54+
index key, object identifier in string form,
55+
``ObjId(id='some_label_id', type='<type>')``,
56+
or Attribute/Metric depending on type of filter.
6757
on_execution_submitted (Optional[Callable[[Execution], None]]): Callback to call when the execution was
6858
submitted to the backend.
69-
70-
is_cancellable (bool, optional): Whether the execution should be cancelled when the connection is interrupted.
71-
59+
is_cancellable (bool, optional): Whether the execution should be cancelled when the connection
60+
is interrupted.
7261
result_page_len (Optional[int]): Optional page size for result pagination.
7362
Defaults to 1000. Larger values can improve performance for large result sets.
7463

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/service.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ def list_workspace_settings(self, workspace_id: str) -> list[CatalogWorkspaceSet
191191
return [CatalogWorkspaceSetting.from_api(ws) for ws in workspace_settings]
192192

193193
def resolve_all_workspace_settings(self, workspace_id: str) -> dict:
194-
"""
195-
Resolves values for all settings in a workspace by current user, workspace, organization, or default settings
196-
and return them as a dictionary. Proper parsing is up to the caller.
194+
"""Resolve values for all settings in a workspace.
195+
196+
Resolves by current user, workspace, organization, or default settings
197+
and returns them as a dictionary. Proper parsing is up to the caller.
197198
TODO: long-term we should return a proper entity object.
198199
199-
:param workspace_id: Workspace ID
200-
:return: Dict of settings
200+
Args:
201+
workspace_id: Workspace ID
202+
203+
Returns:
204+
Dict of settings
201205
"""
202206
# note: in case some settings were recently added and the API client was not regenerated it can fail on
203207
# invalid value when validating allowed types on the client side before request is sent to the server
@@ -211,14 +215,18 @@ def resolve_all_workspace_settings(self, workspace_id: str) -> dict:
211215
return {setting["type"]: setting for setting in resolved_workspace_settings}
212216

213217
def resolve_workspace_settings(self, workspace_id: str, settings: list) -> dict:
214-
"""
215-
Resolves values for given settings in a workspace by current user, workspace, organization, or default settings
216-
and return them as a dictionary. Proper parsing is up to the caller.
218+
"""Resolve values for given settings in a workspace.
219+
220+
Resolves by current user, workspace, organization, or default settings
221+
and returns them as a dictionary. Proper parsing is up to the caller.
217222
TODO: long-term we should return a proper entity object.
218223
219-
:param workspace_id: Workspace ID
220-
:param settings: List of settings to resolve
221-
:return: Dict of settings
224+
Args:
225+
workspace_id: Workspace ID
226+
settings: List of settings to resolve
227+
228+
Returns:
229+
Dict of settings
222230
"""
223231
resolved_workspace_settings = [
224232
setting.to_dict()

packages/gooddata-sdk/src/gooddata_sdk/compute/compute_to_sdk_converter.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ class ComputeToSdkConverter:
4343

4444
@staticmethod
4545
def convert_attribute(attribute_dict: dict[str, Any]) -> Attribute:
46-
"""
47-
Converts attribute dictionary to the SDK Compute model.
48-
:param attribute_dict: the attribute dictionary to convert
49-
:return: the converted attribute
46+
"""Convert attribute dictionary to the SDK Compute model.
47+
48+
Args:
49+
attribute_dict: the attribute dictionary to convert
50+
51+
Returns:
52+
the converted attribute
5053
"""
5154
return Attribute(
5255
local_id=attribute_dict["localIdentifier"],
@@ -56,10 +59,13 @@ def convert_attribute(attribute_dict: dict[str, Any]) -> Attribute:
5659

5760
@staticmethod
5861
def convert_filter(filter_dict: dict[str, Any]) -> Filter:
59-
"""
60-
Converts filter dictionary to the SDK Compute model.
61-
:param filter_dict: the filter dictionary to convert
62-
:return: the converted filter
62+
"""Convert filter dictionary to the SDK Compute model.
63+
64+
Args:
65+
filter_dict: the filter dictionary to convert
66+
67+
Returns:
68+
the converted filter
6369
"""
6470
if "positiveAttributeFilter" in filter_dict:
6571
f = filter_dict["positiveAttributeFilter"]
@@ -186,10 +192,13 @@ def convert_filter(filter_dict: dict[str, Any]) -> Filter:
186192

187193
@staticmethod
188194
def convert_metric(metric_dict: dict[str, Any]) -> Metric:
189-
"""
190-
Converts metric dictionary to the SDK Compute model.
191-
:param metric_dict: the metric dictionary to convert
192-
:return: the converted metric
195+
"""Convert metric dictionary to the SDK Compute model.
196+
197+
Args:
198+
metric_dict: the metric dictionary to convert
199+
200+
Returns:
201+
the converted metric
193202
"""
194203
definition = metric_dict["definition"]
195204
local_id = metric_dict["localIdentifier"]

packages/gooddata-sdk/src/gooddata_sdk/compute/model/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,14 @@ def as_api_model(self) -> OpenApiModel:
8787
raise NotImplementedError()
8888

8989
def description(self, labels: dict[str, str], format_locale: str | None = None) -> str:
90-
"""
91-
Description of the filter as it's visible for customer in UI.
90+
"""Description of the filter as it's visible for customer in UI.
91+
92+
Args:
93+
labels: Dict of labels in a form of ``id: label``. Measures and attributes are expected to be here.
94+
format_locale: Locale ICU format to use for dates formatting in the description
95+
(ie. "en-US" or "cs-CZ")
9296
93-
:param labels: Dict of labels in a form of `id: label`. Measures and attributes are expected to be here.
94-
:param format_locale: Locale ICU format to use for dates formatting in the description (ie. "en-US" or "cs-CZ")
95-
:return: Filter's human-readable description
97+
Returns:
98+
Filter's human-readable description
9699
"""
97100
raise NotImplementedError()

packages/gooddata-sdk/src/gooddata_sdk/type_converter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ class TypeConverterRegistry:
119119
"""
120120

121121
def __init__(self, type_name: str):
122-
"""
123-
Initialize instance with type for which instance is going to be responsible
122+
"""Initialize instance with type for which instance is going to be responsible.
124123
125-
:param type_name: type name
124+
Args:
125+
type_name: type name
126126
"""
127127
self._type_name = type_name
128128
self._converters: dict[str, Converter] = {}
@@ -160,10 +160,10 @@ def _register_with_sub_type(self, converter: Converter, sub_type: str) -> None:
160160
self._converters[sub_type] = converter
161161

162162
def _register_default(self, converter: Converter) -> None:
163-
"""
164-
Register default converter instance for the type. Default type can be registered only once.
163+
"""Register default converter instance for the type. Default type can be registered only once.
165164
166-
:param converter: converter instance
165+
Args:
166+
converter: converter instance
167167
"""
168168
if self._default_converter:
169169
reg_converter_type = self._default_converter.__class__.__name__

0 commit comments

Comments
 (0)