-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: clean for PY3.8 (final) #42422
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
TYP: clean for PY3.8 (final) #42422
Conversation
pandas/_libs/internals.pyi
Outdated
@@ -50,10 +50,12 @@ class SharedBlock: | |||
|
|||
class NumpyBlock(SharedBlock): | |||
values: np.ndarray | |||
# @final # not useful in cython, but we _would_ annotate with @final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbrockmendel i've moved the comment from the cython since the final decorator could be added to the stub so the comment is not relevant.
However, we can't add to the stub as it is overridden in subclass in pandas/core/internals/blocks.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds like it is inaccurate so should be removed anyway
pandas/core/internals/blocks.py
Outdated
@@ -1661,7 +1661,7 @@ def _unstack(self, unstacker, fill_value, new_placement): | |||
class NumpyBlock(libinternals.NumpyBlock, Block): | |||
values: np.ndarray | |||
|
|||
getitem_block_index = libinternals.NumpyBlock.getitem_block_index | |||
getitem_block_index = final(libinternals.NumpyBlock.getitem_block_index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbrockmendel why is the override needed? is this a cython class thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC this was to make mypy happy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the mypy errors are...
pandas/core/internals/blocks.py:1661: error: Definition of "getitem_block_index" in base class "NumpyBlock" is incompatible with definition in base class "Block" [misc]
pandas/core/internals/blocks.py:1670: error: Definition of "getitem_block_index" in base class "NDArrayBackedBlock" is incompatible with definition in base class "Block" [misc]
Found 2 errors in 1 file (checked 1299 source files)
they aren't needed. fixed up mypy error by moving remaining Python implementation of getitem_block_index
from Block
to ExtensionBlock
and added @final
to stub instead.
Also added @final
to Python implementation of getitem_block_index
for consistency.
pandas/core/indexes/datetimelike.py
Outdated
Callable, | ||
final, | ||
) | ||
from pandas._typing import Callable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks iffy. we look at this independently and see if this occurs elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this get resolved? if so, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened #42498
can you rebase |
No description provided.