Skip to content

Commit b750483

Browse files
committed
fix CI build errors:
TST: Check pytables<3.5.1 when skipping (pandas-dev#25773) * TST: Check pytables<3.5.1 when skipping 3.5.1 was made available on conda, causing 'xfail_non_writeable' tests to fail. * TST: Skip geopandas downstream test xref pandas-devgh-25778 added 'except NULL' for get_c_string_buf_and_size in util.pxd(bug without) fixed lint error Fixed code issue from compat with new numpydoc (pandas-dev#26188) fixed docstring
1 parent 527ff39 commit b750483

29 files changed

+81
-114
lines changed

environment.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ dependencies:
2121
- moto
2222
- pytest>=4.0
2323
- sphinx
24-
- numpydoc
24+
- numpydoc>=0.9.0
25+
- pip
2526

2627
# optional
2728
- beautifulsoup4>=4.2.1

pandas/_libs/tslibs/nattype.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class NaTType(_NaT):
331331
332332
.. versionadded:: 0.23.0
333333
""")
334-
day_name = _make_nan_func('day_name', # noqa:E128
334+
day_name = _make_nan_func('day_name', # noqa:E128
335335
"""
336336
Return the day name of the Timestamp with specified locale.
337337

pandas/_libs/tslibs/util.pxd

+6-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ cdef extern from *:
3535
} while(0)
3636
#endif
3737
"""
38-
void PyUnicode_AsUTF8AndSize(object py_string, const char* buffer, Py_ssize_t* length)
39-
void PyBytes_AsStringAndSize(object py_string, char** buffer, Py_ssize_t* length)
38+
void PyUnicode_AsUTF8AndSize(object py_string,
39+
const char* buffer, Py_ssize_t* length)
40+
void PyBytes_AsStringAndSize(object py_string,
41+
char** buffer, Py_ssize_t* length)
4042

4143
cdef extern from "Python.h":
4244
# Note: importing extern-style allows us to declare these as nogil
@@ -257,8 +259,8 @@ cdef inline bint is_nan(object val):
257259
return is_complex_object(val) and val != val
258260

259261

260-
cdef inline const char* get_c_string_buf_and_size(object py_string,
261-
Py_ssize_t *length) except NULL:
262+
cdef inline const char* get_c_string_buf_and_size(
263+
object py_string, Py_ssize_t *length) except NULL:
262264
"""
263265
Extract internal char* buffer of unicode or bytes object `py_string` with
264266
getting length of this internal buffer saved in `length`.

pandas/core/arrays/array_.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
from pandas import compat
88

99

