Skip to content

Convert Unions to TypeVar #26588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2f981d6
convert some Unions to TypeVar
vaibhavhrt May 31, 2019
c2e6267
DOC: Fixed redirects in various parts of the documentation (#26497)
lrjball May 31, 2019
805d7e8
TST: Datetime conftest.py improvements (#26596)
h-vetinari Jun 1, 2019
c591569
ERR: better error message on too large excel sheet (#26080)
Jun 1, 2019
cfa03b6
CLN: remove sample_time attributes from benchmarks (#26598)
pv Jun 1, 2019
e6f21d8
TST: add concrete examples of dataframe fixtures to docstrings (#26593)
simonjayhawkins Jun 1, 2019
dbafe6f
CI/DOC: Building documentation with azure (#26591)
datapythonista Jun 1, 2019
eb4b0b5
DOC: sparse doc fixups (#26571)
TomAugspurger Jun 1, 2019
5dedbfa
BUG: ignore errors for invalid dates in to_datetime() with errors=coe…
nathalier Jun 1, 2019
3457fb2
TST/CLN: Fixturize tests/frame/test_quantile.py (#26556)
makbigc Jun 1, 2019
605476e
BUG: fix categorical comparison with missing values (#26504 ) (#26514)
another-green Jun 1, 2019
a69d56f
Fix the output of df.describe on an empty categorical / object column…
enisnazif Jun 1, 2019
210e2dc
BUG: MultiIndex not dropping nan level and invalid code value (#26408)
jiangyue12392 Jun 1, 2019
a2f9013
API: Series.str-accessor infers dtype (and Index.str does not raise o…
h-vetinari Jun 1, 2019
4cd348b
Changing dev docs ssh key (#26604)
datapythonista Jun 1, 2019
ad7c9e9
CI: Removing doc build in azure (#26609)
datapythonista Jun 1, 2019
68c6766
PERF: don't call RangeIndex._data unnecessarily (#26565)
topper-123 Jun 1, 2019
1f83733
CI: pin pytest version on Python 3.5 (#26619)
simonjayhawkins Jun 2, 2019
6fb0be0
remove outdated gtk package from code (#26590)
xcz011 Jun 2, 2019
a6ad17d
Tidy documentation about plotting Series histograms (#26624)
iamshwin Jun 2, 2019
3a56195
TST/CLN: deduplicate fixture from test_to_latex.py (#26603)
simonjayhawkins Jun 2, 2019
ee52d0e
CLN: Remove convert_objects (#26612)
mroeschke Jun 2, 2019
6f9aa6a
Clean up ufuncs post numpy bump (#26606)
h-vetinari Jun 2, 2019
c95be62
Add more specific error message when user passes incorrect matrix for…
fhoang7 Jun 2, 2019
21f49c4
DOC/CI: restore travis CI doc build environment (#26621)
jorisvandenbossche Jun 3, 2019
b1e4c55
TST/API: Forbid str-accessor for 1-level MultiIndex (#26608)
h-vetinari Jun 3, 2019
d5fad24
Minor doc cleanup because of Panel removal (#26638)
topper-123 Jun 3, 2019
0ee4317
DOC: Small whatsnew cleanups (#26643)
jschendel Jun 4, 2019
da6900e
DOC/CI: Removing Panel specific code from validate_docstrings.py (#26…
datapythonista Jun 4, 2019
dbdd556
Remove NDFrame.select (#26641)
topper-123 Jun 4, 2019
7370c1d
[TST] Fix test_quantile_interpolation_int (#26633)
makbigc Jun 5, 2019
8a1f714
Update Accessors URL for PdVega package. (#26653)
shawnbrown Jun 5, 2019
b642726
DEPS: Adding missing doc dependencies to environment.yml (#26657)
datapythonista Jun 5, 2019
5abb8c3
use range in RangeIndex instead of _start etc. (#26581)
topper-123 Jun 5, 2019
b5535dd
TST: Test sorting levels not aligned with index (#25775) (#26492)
mahepe Jun 5, 2019
d8c2b40
Remove SharedItems from test_excel (#26579)
WillAyd Jun 5, 2019
6a37e19
ERR: include original error message for missing required dependencies…
DanielFEvans Jun 5, 2019
5271868
BUG: fix TypeError for invalid integer dates %Y%m%d with errors='igno…
nathalier Jun 5, 2019
2cc1ca0
Revert "ERR: include original error message for missing required depe…
jorisvandenbossche Jun 5, 2019
ae50e39
Remove redundant check arr_or_dtype is None (#26655)
AlexTereshenkov Jun 5, 2019
077c7c2
filter warning in repr (#26669)
TomAugspurger Jun 5, 2019
ed7bbf0
Merge branch 'master' into Union2TypeVar
vaibhavhrt Jun 6, 2019
52ed915
convert DatetimeLikeScalar to TypeVar
vaibhavhrt Jun 6, 2019
2d3376a
remove unused import
vaibhavhrt Jun 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import IO, AnyStr, Type, Union
from typing import IO, AnyStr, TypeVar, Union

import numpy as np

Expand All @@ -11,12 +11,14 @@
from pandas.core.dtypes.generic import (
ABCExtensionArray, ABCIndexClass, ABCSeries, ABCSparseSeries)

AnyArrayLike = Union[ABCExtensionArray,
ABCIndexClass,
ABCSeries,
ABCSparseSeries,
np.ndarray]
ArrayLike = Union[ABCExtensionArray, np.ndarray]
DatetimeLikeScalar = Type[Union[Period, Timestamp, Timedelta]]
AnyArrayLike = TypeVar('AnyArrayLike',
ABCExtensionArray,
ABCIndexClass,
ABCSeries,
ABCSparseSeries,
np.ndarray)
ArrayLike = TypeVar('ArrayLike', ABCExtensionArray, np.ndarray)
DatetimeLikeScalar = TypeVar('DatetimeLikeScalar', Period, Timestamp,
Timedelta)
Dtype = Union[str, np.dtype, ExtensionDtype]
FilePathOrBuffer = Union[str, Path, IO[AnyStr]]
4 changes: 2 additions & 2 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime, timedelta
import operator
from typing import Any, Sequence, Union, cast
from typing import Any, Sequence, Type, Union, cast
import warnings

import numpy as np
Expand Down Expand Up @@ -58,7 +58,7 @@ def _get_attributes_dict(self):
return {k: getattr(self, k, None) for k in self._attributes}

@property
def _scalar_type(self) -> DatetimeLikeScalar:
def _scalar_type(self) -> Type[DatetimeLikeScalar]:
"""The scalar associated with this datelike

* PeriodArray : Period
Expand Down