File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
Original file line number Diff line number Diff line change @@ -63,11 +63,8 @@ def update_data(self, data: Any):
63
63
pass
64
64
65
65
def __repr__ (self ):
66
- title = "Fastplotlib " + self .__class__ .__name__ + "\n "
67
66
if self .name is not None :
68
- graph_name = "Name: " + self .name + " \n "
67
+ return f"' { self .name } ' fastplotlib. { self . __class__ . __name__ } @ { hex ( id ( self )) } "
69
68
else :
70
- graph_name = "Name: None\n "
71
- location = "Location: " + hex (id (self )) + "\n "
72
- return title + graph_name + location
69
+ return f"fastplotlib.{ self .__class__ .__name__ } @ { hex (id (self ))} "
73
70
Original file line number Diff line number Diff line change 5
5
from wgpu .gui .auto import WgpuCanvas
6
6
from warnings import warn
7
7
from math import copysign
8
+ from textwrap import indent
8
9
9
10
10
11
class Subplot :
@@ -172,13 +173,13 @@ def __getitem__(self, name: str):
172
173
raise IndexError (f"no graphic of given name, the current graphics are:\n { graphic_names } " )
173
174
174
175
def __repr__ (self ):
175
- title = "Fastplotlib " + self . __class__ . __name__ + " \n "
176
+ newline = "\n "
176
177
if self .name is not None :
177
- name = "Name: " + self .name + "\n "
178
+ return f"'{ self .name } ' fastplotlib.{ self .__class__ .__name__ } @ { hex (id (self ))} \n " \
179
+ f"Graphics: \n " \
180
+ f"{ newline .join (graphic .__repr__ () for graphic in self .get_graphics ())} "
178
181
else :
179
- name = "Name: None\n "
180
- graphics = "Graphics:\n ------------------------\n "
181
- for graphic in self .get_graphics ():
182
- graphics += graphic .__repr__ ()
183
- graphics += "------------------------\n "
184
- return title + name + graphics
182
+ return f"fastplotlib.{ self .__class__ .__name__ } @ { hex (id (self ))} \n " \
183
+ f"Graphics: \n " \
184
+ f"{ newline .join (graphic .__repr__ () for graphic in self .get_graphics ())} "
185
+
You can’t perform that action at this time.
0 commit comments