Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti committed Dec 4, 2024
1 parent f17b4dd commit 95b3d10
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
56 changes: 28 additions & 28 deletions src/cosl/coordinated_workers/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def __post_init__(self):
is_minimal_valid = set(self.minimal_deployment).issubset(self.roles)
is_recommended_valid = set(self.recommended_deployment).issubset(self.roles)
if not all(
[
are_meta_keys_valid,
are_meta_values_valid,
is_minimal_valid,
is_recommended_valid,
]
[
are_meta_keys_valid,
are_meta_values_valid,
is_minimal_valid,
is_recommended_valid,
]
):
raise ClusterRolesConfigError(
"Invalid ClusterRolesConfig: The configuration is not coherent."
Expand All @@ -142,8 +142,8 @@ def is_coherent_with(self, cluster_roles: Iterable[str]) -> bool:


def _validate_container_name(
container_name: Optional[str],
resources_requests: Optional[Callable[["Coordinator"], Dict[str, str]]],
container_name: Optional[str],
resources_requests: Optional[Callable[["Coordinator"], Dict[str, str]]],
):
"""Raise `ValueError` if `resources_requests` is not None and `container_name` is None."""
if resources_requests is not None and container_name is None:
Expand Down Expand Up @@ -188,22 +188,22 @@ class Coordinator(ops.Object):
"""

def __init__(
self,
charm: ops.CharmBase,
roles_config: ClusterRolesConfig,
external_url: str, # the ingressed url if we have ingress, else fqdn
worker_metrics_port: int,
endpoints: _EndpointMapping,
nginx_config: Callable[["Coordinator"], str],
workers_config: Callable[["Coordinator"], str],
nginx_options: Optional[NginxMappingOverrides] = None,
is_coherent: Optional[Callable[[ClusterProvider, ClusterRolesConfig], bool]] = None,
is_recommended: Optional[Callable[[ClusterProvider, ClusterRolesConfig], bool]] = None,
resources_limit_options: Optional[_ResourceLimitOptionsMapping] = None,
resources_requests: Optional[Callable[["Coordinator"], Dict[str, str]]] = None,
container_name: Optional[str] = None,
remote_write_endpoints: Optional[Callable[[], List[RemoteWriteEndpoint]]] = None,
workload_tracing_protocols: Optional[List[ReceiverProtocol]] = None,
self,
charm: ops.CharmBase,
roles_config: ClusterRolesConfig,
external_url: str, # the ingressed url if we have ingress, else fqdn
worker_metrics_port: int,
endpoints: _EndpointMapping,
nginx_config: Callable[["Coordinator"], str],
workers_config: Callable[["Coordinator"], str],
nginx_options: Optional[NginxMappingOverrides] = None,
is_coherent: Optional[Callable[[ClusterProvider, ClusterRolesConfig], bool]] = None,
is_recommended: Optional[Callable[[ClusterProvider, ClusterRolesConfig], bool]] = None,
resources_limit_options: Optional[_ResourceLimitOptionsMapping] = None,
resources_requests: Optional[Callable[["Coordinator"], Dict[str, str]]] = None,
container_name: Optional[str] = None,
remote_write_endpoints: Optional[Callable[[], List[RemoteWriteEndpoint]]] = None,
workload_tracing_protocols: Optional[List[ReceiverProtocol]] = None,
):
"""Constructor for a Coordinator object.
Expand Down Expand Up @@ -436,10 +436,10 @@ def _internal_url(self) -> str:
def tls_available(self) -> bool:
"""Return True if tls is enabled and the necessary certs are found."""
return (
self.cert_handler.enabled
and (self.cert_handler.server_cert is not None)
and (self.cert_handler.private_key is not None) # type: ignore
and (self.cert_handler.ca_cert is not None)
self.cert_handler.enabled
and (self.cert_handler.server_cert is not None)
and (self.cert_handler.private_key is not None) # type: ignore
and (self.cert_handler.ca_cert is not None)
)

@property
Expand Down
3 changes: 2 additions & 1 deletion src/cosl/interfaces/datasource_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from typing import (
Iterable,
List,
Tuple, Optional,
Optional,
Tuple,
)

import ops
Expand Down

0 comments on commit 95b3d10

Please sign in to comment.