Skip to content

Commit

Permalink
Reverted summary lines and changed closing brackets for addibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Leyow authored and Kevin Leyow committed Sep 30, 2014
1 parent b8a989f commit 5efa5f1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 25 deletions.
3 changes: 1 addition & 2 deletions gcloud/datastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def get_connection(client_email, private_key_path):


def get_dataset(dataset_id, client_email, private_key_path):
"""Shortcut method to establish a connection to a particular
dataset in the Cloud Datastore.
"""Shortcut method to establish a connection to a particular dataset in the Cloud Datastore.
You'll generally use this as the first call to working with the API:
Expand Down
7 changes: 4 additions & 3 deletions gcloud/datastore/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def _request(self, dataset_id, method, data):
"""
headers = {
'Content-Type': 'application/x-protobuf',
'Content-Length': str(len(data)), }
'Content-Length': str(len(data)),
}
headers, content = self.http.request(
uri=self.build_api_url(dataset_id=dataset_id, method=method),
method='POST', headers=headers, body=data)
Expand All @@ -98,7 +99,7 @@ def build_api_url(cls, dataset_id, method, base_url=None, api_version=None):
:type dataset_id: string
:param dataset_id: The ID of the dataset to connect to.
This is usually your project name in the cloud console.
This is usually your project name in the cloud console.
:type method: string
:param method: The API method to call (ie, runQuery, lookup, ...).
Expand Down Expand Up @@ -133,7 +134,7 @@ def dataset(self, *args, **kwargs):
"""Factory method for Dataset objects.
:param args: All args and kwargs will be passed along to the
:class:`gcloud.datastore.dataset.Dataset` initializer.
:class:`gcloud.datastore.dataset.Dataset` initializer.
:rtype: :class:`gcloud.datastore.dataset.Dataset`
:returns: A dataset object that will use this connection as its transport.
Expand Down
12 changes: 5 additions & 7 deletions gcloud/datastore/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Entity(dict):
<Entity[{'kind': 'MyEntityKind'}] {}>
- :func:`gcloud.datastore.dataset.Dataset.get_entity`
to retrive an existing entity.
to retrive an existing entity.
>>> dataset.get_entity(key)
<Entity[{'kind': 'EntityKind', id: 1234}] {'property': 'value'}>
Expand All @@ -71,8 +71,7 @@ def __init__(self, dataset=None, kind=None):
self._key = None

def dataset(self):
"""Get the :class:`gcloud.datastore.dataset.Dataset`
in which this entity belonds.
"""Get the :class:`gcloud.datastore.dataset.Dataset` in which this entity belongs.
.. note::
This is based on the :class:`gcloud.datastore.key.Key` set on the entity.
Expand Down Expand Up @@ -120,14 +119,13 @@ def kind(self):

@classmethod
def from_key(cls, key):
"""Factory method for creating an entity based on the
:class:`gcloud.datastore.key.Key`.
"""Factory method for creating an entity based on the :class:`gcloud.datastore.key.Key`.
:type key: :class:`gcloud.datastore.key.Key`
:param key: The key for the entity.
:returns: The :class:`Entity` derived from the
:class:`gcloud.datastore.key.Key`.
:class:`gcloud.datastore.key.Key`.
"""

return cls().key(key)
Expand All @@ -139,7 +137,7 @@ def from_protobuf(cls, pb, dataset=None):
The protobuf should be one returned from the Cloud Datastore Protobuf API.
:type key: :class:`gcloud.datastore.datastore_v1_pb2.Entity`
:param key: The Protobuf representing the entity.
:param key: The Protobuf representing the entity.
:returns: The :class:`Entity` derived from the
:class:`gcloud.datastore.datastore_v1_pb2.Entity`.
Expand Down
6 changes: 3 additions & 3 deletions gcloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class Query(object):
'<=': datastore_pb.PropertyFilter.LESS_THAN_OR_EQUAL,
'>': datastore_pb.PropertyFilter.GREATER_THAN,
'>=': datastore_pb.PropertyFilter.GREATER_THAN_OR_EQUAL,
'=': datastore_pb.PropertyFilter.EQUAL, }
'=': datastore_pb.PropertyFilter.EQUAL,
}
"""Mapping of operator strings and their protobuf equivalents."""

def __init__(self, kind=None, dataset=None):
Expand All @@ -62,8 +63,7 @@ def _clone(self):
return clone

def to_protobuf(self):
"""Convert the :class:`Query` instance to a
:class:`gcloud.datastore.datastore_v1_pb2.Query`.
"""Convert the :class:`Query` instance to a :class:`gcloud.datastore.datastore_v1_pb2.Query`.
:rtype: :class:`gclouddatstore.datastore_v1_pb2.Query`
:returns: A Query protobuf that can be sent to the protobuf API.
Expand Down
3 changes: 1 addition & 2 deletions gcloud/storage/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ def save(self):


class DefaultObjectACL(BucketACL):
"""A subclass of BucketACL representing the
default object ACL for a bucket."""
"""A subclass of BucketACL representing the default object ACL for a bucket."""

def save(self):
"""Save this ACL as the default object ACL for the current bucket."""
Expand Down
3 changes: 1 addition & 2 deletions gcloud/storage/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def get_all_keys(self):
return list(self)

def new_key(self, key):
"""Given a path name (or a Key), return a :class:`gcloud.storage.key.Key`
object.
"""Given a path name (or a Key), return a :class:`gcloud.storage.key.Key` object.
This is really useful when you're not sure
if you have a Key object or a string path name.
Expand Down
6 changes: 2 additions & 4 deletions gcloud/storage/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ def __init__(self, connection):
super(BucketIterator, self).__init__(connection=connection, path='/b')

def get_items_from_response(self, response):
"""Factory method which yields :class:`gcloud.storage.bucket.Bucket`
items from a response.
"""Factory method which yields :class:`gcloud.storage.bucket.Bucket` items from a response.
:type response: dict
:param response: The JSON API response for a page of buckets.
Expand Down Expand Up @@ -175,8 +174,7 @@ def __init__(self, bucket):
connection=bucket.connection, path=bucket.path + '/o')

def get_items_from_response(self, response):
"""Factory method which yields :class:`gcloud.storage.key.Key`
items from a response.
"""Factory method which yields :class:`gcloud.storage.key.Key` items from a response.
:type response: dict
:param response: The JSON API response for a page of keys.
Expand Down
6 changes: 4 additions & 2 deletions gcloud/storage/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ def set_contents_from_file(self, fh, rewind=False, size=None,
# Set up a resumable upload session.
headers = {
'X-Upload-Content-Type': content_type or 'application/unknown',
'X-Upload-Content-Length': total_bytes}
'X-Upload-Content-Length': total_bytes
}

upload_url = self.connection.build_api_url(
path=self.bucket.path + '/o',
Expand All @@ -231,7 +232,8 @@ def set_contents_from_file(self, fh, rewind=False, size=None,
end = bytes_uploaded + chunk_size - 1

headers = {
'Content-Range': 'bytes %d-%d/%d' % (start, end, total_bytes), }
'Content-Range': 'bytes %d-%d/%d' % (start, end, total_bytes),
}

response, content = self.connection.make_request(
content_type='text/plain',
Expand Down

0 comments on commit 5efa5f1

Please sign in to comment.