fix: Python 3.9 compatibility - replace union types and builtin generics

- Replace 'str | None' with 'Optional[str]'
- Replace 'list[str]' with 'List[str]'
- Replace 'dict[' with 'Dict['
- Replace 'tuple[' with 'Tuple['
- Add missing typing imports (List, Dict, Tuple)

Fixes TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andy Lee
2025-08-10 00:29:46 +00:00
parent 728fa42ad5
commit ffba435252
13 changed files with 59 additions and 58 deletions

View File

@@ -12,7 +12,7 @@ import shutil
import subprocess
import tempfile
from pathlib import Path
from typing import Optional
from typing import Optional, Tuple
class GraphPartitioner:
@@ -92,7 +92,7 @@ class GraphPartitioner:
output_dir: Optional[str] = None,
partition_prefix: Optional[str] = None,
**kwargs,
) -> tuple[str, str]:
) -> Tuple[str, str]:
"""
Partition a disk-based index for improved performance.
@@ -263,11 +263,11 @@ class GraphPartitioner:
def partition_graph(
index_prefix_path: str,
output_dir: str | None = None,
partition_prefix: str | None = None,
output_dir: Optional[str] = None,
partition_prefix: Optional[str] = None,
build_type: str = "release",
**kwargs,
) -> tuple[str, str]:
) -> Tuple[str, str]:
"""
Convenience function to partition a graph index.