Skip to content

Commit daee441

Browse files
mjohanse-emrMichael Johansen
andauthored
Fix some comments and docstrings (#139)
* Fix some comments and docstrings Signed-off-by: Michael Johansen <[email protected]> * Use rest syntax for the docstring note. Signed-off-by: Michael Johansen <[email protected]> --------- Signed-off-by: Michael Johansen <[email protected]> Co-authored-by: Michael Johansen <[email protected]>
1 parent 21901aa commit daee441

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/nipanel/_panel_value_accessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def get_value(self, value_id: str, default_value: _T | None = None) -> _T | obje
6969
7070
Returns:
7171
The value, or the default value if not set. The returned value will
72-
be the same as default_value, if one was provided.
72+
have the same type as default_value, if one was provided.
7373
7474
Raises:
7575
KeyError: If the value is not set and no default value is provided

src/nipanel/converters/protobuf_types.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,13 @@ def to_python_value(
405405

406406

407407
class HTDateTimeConverter(Converter[ht.datetime, precision_timestamp_pb2.PrecisionTimestamp]):
408-
"""A converter for hightime.datetime objects."""
408+
"""A converter for hightime.datetime objects.
409+
410+
.. note:: The nipanel package will always convert PrecisionTimestamp messages to
411+
bintime.DateTime objects using BTDateTimeConverter. To use hightime.datetime
412+
values in a panel, you must pass a hightime.datetime value for the default_value
413+
parameter of the get_value() method on the panel.
414+
"""
409415

410416
@property
411417
def python_type(self) -> type:
@@ -419,14 +425,12 @@ def protobuf_message(self) -> Type[precision_timestamp_pb2.PrecisionTimestamp]:
419425

420426
@property
421427
def protobuf_typename(self) -> str:
422-
"""The protobuf name for the type.
423-
424-
Override the base class here because there can only be one converter that
425-
converts ``PrecisionTimestamp`` objects. Since there are two converters that convert
426-
to ``PrecisionTimestamp``, we have to choose one to handle conversion from protobuf.
427-
For the purposes of nipanel, we'll convert ``PrecisionTimestamp`` messages to
428-
bintime.DateTime. See ``BTDateTimeConverter``.
429-
"""
428+
"""The protobuf name for the type."""
429+
# Override the base class here because there can only be one converter that
430+
# converts PrecisionTimestamp objects. Since there are two converters that convert
431+
# to PrecisionTimestamp, we have to choose one to handle conversion from protobuf.
432+
# For the purposes of nipanel, we'll convert PrecisionTimestamp messages to
433+
# bintime.DateTime. See BTDateTimeConverter.
430434
return "PrecisionTimestamp_Placeholder"
431435

432436
def to_protobuf_message(

0 commit comments

Comments
 (0)