Skip to content

Commit

Permalink
ci(linters): address more pyright warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Matsuoka <[email protected]>
  • Loading branch information
cmatsuoka committed Sep 9, 2023
1 parent 1a507e1 commit 27e48d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions craft_application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _Dispatcher(craft_cli.Dispatcher):
@property
def parsed_args(self) -> argparse.Namespace:
"""The map of parsed command-line arguments."""
return self._parsed_command_args
return self._parsed_command_args or argparse.Namespace()


@final
Expand Down Expand Up @@ -129,7 +129,7 @@ def cache_dir(self) -> str:
# xdg types: https://github.com/python/typeshed/pull/10163
return save_cache_path(self.app.name) # type: ignore[no-any-return]

def _configure_services(self, build_for: str) -> None:
def _configure_services(self, build_for: str | None) -> None:
"""Configure additional keyword arguments for any service classes.
Any child classes that override this must either call this directly or must
Expand Down
3 changes: 1 addition & 2 deletions craft_application/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
This defines the structure of the input file (e.g. snapcraft.yaml)
"""
import abc
import dataclasses
from typing import Any, Dict, List, Optional, Union

Expand Down Expand Up @@ -80,6 +79,6 @@ def effective_base(self) -> Any: # noqa: ANN401 app specific classes can improv
return self.base
raise RuntimeError("Could not determine effective base")

@abc.abstractmethod
def get_build_plan(self) -> List[BuildInfo]:
"""Obtain the list of architectures and bases from the project file."""
raise NotImplementedError
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class MyProject(craft_application.models.Project):
def get_build_plan(self) -> list[models.BuildInfo]:
arch = craft_application.util.get_host_architecture()
arch = util.get_host_architecture()
return [models.BuildInfo(arch, arch, bases.BaseName("ubuntu", "22.04"))]


Expand All @@ -44,7 +44,7 @@ def app_metadata() -> craft_application.AppMetadata:
return craft_application.AppMetadata(
"testcraft",
"A fake app for testing craft-application",
ProjectClass=MyProject,
ProjectClass=models.Project(),
source_ignore_patterns=["*.snap", "*.charm", "*.starcraft"],
)

Expand Down

0 comments on commit 27e48d3

Please sign in to comment.