Skip to content

Commit

Permalink
chore: lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
sujuka99 committed Sep 22, 2023
1 parent 01335e9 commit fd702f0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions hooks/gen_docs/gen_docs_env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class EnvVarAttrs(str, SuperEnum):
def csv_append_env_var(
file: Path,
name: str,
default_value,
default_value: Any,
description: str | list[str] | None,
*args,
) -> None:
Expand Down Expand Up @@ -270,15 +270,14 @@ def fill_csv_pipeline_config(target: Path) -> None:


def collect_fields(settings: type[BaseSettings]) -> Generator[ModelField, None, None]:
"""Collect and yield all fields in a settings class
"""Collect and yield all fields in a settings class.
:param model: settings class
:yield: all settings including nested ones in settings classes
"""
for field in settings.__fields__.values():
if issubclass(field_type := field.type_, BaseSettings):
for nested_field_info in collect_fields(field_type):
yield nested_field_info
yield from collect_fields(field_type)
yield field


Expand All @@ -294,7 +293,7 @@ def __fill_csv_cli(target: Path) -> None:
var_in_main = getattr(main, var_in_main_name)
if (
not var_in_main_name.startswith("__")
and isinstance(var_in_main, (OptionInfo, ArgumentInfo))
and isinstance(var_in_main, OptionInfo | ArgumentInfo)
and var_in_main.envvar
):
cli_env_var_description: list[str] = [
Expand Down

0 comments on commit fd702f0

Please sign in to comment.