From 8079c011e50de7ccecdf928e21467d3fdc89d6be Mon Sep 17 00:00:00 2001 From: Hippolyte HENRY Date: Thu, 1 Jul 2021 13:58:33 +0200 Subject: [PATCH 1/3] Fix typing of `type_configuration_model_cls` --- src/cloudformation_cli_python_lib/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cloudformation_cli_python_lib/resource.py b/src/cloudformation_cli_python_lib/resource.py index 6017f4f3..74915781 100644 --- a/src/cloudformation_cli_python_lib/resource.py +++ b/src/cloudformation_cli_python_lib/resource.py @@ -60,7 +60,7 @@ def __init__( self, type_name: str, resouce_model_cls: Type[BaseModel], - type_configuration_model_cls: Optional[BaseModel] = None, + type_configuration_model_cls: Optional[Type[BaseModel]] = None, ) -> None: self.type_name = type_name self._model_cls: Type[BaseModel] = resouce_model_cls From ef3aeff10eb402e31e75eaa0ed394dd76c02c172 Mon Sep 17 00:00:00 2001 From: Anton Mokhovikov Date: Fri, 6 Aug 2021 21:45:08 -0700 Subject: [PATCH 2/3] Added Type[BaseModel] Annotation --- python/rpdk/python/codegen.py | 2 +- src/cloudformation_cli_python_lib/resource.py | 2 +- src/cloudformation_cli_python_lib/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/rpdk/python/codegen.py b/python/rpdk/python/codegen.py index 98cbc26d..aef930e8 100644 --- a/python/rpdk/python/codegen.py +++ b/python/rpdk/python/codegen.py @@ -170,7 +170,7 @@ def generate(self, project): LOG.debug("Generate complete") def _pre_package(self, build_path): - f = TemporaryFile("w+b") # pylint: disable=R1732 + f = TemporaryFile("w+b") with zipfile.ZipFile(f, mode="w") as zip_file: self._recursive_relative_write(build_path, build_path, zip_file) diff --git a/src/cloudformation_cli_python_lib/resource.py b/src/cloudformation_cli_python_lib/resource.py index 74915781..39c2abf5 100644 --- a/src/cloudformation_cli_python_lib/resource.py +++ b/src/cloudformation_cli_python_lib/resource.py @@ -65,7 +65,7 @@ def __init__( self.type_name = type_name self._model_cls: Type[BaseModel] = resouce_model_cls self._type_configuration_model_cls: Optional[ - BaseModel + Type[BaseModel] ] = type_configuration_model_cls self._handlers: MutableMapping[Action, HandlerSignature] = {} diff --git a/src/cloudformation_cli_python_lib/utils.py b/src/cloudformation_cli_python_lib/utils.py index be0987a8..c5cae14a 100644 --- a/src/cloudformation_cli_python_lib/utils.py +++ b/src/cloudformation_cli_python_lib/utils.py @@ -140,7 +140,7 @@ class UnmodelledRequest: def to_modelled( self, model_cls: Type[BaseModel], - type_configuration_model_cls: Optional[BaseModel], + type_configuration_model_cls: Optional[Type[BaseModel]], ) -> BaseResourceHandlerRequest: # pylint: disable=protected-access return BaseResourceHandlerRequest( From f51f1b4938e09cb3338db5668e657cefefdf88ec Mon Sep 17 00:00:00 2001 From: Anton Mokhovikov Date: Fri, 6 Aug 2021 22:04:35 -0700 Subject: [PATCH 3/3] fix linter issue --- python/rpdk/python/codegen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/rpdk/python/codegen.py b/python/rpdk/python/codegen.py index aef930e8..98cbc26d 100644 --- a/python/rpdk/python/codegen.py +++ b/python/rpdk/python/codegen.py @@ -170,7 +170,7 @@ def generate(self, project): LOG.debug("Generate complete") def _pre_package(self, build_path): - f = TemporaryFile("w+b") + f = TemporaryFile("w+b") # pylint: disable=R1732 with zipfile.ZipFile(f, mode="w") as zip_file: self._recursive_relative_write(build_path, build_path, zip_file)