function_base.pyi 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. from typing import (
  2. Literal as L,
  3. overload,
  4. Any,
  5. SupportsIndex,
  6. TypeVar,
  7. )
  8. from numpy import floating, complexfloating, generic
  9. from numpy._typing import (
  10. NDArray,
  11. DTypeLike,
  12. _DTypeLike,
  13. _ArrayLikeFloat_co,
  14. _ArrayLikeComplex_co,
  15. )
  16. __all__ = ["logspace", "linspace", "geomspace"]
  17. _SCT = TypeVar("_SCT", bound=generic)
  18. @overload
  19. def linspace(
  20. start: _ArrayLikeFloat_co,
  21. stop: _ArrayLikeFloat_co,
  22. num: SupportsIndex = ...,
  23. endpoint: bool = ...,
  24. retstep: L[False] = ...,
  25. dtype: None = ...,
  26. axis: SupportsIndex = ...,
  27. *,
  28. device: L["cpu"] | None = ...,
  29. ) -> NDArray[floating]: ...
  30. @overload
  31. def linspace(
  32. start: _ArrayLikeComplex_co,
  33. stop: _ArrayLikeComplex_co,
  34. num: SupportsIndex = ...,
  35. endpoint: bool = ...,
  36. retstep: L[False] = ...,
  37. dtype: None = ...,
  38. axis: SupportsIndex = ...,
  39. *,
  40. device: L["cpu"] | None = ...,
  41. ) -> NDArray[complexfloating]: ...
  42. @overload
  43. def linspace(
  44. start: _ArrayLikeComplex_co,
  45. stop: _ArrayLikeComplex_co,
  46. num: SupportsIndex,
  47. endpoint: bool,
  48. retstep: L[False],
  49. dtype: _DTypeLike[_SCT],
  50. axis: SupportsIndex = ...,
  51. *,
  52. device: L["cpu"] | None = ...,
  53. ) -> NDArray[_SCT]: ...
  54. @overload
  55. def linspace(
  56. start: _ArrayLikeComplex_co,
  57. stop: _ArrayLikeComplex_co,
  58. num: SupportsIndex = ...,
  59. endpoint: bool = ...,
  60. retstep: L[False] = ...,
  61. *,
  62. dtype: _DTypeLike[_SCT],
  63. axis: SupportsIndex = ...,
  64. device: L["cpu"] | None = ...,
  65. ) -> NDArray[_SCT]: ...
  66. @overload
  67. def linspace(
  68. start: _ArrayLikeComplex_co,
  69. stop: _ArrayLikeComplex_co,
  70. num: SupportsIndex = ...,
  71. endpoint: bool = ...,
  72. retstep: L[False] = ...,
  73. dtype: DTypeLike = ...,
  74. axis: SupportsIndex = ...,
  75. *,
  76. device: L["cpu"] | None = ...,
  77. ) -> NDArray[Any]: ...
  78. @overload
  79. def linspace(
  80. start: _ArrayLikeFloat_co,
  81. stop: _ArrayLikeFloat_co,
  82. num: SupportsIndex = ...,
  83. endpoint: bool = ...,
  84. *,
  85. retstep: L[True],
  86. dtype: None = ...,
  87. axis: SupportsIndex = ...,
  88. device: L["cpu"] | None = ...,
  89. ) -> tuple[NDArray[floating], floating]: ...
  90. @overload
  91. def linspace(
  92. start: _ArrayLikeComplex_co,
  93. stop: _ArrayLikeComplex_co,
  94. num: SupportsIndex = ...,
  95. endpoint: bool = ...,
  96. *,
  97. retstep: L[True],
  98. dtype: None = ...,
  99. axis: SupportsIndex = ...,
  100. device: L["cpu"] | None = ...,
  101. ) -> tuple[NDArray[complexfloating], complexfloating]: ...
  102. @overload
  103. def linspace(
  104. start: _ArrayLikeComplex_co,
  105. stop: _ArrayLikeComplex_co,
  106. num: SupportsIndex = ...,
  107. endpoint: bool = ...,
  108. *,
  109. retstep: L[True],
  110. dtype: _DTypeLike[_SCT],
  111. axis: SupportsIndex = ...,
  112. device: L["cpu"] | None = ...,
  113. ) -> tuple[NDArray[_SCT], _SCT]: ...
  114. @overload
  115. def linspace(
  116. start: _ArrayLikeComplex_co,
  117. stop: _ArrayLikeComplex_co,
  118. num: SupportsIndex = ...,
  119. endpoint: bool = ...,
  120. *,
  121. retstep: L[True],
  122. dtype: DTypeLike = ...,
  123. axis: SupportsIndex = ...,
  124. device: L["cpu"] | None = ...,
  125. ) -> tuple[NDArray[Any], Any]: ...
  126. @overload
  127. def logspace(
  128. start: _ArrayLikeFloat_co,
  129. stop: _ArrayLikeFloat_co,
  130. num: SupportsIndex = ...,
  131. endpoint: bool = ...,
  132. base: _ArrayLikeFloat_co = ...,
  133. dtype: None = ...,
  134. axis: SupportsIndex = ...,
  135. ) -> NDArray[floating]: ...
  136. @overload
  137. def logspace(
  138. start: _ArrayLikeComplex_co,
  139. stop: _ArrayLikeComplex_co,
  140. num: SupportsIndex = ...,
  141. endpoint: bool = ...,
  142. base: _ArrayLikeComplex_co = ...,
  143. dtype: None = ...,
  144. axis: SupportsIndex = ...,
  145. ) -> NDArray[complexfloating]: ...
  146. @overload
  147. def logspace(
  148. start: _ArrayLikeComplex_co,
  149. stop: _ArrayLikeComplex_co,
  150. num: SupportsIndex,
  151. endpoint: bool,
  152. base: _ArrayLikeComplex_co,
  153. dtype: _DTypeLike[_SCT],
  154. axis: SupportsIndex = ...,
  155. ) -> NDArray[_SCT]: ...
  156. @overload
  157. def logspace(
  158. start: _ArrayLikeComplex_co,
  159. stop: _ArrayLikeComplex_co,
  160. num: SupportsIndex = ...,
  161. endpoint: bool = ...,
  162. base: _ArrayLikeComplex_co = ...,
  163. *,
  164. dtype: _DTypeLike[_SCT],
  165. axis: SupportsIndex = ...,
  166. ) -> NDArray[_SCT]: ...
  167. @overload
  168. def logspace(
  169. start: _ArrayLikeComplex_co,
  170. stop: _ArrayLikeComplex_co,
  171. num: SupportsIndex = ...,
  172. endpoint: bool = ...,
  173. base: _ArrayLikeComplex_co = ...,
  174. dtype: DTypeLike = ...,
  175. axis: SupportsIndex = ...,
  176. ) -> NDArray[Any]: ...
  177. @overload
  178. def geomspace(
  179. start: _ArrayLikeFloat_co,
  180. stop: _ArrayLikeFloat_co,
  181. num: SupportsIndex = ...,
  182. endpoint: bool = ...,
  183. dtype: None = ...,
  184. axis: SupportsIndex = ...,
  185. ) -> NDArray[floating]: ...
  186. @overload
  187. def geomspace(
  188. start: _ArrayLikeComplex_co,
  189. stop: _ArrayLikeComplex_co,
  190. num: SupportsIndex = ...,
  191. endpoint: bool = ...,
  192. dtype: None = ...,
  193. axis: SupportsIndex = ...,
  194. ) -> NDArray[complexfloating]: ...
  195. @overload
  196. def geomspace(
  197. start: _ArrayLikeComplex_co,
  198. stop: _ArrayLikeComplex_co,
  199. num: SupportsIndex,
  200. endpoint: bool,
  201. dtype: _DTypeLike[_SCT],
  202. axis: SupportsIndex = ...,
  203. ) -> NDArray[_SCT]: ...
  204. @overload
  205. def geomspace(
  206. start: _ArrayLikeComplex_co,
  207. stop: _ArrayLikeComplex_co,
  208. num: SupportsIndex = ...,
  209. endpoint: bool = ...,
  210. *,
  211. dtype: _DTypeLike[_SCT],
  212. axis: SupportsIndex = ...,
  213. ) -> NDArray[_SCT]: ...
  214. @overload
  215. def geomspace(
  216. start: _ArrayLikeComplex_co,
  217. stop: _ArrayLikeComplex_co,
  218. num: SupportsIndex = ...,
  219. endpoint: bool = ...,
  220. dtype: DTypeLike = ...,
  221. axis: SupportsIndex = ...,
  222. ) -> NDArray[Any]: ...
  223. def add_newdoc(
  224. place: str,
  225. obj: str,
  226. doc: str | tuple[str, str] | list[tuple[str, str]],
  227. warn_on_python: bool = ...,
  228. ) -> None: ...