Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 78e4d96

Browse files
authored
Add missing type definitions for scripts in docker folder (#12280)
Signed-off-by: Jorge Florian <[email protected]>
1 parent 7732c49 commit 78e4d96

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

changelog.d/12280.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add missing type definitions for scripts in docker folder. Contributed by Jorge Florian.

docker/configure_workers_and_start.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
2929
import os
3030
import subprocess
3131
import sys
32+
from typing import Any, Dict, Set
3233

3334
import jinja2
3435
import yaml
3536

3637
MAIN_PROCESS_HTTP_LISTENER_PORT = 8080
3738

3839

39-
WORKERS_CONFIG = {
40+
WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
4041
"pusher": {
4142
"app": "synapse.app.pusher",
4243
"listener_resources": [],
@@ -355,7 +356,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
355356
# worker_type: {1234, 1235, ...}}
356357
# }
357358
# and will be used to construct 'upstream' nginx directives.
358-
nginx_upstreams = {}
359+
nginx_upstreams: Dict[str, Set[int]] = {}
359360

360361
# A map of: {"endpoint": "upstream"}, where "upstream" is a str representing what will be
361362
# placed after the proxy_pass directive. The main benefit to representing this data as a
@@ -384,7 +385,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
384385
# A counter of worker_type -> int. Used for determining the name for a given
385386
# worker type when generating its config file, as each worker's name is just
386387
# worker_type + instance #
387-
worker_type_counter = {}
388+
worker_type_counter: Dict[str, int] = {}
388389

389390
# For each worker type specified by the user, create config values
390391
for worker_type in worker_types:
@@ -404,7 +405,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
404405
# e.g. federation_reader1
405406
worker_name = worker_type + str(new_worker_count)
406407
worker_config.update(
407-
{"name": worker_name, "port": worker_port, "config_path": config_path}
408+
{"name": worker_name, "port": str(worker_port), "config_path": config_path}
408409
)
409410

410411
# Update the shared config with any worker-type specific options

mypy.ini

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local_partial_types = True
1111
no_implicit_optional = True
1212

1313
files =
14+
docker/,
1415
scripts-dev/,
1516
setup.py,
1617
synapse/,

0 commit comments

Comments
 (0)