Skip to content

Commit 4a79089

Browse files
ritwik-gclaude
andcommitted
Fix CI issues: Python 3.8 compatibility and linting errors
- Fix Python 3.8 compatibility by using List instead of list[] syntax - Remove unused imports across all modules and tests - Fix f-string issues without placeholders - Auto-fix all ruff linting errors - Tests now pass on all Python versions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9e64f05 commit 4a79089

19 files changed

+18
-42
lines changed

helm_values_manager/commands/generate.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"""Generate command implementation."""
2-
import sys
32
from typing import Optional
43

54
import typer
65
from rich.console import Console
76

87
from helm_values_manager.errors import ErrorHandler, GeneratorError
98
from helm_values_manager.generator import generate_values
10-
from helm_values_manager.utils import get_values_file_path, load_schema, load_values
9+
from helm_values_manager.utils import load_schema, load_values
1110
from helm_values_manager.validator import validate_single_environment
1211

1312
console = Console()
@@ -26,9 +25,6 @@ def generate_command(
2625
if not schema_obj:
2726
ErrorHandler.print_error("generate", "Schema file not found")
2827

29-
# Determine values file path
30-
values_path = values or get_values_file_path(env)
31-
3228
# Load values
3329
values_data = load_values(env, values)
3430

helm_values_manager/commands/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from typing import Any, Optional
2+
from typing import Any
33

44
import typer
55
from rich.console import Console
@@ -309,7 +309,7 @@ def remove_command(
309309

310310
# Confirm removal
311311
if not force:
312-
console.print(f"\n[bold]Value to remove:[/bold]")
312+
console.print("\n[bold]Value to remove:[/bold]")
313313
console.print(f"Key: {value.key}")
314314
console.print(f"Path: {value.path}")
315315
console.print(f"Description: {value.description}")

helm_values_manager/commands/validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from helm_values_manager.errors import ErrorHandler
1010
from helm_values_manager.models import Schema
11-
from helm_values_manager.utils import load_schema, load_values, get_values_file_path
11+
from helm_values_manager.utils import load_values
1212
from helm_values_manager.validator import validate_single_environment
1313

1414
console = Console()

helm_values_manager/commands/values.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import json
22
import os
3-
from typing import Any, Optional
3+
from typing import Optional
44

55
import typer
66
from rich.console import Console
77
from rich.prompt import Confirm, Prompt
88
from rich.table import Table
99

1010
from helm_values_manager.commands.schema import parse_value_by_type
11-
from helm_values_manager.models import SchemaValue, SecretReference
12-
from helm_values_manager.errors import ErrorHandler, ValuesError, SchemaError
11+
from helm_values_manager.models import SchemaValue
12+
from helm_values_manager.errors import ErrorHandler, SchemaError
1313
from helm_values_manager.utils import (
14-
get_values_file_path,
1514
is_secret_reference,
1615
load_schema,
1716
load_values,
@@ -325,7 +324,7 @@ def init_command(
325324
# Handle skip-defaults flag
326325
if skip_defaults and has_default:
327326
skipped_count += 1
328-
console.print(f" → Skipping field with default value")
327+
console.print(" → Skipping field with default value")
329328
continue
330329

331330
# Handle force mode
@@ -338,11 +337,11 @@ def init_command(
338337
elif force and not has_default and not schema_value.required:
339338
# Skip optional fields without defaults in force mode
340339
skipped_count += 1
341-
console.print(f" → Skipping optional field without default")
340+
console.print(" → Skipping optional field without default")
342341
continue
343342
elif force and not has_default and schema_value.required:
344343
# Required fields without defaults must be prompted even in force mode
345-
console.print(f" → Required field with no default, prompting...")
344+
console.print(" → Required field with no default, prompting...")
346345
# Skip the "Set value?" prompt and go directly to value input
347346
action = "y" # Force yes for required fields in force mode
348347
else:
@@ -420,7 +419,7 @@ def init_command(
420419
save_values(values, env, values_path)
421420

422421
# Show summary
423-
console.print(f"\n[bold]Summary:[/bold]")
422+
console.print("\n[bold]Summary:[/bold]")
424423
console.print(f" Set {set_count} values")
425424
console.print(f" Skipped {skipped_count} values")
426425

helm_values_manager/errors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Centralized error handling utilities for consistent error formatting."""
2-
import sys
32
from typing import List, Optional
43

54
import typer

helm_values_manager/generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Generator module for creating values.yaml from schema and values."""
22
import os
3-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict
44

55
import yaml
66

77
from helm_values_manager.errors import GeneratorError
8-
from helm_values_manager.models import Schema, SchemaValue, SecretReference
8+
from helm_values_manager.models import Schema
99
from helm_values_manager.utils import is_secret_reference
1010

1111

helm_values_manager/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Literal, Optional, Union
1+
from typing import Any, Dict, List, Literal, Optional, Union
22

33
from pydantic import BaseModel, Field, RootModel
44

@@ -18,7 +18,7 @@ class SchemaValue(BaseModel):
1818

1919
class Schema(BaseModel):
2020
version: str = Field(default="1.0", description="Schema version")
21-
values: list[SchemaValue] = Field(default_factory=list, description="List of value definitions")
21+
values: List[SchemaValue] = Field(default_factory=list, description="List of value definitions")
2222

2323

2424
class SecretReference(BaseModel):
@@ -27,7 +27,7 @@ class SecretReference(BaseModel):
2727

2828

2929
# Type for a value in the values file - can be a regular value or a secret reference
30-
ValueEntry = Union[str, int, float, bool, list, dict, SecretReference]
30+
ValueEntry = Union[str, int, float, bool, List, Dict, SecretReference]
3131

3232

3333
class ValuesFile(RootModel[Dict[str, Any]]):

helm_values_manager/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
from typing import Any, Dict, Optional
44

5-
from helm_values_manager.models import Schema, SecretReference, ValuesFile
5+
from helm_values_manager.models import Schema
66

77

88
def load_schema(schema_path: str = "schema.json") -> Optional[Schema]:

tests/test_edge_cases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for edge cases and error conditions."""
22
import json
3-
import os
43
from pathlib import Path
54

65
import pytest

tests/test_generator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Tests for the generator module."""
22
import json
3-
import os
4-
from pathlib import Path
53

64
import pytest
75
import yaml

0 commit comments

Comments
 (0)