11from __future__ import annotations
22
33import logging
4- from typing import Dict , List , Optional , Tuple
4+ from typing import Dict , List
55
6- from google .cloud import datastore
76from google .cloud .datastore .helpers import entity_to_protobuf
87
98from .config import (
1716logger = 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
0 commit comments