Skip to content

Commit 9ecee9e

Browse files
committed
Fix docstrings
1 parent 336d169 commit 9ecee9e

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/otdf_python/kas_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,5 +692,5 @@ def _unwrap_with_connect_rpc(self, key_access, signed_token, policy_json): # no
692692
raise SDKException(f"Connect RPC rewrap failed: {e}")
693693

694694
def get_key_cache(self) -> KASKeyCache:
695-
"""Returns the key cache"""
695+
"""Returns the KAS key cache used for storing and retrieving encryption keys."""
696696
return self.cache

src/otdf_python/kas_key_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def store(self, kas_info) -> None:
3838
self._cache[cache_key] = kas_info
3939

4040
def set(self, key, value):
41-
"""Backwards compatibility method"""
41+
"""Store a key-value pair in the cache."""
4242
with self._lock:
4343
self._cache[key] = value
4444

src/otdf_python/nanotdf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _create_policy_object(self, attributes: list[str]) -> PolicyObject:
5151
return PolicyObject(uuid=policy_uuid, body=body)
5252

5353
def _serialize_policy_object(self, obj):
54-
"""Custom serializer for policy objects to match otdfctl format."""
54+
"""Custom NanoTDF serializer to convert to compatible JSON format."""
5555
from otdf_python.policy_object import PolicyBody, AttributeObject
5656

5757
if isinstance(obj, PolicyBody):
@@ -123,7 +123,7 @@ def _prepare_policy_data(self, config: NanoTDFConfig) -> tuple[bytes, str]:
123123
return policy_body, policy_type
124124

125125
def _prepare_encryption_key(self, config: NanoTDFConfig) -> bytes:
126-
"""Get encryption key from config or generate a new one."""
126+
"""Get encryption key from config if provided as hex string, otherwise generate a new random key."""
127127
key = None
128128
if (
129129
config.cipher
@@ -438,7 +438,7 @@ def _handle_legacy_key_config(
438438
return key, config
439439

440440
def create_nanotdf(self, data: bytes, config: dict | NanoTDFConfig) -> bytes:
441-
"""Legacy method for backwards compatibility with existing tests"""
441+
"""Create a NanoTDF from input data using the provided configuration."""
442442
if len(data) > self.K_MAX_TDF_SIZE:
443443
raise NanoTDFMaxSizeLimit("exceeds max size for nano tdf")
444444

@@ -512,7 +512,7 @@ def _extract_key_for_reading(
512512
def read_nanotdf(
513513
self, nanotdf_bytes: bytes, config: dict | NanoTDFConfig | None = None
514514
) -> bytes:
515-
"""Legacy method for backwards compatibility with existing tests"""
515+
"""Read and decrypt a NanoTDF, returning the original plaintext data."""
516516
output = BytesIO()
517517
from otdf_python.header import Header # Local import to avoid circular import
518518

src/otdf_python/sdk_exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def __init__(self, message, cause=None):
99
super().__init__(message, cause)
1010

1111

12-
class KasBadRequestException(SDKException):
13-
"""Thrown when the KAS returns a bad request response."""
12+
class KASBadRequestException(SDKException):
13+
"""Thrown when the KAS returns a bad request response or other client request errors."""
1414

1515
def __init__(self, message):
1616
super().__init__(message)

src/otdf_python/tdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _build_policy_json(self, config: TDFConfig) -> str:
150150
return _json.dumps(policy, default=self._serialize_policy_object)
151151

152152
def _serialize_policy_object(self, obj):
153-
"""Custom serializer for policy objects to match otdfctl format."""
153+
"""Custom TDF serializer to convert to compatible JSON format."""
154154
from otdf_python.policy_object import PolicyBody, AttributeObject
155155

156156
if isinstance(obj, PolicyBody):

0 commit comments

Comments
 (0)