Skip to content

Commit

Permalink
Merge pull request #832 from itcarroll/earthaccessfile-patch
Browse files Browse the repository at this point in the history
restore AbstractBaseClass inheritance
  • Loading branch information
mfisher87 authored Oct 1, 2024
2 parents 412e947 + fb78806 commit e38dcc3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
7 changes: 0 additions & 7 deletions docs/user-reference/store/earthaccessfile.md

This file was deleted.

2 changes: 1 addition & 1 deletion earthaccess/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def download(
def open(
granules: Union[List[str], List[DataGranule]],
provider: Optional[str] = None,
) -> List[EarthAccessFile]:
) -> List[AbstractFileSystem]:
"""Returns a list of file-like objects that can be used to access files
hosted on S3 or HTTPS by third party libraries like xarray.
Expand Down
6 changes: 3 additions & 3 deletions earthaccess/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
logger = logging.getLogger(__name__)


class EarthAccessFile:
class EarthAccessFile(fsspec.spec.AbstractBufferedFile):
"""Handle for a file-like object pointing to an on-prem or Earthdata Cloud granule."""

def __init__(
Expand Down Expand Up @@ -64,7 +64,7 @@ def _open_files(
url_mapping: Mapping[str, Union[DataGranule, None]],
fs: fsspec.AbstractFileSystem,
threads: Optional[int] = 8,
) -> List[EarthAccessFile]:
) -> List[fsspec.spec.AbstractBufferedFile]:
def multi_thread_open(data: tuple) -> EarthAccessFile:
urls, granule = data
return EarthAccessFile(fs.open(urls), granule)
Expand Down Expand Up @@ -336,7 +336,7 @@ def open(
self,
granules: Union[List[str], List[DataGranule]],
provider: Optional[str] = None,
) -> List[EarthAccessFile]:
) -> List[fsspec.spec.AbstractBufferedFile]:
"""Returns a list of file-like objects that can be used to access files
hosted on S3 or HTTPS by third party libraries like xarray.
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ nav:
- "Granule Queries": "user-reference/granules/granules-query.md"
- "Granule Results": "user-reference/granules/granules.md"
- Store:
- "EarthAccessFile": "user-reference/store/earthaccessfile.md"
- "Store": "user-reference/store/store.md"
- Auth:
- "Auth": "user-reference/auth/auth.md"
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def test_store_can_create_s3_fsspec_session(self):
return None


@pytest.mark.xfail(
reason="This test reproduces a bug (#610) which has not yet been fixed."
)
def test_earthaccess_file_getattr():
fs = fsspec.filesystem("memory")
with fs.open("/foo", "wb") as f:
Expand Down

0 comments on commit e38dcc3

Please sign in to comment.