mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-12 23:27:22 +00:00
Fix flake8 errors
This commit is contained in:
parent
60d02fe594
commit
0857d002c3
8
.flake8
8
.flake8
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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'),
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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"""
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user