misc: pylint fix last warnings (#52222)

This commit is contained in:
Lauréline Guérin 2021-03-22 16:45:18 +01:00
parent 4889deb2a0
commit 6632a3133b
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
6 changed files with 9 additions and 9 deletions

View File

@ -1142,7 +1142,7 @@ class FormDefPage(Directory):
status_mapping = {}
for status in self.formdef.workflow.possible_status:
status_mapping['wf-%s' % status.id] = 'wf-%s' % form.get_widget('mapping-%s' % status.id).parse()
if any([x[0] != x[1] for x in status_mapping.items()]):
if any(x[0] != x[1] for x in status_mapping.items()):
# if there are status changes, update all formdatas (except drafts)
status_mapping.update({'draft': 'draft'})
for item in self.formdef.data_class().select([NotEqual('status', 'draft')]):

View File

@ -1972,8 +1972,8 @@ class FormPage(Directory):
# filter actions to get those that can be run by the user,
# either because of actual roles, or because the action is
# accessible to functions.
if logged_users_role().id not in action_dict.get('roles') or []:
action_dict['roles'] = [x for x in user.get_roles() if x in action_dict.get('roles') or []]
if logged_users_role().id not in (action_dict.get('roles') or []):
action_dict['roles'] = [x for x in user.get_roles() if x in (action_dict.get('roles') or [])]
if action_dict['roles']:
# action is accessible with user roles, remove mentions of functions
action_dict['functions'] = []
@ -3728,7 +3728,7 @@ class CsvExportAfterJob(AfterJob):
csv_output.writerow(self.csv_tuple_heading(fields))
for filled in items:
csv_output.writerow(tuple([x['value'] for x in self.get_spreadsheet_line(fields, filled)]))
csv_output.writerow(tuple(x['value'] for x in self.get_spreadsheet_line(fields, filled)))
self.file_content = output.getvalue()
self.content_type = 'text/csv'

View File

@ -1285,7 +1285,7 @@ class FormData(StorableObject):
# ignore empty pages
fields_and_details = []
for page in pages:
if not any([bool('value' in x) for x in page['fields']]):
if not any(bool('value' in x) for x in page['fields']):
continue
fields_and_details.append(page)
fields_and_details.extend([x for x in page['fields']])

View File

@ -716,7 +716,7 @@ class FormDef(StorableObject):
# 2nd pass to create view form
for page in pages:
visible_contents = False
if page['fields'] and any([x.include_in_validation_page for x in page['fields']]):
if page['fields'] and any(x.include_in_validation_page for x in page['fields']):
visible_contents = True
form.widgets.append(HtmlWidget(htmltext('<div class="page">')))
if page['page'].label:

View File

@ -775,7 +775,7 @@ class FileWithPreviewWidget(CompositeWidget):
def is_image(self):
if getattr(self, 'file_type', None):
return all([x.startswith('image/') for x in getattr(self, 'file_type', None) or []])
return all(x.startswith('image/') for x in getattr(self, 'file_type', None) or [])
return False
def set_value(self, value):
@ -1365,7 +1365,7 @@ class DateWidget(StringWidget):
def prepare_javascript(cls):
get_response().add_javascript(['jquery.js', 'bootstrap-datetimepicker.js', 'qommon.forms.js'])
current_language = get_request().language
if current_language != 'en' and current_language in get_publisher().supported_languages or []:
if current_language != 'en' and current_language in (get_publisher().supported_languages or []):
get_response().add_javascript(['bootstrap-datetimepicker.%s.js' % current_language])
get_response().add_css_include('datetimepicker.css')

View File

@ -16,7 +16,7 @@
import subprocess
from uwsgidecorators import spool
from uwsgidecorators import spool # pylint: disable=E0401
@spool