diff --git a/barbican/cmd/barbican_manage.py b/barbican/cmd/barbican_manage.py index d2b798ee4..627044e11 100755 --- a/barbican/cmd/barbican_manage.py +++ b/barbican/cmd/barbican_manage.py @@ -321,8 +321,7 @@ def main(): # call the action with the remaining arguments try: - ret = fn(*fn_args, **fn_kwargs) - return(ret) + return fn(*fn_args, **fn_kwargs) except Exception as e: sys.exit("ERROR: %s" % e) diff --git a/barbican/cmd/pkcs11_kek_rewrap.py b/barbican/cmd/pkcs11_kek_rewrap.py index add56ab97..47ec707ca 100755 --- a/barbican/cmd/pkcs11_kek_rewrap.py +++ b/barbican/cmd/pkcs11_kek_rewrap.py @@ -148,7 +148,7 @@ class KekRewrap(object): def main(): - script_desc = ('Utility to re-wrap project KEKs after rotating an MKEK.') + script_desc = 'Utility to re-wrap project KEKs after rotating an MKEK.' parser = argparse.ArgumentParser(description=script_desc) parser.add_argument( diff --git a/barbican/tests/api/controllers/test_containers.py b/barbican/tests/api/controllers/test_containers.py index 44ae4715e..4cb803c5b 100644 --- a/barbican/tests/api/controllers/test_containers.py +++ b/barbican/tests/api/controllers/test_containers.py @@ -343,4 +343,4 @@ def create_container(app, name=None, container_type=None, secret_refs=None, container_ref = resp.json.get('container_ref', '') _, created_uuid = os.path.split(container_ref) - return (resp, created_uuid) + return resp, created_uuid diff --git a/barbican/tests/api/controllers/test_orders.py b/barbican/tests/api/controllers/test_orders.py index e1f1ffd03..7b9d842a8 100644 --- a/barbican/tests/api/controllers/test_orders.py +++ b/barbican/tests/api/controllers/test_orders.py @@ -782,7 +782,7 @@ def create_order(app, order_type=None, meta=None, expect_errors=False): order_ref = resp.json.get('order_ref', '') _, created_uuid = os.path.split(order_ref) - return (resp, created_uuid) + return resp, created_uuid def create_container(app, name=None, container_type=None, secret_refs=None, @@ -807,4 +807,4 @@ def create_container(app, name=None, container_type=None, secret_refs=None, container_ref = resp.json.get('container_ref', '') _, created_uuid = os.path.split(container_ref) - return (resp, created_uuid) + return resp, created_uuid diff --git a/barbican/tests/api/controllers/test_secrets.py b/barbican/tests/api/controllers/test_secrets.py index 14bf31a6e..c20297e6a 100644 --- a/barbican/tests/api/controllers/test_secrets.py +++ b/barbican/tests/api/controllers/test_secrets.py @@ -750,4 +750,4 @@ def create_secret(app, name=None, algorithm=None, bit_length=None, mode=None, secret_ref = resp.json.get('secret_ref', '') _, created_uuid = os.path.split(secret_ref) - return (resp, created_uuid) + return resp, created_uuid diff --git a/barbican/tests/model/test_models.py b/barbican/tests/model/test_models.py index 7d407b226..1814ebf21 100644 --- a/barbican/tests/model/test_models.py +++ b/barbican/tests/model/test_models.py @@ -407,7 +407,7 @@ class WhenCreatingNewSecretACL(utils.BaseTestCase): def test_new_secretacl_with_duplicate_userids_input(self): user_ids = list(self.user_ids) - user_ids = user_ids * 2 # duplicate ids + user_ids *= 2 # duplicate ids acl = models.SecretACL(self.secret_id, self.operation, None, user_ids=user_ids) self.assertEqual(self.secret_id, acl.secret_id) @@ -470,7 +470,7 @@ class WhenCreatingNewContainerACL(utils.BaseTestCase): def test_new_containeracl_with_duplicate_userids_input(self): user_ids = list(self.user_ids) - user_ids = user_ids * 2 # duplicate ids + user_ids *= 2 # duplicate ids acl = models.ContainerACL(self.container_id, self.operation, True, user_ids=user_ids) self.assertEqual(self.container_id, acl.container_id) diff --git a/barbican/tests/plugin/test_kmip.py b/barbican/tests/plugin/test_kmip.py index e2dc62a75..fe8d46787 100644 --- a/barbican/tests/plugin/test_kmip.py +++ b/barbican/tests/plugin/test_kmip.py @@ -464,7 +464,7 @@ class WhenTestingKMIPSecretStore(utils.BaseTestCase): def test_store_opaque_secret_assert_called(self): key_spec = secret_store.KeySpec(None, None, None) - opaque = (b'\x00\x01\x02\x03\x04\x05\x06\x07') + opaque = b'\x00\x01\x02\x03\x04\x05\x06\x07' secret_dto = secret_store.SecretDTO(secret_store.SecretType.OPAQUE, base64.b64encode(opaque), key_spec, @@ -487,7 +487,7 @@ class WhenTestingKMIPSecretStore(utils.BaseTestCase): def test_store_opaque_secret_return_value(self): key_spec = secret_store.KeySpec(None, None, None) - opaque = (b'\x00\x01\x02\x03\x04\x05\x06\x07') + opaque = b'\x00\x01\x02\x03\x04\x05\x06\x07' secret_dto = secret_store.SecretDTO(secret_store.SecretType.OPAQUE, base64.b64encode(opaque), key_spec, diff --git a/bin/demo_requests.py b/bin/demo_requests.py index 6e1503b6f..a659b47b3 100755 --- a/bin/demo_requests.py +++ b/bin/demo_requests.py @@ -92,7 +92,7 @@ def demo_store_secret_two_step_binary(): pr = requests.post(ep_2step, data=json.dumps(payload), headers=hdrs) pr_j = pr.json() secret_ref = pr_j.get('secret_ref') - assert(secret_ref) + assert secret_ref # PUT data to store: hdrs_put = dict(hdrs) @@ -201,7 +201,7 @@ def demo_consumers_add(container_ref): # POST metadata: pr = requests.post(ep_add, data=json.dumps(payload_consumer), headers=hdrs) pr_consumers = pr.json().get('consumers') - assert(pr_consumers) + assert pr_consumers assert(len(pr_consumers) == 1) LOG.info('...Consumer response: {0}'.format(pr_consumers)) diff --git a/functionaltests/common/auth.py b/functionaltests/common/auth.py index 35d19281a..c97d624d6 100644 --- a/functionaltests/common/auth.py +++ b/functionaltests/common/auth.py @@ -58,7 +58,7 @@ class FunctionalTestAuth(auth.AuthBase): tenant_name=self.project_name, auth_url=self.endpoint ) - return (self._client.auth_token, self._client.tenant_id) + return self._client.auth_token, self._client.tenant_id elif self.version.lower() == 'v3': self._client = v3_client.Client( @@ -67,7 +67,7 @@ class FunctionalTestAuth(auth.AuthBase): project_name=self.project_name, auth_url=self.endpoint ) - return (self._client.auth_token, self._client.project_id) + return self._client.auth_token, self._client.project_id else: raise Exception('Unknown authentication version') diff --git a/functionaltests/common/client.py b/functionaltests/common/client.py index ab394eb24..4492891ed 100644 --- a/functionaltests/common/client.py +++ b/functionaltests/common/client.py @@ -154,7 +154,7 @@ class BarbicanClient(object): str_request) def _status_is_2xx_success(self, status_code): - return status_code >= 200 and status_code < 300 + return 200 <= status_code < 300 def attempt_to_deserialize(self, response, model_type): if (self._status_is_2xx_success(response.status_code) and