summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2018-01-30 15:08:58 +0000
committerBenjamin Copeland <ben.copeland@linaro.org>2018-01-30 16:30:41 +0000
commitcbf6b73a3cc1d1b723b4ffea3c53bb74129d54f0 (patch)
treef2ce04e26cf892f6f3c593bbe8cb8c336e872783
parent5e34e52ded9a20bad9fdc92ae67bb0e7abc5c09c (diff)
downloadpatchwork-tools-master.tar.gz
Flake8: Fix Flake8 errorsHEADmaster
Fix some simple Flake8 errors with spacing and using Exception. Change-Id: I21d4a8cba3971d0dc9bdac6df8eed11031b84b68
-rw-r--r--bin.py8
-rwxr-xr-xensure_projects.py2
-rwxr-xr-ximport_emails.py2
-rw-r--r--linaro_metrics/crowd.py2
-rwxr-xr-xlinaro_metrics/migrate_patchmetrics.py2
-rwxr-xr-xlinaro_metrics/sync_github_changes.py4
-rw-r--r--linaro_metrics/views.py2
-rwxr-xr-xupdate_commited_patches.py6
8 files changed, 14 insertions, 14 deletions
diff --git a/bin.py b/bin.py
index eef0250..8c931df 100644
--- a/bin.py
+++ b/bin.py
@@ -9,7 +9,7 @@ import django
def django_setup():
try:
import patchwork
- except:
+ except Exception:
# try and guess location based on how ansible deploys patchwork
here = os.path.abspath(os.path.dirname(__file__))
patchwork = os.path.join(here, '../project')
@@ -30,9 +30,9 @@ def _init_logging(level):
'%(asctime)s %(levelname)-5s %(name)s: %(message)s',
datefmt='%H:%M:%S')
handler.setFormatter(formatter)
- l = logging.getLogger('')
- l.addHandler(handler)
- l.setLevel(getattr(logging, level))
+ log = logging.getLogger('')
+ log.addHandler(handler)
+ log.setLevel(getattr(logging, level))
class LoggingAction(argparse.Action):
diff --git a/ensure_projects.py b/ensure_projects.py
index cfce618..e4f2220 100755
--- a/ensure_projects.py
+++ b/ensure_projects.py
@@ -9,6 +9,6 @@ django_setup() # must be called to get sys.path and django settings in place
for p in settings.DEFAULT_PROJECTS:
try:
Project.objects.get(linkname=p['linkname'])
- except:
+ except Exception:
print('Creating project: %s' % p['linkname'])
Project.objects.create(**p)
diff --git a/import_emails.py b/import_emails.py
index 15338d9..2f71b29 100755
--- a/import_emails.py
+++ b/import_emails.py
@@ -76,7 +76,7 @@ def process_inbox(mail, max_messages=0):
added += 1
move_message(mail, uid, 'processed')
processed += 1
- except:
+ except Exception:
log.exception('Unknown error for %s, moving to retry folder', uid)
move_message(mail, uid, 'retry')
break
diff --git a/linaro_metrics/crowd.py b/linaro_metrics/crowd.py
index 1aab51b..d3bff1e 100644
--- a/linaro_metrics/crowd.py
+++ b/linaro_metrics/crowd.py
@@ -72,7 +72,7 @@ class Crowd(object):
f.seek(0)
try:
self._cache = json.load(f)
- except:
+ except Exception:
self._cache = {} # in case things are corrupted
yield
diff --git a/linaro_metrics/migrate_patchmetrics.py b/linaro_metrics/migrate_patchmetrics.py
index 2598b2f..f9fb683 100755
--- a/linaro_metrics/migrate_patchmetrics.py
+++ b/linaro_metrics/migrate_patchmetrics.py
@@ -39,7 +39,7 @@ def table_iterator(cursor, table):
old_cursor.execute('SELECT * from %s' % table)
for row in old_cursor:
yield row
- except:
+ except Exception:
if row:
print('failed on row: %s' % row)
raise
diff --git a/linaro_metrics/sync_github_changes.py b/linaro_metrics/sync_github_changes.py
index e37f55e..c0f406d 100755
--- a/linaro_metrics/sync_github_changes.py
+++ b/linaro_metrics/sync_github_changes.py
@@ -86,7 +86,7 @@ def get_pull_requests(owner, repo, last_update=None):
return
try:
yield x
- except:
+ except Exception:
log.error('Unable to process pr(%r)', x)
raise
url = resp.headers.get('link')
@@ -169,7 +169,7 @@ def repo_cache():
data = json.load(f)
for repo, dt in data.items():
data[repo] = datetime.strptime(dt, '%Y-%m-%dT%H:%M:%S.%f')
- except:
+ except Exception:
log.exception('ignoring')
yield data
with open(fname, 'w') as f:
diff --git a/linaro_metrics/views.py b/linaro_metrics/views.py
index 308894f..ee88dbe 100644
--- a/linaro_metrics/views.py
+++ b/linaro_metrics/views.py
@@ -181,7 +181,7 @@ def project_view(request, project_id):
try:
with open(commit) as f:
project.last_commit = f.read()
- except:
+ except Exception:
project.last_commit = ''
view_args = {'project_id': project.linkname}
diff --git a/update_commited_patches.py b/update_commited_patches.py
index e295641..a2d73e9 100755
--- a/update_commited_patches.py
+++ b/update_commited_patches.py
@@ -66,7 +66,7 @@ def _update_project(cb, repo_dir, project, commits, dryrun):
cb(project, repo, commit, dryrun)
except MemoryError as e:
log.error('Unable to process commit(%s) because of size: %s',
- commit.id, e)
+ commit.id, e)
except Exception as e:
log.error('Unable to process commit(%s): %s', commit.id, e)
@@ -117,7 +117,7 @@ if __name__ == '__main__':
_update_project(
cb, settings.REPO_DIR, p, args.commit_id, args.dryrun
)
- except:
+ except Exception:
log.exception('Error updating commits for: %s', p)
if not cb_constructor:
@@ -126,5 +126,5 @@ if __name__ == '__main__':
_update_project(
None, settings.REPO_DIR, p, args.commit_id, args.dryrun
)
- except:
+ except Exception:
log.exception('Error updating commits for: %s', p)