Skip to content
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

Misc Type Annotation fixes #26372

Merged
merged 14 commits into from
May 18, 2019
Merged

Misc Type Annotation fixes #26372

merged 14 commits into from
May 18, 2019

Conversation

gwrome
Copy link
Contributor

@gwrome gwrome commented May 13, 2019

Part of #25882

  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

Cleanup of type annotations in files that only had a handful of straightforward errors (or no longer threw errors). These include:

pandas.core.util.hasing

pandas/core/util/hashing.py:8: error: Module 'pandas._libs' has no attribute 'hashing'

pandas.core.indexing

pandas/core/indexing.py:1487: error: Incompatible types in assignment (expression has type "Type[Exception]", base class "_NDFrameIndexer" defined the type as "Type[KeyError]")
pandas/core/indexing.py:1783: error: Incompatible types in assignment (expression has type "str", base class "_NDFrameIndexer" defined the type as "None")
pandas/core/indexing.py:2056: error: Incompatible types in assignment (expression has type "str", base class "_NDFrameIndexer" defined the type as "None")
pandas/core/indexing.py:2058: error: Incompatible types in assignment (expression has type "Type[IndexError]", base class "_NDFrameIndexer" defined the type as "Type[KeyError]")

pandas.core.internals.blocks

pandas/core/internals/blocks.py:2200: error: Definition of "_can_hold_na" in base class "ExtensionBlock" is incompatible with definition in base class "DatetimeBlock"

pandas.core.series

pandas/core/series.py:98: error: Definition of "_update_inplace" in base class "IndexOpsMixin" is incompatible with definition in base class "NDFrame"

pandas.core.panel

pandas/core/panel.py:867: error: Incompatible types in assignment (expression has type "Callable[[Any, Any], Any]", base class "NDFrame" defined the type as "Callable[[Any, Any, Any, Any], Any]")

pandas.core.reshape.reshape

pandas/core/reshape/reshape.py:6: error: Module 'pandas._libs' has no attribute 'reshape'

pandas.io.pytables