10-
def array(data, # type: Sequence[object]
11-
dtype=None, # type: Optional[Union[str, np.dtype, ExtensionDtype]]
12-
copy=True, # type: bool
10+
def array(data,
11+
dtype=None,
12+
copy=True,
1313
):
14-
# type: (...) -> ExtensionArray
1514
"""
1615
Create an array.
1716

pandas/core/arrays/base.py

-17
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ def _from_factorized(cls, values, original):
181181
# ------------------------------------------------------------------------
182182

183183
def __getitem__(self, item):
184-
# type (Any) -> Any
185184
"""
186185
Select a subset of self.
187186
@@ -213,7 +212,6 @@ def __getitem__(self, item):
213212
raise AbstractMethodError(self)
214213

215214
def __setitem__(self, key, value):
216-
# type: (Union[int, np.ndarray], Any) -> None
217215
"""
218216
Set one or more values inplace.
219217
@@ -261,7 +259,6 @@ def __setitem__(self, key, value):
261259
)
262260

263261
def __len__(self):
264-
# type: () -> int
265262
"""
266263
Length of this array
267264
@@ -286,31 +283,27 @@ def __iter__(self):
286283
# ------------------------------------------------------------------------
287284
@property
288285
def dtype(self):
289-
# type: () -> ExtensionDtype
290286
"""
291287
An instance of 'ExtensionDtype'.
292288
"""
293289
raise AbstractMethodError(self)
294290

295291
@property
296292
def shape(self):
297-
# type: () -> Tuple[int, ...]
298293
"""
299294
Return a tuple of the array dimensions.
300295
"""
301296
return (len(self),)
302297

303298
@property
304299
def ndim(self):
305-
# type: () -> int
306300
"""
307301
Extension Arrays are only allowed to be 1-dimensional.
308302
"""
309303
return 1
310304

311305
@property
312306
def nbytes(self):
313-
# type: () -> int
314307
"""
315308
The number of bytes needed to store this object in memory.
316309
"""
@@ -342,7 +335,6 @@ def astype(self, dtype, copy=True):
342335
return np.array(self, dtype=dtype, copy=copy)
343336

344337
def isna(self):
345-
# type: () -> Union[ExtensionArray, np.ndarray]
346338
"""
347339
A 1-D array indicating if each value is missing.
348340
@@ -365,7 +357,6 @@ def isna(self):
365357
raise AbstractMethodError(self)
366358

367359
def _values_for_argsort(self):
368-
# type: () -> ndarray
369360
"""
370361
Return values for sorting.
371362
@@ -597,7 +588,6 @@ def searchsorted(self, value, side="left", sorter=None):
597588
return arr.searchsorted(value, side=side, sorter=sorter)
598589

599590
def _values_for_factorize(self):
600-
# type: () -> Tuple[ndarray, Any]
601591
"""
602592
Return an array and missing value suitable for factorization.
603593
@@ -622,7 +612,6 @@ def _values_for_factorize(self):
622612
return self.astype(object), np.nan
623613

624614
def factorize(self, na_sentinel=-1):
625-
# type: (int) -> Tuple[ndarray, ExtensionArray]
626615
"""
627616
Encode the extension array as an enumerated type.
628617
@@ -725,7 +714,6 @@ def repeat(self, repeats, axis=None):
725714
# ------------------------------------------------------------------------
726715

727716
def take(self, indices, allow_fill=False, fill_value=None):
728-
# type: (Sequence[int], bool, Optional[Any]) -> ExtensionArray
729717
"""
730718
Take elements from an array.
731719
@@ -815,7 +803,6 @@ def take(self, indices, allow_fill=False, fill_value=None):
815803
raise AbstractMethodError(self)
816804

817805
def copy(self, deep=False):
818-
# type: (bool) -> ExtensionArray
819806
"""
820807
Return a copy of the array.
821808
@@ -852,7 +839,6 @@ def __repr__(self):
852839
dtype=self.dtype)
853840

854841
def _formatter(self, boxed=False):
855-
# type: (bool) -> Callable[[Any], Optional[str]]
856842
"""Formatting function for scalar values.
857843
858844
This is used in the default '__repr__'. The returned formatting
@@ -880,7 +866,6 @@ def _formatter(self, boxed=False):
880866
return repr
881867

882868
def _formatting_values(self):
883-
# type: () -> np.ndarray
884869
# At the moment, this has to be an array since we use result.dtype
885870
"""
886871
An array of values to be printed in, e.g. the Series repr
@@ -897,7 +882,6 @@ def _formatting_values(self):
897882

898883
@classmethod
899884
def _concat_same_type(cls, to_concat):
900-
# type: (Sequence[ExtensionArray]) -> ExtensionArray
901885
"""
902886
Concatenate multiple array
903887
@@ -920,7 +904,6 @@ def _concat_same_type(cls, to_concat):
920904

921905
@property
922906
def _ndarray_values(self):
923-
# type: () -> np.ndarray
924907
"""
925908
Internal pandas method for lossy conversion to a NumPy ndarray.
926909

pandas/core/arrays/datetimelike.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def _get_attributes_dict(self):
5858

