[google-cloud-ndb] Use Incomplete instead of Any (#15055)

This commit is contained in:
Semyon Moroz
2025-11-20 12:31:32 +04:00
committed by GitHub
parent e19edcea11
commit 8aa4874f53
14 changed files with 142 additions and 147 deletions
@@ -1,5 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from google.cloud.ndb import tasklets as tasklets
@@ -13,11 +12,11 @@ class _GlobalCacheBatch:
def make_call(self) -> None: ...
def future_info(self, key) -> None: ...
global_get: Any
global_get: Incomplete
class _GlobalCacheGetBatch(_GlobalCacheBatch):
todo: Any
keys: Any
todo: Incomplete
keys: Incomplete
def __init__(self, ignore_options) -> None: ...
def add(self, key): ...
def done_callback(self, cache_call) -> None: ...
@@ -27,7 +26,7 @@ class _GlobalCacheGetBatch(_GlobalCacheBatch):
def global_set(key, value, expires: Incomplete | None = ..., read: bool = ...): ...
class _GlobalCacheSetBatch(_GlobalCacheBatch):
expires: Any
expires: Incomplete
todo: object
futures: object
def __init__(self, options) -> None: ...
@@ -41,17 +40,17 @@ class _GlobalCacheSetIfNotExistsBatch(_GlobalCacheSetBatch):
def make_call(self): ...
def future_info(self, key, value): ... # type:ignore[override]
global_delete: Any
global_delete: Incomplete
class _GlobalCacheDeleteBatch(_GlobalCacheBatch):
keys: Any
futures: Any
keys: Incomplete
futures: Incomplete
def __init__(self, ignore_options) -> None: ...
def add(self, key): ...
def make_call(self): ...
def future_info(self, key): ...
global_watch: Any
global_watch: Incomplete
class _GlobalCacheWatchBatch(_GlobalCacheDeleteBatch):
def make_call(self): ...
@@ -63,7 +62,7 @@ class _GlobalCacheUnwatchBatch(_GlobalCacheDeleteBatch):
def make_call(self): ...
def future_info(self, key): ...
global_compare_and_swap: Any
global_compare_and_swap: Incomplete
class _GlobalCacheCompareAndSwapBatch(_GlobalCacheSetBatch):
def make_call(self): ...
@@ -1,5 +1,4 @@
from _typeshed import Incomplete
from typing import Any
class QueryIterator:
def __iter__(self): ...
@@ -14,7 +13,7 @@ class QueryIterator:
class Cursor:
@classmethod
def from_websafe_string(cls, urlsafe): ...
cursor: Any
cursor: Incomplete
def __init__(self, cursor: Incomplete | None = ..., urlsafe: Incomplete | None = ...) -> None: ...
def to_websafe_string(self): ...
def urlsafe(self): ...
@@ -1,18 +1,19 @@
from typing import Any, NamedTuple
from _typeshed import Incomplete
from typing import NamedTuple
class _Event(NamedTuple):
when: Any
callback: Any
args: Any
kwargs: Any
when: Incomplete
callback: Incomplete
args: Incomplete
kwargs: Incomplete
class EventLoop:
current: Any
idlers: Any
current: Incomplete
idlers: Incomplete
inactive: int
queue: Any
rpcs: Any
rpc_results: Any
queue: Incomplete
rpcs: Incomplete
rpc_results: Incomplete
def __init__(self) -> None: ...
def clear(self) -> None: ...
def insort_event_right(self, event) -> None: ...
@@ -1,8 +1,8 @@
from typing import Any
from _typeshed import Incomplete
from google.cloud.ndb import model
BlobKey: Any
BlobKey: Incomplete
BLOB_INFO_KIND: str
BLOB_MIGRATION_KIND: str
BLOB_KEY_HEADER: str
@@ -51,10 +51,10 @@ class Error:
def fetch_data(*args, **kwargs) -> None: ...
def fetch_data_async(*args, **kwargs) -> None: ...
get: Any
get_async: Any
get_multi: Any
get_multi_async: Any
get: Incomplete
get_async: Incomplete
get_multi: Incomplete
get_multi_async: Incomplete
class InternalError:
def __init__(self, *args, **kwargs) -> None: ...
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Any, NamedTuple
from typing import NamedTuple
from google.cloud.ndb import Key, exceptions as exceptions
@@ -19,18 +19,18 @@ def get_context(raise_context_error: bool = ...): ...
def get_toplevel_context(raise_context_error: bool = ...): ...
class _ContextTuple(NamedTuple):
id: Any
client: Any
namespace: Any
eventloop: Any
batches: Any
commit_batches: Any
transaction: Any
cache: Any
global_cache: Any
on_commit_callbacks: Any
transaction_complete_callbacks: Any
legacy_data: Any
id: Incomplete
client: Incomplete
namespace: Incomplete
eventloop: Incomplete
batches: Incomplete
commit_batches: Incomplete
transaction: Incomplete
cache: Incomplete
global_cache: Incomplete
on_commit_callbacks: Incomplete
transaction_complete_callbacks: Incomplete
legacy_data: Incomplete
class _Context(_ContextTuple):
def __new__(
@@ -67,19 +67,19 @@ class Context(_Context):
def get_cache_policy(self): ...
def get_datastore_policy(self) -> None: ...
def get_global_cache_policy(self): ...
get_memcache_policy: Any
get_memcache_policy: Incomplete
def get_global_cache_timeout_policy(self): ...
get_memcache_timeout_policy: Any
cache_policy: Any
get_memcache_timeout_policy: Incomplete
cache_policy: Incomplete
def set_cache_policy(self, policy): ...
datastore_policy: Any
datastore_policy: Incomplete
def set_datastore_policy(self, policy): ...
global_cache_policy: Any
global_cache_policy: Incomplete
def set_global_cache_policy(self, policy): ...
set_memcache_policy: Any
global_cache_timeout_policy: Any
set_memcache_policy: Incomplete
global_cache_timeout_policy: Incomplete
def set_global_cache_timeout_policy(self, policy): ...
set_memcache_timeout_policy: Any
set_memcache_timeout_policy: Incomplete
def get_retry_state(self): ...
def set_retry_state(self, state) -> None: ...
def clear_retry_state(self) -> None: ...
@@ -1,4 +1,4 @@
from typing import Any
from _typeshed import Incomplete
class Error(Exception): ...
@@ -12,7 +12,7 @@ class Rollback(Error): ...
class BadQueryError(Error): ...
class BadFilterError(Error):
filter: Any
filter: Incomplete
def __init__(self, filter) -> None: ...
class NoLongerImplementedError(NotImplementedError):
@@ -1,13 +1,12 @@
import abc
from _typeshed import Incomplete
from typing import Any
from typing_extensions import Self
ConnectionError: Any
ConnectionError: Incomplete
class GlobalCache(metaclass=abc.ABCMeta):
__metaclass__: Any
transient_errors: Any
__metaclass__: Incomplete
transient_errors: Incomplete
strict_read: bool
strict_write: bool
@abc.abstractmethod
@@ -26,7 +25,7 @@ class GlobalCache(metaclass=abc.ABCMeta):
def clear(self): ...
class _InProcessGlobalCache(GlobalCache):
cache: Any
cache: Incomplete
def __init__(self) -> None: ...
def get(self, keys): ...
def set(self, items, expires: Incomplete | None = ...) -> None: ...
@@ -37,12 +36,12 @@ class _InProcessGlobalCache(GlobalCache):
def clear(self) -> None: ...
class RedisCache(GlobalCache):
transient_errors: Any
transient_errors: Incomplete
@classmethod
def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
redis: Any
strict_read: Any
strict_write: Any
redis: Incomplete
strict_read: Incomplete
strict_write: Incomplete
def __init__(self, redis, strict_read: bool = ..., strict_write: bool = ...) -> None: ...
@property
def pipes(self): ...
@@ -56,16 +55,16 @@ class RedisCache(GlobalCache):
class MemcacheCache(GlobalCache):
class KeyNotSet(Exception):
key: Any
key: Incomplete
def __init__(self, key) -> None: ...
def __eq__(self, other): ...
transient_errors: Any
transient_errors: Incomplete
@classmethod
def from_environment(cls, max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...) -> Self: ...
client: Any
strict_read: Any
strict_write: Any
client: Incomplete
strict_read: Incomplete
strict_write: Incomplete
def __init__(self, client, strict_read: bool = ..., strict_write: bool = ...) -> None: ...
@property
def caskeys(self): ...
@@ -1,7 +1,6 @@
from _typeshed import Incomplete
from typing import Any
UNDEFINED: Any
UNDEFINED: Incomplete
class Key:
def __new__(cls, *path_args, **kwargs): ...
@@ -17,7 +16,7 @@ class Key:
def root(self): ...
def namespace(self): ...
def project(self): ...
app: Any
app: Incomplete
def database(self) -> str | None: ...
def id(self): ...
def string_id(self): ...
@@ -1,5 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from google.cloud.ndb import model
@@ -32,7 +31,7 @@ class Property(_BaseMetadata):
def property_name(self): ...
@property
def kind_name(self): ...
property_representation: Any
property_representation: Incomplete
@classmethod
def key_for_kind(cls, kind): ...
@classmethod
@@ -1,4 +1,4 @@
from typing import Any
from _typeshed import Incomplete
from google.cloud.ndb import model
@@ -6,4 +6,4 @@ class _ClassKeyProperty(model.StringProperty):
def __init__(self, name=..., indexed: bool = ...) -> None: ...
class PolyModel(model.Model):
class_: Any
class_: Incomplete
@@ -1,18 +1,17 @@
from _typeshed import Incomplete
from typing import Any
from google.cloud.ndb import _options
class PropertyOrder:
name: Any
reverse: Any
name: Incomplete
reverse: Incomplete
def __init__(self, name, reverse: bool = ...) -> None: ...
def __neg__(self): ...
class RepeatedStructuredPropertyPredicate:
name: Any
match_keys: Any
match_values: Any
name: Incomplete
match_keys: Incomplete
match_values: Incomplete
def __init__(self, name, match_keys, entity_pb) -> None: ...
def __call__(self, entity_pb): ...
@@ -28,8 +27,8 @@ class Parameter(ParameterizedThing):
def resolve(self, bindings, used): ...
class ParameterizedFunction(ParameterizedThing):
func: Any
values: Any
func: Incomplete
values: Incomplete
def __init__(self, func, values) -> None: ...
def __eq__(self, other): ...
def is_parameterized(self): ...
@@ -65,9 +64,9 @@ class PostFilterNode(Node):
def __eq__(self, other): ...
class _BooleanClauses:
name: Any
combine_or: Any
or_parts: Any
name: Incomplete
combine_or: Incomplete
or_parts: Incomplete
def __init__(self, name, combine_or) -> None: ...
def add_node(self, node) -> None: ...
@@ -89,24 +88,24 @@ AND = ConjunctionNode
OR = DisjunctionNode
class QueryOptions(_options.ReadOptions):
project: Any
namespace: Any
project: Incomplete
namespace: Incomplete
database: str | None
def __init__(self, config: Incomplete | None = ..., context: Incomplete | None = ..., **kwargs) -> None: ...
class Query:
default_options: Any
kind: Any
ancestor: Any
filters: Any
order_by: Any
project: Any
namespace: Any
limit: Any
offset: Any
keys_only: Any
projection: Any
distinct_on: Any
default_options: Incomplete
kind: Incomplete
ancestor: Incomplete
filters: Incomplete
order_by: Incomplete
project: Incomplete
namespace: Incomplete
limit: Incomplete
offset: Incomplete
keys_only: Incomplete
projection: Incomplete
distinct_on: Incomplete
database: str | None
def __init__(
self,
@@ -136,7 +135,7 @@ class Query:
def fetch_async(self, limit: Incomplete | None = ..., **kwargs): ...
def run_to_queue(self, queue, conn, options: Incomplete | None = ..., dsquery: Incomplete | None = ...) -> None: ...
def iter(self, **kwargs): ...
__iter__: Any
__iter__: Incomplete
def map(self, callback, **kwargs): ...
def map_async(self, callback, **kwargs) -> None: ...
def get(self, **kwargs): ...
@@ -146,4 +145,4 @@ class Query:
def fetch_page(self, page_size, **kwargs): ...
def fetch_page_async(self, page_size, **kwargs) -> None: ...
def gql(query_string: str, *args: Any, **kwds: Any) -> Query: ...
def gql(query_string: str, *args, **kwds) -> Query: ...
@@ -1,41 +1,41 @@
from typing import Any
from _typeshed import Incomplete
from google.cloud.ndb import model
class BaseStatistic(model.Model):
STORED_KIND_NAME: str
bytes: Any
count: Any
timestamp: Any
bytes: Incomplete
count: Incomplete
timestamp: Incomplete
class BaseKindStatistic(BaseStatistic):
STORED_KIND_NAME: str
kind_name: Any
entity_bytes: Any
kind_name: Incomplete
entity_bytes: Incomplete
class GlobalStat(BaseStatistic):
STORED_KIND_NAME: str
entity_bytes: Any
builtin_index_bytes: Any
builtin_index_count: Any
composite_index_bytes: Any
composite_index_count: Any
entity_bytes: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
composite_index_bytes: Incomplete
composite_index_count: Incomplete
class NamespaceStat(BaseStatistic):
STORED_KIND_NAME: str
subject_namespace: Any
entity_bytes: Any
builtin_index_bytes: Any
builtin_index_count: Any
composite_index_bytes: Any
composite_index_count: Any
subject_namespace: Incomplete
entity_bytes: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
composite_index_bytes: Incomplete
composite_index_count: Incomplete
class KindStat(BaseKindStatistic):
STORED_KIND_NAME: str
builtin_index_bytes: Any
builtin_index_count: Any
composite_index_bytes: Any
composite_index_count: Any
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
composite_index_bytes: Incomplete
composite_index_count: Incomplete
class KindRootEntityStat(BaseKindStatistic):
STORED_KIND_NAME: str
@@ -45,34 +45,34 @@ class KindNonRootEntityStat(BaseKindStatistic):
class PropertyTypeStat(BaseStatistic):
STORED_KIND_NAME: str
property_type: Any
entity_bytes: Any
builtin_index_bytes: Any
builtin_index_count: Any
property_type: Incomplete
entity_bytes: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
class KindPropertyTypeStat(BaseKindStatistic):
STORED_KIND_NAME: str
property_type: Any
builtin_index_bytes: Any
builtin_index_count: Any
property_type: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
class KindPropertyNameStat(BaseKindStatistic):
STORED_KIND_NAME: str
property_name: Any
builtin_index_bytes: Any
builtin_index_count: Any
property_name: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
class KindPropertyNamePropertyTypeStat(BaseKindStatistic):
STORED_KIND_NAME: str
property_type: Any
property_name: Any
builtin_index_bytes: Any
builtin_index_count: Any
property_type: Incomplete
property_name: Incomplete
builtin_index_bytes: Incomplete
builtin_index_count: Incomplete
class KindCompositeIndexStat(BaseStatistic):
STORED_KIND_NAME: str
index_id: Any
kind_name: Any
index_id: Incomplete
kind_name: Incomplete
class NamespaceGlobalStat(GlobalStat):
STORED_KIND_NAME: str
@@ -1,7 +1,7 @@
from typing import Any
from _typeshed import Incomplete
class Future:
info: Any
info: Incomplete
def __init__(self, info: str = ...) -> None: ...
def done(self): ...
def running(self): ...
@@ -10,9 +10,9 @@ class Future:
def set_result(self, result) -> None: ...
def set_exception(self, exception) -> None: ...
def result(self): ...
get_result: Any
get_result: Incomplete
def exception(self): ...
get_exception: Any
get_exception: Incomplete
def get_traceback(self): ...
def add_done_callback(self, callback) -> None: ...
def cancel(self) -> None: ...
@@ -23,9 +23,9 @@ class Future:
def wait_all(futures): ...
class _TaskletFuture(Future):
generator: Any
context: Any
waiting_on: Any
generator: Incomplete
context: Incomplete
waiting_on: Incomplete
def __init__(self, generator, context, info: str = ...) -> None: ...
def cancel(self) -> None: ...
@@ -1,11 +1,11 @@
import threading
from typing import Any
from _typeshed import Incomplete
TRUTHY_STRINGS: Any
TRUTHY_STRINGS: Incomplete
def asbool(value): ...
DEBUG: Any
DEBUG: Incomplete
def code_info(*args, **kwargs) -> None: ...
def decorator(*args, **kwargs) -> None: ...
@@ -16,7 +16,7 @@ def get_stack(*args, **kwargs) -> None: ...
def logging_debug(log, message, *args, **kwargs) -> None: ...
class keyword_only:
defaults: Any
defaults: Incomplete
def __init__(self, **kwargs) -> None: ...
def __call__(self, wrapped): ...