Skip to content

Commit

Permalink
Typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Dec 10, 2024
1 parent 82d24e3 commit 3e66566
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gotenberg_client/_convert/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import Dict
from typing import Final
from typing import Iterable
Expand Down Expand Up @@ -345,12 +344,12 @@ def metadata(
raise InvalidKeywordError("Keywords cannot contain commas") # noqa: EM101, TRY003

# Get existing metadata if any
existing_metadata: Dict[str, Any] = {}
if "metadata" in self._form_data:
existing_metadata = json.loads(self._form_data["metadata"])
existing_metadata: Dict[str, Union[str, bool, float]] = {}
if "metadata" in self._form_data: # type: ignore[attr-defined,misc]
existing_metadata = json.loads(self._form_data["metadata"]) # type: ignore[attr-defined,misc]

# Convert validated metadata to dictionary
metadata: Dict[str, Any] = {}
metadata: Dict[str, Union[str, bool, float]] = {}

if author:
metadata["Author"] = author
Expand Down Expand Up @@ -379,6 +378,6 @@ def metadata(

# Merge existing and new metadata
if metadata:
self._form_data.update({"metadata": json.dumps({**existing_metadata, **metadata})})
self._form_data.update({"metadata": json.dumps({**existing_metadata, **metadata})}) # type: ignore[attr-defined,misc]

return self

0 comments on commit 3e66566

Please sign in to comment.