@@ -155,21 +155,22 @@ def _running_in_us_west_2(self) -> bool:
155155 return False
156156
157157 if resp .status_code == 200 and b"us-west-2" == resp .content :
158- # On AWS in region us-west-2
158+ # On AWS, in region us-west-2
159159 return True
160160 return False
161161
162162 def set_requests_session (
163163 self , url : str , method : str = "get" , bearer_token : bool = False
164164 ) -> None :
165165 """Sets up a `requests` session with bearer tokens that are used by CMR.
166- Mainly used to get the authentication cookies from different DAACs and URS
167- This HTTPS session can be used to download granules if we want to use a direct, lower level API
166+ Mainly used to get the authentication cookies from different DAACs and URS.
167+ This HTTPS session can be used to download granules if we want to use a direct,
168+ lower level API.
168169
169170 Parameters:
170171 url: used to test the credentials and populate the class auth cookies
171- method: HTTP method to test. default: "GET"
172- bearer_token: if true will be used for authenticated queries on CMR
172+ method: HTTP method to test, default: "GET"
173+ bearer_token: if true, will be used for authenticated queries on CMR
173174
174175 Returns:
175176 fsspec HTTPFileSystem (aiohttp client session)
@@ -203,7 +204,7 @@ def get_s3fs_session(
203204 """Returns a s3fs instance for a given cloud provider / DAAC.
204205
205206 Parameters:
206- daac: any of the DAACs e.g. NSIDC, PODAAC
207+ daac: any of the DAACs, e.g. NSIDC, PODAAC
207208 provider: a data provider if we know them, e.g. PODAAC -> POCLOUD
208209 endpoint: pass the URL for the credentials directly
209210
@@ -262,7 +263,8 @@ def get_s3fs_session(
262263 @lru_cache
263264 def get_fsspec_session (self ) -> fsspec .AbstractFileSystem :
264265 """Returns a fsspec HTTPS session with bearer tokens that are used by CMR.
265- This HTTPS session can be used to download granules if we want to use a direct, lower level API
266+ This HTTPS session can be used to download granules if we want to use a direct,
267+ lower level API.
266268
267269 Returns:
268270 fsspec HTTPFileSystem (aiohttp client session)
@@ -279,7 +281,8 @@ def get_fsspec_session(self) -> fsspec.AbstractFileSystem:
279281
280282 def get_requests_session (self , bearer_token : bool = True ) -> requests .Session :
281283 """Returns a requests HTTPS session with bearer tokens that are used by CMR.
282- This HTTPS session can be used to download granules if we want to use a direct, lower level API
284+ This HTTPS session can be used to download granules if we want to use a direct,
285+ lower level API.
283286
284287 Parameters:
285288 bearer_token: if true, will be used for authenticated queries on CMR
@@ -303,7 +306,7 @@ def open(
303306 provider: an option
304307
305308 Returns:
306- a list of s3fs "file pointers" to s3 files.
309+ A list of s3fs "file pointers" to s3 files.
307310 """
308311 if len (granules ):
309312 return self ._open (granules , provider )
@@ -324,7 +327,7 @@ def _open(
324327 provider: an option
325328
326329 Returns:
327- a list of s3fs "file pointers" to s3 files.
330+ A list of s3fs "file pointers" to s3 files.
328331 """
329332 raise NotImplementedError ("granules should be a list of DataGranule or URLs" )
330333
@@ -454,11 +457,10 @@ def get(
454457 the data will be effectively downloaded to a local directory.
455458
456459 Parameters:
457- granules: a list of granules(DataGranule) instances or a list of granule links (HTTP)
458- local_path: local directory to store the remote data granules
459- access: direct or on_prem, if set it will use it for the access method.
460- threads: parallel number of threads to use to download the files;
461- adjust as necessary, default = 8
460+ granules: A list of granules(DataGranule) instances or a list of granule links (HTTP).
461+ local_path: Local directory to store the remote data granules.
462+ threads: Parallel number of threads to use to download the files;
463+ adjust as necessary, default = 8.
462464
463465 Returns:
464466 List of downloaded files
@@ -493,10 +495,10 @@ def _get(
493495 the data will be effectively downloaded to a local directory.
494496
495497 Parameters:
496- granules: a list of granules(DataGranule) instances or a list of granule links (HTTP)
497- local_path: local directory to store the remote data granules
498- access: direct or on_prem, if set it will use it for the access method.
499- threads: parallel number of threads to use to download the files, adjust as necessary, default = 8
498+ granules: A list of granules (DataGranule) instances or a list of granule links (HTTP).
499+ local_path: Local directory to store the remote data granules
500+ threads: Parallel number of threads to use to download the files;
501+ adjust as necessary, default = 8.
500502
501503 Returns:
502504 None
@@ -548,7 +550,7 @@ def _get_granules(
548550 cloud_hosted = granules [0 ].cloud_hosted
549551 access = "direct" if (cloud_hosted and self .in_region ) else "external"
550552 data_links = list (
551- # we are not in region
553+ # we are not in- region
552554 chain .from_iterable (
553555 granule .data_links (access = access , in_region = self .in_region )
554556 for granule in granules
@@ -587,7 +589,7 @@ def _download_file(self, url: str, directory: str) -> str:
587589 directory: local directory
588590
589591 Returns:
590- a local filepath or an exception
592+ A local filepath or an exception.
591593 """
592594 # If the get data link is an Opendap location
593595 if "opendap" in url and url .endswith (".html" ):
@@ -628,7 +630,7 @@ def _download_onprem_granules(
628630 adjust as necessary, default = 8
629631
630632 Returns:
631- a list of local filepaths to which the files were downloaded
633+ A list of local filepaths to which the files were downloaded.
632634 """
633635 if urls is None :
634636 raise ValueError ("The granules didn't provide a valid GET DATA link" )
0 commit comments