the earthaccess.EarthAccessFile wrapper need not subclass anything #620
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.
Fixes #610, closes #563.
This PR removes any base class from the definition of
earthaccess.EarthAccessFile
(EAF). Previously, EAF inherited fromfsspec.spec.AbstractBufferedFile
(ABF) so was capable of using methods defined on ABF. But EAF held an instance of an ABF atself.f
and handed off__getattr__
requests to that object. Under this setup,self.read
returnssuper().read
ifread
is defined on ABF (andread
is defined on ABF) elseself.read
returnsself.f.read
. That is a bug. It was probably assumed that__getattr__
would catch all method calls, but it only handles what__getattribute__
can't find.We've scraped by with this setup because
self.f
is also an ABF and either does not override ABF on a called method or the override does little more than itself callsuper()
. The latter is the case forself.f.read
whenf
is afsspec.implementations.http.HTTPFile
. It is not the case whenf
is afsspec.implementations.http.HTTPStreamFile
.This PR also updates some type hints and relevant documentation.
f
was wrong, it is an ABF not afsspec.AbstractFileSystem
ToDo if integration tests look okay:
馃摎 Documentation preview 馃摎: https://earthaccess--620.org.readthedocs.build/en/620/