-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: fix mypy errors in pandas\tests\indexes\interval\test_base.py #28926 #28961
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
WillAyd
merged 17 commits into
pandas-dev:master
from
srcole:mypy_indexes_interval_base
Oct 28, 2019
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e77585c
add None as optional type with IntervalIndex
srcole 311fff2
add typing to the class Base
srcole 70ef137
remove changes to test_base
srcole 7bfad53
change allowed Base type to Index to fix mypy errors in other test files
srcole f8a21a2
rearrange imports
srcole ab73ccf
stop ignoring errors in test_numeric and test_category
srcole 85dddbf
Merge branch 'master' into mypy_indexes_interval_base
srcole c483f77
add None as optional type with IntervalIndex
srcole 46449d2
add typing to the class Base
srcole 20d59c2
remove changes to test_base
srcole 3f2d8e1
change allowed Base type to Index to fix mypy errors in other test files
srcole 7460018
rearrange imports
srcole 77ebda7
stop ignoring errors in test_numeric and test_category
srcole 3ad43f8
Merge remote changes
srcole 3362535
Merge branch 'master' into mypy_indexes_interval_base
srcole 01133ab
remove test_coercion
srcole 96cd4c4
Pull recent changes
srcole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this need to be
Optional
?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.
IMO we should keep the
Optional
otherwise when we use 3.6 type annotations we'll getpandas\tests\indexes\common.py:34: error: Incompatible types in assignment (expression has type "None", variable has type "Type[Index]")
The Optional should only be excluded where we have added
something = None # type: ...
for the purpose of type checking.In this case
_holder
was set toNone
before the type annotation was added.so when we move to 3.6, we will change to
_holder: Optional[Type[Index]] = None
whereas if the initialisation was purely added for the type annotations we would change to just
_holder: Type[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.
Isn't the latter what we actually want here though? OK to change to 36 annotation now on this PR since 35 CI should be dropped within the next few days
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.
IMO out of scope here
but to answer your question, in general, with 3.6, we could reduce the number of
assert <some_variable> is not None
that are sometimes needed when class attributes are initialised toNone
, but we would need to evaluate on a case by case basis.i'm not sure a good reason to block since this is not guaranteed.