<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/numpy.git/numpy/core/_asarray.py, branch meson</title>
<subtitle>github.com: numpy/numpy.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/'/>
<entry>
<title>MAINT: simplify flow in np.require</title>
<updated>2022-06-22T11:54:24+00:00</updated>
<author>
<name>Karl Otness</name>
<email>karl@karlotness.com</email>
</author>
<published>2022-04-19T21:16:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=f9cc4bf70c5c6f26ad421962bf5c608558b1035c'/>
<id>f9cc4bf70c5c6f26ad421962bf5c608558b1035c</id>
<content type='text'>
Move the possible_flags dictionary to a global value so it is not
re-constructed each call.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move the possible_flags dictionary to a global value so it is not
re-constructed each call.
</pre>
</div>
</content>
</entry>
<entry>
<title>DOC: mention that np.require takes a sequence of requirements</title>
<updated>2022-06-19T20:57:51+00:00</updated>
<author>
<name>Karl Otness</name>
<email>karl@karlotness.com</email>
</author>
<published>2022-04-19T21:28:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=f6f1e1de5f012a76585f74d2407fa14476b4abd1'/>
<id>f6f1e1de5f012a76585f74d2407fa14476b4abd1</id>
<content type='text'>
Document that other Python sequences are acceptable as arguments, not
just lists.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Document that other Python sequences are acceptable as arguments, not
just lists.
</pre>
</div>
</content>
</entry>
<entry>
<title>DEP: remove NPY_ARRAY_UPDATEIFCOPY, deprecated in 1.14 (#20589)</title>
<updated>2021-12-18T17:05:35+00:00</updated>
<author>
<name>Matti Picus</name>
<email>matti.picus@gmail.com</email>
</author>
<published>2021-12-18T17:05:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=bb95cf015165bcf85f99ba0d28a7a6e727ca955b'/>
<id>bb95cf015165bcf85f99ba0d28a7a6e727ca955b</id>
<content type='text'>
* DEP: remove NPY_ARRAY_UPDATEIFCOPY, deprecated in 1.14

* remove more UPDATEIFCOPY

* typo: add missing comma

* remove a few more UPDATEIFCOPY

* Add release note

* remove UPDATEIFCOPY from comment (from review)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* DEP: remove NPY_ARRAY_UPDATEIFCOPY, deprecated in 1.14

* remove more UPDATEIFCOPY

* typo: add missing comma

* remove a few more UPDATEIFCOPY

* Add release note

* remove UPDATEIFCOPY from comment (from review)</pre>
</div>
</content>
</entry>
<entry>
<title>BUG: import `asanyarray` to `_asarray.py` as its used in `np.require`</title>
<updated>2021-03-18T21:18:52+00:00</updated>
<author>
<name>Sebastian Berg</name>
<email>sebastian@sipsolutions.net</email>
</author>
<published>2021-03-18T21:18:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=0ea47e1901d08cad5fba9cba6ddb40a9ed947bd8'/>
<id>0ea47e1901d08cad5fba9cba6ddb40a9ed947bd8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ENH: Use new argument parsing for array creation functions</title>
<updated>2021-03-18T20:37:20+00:00</updated>
<author>
<name>Sebastian Berg</name>
<email>sebastian@sipsolutions.net</email>
</author>
<published>2020-12-06T04:38:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=f531110689a646f574ad1529d78b6047cf397f3e'/>
<id>f531110689a646f574ad1529d78b6047cf397f3e</id>
<content type='text'>
The array creation functions have the most to gain:

1. np.asarray is 4 times faster and commonly used.
2. Other functions are wrapped using __array_function__ in Python
   making it more difficult

This commit (unfortunatly) has to do a few things:

* Modify __array_function__ C-side dispatching to accomodate
  the fastcall argument convention.
* Move asarray, etc. to C after removing all "fast paths" from
  np.array (simplifying the code)
* Fixup imports, since asarray was imported directly in a few places
* Replace some places where `np.array` was probably used for speed
  instead of np.asarray or similar. (or by accident in 1 or 2 places)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The array creation functions have the most to gain:

1. np.asarray is 4 times faster and commonly used.
2. Other functions are wrapped using __array_function__ in Python
   making it more difficult

This commit (unfortunatly) has to do a few things:

* Modify __array_function__ C-side dispatching to accomodate
  the fastcall argument convention.
* Move asarray, etc. to C after removing all "fast paths" from
  np.array (simplifying the code)
* Fixup imports, since asarray was imported directly in a few places
* Replace some places where `np.array` was probably used for speed
  instead of np.asarray or similar. (or by accident in 1 or 2 places)
</pre>
</div>
</content>
</entry>
<entry>
<title>ENH: implement NEP-35's `like=` argument (gh-16935)</title>
<updated>2020-08-28T18:05:18+00:00</updated>
<author>
<name>Peter Andreas Entschev</name>
<email>peter@entschev.com</email>
</author>
<published>2020-08-28T18:05:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=4cd6e4b336fbc68d88c0e9bc45a435ce7b721f1f'/>
<id>4cd6e4b336fbc68d88c0e9bc45a435ce7b721f1f</id>
<content type='text'>
This PR adds the implementation of NEP-35's like= argument, allowing dispatch of array creation functions with __array_function__ based on a reference array.

* ENH: Add like= kwarg via __array_function__ dispatcher to asarray

* ENH: Add new function for __array_function__ dispatching from C

This new function allows dispatching from C directly, while also
implementing the new `like=` argument, requiring only minimal
changes to existing array creation functions that need to add
support for that argument.

* ENH: Add like= support to numpy.array

The implementation uses array_implement_c_array_function, thus
introducing minimal complexity to the original _array_fromobject
code.

* BUG: Fix like= dispatcher for np.full

* ENH: Remove np.asarray like= dispatcher via Python

np.asarray can rely on np.array's C dispatcher instead.

* TST: Add some tests for like= argument

Tests comprise some of the functions that have been implemented already:
* np.array (C dispatcher)
* np.asarray (indirect C dispatcher via np.array)
* np.full (Python dispatcher)
* np.ones (Python dispatcher)

* ENH: Remove like= argument during array_implement_array_function

* ENH: Add like= kwarg to ones and full

* BUG: prevent duplicate removal of `like=` argument

* ENH: Make `like=` a keyword-only argument

* ENH: Use PyUnicode_InternFromString in arrayfunction_override

Replace PyUnicode_FromString by PyUnicode_InternFromString to cache
"like" string.

* ENH: Check for arrayfunction_override import errors

Check and handle errors on importing NumPy's Python functions

* BUG: Fix array_implement_c_array_function error handling

* ENH: Handle exceptions with C implementation of `like=`

* ENH: Add `like=` dispatch for all asarray functions

Using Python dispatcher for all of them. Using the C dispatcher
directly on the `np.array` call can result in incorrect behavior.
Incorrect behavior may happen if the downstream library's
implementation is different or if not all keyword arguments are
supported.

* ENH: Simplify handling of exceptions with `like=`

* TST: Add test for exception handling with `like=`

* ENH: Add support for `like=` to `np.empty` and `np.zeros`

* TST: Add `like=` tests for `np.empty` and `np.zeros`

* ENH: Add `like=` to remaining multiarraymodule.c functions

Functions are:
* np.arange
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring

* TST: Add tests for multiarraymodule.c functions with like=

Functions are:
* np.arange
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring

* ENH: Add `like=` support to more creation functions

Support for the following functions is added:
* np.eye
* np.fromfunction
* np.genfromtxt
* np.identity
* np.loadtxt
* np.tri

* TST: Add `like=` tests for multiple functions

Tests for the following functions are added:
* np.eye
* np.fromfunction
* np.genfromtxt
* np.identity
* np.loadtxt
* np.tri

* TST: Reduce code duplication in `like=` tests

* DOC: Document `like=` in functions that support it

Add documentations for the following functions:
* np.array
* np.arange
* np.asarray
* np.asanyarray
* np.ascontiguousarray
* np.asfortranarray
* np.require
* np.empty
* np.full
* np.ones
* np.zeros
* np.identity
* np.eye
* np.tri
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring
* np.loadtxt
* np.genfromtxt

* ENH: Add `like=` to numpy/__init__.pyi stubs

* BUG: Remove duplicate `like=` dispatching in as*array

Functions `np.asanyarray`, `np.contiguousarray` and `np.fortranarray`
were dispatching both via their definitions and `np.array` calls,
the latter should be avoided.

* BUG: Fix missing check in array_implement_array_function

* BUG: Add missing keyword-only markers in stubs

* BUG: Fix duplicate keyword-only marker in array stub

* BUG: Fix syntax error in numpy/__init__.pyi

* BUG: Fix more syntax errors in numpy/__init__.pyi

* ENH: Intern arrayfunction_override strings in multiarraymodule

* STY: Add missing brackets to arrayfunction_override.c

* MAINT: Remove arrayfunction_override dict check for kwarg

* TST: Assert that 'like' is not in TestArrayLike kwargs

* MAINT: Rename array_implement_c_array_function(_creation)

This is done to be more explicit as to its usage being intended for
array creation functions only.

* MAINT: Use NotImplemented to indicate fallback to default

* TST: Test that results with `like=np.array` are correct

* TST: Avoid duplicating MyArray code in TestArrayLike

* TST: Don't delete temp file, it may cause issues with Windows

* TST: Don't rely on eval in TestArrayLike

* TST: Use lambda with StringIO in TestArrayLike

* ENH: Avoid unnecessary Py_XDECREF in arrayfunction_override

* TST: Make TestArrayLike more readable

* ENH: Cleaner error handling in arrayfunction_override

* ENH: Simplify array_implement_c_array_function_creation

* STY: Add missing spaces to multiarraymodule.c

* STY: C99 declaration style in arrayfunction_override.c

* ENH: Simplify arrayfunction_override.c further

Remove cleanup label from array_implementation_c_array_function,
simplifying the code. Fix unitialized variable warning in
array_implementation_array_function_internal.

* DOC: Use string replacement for `like=` documentation

Avoid repeating the full text for the `like=` argument by storing it as
a variable and using `replace` on each docstring.

* DOC: Update `like=` docstring

* TST: Test like= with array not implementing __array_function__

* TST: Add missing asanyarray to TestArrayLike

* ENH: Use helper function for like= dispatching

Avoid dispatching like= from Python implementation functions to improve
their performance. This is achieved by only calling a dispatcher
function when like is passed by the users.

* ENH: Rename array_function_dispatch kwarg to public_api

* BUG: Add accidentally removed decorator for np.eye back

* DOC: Add set_array_function_like_doc function

The function keeps Python files cleaner and resolve errors when __doc__
is not defined due to PYTHONOPTIMIZE or -OO .

* DOC: Add mention to like= kwarg being experimental

* TST: Test like= with not implemented downstream function

* DOC: Fix like= docstring reference to NEP 35.

* ENH: Prevent silent errors if public_api is not callable

* ENH: Make set_array_function_like_doc a decorator

* ENH: Simplify `_*_with_like` functions

* BUG: Fix multiple `like=` dispatching in `require`

* MAINT: Remove now unused public_api from array_function_dispatch

Co-authored-by: Sebastian Berg &lt;sebastian@sipsolutions.net&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds the implementation of NEP-35's like= argument, allowing dispatch of array creation functions with __array_function__ based on a reference array.

* ENH: Add like= kwarg via __array_function__ dispatcher to asarray

* ENH: Add new function for __array_function__ dispatching from C

This new function allows dispatching from C directly, while also
implementing the new `like=` argument, requiring only minimal
changes to existing array creation functions that need to add
support for that argument.

* ENH: Add like= support to numpy.array

The implementation uses array_implement_c_array_function, thus
introducing minimal complexity to the original _array_fromobject
code.

* BUG: Fix like= dispatcher for np.full

* ENH: Remove np.asarray like= dispatcher via Python

np.asarray can rely on np.array's C dispatcher instead.

* TST: Add some tests for like= argument

Tests comprise some of the functions that have been implemented already:
* np.array (C dispatcher)
* np.asarray (indirect C dispatcher via np.array)
* np.full (Python dispatcher)
* np.ones (Python dispatcher)

* ENH: Remove like= argument during array_implement_array_function

* ENH: Add like= kwarg to ones and full

* BUG: prevent duplicate removal of `like=` argument

* ENH: Make `like=` a keyword-only argument

* ENH: Use PyUnicode_InternFromString in arrayfunction_override

Replace PyUnicode_FromString by PyUnicode_InternFromString to cache
"like" string.

* ENH: Check for arrayfunction_override import errors

Check and handle errors on importing NumPy's Python functions

* BUG: Fix array_implement_c_array_function error handling

* ENH: Handle exceptions with C implementation of `like=`

* ENH: Add `like=` dispatch for all asarray functions

Using Python dispatcher for all of them. Using the C dispatcher
directly on the `np.array` call can result in incorrect behavior.
Incorrect behavior may happen if the downstream library's
implementation is different or if not all keyword arguments are
supported.

* ENH: Simplify handling of exceptions with `like=`

* TST: Add test for exception handling with `like=`

* ENH: Add support for `like=` to `np.empty` and `np.zeros`

* TST: Add `like=` tests for `np.empty` and `np.zeros`

* ENH: Add `like=` to remaining multiarraymodule.c functions

Functions are:
* np.arange
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring

* TST: Add tests for multiarraymodule.c functions with like=

Functions are:
* np.arange
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring

* ENH: Add `like=` support to more creation functions

Support for the following functions is added:
* np.eye
* np.fromfunction
* np.genfromtxt
* np.identity
* np.loadtxt
* np.tri

* TST: Add `like=` tests for multiple functions

Tests for the following functions are added:
* np.eye
* np.fromfunction
* np.genfromtxt
* np.identity
* np.loadtxt
* np.tri

* TST: Reduce code duplication in `like=` tests

* DOC: Document `like=` in functions that support it

Add documentations for the following functions:
* np.array
* np.arange
* np.asarray
* np.asanyarray
* np.ascontiguousarray
* np.asfortranarray
* np.require
* np.empty
* np.full
* np.ones
* np.zeros
* np.identity
* np.eye
* np.tri
* np.frombuffer
* np.fromfile
* np.fromiter
* np.fromstring
* np.loadtxt
* np.genfromtxt

* ENH: Add `like=` to numpy/__init__.pyi stubs

* BUG: Remove duplicate `like=` dispatching in as*array

Functions `np.asanyarray`, `np.contiguousarray` and `np.fortranarray`
were dispatching both via their definitions and `np.array` calls,
the latter should be avoided.

* BUG: Fix missing check in array_implement_array_function

* BUG: Add missing keyword-only markers in stubs

* BUG: Fix duplicate keyword-only marker in array stub

* BUG: Fix syntax error in numpy/__init__.pyi

* BUG: Fix more syntax errors in numpy/__init__.pyi

* ENH: Intern arrayfunction_override strings in multiarraymodule

* STY: Add missing brackets to arrayfunction_override.c

* MAINT: Remove arrayfunction_override dict check for kwarg

* TST: Assert that 'like' is not in TestArrayLike kwargs

* MAINT: Rename array_implement_c_array_function(_creation)

This is done to be more explicit as to its usage being intended for
array creation functions only.

* MAINT: Use NotImplemented to indicate fallback to default

* TST: Test that results with `like=np.array` are correct

* TST: Avoid duplicating MyArray code in TestArrayLike

* TST: Don't delete temp file, it may cause issues with Windows

* TST: Don't rely on eval in TestArrayLike

* TST: Use lambda with StringIO in TestArrayLike

* ENH: Avoid unnecessary Py_XDECREF in arrayfunction_override

* TST: Make TestArrayLike more readable

* ENH: Cleaner error handling in arrayfunction_override

* ENH: Simplify array_implement_c_array_function_creation

* STY: Add missing spaces to multiarraymodule.c

* STY: C99 declaration style in arrayfunction_override.c

* ENH: Simplify arrayfunction_override.c further

Remove cleanup label from array_implementation_c_array_function,
simplifying the code. Fix unitialized variable warning in
array_implementation_array_function_internal.

* DOC: Use string replacement for `like=` documentation

Avoid repeating the full text for the `like=` argument by storing it as
a variable and using `replace` on each docstring.

* DOC: Update `like=` docstring

* TST: Test like= with array not implementing __array_function__

* TST: Add missing asanyarray to TestArrayLike

* ENH: Use helper function for like= dispatching

Avoid dispatching like= from Python implementation functions to improve
their performance. This is achieved by only calling a dispatcher
function when like is passed by the users.

* ENH: Rename array_function_dispatch kwarg to public_api

* BUG: Add accidentally removed decorator for np.eye back

* DOC: Add set_array_function_like_doc function

The function keeps Python files cleaner and resolve errors when __doc__
is not defined due to PYTHONOPTIMIZE or -OO .

* DOC: Add mention to like= kwarg being experimental

* TST: Test like= with not implemented downstream function

* DOC: Fix like= docstring reference to NEP 35.

* ENH: Prevent silent errors if public_api is not callable

* ENH: Make set_array_function_like_doc a decorator

* ENH: Simplify `_*_with_like` functions

* BUG: Fix multiple `like=` dispatching in `require`

* MAINT: Remove now unused public_api from array_function_dispatch

Co-authored-by: Sebastian Berg &lt;sebastian@sipsolutions.net&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>DOC: Add explanation of 'K' and 'A' layout options to 'asarray*' functions (#16811)</title>
<updated>2020-07-14T07:44:56+00:00</updated>
<author>
<name>Neal C</name>
<email>nealchau@gmail.com</email>
</author>
<published>2020-07-14T07:44:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=f31f12afa6fcbc852dfc57b34dd701d7b4145203'/>
<id>f31f12afa6fcbc852dfc57b34dd701d7b4145203</id>
<content type='text'>
* DOC: update parameter choices for asarray, asarray_contiguous, asarray_chkfinite converters

Co-authored-by: sun &lt;sun@vosdbt.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* DOC: update parameter choices for asarray, asarray_contiguous, asarray_chkfinite converters

Co-authored-by: sun &lt;sun@vosdbt.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>MAINT: Remove unnecessary 'from __future__ import ...' statements</title>
<updated>2020-01-03T15:48:11+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2019-08-27T11:36:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=ed1e9659f103260a32536b4a7615393e3b1173dc'/>
<id>ed1e9659f103260a32536b4a7615393e3b1173dc</id>
<content type='text'>
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
</pre>
</div>
</content>
</entry>
<entry>
<title>DOC: Add missing return value documentation in ndarray.require (#13619)</title>
<updated>2019-05-25T01:27:04+00:00</updated>
<author>
<name>Prithvi MK</name>
<email>32909711+pmk21@users.noreply.github.com</email>
</author>
<published>2019-05-25T01:27:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=cf704e7f245e89c623bd82cbdba7c2dd07cf5fb4'/>
<id>cf704e7f245e89c623bd82cbdba7c2dd07cf5fb4</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>MAINT: Move asarray helpers into their own module</title>
<updated>2019-04-14T00:40:43+00:00</updated>
<author>
<name>Eric Wieser</name>
<email>wieser.eric@gmail.com</email>
</author>
<published>2019-04-14T00:10:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/numpy.git/commit/?id=82641c61b1a2d6d1b8cccce5a65f4215c94b99b2'/>
<id>82641c61b1a2d6d1b8cccce5a65f4215c94b99b2</id>
<content type='text'>
This is a direct move, with some tweaks to imports.

This breaks a cyclic imports between `core.numeric` and `core.fromnumeric`.

This doesn't affect the value of `np.core.numeric.__all__` which keeps code doing `from numpy.core.numeric import *` working.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a direct move, with some tweaks to imports.

This breaks a cyclic imports between `core.numeric` and `core.fromnumeric`.

This doesn't affect the value of `np.core.numeric.__all__` which keeps code doing `from numpy.core.numeric import *` working.
</pre>
</div>
</content>
</entry>
</feed>
