Skip to content

Commit 4b5946f

Browse files
committed
Add more docstrings
1 parent 1cb295f commit 4b5946f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/apify/storage_clients/_apify/_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ def __init__(self, storage_type: _StorageT, alias: str, token: str, api_url: str
4040

4141
@classmethod
4242
def get_additional_cache_key(cls, api_url: str, token: str, *, encrypted: bool = False) -> str:
43+
"""Return additional cache key.
44+
45+
Args:
46+
api_url: Api url used to open the storage.
47+
token: Token used to open the storage.
48+
encrypted: Whether the token should be encrypted in the cache key.
49+
50+
Returns:
51+
Serialized additional cache key string.
52+
53+
"""
4354
if not encrypted:
4455
return cls.ADDITIONAL_CACHE_KEY_SEPARATOR.join([api_url, token])
4556

@@ -51,10 +62,12 @@ def get_additional_cache_key(cls, api_url: str, token: str, *, encrypted: bool =
5162

5263
@property
5364
def additional_cache_key(self) -> str:
65+
"""Serialized unencrypted additional cache key string."""
5466
return self.get_additional_cache_key(self.api_url, self.token, encrypted=False)
5567

5668
@classmethod
5769
def from_exported_string(cls, alias_as_string: str) -> _Alias:
70+
"""Create _Alias from previously serialized _Alias."""
5871
storage_map: dict[str, _StorageT] = {
5972
'Dataset': Dataset,
6073
'KeyValueStore': KeyValueStore,
@@ -90,6 +103,7 @@ def _create_fernet(token: str) -> Fernet:
90103
return Fernet(base64.urlsafe_b64encode(token_32))
91104

92105
async def store_mapping_to_apify_kvs(self, storage_id: str) -> None:
106+
"""Add _Alias and related storage id to the mapping in default kvs."""
93107
if not Configuration.get_global_configuration().is_at_home:
94108
logging.getLogger(__name__).warning(
95109
'Alias storage limited retention is only supported on Apify platform. Storage is not exported.'

0 commit comments

Comments
 (0)