Skip to content

Commit 6c6eb9d

Browse files
committed
fix: Format
1 parent cd20601 commit 6c6eb9d

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

src/c2pa/c2pa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ def sign_file(self,
22962296
try:
22972297
# Open source file and destination file, then use the sign method
22982298
with open(source_path, 'rb') as source_file, \
2299-
open(dest_path, 'w+b') as dest_file:
2299+
open(dest_path, 'w+b') as dest_file:
23002300
return self.sign(signer, mime_type, source_file, dest_file)
23012301
except Exception as e:
23022302
raise C2paError(f"Error signing file: {str(e)}") from e

src/c2pa/lib.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
# Debug flag for library loading
1717
DEBUG_LIBRARY_LOADING = False
1818

19-
# Create a module-specific logger with NullHandler to avoid interfering with global configuration
19+
# Create a module-specific logger with NullHandler to avoid interfering
20+
# with global configuration
2021
logger = logging.getLogger("c2pa")
2122
logger.addHandler(logging.NullHandler())
2223

@@ -45,7 +46,9 @@ def get_platform_identifier() -> str:
4546
elif system == "windows":
4647
return "x86_64-pc-windows-msvc"
4748
elif system == "linux":
48-
if _get_architecture() in [CPUArchitecture.ARM64.value, CPUArchitecture.AARCH64.value]:
49+
if _get_architecture() in [
50+
CPUArchitecture.ARM64.value,
51+
CPUArchitecture.AARCH64.value]:
4952
return "aarch64-unknown-linux-gnu"
5053
return "x86_64-unknown-linux-gnu"
5154
else:
@@ -107,8 +110,8 @@ def _load_single_library(lib_name: str,
107110
The loaded library or None if loading failed
108111
"""
109112
if DEBUG_LIBRARY_LOADING: # pragma: no cover
110-
logger.info(
111-
f"Searching for library '{lib_name}' in paths: {[str(p) for p in search_paths]}")
113+
logger.info(f"Searching for library '{lib_name}' in paths: {
114+
[str(p) for p in search_paths]}")
112115
current_arch = _get_architecture()
113116
if DEBUG_LIBRARY_LOADING: # pragma: no cover
114117
logger.info(f"Current architecture: {current_arch}")
@@ -125,8 +128,8 @@ def _load_single_library(lib_name: str,
125128
except Exception as e:
126129
error_msg = str(e)
127130
if "incompatible architecture" in error_msg:
128-
logger.error(
129-
f"Architecture mismatch: Library at {lib_path} is not compatible with current architecture {current_arch}")
131+
logger.error(f"Architecture mismatch: Library at {
132+
lib_path} is not compatible with current architecture {current_arch}")
130133
logger.error(f"Error details: {error_msg}")
131134
else:
132135
logger.error(
@@ -224,8 +227,8 @@ def dynamically_load_library(
224227
if lib:
225228
return lib
226229
else:
227-
logger.error(
228-
f"Could not find library {env_lib_name} in any of the search paths")
230+
logger.error(f"Could not find library {
231+
env_lib_name} in any of the search paths")
229232
# Continue with normal loading if environment variable library
230233
# name fails
231234
except Exception as e:
@@ -241,18 +244,20 @@ def dynamically_load_library(
241244
if not lib:
242245
platform_id = get_platform_identifier()
243246
current_arch = _get_architecture()
244-
logger.error(
245-
f"Could not find {lib_name} in any of the search paths: {[str(p) for p in possible_paths]}")
247+
logger.error(f"Could not find {lib_name} in any of the search paths: {
248+
[str(p) for p in possible_paths]}")
246249
logger.error(
247250
f"Platform: {platform_id}, Architecture: {current_arch}")
248-
raise RuntimeError(
249-
f"Could not find {lib_name} in any of the search paths (Platform: {platform_id}, Architecture: {current_arch})")
251+
raise RuntimeError(f"Could not find {lib_name} in any of the search paths (Platform: {
252+
platform_id}, Architecture: {current_arch})")
250253
return lib
251254

252255
# Default path (no library name provided in the environment)
253256
c2pa_lib = _load_single_library(c2pa_lib_name, possible_paths)
254257
if not c2pa_lib:
255-
logger.error(f"Could not find {c2pa_lib_name} in any of the search paths: {[str(p) for p in possible_paths]}")
256-
raise RuntimeError(f"Could not find {c2pa_lib_name} in any of the search paths")
258+
logger.error(f"Could not find {c2pa_lib_name} in any of the search paths: {
259+
[str(p) for p in possible_paths]}")
260+
raise RuntimeError(
261+
f"Could not find {c2pa_lib_name} in any of the search paths")
257262

258263
return c2pa_lib

0 commit comments

Comments
 (0)