5959
@property
6060
def _scalar_type(self):
61-
# type: () -> Union[type, Tuple[type]]
6261
"""The scalar associated with this datelike
6362
6463
* PeriodArray : Period
@@ -68,7 +67,6 @@ def _scalar_type(self):
6867
raise AbstractMethodError(self)
6968

7069
def _scalar_from_string(self, value):
71-
# type: (str) -> Union[Period, Timestamp, Timedelta, NaTType]
7270
"""
7371
Construct a scalar type from a string.
7472
@@ -89,7 +87,6 @@ def _scalar_from_string(self, value):
8987
raise AbstractMethodError(self)
9088

9189
def _unbox_scalar(self, value):
92-
# type: (Union[Period, Timestamp, Timedelta, NaTType]) -> int
9390
"""
9491
Unbox the integer value of a scalar `value`.
9592
@@ -109,7 +106,6 @@ def _unbox_scalar(self, value):
109106
raise AbstractMethodError(self)
110107

111108
def _check_compatible_with(self, other):
112-
# type: (Union[Period, Timestamp, Timedelta, NaTType]) -> None
113109
"""
114110
Verify that `self` and `other` are compatible.
115111
@@ -350,7 +346,6 @@ def __iter__(self):
350346

351347
@property
352348
def asi8(self):
353-
# type: () -> ndarray
354349
"""
355350
Integer representation of the values.
356351
@@ -460,10 +455,9 @@ def __getitem__(self, key):
460455

461456
def __setitem__(
462457
self,
463-
key, # type: Union[int, Sequence[int], Sequence[bool], slice]
464-
value, # type: Union[NaTType, Scalar, Sequence[Scalar]]
458+
key,
459+
value,
465460
):
466-
# type: (...) -> None
467461
# I'm fudging the types a bit here. The "Scalar" above really depends
468462
# on type(self). For PeriodArray, it's Period (or stuff coercible
469463
# to a period in from_sequence). For DatetimeArray, it's Timestamp...

pandas/core/arrays/datetimes.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class DatetimeArray(dtl.DatetimeLikeArrayMixin,
274274
# Constructors
275275

276276
_attributes = ["freq", "tz"]
277-
_dtype = None # type: Union[np.dtype, DatetimeTZDtype]
277+
_dtype = None
278278
_freq = None
279279

280280
def __init__(self, values, dtype=_NS_DTYPE, freq=None, copy=False):
@@ -514,7 +514,6 @@ def _box_func(self):
514514

515515
@property
516516
def dtype(self):
517-
# type: () -> Union[np.dtype, DatetimeTZDtype]
518517
"""
519518
The dtype for the DatetimeArray.
520519

pandas/core/arrays/integer.py

-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ def value_counts(self, dropna=True):
510510
return Series(array, index=index)
511511

512512
def _values_for_argsort(self):
513-
# type: () -> ndarray
514513
"""Return values for sorting.
515514
516515
Returns

pandas/core/arrays/period.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ def _simple_new(cls, values, freq=None, **kwargs):
180180

181181
@classmethod
182182
def _from_sequence(cls, scalars, dtype=None, copy=False):
183-
# type: (Sequence[Optional[Period]], PeriodDtype, bool) -> PeriodArray
184183
if dtype:
185184
freq = dtype.freq
186185
else:
@@ -243,7 +242,6 @@ def _generate_range(cls, start, end, periods, freq, fields):
243242
# DatetimeLike Interface
244243

245244
def _unbox_scalar(self, value):
246-
# type: (Union[Period, NaTType]) -> int
247245
if value is NaT:
248246
return value.value
249247
elif isinstance(value, self._scalar_type):
@@ -255,7 +253,6 @@ def _unbox_scalar(self, value):
255253
.format(val=value))
256254

257255
def _scalar_from_string(self, value):
258-
# type: (str) -> Period
259256
return Period(value, freq=self.freq)
260257

261258
def _check_compatible_with(self, other):
@@ -536,10 +533,9 @@ def _sub_period(self, other):
536533
@Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__)
537534
def _addsub_int_array(
538535
self,
539-
other, # type: Union[Index, ExtensionArray, np.ndarray[int]]
540-
op # type: Callable[Any, Any]
536+
other,
537+
op
541538
):
542-
# type: (...) -> PeriodArray
543539

544540
assert op in [operator.add, operator.sub]
545541
if op is operator.sub:
@@ -710,7 +706,6 @@ def _raise_on_incompatible(left, right):
710706
# Constructor Helpers
711707

712708
def period_array(data, freq=None, copy=False):
713-
# type: (Sequence[Optional[Period]], Optional[Tick]) -> PeriodArray
714709
"""
715710
Construct a new PeriodArray from a sequence of Period scalars.
716711

