Skip to content

Commit fad17eb

Browse files
committed
fix: refactor
1 parent 0f0b4bb commit fad17eb

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

src/c2pa/c2pa.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ class Context(ManagedResource, ContextProvider):
15171517
A Context may carry Settings and a Signer,
15181518
and is passed to Reader or Builder to control their behavior,
15191519
thus propagating settings and configurations by passing
1520-
object as parameter.
1520+
the Context object (+settings on it) as parameter.
15211521
15221522
When a Signer is provided, the Signer object is consumed,
15231523
as it becomes included into the Context, and must not be
@@ -1535,14 +1535,11 @@ def __init__(
15351535
Args:
15361536
settings: Optional Settings for configuration.
15371537
If None, default SDK settings are used.
1538-
signer: Optional Signer. If provided it is
1539-
consumed and must not be used directly again
1540-
after that call.
1538+
signer: Optional Signer. If provided it is consumed
1539+
and must not be used directly again after that call.
15411540
15421541
Raises:
1543-
C2paError: If creation fails or if signer is
1544-
provided but the library does not support
1545-
signer-on-context.
1542+
C2paError: If creation fails
15461543
"""
15471544
super().__init__()
15481545
self._has_signer = False
@@ -1566,8 +1563,7 @@ def __init__(
15661563
if settings is not None:
15671564
result = (
15681565
_lib.c2pa_context_builder_set_settings(
1569-
builder_ptr,
1570-
settings._c_settings,
1566+
builder_ptr, settings._c_settings,
15711567
)
15721568
)
15731569
if result != 0:
@@ -1576,8 +1572,7 @@ def __init__(
15761572
if signer is not None:
15771573
signer._ensure_valid_state()
15781574
result = (
1579-
_lib
1580-
.c2pa_context_builder_set_signer(
1575+
_lib.c2pa_context_builder_set_signer(
15811576
builder_ptr, signer._handle,
15821577
)
15831578
)
@@ -1586,9 +1581,7 @@ def __init__(
15861581

15871582
# Build consumes builder_ptr
15881583
ptr = (
1589-
_lib.c2pa_context_builder_build(
1590-
builder_ptr
1591-
)
1584+
_lib.c2pa_context_builder_build(builder_ptr)
15921585
)
15931586
builder_ptr = None
15941587

@@ -1600,11 +1593,9 @@ def __init__(
16001593
# Build succeeded, consume the Signer.
16011594
# Keep its callback ref alive on this Context,
16021595
# then mark it so it won't double-free the
1603-
# native pointer the Context now owns.
1596+
# pointer the Context now owns.
16041597
if signer is not None:
1605-
self._signer_callback_cb = (
1606-
signer._callback_cb
1607-
)
1598+
self._signer_callback_cb = (signer._callback_cb)
16081599
signer._mark_consumed()
16091600
self._has_signer = True
16101601
except Exception:

0 commit comments

Comments
 (0)