typecheck twisted

This commit is contained in:
Jörg Thalheim 2024-01-01 08:32:22 +01:00 committed by mergify[bot]
parent c48efb2b25
commit b2467c4ac5
4 changed files with 15 additions and 14 deletions

View file

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

View file

@ -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())

View file

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

View file

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