lint: Up-rev hacking
Without up-reving hacking python 3.12 can't be used for pep8/flake8 checks. Also address a few new pyflakes issues that seem reasonable to enforce: E275 missing whitespace after keyword H214 Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) H211 do not compare types, use assert{Is,IsNot}Instance Add F811 (redefinition of unused 'function'), as this check makes client.py fail. And noqa some longer lines that we're happy to carry. Change-Id: Ic97698a310ffe7114b668b8c4bc0195f6997bb45
This commit is contained in:
parent
b9fb6ca1d0
commit
1e0ab242ca
@ -754,7 +754,7 @@ def st_stat(parser, args, output_manager, return_parser=False):
|
|||||||
items, headers, output_manager
|
items, headers, output_manager
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise(stat_result["error"])
|
raise stat_result["error"]
|
||||||
else:
|
else:
|
||||||
output_manager.error(
|
output_manager.error(
|
||||||
'Usage: %s stat %s\n%s', BASENAME,
|
'Usage: %s stat %s\n%s', BASENAME,
|
||||||
@ -768,7 +768,7 @@ st_post_options = '''[--read-acl <acl>] [--write-acl <acl>] [--sync-to <sync-to>
|
|||||||
[--sync-key <sync-key>] [--meta <name:value>]
|
[--sync-key <sync-key>] [--meta <name:value>]
|
||||||
[--header <header>]
|
[--header <header>]
|
||||||
[<container> [<object>]]
|
[<container> [<object>]]
|
||||||
'''
|
''' # noqa
|
||||||
|
|
||||||
st_post_help = '''
|
st_post_help = '''
|
||||||
Updates meta information for the account, container, or object.
|
Updates meta information for the account, container, or object.
|
||||||
@ -864,7 +864,7 @@ def st_post(parser, args, output_manager, return_parser=False):
|
|||||||
else:
|
else:
|
||||||
result = swift.post(container=container)
|
result = swift.post(container=container)
|
||||||
if not result["success"]:
|
if not result["success"]:
|
||||||
raise(result["error"])
|
raise result["error"]
|
||||||
|
|
||||||
except SwiftError as e:
|
except SwiftError as e:
|
||||||
output_manager.error(e.value)
|
output_manager.error(e.value)
|
||||||
@ -1520,7 +1520,7 @@ st_bash_completion_help = '''Retrieve command specific flags used by bash_comple
|
|||||||
|
|
||||||
Optional positional arguments:
|
Optional positional arguments:
|
||||||
<command> Swift client command to filter the flags by.
|
<command> Swift client command to filter the flags by.
|
||||||
'''.strip('\n')
|
'''.strip('\n') # noqa
|
||||||
|
|
||||||
|
|
||||||
st_bash_completion_options = '''[command]
|
st_bash_completion_options = '''[command]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
hacking>=3.2.0,<3.3.0 # Apache-2.0
|
hacking>=3.2.0,<6.2.0 # Apache-2.0
|
||||||
|
|
||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
keystoneauth1>=3.4.0 # Apache-2.0
|
keystoneauth1>=3.4.0 # Apache-2.0
|
||||||
|
@ -1330,7 +1330,7 @@ class TestService(unittest.TestCase):
|
|||||||
options)
|
options)
|
||||||
responses = [x for x in resp_iter]
|
responses = [x for x in resp_iter]
|
||||||
for resp in responses:
|
for resp in responses:
|
||||||
self.assertFalse('error' in resp)
|
self.assertNotIn('error', resp)
|
||||||
self.assertTrue(resp['success'])
|
self.assertTrue(resp['success'])
|
||||||
self.assertEqual(5, len(responses))
|
self.assertEqual(5, len(responses))
|
||||||
container_resp, segment_container_resp = responses[0:2]
|
container_resp, segment_container_resp = responses[0:2]
|
||||||
|
@ -711,7 +711,7 @@ class TestShell(unittest.TestCase):
|
|||||||
@mock.patch('swiftclient.service.Connection')
|
@mock.patch('swiftclient.service.Connection')
|
||||||
def test_download_shuffle(self, connection, mock_shuffle):
|
def test_download_shuffle(self, connection, mock_shuffle):
|
||||||
# Test that the container and object lists are shuffled
|
# Test that the container and object lists are shuffled
|
||||||
mock_shuffle.side_effect = lambda l: l
|
mock_shuffle.side_effect = lambda to_shuffle: to_shuffle
|
||||||
connection.return_value.get_object.return_value = [
|
connection.return_value.get_object.return_value = [
|
||||||
{'content-type': 'text/plain',
|
{'content-type': 'text/plain',
|
||||||
'etag': EMPTY_ETAG},
|
'etag': EMPTY_ETAG},
|
||||||
|
@ -2000,7 +2000,7 @@ class TestConnection(MockHttpTest):
|
|||||||
'authurl': 'http://www.test.com',
|
'authurl': 'http://www.test.com',
|
||||||
'tenant_name': 'atenant'}
|
'tenant_name': 'atenant'}
|
||||||
conn = c.Connection(**args)
|
conn = c.Connection(**args)
|
||||||
self.assertEqual(type(conn), c.Connection)
|
self.assertIsInstance(conn, c.Connection)
|
||||||
|
|
||||||
def test_instance_kwargs_token(self):
|
def test_instance_kwargs_token(self):
|
||||||
args = {'preauthtoken': 'atoken123',
|
args = {'preauthtoken': 'atoken123',
|
||||||
@ -3056,7 +3056,7 @@ class TestCloseConnection(MockHttpTest):
|
|||||||
conn = c.Connection(url, 'asdf', 'asdf')
|
conn = c.Connection(url, 'asdf', 'asdf')
|
||||||
self.assertIsNone(conn.http_conn)
|
self.assertIsNone(conn.http_conn)
|
||||||
conn.http_conn = c.http_connection(url)
|
conn.http_conn = c.http_connection(url)
|
||||||
self.assertEqual(type(conn.http_conn), tuple)
|
self.assertIsInstance(conn.http_conn, tuple)
|
||||||
self.assertEqual(len(conn.http_conn), 2)
|
self.assertEqual(len(conn.http_conn), 2)
|
||||||
http_conn_obj = conn.http_conn[1]
|
http_conn_obj = conn.http_conn[1]
|
||||||
self.assertIsInstance(http_conn_obj, c.HTTPConnection)
|
self.assertIsInstance(http_conn_obj, c.HTTPConnection)
|
||||||
|
3
tox.ini
3
tox.ini
@ -69,7 +69,8 @@ commands=
|
|||||||
# H404: multi line docstring should start without a leading new line
|
# H404: multi line docstring should start without a leading new line
|
||||||
# H405: multi line docstring summary not separated with an empty line
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
# W504: line break after binary operator
|
# W504: line break after binary operator
|
||||||
ignore = H101,H301,H306,H401,H403,H404,H405,W504
|
# F811: Redefinition of unused name from line n
|
||||||
|
ignore = H101,H301,H306,H401,H403,H404,H405,W504,F811
|
||||||
# H106: Don’t put vim configuration in source files
|
# H106: Don’t put vim configuration in source files
|
||||||
# H203: Use assertIs(Not)None to check for None
|
# H203: Use assertIs(Not)None to check for None
|
||||||
enable-extensions=H106,H203
|
enable-extensions=H106,H203
|
||||||
|
Loading…
x
Reference in New Issue
Block a user