Projet

Général

Profil

0006-misc-remove-some-unused-imports-52457.patch

Valentin Deniaud, 30 mars 2021 11:39

Télécharger (22,5 ko)

Voir les différences:

Subject: [PATCH 6/6] misc: remove some unused imports (#52457)

 authentic2-ctl                          | 2 --
 doc/conf.py                             | 2 --
 merge-coverage.py                       | 1 -
 src/authentic2/a2_rbac/management.py    | 4 +---
 src/authentic2/api_views.py             | 2 +-
 src/authentic2/apps/journal/utils.py    | 2 +-
 src/authentic2/backends/ldap_backend.py | 1 -
 src/authentic2/compat/misc.py           | 1 -
 src/authentic2/cors.py                  | 2 --
 src/authentic2/custom_user/models.py    | 3 +--
 src/authentic2/forms/honeypot.py        | 3 ---
 src/authentic2/forms/passwords.py       | 8 +-------
 src/authentic2/forms/profile.py         | 1 -
 src/authentic2/manager/forms.py         | 2 --
 src/authentic2/manager/user_import.py   | 1 -
 src/authentic2/manager/user_views.py    | 2 +-
 src/authentic2/manager/widgets.py       | 3 +--
 src/authentic2/managers.py              | 1 -
 src/authentic2/saml/common.py           | 1 -
 src/authentic2/saml/models.py           | 1 -
 src/authentic2/saml/saml2utils.py       | 2 --
 src/authentic2/saml/x509utils.py        | 1 -
 src/authentic2/utils/__init__.py        | 8 +-------
 src/authentic2/utils/lookups.py         | 1 -
 src/authentic2/views.py                 | 1 -
 src/authentic2_auth_oidc/models.py      | 2 +-
 src/authentic2_idp_oidc/models.py       | 1 -
 src/django_rbac/test_settings.py        | 2 --
 src/django_rbac/utils.py                | 1 -
 tests/test_a2_rbac.py                   | 2 +-
 tests/test_api.py                       | 2 --
 tests/test_auth_saml.py                 | 2 --
 tests/test_crypto.py                    | 1 -
 tests/test_custom_user.py               | 1 -
 tests/test_idp_saml2.py                 | 4 ++--
 tests/test_migrations.py                | 2 --
 tests/test_user_model.py                | 1 -
 tests/test_utils_lazy.py                | 1 -
 38 files changed, 12 insertions(+), 66 deletions(-)
authentic2-ctl
2 2
import os
3 3
import sys
4 4

  
5
import authentic2.logger
6

  
7 5
if __name__ == "__main__":
8 6
    config_file = False
9 7

  
doc/conf.py
11 11
# All configuration values have a default; values that are commented out
12 12
# serve to show the default.
13 13

  
14
import os
15
import sys
16 14

  
17 15
# If extensions (or modules to document with autodoc) are in another directory,
18 16
# add these directories to sys.path here. If the directory is relative to the
merge-coverage.py
7 7
import sys
8 8
import xml.etree.ElementTree as ET
9 9
from optparse import OptionParser
10
from shutil import copyfile
11 10

  
12 11
### This file came from the https://github.com/flow123d/flow123d repo they were nice enough to spend time to write this.
13 12
### It is copied here for other people to use on its own.
src/authentic2/a2_rbac/management.py
20 20
from django.utils.translation import ugettext
21 21
from django.utils.translation import ugettext_lazy as _
22 22

  
23
from django_rbac.models import ADMIN_OP
24
from django_rbac.utils import get_ou_model, get_permission_model, get_role_model
23
from django_rbac.utils import get_ou_model, get_role_model
25 24

  
26 25
from ..utils import get_fk_model
27 26
from . import app_settings, utils
28
from .models import MANAGE_MEMBERS_OP
29 27

  
30 28

  
31 29
def update_ou_admin_roles(ou):
src/authentic2/api_views.py
61 61
from authentic2.compat.drf import action
62 62
from django_rbac.utils import get_ou_model, get_role_model
63 63

  
64
from . import api_mixins, app_settings, attribute_kinds, decorators, hooks, utils
64
from . import api_mixins, app_settings, decorators, hooks, utils
65 65
from .a2_rbac.utils import get_default_ou
66 66
from .custom_user.models import User
67 67
from .journal_event_types import UserLogin, UserRegistration
src/authentic2/apps/journal/utils.py
16 16

  
17 17
from datetime import date, timedelta
18 18

  
19
from django.db.models import DateField, Max, Min
19
from django.db.models import Max, Min
20 20

  
21 21

  
22 22
def _json_value(value):
src/authentic2/backends/ldap_backend.py
24 24
    from ldap.dn import escape_dn_chars
25 25
    from ldap.filter import filter_format
26 26
    from ldap.ldapobject import ReconnectLDAPObject as NativeLDAPObject
27
    from pyasn1.codec.der import decoder
28 27

  
29 28
    PYTHON_LDAP3 = [int(x) for x in ldap.__version__.split('.')] >= [3]
30 29
    LDAPObject = NativeLDAPObject
src/authentic2/compat/misc.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import inspect
18
from datetime import datetime
19 18

  
20 19
from django.conf import settings
21 20

  
src/authentic2/cors.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
import itertools
18 17

  
19
from django.apps import apps
20 18
from django.conf import settings
21 19
from django.utils.six.moves.urllib import parse as urlparse
22 20

  
src/authentic2/custom_user/models.py
20 20
import base64
21 21
import datetime
22 22
import os
23
import random
24 23

  
25 24
from django.core.exceptions import MultipleObjectsReturned, ValidationError
26 25
from django.core.mail import send_mail
......
38 37

  
39 38
from authentic2 import app_settings, utils
40 39
from authentic2.decorators import RequestCache, errorcollector
41
from authentic2.models import Attribute, AttributeValue, Service, UserExternalId
40
from authentic2.models import Attribute, AttributeValue, Service
42 41
from authentic2.validators import email_validator
43 42
from django_rbac.models import PermissionMixin
44 43
from django_rbac.utils import get_role_parenting_model
src/authentic2/forms/honeypot.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17

  
18
from django.core.exceptions import ValidationError
19 18
from django.forms import BooleanField, CheckboxInput, Form
20
from django.utils.html import mark_safe
21
from django.utils.translation import gettext as _
22 19

  
23 20

  
24 21
class HoneypotInput(CheckboxInput):
src/authentic2/forms/passwords.py
22 22
from django.core.exceptions import ValidationError
23 23
from django.db.models import Q
24 24
from django.forms import Form
25
from django.urls import reverse
26 25
from django.utils.translation import ugettext_lazy as _
27 26

  
28 27
from .. import app_settings, hooks, models, utils
29 28
from ..backends import get_user_queryset
30
from .fields import (
31
    CheckPasswordField,
32
    NewPasswordField,
33
    PasswordField,
34
    ValidatedEmailField,
35
)
29
from .fields import CheckPasswordField, NewPasswordField, PasswordField
36 30
from .utils import NextUrlFormMixin
37 31

  
38 32
logger = logging.getLogger(__name__)
src/authentic2/forms/profile.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 collections import OrderedDict
18 17

  
19 18
from django import forms
20 19
from django.forms.models import modelform_factory as dj_modelform_factory
src/authentic2/manager/forms.py
23 23
from django.contrib.auth import get_user_model
24 24
from django.contrib.contenttypes.models import ContentType
25 25
from django.core.exceptions import ValidationError
26
from django.db.models.query import Q
27 26
from django.utils import six
28 27
from django.utils.text import slugify
29 28
from django.utils.translation import pgettext, ugettext
30 29
from django.utils.translation import ugettext_lazy as _
31 30

  
32
from authentic2 import app_settings as a2_app_settings
33 31
from authentic2.a2_rbac.utils import get_default_ou
34 32
from authentic2.forms.fields import (
35 33
    CheckPasswordField,
src/authentic2/manager/user_import.py
31 31
from django.core.files.storage import default_storage
32 32
from django.db import connection
33 33
from django.utils import six
34
from django.utils.encoding import force_text
35 34
from django.utils.functional import cached_property
36 35
from django.utils.timezone import utc
37 36
from django.utils.translation import ugettext_lazy as _
src/authentic2/manager/user_views.py
26 26
from django.core.exceptions import PermissionDenied
27 27
from django.core.mail import EmailMultiAlternatives
28 28
from django.db import models, transaction
29
from django.http import FileResponse, Http404, HttpResponseRedirect
29
from django.http import FileResponse, Http404
30 30
from django.shortcuts import get_object_or_404
31 31
from django.template import loader
32 32
from django.urls import reverse, reverse_lazy
src/authentic2/manager/widgets.py
24 24
from django.utils.encoding import force_text
25 25
from django_select2.forms import ModelSelect2MultipleWidget, ModelSelect2Widget
26 26

  
27
from authentic2.models import Service
28 27
from authentic2_idp_oidc.models import OIDCAuthorization
29
from django_rbac.utils import get_ou_model, get_role_model
28
from django_rbac.utils import get_role_model
30 29

  
31 30
from . import utils
32 31

  
src/authentic2/managers.py
19 19

  
20 20
from django.conf import settings
21 21
from django.contrib.contenttypes.models import ContentType
22
from django.contrib.postgres.search import SearchVector
23 22
from django.db import models
24 23
from django.db.models.query import QuerySet
25 24
from django.utils.timezone import now
src/authentic2/saml/common.py
27 27
from django.urls import reverse
28 28
from django.utils import six
29 29
from django.utils.encoding import force_text
30
from django.utils.six.moves.urllib import parse as urlparse
31 30

  
32 31
from authentic2.compat_lasso import lasso
33 32
from authentic2.decorators import RequestCache
src/authentic2/saml/models.py
30 30
from django.utils.translation import ugettext_lazy as _
31 31

  
32 32
from authentic2.compat_lasso import lasso
33
from authentic2.utils import normalize_attribute_values
34 33

  
35 34
try:
36 35
    from django.contrib.contenttypes.fields import GenericForeignKey
src/authentic2/saml/saml2utils.py
16 16

  
17 17
from __future__ import print_function
18 18

  
19
import base64
20
import binascii
21 19
import collections
22 20
import datetime
23 21
import re
src/authentic2/saml/x509utils.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import base64
18
import binascii
19 18
import os
20 19
import subprocess
21 20
import tempfile
src/authentic2/utils/__init__.py
16 16

  
17 17
import copy
18 18
import ctypes
19
import datetime
20
import inspect
21 19
import logging
22 20
import random
23 21
import time
......
26 24
from importlib import import_module
27 25
from itertools import chain, count, islice
28 26

  
29
import django.apps
30 27
from django import forms
31 28
from django.conf import settings
32 29
from django.contrib.auth import REDIRECT_FIELD_NAME
......
34 31
from django.contrib.auth import get_user_model
35 32
from django.contrib.auth import login as auth_login
36 33
from django.core import signing
37
from django.core.cache import cache
38 34
from django.core.exceptions import ImproperlyConfigured
39 35
from django.core.mail import EmailMessage, send_mail
40 36
from django.forms.utils import ErrorList, to_current_timezone
......
49 45
)
50 46
from django.urls import reverse
51 47
from django.utils import html, six, timezone
52
from django.utils.encoding import force_bytes, iri_to_uri, uri_to_iri
48
from django.utils.encoding import iri_to_uri, uri_to_iri
53 49
from django.utils.formats import localize
54
from django.utils.http import urlsafe_base64_encode
55 50
from django.utils.six.moves.urllib import parse as urlparse
56
from django.utils.translation import ugettext as _
57 51
from django.utils.translation import ungettext
58 52

  
59 53
try:
src/authentic2/utils/lookups.py
1 1
from django.contrib.postgres.lookups import Unaccent as PGUnaccent
2
from django.db.models import Func
3 2
from django.db.models.functions import Concat
4 3
from django.db.models.functions import ConcatPair as DjConcatPair
5 4

  
src/authentic2/views.py
43 43
from django.template.loader import render_to_string
44 44
from django.urls import reverse
45 45
from django.utils import six, timezone
46
from django.utils.http import urlsafe_base64_decode
47 46
from django.utils.translation import ugettext as _
48 47
from django.views.decorators.cache import never_cache
49 48
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
src/authentic2_auth_oidc/models.py
22 22
from django.core.exceptions import ValidationError
23 23
from django.db import models
24 24
from django.utils.translation import ugettext_lazy as _
25
from jwcrypto.jwk import JWK, InvalidJWKValue, JWKSet
25
from jwcrypto.jwk import InvalidJWKValue, JWKSet
26 26

  
27 27
from django_rbac.utils import get_ou_model_name
28 28

  
src/authentic2_idp_oidc/models.py
23 23
from django.core.validators import URLValidator
24 24
from django.db import models
25 25
from django.utils import six
26
from django.utils.functional import cached_property
27 26
from django.utils.six.moves.urllib import parse as urlparse
28 27
from django.utils.timezone import now
29 28
from django.utils.translation import ugettext_lazy as _
src/django_rbac/test_settings.py
1
import os
2

  
3 1
from django.conf import global_settings
4 2

  
5 3
MIDDLEWA_CLASSES = global_settings.MIDDLEWARE
src/django_rbac/utils.py
2 2

  
3 3
from django.apps import apps
4 4
from django.conf import settings
5
from django.utils import six
6 5

  
7 6
from . import constants
8 7

  
tests/test_a2_rbac.py
22 22
from authentic2.a2_rbac.models import MANAGE_MEMBERS_OP
23 23
from authentic2.a2_rbac.models import OrganizationalUnit as OU
24 24
from authentic2.a2_rbac.models import Permission, Role, RoleAttribute
25
from authentic2.a2_rbac.utils import get_default_ou, get_view_user_perm
25
from authentic2.a2_rbac.utils import get_default_ou
26 26
from authentic2.custom_user.models import User
27 27
from authentic2.models import Service
28 28
from authentic2.utils import get_hex_uuid
tests/test_api.py
30 30
from django.core import mail
31 31
from django.urls import reverse
32 32
from django.utils.encoding import force_text
33
from django.utils.http import urlencode
34 33
from django.utils.text import slugify
35
from django.utils.timezone import now
36 34
from requests.models import Response
37 35
from rest_framework import VERSION as drf_version
38 36

  
tests/test_auth_saml.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
import datetime
18 17
import os
19 18
import re
20 19

  
21 20
import lasso
22 21
import pytest
23 22
from django.contrib.auth import get_user_model
24
from django.utils.timezone import now
25 23
from mellon.models import UserSAMLIdentifier
26 24

  
27 25
from authentic2.custom_user.models import DeletedUser
tests/test_crypto.py
16 16
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 17

  
18 18
import random
19
import time
20 19
import uuid
21 20

  
22 21
import pytest
tests/test_custom_user.py
17 17
from datetime import date
18 18

  
19 19
import pytest
20
from django.contrib.auth import get_user_model
21 20

  
22 21
from authentic2.custom_user.models import DeletedUser, User
23 22
from authentic2.models import Attribute
tests/test_idp_saml2.py
34 34
from django.utils.six.moves.urllib import parse as urlparse
35 35
from django.utils.translation import gettext as _
36 36

  
37
from authentic2.a2_rbac.models import OrganizationalUnit, Role, RoleAttribute
37
from authentic2.a2_rbac.models import OrganizationalUnit, Role
38 38
from authentic2.constants import NONCE_FIELD_NAME, SERVICE_FIELD_NAME
39 39
from authentic2.custom_user.models import User
40 40
from authentic2.idp.saml import saml2_endpoints
......
44 44
)
45 45
from authentic2.models import Attribute, Service
46 46
from authentic2.saml import models as saml_models
47
from authentic2.saml.models import LibertyProvider, SAMLAttribute
47
from authentic2.saml.models import SAMLAttribute
48 48
from authentic2.utils import make_url
49 49

  
50 50
from . import utils
tests/test_migrations.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
import mock
18 17
from django.contrib.auth.models import AbstractUser
19
from django.db.utils import ProgrammingError
20 18
from django.utils.timezone import now
21 19

  
22 20

  
tests/test_user_model.py
20 20
import pytest
21 21
from django.core import management
22 22
from django.core.exceptions import ValidationError
23
from django.utils.timezone import now
24 23

  
25 24
from authentic2.custom_user.models import DeletedUser, User
26 25
from authentic2.models import Attribute, AttributeValue, UserExternalId
tests/test_utils_lazy.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
import pytest
18 17

  
19 18
from authentic2.utils.lazy import lazy_join
20 19

  
21
-