misc: pylint fix simplifiable-if-statement (#52222)

This commit is contained in:
Lauréline Guérin 2021-03-22 10:09:32 +01:00
parent e8ec57ac99
commit 46be3ca3ce
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
3 changed files with 3 additions and 12 deletions

View File

@ -300,10 +300,7 @@ class FieldsDirectory(Directory):
for field in self.objectdef.fields:
if field.type == 'page':
current_page_no += 1
if str(field.id) == self.page_id:
on_page = True
else:
on_page = False
on_page = bool(str(field.id) == self.page_id)
hidden = ''
if self.page_id and (not on_page or field.type == 'page'):

View File

@ -1520,10 +1520,7 @@ class CheckboxesWidget(CompositeWidget):
# don't mark individual checkboxes as required
element_kwargs.pop('required', None)
if value and key in value:
checked = True
else:
checked = False
checked = bool(value and key in value)
self.add(CheckboxWidget, name, title=title, value=checked, **element_kwargs)
self.element_names[name] = key

View File

@ -91,10 +91,7 @@ def check_key_pair_consistency(publickey=None, privatekey=None):
if rc2 != 0:
rc2, modulus2 = _call_openssl(['dsa', '-in', privatekey_fn, '-noout', '-modulus'])
if rc1 == 0 and rc2 == 0 and modulus1 == modulus2:
return True
else:
return False
return bool(rc1 == 0 and rc2 == 0 and modulus1 == modulus2)
finally:
os.unlink(privatekey_fn)
os.unlink(publickey_fn)