Fix flake8 errors

This commit is contained in:
Adrian Moennich 2020-11-11 10:31:59 +01:00
parent 60d02fe594
commit 0857d002c3
11 changed files with 29 additions and 29 deletions

View File

@ -31,3 +31,11 @@ ignore =
W504
# allow assigning lambdas (it's useful for single-line functions defined inside other functions)
E731
# while single quotes are nicer, we have double quotes in way too many places
Q000
# for non-docstring multiline strings we don't really enforce a quote style
Q001
per-file-ignores =
# allow nicely aligned parametrizations
**/*_test.py:E241

View File

@ -13,13 +13,13 @@ _ = make_bound_gettext('livesync')
__all__ = ('LiveSyncPluginBase', 'LiveSyncBackendBase', 'AgentForm', 'SimpleChange', 'process_records',
'MARCXMLGenerator', 'Uploader', 'MARCXMLUploader')
from .base import LiveSyncPluginBase, LiveSyncBackendBase # isort:skip
from .forms import AgentForm # isort:skip
from .simplify import SimpleChange, process_records # isort:skip
from .marcxml import MARCXMLGenerator # isort:skip
from .uploader import Uploader, MARCXMLUploader # isort:skip
from .base import LiveSyncBackendBase, LiveSyncPluginBase # noqa:E402
from .forms import AgentForm # noqa:E402
from .marcxml import MARCXMLGenerator # noqa:E402
from .simplify import SimpleChange, process_records # noqa:E402
from .uploader import MARCXMLUploader, Uploader # noqa:E402
@signals.import_tasks.connect
def _import_tasks(sender, **kwargs):
import indico_livesync.task
import indico_livesync.task # noqa: F401

View File

@ -103,6 +103,6 @@ def run(agent_id, force=False):
try:
agent.create_backend().run()
db.session.commit()
except:
except Exception:
db.session.rollback()
raise

View File

@ -47,8 +47,7 @@ class PiwikQueryReportEventBase(PiwikQueryReportBase):
def call(self, segmentation_enabled=True, **query_params):
if segmentation_enabled:
query_params['segment'] = self.get_segmentation()
return super().call(module='API', date=[self.start_date, self.end_date],
**query_params)
return super().call(module='API', date=[self.start_date, self.end_date], **query_params)
def get_segmentation(self):
segmentation = {'customVariablePageName1': ('==', 'Conference'),

View File

@ -20,9 +20,8 @@ class PiwikQueryReportEventGraphBase(PiwikQueryReportEventBase):
query_params['height'] = height
if width is not None:
query_params['width'] = width
return super().call(method='ImageGraph.get',
apiModule=apiModule, apiAction=apiAction,
aliasedGraph='1', graphType=graphType, **query_params)
return super().call(method='ImageGraph.get', apiModule=apiModule, apiAction=apiAction, aliasedGraph='1',
graphType=graphType, **query_params)
def get_result(self):
"""Perform the call and return the graph data
@ -41,13 +40,11 @@ class PiwikQueryReportEventGraphBase(PiwikQueryReportEventBase):
class PiwikQueryReportEventGraphCountries(PiwikQueryReportEventGraphBase):
def call(self, **query_params):
return super().call(apiModule='UserCountry', apiAction='getCountry',
period='range', width=490, height=260,
graphType='horizontalBar', **query_params)
return super().call(apiModule='UserCountry', apiAction='getCountry', period='range', width=490, height=260,
graphType='horizontalBar', **query_params)
class PiwikQueryReportEventGraphDevices(PiwikQueryReportEventGraphBase):
def call(self, **query_params):
return super().call(apiModule='UserSettings', apiAction='getOS',
period='range', width=320, height=260,
graphType='horizontalBar', **query_params)
return super().call(apiModule='UserSettings', apiAction='getOS', period='range', width=320, height=260,
graphType='horizontalBar', **query_params)

View File

@ -69,8 +69,7 @@ class PiwikQueryReportEventMetricDownloads(PiwikQueryReportEventMetricBase):
class PiwikQueryReportEventMetricReferrers(PiwikQueryReportEventMetricBase):
def call(self, **query_params):
return super().call(method='Referrers.getReferrerType',
period='range', **query_params)
return super().call(method='Referrers.getReferrerType', period='range', **query_params)
def get_result(self):
"""Perform the call and return a list of referrers"""
@ -83,8 +82,7 @@ class PiwikQueryReportEventMetricReferrers(PiwikQueryReportEventMetricBase):
class PiwikQueryReportEventMetricUniqueVisits(PiwikQueryReportEventMetricVisitsBase):
def call(self, **query_params):
return super().call(method='VisitsSummary.getUniqueVisitors',
**query_params)
return super().call(method='VisitsSummary.getUniqueVisitors', **query_params)
class PiwikQueryReportEventMetricVisits(PiwikQueryReportEventMetricVisitsBase):
@ -115,8 +113,7 @@ class PiwikQueryReportEventMetricVisitDuration(PiwikQueryReportEventMetricBase):
class PiwikQueryReportEventMetricPeakDateAndVisitors(PiwikQueryReportEventMetricBase):
def call(self, **query_params):
return super().call(method='VisitsSummary.getVisits',
**query_params)
return super().call(method='VisitsSummary.getVisits', **query_params)
def get_result(self):
"""Perform the call and return the peak date and how many users"""

View File

@ -59,7 +59,7 @@ class CppHighlighter(Preprocessor):
try:
if nb.metadata.kernelspec.language == "c++":
self.preprocess_cell = self._preprocess_cell_cpp
except:
except Exception:
# if no language metadata, keep python as default
pass
return super().preprocess(nb, resources)

View File

@ -14,4 +14,4 @@ _ = make_bound_gettext('storage_s3')
@signals.import_tasks.connect
def _import_tasks(sender, **kwargs):
import indico_storage_s3.task
import indico_storage_s3.task # noqa: F401

View File

@ -23,7 +23,7 @@ END_MARKER = '# END GENERATED REQUIREMENTS'
def _find_plugins():
subdirs = sorted(x for x in os.walk('.').next()[1]
if x[0] != '.' and x != '_meta' and os.path.exists(os.path.join(x, 'setup.py')))
if x[0] != '.' and x != '_meta' and os.path.exists(os.path.join(x, 'setup.py')))
for subdir in subdirs:
path = os.path.join(subdir, 'setup.py')
with open(path) as f:

View File

@ -14,4 +14,4 @@ _ = make_bound_gettext('vc_vidyo')
@signals.import_tasks.connect
def _import_tasks(sender, **kwargs):
import indico_vc_vidyo.task
import indico_vc_vidyo.task # noqa: F401

View File

@ -10,7 +10,6 @@ import re
from flask_multipass import IdentityRetrievalFailed
from indico.core.auth import multipass
from indico.core.db import db
from indico.modules.auth import Identity
from indico.modules.users import User