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

Convert Unions to TypeVar #26588

merged 44 commits into from
Jun 8, 2019

Conversation

vaibhavhrt
Copy link
Contributor

@vaibhavhrt vaibhavhrt commented May 31, 2019

@vaibhavhrt
Copy link
Contributor Author

@WillAyd take a look, there are some more Union but they error, I will look at them later.

@WillAyd
Copy link
Member

WillAyd commented May 31, 2019

Looks good at first glance. FilePathOrBuffer probably makes sense to keep a Union if that’s what is causing issues as we don’t really use those in containers and typically doesn’t care to maintain their type in generic functions (I.e. we intentionally convert from say strings to buffers)

@vaibhavhrt
Copy link
Contributor Author

@WillAyd got some failing tests of travis, even with just these changes. It doesn't makes much sense to why it's failing, you can check it here: https://travis-ci.com/vaibhavhrt/pandas/jobs/204447635

@WillAyd
Copy link
Member

WillAyd commented May 31, 2019

Might have to merge master to resolve but yes unrelated to this PR

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label May 31, 2019
@jreback jreback added this to the 0.25.0 milestone Jun 1, 2019
@jreback
Copy link
Contributor

jreback commented Jun 1, 2019

lgtm. this is a draft PR, can you update; ping on green (and merge master).

@vaibhavhrt
Copy link
Contributor Author

@jreback I still have a few things to do in this PR. I mark is ready once I am done.

@vaibhavhrt vaibhavhrt marked this pull request as ready for review June 6, 2019 09:39
lrjball and others added 19 commits June 6, 2019 22:09
@codecov
Copy link

codecov bot commented Jun 6, 2019

Codecov Report

Merging #26588 into master will decrease coverage by 50.1%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #26588       +/-   ##
===========================================
- Coverage   91.88%   41.78%   -50.11%     
===========================================
  Files         174      174               
  Lines       50694    50661       -33     
===========================================
- Hits        46581    21167    -25414     
- Misses       4113    29494    +25381
Flag Coverage Δ
#multiple ?
#single 41.78% <100%> (-0.21%) ⬇️
Impacted Files Coverage Δ
pandas/_typing.py 100% <100%> (ø) ⬆️
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.37%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.16%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.1%) ⬇️
pandas/core/sparse/scipy_sparse.py 10.14% <0%> (-89.86%) ⬇️
... and 129 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9c6c22...077c7c2. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 6, 2019

Codecov Report

Merging #26588 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26588      +/-   ##
==========================================
- Coverage   91.88%   91.87%   -0.01%     
==========================================
  Files         174      174              
  Lines       50694    50694              
==========================================
- Hits        46581    46577       -4     
- Misses       4113     4117       +4
Flag Coverage Δ
#multiple 90.41% <100%> (ø) ⬆️
#single 41.92% <100%> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/_typing.py 100% <100%> (ø) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️
pandas/core/frame.py 97% <0%> (-0.12%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9c6c22...2d3376a. Read the comment docs.

@vaibhavhrt
Copy link
Contributor Author

@jreback you can review now. Commits got little messed up when I was trying to delete one of my commits, but I guess that should not be problem.

@WillAyd
Copy link
Member

WillAyd commented Jun 6, 2019 via email

@vaibhavhrt
Copy link
Contributor Author

vaibhavhrt commented Jun 6, 2019

@WillAyd I will do that. You mean this 👇 , right?

DatetimeLikeScalar = TypeVar(...)

@jreback hold on merging for now.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

I think this looks good - over to @jreback

@jreback jreback merged commit b9a7f61 into pandas-dev:master Jun 8, 2019
@jreback
Copy link
Contributor

jreback commented Jun 8, 2019

thanks @vaibhavhrt

@vaibhavhrt vaibhavhrt deleted the Union2TypeVar branch June 9, 2019 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Union annotations with TypeVar