@@ -52,7 +52,7 @@ def __repr__(self) -> str:
5252 elements = dict (zip (self ._indices , self ._values ))
5353 return f'SparseVector({ elements } , { self ._dim } )'
5454
55- def __eq__ (self , other : object ) -> bool :
55+ def __eq__ (self , other : object , / ) -> bool :
5656 if isinstance (other , self .__class__ ):
5757 return self ._dim == other ._dim and self ._indices == other ._indices and self ._values == other ._values
5858 return False
@@ -102,7 +102,7 @@ def _from_dict(self, d: dict[int, float], dim: int) -> None:
102102 self ._indices = [int (v [0 ]) for v in elements ]
103103 self ._values = [float (v [1 ]) for v in elements ]
104104
105- def _from_sparse (self , arr : sparray | spmatrix ) -> None :
105+ def _from_sparse (self , arr : sparray | spmatrix , / ) -> None :
106106 value : coo_array | coo_matrix = arr .tocoo (copy = False ) # type: ignore
107107
108108 shape = cast (tuple [int ], value .shape )
@@ -120,13 +120,13 @@ def _from_sparse(self, arr: sparray | spmatrix) -> None:
120120 self ._indices = value .col .tolist ()
121121 self ._values = value .data .tolist ()
122122
123- def _from_dense (self , value : list [float ] | ndarray ) -> None :
123+ def _from_dense (self , value : list [float ] | ndarray , / ) -> None :
124124 self ._dim = len (value )
125125 self ._indices = [i for i , v in enumerate (value ) if v != 0 ]
126126 self ._values = [float (value [i ]) for i in self ._indices ]
127127
128128 @classmethod
129- def from_text (cls , value : str ) -> SparseVector :
129+ def from_text (cls , value : str , / ) -> SparseVector :
130130 elements , dim = value .split ('/' , 2 )
131131 indices : list [int ] = []
132132 values : list [float ] = []
@@ -139,7 +139,7 @@ def from_text(cls, value: str) -> SparseVector:
139139 return cls ._from_parts (int (dim ), indices , values )
140140
141141 @classmethod
142- def from_binary (cls , value : bytes | bytearray | memoryview ) -> SparseVector :
142+ def from_binary (cls , value : bytes | bytearray | memoryview , / ) -> SparseVector :
143143 dim , nnz , unused = unpack_from ('>iii' , value )
144144
145145 if len (value ) != 12 + 8 * nnz :
@@ -153,15 +153,15 @@ def from_binary(cls, value: bytes | bytearray | memoryview) -> SparseVector:
153153 return cls ._from_parts (dim , indices , values )
154154
155155 @classmethod
156- def _from_parts (cls , dim : int , indices : list [int ], values : list [float ]) -> SparseVector :
156+ def _from_parts (cls , dim : int , indices : list [int ], values : list [float ], / ) -> SparseVector :
157157 vec = cls .__new__ (cls )
158158 vec ._dim = dim
159159 vec ._indices = indices
160160 vec ._values = values
161161 return vec
162162
163163 @classmethod
164- def _to_db (cls , value : list [float ] | ndarray | sparray | spmatrix | SparseVector | None ) -> str | None :
164+ def _to_db (cls , value : list [float ] | ndarray | sparray | spmatrix | SparseVector | None , / ) -> str | None :
165165 if value is None :
166166 return value
167167
@@ -171,7 +171,7 @@ def _to_db(cls, value: list[float] | ndarray | sparray | spmatrix | SparseVector
171171 return value .to_text ()
172172
173173 @classmethod
174- def _from_db (cls , value : str | SparseVector | None ) -> SparseVector | None :
174+ def _from_db (cls , value : str | SparseVector | None , / ) -> SparseVector | None :
175175 if value is None or isinstance (value , SparseVector ):
176176 return value
177177
0 commit comments