-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: PY3 String/BytesIO #25954
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
CLN: PY3 String/BytesIO #25954
Conversation
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.
Minor arguably unrelated request but I think makes sense to address here. Otherwise lgtm
Codecov Report
@@ Coverage Diff @@
## master #25954 +/- ##
==========================================
- Coverage 91.82% 91.81% -0.01%
==========================================
Files 175 175
Lines 52581 52584 +3
==========================================
+ Hits 48280 48282 +2
- Misses 4301 4302 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25954 +/- ##
==========================================
- Coverage 91.84% 91.84% -0.01%
==========================================
Files 175 175
Lines 52553 52552 -1
==========================================
- Hits 48269 48267 -2
- Misses 4284 4285 +1
Continue to review full report at Codecov.
|
@WillAyd mind helping me interpret these typing errors (not too familiar with mypy)?
AFAICT, it has to do with this class defintion Line 414 in f90f4aa
|
Not at a computer to check but I think this happens if a subclass overrides a method with a signature that varies from the parent class.
I’ll see what I can dig up
…Sent from my iPhone
On Apr 2, 2019, at 1:14 PM, Matthew Roeschke ***@***.***> wrote:
@WillAyd mind helping me interpret these typing errors (not too familiar with mypy)?
pandas/io/common.py:414: error: Definition of "__enter__" in base class "ZipFile" is incompatible with definition in base class "BytesIO"
pandas/io/common.py:414: error: Definition of "__enter__" in base class "ZipFile" is incompatible with definition in base class "BinaryIO"
pandas/io/common.py:414: error: Definition of "__enter__" in base class "ZipFile" is incompatible with definition in base class "IO"
pandas/io/common.py:414: error: Definition of "__exit__" in base class "ZipFile" is incompatible with definition in base class "BytesIO"
pandas/io/common.py:414: error: Definition of "read" in base class "ZipFile" is incompatible with definition in base class "BytesIO"
pandas/io/common.py:414: error: Definition of "read" in base class "ZipFile" is incompatible with definition in base class "IO"
pandas/io/common.py:414: error: Definition of "write" in base class "ZipFile" is incompatible with definition in base class "BytesIO"
pandas/io/common.py:414: error: Definition of "write" in base class "ZipFile" is incompatible with definition in base class "BinaryIO"
pandas/io/common.py:414: error: Definition of "write" in base class "ZipFile" is incompatible with definition in base class "IO"
AFAICT, it has to do with this class defintion
https://github.com/pandas-dev/pandas/blob/f90f4aad4589727ebb3235326970a9110aaa309f/pandas/io/common.py#L414
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So the error messages here are rather explicit; the problem is that with multiple inheritance the two classes that object derives from has conflicting signatures. Here's a related issue on the MyPy tracker: This code is pretty tricky though - do you see a test case that actually hits this? Actually wondering if multiple inheritance is even required or if it can subclass ZipFile directly, given it's constructor matches that and the call to If not then ignoring the types might be the only way to go about this |
Thanks for the tips @WillAyd. Since this PR isn't concerned with typing just ignoring the typing check for the |
thanks @mroeschke @WillAyd its ok to ignore these for now; can circle back later (maybe even add a check to detect types we are ignoring). |
git diff upstream/master -u -- "*.py" | flake8 --diff
Imports
StringIO
andBytesIO
fromio
. RemovescStringIO