google-cloud-ndb 2.3.0__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google-cloud-ndb-2.3.0/google_cloud_ndb.egg-info → google_cloud_ndb-2.3.2}/PKG-INFO +7 -3
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/README.md +5 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_datastore_types.py +2 -2
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_gql.py +5 -6
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_retry.py +6 -1
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/client.py +8 -1
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/context.py +3 -4
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/key.py +5 -6
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/model.py +65 -67
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/query.py +5 -6
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/utils.py +1 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/version.py +1 -1
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2/google_cloud_ndb.egg-info}/PKG-INFO +7 -3
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/requires.txt +1 -2
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/setup.py +1 -3
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/AUTHORS +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/LICENSE +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/__init__.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_batch.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_cache.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_datastore_api.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_datastore_query.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_eventloop.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_legacy_entity_pb.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_legacy_protocol_buffer.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_options.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_remote.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_transaction.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/blobstore.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/django_middleware.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/exceptions.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/global_cache.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/metadata.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/msgprop.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/polymodel.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/stats.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/tasklets.py +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/SOURCES.txt +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/dependency_links.txt +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/not-zip-safe +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/top_level.txt +0 -0
- {google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-cloud-ndb
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: NDB library for Google Cloud Datastore
|
|
5
5
|
Home-page: https://github.com/googleapis/python-ndb
|
|
6
6
|
Author: Google LLC
|
|
@@ -28,20 +28,24 @@ License-File: LICENSE
|
|
|
28
28
|
License-File: AUTHORS
|
|
29
29
|
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.0
|
|
30
30
|
Requires-Dist: google-cloud-datastore<3.0.0dev,>=2.16.0
|
|
31
|
-
Requires-Dist: protobuf!=
|
|
31
|
+
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.2
|
|
32
32
|
Requires-Dist: pymemcache<5.0.0dev,>=2.1.0
|
|
33
33
|
Requires-Dist: pytz>=2018.3
|
|
34
34
|
Requires-Dist: redis<6.0.0dev,>=3.0.0
|
|
35
|
-
Requires-Dist: six<2.0.0dev,>=1.12.0
|
|
36
35
|
|
|
37
36
|
# Google Cloud Datastore `ndb` Client Library
|
|
38
37
|
|
|
38
|
+
[](https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels)
|
|
39
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
40
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
41
|
+
|
|
39
42
|
## Introduction
|
|
40
43
|
|
|
41
44
|
This is an updated version of the `ndb` client library for use with
|
|
42
45
|
[Google Cloud Datastore][0].
|
|
43
46
|
|
|
44
47
|
* [Client Library Documentation](https://googleapis.dev/python/python-ndb/latest)
|
|
48
|
+
* [Product Documentation](https://cloud.google.com/datastore/docs)
|
|
45
49
|
|
|
46
50
|
The original Python 2 version of `ndb` was designed specifically for the
|
|
47
51
|
[Google App Engine][1] `python27` runtime and can be found at
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# Google Cloud Datastore `ndb` Client Library
|
|
2
2
|
|
|
3
|
+
[](https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels)
|
|
4
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
5
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
6
|
+
|
|
3
7
|
## Introduction
|
|
4
8
|
|
|
5
9
|
This is an updated version of the `ndb` client library for use with
|
|
6
10
|
[Google Cloud Datastore][0].
|
|
7
11
|
|
|
8
12
|
* [Client Library Documentation](https://googleapis.dev/python/python-ndb/latest)
|
|
13
|
+
* [Product Documentation](https://cloud.google.com/datastore/docs)
|
|
9
14
|
|
|
10
15
|
The original Python 2 version of `ndb` was designed specifically for the
|
|
11
16
|
[Google App Engine][1] `python27` runtime and can be found at
|
|
@@ -46,8 +46,8 @@ class BlobKey(object):
|
|
|
46
46
|
blob_key (Optional[bytes]): The key used for the blobstore.
|
|
47
47
|
|
|
48
48
|
Raises:
|
|
49
|
-
.BadValueError: If the ``blob_key`` exceeds 1500 bytes.
|
|
50
|
-
.BadValueError: If the ``blob_key`` is not :data:`None` or a
|
|
49
|
+
exceptions.BadValueError: If the ``blob_key`` exceeds 1500 bytes.
|
|
50
|
+
exceptions.BadValueError: If the ``blob_key`` is not :data:`None` or a
|
|
51
51
|
:class:`bytes` instance.
|
|
52
52
|
"""
|
|
53
53
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import re
|
|
3
|
-
import six
|
|
4
3
|
import time
|
|
5
4
|
|
|
6
5
|
from google.cloud.ndb import context as context_module
|
|
@@ -656,7 +655,7 @@ class GQL(object):
|
|
|
656
655
|
"""
|
|
657
656
|
vals = []
|
|
658
657
|
for arg in args:
|
|
659
|
-
if isinstance(arg,
|
|
658
|
+
if isinstance(arg, (str, int)):
|
|
660
659
|
val = query_module.Parameter(arg)
|
|
661
660
|
else:
|
|
662
661
|
val = arg.Get()
|
|
@@ -782,7 +781,7 @@ def _raise_cast_error(message):
|
|
|
782
781
|
def _time_function(values):
|
|
783
782
|
if len(values) == 1:
|
|
784
783
|
value = values[0]
|
|
785
|
-
if isinstance(value,
|
|
784
|
+
if isinstance(value, str):
|
|
786
785
|
try:
|
|
787
786
|
time_tuple = time.strptime(value, "%H:%M:%S")
|
|
788
787
|
except ValueError as error:
|
|
@@ -791,7 +790,7 @@ def _time_function(values):
|
|
|
791
790
|
)
|
|
792
791
|
time_tuple = time_tuple[3:]
|
|
793
792
|
time_tuple = time_tuple[0:3]
|
|
794
|
-
elif isinstance(value,
|
|
793
|
+
elif isinstance(value, int):
|
|
795
794
|
time_tuple = (value,)
|
|
796
795
|
else:
|
|
797
796
|
_raise_cast_error("Invalid argument for time(), {}".format(value))
|
|
@@ -808,7 +807,7 @@ def _time_function(values):
|
|
|
808
807
|
def _date_function(values):
|
|
809
808
|
if len(values) == 1:
|
|
810
809
|
value = values[0]
|
|
811
|
-
if isinstance(value,
|
|
810
|
+
if isinstance(value, str):
|
|
812
811
|
try:
|
|
813
812
|
time_tuple = time.strptime(value, "%Y-%m-%d")[0:6]
|
|
814
813
|
except ValueError as error:
|
|
@@ -830,7 +829,7 @@ def _date_function(values):
|
|
|
830
829
|
def _datetime_function(values):
|
|
831
830
|
if len(values) == 1:
|
|
832
831
|
value = values[0]
|
|
833
|
-
if isinstance(value,
|
|
832
|
+
if isinstance(value, str):
|
|
834
833
|
try:
|
|
835
834
|
time_tuple = time.strptime(value, "%Y-%m-%d %H:%M:%S")[0:6]
|
|
836
835
|
except ValueError as error:
|
|
@@ -82,9 +82,10 @@ def retry_async(callback, retries=_DEFAULT_RETRIES):
|
|
|
82
82
|
result = yield result
|
|
83
83
|
except exceptions.NestedRetryException as e:
|
|
84
84
|
error = e
|
|
85
|
-
except
|
|
85
|
+
except BaseException as e:
|
|
86
86
|
# `e` is removed from locals at end of block
|
|
87
87
|
error = e # See: https://goo.gl/5J8BMK
|
|
88
|
+
|
|
88
89
|
if not is_transient_error(error):
|
|
89
90
|
# If we are in an inner retry block, use special nested
|
|
90
91
|
# retry exception to bubble up to outer retry. Else, raise
|
|
@@ -104,6 +105,10 @@ def retry_async(callback, retries=_DEFAULT_RETRIES):
|
|
|
104
105
|
|
|
105
106
|
yield tasklets.sleep(sleep_time)
|
|
106
107
|
|
|
108
|
+
# Unknown errors really want to show up as None, so manually set the error.
|
|
109
|
+
if isinstance(error, core_exceptions.Unknown):
|
|
110
|
+
error = "google.api_core.exceptions.Unknown"
|
|
111
|
+
|
|
107
112
|
raise core_exceptions.RetryError(
|
|
108
113
|
"Maximum number of {} retries exceeded while calling {}".format(
|
|
109
114
|
retries, callback
|
|
@@ -147,7 +147,14 @@ class Client(google_client.ClientWithProject):
|
|
|
147
147
|
)
|
|
148
148
|
|
|
149
149
|
if emulator:
|
|
150
|
-
channel = grpc.insecure_channel(
|
|
150
|
+
channel = grpc.insecure_channel(
|
|
151
|
+
self.host,
|
|
152
|
+
options=[
|
|
153
|
+
# Default options provided in DatastoreGrpcTransport, but not when we override the channel.
|
|
154
|
+
("grpc.max_send_message_length", -1),
|
|
155
|
+
("grpc.max_receive_message_length", -1),
|
|
156
|
+
],
|
|
157
|
+
)
|
|
151
158
|
else:
|
|
152
159
|
user_agent = self.client_info.to_user_agent()
|
|
153
160
|
channel = _helpers.make_secure_channel(
|
|
@@ -20,7 +20,6 @@ import contextlib
|
|
|
20
20
|
import contextvars
|
|
21
21
|
import itertools
|
|
22
22
|
import os
|
|
23
|
-
import six
|
|
24
23
|
import threading
|
|
25
24
|
import uuid
|
|
26
25
|
|
|
@@ -106,7 +105,7 @@ def get_context(raise_context_error=True):
|
|
|
106
105
|
Context: The current context.
|
|
107
106
|
|
|
108
107
|
Raises:
|
|
109
|
-
.ContextError: If called outside of a context
|
|
108
|
+
exceptions.ContextError: If called outside of a context
|
|
110
109
|
established by :meth:`google.cloud.ndb.client.Client.context` and
|
|
111
110
|
``raise_context_error`` is :data:`True`.
|
|
112
111
|
"""
|
|
@@ -140,7 +139,7 @@ def get_toplevel_context(raise_context_error=True):
|
|
|
140
139
|
Context: The current context.
|
|
141
140
|
|
|
142
141
|
Raises:
|
|
143
|
-
.ContextError: If called outside of a context
|
|
142
|
+
exceptions.ContextError: If called outside of a context
|
|
144
143
|
established by :meth:`google.cloud.ndb.client.Client.context` and
|
|
145
144
|
``raise_context_error`` is :data:`True`.
|
|
146
145
|
"""
|
|
@@ -550,7 +549,7 @@ class Context(_Context):
|
|
|
550
549
|
if policy is None:
|
|
551
550
|
policy = _default_global_cache_timeout_policy
|
|
552
551
|
|
|
553
|
-
elif isinstance(policy,
|
|
552
|
+
elif isinstance(policy, int):
|
|
554
553
|
timeout = policy
|
|
555
554
|
|
|
556
555
|
def policy(key):
|
|
@@ -90,7 +90,6 @@ namespace. To explicitly select the empty namespace pass ``namespace=""``.
|
|
|
90
90
|
|
|
91
91
|
import base64
|
|
92
92
|
import functools
|
|
93
|
-
import six
|
|
94
93
|
|
|
95
94
|
from google.cloud.datastore import _app_engine_key_pb2
|
|
96
95
|
from google.cloud.datastore import key as _key_module
|
|
@@ -1245,7 +1244,7 @@ def _from_urlsafe(urlsafe, app, namespace, database):
|
|
|
1245
1244
|
Tuple[google.cloud.datastore.key.Key, .Reference]: The key
|
|
1246
1245
|
corresponding to ``urlsafe`` and the Reference protobuf.
|
|
1247
1246
|
"""
|
|
1248
|
-
if isinstance(urlsafe,
|
|
1247
|
+
if isinstance(urlsafe, str): # pragma: NO BRANCH
|
|
1249
1248
|
urlsafe = urlsafe.encode("ascii")
|
|
1250
1249
|
padding = b"=" * (-len(urlsafe) % 4)
|
|
1251
1250
|
urlsafe += padding
|
|
@@ -1409,7 +1408,7 @@ def _parse_from_args(
|
|
|
1409
1408
|
~.datastore.Key: The constructed key.
|
|
1410
1409
|
|
|
1411
1410
|
Raises:
|
|
1412
|
-
.BadValueError: If ``parent`` is passed but is not a ``Key``.
|
|
1411
|
+
exceptions.BadValueError: If ``parent`` is passed but is not a ``Key``.
|
|
1413
1412
|
"""
|
|
1414
1413
|
# Avoid circular import in Python 2.7
|
|
1415
1414
|
from google.cloud.ndb import context as context_module
|
|
@@ -1515,7 +1514,7 @@ def _clean_flat_path(flat):
|
|
|
1515
1514
|
|
|
1516
1515
|
Raises:
|
|
1517
1516
|
TypeError: If the kind in a pair is an invalid type.
|
|
1518
|
-
.BadArgumentError: If a key ID is :data:`None` (indicating a partial
|
|
1517
|
+
exceptions.BadArgumentError: If a key ID is :data:`None` (indicating a partial
|
|
1519
1518
|
key), but in a pair other than the last one.
|
|
1520
1519
|
TypeError: If a key ID is not a string or integer.
|
|
1521
1520
|
"""
|
|
@@ -1526,7 +1525,7 @@ def _clean_flat_path(flat):
|
|
|
1526
1525
|
if isinstance(kind, type):
|
|
1527
1526
|
kind = kind._get_kind()
|
|
1528
1527
|
flat[i] = kind
|
|
1529
|
-
if not isinstance(kind,
|
|
1528
|
+
if not isinstance(kind, str):
|
|
1530
1529
|
raise TypeError(
|
|
1531
1530
|
"Key kind must be a string or Model class; "
|
|
1532
1531
|
"received {!r}".format(kind)
|
|
@@ -1537,7 +1536,7 @@ def _clean_flat_path(flat):
|
|
|
1537
1536
|
if id_ is None:
|
|
1538
1537
|
if i + 2 < len(flat):
|
|
1539
1538
|
raise exceptions.BadArgumentError("Incomplete Key entry must be last")
|
|
1540
|
-
elif not isinstance(id_,
|
|
1539
|
+
elif not isinstance(id_, (str, int)):
|
|
1541
1540
|
raise TypeError(_INVALID_ID_TYPE.format(id_))
|
|
1542
1541
|
|
|
1543
1542
|
# Remove trailing ``None`` for a partial key.
|
|
@@ -257,7 +257,6 @@ import functools
|
|
|
257
257
|
import inspect
|
|
258
258
|
import json
|
|
259
259
|
import pickle
|
|
260
|
-
import six
|
|
261
260
|
import zlib
|
|
262
261
|
|
|
263
262
|
import pytz
|
|
@@ -1069,7 +1068,7 @@ class Property(ModelAttribute):
|
|
|
1069
1068
|
TypeError: If the ``name`` is not a string.
|
|
1070
1069
|
ValueError: If the name contains a ``.``.
|
|
1071
1070
|
"""
|
|
1072
|
-
if not isinstance(name,
|
|
1071
|
+
if not isinstance(name, str):
|
|
1073
1072
|
raise TypeError("Name {!r} is not a string".format(name))
|
|
1074
1073
|
|
|
1075
1074
|
if "." in name:
|
|
@@ -1488,7 +1487,7 @@ class Property(ModelAttribute):
|
|
|
1488
1487
|
Raises:
|
|
1489
1488
|
ReadonlyPropertyError: If the ``entity`` is the result of a
|
|
1490
1489
|
projection query.
|
|
1491
|
-
.BadValueError: If the current property is repeated but the
|
|
1490
|
+
exceptions.BadValueError: If the current property is repeated but the
|
|
1492
1491
|
``value`` is not a basic container (:class:`list`,
|
|
1493
1492
|
:class:`tuple`, :class:`set` or :class:`frozenset`).
|
|
1494
1493
|
"""
|
|
@@ -2102,7 +2101,7 @@ class Property(ModelAttribute):
|
|
|
2102
2101
|
# If this passes, don't return unicode.
|
|
2103
2102
|
except UnicodeDecodeError:
|
|
2104
2103
|
try:
|
|
2105
|
-
sval =
|
|
2104
|
+
sval = str(sval.decode("utf-8"))
|
|
2106
2105
|
except UnicodeDecodeError:
|
|
2107
2106
|
pass
|
|
2108
2107
|
return sval
|
|
@@ -2259,15 +2258,15 @@ def _validate_key(value, entity=None):
|
|
|
2259
2258
|
"""Validate a key.
|
|
2260
2259
|
|
|
2261
2260
|
Args:
|
|
2262
|
-
value (.Key): The key to be validated.
|
|
2261
|
+
value (~google.cloud.ndb.key.Key): The key to be validated.
|
|
2263
2262
|
entity (Optional[Model]): The entity that the key is being validated
|
|
2264
2263
|
for.
|
|
2265
2264
|
|
|
2266
2265
|
Returns:
|
|
2267
|
-
.Key: The passed in ``value``.
|
|
2266
|
+
~google.cloud.ndb.key.Key: The passed in ``value``.
|
|
2268
2267
|
|
|
2269
2268
|
Raises:
|
|
2270
|
-
.BadValueError: If ``value`` is not a :class
|
|
2269
|
+
exceptions.BadValueError: If ``value`` is not a :class:`~google.cloud.ndb.key.Key`.
|
|
2271
2270
|
KindError: If ``entity`` is specified, but the kind of the entity
|
|
2272
2271
|
doesn't match the kind of ``value``.
|
|
2273
2272
|
"""
|
|
@@ -2316,7 +2315,7 @@ class ModelKey(Property):
|
|
|
2316
2315
|
comparison.
|
|
2317
2316
|
|
|
2318
2317
|
Raises:
|
|
2319
|
-
.BadValueError: If ``value`` is :data:`None`.
|
|
2318
|
+
exceptions.BadValueError: If ``value`` is :data:`None`.
|
|
2320
2319
|
"""
|
|
2321
2320
|
if value is not None:
|
|
2322
2321
|
return super(ModelKey, self)._comparison(op, value)
|
|
@@ -2327,10 +2326,10 @@ class ModelKey(Property):
|
|
|
2327
2326
|
"""Validate a ``value`` before setting it.
|
|
2328
2327
|
|
|
2329
2328
|
Args:
|
|
2330
|
-
value (.Key): The value to check.
|
|
2329
|
+
value (~google.cloud.ndb.key.Key): The value to check.
|
|
2331
2330
|
|
|
2332
2331
|
Returns:
|
|
2333
|
-
.Key: The passed-in ``value``.
|
|
2332
|
+
~google.cloud.ndb.key.Key: The passed-in ``value``.
|
|
2334
2333
|
"""
|
|
2335
2334
|
return _validate_key(value)
|
|
2336
2335
|
|
|
@@ -2340,7 +2339,7 @@ class ModelKey(Property):
|
|
|
2340
2339
|
|
|
2341
2340
|
Args:
|
|
2342
2341
|
entity (Model): An entity to set the entity key on.
|
|
2343
|
-
value (.Key): The key to be set on the entity.
|
|
2342
|
+
value (~google.cloud.ndb.key.Key): The key to be set on the entity.
|
|
2344
2343
|
"""
|
|
2345
2344
|
if value is not None:
|
|
2346
2345
|
value = _validate_key(value, entity=entity)
|
|
@@ -2356,7 +2355,7 @@ class ModelKey(Property):
|
|
|
2356
2355
|
entity (Model): An entity to get the entity key from.
|
|
2357
2356
|
|
|
2358
2357
|
Returns:
|
|
2359
|
-
.Key: The entity key stored on ``entity``.
|
|
2358
|
+
~google.cloud.ndb.key.Key: The entity key stored on ``entity``.
|
|
2360
2359
|
"""
|
|
2361
2360
|
return entity._entity_key
|
|
2362
2361
|
|
|
@@ -2386,7 +2385,7 @@ class BooleanProperty(Property):
|
|
|
2386
2385
|
bool: The passed-in ``value``.
|
|
2387
2386
|
|
|
2388
2387
|
Raises:
|
|
2389
|
-
.BadValueError: If ``value`` is not a :class:`bool`.
|
|
2388
|
+
exceptions.BadValueError: If ``value`` is not a :class:`bool`.
|
|
2390
2389
|
"""
|
|
2391
2390
|
if not isinstance(value, bool):
|
|
2392
2391
|
raise exceptions.BadValueError(
|
|
@@ -2432,10 +2431,10 @@ class IntegerProperty(Property):
|
|
|
2432
2431
|
int: The passed-in ``value``.
|
|
2433
2432
|
|
|
2434
2433
|
Raises:
|
|
2435
|
-
.BadValueError: If ``value`` is not an :class:`int` or convertible
|
|
2434
|
+
exceptions.BadValueError: If ``value`` is not an :class:`int` or convertible
|
|
2436
2435
|
to one.
|
|
2437
2436
|
"""
|
|
2438
|
-
if not isinstance(value,
|
|
2437
|
+
if not isinstance(value, int):
|
|
2439
2438
|
raise exceptions.BadValueError(
|
|
2440
2439
|
"In field {}, expected integer, got {!r}".format(self._name, value)
|
|
2441
2440
|
)
|
|
@@ -2464,17 +2463,17 @@ class FloatProperty(Property):
|
|
|
2464
2463
|
:class:`float`.
|
|
2465
2464
|
|
|
2466
2465
|
Raises:
|
|
2467
|
-
.BadValueError: If ``value`` is not a :class:`float` or convertible
|
|
2466
|
+
exceptions.BadValueError: If ``value`` is not a :class:`float` or convertible
|
|
2468
2467
|
to one.
|
|
2469
2468
|
"""
|
|
2470
|
-
if not isinstance(value,
|
|
2469
|
+
if not isinstance(value, (float, int)):
|
|
2471
2470
|
raise exceptions.BadValueError(
|
|
2472
2471
|
"In field {}, expected float, got {!r}".format(self._name, value)
|
|
2473
2472
|
)
|
|
2474
2473
|
return float(value)
|
|
2475
2474
|
|
|
2476
2475
|
|
|
2477
|
-
class _CompressedValue(
|
|
2476
|
+
class _CompressedValue(bytes):
|
|
2478
2477
|
"""A marker object wrapping compressed values.
|
|
2479
2478
|
|
|
2480
2479
|
Args:
|
|
@@ -2596,8 +2595,8 @@ class BlobProperty(Property):
|
|
|
2596
2595
|
value (bytes): The value to check.
|
|
2597
2596
|
|
|
2598
2597
|
Raises:
|
|
2599
|
-
.BadValueError: If ``value`` is not a :class:`bytes`.
|
|
2600
|
-
.BadValueError: If the current property is indexed but the value
|
|
2598
|
+
exceptions.BadValueError: If ``value`` is not a :class:`bytes`.
|
|
2599
|
+
exceptions.BadValueError: If the current property is indexed but the value
|
|
2601
2600
|
exceeds the maximum length (1500 bytes).
|
|
2602
2601
|
"""
|
|
2603
2602
|
if not isinstance(value, bytes):
|
|
@@ -2777,14 +2776,14 @@ class CompressedTextProperty(BlobProperty):
|
|
|
2777
2776
|
value (Union[bytes, str]): The value to check.
|
|
2778
2777
|
|
|
2779
2778
|
Raises:
|
|
2780
|
-
.BadValueError: If ``value`` is :class:`bytes`, but is not a valid
|
|
2779
|
+
exceptions.BadValueError: If ``value`` is :class:`bytes`, but is not a valid
|
|
2781
2780
|
UTF-8 encoded string.
|
|
2782
|
-
.BadValueError: If ``value`` is neither :class:`bytes` nor
|
|
2781
|
+
exceptions.BadValueError: If ``value`` is neither :class:`bytes` nor
|
|
2783
2782
|
:class:`str`.
|
|
2784
|
-
.BadValueError: If the current property is indexed but the UTF-8
|
|
2783
|
+
exceptions.BadValueError: If the current property is indexed but the UTF-8
|
|
2785
2784
|
encoded value exceeds the maximum length (1500 bytes).
|
|
2786
2785
|
"""
|
|
2787
|
-
if not isinstance(value,
|
|
2786
|
+
if not isinstance(value, str):
|
|
2788
2787
|
# In Python 2.7, bytes is a synonym for str
|
|
2789
2788
|
if isinstance(value, bytes):
|
|
2790
2789
|
try:
|
|
@@ -2811,7 +2810,7 @@ class CompressedTextProperty(BlobProperty):
|
|
|
2811
2810
|
:class:`str`, this will return the UTF-8 encoded bytes for it.
|
|
2812
2811
|
Otherwise, it will return :data:`None`.
|
|
2813
2812
|
"""
|
|
2814
|
-
if isinstance(value,
|
|
2813
|
+
if isinstance(value, str):
|
|
2815
2814
|
return value.encode("utf-8")
|
|
2816
2815
|
|
|
2817
2816
|
def _from_base_type(self, value):
|
|
@@ -2939,14 +2938,14 @@ class TextProperty(Property):
|
|
|
2939
2938
|
value (Union[bytes, str]): The value to check.
|
|
2940
2939
|
|
|
2941
2940
|
Raises:
|
|
2942
|
-
.BadValueError: If ``value`` is :class:`bytes`, but is not a valid
|
|
2941
|
+
exceptions.BadValueError: If ``value`` is :class:`bytes`, but is not a valid
|
|
2943
2942
|
UTF-8 encoded string.
|
|
2944
|
-
.BadValueError: If ``value`` is neither :class:`bytes` nor
|
|
2943
|
+
exceptions.BadValueError: If ``value`` is neither :class:`bytes` nor
|
|
2945
2944
|
:class:`str`.
|
|
2946
|
-
.BadValueError: If the current property is indexed but the UTF-8
|
|
2945
|
+
exceptions.BadValueError: If the current property is indexed but the UTF-8
|
|
2947
2946
|
encoded value exceeds the maximum length (1500 bytes).
|
|
2948
2947
|
"""
|
|
2949
|
-
if isinstance(value,
|
|
2948
|
+
if isinstance(value, bytes):
|
|
2950
2949
|
try:
|
|
2951
2950
|
encoded_length = len(value)
|
|
2952
2951
|
value = value.decode("utf-8")
|
|
@@ -2956,7 +2955,7 @@ class TextProperty(Property):
|
|
|
2956
2955
|
self._name, value
|
|
2957
2956
|
)
|
|
2958
2957
|
)
|
|
2959
|
-
elif isinstance(value,
|
|
2958
|
+
elif isinstance(value, str):
|
|
2960
2959
|
encoded_length = len(value.encode("utf-8"))
|
|
2961
2960
|
else:
|
|
2962
2961
|
raise exceptions.BadValueError("Expected string, got {!r}".format(value))
|
|
@@ -2978,7 +2977,7 @@ class TextProperty(Property):
|
|
|
2978
2977
|
:class:`bytes`, this will return the UTF-8 decoded ``str`` for it.
|
|
2979
2978
|
Otherwise, it will return :data:`None`.
|
|
2980
2979
|
"""
|
|
2981
|
-
if isinstance(value,
|
|
2980
|
+
if isinstance(value, bytes):
|
|
2982
2981
|
return value.decode("utf-8")
|
|
2983
2982
|
|
|
2984
2983
|
def _from_base_type(self, value):
|
|
@@ -3001,7 +3000,7 @@ class TextProperty(Property):
|
|
|
3001
3000
|
:class:`str` corresponding to it. Otherwise, it will return
|
|
3002
3001
|
:data:`None`.
|
|
3003
3002
|
"""
|
|
3004
|
-
if isinstance(value,
|
|
3003
|
+
if isinstance(value, bytes):
|
|
3005
3004
|
try:
|
|
3006
3005
|
return value.decode("utf-8")
|
|
3007
3006
|
except UnicodeError:
|
|
@@ -3057,7 +3056,7 @@ class GeoPtProperty(Property):
|
|
|
3057
3056
|
check.
|
|
3058
3057
|
|
|
3059
3058
|
Raises:
|
|
3060
|
-
.BadValueError: If ``value`` is not a :attr:`.GeoPt`.
|
|
3059
|
+
exceptions.BadValueError: If ``value`` is not a :attr:`.GeoPt`.
|
|
3061
3060
|
"""
|
|
3062
3061
|
if not isinstance(value, GeoPt):
|
|
3063
3062
|
raise exceptions.BadValueError(
|
|
@@ -3209,7 +3208,7 @@ class JsonProperty(BlobProperty):
|
|
|
3209
3208
|
"""
|
|
3210
3209
|
# We write and retrieve `bytes` normally, but for some reason get back
|
|
3211
3210
|
# `str` from a projection query.
|
|
3212
|
-
if not isinstance(value,
|
|
3211
|
+
if not isinstance(value, str):
|
|
3213
3212
|
value = value.decode("ascii")
|
|
3214
3213
|
return json.loads(value)
|
|
3215
3214
|
|
|
@@ -3479,7 +3478,7 @@ class UserProperty(Property):
|
|
|
3479
3478
|
value (User): The value to check.
|
|
3480
3479
|
|
|
3481
3480
|
Raises:
|
|
3482
|
-
.BadValueError: If ``value`` is not a :class:`User`.
|
|
3481
|
+
exceptions.BadValueError: If ``value`` is not a :class:`User`.
|
|
3483
3482
|
"""
|
|
3484
3483
|
# Might be GAE User or our own version
|
|
3485
3484
|
if type(value).__name__ != "User":
|
|
@@ -3510,14 +3509,14 @@ class UserProperty(Property):
|
|
|
3510
3509
|
user_entity = ds_entity_module.Entity()
|
|
3511
3510
|
|
|
3512
3511
|
# Set required fields.
|
|
3513
|
-
user_entity["email"] =
|
|
3512
|
+
user_entity["email"] = str(value.email())
|
|
3514
3513
|
user_entity.exclude_from_indexes.add("email")
|
|
3515
|
-
user_entity["auth_domain"] =
|
|
3514
|
+
user_entity["auth_domain"] = str(value.auth_domain())
|
|
3516
3515
|
user_entity.exclude_from_indexes.add("auth_domain")
|
|
3517
3516
|
# Set optional field.
|
|
3518
3517
|
user_id = value.user_id()
|
|
3519
3518
|
if user_id:
|
|
3520
|
-
user_entity["user_id"] =
|
|
3519
|
+
user_entity["user_id"] = str(user_id)
|
|
3521
3520
|
user_entity.exclude_from_indexes.add("user_id")
|
|
3522
3521
|
|
|
3523
3522
|
return user_entity
|
|
@@ -3553,7 +3552,7 @@ class UserProperty(Property):
|
|
|
3553
3552
|
|
|
3554
3553
|
|
|
3555
3554
|
class KeyProperty(Property):
|
|
3556
|
-
"""A property that contains :class
|
|
3555
|
+
"""A property that contains :class:`~google.cloud.ndb.key.Key` values.
|
|
3557
3556
|
|
|
3558
3557
|
The constructor for :class:`KeyProperty` allows at most two positional
|
|
3559
3558
|
arguments. Any usage of :data:`None` as a positional argument will
|
|
@@ -3596,10 +3595,10 @@ class KeyProperty(Property):
|
|
|
3596
3595
|
multiple values.
|
|
3597
3596
|
required (bool): Indicates if this property is required on the given
|
|
3598
3597
|
model type.
|
|
3599
|
-
default (.Key): The default value for this property.
|
|
3600
|
-
choices (Iterable[.Key]): A container of allowed values for this
|
|
3598
|
+
default (~google.cloud.ndb.key.Key): The default value for this property.
|
|
3599
|
+
choices (Iterable[~google.cloud.ndb.key.Key]): A container of allowed values for this
|
|
3601
3600
|
property.
|
|
3602
|
-
validator (Callable[[~google.cloud.ndb.model.Property, .Key], bool]): A
|
|
3601
|
+
validator (Callable[[~google.cloud.ndb.model.Property, ~google.cloud.ndb.key.Key], bool]): A
|
|
3603
3602
|
validator to be used to check values.
|
|
3604
3603
|
verbose_name (str): A longer, user-friendly name for this property.
|
|
3605
3604
|
write_empty_list (bool): Indicates if an empty list should be written
|
|
@@ -3612,7 +3611,7 @@ class KeyProperty(Property):
|
|
|
3612
3611
|
@functools.wraps(wrapped)
|
|
3613
3612
|
def wrapper(self, *args, **kwargs):
|
|
3614
3613
|
for arg in args:
|
|
3615
|
-
if isinstance(arg,
|
|
3614
|
+
if isinstance(arg, str):
|
|
3616
3615
|
if "name" in kwargs:
|
|
3617
3616
|
raise TypeError("You can only specify name once")
|
|
3618
3617
|
|
|
@@ -3651,7 +3650,7 @@ class KeyProperty(Property):
|
|
|
3651
3650
|
kind = kind._get_kind()
|
|
3652
3651
|
|
|
3653
3652
|
else:
|
|
3654
|
-
if kind is not None and not isinstance(kind,
|
|
3653
|
+
if kind is not None and not isinstance(kind, str):
|
|
3655
3654
|
raise TypeError("Kind must be a Model class or a string")
|
|
3656
3655
|
|
|
3657
3656
|
super(KeyProperty, self).__init__(
|
|
@@ -3687,13 +3686,13 @@ class KeyProperty(Property):
|
|
|
3687
3686
|
"""Validate a ``value`` before setting it.
|
|
3688
3687
|
|
|
3689
3688
|
Args:
|
|
3690
|
-
value (.Key): The value to check.
|
|
3689
|
+
value (~google.cloud.ndb.key.Key): The value to check.
|
|
3691
3690
|
|
|
3692
3691
|
Raises:
|
|
3693
|
-
.BadValueError: If ``value`` is not a :class:`.Key`.
|
|
3694
|
-
.BadValueError: If ``value`` is a partial :class:`.Key` (i.e. it
|
|
3692
|
+
exceptions.BadValueError: If ``value`` is not a :class:`.Key`.
|
|
3693
|
+
exceptions.BadValueError: If ``value`` is a partial :class:`.Key` (i.e. it
|
|
3695
3694
|
has no name or ID set).
|
|
3696
|
-
.BadValueError: If the current property has an associated ``kind``
|
|
3695
|
+
exceptions.BadValueError: If the current property has an associated ``kind``
|
|
3697
3696
|
and ``value`` does not match that kind.
|
|
3698
3697
|
"""
|
|
3699
3698
|
if not isinstance(value, Key):
|
|
@@ -3759,7 +3758,7 @@ class BlobKeyProperty(Property):
|
|
|
3759
3758
|
value (~google.cloud.ndb.model.BlobKey): The value to check.
|
|
3760
3759
|
|
|
3761
3760
|
Raises:
|
|
3762
|
-
.BadValueError: If ``value`` is not a
|
|
3761
|
+
exceptions.BadValueError: If ``value`` is not a
|
|
3763
3762
|
:class:`~google.cloud.ndb.model.BlobKey`.
|
|
3764
3763
|
"""
|
|
3765
3764
|
if not isinstance(value, BlobKey):
|
|
@@ -3878,7 +3877,7 @@ class DateTimeProperty(Property):
|
|
|
3878
3877
|
value (~datetime.datetime): The value to check.
|
|
3879
3878
|
|
|
3880
3879
|
Raises:
|
|
3881
|
-
.BadValueError: If ``value`` is not a :class:`~datetime.datetime`.
|
|
3880
|
+
exceptions.BadValueError: If ``value`` is not a :class:`~datetime.datetime`.
|
|
3882
3881
|
"""
|
|
3883
3882
|
if not isinstance(value, datetime.datetime):
|
|
3884
3883
|
raise exceptions.BadValueError(
|
|
@@ -3933,7 +3932,7 @@ class DateTimeProperty(Property):
|
|
|
3933
3932
|
returns the value without ``tzinfo`` or ``None`` if value did
|
|
3934
3933
|
not have ``tzinfo`` set.
|
|
3935
3934
|
"""
|
|
3936
|
-
if isinstance(value,
|
|
3935
|
+
if isinstance(value, int):
|
|
3937
3936
|
# Projection query, value is integer nanoseconds
|
|
3938
3937
|
seconds = value / 1e6
|
|
3939
3938
|
value = datetime.datetime.fromtimestamp(seconds, pytz.utc)
|
|
@@ -3977,7 +3976,7 @@ class DateProperty(DateTimeProperty):
|
|
|
3977
3976
|
value (~datetime.date): The value to check.
|
|
3978
3977
|
|
|
3979
3978
|
Raises:
|
|
3980
|
-
.BadValueError: If ``value`` is not a :class:`~datetime.date`.
|
|
3979
|
+
exceptions.BadValueError: If ``value`` is not a :class:`~datetime.date`.
|
|
3981
3980
|
"""
|
|
3982
3981
|
if not isinstance(value, datetime.date):
|
|
3983
3982
|
raise exceptions.BadValueError(
|
|
@@ -4037,7 +4036,7 @@ class TimeProperty(DateTimeProperty):
|
|
|
4037
4036
|
value (~datetime.time): The value to check.
|
|
4038
4037
|
|
|
4039
4038
|
Raises:
|
|
4040
|
-
.BadValueError: If ``value`` is not a :class:`~datetime.time`.
|
|
4039
|
+
exceptions.BadValueError: If ``value`` is not a :class:`~datetime.time`.
|
|
4041
4040
|
"""
|
|
4042
4041
|
if not isinstance(value, datetime.time):
|
|
4043
4042
|
raise exceptions.BadValueError(
|
|
@@ -4441,7 +4440,7 @@ class LocalStructuredProperty(BlobProperty):
|
|
|
4441
4440
|
Args:
|
|
4442
4441
|
value: The value to check.
|
|
4443
4442
|
Raises:
|
|
4444
|
-
.BadValueError: If ``value`` is not a given class.
|
|
4443
|
+
exceptions.BadValueError: If ``value`` is not a given class.
|
|
4445
4444
|
"""
|
|
4446
4445
|
if isinstance(value, dict):
|
|
4447
4446
|
# A dict is assumed to be the result of a _to_dict() call.
|
|
@@ -4698,8 +4697,7 @@ class MetaModel(type):
|
|
|
4698
4697
|
return "{}<{}>".format(cls.__name__, ", ".join(props))
|
|
4699
4698
|
|
|
4700
4699
|
|
|
4701
|
-
|
|
4702
|
-
class Model(_NotEqualMixin):
|
|
4700
|
+
class Model(_NotEqualMixin, metaclass=MetaModel):
|
|
4703
4701
|
"""A class describing Cloud Datastore entities.
|
|
4704
4702
|
|
|
4705
4703
|
Model instances are usually called entities. All model classes
|
|
@@ -4871,7 +4869,7 @@ class Model(_NotEqualMixin):
|
|
|
4871
4869
|
to properties of this model.
|
|
4872
4870
|
|
|
4873
4871
|
Raises:
|
|
4874
|
-
.BadArgumentError: If the constructor is called with ``key`` and one
|
|
4872
|
+
exceptions.BadArgumentError: If the constructor is called with ``key`` and one
|
|
4875
4873
|
of ``id``, ``app``, ``namespace``, ``database``, or ``parent`` specified.
|
|
4876
4874
|
"""
|
|
4877
4875
|
|
|
@@ -4965,7 +4963,7 @@ class Model(_NotEqualMixin):
|
|
|
4965
4963
|
|
|
4966
4964
|
def _get_property_for(self, p, indexed=True, depth=0):
|
|
4967
4965
|
"""Internal helper to get the Property for a protobuf-level property."""
|
|
4968
|
-
if isinstance(p.name(),
|
|
4966
|
+
if isinstance(p.name(), str):
|
|
4969
4967
|
p.set_name(bytes(p.name(), encoding="utf-8"))
|
|
4970
4968
|
parts = p.name().decode().split(".")
|
|
4971
4969
|
if len(parts) <= depth:
|
|
@@ -5023,9 +5021,9 @@ class Model(_NotEqualMixin):
|
|
|
5023
5021
|
# A key passed in overrides a key in the pb.
|
|
5024
5022
|
if key is None and pb.key().path.element_size():
|
|
5025
5023
|
# modern NDB expects strings.
|
|
5026
|
-
if not isinstance(pb.key_.app_,
|
|
5024
|
+
if not isinstance(pb.key_.app_, str): # pragma: NO BRANCH
|
|
5027
5025
|
pb.key_.app_ = pb.key_.app_.decode()
|
|
5028
|
-
if not isinstance(pb.key_.name_space_,
|
|
5026
|
+
if not isinstance(pb.key_.name_space_, str): # pragma: NO BRANCH
|
|
5029
5027
|
pb.key_.name_space_ = pb.key_.name_space_.decode()
|
|
5030
5028
|
|
|
5031
5029
|
key = Key(reference=pb.key())
|
|
@@ -5331,7 +5329,7 @@ class Model(_NotEqualMixin):
|
|
|
5331
5329
|
an underscore.
|
|
5332
5330
|
"""
|
|
5333
5331
|
kind = cls._get_kind()
|
|
5334
|
-
if not isinstance(kind,
|
|
5332
|
+
if not isinstance(kind, str):
|
|
5335
5333
|
raise KindError(
|
|
5336
5334
|
"Class {} defines a ``_get_kind()`` method that returns "
|
|
5337
5335
|
"a non-string ({!r})".format(cls.__name__, kind)
|
|
@@ -5373,10 +5371,10 @@ class Model(_NotEqualMixin):
|
|
|
5373
5371
|
"""Validation for ``_key`` attribute (designed to be overridden).
|
|
5374
5372
|
|
|
5375
5373
|
Args:
|
|
5376
|
-
key (.Key): Proposed key to use for this entity.
|
|
5374
|
+
key (~google.cloud.ndb.key.Key): Proposed key to use for this entity.
|
|
5377
5375
|
|
|
5378
5376
|
Returns:
|
|
5379
|
-
.Key: The validated ``key``.
|
|
5377
|
+
~google.cloud.ndb.key.Key: The validated ``key``.
|
|
5380
5378
|
"""
|
|
5381
5379
|
return key
|
|
5382
5380
|
|
|
@@ -6061,7 +6059,7 @@ class Model(_NotEqualMixin):
|
|
|
6061
6059
|
project = _cls._get_arg(kwargs, "project")
|
|
6062
6060
|
options = kwargs.pop("_options")
|
|
6063
6061
|
|
|
6064
|
-
if not isinstance(name,
|
|
6062
|
+
if not isinstance(name, str):
|
|
6065
6063
|
raise TypeError("'name' must be a string; received {!r}".format(name))
|
|
6066
6064
|
|
|
6067
6065
|
elif not name:
|
|
@@ -6666,10 +6664,10 @@ def get_indexes(**options):
|
|
|
6666
6664
|
def _unpack_user(v):
|
|
6667
6665
|
"""Internal helper to unpack a User value from a protocol buffer."""
|
|
6668
6666
|
uv = v.uservalue()
|
|
6669
|
-
email =
|
|
6670
|
-
auth_domain =
|
|
6667
|
+
email = str(uv.email().decode("utf-8"))
|
|
6668
|
+
auth_domain = str(uv.auth_domain().decode("utf-8"))
|
|
6671
6669
|
obfuscated_gaiaid = uv.obfuscated_gaiaid().decode("utf-8")
|
|
6672
|
-
obfuscated_gaiaid =
|
|
6670
|
+
obfuscated_gaiaid = str(obfuscated_gaiaid)
|
|
6673
6671
|
|
|
6674
6672
|
value = User(
|
|
6675
6673
|
email=email,
|
|
@@ -139,7 +139,6 @@ tasklet, properly yielding when appropriate::
|
|
|
139
139
|
|
|
140
140
|
import functools
|
|
141
141
|
import logging
|
|
142
|
-
import six
|
|
143
142
|
|
|
144
143
|
from google.cloud.ndb import context as context_module
|
|
145
144
|
from google.cloud.ndb import exceptions
|
|
@@ -306,7 +305,7 @@ class Parameter(ParameterizedThing):
|
|
|
306
305
|
"""
|
|
307
306
|
|
|
308
307
|
def __init__(self, key):
|
|
309
|
-
if not isinstance(key,
|
|
308
|
+
if not isinstance(key, (int, str)):
|
|
310
309
|
raise TypeError(
|
|
311
310
|
"Parameter key must be an integer or string, not {}".format(key)
|
|
312
311
|
)
|
|
@@ -339,7 +338,7 @@ class Parameter(ParameterizedThing):
|
|
|
339
338
|
Any: The bound value for the current parameter.
|
|
340
339
|
|
|
341
340
|
Raises:
|
|
342
|
-
.BadArgumentError: If the current parameter is not in ``bindings``.
|
|
341
|
+
exceptions.BadArgumentError: If the current parameter is not in ``bindings``.
|
|
343
342
|
"""
|
|
344
343
|
key = self._key
|
|
345
344
|
if key not in bindings:
|
|
@@ -566,7 +565,7 @@ class ParameterNode(Node):
|
|
|
566
565
|
post (bool): Indicates if this is a post-filter node.
|
|
567
566
|
|
|
568
567
|
Raises:
|
|
569
|
-
.BadArgumentError: Always. This is because this node represents
|
|
568
|
+
exceptions.BadArgumentError: Always. This is because this node represents
|
|
570
569
|
a parameter, i.e. no value exists to be filtered on.
|
|
571
570
|
"""
|
|
572
571
|
raise exceptions.BadArgumentError(
|
|
@@ -1680,7 +1679,7 @@ class Query(object):
|
|
|
1680
1679
|
elif isinstance(order, model.Property):
|
|
1681
1680
|
# use the sign to turn it into a PropertyOrder
|
|
1682
1681
|
orders.append(+order)
|
|
1683
|
-
elif isinstance(order,
|
|
1682
|
+
elif isinstance(order, str):
|
|
1684
1683
|
name = order
|
|
1685
1684
|
reverse = False
|
|
1686
1685
|
if order.startswith("-"):
|
|
@@ -2349,7 +2348,7 @@ def _to_property_names(properties):
|
|
|
2349
2348
|
|
|
2350
2349
|
fixed = []
|
|
2351
2350
|
for prop in properties:
|
|
2352
|
-
if isinstance(prop,
|
|
2351
|
+
if isinstance(prop, str):
|
|
2353
2352
|
fixed.append(prop)
|
|
2354
2353
|
elif isinstance(prop, model.Property):
|
|
2355
2354
|
fixed.append(prop._name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-cloud-ndb
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.2
|
|
4
4
|
Summary: NDB library for Google Cloud Datastore
|
|
5
5
|
Home-page: https://github.com/googleapis/python-ndb
|
|
6
6
|
Author: Google LLC
|
|
@@ -28,20 +28,24 @@ License-File: LICENSE
|
|
|
28
28
|
License-File: AUTHORS
|
|
29
29
|
Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.0
|
|
30
30
|
Requires-Dist: google-cloud-datastore<3.0.0dev,>=2.16.0
|
|
31
|
-
Requires-Dist: protobuf!=
|
|
31
|
+
Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.2
|
|
32
32
|
Requires-Dist: pymemcache<5.0.0dev,>=2.1.0
|
|
33
33
|
Requires-Dist: pytz>=2018.3
|
|
34
34
|
Requires-Dist: redis<6.0.0dev,>=3.0.0
|
|
35
|
-
Requires-Dist: six<2.0.0dev,>=1.12.0
|
|
36
35
|
|
|
37
36
|
# Google Cloud Datastore `ndb` Client Library
|
|
38
37
|
|
|
38
|
+
[](https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels)
|
|
39
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
40
|
+
[](https://pypi.org/project/google-cloud-ndb/)
|
|
41
|
+
|
|
39
42
|
## Introduction
|
|
40
43
|
|
|
41
44
|
This is an updated version of the `ndb` client library for use with
|
|
42
45
|
[Google Cloud Datastore][0].
|
|
43
46
|
|
|
44
47
|
* [Client Library Documentation](https://googleapis.dev/python/python-ndb/latest)
|
|
48
|
+
* [Product Documentation](https://cloud.google.com/datastore/docs)
|
|
45
49
|
|
|
46
50
|
The original Python 2 version of `ndb` was designed specifically for the
|
|
47
51
|
[Google App Engine][1] `python27` runtime and can be found at
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.0
|
|
2
2
|
google-cloud-datastore<3.0.0dev,>=2.16.0
|
|
3
|
-
protobuf!=
|
|
3
|
+
protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.2
|
|
4
4
|
pymemcache<5.0.0dev,>=2.1.0
|
|
5
5
|
pytz>=2018.3
|
|
6
6
|
redis<6.0.0dev,>=3.0.0
|
|
7
|
-
six<2.0.0dev,>=1.12.0
|
|
@@ -42,12 +42,10 @@ def main():
|
|
|
42
42
|
dependencies = [
|
|
43
43
|
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
|
|
44
44
|
"google-cloud-datastore >= 2.16.0, < 3.0.0dev",
|
|
45
|
-
"protobuf >= 3.
|
|
45
|
+
"protobuf >= 3.20.2, <6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
|
|
46
46
|
"pymemcache >= 2.1.0, < 5.0.0dev",
|
|
47
47
|
"pytz >= 2018.3",
|
|
48
48
|
"redis >= 3.0.0, < 6.0.0dev",
|
|
49
|
-
# TODO(https://github.com/googleapis/python-ndb/issues/913) remove this dependency once six is no longer used in the codebase
|
|
50
|
-
"six >= 1.12.0, < 2.0.0dev"
|
|
51
49
|
]
|
|
52
50
|
|
|
53
51
|
setuptools.setup(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google/cloud/ndb/_legacy_protocol_buffer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google-cloud-ndb-2.3.0 → google_cloud_ndb-2.3.2}/google_cloud_ndb.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|