Misc Type Annotation fixes by gwrome · Pull Request #26372 · pandas-dev/pandas (original) (raw)
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.