Projet

Général

Profil

0012-misc-fix-ungrouped-imports-pylint-error-56982.patch

Valentin Deniaud, 21 septembre 2021 17:09

Télécharger (4,82 ko)

Voir les différences:

Subject: [PATCH 12/59] misc: fix ungrouped-imports pylint error (#56982)

 src/authentic2/a2_rbac/models.py                      | 11 ++---------
 .../management/commands/check-and-repair.py           |  4 ++--
 src/authentic2/models.py                              |  6 +-----
 src/authentic2/saml/models.py                         | 11 +----------
 4 files changed, 6 insertions(+), 26 deletions(-)
src/authentic2/a2_rbac/models.py
16 16

  
17 17
from collections import namedtuple
18 18

  
19
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
19 20
from django.contrib.contenttypes.models import ContentType
20 21
from django.core.exceptions import ValidationError
21 22
from django.core.validators import MinValueValidator
......
24 25
from django.utils.translation import pgettext_lazy
25 26
from django.utils.translation import ugettext_lazy as _
26 27

  
27
from authentic2.decorators import errorcollector
28
from authentic2.decorators import GlobalCache, errorcollector
28 29
from django_rbac import utils as rbac_utils
29 30
from django_rbac.models import (
30 31
    VIEW_OP,
......
35 36
    RoleParentingAbstractBase,
36 37
)
37 38

  
38
try:
39
    from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
40
except ImportError:
41
    # Django < 1.8
42
    from django.contrib.contenttypes.generic import GenericForeignKey, GenericRelation
43

  
44
from authentic2.decorators import GlobalCache
45

  
46 39
from . import app_settings, fields, managers
47 40

  
48 41

  
src/authentic2/management/commands/check-and-repair.py
31 31
from authentic2 import app_settings
32 32
from authentic2.a2_rbac.models import OrganizationalUnit as OU
33 33
from authentic2.a2_rbac.models import Permission, Role
34
from authentic2.custom_user.models import User
34 35
from django_rbac.models import ADMIN_OP
35 36
from django_rbac.utils import get_operation
36 37

  
37 38
try:
38
    from authentic2.a2_rbac.models import MANAGE_MEMBERS_OP
39
    from authentic2.a2_rbac.models import MANAGE_MEMBERS_OP  # pylint: disable=C0412
39 40
except ImportError:
40 41
    MANAGE_MEMBERS_OP = None
41
from authentic2.custom_user.models import User
42 42

  
43 43
MULTITENANT = 'hobo.multitenant' in settings.INSTALLED_APPS
44 44
if MULTITENANT:
src/authentic2/models.py
21 21

  
22 22
import django
23 23
from django.conf import settings
24
from django.contrib.contenttypes.fields import GenericForeignKey
24 25
from django.contrib.contenttypes.models import ContentType
25 26
from django.contrib.postgres.fields import jsonb
26 27
from django.contrib.postgres.indexes import GinIndex
......
37 38
from authentic2.crypto import base64url_decode, base64url_encode
38 39
from django_rbac.utils import get_role_model_name
39 40

  
40
try:
41
    from django.contrib.contenttypes.fields import GenericForeignKey
42
except ImportError:
43
    from django.contrib.contenttypes.generic import GenericForeignKey
44

  
45 41
# install our natural_key implementation
46 42
from . import managers
47 43
from . import natural_key as unused_natural_key  # noqa: F401
src/authentic2/saml/models.py
20 20

  
21 21
import requests
22 22
from django.conf import settings
23
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
23 24
from django.contrib.contenttypes.models import ContentType
24 25
from django.core.exceptions import ObjectDoesNotExist, ValidationError
25 26
from django.db import models
......
29 30
from django.utils.translation import ugettext_lazy as _
30 31

  
31 32
from authentic2.compat_lasso import lasso
32

  
33
try:
34
    from django.contrib.contenttypes.fields import GenericForeignKey
35
except ImportError:
36
    from django.contrib.contenttypes.generic import GenericForeignKey
37
try:
38
    from django.contrib.contenttypes.fields import GenericRelation
39
except ImportError:
40
    from django.contrib.contenttypes.generic import GenericRelation
41

  
42 33
from authentic2.saml.fields import MultiSelectField, PickledObjectField
43 34

  
44 35
from .. import managers as a2_managers
45
-