summaryrefslogtreecommitdiff
path: root/numpy/tests/typing
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Move typing testsCharles Harris2020-09-0737-1802/+0
| | | | Move them into a new `numpy/typing/tests directory`
* Merge branch 'master' into ndarray-methodsCharles Harris2020-09-077-6/+106
|\
| * Merge pull request #17144 from BvB93/function-base-coreCharles Harris2020-09-073-0/+41
| |\ | | | | | | ENH: Add annotations to 3 functions in `np.core.function_base`
| | * ENH: Change the `axis` type to `SupportsIndex`Bas van Beek2020-08-231-1/+5
| | |
| | * MAINT: The returned step size can be complexBas van Beek2020-08-232-1/+2
| | | | | | | | | | | | Co-Authored-By: Eric Wieser <eric-wieser@users.noreply.github.com>
| | * TST: Add tests for the `np.core.function_base` stubsBas van Beek2020-08-233-0/+36
| | |
| * | Merge pull request #17214 from BvB93/genericCharles Harris2020-09-072-6/+42
| |\ \ | | | | | | | | MAINT: Fix various issues with the `np.generic` annotations
| | * | TST: Don't run typing tests on lines that are commented outBas van Beek2020-09-011-2/+2
| | | | | | | | | | | | | | | | Addresses https://github.com/numpy/numpy/pull/17214#discussion_r481239468
| | * | MAINT: Only allow `SupportsIndex` for python >= 3.8Bas van Beek2020-09-011-3/+7
| | | | | | | | | | | | | | | | See https://bugs.python.org/issue20092
| | * | ENH: Add an alias for `Union[str, bytes]`; updated two `np.generic` constructorsBas van Beek2020-09-011-0/+2
| | | |
| | * | TST: Add tests for the new `generic` constructorsBas van Beek2020-09-011-3/+28
| | | |
| | * | MAINT: Make `datetime64` a `generic` subclass (again)Bas van Beek2020-09-011-3/+8
| | | |
| * | | Merge pull request #17104 from BvB93/sub-modulesCharles Harris2020-09-072-0/+23
| |\ \ \ | | | | | | | | | | ENH: Add placeholder stubs for all sub-modules
| | * | | TST: Remove `compat` and `core` from the testsBas van Beek2020-08-201-2/+0
| | | | |
| | * | | ENH: Replace module-level `__getattr__` with explicitly defined objectsBas van Beek2020-08-192-2/+5
| | | | |
| | * | | REV: Removed one last builtin moduleBas van Beek2020-08-191-1/+0
| | | | |
| | * | | REV: Removed two more (accidently included) builtin modulesBas van Beek2020-08-191-2/+0
| | | | |
| | * | | REV: Removed the (accidently included) builtin `sys` moduleBas van Beek2020-08-191-1/+0
| | | | |
| | * | | ENH: Add placeholder stubs for all sub-modulesBas van Beek2020-08-191-0/+26
| | | |/ | | |/|
* | | | TST: Fixed a testBas van Beek2020-09-071-1/+1
|/ / /
* | | BUG: Avoid using ``np.random`` in typing tests.Charles Harris2020-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Using `np.random` can cause mysterious test failures in mypy `api.run` with a report that 'error: Module has no attribute "rand"'. The fix here is to use `np.empty` instead of `np.random.rand`. Why this works is unknown at present.
* | | ENH: Added missing methods to `np.flatiter` (#17180)Bas van Beek2020-09-023-0/+53
| |/ |/| | | | | | | | | | | | | * MAINT: Added missing methods to `np.flatiter` * DOC: Added a comment about weird `flatiter.__getitem__` behavior Contrary to `ndarray.__getitem__` its counterpart in `flatiter` does not accept objects with the `__array__` or `__index__` protocols; boolean indexing is just plain broken (gh-17175)
* | ENH: typing: Make `np.complexfloating` generic w.r.t. `np.floating` (#17172)Bas van Beek2020-09-011-0/+3
| |
* | TST: Add more `Literal`-related testsBas van Beek2020-08-291-0/+43
| |
* | ENH: Add annotations to the last 8 functions in numpy.core.fromnumeric (#16729)Bas van Beek2020-08-243-0/+176
|/ | | | | | | | | | | | | | | * Added annotations for 8 new functions The 8 respective functions, all located in `np.core.fromnumeric`, consist of: * `prod` * `cumprod` * `ndim` * `size` * `around` * `mean` * `std` * `var` Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* MAINT: Implemented two dtype-related TODO's (#16622)Bas van Beek2020-07-303-2/+47
| | | | | This pull requests addresses and implement two previous TODO's in `np.typing._DTypeLike`: * Added a protocol, `_SupportsDtype`, for objects with the `dtype` attribute. * Replaced an old dictionary, representing array field parameter, with a `TypedDict`.
* MAINT: Added the `order` parameter to `np.array()` (#16966)Bas van Beek2020-07-292-0/+10
| | | | | | | * MAINT: Added the `order` argument to `np.array()` * MAINT: Made a number of `np.array()` arguments keyword-only * TST: Added a `np.array` test with >2 positional arguments
* Allow `None` to be passed to certain `generic` subclassesBas van Beek2020-06-251-0/+6
| | | | | | | Affected generic subclasses: * `floating` * `complexfloating` * `datetime64`
* ENH: Added annotations to 8 functions from np.core.fromnumeric (#16647)Bas van Beek2020-06-223-0/+174
| | | | | | | | | | | | Newly annotated functions: * `clip` * `sum` * `all` * `any` * `cumsum` * `ptp` * `amax` * `amin`
* ENH: add annotation for abs (#16618)Yuya Unno2020-06-212-0/+4
| | | `numpy.abs` is alias of `numpy.absolute`. I added its type annotation.
* TST: add a static typing test for memoryviews as ArrayLikesLevi Stovall2020-06-201-1/+2
| | | | See #16612
* Merge pull request #16558 from person142/typing-runtimeMatti Picus2020-06-172-15/+3
|\ | | | | ENH: make typing module available at runtime
| * MAINT: make typing module available at runtimeJosh Wilson2020-06-092-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/numpy/numpy/issues/16550. This makes `np.typing.ArrayLike` and `np.typing.DtypeLike` available at runtime in addition to typing time. Some things to consider: - `ArrayLike` uses protocols, which are only in the standard library in 3.8+, but are backported in `typing_extensions`. This conditionally imports `Protocol` and sets `_SupportsArray` to `Any` at runtime if the module is not available to prevent NumPy from having a hard dependency on `typing_extensions`. Since e.g. mypy already includes `typing_extensions` as a dependency, anybody actually doing type checking will have it set correctly. - We are starting to hit the edges of "the fiction of the stubs". In particular, they could just cram everything into `__init__.pyi` and ignore the real structure of NumPy. But now that typing is available a runtime, we have to e.g. carefully import `ndarray` from `numpy` in the typing module and not from `..core.multiarray`, because otherwise mypy will think you are talking about a different ndarray. We will probably need to do some shuffling the stubs into more fitting locations to mitigate weirdness like this.
* | MAINT: changed np.generic arguments to positional-only (#16583)Bas van Beek2020-06-142-0/+18
| | | | | | | | | | | | | | | | | | Closes https://github.com/numpy/numpy/issues/16577. Make the arguments of `np.generic` constructors positional-only. Also fix the constructor of`np.bytes_`: encoding is only supported when supplied a string. The opposite holds for `np.str_`.
* | MAINT: fix name of first parameter to dtype constructor in type stubsJosh Wilson2020-06-101-0/+3
| | | | | | | | | | The first parameter to the constructor is currently called "obj", which is incorrect. It should instead be "dtype".
* | MAINT: simplifying annotations for np.core.from_numeric (#16556)Bas van Beek2020-06-101-10/+0
|/ | | | | | Simplified annotations for functions requiring >=1D ArrayLike objects. Affects a set of <20 functions from ``np.core.fromnumeric``. Based on feedback from https://github.com/numpy/numpy-stubs/pull/71.
* MAINT: avoid more division by zero in typing test causing aarch64 to failJosh Wilson2020-06-071-5/+6
|
* MAINT: avoid divide by zero in typing test causing aarch64 tests to failJosh Wilson2020-06-071-1/+1
|
* MAINT: move typing tests cases into a subdirectory of numpy/testsJosh Wilson2020-06-0726-0/+1187