Skip to content

Commit 57b36c9

Browse files
authored
service: Revise docstrings for info.py (#378)
service: Revise docstrings for info.py
1 parent edafb67 commit 57b36c9

1 file changed

Lines changed: 37 additions & 31 deletions

File tree

ni_measurementlink_service/measurement/info.py

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Contains classes and enums to represent measurement metadata."""
1+
"""Measurement service metadata classes and enums."""
22
from __future__ import annotations
33

44
import enum
@@ -7,50 +7,56 @@
77

88

99
class MeasurementInfo(NamedTuple):
10-
"""Class that represents the measurement information.
11-
12-
Attributes
13-
----------
14-
display_name (str): The measurement display name for client to display to user.
15-
16-
version (str): The measurement version that helps to
17-
maintain versions of a measurement in future.
18-
19-
ui_file_paths (list): Absolute paths of the UI file(s) linked to the measurement.
20-
21-
"""
10+
"""A named tuple providing information about a measurement."""
2211

2312
display_name: str
13+
"""The user visible name of the measurement."""
14+
2415
version: str
16+
"""The current version of the measurement."""
17+
2518
ui_file_paths: List[Path]
19+
"""Absolute paths to user interface files for the measurement (e.g. ``.measui`` or ``.vi``
20+
files)."""
2621

2722

2823
class ServiceInfo(NamedTuple):
29-
"""Class that represents the service information.
30-
31-
Attributes
32-
----------
33-
service_class (str): Service class that the measurement belongs to.
34-
Measurements under same service class expected to perform same logic.
35-
For e.g., different version of measurement can come under same service class.
36-
37-
38-
description_url (str): Description URL of the measurement.
39-
40-
provided_interfaces (List[str]): List of interfaces the service provides.
41-
For e.g., ni.measurementlink.measurement.v2.MeasurementService.
42-
Defaults to ["ni.measurementlink.measurement.v1.MeasurementService"].
43-
44-
annotations (Dict[str,str]): Dict that contains extra information of the measurement.
45-
As default we added a (str) description, (str) collection and a (List[str]) list of tags.
46-
Feel free to add your own Annotations as needed.
24+
"""A named tuple providing information about a registered service.
4725
26+
This class is used with the MeasurementLink discovery service when registering and enumerating
27+
services.
4828
"""
4929

5030
service_class: str
31+
""""The "class" of a service. The value of this field should be unique for a given interface
32+
in ``provided_interfaces``. In effect, the ``.proto`` service declaration defines the
33+
interface, and this field defines a class or concrete type of the interface."""
34+
5135
description_url: str
36+
"""The URL of a web page that provides a description of the service."""
37+
5238
provided_interfaces: List[str] = ["ni.measurementlink.measurement.v1.MeasurementService"]
39+
"""The service interfaces provided by the service. These are gRPC full names for the service."""
40+
5341
annotations: Dict[str, str] = {}
42+
"""Represents a set of annotations on the service.
43+
44+
Well-known annotations:
45+
46+
- Description
47+
- Key: "ni/service.description"
48+
- Expected format: string
49+
- Example: "Measure inrush current with a shorted load and validate results against
50+
configured limits."
51+
- Collection
52+
- Key: "ni/service.collection"
53+
- Expected format: "." delimited namespace/hierarchy case-insensitive string
54+
- Example: "CurrentTests.Inrush"
55+
- Tags
56+
- Key: "ni/service.tags"
57+
- Expected format: serialized JSON string of an array of strings
58+
- Example: "[\"powerup\", \"current\"]"
59+
"""
5460

5561

5662
class TypeSpecialization(enum.Enum):

0 commit comments

Comments
 (0)