Skip to content

Commit 610a02b

Browse files
committed
Blacken
1 parent 8e0086f commit 610a02b

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

data_prototype/wrappers.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def __setattr__(self, key, value):
199199
else:
200200
super().__setattr__(key, value)
201201

202+
202203
class LineWrapper(ProxyWrapper):
203204
_wrapped_class = _Line2D
204205
_privtized_methods = ("set_xdata", "set_ydata", "set_data", "get_xdata", "get_ydata", "get_data")
@@ -220,12 +221,21 @@ def _update_wrapped(self, data):
220221
k = {"x": "xdata", "y": "ydata"}.get(k, k)
221222
getattr(self._wrapped_instance, f"set_{k}")(v)
222223

224+
223225
class PathCollectionWrapper(ProxyWrapper):
224226
_wrapped_class = _PathCollection
225227
_privtized_methods = (
226-
"set_facecolors", "set_edgecolors", "set_offsets", "set_sizes", "set_paths",
227-
"get_facecolors", "get_edgecolors", "get_offsets", "get_sizes", "get_paths",
228-
)
228+
"set_facecolors",
229+
"set_edgecolors",
230+
"set_offsets",
231+
"set_sizes",
232+
"set_paths",
233+
"get_facecolors",
234+
"get_edgecolors",
235+
"get_offsets",
236+
"get_sizes",
237+
"get_paths",
238+
)
229239

230240
def __init__(self, data: DataContainer, nus=None, /, **kwargs):
231241
super().__init__(data, nus)
@@ -248,7 +258,6 @@ def _update_wrapped(self, data):
248258
self._wrapped_instance.set_sizes(data["sizes"])
249259

250260

251-
252261
class ImageWrapper(ProxyWrapper):
253262
_wrapped_class = _AxesImage
254263
required_keys = {"xextent", "yextent", "image"}

examples/lissajous.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ def query(
4646
) -> Tuple[Dict[str, Any], Union[str, int]]:
4747
def next_time():
4848
cur_time = time.time()
49-
cur_time = np.array([cur_time, cur_time-.1, cur_time-.2, cur_time-0.3])
49+
cur_time = np.array([cur_time, cur_time - 0.1, cur_time - 0.2, cur_time - 0.3])
5050

51-
phase = 15*np.pi * (self.scale * cur_time % 60) / 150
51+
phase = 15 * np.pi * (self.scale * cur_time % 60) / 150
5252
marker_obj = mmarkers.MarkerStyle("o")
5353
return {
54-
"x": np.cos(5*phase),
55-
"y": np.sin(3*phase),
54+
"x": np.cos(5 * phase),
55+
"y": np.sin(3 * phase),
5656
"phase": phase[0],
5757
"sizes": np.array([256]),
5858
"paths": [marker_obj.get_path().transformed(marker_obj.get_transform())],
@@ -83,13 +83,13 @@ def update(frame, art):
8383
lw = PathCollectionWrapper(sot_c, offset_transform=ax.transData)
8484
ax.add_artist(lw)
8585
ax.add_artist(fc)
86-
#ax.set_xticks([])
87-
#ax.set_yticks([])
86+
# ax.set_xticks([])
87+
# ax.set_yticks([])
8888
ax.set_aspect(1)
8989
ani = FuncAnimation(
9090
fig,
9191
partial(update, art=(lw, fc)),
92-
frames=60*15,
92+
frames=60 * 15,
9393
interval=1000 / 100,
9494
# TODO: blitting does not work because wrappers do not inherent from Artist
9595
# blit=True,

examples/simple_scatter.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,24 @@
2020
def update(frame, art):
2121
return art
2222

23+
2324
marker_obj = mmarkers.MarkerStyle("o")
2425

2526
cont = ArrayContainer(
26-
x = np.array([0,1,2]),
27-
y = np.array([1,4,2]),
28-
paths = np.array([marker_obj.get_path()]),
29-
sizes = np.array([12]),
30-
edgecolors = np.array(["k"]),
31-
facecolors = np.array(["C3"]),
27+
x=np.array([0, 1, 2]),
28+
y=np.array([1, 4, 2]),
29+
paths=np.array([marker_obj.get_path()]),
30+
sizes=np.array([12]),
31+
edgecolors=np.array(["k"]),
32+
facecolors=np.array(["C3"]),
3233
)
3334

3435
fig, ax = plt.subplots()
35-
ax.set_xlim(-.5, 2.5)
36+
ax.set_xlim(-0.5, 2.5)
3637
ax.set_ylim(0, 5)
3738
lw = PathCollectionWrapper(cont, offset_transform=ax.transData)
3839
ax.add_artist(lw)
39-
#ax.set_xticks([])
40-
#ax.set_yticks([])
41-
#ax.set_aspect(1)
40+
# ax.set_xticks([])
41+
# ax.set_yticks([])
42+
# ax.set_aspect(1)
4243
plt.show()

0 commit comments

Comments
 (0)