From 5a175727f81a81f41ee4bc34b0bded8d68ff3f42 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 20 Sep 2021 12:26:29 +0200 Subject: [PATCH 08/59] misc: fix bad-classmethod-argument pylint error (#56982) --- src/authentic2/apps/journal/models.py | 6 +++--- src/authentic2/backends/ldap_backend.py | 2 +- src/authentic2/journal_event_types.py | 2 +- src/authentic2/manager/journal_event_types.py | 2 +- src/authentic2/manager/user_export.py | 2 +- src/authentic2/manager/user_import.py | 2 +- src/authentic2/manager/user_views.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/authentic2/apps/journal/models.py b/src/authentic2/apps/journal/models.py index df222435..5883eaba 100644 --- a/src/authentic2/apps/journal/models.py +++ b/src/authentic2/apps/journal/models.py @@ -107,14 +107,14 @@ class EventTypeDefinition(metaclass=EventTypeDefinitionMeta): return _registry.get(name) @classmethod - def search_by_name(self, name): + def search_by_name(cls, name): for evd_name, evd in _registry.items(): if name in evd_name: yield evd @classmethod - def get_message(self, event, context=None): - return self.label + def get_message(cls, event, context=None): + return cls.label @classmethod def get_statistics( diff --git a/src/authentic2/backends/ldap_backend.py b/src/authentic2/backends/ldap_backend.py index 975d8a19..a396f335 100644 --- a/src/authentic2/backends/ldap_backend.py +++ b/src/authentic2/backends/ldap_backend.py @@ -876,7 +876,7 @@ class LDAPBackend: return None @classmethod - def _parse_simple_config(self): + def _parse_simple_config(cls): if len(settings.LDAP_AUTH_SETTINGS) < 2: raise ImproperlyConfigured( 'In a minimal configuration, you must at least specify url and user DN' diff --git a/src/authentic2/journal_event_types.py b/src/authentic2/journal_event_types.py index 98550a9f..721c5b55 100644 --- a/src/authentic2/journal_event_types.py +++ b/src/authentic2/journal_event_types.py @@ -37,7 +37,7 @@ class EventTypeWithService(EventTypeDefinition): super().record(user=user, session=session, references=references, data=data) @classmethod - def get_service_name(self, event): + def get_service_name(cls, event): (service,) = event.get_typed_references(Service) if service is not None: return str(service) diff --git a/src/authentic2/manager/journal_event_types.py b/src/authentic2/manager/journal_event_types.py index 4ac8e8a7..08e16c8b 100644 --- a/src/authentic2/manager/journal_event_types.py +++ b/src/authentic2/manager/journal_event_types.py @@ -300,7 +300,7 @@ class ManagerUserSSOAuthorizationDeletion(EventTypeWithService): class RoleEventsMixin(EventTypeDefinition): @classmethod - def record(self, user, role, session=None, references=None, data=None, api=False): + def record(cls, user, role, session=None, references=None, data=None, api=False): references = references or [] references = [role] + references data = data or {} diff --git a/src/authentic2/manager/user_export.py b/src/authentic2/manager/user_export.py index 7043c1a3..eb52bae2 100644 --- a/src/authentic2/manager/user_export.py +++ b/src/authentic2/manager/user_export.py @@ -87,7 +87,7 @@ class UserExport: self.progress_path = os.path.join(self.path, 'progress') @classmethod - def base_path(self): + def base_path(cls): path = default_storage.path('user_exports') if not os.path.exists(path): os.makedirs(path) diff --git a/src/authentic2/manager/user_import.py b/src/authentic2/manager/user_import.py index 6edbc225..321a67cd 100644 --- a/src/authentic2/manager/user_import.py +++ b/src/authentic2/manager/user_import.py @@ -78,7 +78,7 @@ class UserImport: pickle.dump(self.meta, fd) @classmethod - def base_path(self): + def base_path(cls): path = default_storage.path('user_imports') if not os.path.exists(path): os.makedirs(path) diff --git a/src/authentic2/manager/user_views.py b/src/authentic2/manager/user_views.py index 5884e9c3..57ea081e 100644 --- a/src/authentic2/manager/user_views.py +++ b/src/authentic2/manager/user_views.py @@ -414,7 +414,7 @@ class UserDetailView(OtherActionsMixin, BaseDetailView): return form @classmethod - def has_perm_on_roles(self, user, instance): + def has_perm_on_roles(cls, user, instance): role_qs = get_role_model().objects.all() if app_settings.ROLE_MEMBERS_FROM_OU and instance.ou: role_qs = role_qs.filter(ou=instance.ou) -- 2.30.2