Projet

Général

Profil

0015-misc-fix-function-redefined-pylint-error-56982.patch

Valentin Deniaud, 21 septembre 2021 17:09

Télécharger (9,28 ko)

Voir les différences:

Subject: [PATCH 15/59] misc: fix function-redefined pylint error (#56982)

 src/authentic2/api_views.py               | 8 ++++----
 src/authentic2/backends/ldap_backend.py   | 1 -
 src/authentic2/backends/models_backend.py | 4 ++--
 src/authentic2/journal.py                 | 4 ++--
 src/authentic2/manager/apps.py            | 4 ++--
 src/authentic2/manager/journal_views.py   | 8 ++++----
 src/authentic2_auth_fc/authenticators.py  | 2 +-
 src/authentic2_auth_saml/backends.py      | 4 ++--
 src/authentic2_idp_cas/models.py          | 5 +++--
 tests/test_commands.py                    | 2 +-
 tests/test_concurrency.py                 | 2 +-
 11 files changed, 22 insertions(+), 22 deletions(-)
src/authentic2/api_views.py
33 33
from django.utils.translation import ugettext_lazy as _
34 34
from django.views.decorators.cache import cache_control
35 35
from django.views.decorators.vary import vary_on_headers
36
from django_filters.fields import IsoDateTimeField
37
from django_filters.filters import IsoDateTimeFilter
36
from django_filters.fields import IsoDateTimeField as BaseIsoDateTimeField
37
from django_filters.filters import IsoDateTimeFilter as BaseIsoDateTimeFilter
38 38
from django_filters.rest_framework import FilterSet
39 39
from django_filters.utils import handle_timezone
40 40
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
......
622 622

  
623 623

  
624 624
# override to handle ambiguous naive DateTime on DST change
625
class IsoDateTimeField(IsoDateTimeField):
625
class IsoDateTimeField(BaseIsoDateTimeField):
626 626
    def __init__(self, *args, **kwargs):
627 627
        self.bound = kwargs.pop('bound')
628 628
        assert self.bound in ['upper', 'lesser']
......
645 645
                return possible[1]
646 646

  
647 647

  
648
class IsoDateTimeFilter(IsoDateTimeFilter):
648
class IsoDateTimeFilter(BaseIsoDateTimeFilter):
649 649
    @property
650 650
    def field_class(self):
651 651
        if self.lookup_expr.startswith('gt'):
src/authentic2/backends/ldap_backend.py
27 27
    from ldap.ldapobject import ReconnectLDAPObject as NativeLDAPObject
28 28

  
29 29
    PYTHON_LDAP3 = [int(x) for x in ldap.__version__.split('.')] >= [3]
30
    LDAPObject = NativeLDAPObject
31 30
except ImportError:
32 31
    ldap = None
33 32
    PYTHON_LDAP3 = None
src/authentic2/backends/models_backend.py
18 18
import functools
19 19

  
20 20
from django.contrib.auth import get_user_model
21
from django.contrib.auth.backends import ModelBackend
21
from django.contrib.auth.backends import ModelBackend as BaseModelBackend
22 22
from django.db import models
23 23

  
24 24
from authentic2.backends import get_user_queryset
......
35 35
PROXY_USER_MODEL = None
36 36

  
37 37

  
38
class ModelBackend(ModelBackend):
38
class ModelBackend(BaseModelBackend):
39 39
    """
40 40
    Authenticates against settings.AUTH_USER_MODEL.
41 41
    """
src/authentic2/journal.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from authentic2.apps.journal.journal import Journal
17
from authentic2.apps.journal.journal import Journal as BaseJournal
18 18
from authentic2.utils.service import get_service_from_request
19 19

  
20 20

  
21
class Journal(Journal):
21
class Journal(BaseJournal):
22 22
    def __init__(self, **kwargs):
23 23
        self._service = kwargs.pop('service', None)
24 24
        super().__init__(**kwargs)
src/authentic2/manager/apps.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.apps import AppConfig
17
from django.apps import AppConfig as BaseAppConfig
18 18

  
19 19

  
20
class AppConfig(AppConfig):
20
class AppConfig(BaseAppConfig):
21 21
    name = 'authentic2.manager'
22 22
    verbose_name = 'Authentic2 Manager'
23 23

  
src/authentic2/manager/journal_views.py
27 27
from django.utils.translation import ugettext_lazy as _
28 28
from django.views.generic.list import ListView
29 29

  
30
from authentic2.apps.journal.forms import JournalForm
30
from authentic2.apps.journal.forms import JournalForm as BaseJournalForm
31 31
from authentic2.apps.journal.models import EventType, n_2_pairing
32
from authentic2.apps.journal.search_engine import JournalSearchEngine
32
from authentic2.apps.journal.search_engine import JournalSearchEngine as BaseJournalSearchEngine
33 33
from authentic2.apps.journal.views import JournalView
34 34
from authentic2.custom_user.models import DeletedUser
35 35

  
......
38 38
User = get_user_model()
39 39

  
40 40

  
41
class JournalSearchEngine(JournalSearchEngine):
41
class JournalSearchEngine(BaseJournalSearchEngine):
42 42
    def search_by_uuid(self, lexem):
43 43
        # by user uuid
44 44
        try:
......
123 123
)
124 124

  
125 125

  
126
class JournalForm(JournalForm):
126
class JournalForm(BaseJournalForm):
127 127
    search_engine_class = JournalSearchEngine
