@@ -59,7 +59,7 @@ class AnnotatedShape(AbstractShape):
5959 """
6060
6161 __implements__ = (IBasePlotItem , ISerializableType )
62- SHAPE_CLASS : AbstractShape = RectangleShape # to be overridden
62+ SHAPE_CLASS : type [ AbstractShape ] = RectangleShape # to be overridden
6363 LABEL_ANCHOR : str = ""
6464
6565 def __init__ (self , annotationparam : AnnotationParam | None = None ) -> None :
@@ -278,7 +278,7 @@ def get_tr_center(self):
278278 def get_tr_center_str (self ):
279279 """Return center coordinates as a string (with units)"""
280280 xc , yc = self .get_tr_center ()
281- return "( {} ; {} )" . format ( self .x_to_str (xc ), self .y_to_str (yc ))
281+ return f "( { self .x_to_str (xc )} ; { self .y_to_str (yc )} )"
282282
283283 def get_tr_size (self ):
284284 """Return shape size after applying transform matrix"""
@@ -287,7 +287,7 @@ def get_tr_size(self):
287287 def get_tr_size_str (self ):
288288 """Return size as a string (with units)"""
289289 xs , ys = self .get_tr_size ()
290- return "{} x {}" . format ( self .x_to_str (xs ), self .y_to_str (ys ))
290+ return f" { self .x_to_str (xs )} x { self .y_to_str (ys )} "
291291
292292 def get_infos (self ) -> str :
293293 """Get informations on current shape
@@ -601,7 +601,7 @@ def set_rect(self, x1, y1, x2, y2):
601601 self .shape .set_rect (x1 , y1 , x2 , y2 )
602602 self .set_label_position ()
603603
604- def get_rect (self ):
604+ def get_rect (self ) -> tuple [ float , float , float , float ] :
605605 """
606606 Return the coordinates of the shape's top-left and bottom-right corners
607607 """
@@ -659,7 +659,7 @@ def get_tr_angle(self):
659659 xcoords = self .get_transformed_coords (0 , 1 )
660660 _x , yr1 = self .apply_transform_matrix (1.0 , 1.0 )
661661 _x , yr2 = self .apply_transform_matrix (1.0 , 2.0 )
662- return (compute_angle (reverse = yr1 > yr2 , * xcoords ) + 90 ) % 180 - 90
662+ return (compute_angle (* xcoords , reverse = yr1 > yr2 ) + 90 ) % 180 - 90
663663
664664 def get_bounding_rect_coords (self ) -> tuple [float , float , float , float ]:
665665 """Return bounding rectangle coordinates (in plot coordinates)
@@ -802,7 +802,7 @@ def get_tr_angle(self):
802802 xcoords = self .get_transformed_coords (0 , 1 )
803803 _x , yr1 = self .apply_transform_matrix (1.0 , 1.0 )
804804 _x , yr2 = self .apply_transform_matrix (1.0 , 2.0 )
805- return (compute_angle (reverse = yr1 > yr2 , * xcoords ) + 90 ) % 180 - 90
805+ return (compute_angle (* xcoords , reverse = yr1 > yr2 ) + 90 ) % 180 - 90
806806
807807 # ----AnnotatedShape API-----------------------------------------------------
808808 def set_label_position (self ):
@@ -834,7 +834,7 @@ def get_infos(self) -> str:
834834 [
835835 _ ("Center:" ) + " " + self .get_tr_center_str (),
836836 _ ("Size:" ) + " " + self .get_tr_size_str (),
837- _ ("Angle:" ) + " {:.1f}°" . format ( self . get_tr_angle ()) ,
837+ _ ("Angle:" ) + f " { self . get_tr_angle () :.1f} °" ,
838838 ]
839839 )
840840
0 commit comments