Skip to content

RUFF: fix legacy use of np.numpy.random #5786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2024
Merged

Conversation

tkknight
Copy link
Contributor

@tkknight tkknight commented Feb 26, 2024

🚀 Pull Request

Description

Fixes the NPY002 error in ruff. This rule was introduced in a recent ruff release https://github.com/astral-sh/ruff/releases/tag/v0.2.2.

$ ruff .
lib/iris/tests/unit/util/test_broadcast_to_shape.py:24:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`
lib/iris/tests/unit/util/test_broadcast_to_shape.py:31:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`       
lib/iris/tests/unit/util/test_broadcast_to_shape.py:40:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`       
lib/iris/tests/unit/util/test_broadcast_to_shape.py:59:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`       
lib/iris/tests/unit/util/test_broadcast_to_shape.py:69:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`       
lib/iris/tests/unit/util/test_broadcast_to_shape.py:79:13: NPY002 Replace legacy `np.random.random` call with `np.random.Generator`       
Found 6 errors.

Consult Iris pull request check list

@tkknight tkknight marked this pull request as ready for review February 26, 2024 15:47
@bjlittle bjlittle self-requested a review February 27, 2024 15:35
Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkknight Nice one 👍

LGTM

@bjlittle bjlittle merged commit f4e2fb7 into SciTools:main Feb 27, 2024
@tkknight tkknight deleted the ruff_numpy branch February 27, 2024 15:38
@bjlittle bjlittle self-assigned this Feb 27, 2024
tkknight added a commit to tkknight/iris that referenced this pull request Feb 27, 2024
* main:
  ASV custom build command and file-based benchmark triggers (SciTools#5776)
  DOCS: Enable numpydoc validation pre-commit hook (SciTools#5762)
  RUFF: fix legacy use of np.numpy.random (SciTools#5786)
stephenworsley pushed a commit to stephenworsley/iris that referenced this pull request Mar 11, 2024
* fix numpy (ruff NPY002)

* handle test with dask array.
pp-mo pushed a commit to pp-mo/iris that referenced this pull request Mar 11, 2024
* fix numpy (ruff NPY002)

* handle test with dask array.
pp-mo pushed a commit to pp-mo/iris that referenced this pull request Mar 11, 2024
* fix numpy (ruff NPY002)

* handle test with dask array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants