11from collections .abc import Callable
22from contextlib import _GeneratorContextManager
3- from typing import Final , Literal , SupportsIndex , TypeAlias , TypedDict , overload , type_check_only
4- from typing_extensions import deprecated
3+ from typing import Final , Literal , SupportsIndex , TypeAlias , TypedDict , type_check_only
54
65import _numtype as _nt
76import numpy as np
8- from numpy ._globals import _NoValueType
97from numpy ._typing import _CharLike_co , _FloatLike_co
108
119__all__ = [
@@ -25,7 +23,6 @@ _FloatMode: TypeAlias = Literal["fixed", "unique", "maxprec", "maxprec_equal"]
2523_Sign : TypeAlias = Literal ["-" , "+" , " " ]
2624_Trim : TypeAlias = Literal ["k" , "." , "0" , "-" ]
2725_Legacy : TypeAlias = Literal ["1.13" , "1.21" , "1.25" , "2.1" , False ]
28- _LegacyNoStyle : TypeAlias = Literal ["1.21" , "1.25" , "2.1" , False ]
2926_ReprFunc : TypeAlias = Callable [[_nt .Array ], str ]
3027
3128@type_check_only
@@ -103,43 +100,6 @@ def printoptions(
103100) -> _GeneratorContextManager [_FormatOptions ]: ...
104101
105102# public numpy export
106- @overload # no style
107- def array2string (
108- a : _nt .Array ,
109- max_line_width : int | None = None ,
110- precision : SupportsIndex | None = None ,
111- suppress_small : bool | None = None ,
112- separator : str = " " ,
113- prefix : str = "" ,
114- style : _NoValueType = ...,
115- formatter : _FormatDict | None = None ,
116- threshold : int | None = None ,
117- edgeitems : int | None = None ,
118- sign : _Sign | None = None ,
119- floatmode : _FloatMode | None = None ,
120- suffix : str = "" ,
121- * ,
122- legacy : _Legacy | None = None ,
123- ) -> str : ...
124- @overload # style=<given> (positional), legacy="1.13"
125- def array2string (
126- a : _nt .Array ,
127- max_line_width : int | None ,
128- precision : SupportsIndex | None ,
129- suppress_small : bool | None ,
130- separator : str ,
131- prefix : str ,
132- style : _ReprFunc ,
133- formatter : _FormatDict | None = None ,
134- threshold : int | None = None ,
135- edgeitems : int | None = None ,
136- sign : _Sign | None = None ,
137- floatmode : _FloatMode | None = None ,
138- suffix : str = "" ,
139- * ,
140- legacy : Literal ["1.13" ],
141- ) -> str : ...
142- @overload # style=<given> (keyword), legacy="1.13"
143103def array2string (
144104 a : _nt .Array ,
145105 max_line_width : int | None = None ,
@@ -148,52 +108,13 @@ def array2string(
148108 separator : str = " " ,
149109 prefix : str = "" ,
150110 * ,
151- style : _ReprFunc ,
152111 formatter : _FormatDict | None = None ,
153112 threshold : int | None = None ,
154113 edgeitems : int | None = None ,
155114 sign : _Sign | None = None ,
156115 floatmode : _FloatMode | None = None ,
157116 suffix : str = "" ,
158- legacy : Literal ["1.13" ],
159- ) -> str : ...
160- @overload # style=<given> (positional), legacy!="1.13"
161- @deprecated ("'style' argument is deprecated and no longer functional except in 1.13 'legacy' mode" )
162- def array2string (
163- a : _nt .Array ,
164- max_line_width : int | None ,
165- precision : SupportsIndex | None ,
166- suppress_small : bool | None ,
167- separator : str ,
168- prefix : str ,
169- style : _ReprFunc ,
170- formatter : _FormatDict | None = None ,
171- threshold : int | None = None ,
172- edgeitems : int | None = None ,
173- sign : _Sign | None = None ,
174- floatmode : _FloatMode | None = None ,
175- suffix : str = "" ,
176- * ,
177- legacy : _LegacyNoStyle | None = None ,
178- ) -> str : ...
179- @overload # style=<given> (keyword), legacy="1.13"
180- @deprecated ("'style' argument is deprecated and no longer functional except in 1.13 'legacy' mode" )
181- def array2string (
182- a : _nt .Array ,
183- max_line_width : int | None = None ,
184- precision : SupportsIndex | None = None ,
185- suppress_small : bool | None = None ,
186- separator : str = " " ,
187- prefix : str = "" ,
188- * ,
189- style : _ReprFunc ,
190- formatter : _FormatDict | None = None ,
191- threshold : int | None = None ,
192- edgeitems : int | None = None ,
193- sign : _Sign | None = None ,
194- floatmode : _FloatMode | None = None ,
195- suffix : str = "" ,
196- legacy : _LegacyNoStyle | None = None ,
117+ legacy : _Legacy | None = None ,
197118) -> str : ...
198119
199120# public numpy export
0 commit comments