Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nipanel/_panel_value_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_value(self, value_id: str, default_value: _T | None = None) -> _T | obje

Returns:
The value, or the default value if not set. The returned value will
be the same as default_value, if one was provided.
have the same type as default_value, if one was provided.

Raises:
KeyError: If the value is not set and no default value is provided
Expand Down
22 changes: 13 additions & 9 deletions src/nipanel/converters/protobuf_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,13 @@ def to_python_value(


class HTDateTimeConverter(Converter[ht.datetime, precision_timestamp_pb2.PrecisionTimestamp]):
"""A converter for hightime.datetime objects."""
"""A converter for hightime.datetime objects.

.. note:: The nipanel package will always convert PrecisionTimestamp messages to
bintime.DateTime objects using BTDateTimeConverter. To use hightime.datetime
values in a panel, you must pass a hightime.datetime value for the default_value
parameter of the get_value() method on the panel.
"""

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

@property
def protobuf_typename(self) -> str:
"""The protobuf name for the type.

Override the base class here because there can only be one converter that
converts ``PrecisionTimestamp`` objects. Since there are two converters that convert
to ``PrecisionTimestamp``, we have to choose one to handle conversion from protobuf.
For the purposes of nipanel, we'll convert ``PrecisionTimestamp`` messages to
bintime.DateTime. See ``BTDateTimeConverter``.
"""
"""The protobuf name for the type."""
# Override the base class here because there can only be one converter that
# converts PrecisionTimestamp objects. Since there are two converters that convert
# to PrecisionTimestamp, we have to choose one to handle conversion from protobuf.
# For the purposes of nipanel, we'll convert PrecisionTimestamp messages to
# bintime.DateTime. See BTDateTimeConverter.
return "PrecisionTimestamp_Placeholder"

def to_protobuf_message(
Expand Down
Loading