Skip to content

Commit 94e87e9

Browse files
Copilotkhnumdev
andcommitted
Fix linting issues and modernize type hints
Co-authored-by: khnumdev <13968776+khnumdev@users.noreply.github.com>
1 parent b9e714b commit 94e87e9

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

commands/analyze_entity_fields.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def _process_entity(e: datastore.Entity):
5656
if enable_parallel:
5757
from concurrent.futures import ThreadPoolExecutor, as_completed
5858

59-
results_iter = []
6059
with ThreadPoolExecutor(max_workers=8) as exe:
6160
futures = {exe.submit(_process_entity, e): e for e in ents}
6261
for fut in tqdm(as_completed(futures), total=len(futures), desc="Analyzing field contributions", unit="entity"):

commands/analyze_kinds.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from __future__ import annotations
22

33
import logging
4-
from typing import Dict, List, Optional, Tuple
4+
from typing import Dict, List
55

6-
from google.cloud import datastore
76
from google.cloud.datastore.helpers import entity_to_protobuf
87

98
from .config import (
@@ -17,7 +16,7 @@
1716
logger = logging.getLogger(__name__)
1817

1918

20-
def get_kind_stats(client, kind: str, namespace: Optional[str] = None) -> Tuple[Optional[int], Optional[int]]:
19+
def get_kind_stats(client, kind: str, namespace: str | None = None) -> tuple[int | None, int | None]:
2120
"""
2221
Returns (count, bytes) for the given kind/namespace using Datastore statistics.
2322
Falls back to None if not found.
@@ -39,7 +38,7 @@ def get_kind_stats(client, kind: str, namespace: Optional[str] = None) -> Tuple[
3938
return None, None
4039

4140

42-
def estimate_entity_count_and_size(client, kind: str, namespace: Optional[str], sample_size: int = 100) -> Tuple[int, int]:
41+
def estimate_entity_count_and_size(client, kind: str, namespace: str | None, sample_size: int = 100) -> tuple[int, int]:
4342
"""
4443
Original keys-only method: exact count, approximate bytes via sampling.
4544
"""
@@ -65,7 +64,7 @@ def estimate_entity_count_and_size(client, kind: str, namespace: Optional[str],
6564
return total_count, int(avg_size * total_count)
6665

6766

68-
def analyze_kinds(config: AppConfig, method: Optional[str] = None) -> List[Dict]:
67+
def analyze_kinds(config: AppConfig, method: str | None = None) -> List[Dict]:
6968
"""
7069
Analyze kinds using either:
7170
- 'stats' (default) => fast built-in Datastore statistics

commands/cleanup_expired.py

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

33
import logging
44
from datetime import datetime, timezone
5-
from typing import Dict, List, Optional
5+
from typing import Dict, List
66

77
from google.cloud import datastore
88

0 commit comments

Comments
 (0)