mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-24 22:09:42 +00:00
## Summary <!-- What's the purpose of the change? What does it do, and why? --> Hi! Currently NumPy Python API is undergoing a cleanup process that will be delivered in NumPy 2.0 (release is planned for the end of the year). Most changes are rather simple (renaming, removing or moving a member of the main namespace to a new place), and they could be flagged/fixed by an additional ruff rule for numpy (e.g. changing occurrences of `np.float_` to `np.float64`). Would you accept such rule? I named it `NPY201` in the existing group, so people will receive a heads-up for changes arriving in 2.0 before actually migrating to it. ~~This is still a draft PR.~~ I'm not an expert in rust so if any part of code can be done better please share! NumPy 2.0 migration guide: https://numpy.org/devdocs/numpy_2_0_migration_guide.html NEP 52: https://numpy.org/neps/nep-0052-python-api-cleanup.html NumPy cleanup tracking issue: https://github.com/numpy/numpy/issues/23999 ## Test Plan A unit test is provided that checks all rule's fix cases.
106 lines
1.1 KiB
Python
106 lines
1.1 KiB
Python
def func():
|
|
import numpy as np
|
|
|
|
np.add_docstring
|
|
|
|
np.add_newdoc
|
|
|
|
np.add_newdoc_ufunc
|
|
|
|
np.asfarray([1,2,3])
|
|
|
|
np.byte_bounds(np.array([1,2,3]))
|
|
|
|
np.cast
|
|
|
|
np.cfloat(12+34j)
|
|
|
|
np.clongfloat(12+34j)
|
|
|
|
np.compat
|
|
|
|
np.complex_(12+34j)
|
|
|
|
np.DataSource
|
|
|
|
np.deprecate
|
|
|
|
np.deprecate_with_doc
|
|
|
|
np.disp(10)
|
|
|
|
np.fastCopyAndTranspose
|
|
|
|
np.find_common_type
|
|
|
|
np.get_array_wrap
|
|
|
|
np.float_
|
|
|
|
np.geterrobj
|
|
|
|
np.Inf
|
|
|
|
np.Infinity
|
|
|
|
np.infty
|
|
|
|
np.issctype
|
|
|
|
np.issubclass_(np.int32, np.integer)
|
|
|
|
np.issubsctype
|
|
|
|
np.mat
|
|
|
|
np.maximum_sctype
|
|
|
|
np.NaN
|
|
|
|
np.nbytes[np.int64]
|
|
|
|
np.NINF
|
|
|
|
np.NZERO
|
|
|
|
np.longcomplex(12+34j)
|
|
|
|
np.longfloat(12+34j)
|
|
|
|
np.lookfor
|
|
|
|
np.obj2sctype(int)
|
|
|
|
np.PINF
|
|
|
|
np.PZERO
|
|
|
|
np.recfromcsv
|
|
|
|
np.recfromtxt
|
|
|
|
np.round_(12.34)
|
|
|
|
np.safe_eval
|
|
|
|
np.sctype2char
|
|
|
|
np.sctypes
|
|
|
|
np.seterrobj
|
|
|
|
np.set_numeric_ops
|
|
|
|
np.set_string_function
|
|
|
|
np.singlecomplex(12+1j)
|
|
|
|
np.string_("asdf")
|
|
|
|
np.source
|
|
|
|
np.tracemalloc_domain
|
|
|
|
np.unicode_("asf")
|
|
|
|
np.who()
|