Skip to content

Commit

Permalink
style: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Jun 10, 2024
1 parent 6a9863f commit 0af9805
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions charmcraft/application/commands/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from tabulate import tabulate

import charmcraft.store.models
from charmcraft import const, env, errors, parts, services, utils
from charmcraft import const, env, errors, parts, utils
from charmcraft.application.commands.base import CharmcraftCommand
from charmcraft.models import project
from charmcraft.store import Store
Expand Down Expand Up @@ -1949,7 +1949,7 @@ def run(self, parsed_args: argparse.Namespace) -> int:
elif parsed_args.image:
emit.progress("Getting image")
emit.debug("Trying to get image from Docker")
image_service = typing.cast(services.ImageService, self._services.image)
image_service = self._services.image
if digest := image_service.get_maybe_id_from_docker(parsed_args.image):
emit.debug("Image is available via the local Docker daemon.")
source_path = f"docker-daemon:{digest}"
Expand Down
11 changes: 7 additions & 4 deletions charmcraft/services/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
from collections.abc import Sequence

import craft_application
import docker
import docker.errors
import docker.models.images
import docker # type: ignore[import-untyped]
import docker.errors # type: ignore[import-untyped]
import docker.models.images # type: ignore[import-untyped]
from overrides import override

from charmcraft import const, errors, utils

Expand Down Expand Up @@ -63,7 +64,9 @@ def __init__(

self._skopeo_path = shutil.which("skopeo") or ""

@override
def setup(self) -> None:
"""Set up the image service."""
super().setup()
if not self._skopeo_path:
raise errors.CraftError(
Expand Down Expand Up @@ -105,7 +108,7 @@ def copy(
)

def get_maybe_id_from_docker(self, name: str) -> str | None:
"""Get the ID of an image from Docker
"""Get the ID of an image from Docker.
:param name: Any string Docker recognises as the image name.
:returns: An image digest or None
Expand Down

0 comments on commit 0af9805

Please sign in to comment.