summaryrefslogtreecommitdiff
path: root/nova/volume
diff options
context:
space:
mode:
authorSean Mooney <work@seanmooney.info>2021-08-26 14:16:19 +0100
committerSean Mooney <work@seanmooney.info>2021-11-08 12:37:27 +0000
commitf3d48000b139ec38d92da276a43a8387f76cbc89 (patch)
tree4b1bbbf298d78b2dc00a6399766c9614d7f5e47e /nova/volume
parentf024490e95c2bdb8072247e9907c6aa1475c80d8 (diff)
downloadnova-f3d48000b139ec38d92da276a43a8387f76cbc89.tar.gz
Add autopep8 to tox and pre-commit
autopep8 is a code formating tool that makes python code pep8 compliant without changing everything. Unlike black it will not radically change all code and the primary change to the existing codebase is adding a new line after class level doc strings. This change adds a new tox autopep8 env to manually run it on your code before you submit a patch, it also adds autopep8 to pre-commit so if you use pre-commit it will do it for you automatically. This change runs autopep8 in diff mode with --exit-code in the pep8 tox env so it will fail if autopep8 would modify your code if run in in-place mode. This allows use to gate on autopep8 not modifying patches that are submited. This will ensure authorship of patches is maintianed. The intent of this change is to save the large amount of time we spend on ensuring style guidlines are followed automatically to make it simpler for both new and old contibutors to work on nova and save time and effort for all involved. Change-Id: Idd618d634cc70ae8d58fab32f322e75bfabefb9d
Diffstat (limited to 'nova/volume')
-rw-r--r--nova/volume/cinder.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/volume/cinder.py b/nova/volume/cinder.py
index 4727598d4f..c5de961d28 100644
--- a/nova/volume/cinder.py
+++ b/nova/volume/cinder.py
@@ -412,6 +412,7 @@ def translate_cinder_exception(method):
def translate_create_exception(method):
"""Transforms the exception for create but keeps its traceback intact.
"""
+
def wrapper(self, ctx, size, *args, **kwargs):
try:
res = method(self, ctx, size, *args, **kwargs)
@@ -426,6 +427,7 @@ def translate_create_exception(method):
def translate_volume_exception(method):
"""Transforms the exception for the volume but keeps its traceback intact.
"""
+
def wrapper(self, ctx, volume_id, *args, **kwargs):
try:
res = method(self, ctx, volume_id, *args, **kwargs)
@@ -441,6 +443,7 @@ def translate_attachment_exception(method):
"""Transforms the exception for the attachment but keeps its traceback
intact.
"""
+
def wrapper(self, ctx, attachment_id, *args, **kwargs):
try:
res = method(self, ctx, attachment_id, *args, **kwargs)
@@ -455,6 +458,7 @@ def translate_snapshot_exception(method):
"""Transforms the exception for the snapshot but keeps its traceback
intact.
"""
+
def wrapper(self, ctx, snapshot_id, *args, **kwargs):
try:
res = method(self, ctx, snapshot_id, *args, **kwargs)
@@ -466,6 +470,7 @@ def translate_snapshot_exception(method):
def translate_mixed_exceptions(method):
"""Transforms exceptions that can come from both volumes and snapshots."""
+
def wrapper(self, ctx, res_id, *args, **kwargs):
try:
res = method(self, ctx, res_id, *args, **kwargs)