Skip to content

Commit 15988be

Browse files
authored
CI: check for numpy.random-related imports (#37117)
1 parent 109ee11 commit 15988be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,17 @@ repos:
6666
from\ pandas\.core\ import\ common|
6767
6868
# Check for imports from collections.abc instead of `from collections import abc`
69-
from\ collections\.abc\ import|
69+
from\ collections\.abc\ import
7070
71-
from\ numpy\ import\ nan
71+
- id: non-standard-numpy.random-related-imports
72+
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
73+
language: pygrep
74+
exclude: pandas/_testing.py
75+
entry: |
76+
(?x)
77+
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
78+
from\ numpy\ import\ random|
79+
from\ numpy.random\ import
7280
types: [python]
7381
- id: non-standard-imports-in-tests
7482
name: Check for non-standard imports in test suite

0 commit comments

Comments
 (0)