diff --git a/citadel/indico_citadel/cli.py b/citadel/indico_citadel/cli.py index b3e78fa..46df8bf 100644 --- a/citadel/indico_citadel/cli.py +++ b/citadel/indico_citadel/cli.py @@ -26,12 +26,12 @@ def cli(): @cli.command() -@click.option('--force', '-f', is_flag=True, help="Upload even if it has already been done once.") -@click.option('--retry', '-r', is_flag=True, help="Restart automatically after a failure") +@click.option('--force', '-f', is_flag=True, help='Upload even if it has already been done once.') +@click.option('--retry', '-r', is_flag=True, help='Restart automatically after a failure') @click.option('--batch', type=int, default=1000, show_default=True, metavar='N', - help="The amount of records yielded per upload batch.") + help='The amount of records yielded per upload batch.') @click.option('--max-size', type=int, metavar='SIZE', - help="The max size (in MB) of files to upload. Defaults to the size from the plugin settings.") + help='The max size (in MB) of files to upload. Defaults to the size from the plugin settings.') def upload(batch, force, max_size, retry): """Upload file contents for full text search.""" agent = LiveSyncAgent.query.filter(LiveSyncAgent.backend_name == 'citadel').first() diff --git a/citadel/indico_citadel/search.py b/citadel/indico_citadel/search.py index ee1a75d..859d9ca 100644 --- a/citadel/indico_citadel/search.py +++ b/citadel/indico_citadel/search.py @@ -93,10 +93,10 @@ placeholders = { 'person': ('_data.persons_index.name', _("A speaker, author or event chair's name")), 'affiliation': ('_data.persons_index.affiliation', _("A speaker, author or event chair's affiliation")), 'type': ('type_any', _('An entry type (such as conference, meeting, file, etc.)')), - 'venue': ('_data.location.venue_name', _("Name of the venue")), - 'room': ('_data.location.room_name', _("Name of the room")), - 'address': ('_data.location.address', _("Address of the venue")), - 'file': ('_data.filename', _("Name of the attached file")), + 'venue': ('_data.location.venue_name', _('Name of the venue')), + 'room': ('_data.location.room_name', _('Name of the room')), + 'address': ('_data.location.address', _('Address of the venue')), + 'file': ('_data.filename', _('Name of the attached file')), 'keyword': ('_data.keywords', _('A keyword associated with an event')), 'category': ('category_path.title', _('The category of an event')), } diff --git a/livesync/indico_livesync/cli.py b/livesync/indico_livesync/cli.py index 210a5b6..ba29ecb 100644 --- a/livesync/indico_livesync/cli.py +++ b/livesync/indico_livesync/cli.py @@ -62,17 +62,17 @@ def agents(): print(table.table) if not all(a.initial_data_exported for a in agent_list): print() - print("You need to perform the initial data export for some agents.") - print(cformat("To do so, run " - "%{yellow!}indico livesync initial-export %{reset}%{yellow}%{reset} for those agents.")) + print('You need to perform the initial data export for some agents.') + print(cformat('To do so, run ' + '%{yellow!}indico livesync initial-export %{reset}%{yellow}%{reset} for those agents.')) @cli.command() @click.argument('agent_id', type=int) -@click.option('--retry', '-r', is_flag=True, help="Restart automatically after a failure") -@click.option('--force', '-f', is_flag=True, help="Perform export even if it has already been done once.") -@click.option('--verbose', '-v', is_flag=True, help="Be more verbose (what this does is up to the backend)") -@click.option('--batch', type=int, default=5000, help="The amount of records yielded per export batch.", +@click.option('--retry', '-r', is_flag=True, help='Restart automatically after a failure') +@click.option('--force', '-f', is_flag=True, help='Perform export even if it has already been done once.') +@click.option('--verbose', '-v', is_flag=True, help='Be more verbose (what this does is up to the backend)') +@click.option('--batch', type=int, default=5000, help='The amount of records yielded per export batch.', show_default=True, metavar='N') def initial_export(agent_id, batch, force, verbose, retry): """Performs the initial data export for an agent.""" @@ -116,8 +116,8 @@ def initial_export(agent_id, batch, force, verbose, retry): @cli.command() @click.argument('agent_id', type=int, required=False) -@click.option('--force', '-f', is_flag=True, help="Run even if initial export was not done") -@click.option('--verbose', '-v', is_flag=True, help="Be more verbose (what this does is up to the backend)") +@click.option('--force', '-f', is_flag=True, help='Run even if initial export was not done') +@click.option('--verbose', '-v', is_flag=True, help='Be more verbose (what this does is up to the backend)') @click.option('--allow-category', '-c', 'allowed_categories', multiple=True, type=int, help="Process changes for the specified category id even if 'Skip category changes' is enabled. " "This setting can be used multiple times.") diff --git a/livesync/indico_livesync/forms.py b/livesync/indico_livesync/forms.py index 5c3450d..d6bab55 100644 --- a/livesync/indico_livesync/forms.py +++ b/livesync/indico_livesync/forms.py @@ -15,4 +15,4 @@ from indico_livesync import _ class AgentForm(IndicoForm): name = StringField(_('Name'), [DataRequired()], - description=_("The name of the agent. Only used in the administration interface.")) + description=_('The name of the agent. Only used in the administration interface.')) diff --git a/livesync/indico_livesync/plugin.py b/livesync/indico_livesync/plugin.py index df71c11..7763a45 100644 --- a/livesync/indico_livesync/plugin.py +++ b/livesync/indico_livesync/plugin.py @@ -23,15 +23,15 @@ from indico_livesync.handler import connect_signals class SettingsForm(IndicoForm): queue_entry_ttl = IntegerField(_('Queue entry TTL'), [NumberRange(min=0)], - description=_("How many days should processed entries be kept in the queue. " - "The time counts from the creation of the queue entries, so if the " - "LiveSync task is not running for some time, queue entries may be " - "deleted during the next run after processing them. Setting it to 0 " - "disables automatic deletion.")) + description=_('How many days should processed entries be kept in the queue. ' + 'The time counts from the creation of the queue entries, so if the ' + 'LiveSync task is not running for some time, queue entries may be ' + 'deleted during the next run after processing them. Setting it to 0 ' + 'disables automatic deletion.')) excluded_categories = MultipleItemsField(_('Excluded categories'), - fields=[{'id': 'id', 'caption': _("Category ID"), 'required': True}], - description=_("Changes to objects inside these categories or any of their " - "subcategories are excluded.")) + fields=[{'id': 'id', 'caption': _('Category ID'), 'required': True}], + description=_('Changes to objects inside these categories or any of their ' + 'subcategories are excluded.')) disable_queue_runs = BooleanField(_('Disable queue runs'), widget=SwitchWidget(), description=_('Disable all scheduled queue runs.')) skip_category_changes = BooleanField(_('Skip category changes'), widget=SwitchWidget(), diff --git a/payment_manual/indico_payment_manual/placeholders.py b/payment_manual/indico_payment_manual/placeholders.py index 421b8d4..57a4db1 100644 --- a/payment_manual/indico_payment_manual/placeholders.py +++ b/payment_manual/indico_payment_manual/placeholders.py @@ -35,19 +35,19 @@ class EscapablePlaceholder(ParametrizedPlaceholder): class FirstNamePlaceholder(EscapablePlaceholder): name = 'first_name' - basic_description = _("First name of the registrant") + basic_description = _('First name of the registrant') field = 'first_name' class LastNamePlaceholder(EscapablePlaceholder): name = 'last_name' - basic_description = _("Last name of the registrant") + basic_description = _('Last name of the registrant') field = 'last_name' class EmailPlaceholder(EscapablePlaceholder): name = 'email' - basic_description = _("Email address of the registrant") + basic_description = _('Email address of the registrant') field = 'email' @@ -57,7 +57,7 @@ class RegistrationIDPlaceholder(IDPlaceholder): class RegistrationDatabaseIDPlaceholder(Placeholder): name = 'registration_db_id' - description = _("The database ID of the registration") + description = _('The database ID of the registration') @classmethod def render(cls, regform, registration): @@ -66,7 +66,7 @@ class RegistrationDatabaseIDPlaceholder(Placeholder): class RegistrationFormIDPlaceholder(Placeholder): name = 'registration_form_id' - description = _("The ID of the registration form") + description = _('The ID of the registration form') @classmethod def render(cls, regform, registration): @@ -75,7 +75,7 @@ class RegistrationFormIDPlaceholder(Placeholder): class EventIDPlaceholder(Placeholder): name = 'event_id' - description = _("The ID of the event") + description = _('The ID of the event') @classmethod def render(cls, regform, registration): @@ -98,14 +98,14 @@ class PricePlaceholder(ParametrizedPlaceholder): @classmethod def iter_param_info(cls, regform, registration): - yield None, _("The price the registrant needs to pay (e.g. 100.00 or 100.25)") - yield 'short', _("The price without cents if possible (e.g. 100 or 100.25)") - yield 'int', _("The price formatted as an integer (e.g. 10000 or 10025)") + yield None, _('The price the registrant needs to pay (e.g. 100.00 or 100.25)') + yield 'short', _('The price without cents if possible (e.g. 100 or 100.25)') + yield 'int', _('The price formatted as an integer (e.g. 10000 or 10025)') class CurrencyPlaceholder(Placeholder): name = 'currency' - description = _("The currency used in the registration") + description = _('The currency used in the registration') @classmethod def render(cls, regform, registration): diff --git a/payment_paypal/indico_payment_paypal/controllers.py b/payment_paypal/indico_payment_paypal/controllers.py index 44923de..bcc1c76 100644 --- a/payment_paypal/indico_payment_paypal/controllers.py +++ b/payment_paypal/indico_payment_paypal/controllers.py @@ -46,18 +46,18 @@ class RHPaypalIPN(RH): verify_params = list(chain(IPN_VERIFY_EXTRA_PARAMS, request.form.items())) result = requests.post(current_plugin.settings.get('url'), data=verify_params).text if result != 'VERIFIED': - current_plugin.logger.warning("Paypal IPN string %s did not validate (%s)", verify_params, result) + current_plugin.logger.warning('Paypal IPN string %s did not validate (%s)', verify_params, result) return if self._is_transaction_duplicated(): - current_plugin.logger.info("Payment not recorded because transaction was duplicated\nData received: %s", + current_plugin.logger.info('Payment not recorded because transaction was duplicated\nData received: %s', request.form) return payment_status = request.form.get('payment_status') if payment_status == 'Failed': - current_plugin.logger.info("Payment failed (status: %s)\nData received: %s", payment_status, request.form) + current_plugin.logger.info('Payment failed (status: %s)\nData received: %s', payment_status, request.form) return if payment_status == 'Refunded' or float(request.form.get('mc_gross')) <= 0: - current_plugin.logger.warning("Payment refunded (status: %s)\nData received: %s", + current_plugin.logger.warning('Payment refunded (status: %s)\nData received: %s', payment_status, request.form) return if payment_status not in paypal_transaction_action_mapping: @@ -79,7 +79,7 @@ class RHPaypalIPN(RH): request.form.get('receiver_email', '').lower()} if expected in candidates: return True - current_plugin.logger.warning("Unexpected business: %s not in %r (request data: %r)", expected, candidates, + current_plugin.logger.warning('Unexpected business: %s not in %r (request data: %r)', expected, candidates, request.form) return False diff --git a/piwik/indico_piwik/forms.py b/piwik/indico_piwik/forms.py index 4f329a1..cd97237 100644 --- a/piwik/indico_piwik/forms.py +++ b/piwik/indico_piwik/forms.py @@ -15,21 +15,21 @@ from indico_piwik import _ class SettingsForm(IndicoForm): - enabled = BooleanField(_("Track global visits"), widget=SwitchWidget()) - enabled_for_events = BooleanField(_("Track events"), widget=SwitchWidget()) - cache_enabled = BooleanField(_("Cache results"), widget=SwitchWidget()) - server_url = StringField(_("Piwik server URL")) - server_api_url = StringField(_("Piwik API server URL"), + enabled = BooleanField(_('Track global visits'), widget=SwitchWidget()) + enabled_for_events = BooleanField(_('Track events'), widget=SwitchWidget()) + cache_enabled = BooleanField(_('Cache results'), widget=SwitchWidget()) + server_url = StringField(_('Piwik server URL')) + server_api_url = StringField(_('Piwik API server URL'), description=_("Should be pointing to 'index.php'")) - server_token = StringField(_("Piwik API token"), - description=_("Token to access the API. Do not share it!")) - site_id_general = StringField(_("Global statistics ID"), - description=_("Piwik site ID for global statistics")) - site_id_events = StringField(_("Event statistics ID"), - description=_("Piwik site ID for event statistics")) - cache_ttl = IntegerField(_("Result cache TTL (seconds)"), - description=_("How long event reports are kept cached")) - use_only_server_url = BooleanField(_("Use Piwik server URL for all requests")) + server_token = StringField(_('Piwik API token'), + description=_('Token to access the API. Do not share it!')) + site_id_general = StringField(_('Global statistics ID'), + description=_('Piwik site ID for global statistics')) + site_id_events = StringField(_('Event statistics ID'), + description=_('Piwik site ID for event statistics')) + cache_ttl = IntegerField(_('Result cache TTL (seconds)'), + description=_('How long event reports are kept cached')) + use_only_server_url = BooleanField(_('Use Piwik server URL for all requests')) def validate_site_id_events(self, field): if self.site_id_general is not None and field is not None and self.site_id_general.data == field.data: diff --git a/piwik/indico_piwik/piwik.py b/piwik/indico_piwik/piwik.py index a73c211..acd645e 100644 --- a/piwik/indico_piwik/piwik.py +++ b/piwik/indico_piwik/piwik.py @@ -65,9 +65,9 @@ class PiwikRequest: try: response = requests.get(query_url, timeout=timeout) except socket.timeout: - current_plugin.logger.warning("Timeout contacting Piwik server") + current_plugin.logger.warning('Timeout contacting Piwik server') return default_response except Exception: - current_plugin.logger.exception("Unable to connect") + current_plugin.logger.exception('Unable to connect') return default_response return response.content diff --git a/piwik/indico_piwik/plugin.py b/piwik/indico_piwik/plugin.py index 5d2afa8..872e2ec 100644 --- a/piwik/indico_piwik/plugin.py +++ b/piwik/indico_piwik/plugin.py @@ -63,7 +63,7 @@ class PiwikPlugin(IndicoPlugin): def add_sidemenu_item(self, sender, event, **kwargs): if not event.can_manage(session.user) or not PiwikPlugin.settings.get('site_id_events'): return - return SideMenuItem('statistics', _("Statistics"), url_for_plugin('piwik.view', event), section='reports') + return SideMenuItem('statistics', _('Statistics'), url_for_plugin('piwik.view', event), section='reports') def get_blueprints(self): return blueprint diff --git a/piwik/indico_piwik/queries/metrics.py b/piwik/indico_piwik/queries/metrics.py index 5a78506..dc20159 100644 --- a/piwik/indico_piwik/queries/metrics.py +++ b/piwik/indico_piwik/queries/metrics.py @@ -84,4 +84,4 @@ class PiwikQueryReportEventMetricPeakDateAndVisitors(PiwikQueryReportEventMetric date, value = max(result.items(), key=itemgetter(1)) return {'date': date, 'users': value} else: - return {'date': "No Data", 'users': 0} + return {'date': 'No Data', 'users': 0} diff --git a/piwik/indico_piwik/queries/utils.py b/piwik/indico_piwik/queries/utils.py index 92acd83..720a729 100644 --- a/piwik/indico_piwik/queries/utils.py +++ b/piwik/indico_piwik/queries/utils.py @@ -51,4 +51,4 @@ def stringify_seconds(seconds=0): ti['m'] = minutes % 60 ti['h'] = minutes / 60 - return "%dh %dm %ds" % (ti['h'], ti['m'], ti['s']) + return '%dh %dm %ds' % (ti['h'], ti['m'], ti['s']) diff --git a/previewer_jupyter/indico_previewer_jupyter/controllers.py b/previewer_jupyter/indico_previewer_jupyter/controllers.py index f441bbc..93bd0ce 100644 --- a/previewer_jupyter/indico_previewer_jupyter/controllers.py +++ b/previewer_jupyter/indico_previewer_jupyter/controllers.py @@ -51,6 +51,6 @@ class RHEventPreviewIPyNB(RH): response.headers['Content-Security-Policy'] = csp_header response.headers['X-Webkit-CSP'] = csp_header # IE10 doesn't have proper CSP support, so we need to be more strict - response.headers['X-Content-Security-Policy'] = "sandbox allow-same-origin;" + response.headers['X-Content-Security-Policy'] = 'sandbox allow-same-origin;' return response diff --git a/previewer_jupyter/indico_previewer_jupyter/cpp_highlighter.py b/previewer_jupyter/indico_previewer_jupyter/cpp_highlighter.py index 51fe330..6804a70 100644 --- a/previewer_jupyter/indico_previewer_jupyter/cpp_highlighter.py +++ b/previewer_jupyter/indico_previewer_jupyter/cpp_highlighter.py @@ -34,22 +34,22 @@ class CppHighlighter(Preprocessor): # Build regular expressions to catch language extensions or switches and choose # an adequate pygments lexer - any_magic = "|".join(self.magics) - self.re_magic_language = re.compile(fr"^\s*({any_magic}).*", re.DOTALL) + any_magic = '|'.join(self.magics) + self.re_magic_language = re.compile(fr'^\s*({any_magic}).*', re.DOTALL) def matches(self, source, reg_expr): return bool(reg_expr.match(source)) def _preprocess_cell_python(self, cell, resources, cell_index): # Mark %%cpp and %%dcl code cells as cpp - if cell.cell_type == "code" and self.matches(cell.source, self.re_magic_language): + if cell.cell_type == 'code' and self.matches(cell.source, self.re_magic_language): cell['metadata']['magics_language'] = self.cpp return cell, resources def _preprocess_cell_cpp(self, cell, resources, cell_index): # Mark all code cells as cpp - if cell.cell_type == "code": + if cell.cell_type == 'code': cell['metadata']['magics_language'] = self.cpp return cell, resources @@ -57,7 +57,7 @@ class CppHighlighter(Preprocessor): def preprocess(self, nb, resources): self.preprocess_cell = self._preprocess_cell_python try: - if nb.metadata.kernelspec.language == "c++": + if nb.metadata.kernelspec.language == 'c++': self.preprocess_cell = self._preprocess_cell_cpp except Exception: # if no language metadata, keep python as default diff --git a/previewer_jupyter/indico_previewer_jupyter/plugin.py b/previewer_jupyter/indico_previewer_jupyter/plugin.py index 71a207c..7ae73d0 100644 --- a/previewer_jupyter/indico_previewer_jupyter/plugin.py +++ b/previewer_jupyter/indico_previewer_jupyter/plugin.py @@ -25,7 +25,7 @@ register_custom_mimetypes() class NotebookPreviewer(Previewer): - ALLOWED_CONTENT_TYPE = re.compile(r"^application/x-ipynb\+json$") + ALLOWED_CONTENT_TYPE = re.compile(r'^application/x-ipynb\+json$') @classmethod def generate_content(cls, attachment): diff --git a/prometheus/indico_prometheus/plugin.py b/prometheus/indico_prometheus/plugin.py index f1478e9..099bedc 100644 --- a/prometheus/indico_prometheus/plugin.py +++ b/prometheus/indico_prometheus/plugin.py @@ -22,8 +22,8 @@ from indico_prometheus.blueprint import blueprint class PluginSettingsForm(IndicoForm): enabled = BooleanField( - _("Enabled"), [DataRequired()], - description=_("Endpoint enabled. Turn this on once you set a proper bearer token."), + _('Enabled'), [DataRequired()], + description=_('Endpoint enabled. Turn this on once you set a proper bearer token.'), widget=SwitchWidget() ) global_cache_ttl = TimeDeltaField( diff --git a/storage_s3/indico_storage_s3/plugin.py b/storage_s3/indico_storage_s3/plugin.py index fc8aa24..d4a49c5 100644 --- a/storage_s3/indico_storage_s3/plugin.py +++ b/storage_s3/indico_storage_s3/plugin.py @@ -30,19 +30,19 @@ from indico_storage_s3.storage import (DynamicS3Storage, ReadOnlyDynamicS3Storag class SettingsForm(IndicoForm): - bucket_info_enabled = BooleanField(_("Bucket info API"), widget=SwitchWidget()) - username = StringField(_("Username"), [HiddenUnless('bucket_info_enabled', preserve_data=True), DataRequired()], - description=_("The username to access the S3 bucket info endpoint")) + bucket_info_enabled = BooleanField(_('Bucket info API'), widget=SwitchWidget()) + username = StringField(_('Username'), [HiddenUnless('bucket_info_enabled', preserve_data=True), DataRequired()], + description=_('The username to access the S3 bucket info endpoint')) password = IndicoPasswordField(_('Password'), [HiddenUnless('bucket_info_enabled', preserve_data=True), DataRequired()], toggle=True, - description=_("The password to access the S3 bucket info endpoint")) + description=_('The password to access the S3 bucket info endpoint')) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) url = Markup('{}').format(url_for_plugin('storage_s3.buckets')) - self.bucket_info_enabled.description = _("Enables an API on {url} that returns information on all S3 buckets " - "currently in use, including dynamically-named ones.").format(url=url) + self.bucket_info_enabled.description = _('Enables an API on {url} that returns information on all S3 buckets ' + 'currently in use, including dynamically-named ones.').format(url=url) class S3StoragePlugin(IndicoPlugin): diff --git a/vc_dummy/indico_vc_dummy/plugin.py b/vc_dummy/indico_vc_dummy/plugin.py index 6d4052b..945af04 100644 --- a/vc_dummy/indico_vc_dummy/plugin.py +++ b/vc_dummy/indico_vc_dummy/plugin.py @@ -34,7 +34,7 @@ class DummyPlugin(VCPluginMixin, IndicoPlugin): configurable = True vc_room_form = VCRoomForm vc_room_attach_form = VCRoomAttachForm - friendly_name = "Dummy" + friendly_name = 'Dummy' @property def logo_url(self): diff --git a/vc_zoom/indico_vc_zoom/plugin.py b/vc_zoom/indico_vc_zoom/plugin.py index 571d850..e830f94 100644 --- a/vc_zoom/indico_vc_zoom/plugin.py +++ b/vc_zoom/indico_vc_zoom/plugin.py @@ -59,8 +59,8 @@ class PluginSettingsForm(VCPluginSettingsFormBase): client_secret = IndicoPasswordField(_('Client Secret'), [], toggle=True) webhook_token = IndicoPasswordField(_('Webhook Secret Token'), toggle=True, - description=_("Specify the \"Secret Token\" of your Zoom Webhook if you want " - "live updates in case of modified/deleted Zoom meetings.")) + description=_('Specify the "Secret Token" of your Zoom Webhook if you want ' + 'live updates in case of modified/deleted Zoom meetings.')) user_lookup_mode = IndicoEnumSelectField(_('User lookup mode'), [DataRequired()], enum=UserLookupMode, description=_('Specify how Indico should look up the zoom user that '