diff --git a/buildbot_nix/__init__.py b/buildbot_nix/__init__.py index 016ca40..06fffe1 100644 --- a/buildbot_nix/__init__.py +++ b/buildbot_nix/__init__.py @@ -287,7 +287,7 @@ class ReloadGithubProjects(steps.BuildStep): @defer.inlineCallbacks def run(self) -> Generator[Any, object, Any]: - d = threads.deferToThread(self.reload_projects) + d = threads.deferToThread(self.reload_projects) # type: ignore[no-untyped-call] self.error_msg = "" @@ -677,7 +677,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase): endpoint_object: Any, endpoint_dict: dict[str, Any], object_type: str, - ) -> Generator[Any, Any, Any]: + ) -> Generator[defer.Deferred[Match], Any, Any]: res = yield endpoint_object.get({}, endpoint_dict) if res is None: return None @@ -704,7 +704,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase): epobject: Any, epdict: dict[str, Any], options: dict[str, Any], - ) -> Generator[Any, Any, Any]: + ) -> defer.Deferred[Match]: return self.check_builder(epobject, epdict, "build") def match_BuildEndpoint_stop( # noqa: N802 @@ -712,7 +712,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase): epobject: Any, epdict: dict[str, Any], options: dict[str, Any], - ) -> Generator[Any, Any, Any]: + ) -> defer.Deferred[Match]: return self.check_builder(epobject, epdict, "build") def match_BuildRequestEndpoint_stop( # noqa: N802 @@ -720,7 +720,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase): epobject: Any, epdict: dict[str, Any], options: dict[str, Any], - ) -> Generator[Any, Any, Any]: + ) -> defer.Deferred[Match]: return self.check_builder(epobject, epdict, "buildrequest") diff --git a/buildbot_nix/worker.py b/buildbot_nix/worker.py index 749d2aa..3f7139d 100644 --- a/buildbot_nix/worker.py +++ b/buildbot_nix/worker.py @@ -6,6 +6,7 @@ from pathlib import Path from buildbot_worker.bot import Worker from twisted.application import service +from twisted.python import components def require_env(key: str) -> str: @@ -31,7 +32,7 @@ class WorkerConfig: def setup_worker( - application: service.Application, + application: components.Componentized, builder_id: int, config: WorkerConfig, ) -> None: @@ -64,12 +65,12 @@ def setup_worker( s.setServiceParent(application) -def setup_workers(application: service.Application, config: WorkerConfig) -> None: +def setup_workers(application: components.Componentized, config: WorkerConfig) -> None: for i in range(config.worker_count): setup_worker(application, i, config) # note: this line is matched against to check that this is a worker # directory; do not edit it. -application = service.Application("buildbot-worker") +application = service.Application("buildbot-worker") # type: ignore[no-untyped-call] setup_workers(application, WorkerConfig()) diff --git a/nix/treefmt/flake-module.nix b/nix/treefmt/flake-module.nix index 258a0e7..4aef50e 100644 --- a/nix/treefmt/flake-module.nix +++ b/nix/treefmt/flake-module.nix @@ -10,8 +10,12 @@ programs.deno.enable = true; settings.formatter.shellcheck.options = [ "-s" "bash" ]; - programs.mypy.enable = true; - programs.mypy.directories."." = { }; + programs.mypy = { + enable = true; + directories.".".extraPythonPackages = [ + pkgs.python3.pkgs.twisted + ]; + }; settings.formatter.python = { command = "sh"; options = [ diff --git a/pyproject.toml b/pyproject.toml index 727cfef..8ceda80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,7 +100,3 @@ ignore_missing_imports = true [[tool.mypy.overrides]] module = "buildbot_worker.*" ignore_missing_imports = true - -[[tool.mypy.overrides]] -module = "twisted.*" -ignore_missing_imports = true