Skip to content

Commit 671f3fe

Browse files
saurav-chakravortyPingviinituutti
authored andcommitted
DOC: exclude autogenerated c/cpp/html files from 'trailing whitespace' checks (pandas-dev#24549)
1 parent 5fc4c39 commit 671f3fe

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

ci/code_checks.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
9393
# this particular codebase (e.g. src/headers, src/klib, src/msgpack). However,
9494
# we can lint all header files since they aren't "generated" like C files are.
9595
MSG='Linting .c and .h' ; echo $MSG
96-
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime
96+
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime pandas/io/msgpack pandas/_libs/*.cpp pandas/util
9797
RET=$(($RET + $?)) ; echo $MSG "DONE"
9898

9999
echo "isort --version-number"
@@ -174,9 +174,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
174174
MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG
175175
set -o pipefail
176176
if [[ "$AZURE" == "true" ]]; then
177-
! grep -n --exclude="*.svg" -RI "\s$" * | awk -F ":" '{print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}'
177+
# we exclude all c/cpp files as the c/cpp files of pandas code base are tested when Linting .c and .h files
178+
! grep -n '--exclude=*.'{svg,c,cpp,html} -RI "\s$" * | awk -F ":" '{print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}'
178179
else
179-
! grep -n --exclude="*.svg" -RI "\s$" * | awk -F ":" '{print $1 ":" $2 ":Tailing whitespaces found: " $3}'
180+
! grep -n '--exclude=*.'{svg,c,cpp,html} -RI "\s$" * | awk -F ":" '{print $1 ":" $2 ":Tailing whitespaces found: " $3}'
180181
fi
181182
RET=$(($RET + $?)) ; echo $MSG "DONE"
182183
fi

pandas/util/move.c

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
Copyright (c) 2019, PyData Development Team
3+
All rights reserved.
4+
5+
Distributed under the terms of the BSD Simplified License.
6+
7+
The full license is in the LICENSE file, distributed with this software.
8+
*/
9+
110
#include <Python.h>
211

312
#define COMPILING_IN_PY2 (PY_VERSION_HEX <= 0x03000000)
@@ -31,15 +40,13 @@ typedef struct {
3140
static PyTypeObject stolenbuf_type; /* forward declare type */
3241

3342
static void
34-
stolenbuf_dealloc(stolenbufobject *self)
35-
{
43+
stolenbuf_dealloc(stolenbufobject *self) {
3644
Py_DECREF(self->invalid_bytes);
3745
PyObject_Del(self);
3846
}
3947

4048
static int
41-
stolenbuf_getbuffer(stolenbufobject *self, Py_buffer *view, int flags)
42-
{
49+
stolenbuf_getbuffer(stolenbufobject *self, Py_buffer *view, int flags) {
4350
return PyBuffer_FillInfo(view,
4451
(PyObject*) self,
4552
(void*) PyString_AS_STRING(self->invalid_bytes),
@@ -51,8 +58,8 @@ stolenbuf_getbuffer(stolenbufobject *self, Py_buffer *view, int flags)
5158
#if COMPILING_IN_PY2
5259

5360
static Py_ssize_t
54-
stolenbuf_getreadwritebuf(stolenbufobject *self, Py_ssize_t segment, void **out)
55-
{
61+
stolenbuf_getreadwritebuf(stolenbufobject *self,
62+
Py_ssize_t segment, void **out) {
5663
if (segment != 0) {
5764
PyErr_SetString(PyExc_SystemError,
5865
"accessing non-existent string segment");
@@ -63,8 +70,7 @@ stolenbuf_getreadwritebuf(stolenbufobject *self, Py_ssize_t segment, void **out)
6370
}
6471

6572
static Py_ssize_t
66-
stolenbuf_getsegcount(stolenbufobject *self, Py_ssize_t *len)
67-
{
73+
stolenbuf_getsegcount(stolenbufobject *self, Py_ssize_t *len) {
6874
if (len) {
6975
*len = PyString_GET_SIZE(self->invalid_bytes);
7076
}
@@ -157,8 +163,7 @@ PyDoc_STRVAR(
157163
however, if called through *unpacking like ``stolenbuf(*(a,))`` it would
158164
only have the one reference (the tuple). */
159165
static PyObject*
160-
move_into_mutable_buffer(PyObject *self, PyObject *bytes_rvalue)
161-
{
166+
move_into_mutable_buffer(PyObject *self, PyObject *bytes_rvalue) {
162167
stolenbufobject *ret;
163168

164169
if (!PyString_CheckExact(bytes_rvalue)) {

0 commit comments

Comments
 (0)