File tree 3 files changed +31
-24
lines changed
3 files changed +31
-24
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,36 @@ repos:
119
119
entry : python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
120
120
types : [python]
121
121
exclude : ^(asv_bench|pandas/tests|doc)/
122
+ - id : FrameOrSeriesUnion
123
+ name : Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
124
+ entry : Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]
125
+ language : pygrep
126
+ types : [python]
127
+ exclude : ^pandas/_typing\.py$
128
+ - id : type-not-class
129
+ name : Check for use of foo.__class__ instead of type(foo)
130
+ entry : \.__class__
131
+ language : pygrep
132
+ files : \.(py|pyx)$
133
+ - id : unwanted-typing
134
+ name : Check for use of comment-based annotation syntax and missing error codes
135
+ entry : |
136
+ (?x)
137
+ \#\ type:\ (?!ignore)|
138
+ \#\ type:\s?ignore(?!\[)
139
+ language : pygrep
140
+ types : [python]
141
+ - id : no-os-remove
142
+ name : Check code for instances of os.remove
143
+ entry : os\.remove
144
+ language : pygrep
145
+ types : [python]
146
+ files : ^pandas/tests/
147
+ exclude : |
148
+ (?x)^
149
+ pandas/tests/io/excel/test_writers\.py|
150
+ pandas/tests/io/pytables/common\.py|
151
+ pandas/tests/io/pytables/test_store\.py$
122
152
- repo : https://github.com/asottile/yesqa
123
153
rev : v1.2.2
124
154
hooks :
Original file line number Diff line number Diff line change @@ -122,29 +122,6 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
122
122
RET=$(( $RET + $? )) ; echo $MSG " DONE"
123
123
124
124
# -------------------------------------------------------------------------
125
- # Type annotations
126
-
127
- MSG=' Check for use of comment-based annotation syntax' ; echo $MSG
128
- invgrep -R --include=" *.py" -P ' # type: (?!ignore)' pandas
129
- RET=$(( $RET + $? )) ; echo $MSG " DONE"
130
-
131
- MSG=' Check for missing error codes with # type: ignore' ; echo $MSG
132
- invgrep -R --include=" *.py" -P ' # type:\s?ignore(?!\[)' pandas
133
- RET=$(( $RET + $? )) ; echo $MSG " DONE"
134
-
135
- MSG=' Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias' ; echo $MSG
136
- invgrep -R --include=" *.py" --exclude=_typing.py -E ' Union\[.*(Series.*DataFrame|DataFrame.*Series).*\]' pandas
137
- RET=$(( $RET + $? )) ; echo $MSG " DONE"
138
-
139
- # -------------------------------------------------------------------------
140
- MSG=' Check for use of foo.__class__ instead of type(foo)' ; echo $MSG
141
- invgrep -R --include=* .{py,pyx} ' \.__class__' pandas
142
- RET=$(( $RET + $? )) ; echo $MSG " DONE"
143
-
144
- MSG=' Check code for instances of os.remove' ; echo $MSG
145
- invgrep -R --include=" *.py*" --exclude " common.py" --exclude " test_writers.py" --exclude " test_store.py" -E " os\.remove" pandas/tests/
146
- RET=$(( $RET + $? )) ; echo $MSG " DONE"
147
-
148
125
MSG=' Check for inconsistent use of pandas namespace in tests' ; echo $MSG
149
126
for class in " Series" " DataFrame" " Index" " MultiIndex" " Timestamp" " Timedelta" " TimedeltaIndex" " DatetimeIndex" " Categorical" ; do
150
127
check_namespace ${class}
Original file line number Diff line number Diff line change @@ -474,7 +474,7 @@ def main(
474
474
475
475
sys .exit (
476
476
main (
477
- function = globals ().get (args .validation_type ), # type: ignore
477
+ function = globals ().get (args .validation_type ),
478
478
source_path = args .paths ,
479
479
output_format = args .format ,
480
480
)
You can’t perform that action at this time.
0 commit comments