Skip to content

Commit 37c8f26

Browse files
committed
fix: refactor
1 parent aa6b834 commit 37c8f26

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

src/c2pa/c2pa.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,16 +3020,15 @@ def from_archive(
30203020
) -> 'Builder':
30213021
"""Create a new Builder from an archive stream.
30223022
3023-
This creates builder without a context. To preserve context
3024-
settings, create a Builder with a context first, then call
3025-
with_archive() on it.
3023+
This creates builder without a context. To use a context,
3024+
create a Builder with a context first, then call with_archive() on it.
30263025
30273026
Args:
30283027
stream: The stream containing the archive
30293028
(any Python stream-like object)
30303029
30313030
Returns:
3032-
A new Builder instance
3031+
A new Builder instance (without any context)
30333032
30343033
Raises:
30353034
C2paError: If there was an error creating the builder
@@ -3040,9 +3039,7 @@ def from_archive(
30403039

30413040
try:
30423041
builder._handle = (
3043-
_lib.c2pa_builder_from_archive(
3044-
stream_obj._stream
3045-
)
3042+
_lib.c2pa_builder_from_archive(stream_obj._stream)
30463043
)
30473044

30483045
_check_ffi_operation_result(builder._handle,
@@ -3075,7 +3072,7 @@ def __init__(
30753072
30763073
Args:
30773074
manifest_json: The manifest JSON definition (string or dict)
3078-
context: Optional ContextProvider for settings
3075+
context: Optional Context (ContextProvider) for settings
30793076
30803077
Raises:
30813078
C2paError: If there was an error creating the builder
@@ -3126,9 +3123,7 @@ def _init_from_context(self, context, json_str):
31263123

31273124
# Consume-and-return: builder_ptr is consumed,
31283125
# new_ptr is the valid pointer going forward
3129-
new_ptr = _lib.c2pa_builder_with_definition(
3130-
builder_ptr, json_str,
3131-
)
3126+
new_ptr = _lib.c2pa_builder_with_definition(builder_ptr, json_str)
31323127

31333128
_check_ffi_operation_result(new_ptr,
31343129
Builder._ERROR_MESSAGES[
@@ -3360,7 +3355,6 @@ def add_action(self, action_json: Union[str, dict]) -> None:
33603355
self._ensure_valid_state()
33613356

33623357
action_str = _to_utf8_bytes(action_json, "action JSON")
3363-
33643358
result = _lib.c2pa_builder_add_action(self._handle, action_str)
33653359

33663360
_check_ffi_operation_result(result,

0 commit comments

Comments
 (0)