Skip to content

Commit

Permalink
typecheck twisted
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Jan 1, 2024
1 parent c48efb2 commit b2467c4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions buildbot_nix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def reload_projects(self) -> None:

@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 = ""

Expand Down Expand Up @@ -677,7 +677,7 @@ def check_builder(
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
Expand All @@ -704,23 +704,23 @@ def match_BuildEndpoint_rebuild( # noqa: N802
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
self,
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
self,
epobject: Any,
epdict: dict[str, Any],
options: dict[str, Any],
) -> Generator[Any, Any, Any]:
) -> defer.Deferred[Match]:
return self.check_builder(epobject, epdict, "buildrequest")


Expand Down
7 changes: 4 additions & 3 deletions buildbot_nix/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from buildbot_worker.bot import Worker
from twisted.application import service
from twisted.python import components


def require_env(key: str) -> str:
Expand All @@ -31,7 +32,7 @@ class WorkerConfig:


def setup_worker(
application: service.Application,
application: components.Componentized,
builder_id: int,
config: WorkerConfig,
) -> None:
Expand Down Expand Up @@ -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())
8 changes: 6 additions & 2 deletions nix/treefmt/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b2467c4

Please sign in to comment.