Skip to content

Commit 63d03bc

Browse files
authored
Merge pull request #10 from Dr-Irv/mypyfixes
test the stubs with mypy, pyright
2 parents bf30e40 + 19921a0 commit 63d03bc

File tree

10 files changed

+43
-72
lines changed

10 files changed

+43
-72
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ jobs:
4040

4141
- name: Run mypy
4242
run:
43-
mypy tests/pandas
43+
mypy tests/pandas typings/pandas
4444

pyrighttestconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"typeCheckingMode": "basic",
3-
"include": [ "tests" ],
3+
"include": [ "tests", "typings/pandas" ],
44
"reportMissingModuleSource": false,
55
"reportUnusedVariable": false,
66
"useLibraryCodeForTypes": true,

runtests.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
echo on
22
pytest tests > pytest.out
3-
mypy tests > mypytests.out
3+
mypy tests typings/pandas > mypytests.out
44
pyright -p pyrighttestconfig.json > pandastests.out
55

runtests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
22
pytest tests > pytest.out
3-
mypy tests > mypytests.out
3+
mypy tests typings/pandas > mypytests.out
44
pyright -p pyrighttestconfig.json > pandastests.out
55

tests/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ pyright
33
pytest
44
mypy==0.950
55
typing_extensions==4.2.0
6+
matplotlib>=3.3.2
7+
numpy>=1.22.3

typings/pandas/_typing.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ PythonScalar = Union[str, int, float, bool, complex]
4545
DatetimeLikeScalar = TypeVar("DatetimeLikeScalar", Period, Timestamp, Timedelta)
4646
PandasScalar = Union[bytes, datetime.date, datetime.datetime, datetime.timedelta]
4747
# Scalar = Union[PythonScalar, PandasScalar]
48+
IntStrT = TypeVar("IntStrT", int, str)
4849

4950
# dtypes
5051
NpDtype = Union[

typings/pandas/core/groupby/base.pyi

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#from pandas.core.dtypes.common import is_list_like as is_list_like, is_scalar as is_scalar
2+
from typing import NamedTuple
3+
4+
class OutputKey(NamedTuple):
5+
label: str
6+
position: int
7+
8+
class GroupByMixin: ...
9+
10+
plotting_methods = ...
11+
common_apply_whitelist = ...
12+
series_apply_whitelist = ...
13+
dataframe_apply_whitelist = ...
14+
cythonized_kernels = ...
15+
cython_cast_blacklist = ...
16+
reduction_kernels = ...
17+
transformation_kernels = ...
18+
groupby_other_methods = ...
19+
transform_kernel_whitelist = ...

typings/pandas/core/indexes/frozen.pyi

-14
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,9 @@ from pandas.core.base import PandasObject as PandasObject
33
class FrozenList(PandasObject, list):
44
def union(self, other) -> FrozenList: ...
55
def difference(self, other) -> FrozenList: ...
6-
__add__ = ...
7-
__iadd__ = ...
86
def __getitem__(self, n): ...
97
def __radd__(self, other): ...
108
def __eq__(self, other) -> bool: ...
11-
__req__ = ...
129
def __mul__(self, other): ...
13-
__imul__ = ...
1410
def __reduce__(self): ...
1511
def __hash__(self): ...
16-
__setitem__ = ...
17-
__setslice__ = ...
18-
__delitem__ = ...
19-
__delslice__ = ...
20-
pop = ...
21-
append = ...
22-
extend = ...
23-
remove = ...
24-
sort = ...
25-
insert = ...

typings/pandas/core/window/common.pyi

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pandas.core.groupby.base import GroupByMixin as GroupByMixin
2+
from typing import Callable, Optional
3+
4+
class WindowGroupByMixin(GroupByMixin):
5+
def __init__(self, obj, *args, **kwargs) -> None: ...
6+
7+
def calculate_center_offset(window): ...
8+
def calculate_min_periods(
9+
window: int,
10+
min_periods: Optional[int],
11+
num_values: int,
12+
required_min_periods: int,
13+
floor: int,
14+
) -> int: ...
15+
def zsqrt(x): ...
16+
def prep_binary(arg1, arg2): ...
17+
def get_weighted_roll_func(cfunc: Callable) -> Callable: ...

typings/pandas/io/excel/_base.pyi

-54
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,6 @@ from typing import (
1313
overload,
1414
)
1515

16-
@overload
17-
def read_excel(
18-
filepath: str,
19-
sheet_name: Optional[List[str]],
20-
header: Optional[Union[int, Sequence[int]]] = ...,
21-
names: Optional[Sequence[str]] = ...,
22-
index_col: Optional[Union[int, Sequence[int]]] = ...,
23-
usecols: Optional[Union[int, str, Sequence[Union[int, str, Callable]]]] = ...,
24-
squeeze: bool = ...,
25-
dtype: Union[str, Dict[str, Any], Dtype] = ...,
26-
engine: Optional[str] = ...,
27-
converters: Optional[Dict[Union[int, str], Callable]] = ...,
28-
true_values: Optional[Sequence[Scalar]] = ...,
29-
false_values: Optional[Sequence[Scalar]] = ...,
30-
skiprows: Optional[Union[Sequence[int], int, Callable]] = ...,
31-
nrows: Optional[int] = ...,
32-
na_values=...,
33-
keep_default_na: bool = ...,
34-
verbose: bool = ...,
35-
parse_dates: Union[bool, Sequence, Dict[str, Sequence]] = ...,
36-
date_parser: Optional[Callable] = ...,
37-
thousands: Optional[str] = ...,
38-
comment: Optional[str] = ...,
39-
skipfooter: int = ...,
40-
convert_float: bool = ...,
41-
mangle_dupe_cols: bool = ...,
42-
) -> Dict[str, DataFrame]: ...
43-
@overload
44-
def read_excel(
45-
filepath: str,
46-
sheet_name: List[int],
47-
header: Optional[Union[int, Sequence[int]]] = ...,
48-
names: Optional[Sequence[str]] = ...,
49-
index_col: Optional[Union[int, Sequence[int]]] = ...,
50-
usecols: Optional[Union[int, str, Sequence[Union[int, str, Callable]]]] = ...,
51-
squeeze: bool = ...,
52-
dtype: Union[str, Dict[str, Any], Dtype] = ...,
53-
engine: Optional[str] = ...,
54-
converters: Optional[Dict[Union[int, str], Callable]] = ...,
55-
true_values: Optional[Sequence[Scalar]] = ...,
56-
false_values: Optional[Sequence[Scalar]] = ...,
57-
skiprows: Optional[Union[Sequence[int], int, Callable]] = ...,
58-
nrows: Optional[int] = ...,
59-
na_values=...,
60-
keep_default_na: bool = ...,
61-
verbose: bool = ...,
62-
parse_dates: Union[bool, Sequence, Dict[str, Sequence]] = ...,
63-
date_parser: Optional[Callable] = ...,
64-
thousands: Optional[str] = ...,
65-
comment: Optional[str] = ...,
66-
skipfooter: int = ...,
67-
convert_float: bool = ...,
68-
mangle_dupe_cols: bool = ...,
69-
) -> Dict[int, DataFrame]: ...
7016
@overload
7117
def read_excel(
7218
filepath: str,

0 commit comments

Comments
 (0)