Sitelet https://github.com/openstack/python-swiftclient/commit/1eb2c29856fda85abbf7c06802b4fb09cc66bb41
Skip to content

Commit 1eb2c29

Browse files
committed
Switch to flake8.
Change-Id: Ib9ba1e7eed09c5a90c558a8365d0a87c3f4b5ee5
1 parent 000e33d commit 1eb2c29

8 files changed

Lines changed: 149 additions & 92 deletions

File tree

‎bin/swift‎

Lines changed: 107 additions & 71 deletions
Large diffs are not rendered by default.

‎setup.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import os
1919
import setuptools
20-
import sys
2120

2221
from swiftclient.openstack.common import setup
2322

‎swiftclient/__init__.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
# -*- encoding: utf-8 -*-
2+
# Copyright (c) 2012 Rackspace
3+
# flake8: noqa
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
# implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
217
""""
318
OpenStack Swift Python client binding.
419
"""

‎swiftclient/client.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""
1919

2020
import socket
21-
import os
2221
import sys
2322
import logging
2423
import warnings
@@ -99,11 +98,9 @@ def encode_utf8(value):
9998
try:
10099
# simplejson is popular and pretty good
101100
from simplejson import loads as json_loads
102-
from simplejson import dumps as json_dumps
103101
except ImportError:
104102
# 2.6 will have a json module in the stdlib
105103
from json import loads as json_loads
106-
from json import dumps as json_dumps
107104

108105

109106
class ClientException(Exception):

‎swiftclient/openstack/common/setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def get_version_from_git():
269269
if the current revision has no tag."""
270270

271271
if os.path.isdir('.git'):
272-
return _run_shell_command(
272+
return _run_shell_command(
273273
"git describe --always").replace('-', '.')
274274
return None
275275

‎tests/test_swiftclient.py‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def test_server_error(self):
371371
self.assertRaises(c.ClientException, c.head_account,
372372
'http://www.tests.com', 'asdf')
373373
try:
374-
value = c.head_account('http://www.tests.com', 'asdf')
374+
c.head_account('http://www.tests.com', 'asdf')
375375
except c.ClientException as e:
376376
new_body = "[first 60 chars of response] " + body[0:60]
377377
self.assertEquals(e.__str__()[-89:], new_body)
@@ -394,7 +394,7 @@ def test_server_error(self):
394394
'http://www.test.com', 'asdf', 'asdf',
395395
)
396396
try:
397-
value = c.head_container('http://www.test.com', 'asdf', 'asdf')
397+
c.head_container('http://www.test.com', 'asdf', 'asdf')
398398
except c.ClientException as e:
399399
self.assertEquals(e.http_response_content, body)
400400

@@ -413,7 +413,7 @@ def test_server_error(self):
413413
'http://www.test.com', 'asdf', 'asdf',
414414
)
415415
try:
416-
value = c.put_container('http://www.test.com', 'asdf', 'asdf')
416+
c.put_container('http://www.test.com', 'asdf', 'asdf')
417417
except c.ClientException as e:
418418
self.assertEquals(e.http_response_content, body)
419419

@@ -501,7 +501,7 @@ def test_server_error(self):
501501
args = ('http://www.test.com', 'asdf', 'asdf', 'asdf', 'asdf')
502502
self.assertRaises(c.ClientException, c.put_object, *args)
503503
try:
504-
value = c.put_object(*args)
504+
c.put_object(*args)
505505
except c.ClientException as e:
506506
self.assertEquals(e.http_response_content, body)
507507

@@ -517,7 +517,7 @@ class TestPostObject(MockHttpTest):
517517
def test_ok(self):
518518
c.http_connection = self.fake_http_connection(200)
519519
args = ('http://www.test.com', 'asdf', 'asdf', 'asdf', {})
520-
value = c.post_object(*args)
520+
c.post_object(*args)
521521

522522
def test_unicode_ok(self):
523523
conn = c.http_connection(u'http://www.test.com/')
@@ -542,7 +542,7 @@ def test_server_error(self):
542542
args = ('http://www.test.com', 'asdf', 'asdf', 'asdf', {})
543543
self.assertRaises(c.ClientException, c.post_object, *args)
544544
try:
545-
value = c.post_object(*args)
545+
c.post_object(*args)
546546
except c.ClientException as e:
547547
self.assertEquals(e.http_response_content, body)
548548

@@ -551,7 +551,7 @@ class TestDeleteObject(MockHttpTest):
551551

552552
def test_ok(self):
553553
c.http_connection = self.fake_http_connection(200)
554-
value = c.delete_object('http://www.test.com', 'asdf', 'asdf', 'asdf')
554+
c.delete_object('http://www.test.com', 'asdf', 'asdf', 'asdf')
555555

556556
def test_server_error(self):
557557
c.http_connection = self.fake_http_connection(500)
@@ -572,16 +572,16 @@ def test_instance(self):
572572
self.assertEquals(conn.retries, 5)
573573

574574
def test_instance_kwargs(self):
575-
args = {'user': 'ausername',
576-
'key': 'secretpass',
577-
'authurl': 'http://www.test.com',
578-
'tenant_name': 'atenant'}
575+
args = {'user': 'ausername',
576+
'key': 'secretpass',
577+
'authurl': 'http://www.test.com',
578+
'tenant_name': 'atenant'}
579579
conn = c.Connection(**args)
580580
self.assertEquals(type(conn), c.Connection)
581581

582582
def test_instance_kwargs_token(self):
583583
args = {'preauthtoken': 'atoken123',
584-
'preauthurl': 'http://www.test.com:8080/v1/AUTH_123456'}
584+
'preauthurl': 'http://www.test.com:8080/v1/AUTH_123456'}
585585
conn = c.Connection(**args)
586586
self.assertEquals(type(conn), c.Connection)
587587

@@ -650,7 +650,7 @@ def swap_sleep(*args):
650650
self.assertEquals(conn.url, 'http://www.old.com')
651651
self.assertEquals(conn.token, 'old')
652652

653-
value = conn.head_account()
653+
conn.head_account()
654654

655655
self.assertTrue(self.swap_sleep_called)
656656
self.assertEquals(conn.attempts, 2)

‎tools/test-requires‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
distribute>=0.6.24
22

3+
# Install bounded pep8/pyflakes first, then let flake8 install
4+
pep8==1.4.5
5+
pyflakes==0.7.2
6+
flake8==2.0
7+
38
coverage
49
discover
510
eventlet
6-
pep8==1.3
711
python-keystoneclient
812
sphinx>=1.1.2
913
testrepository>=0.0.13

‎tox.ini‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ deps = -r{toxinidir}/tools/pip-requires
1212
commands = python setup.py testr --testr-args="{posargs}"
1313

1414
[testenv:pep8]
15-
deps = pep8
16-
commands = pep8 --repeat --show-source --exclude=openstack swiftclient setup.py tests
15+
commands =
16+
flake8
17+
flake8 bin/swift
1718

1819
[testenv:venv]
1920
commands = {posargs}
@@ -23,3 +24,8 @@ commands = python setup.py testr --coverage
2324

2425
[tox:jenkins]
2526
downloadcache = ~/cache/pip
27+
28+
[flake8]
29+
ignore = H
30+
show-source = True
31+
exclude = .venv,.tox,dist,doc,test,*egg

0 commit comments

Comments
 (0)