root: upgrade to pylint 2.7
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
e202fd988b
commit
3157bf63a6
|
@ -13,7 +13,7 @@ disable =
|
||||||
similarities,
|
similarities,
|
||||||
cyclic-import,
|
cyclic-import,
|
||||||
protected-access,
|
protected-access,
|
||||||
unsubscriptable-object # remove when pylint is upgraded to 2.6
|
raise-missing-from
|
||||||
|
|
||||||
load-plugins=pylint_django,pylint.extensions.bad_builtin
|
load-plugins=pylint_django,pylint.extensions.bad_builtin
|
||||||
django-settings-module=authentik.root.settings
|
django-settings-module=authentik.root.settings
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TestAdminAPI(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
body = loads(response.content)
|
body = loads(response.content)
|
||||||
self.assertTrue(
|
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):
|
def test_tasks_retry(self):
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from django.db.models import Model
|
from django.db.models import Model
|
||||||
from django.db.models.signals import post_save, pre_delete
|
from django.db.models.signals import post_save, pre_delete
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from guardian.models import UserObjectPermission
|
from guardian.models import UserObjectPermission
|
||||||
|
|
||||||
from authentik.core.middleware import LOCAL
|
from authentik.core.middleware import LOCAL
|
||||||
|
from authentik.core.models import User
|
||||||
from authentik.events.models import Event, EventAction, Notification
|
from authentik.events.models import Event, EventAction, Notification
|
||||||
from authentik.events.signals import EventNewThread
|
from authentik.events.signals import EventNewThread
|
||||||
from authentik.events.utils import model_to_dict
|
from authentik.events.utils import model_to_dict
|
||||||
|
|
|
@ -31,6 +31,7 @@ class PolicyBindingModelForeignKey(PrimaryKeyRelatedField):
|
||||||
def use_pk_only_optimization(self):
|
def use_pk_only_optimization(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# pylint: disable=inconsistent-return-statements
|
||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
if self.pk_field is not None:
|
if self.pk_field is not None:
|
||||||
data = self.pk_field.to_internal_value(data)
|
data = self.pk_field.to_internal_value(data)
|
||||||
|
|
|
@ -148,11 +148,11 @@ class PolicyEngine:
|
||||||
return PolicyResult(self.empty_result)
|
return PolicyResult(self.empty_result)
|
||||||
passing = False
|
passing = False
|
||||||
if self.mode == PolicyEngineMode.MODE_AND:
|
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:
|
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 = 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
|
return result
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -454,7 +454,7 @@ class AuthorizationFlowInitView(PolicyAccessView):
|
||||||
# OpenID clients can specify a `prompt` parameter, and if its set to consent we
|
# OpenID clients can specify a `prompt` parameter, and if its set to consent we
|
||||||
# need to inject a consent stage
|
# need to inject a consent stage
|
||||||
if PROMPT_CONSNET in self.params.prompt:
|
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
|
# Plan does not have any consent stage, so we add an in-memory one
|
||||||
stage = ConsentStage(
|
stage = ConsentStage(
|
||||||
name="OAuth2 Provider In-memory consent stage",
|
name="OAuth2 Provider In-memory consent stage",
|
||||||
|
|
|
@ -47,7 +47,7 @@ class UserWriteStageView(StageView):
|
||||||
# Also check that we're not currently impersonating, so we don't update the session
|
# Also check that we're not currently impersonating, so we don't update the session
|
||||||
should_update_seesion = False
|
should_update_seesion = False
|
||||||
if (
|
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 self.request.user.pk == user.pk
|
||||||
and SESSION_IMPERSONATE_USER not in self.request.session
|
and SESSION_IMPERSONATE_USER not in self.request.session
|
||||||
):
|
):
|
||||||
|
|
Reference in New Issue