From 71590da3801a536609cffa252235053ba1d4d9d9 Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Tue, 31 Jan 2017 09:17:12 -0500 Subject: [PATCH] Updates for pycodestyle. (#2973) --- bigquery/unit_tests/test_dataset.py | 2 +- bigquery/unit_tests/test_job.py | 2 +- bigquery/unit_tests/test_table.py | 2 +- bigtable/unit_tests/test_instance.py | 2 +- core/unit_tests/test_exceptions.py | 4 ++-- datastore/google/cloud/datastore/transaction.py | 2 +- datastore/unit_tests/test__http.py | 4 ++-- datastore/unit_tests/test_batch.py | 2 +- datastore/unit_tests/test_client.py | 2 +- datastore/unit_tests/test_query.py | 2 +- dns/google/cloud/dns/changes.py | 4 ++-- dns/unit_tests/test_changes.py | 2 +- dns/unit_tests/test_zone.py | 2 +- resource_manager/unit_tests/test_project.py | 2 +- runtimeconfig/unit_tests/test_config.py | 2 +- runtimeconfig/unit_tests/test_variable.py | 2 +- storage/unit_tests/test_batch.py | 6 +++--- storage/unit_tests/test_bucket.py | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bigquery/unit_tests/test_dataset.py b/bigquery/unit_tests/test_dataset.py index ad510dded5ea..97721554f1b6 100644 --- a/bigquery/unit_tests/test_dataset.py +++ b/bigquery/unit_tests/test_dataset.py @@ -838,7 +838,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/bigquery/unit_tests/test_job.py b/bigquery/unit_tests/test_job.py index e0176d6a456b..0e43712d0d15 100644 --- a/bigquery/unit_tests/test_job.py +++ b/bigquery/unit_tests/test_job.py @@ -1904,7 +1904,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/bigquery/unit_tests/test_table.py b/bigquery/unit_tests/test_table.py index 57fcb4a4800c..09fd37730199 100644 --- a/bigquery/unit_tests/test_table.py +++ b/bigquery/unit_tests/test_table.py @@ -1989,7 +1989,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/bigtable/unit_tests/test_instance.py b/bigtable/unit_tests/test_instance.py index c243ca77a135..aefba45d9158 100644 --- a/bigtable/unit_tests/test_instance.py +++ b/bigtable/unit_tests/test_instance.py @@ -254,8 +254,8 @@ def test_create(self): metadata=Any( type_url=type_url, value=metadata.SerializeToString(), - ) ) + ) # Patch the stub used by the API method. client._instance_stub = stub = _FakeStub(response_pb) diff --git a/core/unit_tests/test_exceptions.py b/core/unit_tests/test_exceptions.py index 4ab41cb8d576..b3488296eff4 100644 --- a/core/unit_tests/test_exceptions.py +++ b/core/unit_tests/test_exceptions.py @@ -40,7 +40,7 @@ def test_ctor_explicit(self): 'locationType': 'testing', 'message': 'Testing', 'reason': 'test', - } + } e = self._make_one('Testing', [ERROR]) e.code = 600 self.assertEqual(str(e), '600 Testing') @@ -115,7 +115,7 @@ def test_miss_w_content_as_dict(self): 'locationType': 'testing', 'message': 'Testing', 'reason': 'test', - } + } response = _Response(600) content = {"error": {"message": "Unknown Error", "errors": [ERROR]}} exception = self._call_fut(response, content) diff --git a/datastore/google/cloud/datastore/transaction.py b/datastore/google/cloud/datastore/transaction.py index b63098959d0d..48a044ba789c 100644 --- a/datastore/google/cloud/datastore/transaction.py +++ b/datastore/google/cloud/datastore/transaction.py @@ -186,7 +186,7 @@ def begin(self): try: self._id = self._client._connection.begin_transaction( self.project) - except: + except: # noqa: E722 do not use bare except, specify exception instead self._status = self._ABORTED raise diff --git a/datastore/unit_tests/test__http.py b/datastore/unit_tests/test__http.py index ced9b65a4cd0..7e47e7c2f65a 100644 --- a/datastore/unit_tests/test__http.py +++ b/datastore/unit_tests/test__http.py @@ -1051,11 +1051,11 @@ def test_allocate_ids_non_empty(self): before_key_pbs = [ self._make_key_pb(PROJECT, id_=None), self._make_key_pb(PROJECT, id_=None), - ] + ] after_key_pbs = [ self._make_key_pb(PROJECT), self._make_key_pb(PROJECT, id_=2345), - ] + ] rsp_pb = datastore_pb2.AllocateIdsResponse() rsp_pb.keys.add().CopyFrom(after_key_pbs[0]) rsp_pb.keys.add().CopyFrom(after_key_pbs[1]) diff --git a/datastore/unit_tests/test_batch.py b/datastore/unit_tests/test_batch.py index 6f2cda6bfbc3..72614d070cba 100644 --- a/datastore/unit_tests/test_batch.py +++ b/datastore/unit_tests/test_batch.py @@ -121,7 +121,7 @@ def test_put_entity_w_completed_key(self): 'baz': 'qux', 'spam': [1, 2, 3], 'frotz': [], # will be ignored - } + } connection = _Connection() client = _Client(_PROJECT, connection) batch = self._make_one(client) diff --git a/datastore/unit_tests/test_client.py b/datastore/unit_tests/test_client.py index 32236ecf2c49..e89acc9c0922 100644 --- a/datastore/unit_tests/test_client.py +++ b/datastore/unit_tests/test_client.py @@ -853,7 +853,7 @@ def test_query_explicit(self): projection=PROJECTION, order=ORDER, distinct_on=DISTINCT_ON, - ) + ) self.assertIsInstance(query, _Dummy) self.assertEqual(query.args, (client,)) diff --git a/datastore/unit_tests/test_query.py b/datastore/unit_tests/test_query.py index e0a5a955beca..f3ed774db336 100644 --- a/datastore/unit_tests/test_query.py +++ b/datastore/unit_tests/test_query.py @@ -68,7 +68,7 @@ def test_ctor_explicit(self): projection=PROJECTION, order=ORDER, distinct_on=DISTINCT_ON, - ) + ) self.assertIs(query._client, client) self.assertEqual(query.project, _PROJECT) self.assertEqual(query.kind, _KIND) diff --git a/dns/google/cloud/dns/changes.py b/dns/google/cloud/dns/changes.py index 62895f07928a..e900cbcebd22 100644 --- a/dns/google/cloud/dns/changes.py +++ b/dns/google/cloud/dns/changes.py @@ -188,14 +188,14 @@ def _build_resource(self): 'type': added.record_type, 'ttl': str(added.ttl), 'rrdatas': added.rrdatas, - } for added in self.additions] + } for added in self.additions] deletions = [{ 'name': deleted.name, 'type': deleted.record_type, 'ttl': str(deleted.ttl), 'rrdatas': deleted.rrdatas, - } for deleted in self.deletions] + } for deleted in self.deletions] return { 'additions': additions, diff --git a/dns/unit_tests/test_changes.py b/dns/unit_tests/test_changes.py index 2eb8390eddf7..7ab2e232f982 100644 --- a/dns/unit_tests/test_changes.py +++ b/dns/unit_tests/test_changes.py @@ -347,7 +347,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/dns/unit_tests/test_zone.py b/dns/unit_tests/test_zone.py index bf16f2fde010..07762f9c10df 100644 --- a/dns/unit_tests/test_zone.py +++ b/dns/unit_tests/test_zone.py @@ -693,7 +693,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/resource_manager/unit_tests/test_project.py b/resource_manager/unit_tests/test_project.py index a8c3d40340e6..2b52712b0e48 100644 --- a/resource_manager/unit_tests/test_project.py +++ b/resource_manager/unit_tests/test_project.py @@ -362,7 +362,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/runtimeconfig/unit_tests/test_config.py b/runtimeconfig/unit_tests/test_config.py index 4e066ea27504..b7bfb5a43368 100644 --- a/runtimeconfig/unit_tests/test_config.py +++ b/runtimeconfig/unit_tests/test_config.py @@ -352,7 +352,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/runtimeconfig/unit_tests/test_variable.py b/runtimeconfig/unit_tests/test_variable.py index b83b1840accb..c16b5387e1b9 100644 --- a/runtimeconfig/unit_tests/test_variable.py +++ b/runtimeconfig/unit_tests/test_variable.py @@ -198,7 +198,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response diff --git a/storage/unit_tests/test_batch.py b/storage/unit_tests/test_batch.py index 41861f3c18d7..60157af8c06b 100644 --- a/storage/unit_tests/test_batch.py +++ b/storage/unit_tests/test_batch.py @@ -40,7 +40,7 @@ def test_ctor_body_None(self): LINES = [ "DELETE /path/to/api HTTP/1.1", "", - ] + ] mah = self._make_one(METHOD, PATH, {}, None) self.assertEqual(mah.get_content_type(), 'application/http') self.assertEqual(mah.get_payload().splitlines(), LINES) @@ -56,7 +56,7 @@ def test_ctor_body_str(self): "Content-Type: text/plain", "", "ABC", - ] + ] mah = self._make_one(METHOD, PATH, HEADERS, BODY) self.assertEqual(mah.get_payload().splitlines(), LINES) @@ -71,7 +71,7 @@ def test_ctor_body_dict(self): 'Content-Type: application/json', '', '{"foo": "bar"}', - ] + ] mah = self._make_one(METHOD, PATH, HEADERS, BODY) self.assertEqual(mah.get_payload().splitlines(), LINES) diff --git a/storage/unit_tests/test_bucket.py b/storage/unit_tests/test_bucket.py index 82d608396f36..2a740a21c36f 100644 --- a/storage/unit_tests/test_bucket.py +++ b/storage/unit_tests/test_bucket.py @@ -1098,7 +1098,7 @@ def api_request(self, **kw): try: response, self._responses = self._responses[0], self._responses[1:] - except: + except IndexError: raise NotFound('miss') else: return response