Skip to content

Commit

Permalink
[type hints] RepositoryDefinition (#20366)
Browse files Browse the repository at this point in the history
## How I Tested These Changes

pyright
  • Loading branch information
alangenfeld authored Mar 8, 2024
1 parent 076cd7b commit 0562933
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 0562933

Please sign in to comment.