Skip to content

Commit

Permalink
ci(ruff-commas): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
sujuka99 committed Sep 26, 2023
1 parent d0eefab commit 301284e
Show file tree
Hide file tree
Showing 59 changed files with 451 additions and 451 deletions.
2 changes: 1 addition & 1 deletion kpops/cli/custom_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def format(self, record):
logging.WARNING: typer.style(message_format, fg=typer.colors.YELLOW),
logging.ERROR: typer.style(message_format, fg=typer.colors.RED),
logging.CRITICAL: typer.style(
message_format, fg=typer.colors.RED, bold=True
message_format, fg=typer.colors.RED, bold=True,
),
}

Expand Down
40 changes: 20 additions & 20 deletions kpops/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def setup_pipeline(

handlers = setup_handlers(components_module, pipeline_config)
return Pipeline.load_from_yaml(
pipeline_base_dir, pipeline_path, registry, pipeline_config, handlers
pipeline_base_dir, pipeline_path, registry, pipeline_config, handlers,
)


def setup_handlers(
components_module: str | None, config: PipelineConfig
components_module: str | None, config: PipelineConfig,
) -> ComponentHandlers:
schema_handler = SchemaHandler.load_schema_handler(components_module, config)
connector_handler = KafkaConnectHandler.from_pipeline_config(config)
Expand All @@ -149,13 +149,13 @@ def get_step_names(steps_to_apply: list[PipelineComponent]) -> list[str]:


def filter_steps_to_apply(
pipeline: Pipeline, steps: set[str], filter_type: FilterType
pipeline: Pipeline, steps: set[str], filter_type: FilterType,
) -> list[PipelineComponent]:
def is_in_steps(component: PipelineComponent) -> bool:
return component.name in steps

log.debug(
f"KPOPS_PIPELINE_STEPS is defined with values: {steps} and filter type of {filter_type.value}"
f"KPOPS_PIPELINE_STEPS is defined with values: {steps} and filter type of {filter_type.value}",
)
filtered_steps = [
component
Expand All @@ -171,15 +171,15 @@ def is_in_steps(component: PipelineComponent) -> bool:


def get_steps_to_apply(
pipeline: Pipeline, steps: str | None, filter_type: FilterType
pipeline: Pipeline, steps: str | None, filter_type: FilterType,
) -> list[PipelineComponent]:
if steps:
return filter_steps_to_apply(pipeline, parse_steps(steps), filter_type)
return list(pipeline)


def reverse_pipeline_steps(
pipeline: Pipeline, steps: str | None, filter_type: FilterType
pipeline: Pipeline, steps: str | None, filter_type: FilterType,
) -> Iterator[PipelineComponent]:
return reversed(get_steps_to_apply(pipeline, steps, filter_type))

Expand All @@ -193,7 +193,7 @@ def log_action(action: str, pipeline_component: PipelineComponent):


def create_pipeline_config(
config: Path, defaults: Optional[Path], verbose: bool
config: Path, defaults: Optional[Path], verbose: bool,
) -> PipelineConfig:
setup_logging_level(verbose)
PipelineConfig.Config.config_path = config
Expand All @@ -210,7 +210,7 @@ def create_pipeline_config(
Generate json schema.
The schemas can be used to enable support for kpops files in a text editor.
"""
""",
)
def schema(
scope: SchemaScope = typer.Argument(
Expand All @@ -225,7 +225,7 @@ def schema(
),
components_module: Optional[str] = COMPONENTS_MODULES,
include_stock_components: bool = typer.Option(
default=True, help="Include the built-in KPOps components."
default=True, help="Include the built-in KPOps components.",
),
) -> None:
match scope:
Expand All @@ -236,7 +236,7 @@ def schema(


@app.command( # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
help="Enriches pipelines steps with defaults. The output is used as input for the deploy/destroy/... commands."
help="Enriches pipelines steps with defaults. The output is used as input for the deploy/destroy/... commands.",
)
def generate(
pipeline_path: Path = PIPELINE_PATH_ARG,
Expand All @@ -251,7 +251,7 @@ def generate(
) -> Pipeline:
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
pipeline_base_dir, pipeline_path, components_module, pipeline_config
pipeline_base_dir, pipeline_path, components_module, pipeline_config,
)

if not template:
Expand All @@ -264,14 +264,14 @@ def generate(
elif steps:
log.warning(
"The following flags are considered only when `--template` is set: \n \
'--steps'"
'--steps'",
)

return pipeline


@app.command(
help="Deploy pipeline steps"
help="Deploy pipeline steps",
) # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
def deploy(
pipeline_path: Path = PIPELINE_PATH_ARG,
Expand All @@ -286,7 +286,7 @@ def deploy(
):
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
pipeline_base_dir, pipeline_path, components_module, pipeline_config
pipeline_base_dir, pipeline_path, components_module, pipeline_config,
)

steps_to_apply = get_steps_to_apply(pipeline, steps, filter_type)
Expand All @@ -296,7 +296,7 @@ def deploy(


@app.command(
help="Destroy pipeline steps"
help="Destroy pipeline steps",
) # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
def destroy(
pipeline_path: Path = PIPELINE_PATH_ARG,
Expand All @@ -311,7 +311,7 @@ def destroy(
):
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
pipeline_base_dir, pipeline_path, components_module, pipeline_config
pipeline_base_dir, pipeline_path, components_module, pipeline_config,
)
pipeline_steps = reverse_pipeline_steps(pipeline, steps, filter_type)
for component in pipeline_steps:
Expand All @@ -320,7 +320,7 @@ def destroy(


@app.command(
help="Reset pipeline steps"
help="Reset pipeline steps",
) # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
def reset(
pipeline_path: Path = PIPELINE_PATH_ARG,
Expand All @@ -335,7 +335,7 @@ def reset(
):
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
pipeline_base_dir, pipeline_path, components_module, pipeline_config
pipeline_base_dir, pipeline_path, components_module, pipeline_config,
)
pipeline_steps = reverse_pipeline_steps(pipeline, steps, filter_type)
for component in pipeline_steps:
Expand All @@ -345,7 +345,7 @@ def reset(


@app.command(
help="Clean pipeline steps"
help="Clean pipeline steps",
) # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
def clean(
pipeline_path: Path = PIPELINE_PATH_ARG,
Expand All @@ -360,7 +360,7 @@ def clean(
):
pipeline_config = create_pipeline_config(config, defaults, verbose)
pipeline = setup_pipeline(
pipeline_base_dir, pipeline_path, components_module, pipeline_config
pipeline_base_dir, pipeline_path, components_module, pipeline_config,
)
pipeline_steps = reverse_pipeline_steps(pipeline, steps, filter_type)
for component in pipeline_steps:
Expand Down
2 changes: 1 addition & 1 deletion kpops/cli/pipeline_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def customise_sources(
env_settings: SettingsSourceCallable,
file_secret_settings: SettingsSourceCallable,
) -> tuple[
SettingsSourceCallable | Callable[[PipelineConfig], dict[str, Any]], ...
SettingsSourceCallable | Callable[[PipelineConfig], dict[str, Any]], ...,
]:
return (
env_settings,
Expand Down
4 changes: 2 additions & 2 deletions kpops/cli/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __getitem__(self, component_type: str) -> type[PipelineComponent]:
return self._classes[component_type]
except KeyError as ke:
raise ClassNotFoundError(
f"Could not find a component of type {component_type}"
f"Could not find a component of type {component_type}",
) from ke


Expand All @@ -56,7 +56,7 @@ def _find_classes(module_name: str, baseclass: type[T]) -> Iterator[type[T]]:
if issubclass(_class, baseclass):
# filter out internal kpops classes unless specifically requested
if _class.__module__.startswith(
KPOPS_MODULE
KPOPS_MODULE,
) and not module_name.startswith(KPOPS_MODULE):
continue
yield _class
2 changes: 1 addition & 1 deletion kpops/component_handlers/helm_wrapper/dry_run_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def print_helm_diff(self, stdout: str, helm_release_name: str, log: Logger) -> N
:param log: The Logger object of the component class
"""
current_release = list(
self._helm.get_manifest(helm_release_name, self.namespace)
self._helm.get_manifest(helm_release_name, self.namespace),
)
if current_release:
log.info(f"Helm release {helm_release_name} already exists")
Expand Down
6 changes: 3 additions & 3 deletions kpops/component_handlers/helm_wrapper/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, helm_config: HelmConfig) -> None:
self._version = self.get_version()
if self._version.major != 3:
raise RuntimeError(
f"The supported Helm version is 3.x.x. The current Helm version is {self._version.major}.{self._version.minor}.{self._version.patch}"
f"The supported Helm version is 3.x.x. The current Helm version is {self._version.major}.{self._version.minor}.{self._version.patch}",
)

def add_repo(
Expand Down Expand Up @@ -121,7 +121,7 @@ def uninstall(
return self.__execute(command)
except ReleaseNotFoundException:
log.warning(
f"Release with name {release_name} not found. Could not uninstall app."
f"Release with name {release_name} not found. Could not uninstall app.",
)

def template(
Expand Down Expand Up @@ -184,7 +184,7 @@ def get_version(self) -> Version:
version_match = re.search(r"^v(\d+(?:\.\d+){0,2})", short_version)
if version_match is None:
raise RuntimeError(
f"Could not parse the Helm version.\n\nHelm output:\n{short_version}"
f"Could not parse the Helm version.\n\nHelm output:\n{short_version}",
)
version = map(int, version_match.group(1).split("."))
return Version(*version)
Expand Down
16 changes: 8 additions & 8 deletions kpops/component_handlers/helm_wrapper/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ class RepoAuthFlags(BaseModel):
"""

username: str | None = Field(
default=None, description=describe_attr("username", __doc__)
default=None, description=describe_attr("username", __doc__),
)
password: str | None = Field(
default=None, description=describe_attr("password", __doc__)
default=None, description=describe_attr("password", __doc__),
)
ca_file: Path | None = Field(
default=None, description=describe_attr("ca_file", __doc__)
default=None, description=describe_attr("ca_file", __doc__),
)
cert_file: Path | None = Field(
default=None, description=describe_attr("cert_file", __doc__)
default=None, description=describe_attr("cert_file", __doc__),
)
insecure_skip_tls_verify: bool = Field(
default=False, description=describe_attr("insecure_skip_tls_verify", __doc__)
default=False, description=describe_attr("insecure_skip_tls_verify", __doc__),
)

class Config(DescConfig):
Expand Down Expand Up @@ -73,11 +73,11 @@ class HelmRepoConfig(BaseModel):
"""

repository_name: str = Field(
default=..., description=describe_attr("repository_name", __doc__)
default=..., description=describe_attr("repository_name", __doc__),
)
url: str = Field(default=..., description=describe_attr("url", __doc__))
repo_auth_flags: RepoAuthFlags = Field(
default=RepoAuthFlags(), description=describe_attr("repo_auth_flags", __doc__)
default=RepoAuthFlags(), description=describe_attr("repo_auth_flags", __doc__),
)

class Config(DescConfig):
Expand Down Expand Up @@ -131,7 +131,7 @@ def to_command(self) -> list[str]:
[
"--set-file",
",".join([f"{key}={path}" for key, path in self.set_file.items()]),
]
],
)
if self.create_namespace:
command.append("--create-namespace")
Expand Down
2 changes: 1 addition & 1 deletion kpops/component_handlers/helm_wrapper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def trim_release_name(name: str, suffix: str = "") -> str:
if len(name) > RELEASE_NAME_MAX_LEN:
new_name = name[: (RELEASE_NAME_MAX_LEN - len(suffix))] + suffix
log.critical(
f"Invalid Helm release name '{name}'. Truncating to {RELEASE_NAME_MAX_LEN} characters: \n {name} --> {new_name}"
f"Invalid Helm release name '{name}'. Truncating to {RELEASE_NAME_MAX_LEN} characters: \n {name} --> {new_name}",
)
name = new_name
return name
Loading

0 comments on commit 301284e

Please sign in to comment.