Skip to content

Commit

Permalink
Merge pull request #596 from Sherwin-14/docleanup
Browse files Browse the repository at this point in the history
Did the necessary docstring cleanup as discussed in #590
  • Loading branch information
mfisher87 committed Jun 12, 2024
2 parents 86458ef + dbcf38b commit 57c55d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 4 additions & 3 deletions earthaccess/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ def __init__(
if username and password:
self.auth = (username, password)

# Overrides from the library to keep headers when redirected to or from
# the NASA auth host.
def rebuild_auth(self, prepared_request: Any, response: Any) -> None:
"""Overrides from the library to keep headers when redirected to or from the NASA auth host."""
headers = prepared_request.headers
url = prepared_request.url

Expand Down Expand Up @@ -93,7 +92,7 @@ def login(
* **"environment"**:
Retrieve a username and password from $EARTHDATA_USERNAME and $EARTHDATA_PASSWORD.
persist: Will persist credentials in a `.netrc` file.
system (Env): the EDL endpoint to log in to Earthdata, defaults to PROD
system: the EDL endpoint to log in to Earthdata, defaults to PROD
Returns:
An instance of Auth.
Expand Down Expand Up @@ -132,6 +131,7 @@ def _set_earthdata_system(self, system: System) -> None:

def refresh_tokens(self) -> bool:
"""Refresh CMR tokens.
Tokens are used to do authenticated queries on CMR for restricted and early access datasets.
This method renews the tokens to make sure we can query the collections allowed to our EDL user.
"""
Expand Down Expand Up @@ -188,6 +188,7 @@ def get_s3_credentials(
endpoint: Optional[str] = None,
) -> Dict[str, str]:
"""Gets AWS S3 credentials for a given NASA cloud provider.
The easier way is to use the DAAC short name; provider is optional if we know it.
Parameters:
Expand Down
7 changes: 5 additions & 2 deletions earthaccess/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ def __init__(self, auth: Optional[Auth] = None, *args: Any, **kwargs: Any) -> No

@override
def hits(self) -> int:
"""Returns the number of hits the current query will return. This is done by
making a lightweight query to CMR and inspecting the returned headers.
"""Returns the number of hits the current query will return.
This is done by making a lightweight query to CMR and inspecting the returned headers.
Restricted datasets will always return zero results even if there are results.
Returns:
Expand Down Expand Up @@ -469,6 +470,7 @@ def __init__(self, auth: Optional[Auth] = None, *args: Any, **kwargs: Any) -> No
@override
def hits(self) -> int:
"""Returns the number of hits the current query will return.
This is done by making a lightweight query to CMR and inspecting the returned
headers.
Expand Down Expand Up @@ -561,6 +563,7 @@ def parameters(self, **kwargs: Any) -> Self:
@override
def provider(self, provider: str) -> Self:
"""Only match collections from a given provider.
A NASA datacenter or DAAC can have one or more providers.
For example, PODAAC is a data center or DAAC,
PODAAC is the default provider for on-prem data, and POCLOUD is
Expand Down
3 changes: 3 additions & 0 deletions earthaccess/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def set_requests_session(
self, url: str, method: str = "get", bearer_token: bool = False
) -> None:
"""Sets up a `requests` session with bearer tokens that are used by CMR.
Mainly used to get the authentication cookies from different DAACs and URS.
This HTTPS session can be used to download granules if we want to use a direct,
lower level API.
Expand Down Expand Up @@ -265,6 +266,7 @@ def get_s3fs_session(
@lru_cache
def get_fsspec_session(self) -> fsspec.AbstractFileSystem:
"""Returns a fsspec HTTPS session with bearer tokens that are used by CMR.
This HTTPS session can be used to download granules if we want to use a direct,
lower level API.
Expand All @@ -283,6 +285,7 @@ def get_fsspec_session(self) -> fsspec.AbstractFileSystem:

def get_requests_session(self, bearer_token: bool = True) -> requests.Session:
"""Returns a requests HTTPS session with bearer tokens that are used by CMR.
This HTTPS session can be used to download granules if we want to use a direct,
lower level API.
Expand Down

0 comments on commit 57c55d9

Please sign in to comment.