Skip to content

TYPING: add some type hints to core.generic #27646

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
05dcd23
TYPING: add some type hints to core.generic
simonjayhawkins Jul 29, 2019
3dfecd1
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Jul 29, 2019
a207010
black
simonjayhawkins Jul 29, 2019
978029e
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Jul 31, 2019
3ba8c76
move typing_extensions to _typing.py
simonjayhawkins Jul 31, 2019
9aa69fe
add whatsnew
simonjayhawkins Jul 31, 2019
4346a6b
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 3, 2019
8fb0254
use Literal for Axis Alias
simonjayhawkins Aug 3, 2019
3b04221
return type Type[FrameOrSeries] for _constructor
simonjayhawkins Aug 3, 2019
ec609ee
resolve merge conflict
simonjayhawkins Aug 5, 2019
2f35f26
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 5, 2019
ac31e7d
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 6, 2019
7c4e87a
remove typing_extensions
simonjayhawkins Aug 6, 2019
f56794d
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 8, 2019
0ce386e
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 24, 2019
b8195b9
resolve merge conflicts
simonjayhawkins Aug 27, 2019
3690f0b
remove extra line
simonjayhawkins Aug 27, 2019
416c461
resolve merge conflict
simonjayhawkins Aug 28, 2019
aa71327
import FrameOrSeries and _T from _typing
simonjayhawkins Aug 28, 2019
6397422
lint error - unused import
simonjayhawkins Aug 28, 2019
b8866d6
revert changes to runtime behaviour
simonjayhawkins Aug 29, 2019
90833db
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 29, 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
1 change: 1 addition & 0 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Scalar = Union[str, int, float]
Axis = Union[str, int]
Ordered = Optional[bool]
Level = Union[str, int]

# to maintain type information across generic functions and parametrization
_T = TypeVar("_T")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the discussion for this might have been elsewhere, but would it make sense for this to be something like "SameAsSelf"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is standard notation used throughout typeshed for an unconstrained typevar.

would not make sense to rename as the type variable could be used to parameterize a generic function(as in this module) that has nothing to do with the type of self.

of course, _T can also be used for generic self but doesn't need a separate alias, although we do use a separate alias (SeriesOrFrame) which is bounded, but is actually unnecessary when applied to self.

Loading