@@ -177,32 +177,6 @@ def normalized(
177177 return data # ty: ignore[invalid-return-type]
178178 return data .astype (float , copy = False ) # ty: ignore[possibly-missing-attribute]
179179
180- # Other possible numeric standalone data (n integers or floats)
181- case [Real (), * rest ], () if not isinstance (data , tuple ) and all (
182- isinstance (r , Real ) for r in rest
183- ):
184- return normalized (np .asarray (data ), keywords = keywords , format_ = format_ )
185-
186- # Other possible numeric standalone data (n x 3 floats)
187- case [_, * _], () if not isinstance (data , tuple ) and all (
188- (
189- isinstance (r , Sequence )
190- and not isinstance (r , tuple )
191- and len (r ) == 3
192- and all (isinstance (x , Real ) for x in r )
193- )
194- or (
195- isinstance (r , np .ndarray )
196- and r .shape == (3 ,)
197- and (
198- np .issubdtype (r .dtype , np .floating )
199- or np .issubdtype (r .dtype , np .integer )
200- )
201- )
202- for r in data # ty: ignore[not-iterable]
203- ):
204- return normalized (np .asarray (data ), keywords = keywords , format_ = format_ )
205-
206180 # ASCII faces-like list
207181 case [* _], () if not isinstance (data , tuple ) and all (
208182 isinstance (e , np .ndarray )
@@ -232,6 +206,32 @@ def normalized(
232206 ):
233207 return [np .asarray (e ) for e in data ] # ty: ignore[not-iterable]
234208
209+ # Other possible numeric standalone data (n integers or floats)
210+ case [Real (), * rest ], () if not isinstance (data , tuple ) and all (
211+ isinstance (r , Real ) for r in rest
212+ ):
213+ return normalized (np .asarray (data ), keywords = keywords , format_ = format_ )
214+
215+ # Other possible numeric standalone data (n x 3 floats)
216+ case [_, * _], () if not isinstance (data , tuple ) and all (
217+ (
218+ isinstance (r , Sequence )
219+ and not isinstance (r , tuple )
220+ and len (r ) == 3
221+ and all (isinstance (x , Real ) for x in r )
222+ )
223+ or (
224+ isinstance (r , np .ndarray )
225+ and r .shape == (3 ,)
226+ and (
227+ np .issubdtype (r .dtype , np .floating )
228+ or np .issubdtype (r .dtype , np .integer )
229+ )
230+ )
231+ for r in data # ty: ignore[not-iterable]
232+ ):
233+ return normalized (np .asarray (data ), keywords = keywords , format_ = format_ )
234+
235235 # Uniform field (scalar)
236236 case Real (), _common .FIELD_KEYWORDS :
237237 return float (data ) # ty: ignore[invalid-argument-type]
@@ -487,14 +487,14 @@ def dumps(
487487 + b")"
488488 )
489489
490- case np .ndarray (), (_, * _) | None , _ :
490+ case np .ndarray (), (_, * _) | None , "ascii" | None :
491491 return dumps (len (data ), keywords = None , format_ = None ) + dumps ( # ty: ignore[invalid-argument-type]
492492 data .tolist (), # ty: ignore[possibly-missing-attribute]
493493 keywords = None ,
494494 format_ = format_ ,
495495 )
496496
497- case np .ndarray (), (), _ :
497+ case np .ndarray (), (), "ascii" | None :
498498 return dumps (data .tolist (), keywords = None , format_ = format_ ) # ty: ignore[invalid-argument-type,possibly-missing-attribute]
499499
500500 case DimensionSet (), _, _:
@@ -552,7 +552,7 @@ def dumps(
552552 + b" " .join (
553553 dumps (
554554 v , # ty: ignore[invalid-argument-type]
555- keywords = keywords ,
555+ keywords = None ,
556556 format_ = format_ ,
557557 _tuple_is_keyword_entry = True ,
558558 )
0 commit comments