typecheck twisted
This commit is contained in:
parent
c48efb2b25
commit
b2467c4ac5
|
@ -287,7 +287,7 @@ class ReloadGithubProjects(steps.BuildStep):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def run(self) -> Generator[Any, object, Any]:
|
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 = ""
|
self.error_msg = ""
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase):
|
||||||
endpoint_object: Any,
|
endpoint_object: Any,
|
||||||
endpoint_dict: dict[str, Any],
|
endpoint_dict: dict[str, Any],
|
||||||
object_type: str,
|
object_type: str,
|
||||||
) -> Generator[Any, Any, Any]:
|
) -> Generator[defer.Deferred[Match], Any, Any]:
|
||||||
res = yield endpoint_object.get({}, endpoint_dict)
|
res = yield endpoint_object.get({}, endpoint_dict)
|
||||||
if res is None:
|
if res is None:
|
||||||
return None
|
return None
|
||||||
|
@ -704,7 +704,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase):
|
||||||
epobject: Any,
|
epobject: Any,
|
||||||
epdict: dict[str, Any],
|
epdict: dict[str, Any],
|
||||||
options: dict[str, Any],
|
options: dict[str, Any],
|
||||||
) -> Generator[Any, Any, Any]:
|
) -> defer.Deferred[Match]:
|
||||||
return self.check_builder(epobject, epdict, "build")
|
return self.check_builder(epobject, epdict, "build")
|
||||||
|
|
||||||
def match_BuildEndpoint_stop( # noqa: N802
|
def match_BuildEndpoint_stop( # noqa: N802
|
||||||
|
@ -712,7 +712,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase):
|
||||||
epobject: Any,
|
epobject: Any,
|
||||||
epdict: dict[str, Any],
|
epdict: dict[str, Any],
|
||||||
options: dict[str, Any],
|
options: dict[str, Any],
|
||||||
) -> Generator[Any, Any, Any]:
|
) -> defer.Deferred[Match]:
|
||||||
return self.check_builder(epobject, epdict, "build")
|
return self.check_builder(epobject, epdict, "build")
|
||||||
|
|
||||||
def match_BuildRequestEndpoint_stop( # noqa: N802
|
def match_BuildRequestEndpoint_stop( # noqa: N802
|
||||||
|
@ -720,7 +720,7 @@ class AnyProjectEndpointMatcher(EndpointMatcherBase):
|
||||||
epobject: Any,
|
epobject: Any,
|
||||||
epdict: dict[str, Any],
|
epdict: dict[str, Any],
|
||||||
options: dict[str, Any],
|
options: dict[str, Any],
|
||||||
) -> Generator[Any, Any, Any]:
|
) -> defer.Deferred[Match]:
|
||||||
return self.check_builder(epobject, epdict, "buildrequest")
|
return self.check_builder(epobject, epdict, "buildrequest")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from buildbot_worker.bot import Worker
|
from buildbot_worker.bot import Worker
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
|
from twisted.python import components
|
||||||
|
|
||||||
|
|
||||||
def require_env(key: str) -> str:
|
def require_env(key: str) -> str:
|
||||||
|
@ -31,7 +32,7 @@ class WorkerConfig:
|
||||||
|
|
||||||
|
|
||||||
def setup_worker(
|
def setup_worker(
|
||||||
application: service.Application,
|
application: components.Componentized,
|
||||||
builder_id: int,
|
builder_id: int,
|
||||||
config: WorkerConfig,
|
config: WorkerConfig,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -64,12 +65,12 @@ def setup_worker(
|
||||||
s.setServiceParent(application)
|
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):
|
for i in range(config.worker_count):
|
||||||
setup_worker(application, i, config)
|
setup_worker(application, i, config)
|
||||||
|
|
||||||
|
|
||||||
# note: this line is matched against to check that this is a worker
|
# note: this line is matched against to check that this is a worker
|
||||||
# directory; do not edit it.
|
# directory; do not edit it.
|
||||||
application = service.Application("buildbot-worker")
|
application = service.Application("buildbot-worker") # type: ignore[no-untyped-call]
|
||||||
setup_workers(application, WorkerConfig())
|
setup_workers(application, WorkerConfig())
|
||||||
|
|
|
@ -10,8 +10,12 @@
|
||||||
programs.deno.enable = true;
|
programs.deno.enable = true;
|
||||||
settings.formatter.shellcheck.options = [ "-s" "bash" ];
|
settings.formatter.shellcheck.options = [ "-s" "bash" ];
|
||||||
|
|
||||||
programs.mypy.enable = true;
|
programs.mypy = {
|
||||||
programs.mypy.directories."." = { };
|
enable = true;
|
||||||
|
directories.".".extraPythonPackages = [
|
||||||
|
pkgs.python3.pkgs.twisted
|
||||||
|
];
|
||||||
|
};
|
||||||
settings.formatter.python = {
|
settings.formatter.python = {
|
||||||
command = "sh";
|
command = "sh";
|
||||||
options = [
|
options = [
|
||||||
|
|
|
@ -100,7 +100,3 @@ ignore_missing_imports = true
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = "buildbot_worker.*"
|
module = "buildbot_worker.*"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
|
||||||
module = "twisted.*"
|
|
||||||
ignore_missing_imports = true
|
|
||||||
|
|
Loading…
Reference in a new issue