pandas/io/pytables.py:2462: error: Need type annotation for 'attributes'
pandas/io/pytables.py:2845: error: Incompatible types in assignment (expression has type "str", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:2882: error: Incompatible types in assignment (expression has type "str", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:2906: error: Incompatible types in assignment (expression has type "str", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:3025: error: Incompatible types in assignment (expression has type "str", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:3026: error: Incompatible types in assignment (expression has type "Type[DataFrame]", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:3054: error: Incompatible types in assignment (expression has type "str", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:3849: error: Incompatible types in assignment (expression has type "str", base class "Table" defined the type as "None")
pandas/io/pytables.py:3877: error: Incompatible types in assignment (expression has type "str", base class "Table" defined the type as "None")
pandas/io/pytables.py:3878: error: Incompatible types in assignment (expression has type "int", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:3894: error: Incompatible types in assignment (expression has type "None", base class "LegacyTable" defined the type as "List[IndexCol]")
pandas/io/pytables.py:4129: error: Incompatible types in assignment (expression has type "Type[DataFrame]", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:4195: error: Incompatible types in assignment (expression has type "Type[Series]", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:4253: error: Incompatible types in assignment (expression has type "Type[DataFrame]", base class "Fixed" defined the type as "None")
pandas/io/pytables.py:4301: error: Incompatible types in assignment (expression has type "Type[DataFrame]", base class "Fixed" defined the type as "None")

pandas.core.reshape.merge

pandas/core/reshape/merge.py:11: error: Module 'pandas._libs' has no attribute 'join'

pandas.util.testing

pandas/util/testing.py:24: error: Module 'pandas._libs' has no attribute 'testing'

pandas.core.window

pandas/core/window.py:45: error: Need type annotation for 'exclusions'
pandas/core/window.py:314: error: Incompatible types in assignment (expression has type "Callable[[Arg(Any, 'arg'), VarArg(Any), KwArg(Any)], Any]", base class "SelectionMixin" defined the type as "Callable[[Arg(Any, 'func'), VarArg(Any), KwArg(Any)], Any]")
pandas/core/window.py:1806: error: Definition of "_apply" in base class "_GroupByMixin" is incompatible with definition in base class "_Rolling"
pandas/core/window.py:2077: error: Definition of "_apply" in base class "_GroupByMixin" is incompatible with definition in base class "_Rolling"

pandas.core.resample

pandas/core/resample.py:34: error: Need type annotation for '_shared_docs_kwargs'
pandas/core/resample.py:876: error: All conditional function variants must have identical signatures
pandas/core/resample.py:884: error: All conditional function variants must have identical signatures
pandas/core/resample.py:891: error: All conditional function variants must have identical signatures
pandas/core/resample.py:1101: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1101: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1101: error: Definition of "_downsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1101: error: Definition of "_groupby_and_aggregate" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1217: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "PeriodIndexResampler"
pandas/core/resample.py:1217: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1217: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1217: error: Definition of "_downsample" in base class "_GroupByMixin" is incompatible with definition in base class "PeriodIndexResampler"
pandas/core/resample.py:1217: error: Definition of "_downsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1217: error: Definition of "_groupby_and_aggregate" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1247: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1247: error: Definition of "_upsample" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1247: error: Definition of "_downsample" in base class "_GroupByMixin" is incompatible with definition in base class "DatetimeIndexResampler"
pandas/core/resample.py:1247: error: Definition of "_groupby_and_aggregate" in base class "_GroupByMixin" is incompatible with definition in base class "Resampler"
pandas/core/resample.py:1299: error: Incompatible types in assignment (expression has type "Tuple[str, ...]", base class "Grouper" defined the type as "Tuple[str, str, str, str, str]")

pandas.util._doctools was removed because it no longer threw mypy errors for some reason.

pandas/core/base.py Outdated Show resolved Hide resolved
pandas/core/internals/blocks.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26372      +/-   ##
==========================================
- Coverage   91.68%   91.68%   -0.01%     
==========================================
  Files         174      174              
  Lines       50700    50710      +10     
==========================================
+ Hits        46486    46492       +6     
- Misses       4214     4218       +4
Flag Coverage Δ
#multiple 90.18% <100%> (ø) ⬆️
#single 41.18% <93.54%> (-0.17%) ⬇️
Impacted Files Coverage Δ
pandas/core/internals/blocks.py 94.08% <100%> (ø) ⬆️
pandas/core/indexing.py 90.54% <100%> (ø) ⬆️
pandas/core/base.py 98% <100%> (ø) ⬆️
pandas/util/testing.py 90.7% <100%> (ø) ⬆️
pandas/core/generic.py 93.34% <100%> (ø) ⬆️
pandas/core/reshape/merge.py 94.47% <100%> (ø) ⬆️
pandas/core/util/hashing.py 98.41% <100%> (+0.01%) ⬆️
pandas/core/reshape/reshape.py 99.56% <100%> (ø) ⬆️
pandas/io/pytables.py 90.22% <100%> (ø) ⬆️
pandas/core/window.py 96.42% <100%> (ø) ⬆️
... and 2 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 b48d1ff...86f61b6. Read the comment docs.

@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26372      +/-   ##
==========================================
- Coverage   91.69%   91.69%   -0.01%     
==========================================
  Files         174      174              
  Lines       50741    50748       +7     
==========================================
+ Hits        46529    46532       +3     
- Misses       4212     4216       +4
Flag Coverage Δ
#multiple 90.2% <100%> (ø) ⬆️
#single 41.16% <93.1%> (-0.17%) ⬇️
Impacted Files Coverage Δ
pandas/core/internals/blocks.py 94.08% <100%> (ø) ⬆️
pandas/core/indexing.py 90.53% <100%> (ø) ⬆️
pandas/core/base.py 98% <100%> (ø) ⬆️
pandas/util/testing.py 90.7% <100%> (ø) ⬆️
pandas/core/generic.py 93.49% <100%> (ø) ⬆️
pandas/core/reshape/merge.py 94.47% <100%> (ø) ⬆️
pandas/core/util/hashing.py 98.41% <100%> (+0.01%) ⬆️
pandas/core/reshape/reshape.py 99.56% <100%> (ø) ⬆️
pandas/io/pytables.py 90.22% <100%> (ø) ⬆️
pandas/core/window.py 96.41% <100%> (ø) ⬆️
... and 2 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 cb6e47d...9e42d72. Read the comment docs.

pandas/core/base.py Outdated Show resolved Hide resolved
pandas/core/indexing.py Outdated Show resolved Hide resolved
pandas/core/indexing.py Outdated Show resolved Hide resolved
pandas/core/internals/blocks.py Show resolved Hide resolved
pandas/core/window.py Outdated Show resolved Hide resolved
pandas/io/pytables.py Outdated Show resolved Hide resolved
@WillAyd WillAyd added the Typing type annotations, mypy/pyright type checking label May 13, 2019
@gwrome
Copy link
Contributor Author

gwrome commented May 13, 2019

@WillAyd Do you have any insight into what's causing the Linux py37_np_dev tests to fail? It doesn't seem related to this PR to me.

@WillAyd
Copy link
Member

WillAyd commented May 13, 2019

Just merged a fix into master for that should go away on next push

pandas/core/indexing.py Outdated Show resolved Hide resolved
pandas/core/window.py Outdated Show resolved Hide resolved
pandas/core/window.py Show resolved Hide resolved
pandas/core/window.py Outdated Show resolved Hide resolved
pandas/io/pytables.py Outdated Show resolved Hide resolved
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.

Minor comment otherwise over to @jreback

pandas/io/pytables.py Outdated Show resolved Hide resolved
@WillAyd WillAyd added this to the 0.25.0 milestone May 14, 2019
@jreback
Copy link
Contributor

jreback commented May 16, 2019

lgtm, can you merge master; ping on green.

@gwrome
Copy link
Contributor Author

gwrome commented May 16, 2019

@jreback the board is green.

@WillAyd WillAyd merged commit 0e9589d into pandas-dev:master May 18, 2019
@WillAyd
Copy link
Member

WillAyd commented May 18, 2019

Thanks @gwrome

@gwrome gwrome deleted the blacklist-misc branch May 18, 2019 15:47
@vaibhavhrt
Copy link
Contributor

closes #26439

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.

None yet

4 participants