Skip to content

Commit 14a7415

Browse files
committed
Rename 'app_engine_id'/'compute_engine_id' to indicate non-APIness.
1 parent 8dcdf76 commit 14a7415

4 files changed

Lines changed: 14 additions & 17 deletions

File tree

gcloud/_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def _lazy_property_deco(deferred_callable):
112112
return _LazyProperty(deferred_callable.__name__, deferred_callable)
113113

114114

115-
def app_engine_id():
115+
def _app_engine_id():
116116
"""Gets the App Engine application ID if it can be inferred.
117117
118118
:rtype: string or ``NoneType``
@@ -125,7 +125,7 @@ def app_engine_id():
125125
return app_identity.get_application_id()
126126

127127

128-
def compute_engine_id():
128+
def _compute_engine_id():
129129
"""Gets the Compute Engine project ID if it can be inferred.
130130
131131
Uses 169.254.169.254 for the metadata server to avoid request

gcloud/datastore/_implicit_environ.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
"""
2020

2121
import os
22-
import socket
2322

24-
from six.moves.http_client import HTTPConnection # pylint: disable=F0401
25-
26-
from gcloud._helpers import app_engine_id
27-
from gcloud._helpers import compute_engine_id
23+
from gcloud._helpers import _app_engine_id
24+
from gcloud._helpers import _compute_engine_id
2825
from gcloud._helpers import _lazy_property_deco
2926
from gcloud import credentials
3027
from gcloud.datastore.connection import Connection
@@ -72,10 +69,10 @@ def _determine_default_dataset_id(dataset_id=None):
7269
dataset_id = _get_gcd_dataset_id()
7370

7471
if dataset_id is None:
75-
dataset_id = app_engine_id()
72+
dataset_id = _app_engine_id()
7673

7774
if dataset_id is None:
78-
dataset_id = compute_engine_id()
75+
dataset_id = _compute_engine_id()
7976

8077
return dataset_id
8178

gcloud/datastore/test__implicit_environ.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ def gce_mock():
154154
patched_methods = {
155155
'_get_production_dataset_id': prod_mock,
156156
'_get_gcd_dataset_id': gcd_mock,
157-
'app_engine_id': gae_mock,
158-
'compute_engine_id': gce_mock,
157+
'_app_engine_id': gae_mock,
158+
'_compute_engine_id': gce_mock,
159159
}
160160

161161
with _Monkey(_implicit_environ, **patched_methods):

gcloud/test__helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ def test_func():
9595
self.assertEqual(lazy_prop._name, 'test_func')
9696

9797

98-
class Test_app_engine_id(unittest2.TestCase):
98+
class Test__app_engine_id(unittest2.TestCase):
9999

100100
def _callFUT(self):
101-
from gcloud._helpers import app_engine_id
102-
return app_engine_id()
101+
from gcloud._helpers import _app_engine_id
102+
return _app_engine_id()
103103

104104
def test_no_value(self):
105105
from gcloud._testing import _Monkey
@@ -120,11 +120,11 @@ def test_value_set(self):
120120
self.assertEqual(dataset_id, APP_ENGINE_ID)
121121

122122

123-
class Test_compute_engine_id(unittest2.TestCase):
123+
class Test__compute_engine_id(unittest2.TestCase):
124124

125125
def _callFUT(self):
126-
from gcloud._helpers import compute_engine_id
127-
return compute_engine_id()
126+
from gcloud._helpers import _compute_engine_id
127+
return _compute_engine_id()
128128

129129
def _monkeyConnection(self, connection):
130130
from gcloud._testing import _Monkey

0 commit comments

Comments
 (0)