-
Notifications
You must be signed in to change notification settings - Fork 105
method resolution surprise on EarthAccessFile
#610
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
Comments
EarthAccessGranule
EarthAccessFile
No, don't use |
When #620 removed the inherited |
It would be very helpful if we had an integration test for the behavior that the |
A change to repair damage done in #620 is to reintroduce a base class on |
Merged #832 in order to make way for a release. Note that the test surfacing this bug has been marked as an expected fail. earthaccess/tests/unit/test_store.py Lines 132 to 141 in fb78806
|
I would like to clarify a couple of things. First of all, comparing two bound methods should be done with "==", not with "is" to check for method equivalence:
Now running
gives the following output:
Modifying the class as follows:
fixes the issue:
If we want to resolve the issue only for the read method, then
should be replaced with
|
Important to note:
This means that :
doesn't override existing methods like read. |
There's something funny going on with the wrapping of
fsspec.spec.AbstractBufferedFile
, where the method resolution isn't coming out as expected.The following gives me an
AssertionError
I don't know about the internals, but
getattr(g, "read")
andg.__getattribute__("read")
both follow the MRO to theread
method offsspec.spec.AbstractBufferedFile
. We don't want that! We want theread
method, given byg.__getattr__("read")
asfsspec.implementations.http.HTTPFile.read
as resulting fromgetattr(g.f)
in the class definition.earthaccess/earthaccess/store.py
Lines 28 to 34 in b7443fe
Is it possible that
__getattr__
should be__getattribute__
?Sorry for the multiple edits; confused myself with two
f
sThe text was updated successfully, but these errors were encountered: