Skip to content

Commit c639d7f

Browse files
committed
fix: Code reorg merging conflicts
1 parent 596dfad commit c639d7f

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

src/c2pa/c2pa.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,50 +2066,6 @@ def get_supported_mime_types(cls) -> list[str]:
20662066

20672067
return cls._supported_mime_types_cache
20682068

2069-
def __init__(self, manifest_json: Any):
2070-
"""Initialize a new Builder instance.
2071-
2072-
Args:
2073-
manifest_json: The manifest JSON definition (string or dict)
2074-
2075-
Raises:
2076-
C2paError: If there was an error creating the builder
2077-
C2paError.Encoding: If manifest JSON contains invalid UTF-8 chars
2078-
C2paError.Json: If the manifest JSON cannot be serialized
2079-
"""
2080-
self._closed = False
2081-
self._initialized = False
2082-
self._builder = None
2083-
2084-
if not isinstance(manifest_json, str):
2085-
try:
2086-
manifest_json = json.dumps(manifest_json)
2087-
except (TypeError, ValueError) as e:
2088-
raise C2paError.Json(
2089-
Builder._ERROR_MESSAGES['json_error'].format(
2090-
str(e)))
2091-
2092-
try:
2093-
json_str = manifest_json.encode('utf-8')
2094-
except UnicodeError as e:
2095-
raise C2paError.Encoding(
2096-
Builder._ERROR_MESSAGES['encoding_error'].format(
2097-
str(e)))
2098-
2099-
self._builder = _lib.c2pa_builder_from_json(json_str)
2100-
2101-
if not self._builder:
2102-
error = _parse_operation_result_for_error(_lib.c2pa_error())
2103-
if error:
2104-
raise C2paError(error)
2105-
raise C2paError(
2106-
Builder._ERROR_MESSAGES['builder_error'].format(
2107-
"Unknown error"
2108-
)
2109-
)
2110-
2111-
self._initialized = True
2112-
21132069
@classmethod
21142070
def from_json(cls, manifest_json: Any) -> 'Builder':
21152071
"""Create a new Builder from a JSON manifest.
@@ -2276,13 +2232,6 @@ def close(self):
22762232
finally:
22772233
self._closed = True
22782234

2279-
def __enter__(self):
2280-
self._ensure_valid_state()
2281-
return self
2282-
2283-
def __exit__(self, exc_type, exc_val, exc_tb):
2284-
self.close()
2285-
22862235
def set_no_embed(self):
22872236
"""Set the no-embed flag.
22882237

0 commit comments

Comments
 (0)