diff --git a/gcloud/datastore/__init__.py b/gcloud/datastore/__init__.py index bff7408255cf3..0de26dddcb2eb 100644 --- a/gcloud/datastore/__init__.py +++ b/gcloud/datastore/__init__.py @@ -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: diff --git a/gcloud/datastore/connection.py b/gcloud/datastore/connection.py index 60744ee41a3ae..05b6f3b1f1d4c 100644 --- a/gcloud/datastore/connection.py +++ b/gcloud/datastore/connection.py @@ -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) @@ -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, ...). @@ -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. diff --git a/gcloud/datastore/entity.py b/gcloud/datastore/entity.py index 6ec029c3967bf..21a2782ed4a36 100644 --- a/gcloud/datastore/entity.py +++ b/gcloud/datastore/entity.py @@ -44,7 +44,7 @@ class Entity(dict): - :func:`gcloud.datastore.dataset.Dataset.get_entity` - to retrive an existing entity. + to retrive an existing entity. >>> dataset.get_entity(key) @@ -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. @@ -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) @@ -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`. diff --git a/gcloud/datastore/query.py b/gcloud/datastore/query.py index 48a894d15260f..4b67333b3cbec 100644 --- a/gcloud/datastore/query.py +++ b/gcloud/datastore/query.py @@ -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): @@ -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. diff --git a/gcloud/storage/acl.py b/gcloud/storage/acl.py index 0daa49ec024c7..3c873bcaecc08 100644 --- a/gcloud/storage/acl.py +++ b/gcloud/storage/acl.py @@ -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.""" diff --git a/gcloud/storage/bucket.py b/gcloud/storage/bucket.py index 5c4f14f5f01d2..605800c947656 100644 --- a/gcloud/storage/bucket.py +++ b/gcloud/storage/bucket.py @@ -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. diff --git a/gcloud/storage/iterator.py b/gcloud/storage/iterator.py index e76013eba1c82..e7f75428f1f05 100644 --- a/gcloud/storage/iterator.py +++ b/gcloud/storage/iterator.py @@ -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. @@ -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. diff --git a/gcloud/storage/key.py b/gcloud/storage/key.py index d144283c9f06d..06a3d3d69dacb 100644 --- a/gcloud/storage/key.py +++ b/gcloud/storage/key.py @@ -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', @@ -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',