Skip to content

Commit 40badb9

Browse files
committed
fix: refactor
1 parent ba312ea commit 40badb9

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/c2pa/c2pa.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,15 +2545,14 @@ def detailed_json(self) -> str:
25452545
return _convert_to_py_string(result)
25462546

25472547
def _get_manifest_field(self, extractor):
2548-
"""Extract a field from cached manifest data, or None if unavailable.
2548+
"""Extract a field from (cached) manifest data, or None if unavailable.
25492549
25502550
Args:
25512551
extractor: A callable that takes the parsed manifest dict
25522552
and returns the desired field value.
25532553
25542554
Returns:
2555-
The extracted field value, or None if no manifest data
2556-
is available.
2555+
Extracted field value, or None if not available.
25572556
"""
25582557
try:
25592558
data = self._get_cached_manifest_data()
@@ -2629,8 +2628,7 @@ def get_validation_state(self) -> Optional[str]:
26292628
or None if the validation_state field is not present or if no
26302629
manifest is found or if there was an error parsing the JSON.
26312630
"""
2632-
return self._get_manifest_field(
2633-
lambda d: d.get("validation_state"))
2631+
return self._get_manifest_field(lambda d: d.get("validation_state"))
26342632

26352633
def get_validation_results(self) -> Optional[dict]:
26362634
"""Get the validation results of the manifest store.
@@ -2645,8 +2643,7 @@ def get_validation_results(self) -> Optional[dict]:
26452643
field is not present or if no manifest is found or if
26462644
there was an error parsing the JSON.
26472645
"""
2648-
return self._get_manifest_field(
2649-
lambda d: d.get("validation_results"))
2646+
return self._get_manifest_field(lambda d: d.get("validation_results"))
26502647

26512648
def resource_to_stream(self, uri: str, stream: Any) -> int:
26522649
"""Write a resource to a stream.
@@ -2898,10 +2895,8 @@ def wrapped_callback(
28982895
return signer_instance
28992896

29002897
def __init__(self, signer_ptr: ctypes.POINTER(C2paSigner)):
2901-
"""Initialize a new Signer instance.
2902-
2903-
Note: This constructor is not meant to be called directly.
2904-
Use from_info() or from_callback() instead.
2898+
"""Initialize a new Signer instance. This constructor is not meant
2899+
to be called directly. Use from_info() or from_callback() instead.
29052900
29062901
Args:
29072902
signer_ptr: Pointer to the native C2PA signer

0 commit comments

Comments
 (0)