Skip to content

Commit a428641

Browse files
committed
fix: pr review
1 parent 8c5ce8c commit a428641

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

python_on_whales/components/buildx/imagetools/cli_wrapper.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create(
2020
sources: List[str] = [],
2121
tags: List[str] = [],
2222
append: bool = False,
23-
annotations: Optional[Dict[str, str]] = None,
23+
annotations: Dict[str, str] = {},
2424
files: List[Union[str, Path]] = [],
2525
dry_run: bool = False,
2626
builder: Optional[str] = None,
@@ -54,17 +54,16 @@ def create(
5454
raise TypeError(
5555
"The argument 'files' of the function docker.buildx.imagetools.create() must be a list of strings."
5656
)
57-
if annotations is not None and not isinstance(annotations, dict):
57+
if not isinstance(annotations, dict):
5858
raise TypeError(
5959
"The argument 'annotations' of the function docker.buildx.imagetools.create() must be a dict."
6060
)
6161

6262
full_cmd = self.docker_cmd + ["buildx", "imagetools", "create"]
6363
for tag in tags:
6464
full_cmd.add_simple_arg("--tag", tag)
65-
if annotations:
66-
for key, value in annotations.items():
67-
full_cmd.add_simple_arg("--annotation", f"{key}={value}")
65+
for key, value in annotations.items():
66+
full_cmd.add_simple_arg("--annotation", f"{key}={value}")
6867
for file in files:
6968
full_cmd.add_simple_arg("--file", file)
7069
full_cmd.add_simple_arg("--builder", builder)

0 commit comments

Comments
 (0)