Skip to content

Commit ae373d9

Browse files
committed
Address the formatter
Signed-off-by: Joe Friedrichsen <[email protected]>
1 parent 185b9cb commit ae373d9

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

examples/sample/sample.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
panel.set_value("sample_float", 3.14)
2020
panel.set_value("sample_bool", True)
2121

22-
x_values = [float(x) for x in itertools.takewhile(lambda p: p < 2*math.pi, itertools.count(0, 0.05))]
22+
x_values = [
23+
float(x) for x in itertools.takewhile(lambda p: p < 2 * math.pi, itertools.count(0, 0.05))
24+
]
2325
y_values = [math.sin(x) for x in x_values]
2426
panel.set_value("x_values", x_values)
2527
panel.set_value("y_values", y_values)

examples/sample/sample_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
st.write(panel.get_value("sample_float"))
2525
st.write(panel.get_value("sample_bool"))
2626
st.line_chart(
27-
data = pd.DataFrame(
27+
data=pd.DataFrame(
2828
{
2929
"x": panel.get_value("x_values"),
3030
"y": panel.get_value("y_values"),

src/nipanel/_converters.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,22 @@ def protobuf_message(self) -> Type[python_panel_types_pb2.BoolCollection]:
182182
"""The type-specific protobuf message for the Python type."""
183183
return python_panel_types_pb2.BoolCollection
184184

185-
def to_protobuf_message(self, python_value: Collection[bool]) -> python_panel_types_pb2.BoolCollection:
185+
def to_protobuf_message(
186+
self, python_value: Collection[bool]
187+
) -> python_panel_types_pb2.BoolCollection:
186188
"""Convert the Python collection of bools to a protobuf python_panel_types_pb2.BoolCollection."""
187189
return self.protobuf_message(values=python_value)
188190

189-
def to_python_value(self, protobuf_value: python_panel_types_pb2.BoolCollection) -> Collection[bool]:
191+
def to_python_value(
192+
self, protobuf_value: python_panel_types_pb2.BoolCollection
193+
) -> Collection[bool]:
190194
"""Convert the protobuf message to a Python collection of bools."""
191195
return list(protobuf_value.values)
192196

193197

194-
class BytesCollectionConverter(Converter[Collection[bytes], python_panel_types_pb2.ByteStringCollection]):
198+
class BytesCollectionConverter(
199+
Converter[Collection[bytes], python_panel_types_pb2.ByteStringCollection]
200+
):
195201
"""A converter for a Collection of byte strings."""
196202

197203
@property
@@ -204,16 +210,22 @@ def protobuf_message(self) -> Type[python_panel_types_pb2.ByteStringCollection]:
204210
"""The type-specific protobuf message for the Python type."""
205211
return python_panel_types_pb2.ByteStringCollection
206212

207-
def to_protobuf_message(self, python_value: Collection[bytes]) -> python_panel_types_pb2.ByteStringCollection:
213+
def to_protobuf_message(
214+
self, python_value: Collection[bytes]
215+
) -> python_panel_types_pb2.ByteStringCollection:
208216
"""Convert the Python collection of byte strings to a protobuf python_panel_types_pb2.ByteStringCollection."""
209217
return self.protobuf_message(values=python_value)
210218

211-
def to_python_value(self, protobuf_value: python_panel_types_pb2.ByteStringCollection) -> Collection[bytes]:
219+
def to_python_value(
220+
self, protobuf_value: python_panel_types_pb2.ByteStringCollection
221+
) -> Collection[bytes]:
212222
"""Convert the protobuf message to a Python collection of byte strings."""
213223
return list(protobuf_value.values)
214224

215225

216-
class FloatCollectionConverter(Converter[Collection[float], python_panel_types_pb2.FloatCollection]):
226+
class FloatCollectionConverter(
227+
Converter[Collection[float], python_panel_types_pb2.FloatCollection]
228+
):
217229
"""A converter for a Collection of floats."""
218230

219231
@property
@@ -226,11 +238,15 @@ def protobuf_message(self) -> Type[python_panel_types_pb2.FloatCollection]:
226238
"""The type-specific protobuf message for the Python type."""
227239
return python_panel_types_pb2.FloatCollection
228240

229-
def to_protobuf_message(self, python_value: Collection[float]) -> python_panel_types_pb2.FloatCollection:
241+
def to_protobuf_message(
242+
self, python_value: Collection[float]
243+
) -> python_panel_types_pb2.FloatCollection:
230244
"""Convert the Python collection of floats to a protobuf python_panel_types_pb2.FloatCollection."""
231245
return self.protobuf_message(values=python_value)
232246

233-
def to_python_value(self, protobuf_value: python_panel_types_pb2.FloatCollection) -> Collection[float]:
247+
def to_python_value(
248+
self, protobuf_value: python_panel_types_pb2.FloatCollection
249+
) -> Collection[float]:
234250
"""Convert the protobuf message to a Python collection of floats."""
235251
return list(protobuf_value.values)
236252

@@ -248,11 +264,15 @@ def protobuf_message(self) -> Type[python_panel_types_pb2.IntCollection]:
248264
"""The type-specific protobuf message for the Python type."""
249265
return python_panel_types_pb2.IntCollection
250266

251-
def to_protobuf_message(self, python_value: Collection[int]) -> python_panel_types_pb2.IntCollection:
267+
def to_protobuf_message(
268+
self, python_value: Collection[int]
269+
) -> python_panel_types_pb2.IntCollection:
252270
"""Convert the Python collection of integers to a protobuf python_panel_types_pb2.IntCollection."""
253271
return self.protobuf_message(values=python_value)
254272

255-
def to_python_value(self, protobuf_value: python_panel_types_pb2.IntCollection) -> Collection[int]:
273+
def to_python_value(
274+
self, protobuf_value: python_panel_types_pb2.IntCollection
275+
) -> Collection[int]:
256276
"""Convert the protobuf message to a Python collection of integers."""
257277
return list(protobuf_value.values)
258278

@@ -270,11 +290,15 @@ def protobuf_message(self) -> Type[python_panel_types_pb2.StringCollection]:
270290
"""The type-specific protobuf message for the Python type."""
271291
return python_panel_types_pb2.StringCollection
272292

273-
def to_protobuf_message(self, python_value: Collection[str]) -> python_panel_types_pb2.StringCollection:
293+
def to_protobuf_message(
294+
self, python_value: Collection[str]
295+
) -> python_panel_types_pb2.StringCollection:
274296
"""Convert the Python collection of strings to a protobuf python_panel_types_pb2.StringCollection."""
275297
return self.protobuf_message(values=python_value)
276298

277-
def to_python_value(self, protobuf_value: python_panel_types_pb2.StringCollection) -> Collection[str]:
299+
def to_python_value(
300+
self, protobuf_value: python_panel_types_pb2.StringCollection
301+
) -> Collection[str]:
278302
"""Convert the protobuf message to a Python collection of strings."""
279303
return list(protobuf_value.values)
280304

0 commit comments

Comments
 (0)