Skip to content

Commit 6ff26ea

Browse files
committed
Clarify some docstrings
Signed-off-by: Joe Friedrichsen <114173023+jfriedri-ni@users.noreply.github.com>
1 parent ae54c82 commit 6ff26ea

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/nipanel/_converters.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def to_protobuf_any(self, python_value: Any) -> any_pb2.Any:
4242

4343
@abstractmethod
4444
def to_protobuf_message(self, python_value: Any) -> Message:
45-
"""Convert the Python object to its type-specific message and pack it as any_pb2.Any."""
45+
"""Convert the Python object to its type-specific message."""
4646

4747
def to_python(self, protobuf_value: any_pb2.Any) -> _TPythonType:
4848
"""Convert the protobuf Any message to its matching Python type."""
@@ -71,7 +71,7 @@ def protobuf_message(self) -> Type[wrappers_pb2.BoolValue]:
7171
return wrappers_pb2.BoolValue
7272

7373
def to_protobuf_message(self, python_value: bool) -> Message:
74-
"""Convert a bool to a protobuf Any."""
74+
"""Convert the Python bool to a protobuf wrappers_pb2.BoolValue."""
7575
return self.protobuf_message(value=python_value)
7676

7777
def to_python_value(self, protobuf_value: wrappers_pb2.BoolValue) -> bool:
@@ -93,11 +93,11 @@ def protobuf_message(self) -> Type[wrappers_pb2.BytesValue]:
9393
return wrappers_pb2.BytesValue
9494

9595
def to_protobuf_message(self, python_value: bytes) -> Message:
96-
"""Convert bytes to a protobuf Any."""
96+
"""Convert the Python bytes string to a protobuf wrappers_pb2.BytesValue."""
9797
return self.protobuf_message(value=python_value)
9898

9999
def to_python_value(self, protobuf_value: wrappers_pb2.BytesValue) -> bytes:
100-
"""Convert the protobuf message to Python bytes."""
100+
"""Convert the protobuf message to a Python bytes string."""
101101
return protobuf_value.value
102102

103103

@@ -115,7 +115,7 @@ def protobuf_message(self) -> Type[wrappers_pb2.DoubleValue]:
115115
return wrappers_pb2.DoubleValue
116116

117117
def to_protobuf_message(self, python_value: float) -> Message:
118-
"""Convert a float to a protobuf Any."""
118+
"""Convert the Python float to a protobuf wrappers_pb2.DoubleValue."""
119119
return self.protobuf_message(value=python_value)
120120

121121
def to_python_value(self, protobuf_value: wrappers_pb2.DoubleValue) -> float:
@@ -137,7 +137,7 @@ def protobuf_message(self) -> Type[wrappers_pb2.Int64Value]:
137137
return wrappers_pb2.Int64Value
138138

139139
def to_protobuf_message(self, python_value: int) -> Message:
140-
"""Convert an int to a protobuf Any."""
140+
"""Convert the Python int to a protobuf wrappers_pb2.Int64Value."""
141141
return self.protobuf_message(value=python_value)
142142

143143
def to_python_value(self, protobuf_value: wrappers_pb2.Int64Value) -> int:
@@ -159,7 +159,7 @@ def protobuf_message(self) -> Type[wrappers_pb2.StringValue]:
159159
return wrappers_pb2.StringValue
160160

161161
def to_protobuf_message(self, python_value: str) -> Message:
162-
"""Convert a str to a protobuf Any."""
162+
"""Convert the Python str to a protobuf wrappers_pb2.StringValue."""
163163
return self.protobuf_message(value=python_value)
164164

165165
def to_python_value(self, protobuf_value: wrappers_pb2.StringValue) -> str:

0 commit comments

Comments
 (0)