Skip to content

Commit

Permalink
chore(deps): update dependency sphinx-autoapi to v3.2.1 (#810)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency sphinx-autoapi to v3.2.1

* service: Change the way we document public attributes in MeasurementService

Documenting attributes using Napoleon "Attributes:" in the class docstring causes
duplicate object warnings because sphinx-autoapi also documents these attributes
based on their assignments in the `__init__` method.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Brad Keryan <brad.keryan@ni.com>
  • Loading branch information
renovate[bot] and bkeryan authored Jul 31, 2024
1 parent 78079ce commit 7a3f848
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,7 @@ def reserve_sessions(


class MeasurementService:
"""Class that supports registering and hosting a python function as a gRPC service.
Attributes:
measurement_info (info.MeasurementInfo): Measurement info
service_info(info.ServiceInfo) : Service Info
context (MeasurementContext): Accessor for context-local state.
"""
"""Class that supports registering and hosting a python function as a gRPC service."""

def __init__(
self,
Expand Down Expand Up @@ -223,31 +215,33 @@ def __init__(
f"Service class '{service_class}' not found in '{service_config_file}'"
)

self.measurement_info = MeasurementInfo(
# Note: sphinx-autoapi uses the public attributes' type hints and docstrings.
self.measurement_info: MeasurementInfo = MeasurementInfo(
display_name=service["displayName"],
version=version,
ui_file_paths=ui_file_paths,
)
"""Information about the measurement performed by this service."""

def convert_value_to_str(value: object) -> str:
if isinstance(value, str):
return value
return json.dumps(value, separators=(",", ":"))

service_annotations_string = {
key: convert_value_to_str(value)
for key, value in service.get("annotations", {}).items()
}

self.service_info = ServiceInfo(
self.service_info: ServiceInfo = ServiceInfo(
display_name=service["displayName"],
service_class=service["serviceClass"],
description_url=service["descriptionUrl"],
provided_interfaces=service["providedInterfaces"],
annotations=service_annotations_string,
annotations={
key: convert_value_to_str(value)
for key, value in service.get("annotations", {}).items()
},
)
"""Information about this service."""

self.context = MeasurementContext()
self.context: MeasurementContext = MeasurementContext()
"""Accessor for context-local state."""

self._configuration_parameter_list: List[parameter_metadata.ParameterMetadata] = []
self._output_parameter_list: List[parameter_metadata.ParameterMetadata] = []
Expand Down
6 changes: 3 additions & 3 deletions packages/service/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a3f848

Please sign in to comment.