diff --git a/gcloud/datastore/__init__.py b/gcloud/datastore/__init__.py index 5b6d2d9815bb..c9cb11020b07 100644 --- a/gcloud/datastore/__init__.py +++ b/gcloud/datastore/__init__.py @@ -18,9 +18,10 @@ >>> from gcloud import datastore ->>> key = datastore.Key('EntityKind', 1234) +>>> client = datastore.Client() +>>> key = client.key('EntityKind', 1234) >>> entity = datastore.Entity(key) ->>> query = datastore.Query(kind='EntityKind') +>>> query = client.query(kind='EntityKind') The main concepts with this API are: @@ -49,11 +50,6 @@ when race conditions may occur. """ -from gcloud.datastore._implicit_environ import get_connection -from gcloud.datastore._implicit_environ import get_default_connection -from gcloud.datastore._implicit_environ import get_default_dataset_id -from gcloud.datastore._implicit_environ import set_default_connection -from gcloud.datastore._implicit_environ import set_default_dataset_id from gcloud.datastore.batch import Batch from gcloud.datastore.connection import SCOPE from gcloud.datastore.connection import Connection @@ -62,25 +58,3 @@ from gcloud.datastore.key import Key from gcloud.datastore.query import Query from gcloud.datastore.transaction import Transaction - - -def set_defaults(dataset_id=None, connection=None): - """Set defaults either explicitly or implicitly as fall-back. - - Uses the arguments to call the individual default methods - - - set_default_dataset_id - - set_default_connection - - In the future we will likely enable methods like - - - set_default_namespace - - :type dataset_id: string - :param dataset_id: Optional. The dataset ID to use as default. - - :type connection: :class:`gcloud.datastore.connection.Connection` - :param connection: A connection provided to be the default. - """ - set_default_dataset_id(dataset_id=dataset_id) - set_default_connection(connection=connection) diff --git a/gcloud/datastore/test___init__.py b/gcloud/datastore/test___init__.py deleted file mode 100644 index dd22d2787ad0..000000000000 --- a/gcloud/datastore/test___init__.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2014 Google Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest2 - - -class Test_set_defaults(unittest2.TestCase): - - def _callFUT(self, dataset_id=None, connection=None): - from gcloud.datastore import set_defaults - return set_defaults(dataset_id=dataset_id, connection=connection) - - def test_it(self): - from gcloud._testing import _Monkey - from gcloud import datastore - - DATASET_ID = object() - CONNECTION = object() - - SET_DATASET_CALLED = [] - - def call_set_dataset(dataset_id=None): - SET_DATASET_CALLED.append(dataset_id) - - SET_CONNECTION_CALLED = [] - - def call_set_connection(connection=None): - SET_CONNECTION_CALLED.append(connection) - - with _Monkey(datastore, set_default_dataset_id=call_set_dataset, - set_default_connection=call_set_connection): - self._callFUT(dataset_id=DATASET_ID, connection=CONNECTION) - - self.assertEqual(SET_DATASET_CALLED, [DATASET_ID]) - self.assertEqual(SET_CONNECTION_CALLED, [CONNECTION])