@@ -69,7 +69,7 @@ def parsestr(value: str) -> str:
6969 """
7070 if value [0 ] == value [- 1 ] == "\" " :
7171 return value [1 :- 1 ]
72-
72+
7373 return value
7474
7575
@@ -95,7 +95,7 @@ def toenum(e: type[_E], value: _E | str) -> _E:
9595 Examples
9696 --------
9797 >>> from enum import Enum
98- >>>
98+ >>>
9999 >>> class MyEnum(Enum):
100100 ... ONE = 1
101101 ... TWO = 2
@@ -107,13 +107,13 @@ def toenum(e: type[_E], value: _E | str) -> _E:
107107 """
108108 if isinstance (value , str ):
109109 return e [value ]
110-
110+
111111 if value not in e :
112112 raise ValueError (
113113 f"given member ({ value } ) is not a member "
114114 f"of the target enum: { e } "
115115 )
116-
116+
117117 return value
118118
119119
@@ -126,18 +126,18 @@ def enumparser(e: type[_E]) -> Callable[[str], _E]:
126126 ----------
127127 e: Enum
128128 Target enum type.
129-
129+
130130 Returns
131131 -------
132132 Callable
133133 Parser function, that takes a string as input, and returns an
134134 enum member.
135-
135+
136136 Examples
137137 --------
138138
139139 >>> from enum import Enum
140- >>>
140+ >>>
141141 >>> class MyEnum(Enum):
142142 ... ONE = 1
143143 ... TWO = 2
@@ -149,7 +149,7 @@ def enumparser(e: type[_E]) -> Callable[[str], _E]:
149149 """
150150 def parseenum (value : str ) -> _E :
151151 return e (int (value ))
152-
152+
153153 return parseenum
154154
155155
@@ -426,11 +426,11 @@ def __str__(self) -> str:
426426
427427 def __repr__ (self ) -> str :
428428 return f"{ type (self ).__name__ :s} ({ self .asunit (AngleUnit .DMS ):s} )"
429-
429+
430430 def __eq__ (self , other : object ) -> bool :
431431 if type (other ) is not Angle :
432432 return False
433-
433+
434434 return math .isclose (self ._value , other ._value )
435435
436436 def __pos__ (self ) -> Angle :
@@ -621,7 +621,7 @@ def parse(cls, string: str) -> Byte:
621621class Vector :
622622 """
623623 Utility type to represent a position with 3D cartesian coordinates.
624-
624+
625625 Supported arithmetic operations:
626626 - \\ + `Vector`
627627 - \\ - `Vector`
@@ -679,7 +679,7 @@ def __getitem__(self, idx: int) -> float:
679679
680680 coords = (self .x , self .y , self .z )
681681 return coords [idx ]
682-
682+
683683 def __eq__ (self , other ) -> bool :
684684 if type (other ) is not type (self ):
685685 return False
@@ -689,77 +689,77 @@ def __eq__(self, other) -> bool:
689689 and math .isclose (self .y , other .y )
690690 and math .isclose (self .z , other .z )
691691 )
692-
692+
693693 def __pos__ (self ) -> Self :
694694 return type (self )(
695695 self .x ,
696696 self .y ,
697697 self .z
698698 )
699-
699+
700700 def __neg__ (self ) -> Self :
701701 return type (self )(
702702 - self .x ,
703703 - self .y ,
704704 - self .z
705705 )
706-
706+
707707 def __add__ (self , other : Self ) -> Self :
708708 if type (other ) is not type (self ):
709709 raise TypeError (
710710 f"unsupported operand type(s) for +: "
711711 f"'{ type (self ).__name__ } ' and "
712712 f"'{ type (other ).__name__ } '"
713713 )
714-
714+
715715 return type (self )(
716716 self .x + other .x ,
717717 self .y + other .y ,
718718 self .z + other .z
719719 )
720-
720+
721721 def __sub__ (self , other : Self ) -> Self :
722722 if type (other ) is not type (self ):
723723 raise TypeError (
724724 f"unsupported operand type(s) for -: "
725725 f"'{ type (self ).__name__ } ' and "
726726 f"'{ type (other ).__name__ } '"
727727 )
728-
728+
729729 return type (self )(
730730 self .x - other .x ,
731731 self .y - other .y ,
732732 self .z - other .z
733733 )
734-
734+
735735 def __mul__ (self , other : int | float ) -> Self :
736736 if type (other ) not in (int , float ):
737737 raise TypeError (
738738 f"unsupported operand type(s) for *: "
739739 f"'{ type (self ).__name__ } ' and "
740740 f"'{ type (other ).__name__ } '"
741741 )
742-
742+
743743 return type (self )(
744744 self .x * other ,
745745 self .y * other ,
746746 self .z * other
747747 )
748-
748+
749749 def __truediv__ (self , other : int | float ) -> Self :
750750 if type (other ) not in (int , float ):
751751 raise TypeError (
752752 f"unsupported operand type(s) for /: "
753753 f"'{ type (self ).__name__ } ' and "
754754 f"'{ type (other ).__name__ } '"
755755 )
756-
756+
757757 return type (self )(
758758 self .x / other ,
759759 self .y / other ,
760760 self .z / other
761761 )
762-
762+
763763 def length (self ) -> float :
764764 """
765765 Calculates the length of the vector.
@@ -778,7 +778,7 @@ def length(self) -> float:
778778 )
779779 )
780780 )
781-
781+
782782 def normalized (self ) -> Self :
783783 """
784784 Returns a copy of the vector, normalized to unit length.
@@ -788,17 +788,17 @@ def normalized(self) -> Self:
788788 Self
789789 Normalized vector.
790790 """
791- l = self .length ()
792- if l == 0 :
791+ length = self .length ()
792+ if length == 0 :
793793 return + self
794-
795- return self / l
794+
795+ return self / length
796796
797797
798798class Coordinate (Vector ):
799799 """
800800 Utility type to represent a position with 3D cartesian coordinates.
801-
801+
802802 Supported arithmetic operations:
803803 - \\ + `Coordinate`
804804 - \\ - `Coordinate`
0 commit comments