root: upgrade to pylint 2.7

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-22 19:58:56 +01:00
parent e202fd988b
commit 3157bf63a6
7 changed files with 9 additions and 8 deletions

View File

@ -13,7 +13,7 @@ disable =
similarities,
cyclic-import,
protected-access,
unsubscriptable-object # remove when pylint is upgraded to 2.6
raise-missing-from
load-plugins=pylint_django,pylint.extensions.bad_builtin
django-settings-module=authentik.root.settings

View File

@ -27,7 +27,7 @@ class TestAdminAPI(TestCase):
self.assertEqual(response.status_code, 200)
body = loads(response.content)
self.assertTrue(
any([task["task_name"] == "clean_expired_models" for task in body])
any(task["task_name"] == "clean_expired_models" for task in body)
)
def test_tasks_retry(self):

View File

@ -2,13 +2,13 @@
from functools import partial
from typing import Callable
from django.contrib.auth.models import User
from django.db.models import Model
from django.db.models.signals import post_save, pre_delete
from django.http import HttpRequest, HttpResponse
from guardian.models import UserObjectPermission
from authentik.core.middleware import LOCAL
from authentik.core.models import User
from authentik.events.models import Event, EventAction, Notification
from authentik.events.signals import EventNewThread
from authentik.events.utils import model_to_dict

View File

@ -31,6 +31,7 @@ class PolicyBindingModelForeignKey(PrimaryKeyRelatedField):
def use_pk_only_optimization(self):
return False
# pylint: disable=inconsistent-return-statements
def to_internal_value(self, data):
if self.pk_field is not None:
data = self.pk_field.to_internal_value(data)

View File

@ -148,11 +148,11 @@ class PolicyEngine:
return PolicyResult(self.empty_result)
passing = False
if self.mode == PolicyEngineMode.MODE_AND:
passing = all([x.passing for x in all_results])
passing = all(x.passing for x in all_results)
if self.mode == PolicyEngineMode.MODE_OR:
passing = any([x.passing for x in all_results])
passing = any(x.passing for x in all_results)
result = PolicyResult(passing)
result.messages = tuple([y for x in all_results for y in x.messages])
result.messages = tuple(y for x in all_results for y in x.messages)
return result
@property

View File

@ -454,7 +454,7 @@ class AuthorizationFlowInitView(PolicyAccessView):
# OpenID clients can specify a `prompt` parameter, and if its set to consent we
# need to inject a consent stage
if PROMPT_CONSNET in self.params.prompt:
if not any([isinstance(x, ConsentStageView) for x in plan.stages]):
if not any(isinstance(x, ConsentStageView) for x in plan.stages):
# Plan does not have any consent stage, so we add an in-memory one
stage = ConsentStage(
name="OAuth2 Provider In-memory consent stage",

View File

@ -47,7 +47,7 @@ class UserWriteStageView(StageView):
# Also check that we're not currently impersonating, so we don't update the session
should_update_seesion = False
if (
any(["password" in x for x in data.keys()])
any("password" in x for x in data.keys())
and self.request.user.pk == user.pk
and SESSION_IMPERSONATE_USER not in self.request.session
):