From 70297958fbff6df7a965c41fd971f358fcf244b1 Mon Sep 17 00:00:00 2001 From: chemelnucfin Date: Wed, 13 Dec 2017 15:07:06 -0800 Subject: [PATCH 1/3] Revert "Removing redundant constant. (#4588)" This reverts commit be0493b7c3f80bc6564cab3b924c60c939cf4897. From 04d44f633d88df60ab848d767b6a90d4c777be81 Mon Sep 17 00:00:00 2001 From: chemelnucfin Date: Wed, 13 Dec 2017 15:07:06 -0800 Subject: [PATCH 2/3] Revert "Spanner: Changed _rows to list (#4583)" This reverts commit 0e4fc3076470ec84fa4b2bd65c2108e46f425d0f. From bf6d4309fa6c500d3bf72b4899c66c153ea89dd6 Mon Sep 17 00:00:00 2001 From: chemelnucfin Date: Wed, 13 Dec 2017 15:07:06 -0800 Subject: [PATCH 3/3] Revert "Do not use easily-misread glyphs in Firestore auto-IDs. (#4107)" This reverts commit 89c4415419089175e4753b995d1a1dabe2943a20. --- .../google/cloud/firestore_v1beta1/collection.py | 11 ++++++----- firestore/tests/unit/test_collection.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/firestore/google/cloud/firestore_v1beta1/collection.py b/firestore/google/cloud/firestore_v1beta1/collection.py index c52b7d41627c..9c87b622c7f2 100644 --- a/firestore/google/cloud/firestore_v1beta1/collection.py +++ b/firestore/google/cloud/firestore_v1beta1/collection.py @@ -24,7 +24,8 @@ from google.cloud.firestore_v1beta1.proto import document_pb2 -_AUTO_ID_CHARS = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789' +_AUTO_ID_CHARS = ( + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') class CollectionReference(object): @@ -92,7 +93,7 @@ def document(self, document_id=None): Args: document_id (Optional[str]): The document identifier within the current collection. If not provided, will default - to a random 21 character string composed of digits, + to a random 20 character string composed of digits, uppercase and lowercase and letters. Returns: @@ -138,7 +139,7 @@ def add(self, document_data, document_id=None): document_id (Optional[str]): The document identifier within the current collection. If not provided, an ID will be automatically assigned by the server (the assigned ID will be - a random 21 character string composed of digits, + a random 20 character string composed of digits, uppercase and lowercase letters). Returns: @@ -375,8 +376,8 @@ def _auto_id(): """Generate a "random" automatically generated ID. Returns: - str: A 21 character string composed of digits, uppercase and + str: A 20 character string composed of digits, uppercase and lowercase and letters. """ return ''.join( - random.choice(_AUTO_ID_CHARS) for _ in six.moves.xrange(21)) + random.choice(_AUTO_ID_CHARS) for _ in six.moves.xrange(20)) diff --git a/firestore/tests/unit/test_collection.py b/firestore/tests/unit/test_collection.py index ab7909cbab61..365c98622ca0 100644 --- a/firestore/tests/unit/test_collection.py +++ b/firestore/tests/unit/test_collection.py @@ -427,12 +427,12 @@ def _call_fut(): def test_it(self, mock_rand_choice): from google.cloud.firestore_v1beta1.collection import _AUTO_ID_CHARS - mock_result = '23456789abcdefghjkmnp' + mock_result = '0123456789abcdefghij' mock_rand_choice.side_effect = list(mock_result) result = self._call_fut() self.assertEqual(result, mock_result) - mock_calls = [mock.call(_AUTO_ID_CHARS)] * 21 + mock_calls = [mock.call(_AUTO_ID_CHARS)] * 20 self.assertEqual(mock_rand_choice.mock_calls, mock_calls)