Skip to content

Commit bd580a4

Browse files
committed
ci: Revert "fix: Format - tests do not like format change
" This reverts commit f9c977c.
1 parent f9c977c commit bd580a4

File tree

2 files changed

+18
-30
lines changed

2 files changed

+18
-30
lines changed

src/c2pa/c2pa.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,8 @@ def read_file(path: Union[str, Path],
581581
"The read_file function is deprecated and will be removed in a future version. "
582582
"Please use the Reader class for reading C2PA metadata instead.",
583583
DeprecationWarning,
584-
stacklevel=2)
584+
stacklevel=2
585+
)
585586

586587
container = _StringContainer()
587588

@@ -625,7 +626,8 @@ def sign_file(
625626
"The sign_file function is deprecated and will be removed in a future version. "
626627
"Please use the Builder class for signing and the Reader class for reading signed data instead.",
627628
DeprecationWarning,
628-
stacklevel=2)
629+
stacklevel=2
630+
)
629631

630632
try:
631633
# Create a signer from the signer info
@@ -639,8 +641,7 @@ def sign_file(
639641
# Get the MIME type from the file extension
640642
mime_type = mimetypes.guess_type(str(source_path))[0]
641643
if not mime_type:
642-
raise C2paError.NotSupported(
643-
f"Could not determine MIME type for file: {source_path}")
644+
raise C2paError.NotSupported(f"Could not determine MIME type for file: {source_path}")
644645

645646
# Sign the file using the builder
646647
manifest_bytes = builder.sign(
@@ -700,8 +701,7 @@ def __init__(self, file):
700701
Raises:
701702
TypeError: If the file object doesn't implement all required methods
702703
"""
703-
# Initialize _closed first to prevent AttributeError during garbage
704-
# collection
704+
# Initialize _closed first to prevent AttributeError during garbage collection
705705
self._closed = False
706706
self._initialized = False
707707
self._stream = None
@@ -1805,8 +1805,7 @@ def sign(
18051805
dest_stream = Stream(dest)
18061806

18071807
# Use the internal stream-base signing logic
1808-
_, manifest_bytes = self._sign_internal(
1809-
signer, format, source_stream, dest_stream)
1808+
_, manifest_bytes = self._sign_internal(signer, format, source_stream, dest_stream)
18101809
return manifest_bytes
18111810

18121811
def sign_file(self,
@@ -1832,8 +1831,7 @@ def sign_file(self,
18321831
# Get the MIME type from the file extension
18331832
mime_type = mimetypes.guess_type(str(source_path))[0]
18341833
if not mime_type:
1835-
raise C2paError.NotSupported(
1836-
f"Could not determine MIME type for file: {source_path}")
1834+
raise C2paError.NotSupported(f"Could not determine MIME type for file: {source_path}")
18371835

18381836
# Open source and destination files
18391837
with open(source_path, 'rb') as source_file, open(dest_path, 'wb') as dest_file:
@@ -1842,8 +1840,7 @@ def sign_file(self,
18421840
dest_stream = Stream(dest_file)
18431841

18441842
# Use the internal stream-base signing logic
1845-
return self._sign_internal(
1846-
signer, mime_type, source_stream, dest_stream)
1843+
return self._sign_internal(signer, mime_type, source_stream, dest_stream)
18471844

18481845

18491846
def format_embeddable(format: str, manifest_bytes: bytes) -> tuple[int, bytes]:

src/c2pa/lib.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def _load_single_library(lib_name: str,
122122
The loaded library or None if loading failed
123123
"""
124124
if DEBUG_LIBRARY_LOADING:
125-
logger.info(f"Searching for library '{lib_name}' in paths: {
126-
[str(p) for p in search_paths]}")
125+
logger.info(f"Searching for library '{lib_name}' in paths: {[str(p) for p in search_paths]}")
127126
current_arch = _get_architecture()
128127
if DEBUG_LIBRARY_LOADING:
129128
logger.info(f"Current architecture: {current_arch}")
@@ -140,12 +139,10 @@ def _load_single_library(lib_name: str,
140139
except Exception as e:
141140
error_msg = str(e)
142141
if "incompatible architecture" in error_msg:
143-
logger.error(f"Architecture mismatch: Library at {
144-
lib_path} is not compatible with current architecture {current_arch}")
142+
logger.error(f"Architecture mismatch: Library at {lib_path} is not compatible with current architecture {current_arch}")
145143
logger.error(f"Error details: {error_msg}")
146144
else:
147-
logger.error(
148-
f"Failed to load library from {lib_path}: {e}")
145+
logger.error(f"Failed to load library from {lib_path}: {e}")
149146
else:
150147
logger.debug(f"Library not found at: {lib_path}")
151148
return None
@@ -236,8 +233,7 @@ def dynamically_load_library(
236233
if lib:
237234
return lib
238235
else:
239-
logger.error(f"Could not find library {
240-
env_lib_name} in any of the search paths")
236+
logger.error(f"Could not find library {env_lib_name} in any of the search paths")
241237
# Continue with normal loading if environment variable library
242238
# name fails
243239
except Exception as e:
@@ -253,20 +249,15 @@ def dynamically_load_library(
253249
if not lib:
254250
platform_id = get_platform_identifier()
255251
current_arch = _get_architecture()
256-
logger.error(f"Could not find {lib_name} in any of the search paths: {
257-
[str(p) for p in possible_paths]}")
258-
logger.error(
259-
f"Platform: {platform_id}, Architecture: {current_arch}")
260-
raise RuntimeError(f"Could not find {lib_name} in any of the search paths (Platform: {
261-
platform_id}, Architecture: {current_arch})")
252+
logger.error(f"Could not find {lib_name} in any of the search paths: {[str(p) for p in possible_paths]}")
253+
logger.error(f"Platform: {platform_id}, Architecture: {current_arch}")
254+
raise RuntimeError(f"Could not find {lib_name} in any of the search paths (Platform: {platform_id}, Architecture: {current_arch})")
262255
return lib
263256

264257
# Default path (no library name provided in the environment)
265258
c2pa_lib = _load_single_library(c2pa_lib_name, possible_paths)
266259
if not c2pa_lib:
267-
logger.error(f"Could not find {c2pa_lib_name} in any of the search paths: {
268-
[str(p) for p in possible_paths]}")
269-
raise RuntimeError(
270-
f"Could not find {c2pa_lib_name} in any of the search paths")
260+
logger.error(f"Could not find {c2pa_lib_name} in any of the search paths: {[str(p) for p in possible_paths]}")
261+
raise RuntimeError(f"Could not find {c2pa_lib_name} in any of the search paths")
271262

272263
return c2pa_lib

0 commit comments

Comments
 (0)