Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Commit 5d15302

Browse files
committed
Merge branch 'master' into release
2 parents c1a0fe0 + be4b057 commit 5d15302

File tree

16 files changed

+381
-19
lines changed

16 files changed

+381
-19
lines changed

.github/workflows/test_correctness.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.6, 3.8]
14+
python-version: [3.6, 3.9]
1515

1616
steps:
1717
- uses: actions/checkout@v1
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install pytest and dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install pytest numpy pandas matplotlib
25+
pip install pytest numpy pandas matplotlib kiwisolver>=1.3.1
2626
- name: Test with pytest
2727
run: |
2828
python -m pytest -vv tests/

matplotlib-stubs/artist.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class Artist:
22
def set_label(self, s: str) -> None: ...
3+
def remove(self) -> None: ...
34

45
class Line2D(Artist): ...
56
class Collection(Artist): ...

matplotlib-stubs/backend_bases.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
from typing import Optional
2+
13
class Event: ...
24
class LocationEvent(Event): ...
35
class MouseEvent(LocationEvent): ...
6+
7+
class KeyEvent(Event):
8+
key: Optional[str]

matplotlib-stubs/pyplot.pyi.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ class Figure:
136136
) -> None: ...
137137
def add_subplot(
138138
self,
139-
nrows: int,
140-
ncols: int,
141-
index: int,
139+
nrows: int = ...,
140+
ncols: int = ...,
141+
index: int = ...,
142142
polar: bool = ...,
143143
sharex: Axes = ...,
144144
sharey: Axes = ...,
145145
label: str = ...,
146+
**kwargs: Any,
146147
) -> SubplotBase: ...
147148
def legend(self, *args: Any, **kwargs: Any) -> Legend: ...
148149
def clf(self) -> None: ...
@@ -214,7 +215,7 @@ def subplots_adjust(
214215
wspace: Optional[float] = ...,
215216
hspace: Optional[float] = ...,
216217
) -> None: ...
217-
def close(fig: Union[Figure, Literal["all"]]) -> None: ...
218+
def close(fig: Union[None, Figure, Literal["all"]] = ...) -> None: ...
218219
def clf() -> None: ...
219220
def plot(
220221
x: Data,

numpy-stubs/__init__.pyi

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Public API of numpy"""
2+
import os
23
from typing import (
34
Any,
45
Callable,
@@ -578,7 +579,7 @@ def linspace(
578579
def linspace(
579580
start: float, stop: float, *, dtype: Type[_DType], num: int = ..., endpoint: bool = ...
580581
) -> ndarray[_DType]: ...
581-
def load(file: Union[Path, IO], encoding: str = ...) -> Dict[str, ndarray]: ...
582+
def load(file: Union[str, os.PathLike, IO], encoding: str = ...) -> Dict[str, ndarray]: ...
582583
def loadtxt(
583584
fname: Any,
584585
dtype: Type[_DType] = ...,
@@ -805,7 +806,10 @@ def ravel(a: ndarray[_DType]) -> ndarray[_DType]: ...
805806
def reshape(a: ndarray[_DType], newshape: _ShapeType) -> ndarray[_DType]: ...
806807
def round(a: ndarray[_DType], decimals: _IntLike = ...) -> ndarray[_DType]: ...
807808
def save(
808-
file: Union[str, Path], arr: ndarray, allow_pickle: bool = ..., fix_imports: bool = ...
809+
file: Union[str, os.PathLike, IO],
810+
arr: ndarray,
811+
allow_pickle: bool = ...,
812+
fix_imports: bool = ...,
809813
) -> None: ...
810814
@overload
811815
def searchsorted(a: ndarray[_DType], v: _DType, side: str = ...) -> int64: ...
@@ -928,6 +932,24 @@ class finfo(Generic[_Float]):
928932
@overload
929933
def __init__(self: finfo[float64], dtype: Union[float, Type[float]]): ...
930934

935+
#
936+
# module functions
937+
#
938+
def set_printoptions(
939+
precision: Any = ...,
940+
threshold: Any = ...,
941+
edgeitems: Any = ...,
942+
linewidth: Any = ...,
943+
suppress: Any = ...,
944+
nanstr: Any = ...,
945+
infstr: Any = ...,
946+
formatter: Any = ...,
947+
sign: Any = ...,
948+
floatmode: Any = ...,
949+
*,
950+
legacy: Any = ...,
951+
) -> None: ...
952+
931953
#
932954
# Specific values
933955
#

pandas-stubs/__init__.pyi

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
"""Pandas public API"""
2+
from pathlib import Path
23
from typing import (
3-
Tuple,
4-
List,
5-
Union,
64
IO,
7-
Optional,
85
Any,
9-
overload,
106
Callable,
117
Dict,
8+
List,
9+
Mapping,
10+
Optional,
1211
Sequence,
12+
Tuple,
1313
Type,
1414
TypeVar,
15-
Mapping,
15+
Union,
16+
overload,
1617
)
17-
from typing_extensions import Literal
18-
from pathlib import Path
18+
1919
import numpy as _np
20+
from typing_extensions import Literal
21+
2022
from . import testing
21-
from .core.frame import DataFrame as DataFrame, _ListLike
22-
from .core.frame import _AxisType
23+
from .core.arrays.integer import Int8Dtype as Int8Dtype
24+
from .core.arrays.integer import Int16Dtype as Int16Dtype
25+
from .core.arrays.integer import Int32Dtype as Int32Dtype
26+
from .core.arrays.integer import Int64Dtype as Int64Dtype
27+
from .core.arrays.integer import UInt8Dtype as UInt8Dtype
28+
from .core.arrays.integer import UInt16Dtype as UInt16Dtype
29+
from .core.arrays.integer import UInt32Dtype as UInt32Dtype
30+
from .core.arrays.integer import UInt64Dtype as UInt64Dtype
31+
from .core.frame import DataFrame as DataFrame
32+
from .core.frame import _AxisType, _ListLike
33+
from .core.indexes import Index as Index
34+
from .core.indexes import MultiIndex as MultiIndex
2335
from .core.series import Series as Series
24-
from .core.indexes import Index as Index, MultiIndex as MultiIndex
2536

2637
def concat(
2738
dataframes: Union[Sequence[DataFrame], Mapping[str, DataFrame]],

pandas-stubs/core/api.pyi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .arrays.integer import (
2+
Int8Dtype,
3+
Int16Dtype,
4+
Int32Dtype,
5+
Int64Dtype,
6+
UInt8Dtype,
7+
UInt16Dtype,
8+
UInt32Dtype,
9+
UInt64Dtype,
10+
)

pandas-stubs/core/arrays/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .base import ExtensionArray, ExtensionOpsMixin

pandas-stubs/core/arrays/base.pyi

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from typing import Any, Callable, TypeVar
2+
3+
import numpy as np
4+
5+
# This is normally where ExtensionArray would be defined,
6+
# but we can't do conditional TYPE_CHECKING imports like pandas does.
7+
# So this will work for now.
8+
from ..dtypes.base import _ArrayLike
9+
from ..dtypes.base import _ExtensionArray as ExtensionArray
10+
11+
class ExtensionOpsMixin:
12+
@classmethod
13+
def _create_arithmetic_method(
14+
cls, op: Callable[..., Any]
15+
) -> Callable[[Any, Any], ExtensionArray]: ...
16+
@classmethod
17+
def _add_arithmetic_ops(cls) -> None: ...
18+
@classmethod
19+
def _create_comparison_method(cls, op: Callable[..., Any]) -> Callable[..., bool]: ...
20+
@classmethod
21+
def _add_comparison_ops(cls) -> None: ...
22+
@classmethod
23+
def _create_logical_method(cls, op: Callable[..., Any]) -> Callable[..., bool]: ...
24+
@classmethod
25+
def _add_logical_ops(cls) -> None: ...

pandas-stubs/core/arrays/integer.pyi

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
from typing import Any, Callable, List, Optional, Sequence, Type, Union, Tuple
2+
from typing_extensions import Literal
3+
import numpy as np
4+
from numpy import _ScalarLike
5+
6+
from ..dtypes.base import _ArrayLike, _DtypeObj
7+
from .masked import BaseMaskedArray, BaseMaskedDtype
8+
9+
class _IntegerDtype(BaseMaskedDtype):
10+
def __repr__(self) -> str: ...
11+
def is_signed_integer(self) -> bool: ...
12+
def is_unsigned_integer(self) -> bool: ...
13+
@property
14+
def _is_numeric(self) -> bool: ...
15+
def numpy_dtype(self) -> np.dtype: ...
16+
def kind(self) -> str: ...
17+
def itemsize(self) -> int: ...
18+
@classmethod
19+
def construct_array_type(cls) -> Type[IntegerArray]: ...
20+
def _get_common_dtype(self, dtypes: List[_DtypeObj]) -> Optional[_DtypeObj]: ...
21+
def __from_arrow__(
22+
self,
23+
array: Any, # Union[pyarrow.Array, pyarrow.ChunkedArray]
24+
) -> IntegerArray: ...
25+
26+
class IntegerArray(BaseMaskedArray):
27+
def dtype(self) -> _IntegerDtype: ...
28+
def __init__(self, values: np.ndarray, mask: np.ndarray, copy: bool = ...) -> None: ...
29+
@classmethod
30+
def _from_sequence(
31+
cls, scalars: Sequence[_ScalarLike], dtype: Optional[_DtypeObj] = ..., copy: bool = ...
32+
) -> IntegerArray: ...
33+
@classmethod
34+
def _from_sequence_of_strings(
35+
cls, strings: Sequence[str], dtype: Optional[_DtypeObj] = ..., copy: bool = ...
36+
) -> IntegerArray: ...
37+
def __array_ufunc__(
38+
self,
39+
ufunc: Callable[..., Any],
40+
method: Literal["reduce", "accumulate", "reduceat", "outer", "at", "__call__"],
41+
*inputs: Any,
42+
**kwargs: Any,
43+
) -> Any: ...
44+
def _coerce_to_array(self, value: Any) -> Tuple[np.ndarray, np.ndarray]: ...
45+
def astype(self, dtype: Union[str, _DtypeObj], copy: bool = ...) -> _ArrayLike: ...
46+
def _values_for_argsort(self) -> np.ndarray: ...
47+
@classmethod
48+
def _create_comparison_method(cls, op: Callable[..., Any]) -> Callable[..., bool]: ...
49+
def sum(self, skipna: bool = ..., min_count: int = ..., **kwargs: Any) -> _IntegerDtype: ...
50+
def _maybe_mask_result(
51+
self,
52+
result: _ArrayLike,
53+
mask: _ArrayLike,
54+
other: Union[_ScalarLike, _ArrayLike],
55+
op_name: str,
56+
) -> Callable[[Any, Any], IntegerArray]: ...
57+
@classmethod
58+
def _create_arithmetic_method(
59+
cls, op: Callable[..., Any]
60+
) -> Callable[[Any, Any], IntegerArray]: ...
61+
62+
class Int8Dtype(_IntegerDtype): ...
63+
class Int16Dtype(_IntegerDtype): ...
64+
class Int32Dtype(_IntegerDtype): ...
65+
class Int64Dtype(_IntegerDtype): ...
66+
class UInt8Dtype(_IntegerDtype): ...
67+
class UInt16Dtype(_IntegerDtype): ...
68+
class UInt32Dtype(_IntegerDtype): ...
69+
class UInt64Dtype(_IntegerDtype): ...

pandas-stubs/core/arrays/masked.pyi

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from typing import Any, Generator, Iterable, Optional, Sequence, Tuple, Type, TypeVar, Union
2+
3+
import numpy as np
4+
from numpy import _ScalarLike
5+
6+
from ..arrays.base import ExtensionArray, ExtensionOpsMixin
7+
from ..dtypes.base import ExtensionDtype, _ArrayLike, _DtypeObj
8+
from ..series import Series
9+
10+
_BaseMaskedArrayT = TypeVar("_BaseMaskedArrayT", bound=BaseMaskedArray)
11+
12+
class BaseMaskedDtype(ExtensionDtype):
13+
@property
14+
def numpy_dtype(self) -> np.dtype: ...
15+
@classmethod
16+
def construct_array_type(cls) -> Type[BaseMaskedArray]: ...
17+
18+
class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin):
19+
def __init__(self, values: np.ndarray, mask: np.ndarray, copy: bool = ...) -> None: ...
20+
@property
21+
def dtype(self) -> BaseMaskedDtype: ...
22+
def _coerce_to_array(self, values: Any) -> Tuple[np.ndarray, np.ndarray]: ...
23+
def __setitem__(self, key: Union[int, slice, np.ndarray], value: Any) -> None: ...
24+
def __iter__(self) -> Generator[Any, None, None]: ...
25+
def __len__(self) -> int: ...
26+
def __invert__(self: _BaseMaskedArrayT) -> _BaseMaskedArrayT: ...
27+
def to_numpy(
28+
self, dtype: Optional[_DtypeObj] = ..., copy: bool = ..., na_value: _ScalarLike = ...
29+
) -> np.ndarray: ...
30+
def __array__(self, dtype: _DtypeObj = ...) -> np.ndarray: ...
31+
def __arrow_array__(self, type: Optional[Any] = ...) -> Any: ... # pyarrow.array: ...
32+
@property
33+
def _hasna(self) -> bool: ...
34+
def isna(self) -> _ArrayLike: ...
35+
@property
36+
def _na_value(self) -> Any: ...
37+
@property
38+
def nbytes(self) -> int: ...
39+
@classmethod
40+
def _concat_same_type(
41+
cls: Type[_BaseMaskedArrayT], to_concat: Iterable
42+
) -> _BaseMaskedArrayT: ...
43+
def take(
44+
self: _BaseMaskedArrayT,
45+
indexer: Sequence,
46+
allow_fill: bool = ...,
47+
fill_value: Optional[_ScalarLike] = ...,
48+
) -> _BaseMaskedArrayT: ...
49+
def copy(self: _BaseMaskedArrayT) -> _BaseMaskedArrayT: ...
50+
def factorize(self, na_sentinel: int = ...) -> Tuple[np.ndarray, ExtensionArray]: ...
51+
def value_counts(self, dropna: bool = ...) -> Series: ...
52+
def _reduce(self, name: str, skipna: bool = ..., **kwargs: Any) -> _ScalarLike: ...

pandas-stubs/core/dtypes/__init__.pyi

Whitespace-only changes.

0 commit comments

Comments
 (0)