pandas/core/arrays/sparse.py

-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class SparseDtype(ExtensionDtype):
7979
_metadata = ('_dtype', '_fill_value', '_is_na_fill_value')
8080

8181
def __init__(self, dtype=np.float64, fill_value=None):
82-
# type: (Union[str, np.dtype, 'ExtensionDtype', type], Any) -> None
8382
from pandas.core.dtypes.missing import na_value_for_dtype
8483
from pandas.core.dtypes.common import (
8584
pandas_dtype, is_string_dtype, is_scalar
@@ -372,7 +371,6 @@ def _subtype_with_str(self):
372371

373372

374373
def _get_fill(arr):
375-
# type: (SparseArray) -> ndarray
376374
"""
377375
Create a 0-dim ndarray containing the fill value
378376
@@ -413,7 +411,6 @@ def _sparse_array_op(left, right, op, name):
413411
-------
414412
SparseArray
415413
"""
416-
# type: (SparseArray, SparseArray, Callable, str) -> Any
417414
if name.startswith('__'):
418415
# For lookups in _libs.sparse we need non-dunder op name
419416
name = name[2:-2]
@@ -672,7 +669,6 @@ def __init__(self, data, sparse_index=None, index=None, fill_value=None,
672669

673670
@classmethod
674671
def _simple_new(cls, sparse_array, sparse_index, dtype):
675-
# type: (np.ndarray, SparseIndex, SparseDtype) -> 'SparseArray'
676672
new = cls([])
677673
new._sparse_index = sparse_index
678674
new._sparse_values = sparse_array

pandas/core/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,6 @@ def base(self):
785785

786786
@property
787787
def array(self):
788-
# type: () -> ExtensionArray
789788
"""
790789
The ExtensionArray of the data backing this Series or Index.
791790

pandas/core/common.py

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def maybe_box_datetimelike(value):
9191

9292

9393
def is_bool_indexer(key):
94-
# type: (Any) -> bool
9594
"""
9695
Check whether `key` is a valid boolean indexer.
9796

pandas/core/dtypes/base.py

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def __ne__(self, other):
6464

6565
@property
6666
def names(self):
67-
# type: () -> Optional[List[str]]
6867
"""Ordered list of field names, or None if there are no fields.
6968
7069
This is for compatibility with NumPy arrays, and may be removed in the

pandas/core/dtypes/dtypes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ def construct_from_string(cls, string):
937937
raise TypeError(msg.format(typ=type(string)))
938938

939939
if (string.lower() == 'interval' or
940-
cls._match.search(string) is not None):
941-
return cls(string)
940+
cls._match.search(string) is not None):
941+
return cls(string)
942942

943943
msg = ('Incorrectly formatted string passed to constructor. '
944944
'Valid formats include Interval or Interval[dtype] '

pandas/core/frame.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -6191,11 +6191,10 @@ def diff(self, periods=1, axis=0):
61916191
# Function application
61926192

61936193
def _gotitem(self,
6194-
key, # type: Union[str, List[str]]
6195-
ndim, # type: int
6196-
subset=None # type: Union[Series, DataFrame, None]
6194+
key,
6195+
ndim,
6196+
subset=None
61976197
):
6198-
# type: (...) -> Union[Series, DataFrame]
61996198
"""
62006199
Sub-classes to define. Return a sliced object.
62016200

0 commit comments

Comments
 (0)