From a8832cb9201f2088f9dab08fbce6f0a2cffa212b Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 17 May 2022 07:42:35 -0400 Subject: [PATCH] Added missing __init__ annotations. Signed-off-by: dblock --- src/build_workflow/build_recorder.py | 4 ++-- src/ci_workflow/ci_check_list_source.py | 2 +- src/manifests/build/build_manifest_1_0.py | 6 +++--- src/manifests/build/build_manifest_1_1.py | 6 +++--- src/manifests/build_manifest.py | 6 +++--- src/manifests/bundle/bundle_manifest_1_0.py | 6 +++--- src/manifests/bundle_manifest.py | 4 ++-- src/manifests/distribution.py | 2 +- src/manifests/input_manifest.py | 12 ++++++------ src/manifests/manifests.py | 2 +- src/manifests/test_manifest.py | 4 ++-- src/sign_workflow/sign_artifacts.py | 2 +- src/system/temporary_directory.py | 2 +- .../bwc_test/bwc_test_runner_opensearch.py | 2 +- src/test_workflow/dependency_installer_opensearch.py | 2 +- .../dependency_installer_opensearch_dashboards.py | 2 +- .../integ_test_runner_opensearch_dashboards.py | 2 +- .../integ_test_start_properties_opensearch.py | 2 +- .../perf_test/perf_test_cluster_config.py | 2 +- src/test_workflow/test_recorder/test_recorder.py | 4 ++-- src/test_workflow/test_result/test_result.py | 2 +- 21 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/build_workflow/build_recorder.py b/src/build_workflow/build_recorder.py index 3e6fcee5e5..d3118a8513 100644 --- a/src/build_workflow/build_recorder.py +++ b/src/build_workflow/build_recorder.py @@ -16,7 +16,7 @@ class BuildRecorder: - def __init__(self, target: BuildTarget): + def __init__(self, target: BuildTarget) -> None: self.build_manifest = self.BuildManifestBuilder(target) self.target = target self.name = target.name @@ -52,7 +52,7 @@ def write_manifest(self) -> None: logging.info(f"Created build manifest {manifest_path}") class BuildManifestBuilder: - def __init__(self, target: BuildTarget): + def __init__(self, target: BuildTarget) -> None: self.data: Dict[str, Any] = {} self.data["build"] = {} self.data["build"]["id"] = target.build_id diff --git a/src/ci_workflow/ci_check_list_source.py b/src/ci_workflow/ci_check_list_source.py index 1d9467aba5..a2ada40218 100644 --- a/src/ci_workflow/ci_check_list_source.py +++ b/src/ci_workflow/ci_check_list_source.py @@ -31,7 +31,7 @@ def checkout(self, work_dir: str) -> None: } class InvalidCheckError(Exception): - def __init__(self, check: Any): + def __init__(self, check: Any) -> None: self.check = check super().__init__(f"Invalid check: {check.name}, must be one of {CiCheckListSource.CHECKS.keys()}.") diff --git a/src/manifests/build/build_manifest_1_0.py b/src/manifests/build/build_manifest_1_0.py index 78d4ed0cfe..d89200e51b 100644 --- a/src/manifests/build/build_manifest_1_0.py +++ b/src/manifests/build/build_manifest_1_0.py @@ -75,7 +75,7 @@ class BuildManifest_1_0(ComponentManifest['BuildManifest_1_0', 'BuildComponents_ }, } - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.build = self.Build(data["build"]) self.components = BuildComponents_1_0(data.get("components", [])) # type: ignore[assignment] @@ -88,7 +88,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name: str = data["name"] self.version = data["version"] self.architecture = data["architecture"] @@ -114,7 +114,7 @@ def __create__(self, data: Any) -> 'BuildComponent_1_0': class BuildComponent_1_0(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.repository = data["repository"] self.ref = data["ref"] diff --git a/src/manifests/build/build_manifest_1_1.py b/src/manifests/build/build_manifest_1_1.py index 586e43f73d..8b9b80884c 100644 --- a/src/manifests/build/build_manifest_1_1.py +++ b/src/manifests/build/build_manifest_1_1.py @@ -76,7 +76,7 @@ class BuildManifest_1_1(ComponentManifest['BuildManifest_1_1', 'BuildComponents_ }, } - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.build = self.Build(data["build"]) self.components = BuildComponents_1_1(data.get("components", [])) # type: ignore[assignment] @@ -89,7 +89,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name: str = data["name"] self.version = data["version"] self.architecture = data["architecture"] @@ -115,7 +115,7 @@ def __create__(self, data: Any) -> 'BuildComponent_1_1': class BuildComponent_1_1(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.repository = data["repository"] self.ref = data["ref"] diff --git a/src/manifests/build_manifest.py b/src/manifests/build_manifest.py index 53a9de770a..f85021bb84 100644 --- a/src/manifests/build_manifest.py +++ b/src/manifests/build_manifest.py @@ -89,7 +89,7 @@ class BuildManifest(ComponentManifest['BuildManifest', 'BuildComponents']): }, } - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.build = self.Build(data["build"]) self.components = BuildComponents(data.get("components", [])) # type: ignore[assignment] @@ -102,7 +102,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name: str = data["name"] self.version: str = data["version"] self.platform: str = data["platform"] @@ -132,7 +132,7 @@ def __create__(self, data: Any) -> 'BuildComponent': class BuildComponent(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.repository = data["repository"] self.ref = data["ref"] diff --git a/src/manifests/bundle/bundle_manifest_1_0.py b/src/manifests/bundle/bundle_manifest_1_0.py index 2284f38e0a..dd254e4996 100644 --- a/src/manifests/bundle/bundle_manifest_1_0.py +++ b/src/manifests/bundle/bundle_manifest_1_0.py @@ -59,7 +59,7 @@ class BundleManifest_1_0(ComponentManifest['BundleManifest_1_0', 'BundleComponen }, } - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.build = self.Build(data["build"]) self.components = BundleComponents_1_0(data.get("components", [])) # type: ignore[assignment] @@ -72,7 +72,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name = data["name"] self.version = data["version"] self.architecture = data["architecture"] @@ -96,7 +96,7 @@ def __create__(self, data: Any) -> 'BundleComponent_1_0': class BundleComponent_1_0(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.repository = data["repository"] self.ref = data["ref"] diff --git a/src/manifests/bundle_manifest.py b/src/manifests/bundle_manifest.py index 6c3e538eea..26daaf61b7 100644 --- a/src/manifests/bundle_manifest.py +++ b/src/manifests/bundle_manifest.py @@ -78,7 +78,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Dict[str, str]): + def __init__(self, data: Dict[str, str]) -> None: self.name = data["name"] self.version = data["version"] self.platform = data["platform"] @@ -110,7 +110,7 @@ def __create__(self, data: Any) -> 'BundleComponent': class BundleComponent(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.repository = data["repository"] self.ref = data["ref"] diff --git a/src/manifests/distribution.py b/src/manifests/distribution.py index e41a763caa..5fc78a5711 100644 --- a/src/manifests/distribution.py +++ b/src/manifests/distribution.py @@ -4,7 +4,7 @@ class DistributionNotFound(Exception): - def __init__(self, urls: List[str]): + def __init__(self, urls: List[str]) -> None: self.urls = urls super().__init__(f"Unable to find a distribution under urls {self.urls}") diff --git a/src/manifests/input_manifest.py b/src/manifests/input_manifest.py index cd232dbc99..f3bcbd3022 100644 --- a/src/manifests/input_manifest.py +++ b/src/manifests/input_manifest.py @@ -101,7 +101,7 @@ class InputManifest(ComponentManifest['InputManifest', 'InputComponents']): }, } - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.build = self.Build(data["build"]) @@ -123,14 +123,14 @@ def stable(self) -> 'InputManifest': return manifest class Ci: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.image = None if data is None else self.Image(data.get("image", None)) def __to_dict__(self) -> Optional[dict]: return None if self.image is None else {"image": self.image.__to_dict__()} class Image: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name = data["name"] self.args = data.get("args", None) @@ -141,7 +141,7 @@ def __to_dict__(self) -> dict: } class Build: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name: str = data["name"] self.version = data["version"] self.qualifier = data.get("qualifier", None) @@ -199,7 +199,7 @@ def select(self, focus: List[str] = [], platform: str = None) -> Iterator['Input class InputComponent(Component): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.platforms = data.get("platforms", None) self.checks = list(map(lambda entry: Check(entry), data.get("checks", []))) @@ -255,7 +255,7 @@ def __to_dict__(self) -> dict: class InputComponentFromDist(InputComponent): - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: super().__init__(data) self.dist = data["dist"] diff --git a/src/manifests/manifests.py b/src/manifests/manifests.py index 3a811b5910..38b5e86314 100644 --- a/src/manifests/manifests.py +++ b/src/manifests/manifests.py @@ -16,7 +16,7 @@ class Manifests(SortedDict, Generic[T]): - def __init__(self, klass: Any, files: List[str]): + def __init__(self, klass: Any, files: List[str]) -> None: super(Manifests, self).__init__() self.klass = klass self.__append__(files) diff --git a/src/manifests/test_manifest.py b/src/manifests/test_manifest.py index 6ebcf75050..42588a3c1f 100644 --- a/src/manifests/test_manifest.py +++ b/src/manifests/test_manifest.py @@ -92,14 +92,14 @@ def __to_dict__(self) -> dict: } class Ci: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.image = None if data is None else self.Image(data.get("image", None)) def __to_dict__(self) -> Optional[dict]: return None if self.image is None else {"image": self.image.__to_dict__()} class Image: - def __init__(self, data: Any): + def __init__(self, data: Any) -> None: self.name = data["name"] self.args = data.get("args", None) diff --git a/src/sign_workflow/sign_artifacts.py b/src/sign_workflow/sign_artifacts.py index 1980552ff0..7355926d8b 100644 --- a/src/sign_workflow/sign_artifacts.py +++ b/src/sign_workflow/sign_artifacts.py @@ -23,7 +23,7 @@ class SignArtifacts: signature_type: str signer: Signer - def __init__(self, target: Path, components: List[str], artifact_type: str, signature_type: str, signer: Signer): + def __init__(self, target: Path, components: List[str], artifact_type: str, signature_type: str, signer: Signer) -> None: self.target = target self.components = components self.artifact_type = artifact_type diff --git a/src/system/temporary_directory.py b/src/system/temporary_directory.py index 511a66b66e..aff46393d8 100644 --- a/src/system/temporary_directory.py +++ b/src/system/temporary_directory.py @@ -25,7 +25,7 @@ def g__handleRemoveReadonly(func: FunctionType, path: str, exc: Any) -> Any: class TemporaryDirectory: - def __init__(self, keep: bool = False, chdir: bool = False): + def __init__(self, keep: bool = False, chdir: bool = False) -> None: self.keep = keep self.name = tempfile.mkdtemp() if chdir: diff --git a/src/test_workflow/bwc_test/bwc_test_runner_opensearch.py b/src/test_workflow/bwc_test/bwc_test_runner_opensearch.py index c40f459f2d..dcf4712ad9 100644 --- a/src/test_workflow/bwc_test/bwc_test_runner_opensearch.py +++ b/src/test_workflow/bwc_test/bwc_test_runner_opensearch.py @@ -19,7 +19,7 @@ class BwcTestRunnerOpenSearch(BwcTestRunner): - def __init__(self, args: TestArgs, test_manifest: TestManifest): + def __init__(self, args: TestArgs, test_manifest: TestManifest) -> None: self.properties = BwcTestStartPropertiesOpenSearch(args.paths.get("opensearch", os.getcwd())) super().__init__(args, test_manifest, self.properties.build_manifest.components) logging.info("Entering BWC test for OpenSearch") diff --git a/src/test_workflow/dependency_installer_opensearch.py b/src/test_workflow/dependency_installer_opensearch.py index c2a6789ef1..0a7c5e9fa2 100644 --- a/src/test_workflow/dependency_installer_opensearch.py +++ b/src/test_workflow/dependency_installer_opensearch.py @@ -13,7 +13,7 @@ class DependencyInstallerOpenSearch(DependencyInstaller): - def __init__(self, root_url: str, build_manifest: BuildManifest, bundle_manifest: BundleManifest): + def __init__(self, root_url: str, build_manifest: BuildManifest, bundle_manifest: BundleManifest) -> None: super().__init__(root_url, build_manifest, bundle_manifest) @property diff --git a/src/test_workflow/dependency_installer_opensearch_dashboards.py b/src/test_workflow/dependency_installer_opensearch_dashboards.py index e096991db4..fe40b193f4 100644 --- a/src/test_workflow/dependency_installer_opensearch_dashboards.py +++ b/src/test_workflow/dependency_installer_opensearch_dashboards.py @@ -11,5 +11,5 @@ class DependencyInstallerOpenSearchDashboards(DependencyInstaller): - def __init__(self, root_url: str, build_manifest: BuildManifest, bundle_manifest: BundleManifest): + def __init__(self, root_url: str, build_manifest: BuildManifest, bundle_manifest: BundleManifest) -> None: super().__init__(root_url, build_manifest, bundle_manifest) diff --git a/src/test_workflow/integ_test/integ_test_runner_opensearch_dashboards.py b/src/test_workflow/integ_test/integ_test_runner_opensearch_dashboards.py index b4e322cff8..8eac303034 100644 --- a/src/test_workflow/integ_test/integ_test_runner_opensearch_dashboards.py +++ b/src/test_workflow/integ_test/integ_test_runner_opensearch_dashboards.py @@ -20,7 +20,7 @@ class IntegTestRunnerOpenSearchDashboards(IntegTestRunner): properties: IntegTestStartPropertiesOpenSearchDashboards properties_dependency: IntegTestStartPropertiesOpenSearch - def __init__(self, args: TestArgs, test_manifest: TestManifest): + def __init__(self, args: TestArgs, test_manifest: TestManifest) -> None: self.properties_dependency = IntegTestStartPropertiesOpenSearch(args.paths.get("opensearch", os.getcwd())) self.properties = IntegTestStartPropertiesOpenSearchDashboards(args.paths.get("opensearch-dashboards", os.getcwd())) super().__init__(args, test_manifest, self.properties.build_manifest.components) diff --git a/src/test_workflow/integ_test/integ_test_start_properties_opensearch.py b/src/test_workflow/integ_test/integ_test_start_properties_opensearch.py index 3860d84b3c..f120a2b7b7 100644 --- a/src/test_workflow/integ_test/integ_test_start_properties_opensearch.py +++ b/src/test_workflow/integ_test/integ_test_start_properties_opensearch.py @@ -11,6 +11,6 @@ class IntegTestStartPropertiesOpenSearch(IntegTestStartProperties): dependency_installer: DependencyInstallerOpenSearch - def __init__(self, path: str): + def __init__(self, path: str) -> None: super().__init__(path, "builds/opensearch/manifest.yml", "dist/opensearch/manifest.yml") self.dependency_installer = DependencyInstallerOpenSearch(self.path, self.build_manifest, self.bundle_manifest) diff --git a/src/test_workflow/perf_test/perf_test_cluster_config.py b/src/test_workflow/perf_test/perf_test_cluster_config.py index 5574e505e3..3cce942ff7 100644 --- a/src/test_workflow/perf_test/perf_test_cluster_config.py +++ b/src/test_workflow/perf_test/perf_test_cluster_config.py @@ -15,7 +15,7 @@ class PerfTestClusterConfig(): """ Maintains the cluster level configuration. """ - def __init__(self, security: bool = False, data_nodes: int = 1, master_nodes: int = 0, ingest_nodes: int = 0, client_nodes: int = 0): + def __init__(self, security: bool = False, data_nodes: int = 1, master_nodes: int = 0, ingest_nodes: int = 0, client_nodes: int = 0) -> None: self.security = security self.data_nodes = data_nodes self.master_nodes = master_nodes diff --git a/src/test_workflow/test_recorder/test_recorder.py b/src/test_workflow/test_recorder/test_recorder.py index 7d74016fe3..9a1b48af29 100644 --- a/src/test_workflow/test_recorder/test_recorder.py +++ b/src/test_workflow/test_recorder/test_recorder.py @@ -90,7 +90,7 @@ def save_test_result_data(self, test_result_data: TestResultData) -> None: class RemoteClusterLogs(LogRecorder): parent_class: TestRecorder - def __init__(self, parent_class: TestRecorder): + def __init__(self, parent_class: TestRecorder) -> None: self.parent_class = parent_class def save_test_result_data(self, test_result_data: TestResultData) -> None: @@ -107,7 +107,7 @@ def save_test_result_data(self, test_result_data: TestResultData) -> None: class TestResultsLogs(LogRecorder): parent_class: TestRecorder - def __init__(self, parent_class: TestRecorder): + def __init__(self, parent_class: TestRecorder) -> None: self.parent_class = parent_class def save_test_result_data(self, test_result_data: TestResultData) -> None: diff --git a/src/test_workflow/test_result/test_result.py b/src/test_workflow/test_result/test_result.py index d8c5ad0f2e..49dc778406 100644 --- a/src/test_workflow/test_result/test_result.py +++ b/src/test_workflow/test_result/test_result.py @@ -7,7 +7,7 @@ class TestResult: config: dict status: int - def __init__(self, component: str, config: dict, status: int): + def __init__(self, component: str, config: dict, status: int) -> None: self.component = component self.config = config self.status = status