From 05629330003ad84a487e34c48c5242efda0729c6 Mon Sep 17 00:00:00 2001 From: Alex Langenfeld Date: Fri, 8 Mar 2024 16:47:04 -0600 Subject: [PATCH] [type hints] RepositoryDefinition (#20366) ## How I Tested These Changes pyright --- .../decorators/repository_decorator.py | 2 +- .../repository_definition.py | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/decorators/repository_decorator.py b/python_modules/dagster/dagster/_core/definitions/decorators/repository_decorator.py index 357e26804f43c..a7865ced95d79 100644 --- a/python_modules/dagster/dagster/_core/definitions/decorators/repository_decorator.py +++ b/python_modules/dagster/dagster/_core/definitions/decorators/repository_decorator.py @@ -207,7 +207,7 @@ def __call__( name=self.name, description=self.description, metadata=self.metadata, - repository_data=repository_data, + repository_data=check.not_none(repository_data), ) update_wrapper(repository_def, fn) diff --git a/python_modules/dagster/dagster/_core/definitions/repository_definition/repository_definition.py b/python_modules/dagster/dagster/_core/definitions/repository_definition/repository_definition.py index b25c8a4aad18b..a9d0408e6bec8 100644 --- a/python_modules/dagster/dagster/_core/definitions/repository_definition/repository_definition.py +++ b/python_modules/dagster/dagster/_core/definitions/repository_definition/repository_definition.py @@ -97,18 +97,16 @@ class RepositoryDefinition: def __init__( self, - name, + name: str, *, - repository_data, - description=None, - metadata=None, - repository_load_data=None, + repository_data: RepositoryData, + description: Optional[str] = None, + metadata: Optional[Mapping[str, Any]] = None, + repository_load_data: Optional[RepositoryLoadData] = None, ): self._name = check_valid_name(name) self._description = check.opt_str_param(description, "description") - self._repository_data: RepositoryData = check.inst_param( - repository_data, "repository_data", RepositoryData - ) + self._repository_data = check.inst_param(repository_data, "repository_data", RepositoryData) self._metadata = check.opt_mapping_param(metadata, "metadata", key_type=str) self._repository_load_data = check.opt_inst_param( repository_load_data, "repository_load_data", RepositoryLoadData @@ -136,7 +134,7 @@ def metadata(self) -> Optional[MetadataMapping]: """Optional[MetadataMapping]: Arbitrary metadata for the repository.""" return self._metadata - def load_all_definitions(self): + def load_all_definitions(self) -> None: # force load of all lazy constructed code artifacts self._repository_data.load_all_definitions()