Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Oct 11, 2023
1 parent 3400fe4 commit c2bb1cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion earthaccess/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def download(
def open(
granules: Union[List[str], List[earthaccess.results.DataGranule]],
provider: Optional[str] = None,
sizes=None,
sizes: Optional[List[int]] = None,
) -> List[AbstractFileSystem]:
"""Returns a list of fsspec file-like objects that can be used to access files
hosted on S3 or HTTPS by third party libraries like xarray.
Expand Down
21 changes: 13 additions & 8 deletions earthaccess/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ def _open_files(
granules: Union[List[str], List[DataGranule]],
fs: fsspec.AbstractFileSystem,
threads: Optional[int] = 8,
sizes=None,
sizes: Optional[List[int]] = None,
) -> List[fsspec.AbstractFileSystem]:
file_sizes: Union[List[int], List[None]]
if sizes is None:
sizes = [None] * len(data_links)
file_sizes = [None] * len(data_links)
else:
file_sizes = sizes

def multi_thread_open(data: tuple) -> EarthAccessFile:
urls, granule, size = data
Expand All @@ -67,7 +70,9 @@ def multi_thread_open(data: tuple) -> EarthAccessFile:
)
return EarthAccessFile(fs.open(urls, size=size), granule)

fileset = pqdm(zip(data_links, granules, sizes), multi_thread_open, n_jobs=threads)
fileset = pqdm(
zip(data_links, granules, file_sizes), multi_thread_open, n_jobs=threads
)
return fileset


Expand Down Expand Up @@ -281,7 +286,7 @@ def open(
self,
granules: Union[List[str], List[DataGranule]],
provider: Optional[str] = None,
sizes=None,
sizes: Optional[List[int]] = None,
) -> Union[List[Any], None]:
"""Returns a list of fsspec file-like objects that can be used to access files
hosted on S3 or HTTPS by third party libraries like xarray.
Expand All @@ -301,7 +306,7 @@ def _open(
self,
granules: Union[List[str], List[DataGranule]],
provider: Optional[str] = None,
sizes=None,
sizes: Optional[List[int]] = None,
) -> Union[List[Any], None]:
"""Returns a list of fsspec file-like objects that can be used to access files
hosted on S3 or HTTPS by third party libraries like xarray.
Expand All @@ -319,7 +324,7 @@ def _open_granules(
granules: List[DataGranule],
provider: Optional[str] = None,
threads: Optional[int] = 8,
sizes=None,
sizes: Optional[List[int]] = None,
) -> Union[List[Any], None]:
fileset: List = []
data_links: List = []
Expand Down Expand Up @@ -393,7 +398,7 @@ def _open_urls(
granules: List[str],
provider: Optional[str] = None,
threads: Optional[int] = 8,
sizes=None,
sizes: Optional[List[int]] = None,
) -> Union[List[Any], None]:
fileset: List = []
data_links: List = []
Expand Down Expand Up @@ -661,7 +666,7 @@ def _open_urls_https(
urls: List[str],
granules: Union[List[str], List[DataGranule]],
threads: Optional[int] = 8,
sizes=None,
sizes: Optional[List[int]] = None,
) -> List[fsspec.AbstractFileSystem]:
https_fs = self.get_fsspec_session()
if https_fs is not None:
Expand Down

0 comments on commit c2bb1cd

Please sign in to comment.