128 128

  
129 129
    event_type = forms.ChoiceField(label=_('Event type'), required=False, choices=EVENT_TYPE_CHOICES)
src/authentic2_auth_fc/authenticators.py
36 36
    def name(self):
37 37
        return gettext_noop('FranceConnect')
38 38

  
39
    def id(self):
39
    def id(self):  # pylint: disable=E0102
40 40
        return 'fc'
41 41

  
42 42
    def autorun(self, request, block_id):
src/authentic2_auth_saml/backends.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from mellon.backends import SAMLBackend
17
from mellon.backends import SAMLBackend as BaseSAMLBackend
18 18

  
19 19
from authentic2.middleware import StoreRequestMiddleware
20 20

  
21 21
from . import app_settings
22 22

  
23 23

  
24
class SAMLBackend(SAMLBackend):
24
class SAMLBackend(BaseSAMLBackend):
25 25
    def authenticate(self, request=None, **kwargs):
26 26
        if not app_settings.enable:
27 27
            return None
src/authentic2_idp_cas/models.py
20 20
from django.utils.timezone import now
21 21
from django.utils.translation import ugettext_lazy as _
22 22

  
23
from authentic2.models import LogoutUrlAbstract, Service
23
from authentic2.models import LogoutUrlAbstract
24
from authentic2.models import Service as BaseService
24 25
from authentic2.utils.misc import check_session_key
25 26

  
26 27
from . import constants, managers, utils
......
30 31
)
31 32

  
32 33

  
33
class Service(LogoutUrlAbstract, Service):
34
class Service(LogoutUrlAbstract, BaseService):
34 35
    urls = models.TextField(verbose_name=_('urls'))
35 36
    identifier_attribute = models.CharField(max_length=64, verbose_name=_('attribute name'), blank=False)
36 37
    proxy = models.ManyToManyField(
tests/test_commands.py
219 219
    call_command('load-ldif', ldif.strpath, result='result', extra_attribute={'ldap_attr': 'first_name'})
220 220

  
221 221
    # test ExtraAttributeAction
222
    class MockPArser:
222
    class MockPArser:  # pylint: disable=E0102
223 223
        def __init__(self, *args, **kwargs):
224 224
            self.users = []
225 225
            assert len(args) == 1
tests/test_concurrency.py
55 55
        map_threads(f, range(concurrency))
56 56
        assert AttributeValue.objects.filter(attribute=multiple_at).count() == 1
57 57

  
58
        def f(i):
58
        def f(i):  # pylint: disable=E0102
59 59
            simple_user.attributes.single = str(i)
60 60
            connection.close()
61 61

  
62
-