Skip to content

Commit 95e80e1

Browse files
committed
Merge pull request #368 from tseaver/annotate_pylintrc_w_defaults_and_rationale
Annotate pylintrc w defaults and rationale
2 parents 8aeff0b + 1a79f4c commit 95e80e1

File tree

4 files changed

+397
-31
lines changed

4 files changed

+397
-31
lines changed

gcloud/datastore/helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def key_from_protobuf(pb):
7474
return Key(path, namespace, dataset_id)
7575

7676

77-
def _get_protobuf_attribute_and_value(val):
77+
def _pb_attr_value(val):
7878
"""Given a value, return the protobuf attribute name and proper value.
7979
8080
The Protobuf API uses different attribute names
@@ -96,9 +96,9 @@ def _get_protobuf_attribute_and_value(val):
9696
9797
For example:
9898
99-
>>> _get_protobuf_attribute_and_value(1234)
99+
>>> _pb_attr_value(1234)
100100
('integer_value', 1234)
101-
>>> _get_protobuf_attribute_and_value('my_string')
101+
>>> _pb_attr_value('my_string')
102102
('string_value', 'my_string')
103103
104104
:type val: `datetime.datetime`, :class:`gcloud.datastore.key.Key`,
@@ -230,7 +230,7 @@ def _set_protobuf_value(value_pb, val):
230230
value_pb.Clear()
231231
return
232232

233-
attr, val = _get_protobuf_attribute_and_value(val)
233+
attr, val = _pb_attr_value(val)
234234
if attr == 'key_value':
235235
value_pb.key_value.CopyFrom(val)
236236
elif attr == 'entity_value':

gcloud/datastore/test_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ def test_w_path_in_pb(self):
118118
self.assertEqual(key.path(), _PATH)
119119

120120

121-
class Test__get_protobuf_attribute_and_value(unittest2.TestCase):
121+
class Test__pb_attr_value(unittest2.TestCase):
122122

123123
def _callFUT(self, val):
124-
from gcloud.datastore.helpers import _get_protobuf_attribute_and_value
124+
from gcloud.datastore.helpers import _pb_attr_value
125125

126-
return _get_protobuf_attribute_and_value(val)
126+
return _pb_attr_value(val)
127127

128128
def test_datetime_naive(self):
129129
import calendar

gcloud/storage/key.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ def public_url(self):
126126
:rtype: `string`
127127
:returns: The public URL for this key.
128128
"""
129-
return '{storage_base_url}/{self.bucket.name}/{self.name}'.format(
129+
return '{storage_base_url}/{bucket_name}/{key_name}'.format(
130130
storage_base_url='http://commondatastorage.googleapis.com',
131-
self=self)
131+
key_name=self.name,
132+
bucket_name=self.bucket.name,
133+
)
132134

133135
def generate_signed_url(self, expiration, method='GET'):
134136
"""Generates a signed URL for this key.
@@ -151,7 +153,10 @@ def generate_signed_url(self, expiration, method='GET'):
151153
:returns: A signed URL you can use to access the resource
152154
until expiration.
153155
"""
154-
resource = '/{self.bucket.name}/{self.name}'.format(self=self)
156+
resource = '/{bucket_name}/{key_name}'.format(
157+
key_name=self.name,
158+
bucket_name=self.bucket.name,
159+
)
155160
return self.connection.generate_signed_url(resource=resource,
156161
expiration=expiration,
157162
method=method)

0 commit comments

Comments
 (0)