Skip to content

Commit

Permalink
Fixed a majority of pep8 errors in gcloud.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Leyow authored and Kevin Leyow committed Sep 28, 2014
1 parent 1095168 commit f4902a8
Show file tree
Hide file tree
Showing 30 changed files with 383 additions and 322 deletions.
1 change: 0 additions & 1 deletion gcloud/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ def http(self):
if self._credentials:
self._http = self._credentials.authorize(self._http)
return self._http

1 change: 1 addition & 0 deletions gcloud/datastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def get_connection(client_email, private_key_path):
client_email, private_key_path, scope=SCOPE)
return Connection(credentials=credentials)


def get_dataset(dataset_id, client_email, private_key_path):
"""Shortcut method to establish a connection to a particular dataset in the Cloud Datastore.
Expand Down
3 changes: 2 additions & 1 deletion gcloud/datastore/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def get_entities(self, keys):
# This import is here to avoid circular references.
from gcloud.datastore.entity import Entity

entity_pbs = self.connection().lookup(dataset_id=self.id(),
entity_pbs = self.connection().lookup(
dataset_id=self.id(),
key_pbs=[k.to_protobuf() for k in keys])

entities = []
Expand Down
2 changes: 1 addition & 1 deletion gcloud/datastore/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
PRIVATE_KEY_PATH = os.path.join(os.path.dirname(__file__), 'demo.key')


def get_dataset(): #pragma NO COVER
def get_dataset(): # pragma NO COVER
return datastore.get_dataset(DATASET_ID, CLIENT_EMAIL, PRIVATE_KEY_PATH)
5 changes: 3 additions & 2 deletions gcloud/datastore/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ def delete(self):
self.dataset().connection().delete_entity(
dataset_id=self.dataset().id(), key_pb=self.key().to_protobuf())

def __repr__(self): #pragma NO COVER
def __repr__(self): # pragma NO COVER
# An entity should have a key all the time (even if it's partial).
if self.key():
return '<Entity%s %s>' % (self.key().path(), super(Entity, self).__repr__())
return '<Entity%s %s>' % (self.key().path(),
super(Entity, self).__repr__())
else:
return '<Entity %s>' % (super(Entity, self).__repr__())
4 changes: 2 additions & 2 deletions gcloud/datastore/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ def name(self, name=None):
def id_or_name(self):
return self.id() or self.name()

def parent(self):#pragma NO COVER
def parent(self): # pragma NO COVER
# See https://github.com/GoogleCloudPlatform/gcloud-python/issues/135
raise NotImplementedError

def __repr__(self): #pragma NO COVER
def __repr__(self): # pragma NO COVER
return '<Key%s>' % self.path()
10 changes: 6 additions & 4 deletions gcloud/datastore/test___init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest2


class Test_get_connection(unittest2.TestCase):

def _callFUT(self, client_email, private_key_path):
Expand All @@ -13,6 +14,7 @@ def test_it(self):
from gcloud.datastore.connection import Connection
from gcloud.test_credentials import _Client
from gcloud.test_credentials import _Monkey

CLIENT_EMAIL = '[email protected]'
PRIVATE_KEY = 'SEEkR1t'
client = _Client()
Expand All @@ -26,8 +28,8 @@ def test_it(self):
self.assertEqual(client._called_with,
{'service_account_name': CLIENT_EMAIL,
'private_key': PRIVATE_KEY,
'scope': SCOPE,
})
'scope': SCOPE, })


class Test_get_dataset(unittest2.TestCase):

Expand All @@ -43,6 +45,7 @@ def test_it(self):
from gcloud.datastore.dataset import Dataset
from gcloud.test_credentials import _Client
from gcloud.test_credentials import _Monkey

CLIENT_EMAIL = '[email protected]'
PRIVATE_KEY = 'SEEkR1t'
DATASET_ID = 'DATASET'
Expand All @@ -58,5 +61,4 @@ def test_it(self):
self.assertEqual(client._called_with,
{'service_account_name': CLIENT_EMAIL,
'private_key': PRIVATE_KEY,
'scope': SCOPE,
})
'scope': SCOPE, })
Loading

0 comments on commit f4902a8

Please sign in to comment.