Projet

Général

Profil

0049-misc-fix-unused-import-pylint-error-56982.patch

Valentin Deniaud, 21 septembre 2021 17:09

Télécharger (27,5 ko)

Voir les différences:

Subject: [PATCH 49/59] misc: fix unused-import pylint error (#56982)

 ...03_partial_unique_index_on_name_and_slug.py |  2 +-
 .../migrations/0004_auto_20150523_0028.py      |  2 +-
 .../migrations/0008_auto_20150810_1953.py      |  2 +-
 .../0009_partial_unique_index_on_permission.py |  2 +-
 .../migrations/0011_auto_20160209_1511.py      |  2 +-
 .../migrations/0013_auto_20170629_0007.py      |  2 +-
 .../migrations/0014_auto_20170711_1024.py      |  2 +-
 .../migrations/0016_auto_20171208_1429.py      |  2 +-
 .../0020_partial_unique_index_on_name.py       |  2 +-
 .../migrations/0001_initial.py                 |  1 -
 .../migrations/0004_auto_20150915_2041.py      |  2 +-
 src/authentic2/attribute_kinds.py              |  1 -
 src/authentic2/compat/drf.py                   |  2 +-
 src/authentic2/compat/misc.py                  | 18 ------------------
 src/authentic2/compat_lasso.py                 |  2 +-
 .../migrations/0003_auto_20150504_1410.py      |  2 +-
 .../migrations/0009_auto_20150810_1953.py      |  2 +-
 .../migrations/0015_auto_20170707_1653.py      |  2 +-
 src/authentic2/decorators.py                   |  5 ++---
 .../idp/migrations/0003_auto_20150915_2041.py  |  2 +-
 .../management/commands/sync-ldap-users.py     |  4 ++--
 src/authentic2/manager/journal_views.py        |  2 +-
 src/authentic2/manager/user_export.py          |  1 -
 src/authentic2/manager/user_views.py           |  7 ++-----
 .../migrations/0009_auto_20160211_2247.py      |  2 +-
 .../migrations/0011_auto_20160211_2253.py      |  2 +-
 .../migrations/0013_auto_20160211_2258.py      |  2 +-
 .../migrations/0020_delete_federatedid.py      |  2 +-
 src/authentic2/models.py                       |  2 +-
 src/authentic2/saml/migrations/0003_merge.py   |  2 +-
 .../migrations/0006_restore_foreign_keys.py    |  2 +-
 .../saml/migrations/0014_auto_20150617_1216.py |  2 +-
 .../saml/migrations/0016_auto_20150915_2041.py |  2 +-
 src/authentic2/serializers.py                  |  1 -
 src/authentic2/validators.py                   |  2 +-
 src/authentic2/wsgi.py                         |  2 +-
 src/authentic2_auth_fc/apps.py                 |  2 --
 src/authentic2_auth_fc/backends.py             |  1 -
 .../migrations/0001_initial.py                 |  1 -
 .../migrations/0008_auto_20201102_1142.py      |  1 -
 .../migrations/0004_create_services.py         |  2 +-
 .../migrations/0006_copy_proxy_m2m.py          |  2 +-
 .../migrations/0008_alter_foreign_keys.py      |  2 +-
 .../0010_copy_service_ptr_id_to_old_id.py      |  2 +-
 .../0012_copy_service_proxy_to_m2m.py          |  2 +-
 .../0013_delete_model_service_proxy2.py        |  2 +-
 src/django_rbac/migrations/0001_initial.py     |  1 -
 tests/test_auth_oidc.py                        |  1 -
 tests/test_commands.py                         |  2 +-
 tests/test_ldap.py                             |  2 --
 tests/test_login.py                            |  2 +-
 tests/utils.py                                 |  1 -
 52 files changed, 42 insertions(+), 78 deletions(-)
src/authentic2/a2_rbac/migrations/0003_partial_unique_index_on_name_and_slug.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3
from authentic2.migrations import CreatePartialIndexes
4 4

  
src/authentic2/a2_rbac/migrations/0004_auto_20150523_0028.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0008_auto_20150810_1953.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0009_partial_unique_index_on_permission.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3
from authentic2.migrations import CreatePartialIndexes
4 4

  
src/authentic2/a2_rbac/migrations/0011_auto_20160209_1511.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0013_auto_20170629_0007.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0014_auto_20170711_1024.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0016_auto_20171208_1429.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/a2_rbac/migrations/0020_partial_unique_index_on_name.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3
from authentic2.migrations import CreatePartialIndexes
4 4

  
src/authentic2/attribute_aggregator/migrations/0001_initial.py
1
from django.conf import settings
2 1
from django.db import migrations, models
3 2

  
4 3

  
src/authentic2/attribute_aggregator/migrations/0004_auto_20150915_2041.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/attribute_kinds.py
21 21
import os
22 22
import re
23 23
import string
24
import urllib
25 24
import uuid
26 25
from itertools import chain
27 26

  
src/authentic2/compat/drf.py
16 16

  
17 17

  
18 18
try:
19
    from rest_framework.decorators import action
19
    from rest_framework.decorators import action  # pylint: disable=unused-import
20 20
except ImportError:
21 21
    from rest_framework.decorators import detail_route, list_route
22 22

  
src/authentic2/compat/misc.py
16 16

  
17 17
import inspect
18 18

  
19
from django.conf import settings
20

  
21
try:
22
    from django.contrib.auth import get_user_model
23
except ImportError:
24
    from django.contrib.auth.models import User
25

  
26
    get_user_model = lambda: User
27

  
28
try:
29
    from django.db.transaction import atomic
30

  
31
    commit_on_success = atomic
32
except ImportError:
33
    from django.db.transaction import commit_on_success
34

  
35
user_model_label = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
36

  
37 19
if hasattr(inspect, 'signature'):
38 20

  
39 21
    def signature_parameters(func):
src/authentic2/compat_lasso.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
try:
18
    import lasso
18
    import lasso  # pylint: disable=unused-import
19 19
except ImportError:
20 20

  
21 21
    class MockLasso:
src/authentic2/custom_user/migrations/0003_auto_20150504_1410.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/custom_user/migrations/0009_auto_20150810_1953.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/custom_user/migrations/0015_auto_20170707_1653.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/decorators.py
22 22
from functools import wraps
23 23
from json import dumps as json_dumps
24 24

  
25
from django.core.cache import cache as django_cache
26 25
from django.core.exceptions import ValidationError
27 26
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
28 27
from django.views.debug import technical_404_response
......
30 29
from . import app_settings, middleware
31 30

  
32 31
# XXX: import to_list for retrocompaibility
33
from .utils.misc import to_iter, to_list  # noqa: F401
32
from .utils.misc import to_iter, to_list  # pylint: disable=unused-import
34 33

  
35 34

  
36 35
class CacheUnusable(RuntimeError):
......
65 64
def lasso_required():
66 65
    def test():
67 66
        try:
68
            import lasso  # noqa: F401
67
            import lasso  # pylint: disable=unused-import
69 68

  
70 69
            return True
71 70
        except ImportError:
src/authentic2/idp/migrations/0003_auto_20150915_2041.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/management/commands/sync-ldap-users.py
16 16

  
17 17

  
18 18
try:
19
    import ldap
20
    from ldap.filter import filter_format  # noqa: F401
19
    import ldap  # pylint: disable=unused-import
20
    from ldap.filter import filter_format  # pylint: disable=unused-import
21 21
except ImportError:
22 22
    ldap = None
23 23

  
src/authentic2/manager/journal_views.py
20 20
from django import forms
21 21
from django.contrib.auth import get_user_model
22 22
from django.contrib.contenttypes.models import ContentType
23
from django.core.exceptions import PermissionDenied, ValidationError
23
from django.core.exceptions import ValidationError
24 24
from django.core.validators import EmailValidator
25 25
from django.db.models import Q
26 26
from django.urls import reverse
src/authentic2/manager/user_export.py
17 17
import collections
18 18
import datetime
19 19
import os
20
import pickle
21 20
import uuid
22 21

  
23 22
import tablib
src/authentic2/manager/user_views.py
17 17
import base64
18 18
import collections
19 19
import operator
20
import pickle
21
import sys
22 20

  
23 21
from django.contrib import messages
24 22
from django.contrib.auth import REDIRECT_FIELD_NAME, get_user_model
25 23
from django.core.exceptions import PermissionDenied
26 24
from django.core.mail import EmailMultiAlternatives
27
from django.db import connection, models, transaction
25
from django.db import models, transaction
28 26
from django.http import FileResponse, Http404, HttpResponse
29 27
from django.shortcuts import get_object_or_404
30 28
from django.template import loader
......
62 60
    UserSearchForm,
63 61
)
64 62
from .journal_views import BaseJournalView
65
from .resources import UserResource
66 63
from .tables import OuUserRolesTable, UserAuthorizationsTable, UserRolesTable, UserTable
67
from .user_export import UserExport, get_user_dataset
64
from .user_export import UserExport
68 65
from .utils import get_ou_count, has_show_username
69 66
from .views import (
70 67
    Action,
src/authentic2/migrations/0009_auto_20160211_2247.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def deduplicate_attribute_values(apps, schema_editor):
src/authentic2/migrations/0011_auto_20160211_2253.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def fill_attribute_value_multiple(apps, schema_editor):
src/authentic2/migrations/0013_auto_20160211_2258.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3
from authentic2.migrations import CreatePartialIndexes
4 4

  
src/authentic2/migrations/0020_delete_federatedid.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/models.py
40 40

  
41 41
# install our natural_key implementation
42 42
from . import managers
43
from . import natural_key as unused_natural_key  # noqa: F401
43
from . import natural_key as unused_natural_key  # pylint: disable=unused-import
44 44
from .utils.misc import ServiceAccessDenied
45 45

  
46 46

  
src/authentic2/saml/migrations/0003_merge.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/saml/migrations/0006_restore_foreign_keys.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def create_services(apps, schema_editor):
src/authentic2/saml/migrations/0014_auto_20150617_1216.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/saml/migrations/0016_auto_20150915_2041.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/authentic2/serializers.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import json
18
import sys
19 18

  
20 19
from django.contrib.contenttypes.fields import GenericForeignKey
21 20
from django.contrib.contenttypes.models import ContentType
src/authentic2/validators.py
29 29
from . import app_settings
30 30

  
31 31
# keep those symbols here for retrocompatibility
32
from .passwords import password_help_text, validate_password  # noqa: F401
32
from .passwords import password_help_text, validate_password  # pylint: disable=unused-import
33 33

  
34 34

  
35 35
# copied from http://www.djangotips.com/real-email-validation
src/authentic2/wsgi.py
34 34
from django.core.wsgi import get_wsgi_application
35 35

  
36 36
# XXX: monkeypatch logging
37
from . import logger  # noqa: F401
37
from . import logger  # pylint: disable=unused-import
38 38

  
39 39
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentic2.settings")
40 40

  
src/authentic2_auth_fc/apps.py
17 17
import django.apps
18 18
from django import template
19 19

  
20
from . import app_settings
21

  
22 20

  
23 21
class Plugin:
24 22
    def redirect_logout_list(self, request, **kwargs):
src/authentic2_auth_fc/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
import json
18 17
import logging
19 18

  
20 19
from django.contrib.auth import get_user_model
src/authentic2_auth_oidc/migrations/0001_initial.py
4 4
from django.conf import settings
5 5
from django.db import migrations, models
6 6

  
7
import authentic2.a2_rbac.utils
8 7
import authentic2_auth_oidc.models
9 8

  
10 9

  
src/authentic2_auth_oidc/migrations/0008_auto_20201102_1142.py
1 1
# Generated by Django 2.2.17 on 2020-11-02 10:42
2 2

  
3
import django.db.models.deletion
4 3
from django.conf import settings
5 4
from django.db import migrations, models
6 5

  
src/authentic2_idp_cas/migrations/0004_create_services.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def create_services(apps, schema_editor):
src/authentic2_idp_cas/migrations/0006_copy_proxy_m2m.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def copy_proxy_m2m_to_service_proxy(apps, schema_editor):
src/authentic2_idp_cas/migrations/0008_alter_foreign_keys.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def alter_foreign_keys(apps, schema_editor):
src/authentic2_idp_cas/migrations/0010_copy_service_ptr_id_to_old_id.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def noop(apps, schema_editor):
src/authentic2_idp_cas/migrations/0012_copy_service_proxy_to_m2m.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
def copy_proxy_m2m_to_service_proxy(apps, schema_editor):
src/authentic2_idp_cas/migrations/0013_delete_model_service_proxy2.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
src/django_rbac/migrations/0001_initial.py
1
from django.conf import settings
2 1
from django.db import migrations, models
3 2

  
4 3

  
tests/test_auth_oidc.py
39 39
from authentic2.custom_user.models import DeletedUser
40 40
from authentic2.models import Attribute, AttributeValue
41 41
from authentic2.utils.misc import last_authentication_event
42
from authentic2_auth_oidc.backends import OIDCBackend
43 42
from authentic2_auth_oidc.models import OIDCAccount, OIDCClaimMapping, OIDCProvider
44 43
from authentic2_auth_oidc.utils import (
45 44
    IDToken,
tests/test_commands.py
34 34
from django_rbac.models import ADMIN_OP, Operation
35 35
from django_rbac.utils import get_operation, get_ou_model, get_permission_model, get_role_model
36 36

  
37
from .utils import call_command, login, run_on_commit_hooks
37
from .utils import call_command, login
38 38

  
39 39
User = get_user_model()
40 40

  
tests/test_ldap.py
733 733

  
734 734

  
735 735
def test_get_users(slapd, settings, db, monkeypatch, caplog):
736
    from types import MethodType
737

  
738 736
    import django.db.models.base
739 737
    from django.contrib.auth.models import Group
740 738

  
tests/test_login.py
22 22
from authentic2 import models
23 23
from authentic2.utils.misc import get_token_login_url
24 24

  
25
from .utils import assert_event, check_log, login
25
from .utils import assert_event, login
26 26

  
27 27
User = get_user_model()
28 28

  
tests/utils.py
21 21
import urllib.parse
22 22
from contextlib import closing, contextmanager
23 23

  
24
import httmock
25 24
from django.core.management import call_command as django_call_command
26 25
from django.shortcuts import resolve_url
27 26
from django.test import TestCase
28
-