Skip to content

Commit 355dc12

Browse files
committed
Bump hacking
hacking 3.0.x is quite old. Bump it to the version now commonly used in multiple repositories. Change-Id: I16cc59ee5d7e5218b809ba49b2f6e10ebd6f54e4
1 parent 90a8bb9 commit 355dc12

File tree

13 files changed

+20
-36
lines changed

13 files changed

+20
-36
lines changed

doc/requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# The order of packages is significant, because pip processes them in the order
2-
# of appearance. Changing the order has an impact on the overall integration
3-
# process, which may cause wedges in the gate later.
41
openstackdocstheme>=2.2.1 # Apache-2.0
52
osprofiler>=1.4.0 # Apache-2.0
63
os-api-ref>=1.4.0 # Apache-2.0

magnum/api/controllers/v1/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class Cluster(base.APIBase):
184184
master_lb_enabled = wsme.wsattr(types.boolean)
185185
"""Indicates whether created clusters should have a load balancer for master
186186
nodes or not.
187-
"""
187+
""" # noqa: E501
188188

189189
def __init__(self, **kwargs):
190190
super(Cluster, self).__init__()

magnum/api/controllers/v1/cluster_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class ClusterTemplate(base.APIBase):
141141
master_lb_enabled = wsme.wsattr(types.boolean, default=False)
142142
"""Indicates whether created clusters should have a load balancer for master
143143
nodes or not.
144-
"""
144+
""" # noqa: E501
145145

146146
floating_ip_enabled = wsme.wsattr(types.boolean, default=True)
147147
"""Indicates whether created clusters should have a floating ip or not."""

magnum/api/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def apply_jsonpatch(doc, patch):
8686
p['path'] == '/health_status_reason')):
8787
try:
8888
val = p['value']
89-
dict_val = val if type(val) == dict else ast.literal_eval(val)
89+
dict_val = (val if isinstance(val, dict)
90+
else ast.literal_eval(val))
9091
p['value'] = dict_val
9192
except (SyntaxError, ValueError, AssertionError) as e:
9293
raise exception.PatchError(patch=patch, reason=e)

magnum/hacking/checks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def assert_equal_in(logical_line):
9393
"""Check for assertEqual(True|False, A in B), assertEqual(A in B, True|False)
9494
9595
M338
96-
"""
96+
""" # noqa: E501
9797
res = (assert_equal_in_start_with_true_or_false_re.search(logical_line) or
9898
assert_equal_in_end_with_true_or_false_re.search(logical_line))
9999
if res:
@@ -109,7 +109,7 @@ def no_xrange(logical_line):
109109
M339
110110
"""
111111
if assert_xrange_re.match(logical_line):
112-
yield(0, "M339: Do not use xrange().")
112+
yield (0, "M339: Do not use xrange().")
113113

114114

115115
@core.flake8ext
@@ -169,4 +169,4 @@ def check_explicit_underscore_import(logical_line, filename):
169169
UNDERSCORE_IMPORT_FILES.append(filename)
170170
elif (translated_log.match(logical_line) or
171171
string_translation.match(logical_line)):
172-
yield(0, "M340: Found use of _() without explicit import of _ !")
172+
yield (0, "M340: Found use of _() without explicit import of _ !")

magnum/objects/x509keypair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def get_by_uuid(cls, context, uuid):
9494
:param uuid: the uuid of a x509keypair.
9595
:param context: Security context
9696
:returns: a :class:`X509KeyPair` object.
97-
"""
97+
""" # noqa: E501
9898
db_x509keypair = cls.dbapi.get_x509keypair_by_uuid(context, uuid)
9999
x509keypair = X509KeyPair._from_db_object(cls(context), db_x509keypair)
100100
return x509keypair

magnum/tests/unit/api/controllers/v1/test_cluster_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def _create_model_raises_app_error(self, **kwargs):
691691
# Create mock for db and image data
692692
with mock.patch.object(
693693
self.dbapi, 'create_cluster_template',
694-
wraps=self.dbapi.create_cluster_template) as cc_mock,\
694+
wraps=self.dbapi.create_cluster_template) as cc_mock, \
695695
mock.patch('magnum.api.attr_validator.validate_image')\
696696
as mock_image_data:
697697
mock_image_data.return_value = {'name': 'mock_name',

magnum/tests/unit/api/controllers/v1/test_federation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_member_join(self):
206206

207207
# make sure it was added:
208208
fed = self.get_json('/federations/%s' % f.uuid)
209-
self.assertTrue(new_member.uuid in fed['member_ids'])
209+
self.assertIn(new_member.uuid, fed['member_ids'])
210210

211211
def test_member_unjoin(self):
212212
member = obj_utils.create_test_cluster(self.context)
@@ -221,7 +221,7 @@ def test_member_unjoin(self):
221221

222222
# make sure it was deleted:
223223
fed = self.get_json('/federations/%s' % federation.uuid)
224-
self.assertFalse(member.uuid in fed['member_ids'])
224+
self.assertNotIn(member.uuid, fed['member_ids'])
225225

226226
def test_join_non_existent_cluster(self):
227227
foo_uuid = uuidutils.generate_uuid()

magnum/tests/unit/api/controllers/v1/test_quota.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ def test_get_all_with_pagination_limit(self, mock_context,
158158
expected = [r.project_id for r in quota_list[:2]]
159159
res_proj_ids = [r['project_id'] for r in response['quotas']]
160160
self.assertEqual(sorted(expected), sorted(res_proj_ids))
161-
self.assertTrue('http://localhost/v1/quotas?' in response['next'])
162-
self.assertTrue('sort_key=id' in response['next'])
163-
self.assertTrue('sort_dir=asc' in response['next'])
164-
self.assertTrue('limit=2' in response['next'])
165-
self.assertTrue('marker=%s' % quota_list[1].id in response['next'])
161+
self.assertIn('http://localhost/v1/quotas?', response['next'])
162+
self.assertIn('sort_key=id', response['next'])
163+
self.assertIn('sort_dir=asc', response['next'])
164+
self.assertIn('limit=2', response['next'])
165+
self.assertIn('marker=%s' % quota_list[1].id, response['next'])
166166

167167
@mock.patch("magnum.common.policy.enforce")
168168
@mock.patch("magnum.common.context.make_context")

magnum/tests/unit/common/x509/test_operations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ def test_decrypt_key(self, mock_load_pem_private_key,
4646
def test_generate_csr_and_key(self):
4747
csr_keys = operations.generate_csr_and_key(u"Test")
4848
self.assertIsNotNone(csr_keys)
49-
self.assertTrue("public_key" in csr_keys)
50-
self.assertTrue("private_key" in csr_keys)
49+
self.assertIn("public_key", csr_keys)
50+
self.assertIn("private_key", csr_keys)

0 commit comments

Comments
 (0)