Skip to content

Commit d5e2042

Browse files
chore: fix interrogate pre-commit
- Add docstrings for nested prompting helpers - Exclude generated cforge/_version.py from interrogate hook Signed-off-by: Matthew Grigsby <38010437+MatthewGrigsby@users.noreply.github.com>
1 parent 4fc4c71 commit d5e2042

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,5 +530,5 @@ repos:
530530
rev: 1.7.0 # or master if you're bold
531531
hooks:
532532
- id: interrogate
533-
args: [--quiet, --fail-under=100]
533+
args: [--quiet, --fail-under=100, --exclude, cforge/_version.py]
534534
files: ^cforge/

cforge/common/prompting.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,15 @@ def _prompt_field_value(
479479
)
480480

481481
def _format_string_default(default_value: Any) -> Tuple[str, bool]:
482+
"""Return a default prompt value (as text) and whether to show it."""
482483
if default_value is None:
483484
return "", False
484485
if isinstance(default_value, str):
485486
return default_value, True
486487
return json.dumps(default_value), True
487488

488489
def _prompt_string_with_default() -> Tuple[Optional[str], bool]:
490+
"""Prompt for a string value while honoring schema defaults and required-ness."""
489491
default_text, show_default = _format_string_default(field_schema.get("default"))
490492
value = _prompt_string_value(
491493
console=console,
@@ -743,13 +745,15 @@ def _prompt_object(field_schema: Dict[str, Any], prefilled: Optional[Dict[str, A
743745
additional_properties_schema = _resolve_effective_schema(schema, additional_properties)
744746

745747
def _assign_typed_value(key: str, next_indent: str) -> None:
748+
"""Prompt for and assign a typed additional property value."""
746749
value, _ = _prompt_field_value(key, additional_properties_schema, is_required=True, field_indent=next_indent)
747750
data[key] = value
748751

749752
_prompt_additional_properties(object_indent, _assign_typed_value)
750753
elif additional_properties is True and prompt_optional:
751754

752755
def _assign_json_value(key: str, next_indent: str) -> None:
756+
"""Prompt for and assign a JSON additional property value."""
753757
formatted_next_indent = _format_prompt_indent(next_indent)
754758
console.print(f"{formatted_next_indent}Enter JSON value", end="")
755759
raw_value = typer.prompt("", type=str)

0 commit comments

Comments
 (0)