File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +15
-14
lines changed
Original file line number Diff line number Diff line change @@ -63,13 +63,12 @@ def update_data(self, data: Any):
63
63
pass
64
64
65
65
def __repr__ (self ):
66
- print ("Fastplotlib " + self .__class__ .__name__ + "\n " )
67
- if self .name is not None :
68
- print ("Graphic Name: " + self .name + "\n " )
69
- print ("Graphic Location: " + hex (id (self )) + "\n " )
66
+ title = "Fastplotlib " + self .__class__ .__name__ + "\n "
67
+ if self .name is None :
68
+ graph_name = "Name: " + self .name + "\n "
70
69
else :
71
- print ( "Graphic Location: " + hex ( id ( self )) + " \n ")
72
- print ( "Data: \n ")
73
- print (self .data )
74
- return ""
70
+ graph_name = "Name: None \n "
71
+ location = "Location: " + hex ( id ( self )) + " \n "
72
+ data = str (self .data )
73
+ return title + graph_name + location + data
75
74
Original file line number Diff line number Diff line change @@ -172,11 +172,13 @@ def __getitem__(self, name: str):
172
172
raise IndexError (f"no graphic of given name, the current graphics are:\n { graphic_names } " )
173
173
174
174
def __repr__ (self ):
175
- print ( "Fastplotlib Subplot \n " )
175
+ title = "Fastplotlib " + self . __class__ . __name__ + " \n "
176
176
if self .name is not None :
177
- print ("Subplot Name: " + self .name + "\n " )
178
- print ("Graphics:\n ------------------------------------------------------------------------" )
177
+ name = "Name: " + self .name + "\n "
178
+ else :
179
+ name = "Name: None\n "
180
+ graphics = "Graphics:\n ------------------------------------------------------------------------\n "
179
181
for graphic in self .get_graphics ():
180
- print ( graphic )
181
- print ( " ------------------------------------------------------------------------" )
182
- return ""
182
+ graphics += graphic . __repr__ ( )
183
+ graphics += " \n ------------------------------------------------------------------------\n "
184
+ return title + name + graphics
You can’t perform that action at this time.
0 commit comments