diff --git a/docs/firestore-path.rst b/docs/firestore-path.rst deleted file mode 100644 index 0af8bb52a29f..000000000000 --- a/docs/firestore-path.rst +++ /dev/null @@ -1,5 +0,0 @@ -Firestore Path -================ -.. autoclass:: google.cloud.firestore.Path - :members: - :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst index 133fd50cc30f..79e2c70e5ba2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,7 +32,6 @@ firestore-client firestore-collection firestore-document - firestore-path .. toctree:: :maxdepth: 0 diff --git a/firestore/google/cloud/firestore/__init__.py b/firestore/google/cloud/firestore/__init__.py index 57735bd65cdb..13a708ac082f 100644 --- a/firestore/google/cloud/firestore/__init__.py +++ b/firestore/google/cloud/firestore/__init__.py @@ -17,12 +17,10 @@ from google.cloud.firestore.client import Client from google.cloud.firestore.collection import CollectionRef from google.cloud.firestore.document import Document -from google.cloud.firestore.path import Path __all__ = [ 'Client', - 'Path', 'Document', 'CollectionRef', ] diff --git a/firestore/google/cloud/firestore/path.py b/firestore/google/cloud/firestore/_path.py similarity index 100% rename from firestore/google/cloud/firestore/path.py rename to firestore/google/cloud/firestore/_path.py diff --git a/firestore/google/cloud/firestore/_values.py b/firestore/google/cloud/firestore/_values.py index c1580ac6e187..0801af6960ff 100644 --- a/firestore/google/cloud/firestore/_values.py +++ b/firestore/google/cloud/firestore/_values.py @@ -17,7 +17,7 @@ import datetime from google.cloud.firestore import document -from google.cloud.firestore import path +from google.cloud.firestore import _path import six @@ -39,7 +39,7 @@ def encode_value(val): :type val: str, unicode, int, bool, float, datetime.datetime, bytes, dict, None, - :class:`google.cloud.firestore.Path`, or + :class:`google.cloud.firestore._path.Path`, or :class:`google.cloud.firestore.Document`. :param val: A native Python value. @@ -69,7 +69,7 @@ def encode_value(val): if isinstance(val, six.binary_type): return Value(blob_value=val) - if isinstance(val, path.Path): + if isinstance(val, _path.Path): if val.is_empty: return encode_value(None) @@ -101,7 +101,7 @@ def decode_value(val): :rtype: str, unicode, int, bool, float, datetime.datetime, bytes, dict, None, - :class:`google.cloud.firestore.Path`, or + :class:`google.cloud.firestore._path.Path`, or :class:`google.cloud.firestore.Document`. :returns: A native Python value. """ diff --git a/firestore/unit_tests/test_collection.py b/firestore/unit_tests/test_collection.py index 889e9d295a20..294d1779c4b2 100644 --- a/firestore/unit_tests/test_collection.py +++ b/firestore/unit_tests/test_collection.py @@ -27,7 +27,7 @@ def _make_one(self, *args, **kwargs): return self._get_target_class()(*args, **kwargs) def test_constructor(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path client = object() path = Path('my-collection') diff --git a/firestore/unit_tests/test_document.py b/firestore/unit_tests/test_document.py index d049ba715c4d..8453fcbdaeae 100644 --- a/firestore/unit_tests/test_document.py +++ b/firestore/unit_tests/test_document.py @@ -24,7 +24,7 @@ def _get_target_class(): return Document def _make_one(self, client, path=None, properties=None, *args, **kwargs): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path if path is None: path = Path('my-collection', 'my-document') @@ -33,7 +33,7 @@ def _make_one(self, client, path=None, properties=None, *args, **kwargs): *args, **kwargs) def test_constructor(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path client = object() properties = {'hi': 'mom'} @@ -46,7 +46,7 @@ def test_constructor(self): self.assertEqual(dict(doc), properties) def test_constructor_path_non_document(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path client = object() collection_path = Path('my-collection') @@ -54,13 +54,9 @@ def test_constructor_path_non_document(self): self._make_one(client, collection_path) def test_doc_id(self): - from google.cloud.firestore.path import Path - client = object() - doc_id = 'my-document' - path = Path('my-collection', doc_id) - doc = self._make_one(client, path) - self.assertEqual(doc.doc_id, doc_id) + doc = self._make_one(client) + self.assertEqual(doc.doc_id, 'my-document') def test_version(self): client = object() diff --git a/firestore/unit_tests/test_path.py b/firestore/unit_tests/test_path.py index 7474df50645d..15996661af1d 100644 --- a/firestore/unit_tests/test_path.py +++ b/firestore/unit_tests/test_path.py @@ -19,7 +19,7 @@ class TestPath(unittest.TestCase): @staticmethod def _get_target_class(): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path return Path def _make_one(self, *args, **kwargs): @@ -129,7 +129,7 @@ def test_nested_document_to_key_proto(self): self.assertEqual(key.path[1].name, 'nested-doc') def test_document_name_from_proto(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path path = self._make_one('my-collection', 'my-document') key = path.to_key_proto() @@ -137,7 +137,7 @@ def test_document_name_from_proto(self): self.assertEqual(path, path_from_key) def test_document_id_from_proto(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path path = self._make_one('my-collection', 123) key = path.to_key_proto() @@ -145,7 +145,7 @@ def test_document_id_from_proto(self): self.assertEqual(path, path_from_key) def test_collection_from_proto(self): - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path path = self._make_one('my-collection') key = path.to_key_proto() diff --git a/firestore/unit_tests/test_values.py b/firestore/unit_tests/test_values.py index 85e2651a145d..82c5afed873e 100644 --- a/firestore/unit_tests/test_values.py +++ b/firestore/unit_tests/test_values.py @@ -110,7 +110,7 @@ def test_blob(self): def test_path(self): from google.protobuf import struct_pb2 from google.firestore.v1alpha1.entity_pb2 import Key - from google.cloud.firestore.path import Path + from google.cloud.firestore._path import Path empty_path = Path()