Skip to content

Commit

Permalink
refactor: remove all hostable mention from naming
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFarault committed Nov 21, 2024
1 parent 55df193 commit 55ae3b8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tdp/cli/commands/vars/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def edit(
# Check if component exists
entity_name = parse_entity_name(variables_file.stem)
if isinstance(entity_name, ServiceComponentName):
if entity_name not in collections.hostable_entities[service_name]:
if entity_name not in collections.entities[service_name]:
raise click.ClickException(
f"Error unknown component '{entity_name.component}' for service '{entity_name.service}'"
)
Expand Down
2 changes: 1 addition & 1 deletion tdp/cli/params/status/component_argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _check_component(
collections: Collections = ctx.params["collections"]
service: str = ctx.params["service"]
if value and value not in [
sc_name.component for sc_name in collections.hostable_entities[service]
sc_name.component for sc_name in collections.entities[service]
]:
raise click.UsageError(
f"Component '{value}' does not exists in service '{service}'."
Expand Down
6 changes: 3 additions & 3 deletions tdp/core/collections/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, collections: Iterable[CollectionReader]):
self._dag_operations, self._other_operations = self._init_operations()
self._default_var_directories = self._init_default_vars_dirs()
self._schemas = self._init_schemas()
self._services_components = self._init_hostable_entities()
self._services_components = self._init_entities()

@staticmethod
def from_collection_paths(
Expand Down Expand Up @@ -102,7 +102,7 @@ def schemas(self) -> dict[str, ServiceSchema]:
# ? The mapping is using service name as a string for convenience. Should we keep
# ? this or change it to ServiceName?
@property
def hostable_entities(self) -> dict[str, set[ServiceComponentName]]:
def entities(self) -> dict[str, set[ServiceComponentName]]:
"""Mapping of services to their set of components."""
return self._services_components

Expand Down Expand Up @@ -232,7 +232,7 @@ def _init_schemas(self) -> dict[str, ServiceSchema]:
schemas.setdefault(schema.service, ServiceSchema()).add_schema(schema)
return schemas

def _init_hostable_entities(self) -> dict[str, set[ServiceComponentName]]:
def _init_entities(self) -> dict[str, set[ServiceComponentName]]:
services_components: dict[str, set[ServiceComponentName]] = {}
for operation in self.operations.values():
service = services_components.setdefault(operation.name.service, set())
Expand Down
2 changes: 1 addition & 1 deletion test_dag_order/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def resolve_components(
service_component_map: dict[str, str] = {}
for service_component in service_components:
if isinstance(parse_entity_name(service_component), ServiceName):
for component in collections.hostable_entities[service_component]:
for component in collections.entities[service_component]:
resolved_components.add(component.name)
service_component_map[component.name] = service_component
else:
Expand Down

0 comments on commit 55ae3b8

Please sign in to comment.