Projet

Général

Profil

0003-misc-fix-unused-import-pylint-error-56288.patch

Lauréline Guérin, 30 août 2021 17:53

Télécharger (28,5 ko)

Voir les différences:

Subject: [PATCH 03/31] misc: fix unused-import pylint error (#56288)

 combo/apps/assets/templatetags/assets.py         |  1 -
 combo/apps/assets/views.py                       |  1 -
 combo/apps/dashboard/views.py                    |  2 --
 combo/apps/dataviz/forms.py                      |  1 -
 combo/apps/dataviz/models.py                     |  1 -
 combo/apps/family/migrations/0001_initial.py     |  1 -
 combo/apps/family/utils.py                       |  1 -
 combo/apps/gallery/forms.py                      |  1 -
 combo/apps/gallery/models.py                     |  2 --
 combo/apps/gallery/views.py                      | 13 ++-----------
 combo/apps/kb/models.py                          |  2 --
 combo/apps/lingo/manager_views.py                |  1 -
 .../lingo/migrations/0017_auto_20160327_0831.py  |  2 +-
 .../lingo/migrations/0043_auto_20210628_1849.py  |  2 +-
 combo/apps/lingo/models.py                       |  2 +-
 combo/apps/lingo/views.py                        |  2 +-
 combo/apps/maps/models.py                        |  1 -
 combo/apps/pwa/__init__.py                       |  2 +-
 combo/apps/pwa/models.py                         |  2 --
 combo/apps/pwa/views.py                          |  2 +-
 .../0004_remove_searchcell__search_service.py    |  2 +-
 .../migrations/0008_wcsformcell_cached_json.py   |  2 +-
 .../0009_remove_wcscategorycell_link_page.py     |  2 +-
 combo/data/management/commands/cron.py           |  1 -
 combo/data/migrations/0005_auto_20150226_0903.py |  2 +-
 .../data/migrations/0019_create_parent_cells.py  |  2 +-
 combo/data/migrations/0031_remove_blurps.py      |  2 +-
 combo/data/migrations/0040_auto_20200119_1017.py |  2 +-
 combo/data/models.py                             |  4 ++--
 combo/data/utils.py                              |  1 -
 combo/manager/apps.py                            |  2 +-
 combo/manager/urls.py                            |  2 +-
 combo/public/templatetags/combo.py               |  3 +--
 combo/public/views.py                            |  2 --
 combo/utils/crypto.py                            |  1 -
 combo/utils/signature.py                         |  1 -
 tests/conftest.py                                | 10 ++++++++++
 tests/test_calendar.py                           |  2 +-
 tests/test_dashboard.py                          |  4 +---
 tests/test_dataviz.py                            |  9 +++------
 tests/test_fargo.py                              |  1 -
 tests/test_gallery_cell.py                       |  2 +-
 tests/test_import_export.py                      |  1 -
 tests/test_lingo_payment.py                      |  1 -
 tests/test_notification.py                       |  4 ++--
 tests/test_public.py                             | 16 ++--------------
 tests/test_publik.py                             | 12 +-----------
 tests/test_pwa.py                                |  2 --
 tests/test_utils.py                              |  1 -
 49 files changed, 41 insertions(+), 97 deletions(-)
combo/apps/assets/templatetags/assets.py
18 18

  
19 19
from django import template
20 20
from django.db.models.fields.files import ImageFieldFile
21
from django.utils import six
22 21
from sorl.thumbnail.shortcuts import get_thumbnail
23 22

  
24 23
from ..models import Asset
combo/apps/assets/views.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 os
19 18
import tarfile
20 19

  
combo/apps/dashboard/views.py
17 17
import json
18 18

  
19 19
from django.conf import settings
20
from django.contrib.contenttypes.models import ContentType
21 20
from django.core.exceptions import PermissionDenied
22 21
from django.db.models import Max, Min
23 22
from django.http import (
......
32 31
from django.views.decorators.csrf import csrf_exempt
33 32
from django.views.generic import View
34 33

  
35
from combo.data.library import get_cell_class
36 34
from combo.data.models import CellBase, ConfigJsonCell
37 35
from combo.public.views import render_cell
38 36

  
combo/apps/dataviz/forms.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 sys
18 17
from collections import OrderedDict
19 18

  
20 19
from django import forms
combo/apps/dataviz/models.py
16 16

  
17 17
import copy
18 18
import os
19
import sys
20 19
from collections import OrderedDict
21 20
from datetime import date, datetime, timedelta
22 21

  
combo/apps/family/migrations/0001_initial.py
1
import ckeditor.fields
2 1
from django.db import migrations, models
3 2

  
4 3

  
combo/apps/family/utils.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from django.conf import settings
18
from django.utils.http import urlencode
19 18

  
20 19
from combo.utils import requests
21 20

  
combo/apps/gallery/forms.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from django import forms
18
from django.utils.translation import ugettext_lazy as _
19 18

  
20 19
from .models import Image
21 20

  
combo/apps/gallery/models.py
16 16

  
17 17
import json
18 18

  
19
from django import template
20 19
from django.core import serializers
21 20
from django.db import models
22
from django.forms import models as model_forms
23 21
from django.utils.translation import ugettext_lazy as _
24 22

  
25 23
from combo.data.library import register_cell_class
combo/apps/gallery/views.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from django.shortcuts import redirect
18
from django.urls import reverse, reverse_lazy
19
from django.views.generic import (
20
    CreateView,
21
    DeleteView,
22
    DetailView,
23
    FormView,
24
    ListView,
25
    RedirectView,
26
    TemplateView,
27
    UpdateView,
28
)
18
from django.urls import reverse
19
from django.views.generic import CreateView, UpdateView
29 20

  
30 21
from .forms import ImageAddForm, ImageEditForm
31 22
from .models import GalleryCell, Image
combo/apps/kb/models.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 itertools
19 18

  
20 19
from django.db import models
21
from django.utils import timezone
22 20
from django.utils.translation import ugettext_lazy as _
23 21

  
24 22
from combo.data.library import register_cell_class
combo/apps/lingo/manager_views.py
26 26
from django.shortcuts import get_object_or_404
27 27
from django.template.response import TemplateResponse
28 28
from django.urls import reverse, reverse_lazy
29
from django.utils import six
30 29
from django.utils.timezone import make_aware, now
31 30
from django.utils.translation import ugettext_lazy as _
32 31
from django.views.generic import CreateView, DeleteView, ListView, UpdateView, View
combo/apps/lingo/migrations/0017_auto_20160327_0831.py
1 1
import ckeditor.fields
2
from django.db import migrations, models
2
from django.db import migrations
3 3

  
4 4

  
5 5
class Migration(migrations.Migration):
combo/apps/lingo/migrations/0043_auto_20210628_1849.py
1 1
# Generated by Django 2.2.19 on 2021-06-28 16:49
2 2

  
3
from django.db import migrations, models
3
from django.db import migrations
4 4

  
5 5

  
6 6
class Migration(migrations.Migration):
combo/apps/lingo/models.py
36 36
from django.forms import models as model_forms
37 37
from django.template.loader import render_to_string
38 38
from django.urls import reverse
39
from django.utils import dateparse, six, timezone
39
from django.utils import dateparse, timezone
40 40
from django.utils.encoding import force_bytes, python_2_unicode_compatible
41 41
from django.utils.formats import localize
42 42
from django.utils.six.moves.urllib import parse as urlparse
combo/apps/lingo/views.py
39 39
from django.shortcuts import get_object_or_404
40 40
from django.template.response import TemplateResponse
41 41
from django.urls import reverse
42
from django.utils import dateparse, six, timezone
42
from django.utils import dateparse
43 43
from django.utils.encoding import force_text, smart_text
44 44
from django.utils.http import urlencode
45 45
from django.utils.translation import ugettext_lazy as _
combo/apps/maps/models.py
22 22
from django.core import serializers, validators
23 23
from django.db import models
24 24
from django.urls import reverse
25
from django.utils import six
26 25
from django.utils.encoding import python_2_unicode_compatible
27 26
from django.utils.html import escape
28 27
from django.utils.text import slugify
combo/apps/pwa/__init__.py
23 23
    name = 'combo.apps.pwa'
24 24

  
25 25
    def ready(self):
26
        from . import signals
26
        from . import signals  # noqa pylint: disable=unused-import
27 27

  
28 28
    def get_before_urls(self):
29 29
        from . import urls
combo/apps/pwa/models.py
25 25
from django.core.files.base import ContentFile
26 26
from django.core.files.storage import default_storage
27 27
from django.db import models
28
from django.utils import six
29 28
from django.utils.encoding import force_bytes, force_text
30
from django.utils.six import BytesIO
31 29
from django.utils.translation import ugettext_lazy as _
32 30
from py_vapid import Vapid
33 31

  
combo/apps/pwa/views.py
21 21
from django.conf import settings
22 22
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, JsonResponse
23 23
from django.template.loader import TemplateDoesNotExist, get_template
24
from django.utils.encoding import force_bytes, force_text
24
from django.utils.encoding import force_text
25 25
from django.views.decorators.csrf import csrf_exempt
26 26
from django.views.generic import TemplateView
27 27
from py_vapid import Vapid
combo/apps/search/migrations/0004_remove_searchcell__search_service.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
combo/apps/wcs/migrations/0008_wcsformcell_cached_json.py
1 1
from django.contrib.postgres.fields import JSONField
2
from django.db import migrations, models
2
from django.db import migrations
3 3

  
4 4

  
5 5
class Migration(migrations.Migration):
combo/apps/wcs/migrations/0009_remove_wcscategorycell_link_page.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
combo/data/management/commands/cron.py
19 19
import traceback
20 20

  
21 21
from django.apps import apps
22
from django.conf import settings
23 22
from django.core.management.base import BaseCommand, CommandError
24 23

  
25 24

  
combo/data/migrations/0005_auto_20150226_0903.py
1 1
import ckeditor.fields
2
from django.db import migrations, models
2
from django.db import migrations
3 3

  
4 4

  
5 5
class Migration(migrations.Migration):
combo/data/migrations/0019_create_parent_cells.py
1 1
from django.conf import settings
2
from django.db import migrations, models
2
from django.db import migrations
3 3

  
4 4

  
5 5
def create_parent_content_cells(apps, schema_editor):
combo/data/migrations/0031_remove_blurps.py
1
from django.db import migrations, models
1
from django.db import migrations
2 2

  
3 3

  
4 4
class Migration(migrations.Migration):
combo/data/migrations/0040_auto_20200119_1017.py
1 1
# Generated by Django 1.11.17 on 2020-01-19 09:17
2 2

  
3
from django.db import migrations, models
3
from django.db import migrations
4 4

  
5 5

  
6 6
class Migration(migrations.Migration):
combo/data/models.py
45 45
from django.dispatch import receiver
46 46
from django.forms import models as model_forms
47 47
from django.forms.widgets import MediaDefiningClass
48
from django.template import Context, TemplateDoesNotExist, TemplateSyntaxError, engines
48
from django.template import TemplateDoesNotExist, TemplateSyntaxError, engines
49 49
from django.test.client import RequestFactory
50
from django.utils import six, timezone
50
from django.utils import timezone
51 51
from django.utils.encoding import force_text, python_2_unicode_compatible, smart_bytes
52 52
from django.utils.html import strip_tags
53 53
from django.utils.safestring import mark_safe
combo/data/utils.py
21 21
from django.contrib.auth.models import Group
22 22
from django.core.serializers.base import DeserializationError
23 23
from django.db import transaction
24
from django.utils import six
25 24
from django.utils.encoding import python_2_unicode_compatible
26 25
from django.utils.translation import ugettext_lazy as _
27 26

  
combo/manager/apps.py
21 21
    name = 'combo.manager'
22 22

  
23 23
    def ready(self):
24
        import combo.monkeypatch
24
        import combo.monkeypatch  # noqa pylint: disable=unused-import
combo/manager/urls.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
import ckeditor.views as ckeditor_views
18
from django.conf.urls import include, url
18
from django.conf.urls import url
19 19
from django.contrib.admin.views.decorators import staff_member_required
20 20
from django.views.decorators.cache import never_cache
21 21

  
combo/public/templatetags/combo.py
19 19
import datetime
20 20
import json
21 21
import math
22
import time
23 22
from decimal import Decimal
24 23
from decimal import DivisionByZero as DecimalDivisionByZero
25 24
from decimal import InvalidOperation as DecimalInvalidOperation
......
41 40

  
42 41
from django.template import Template, TemplateSyntaxError, defaultfilters
43 42
from django.template.defaultfilters import stringfilter
44
from django.utils import dateparse, six
43
from django.utils import dateparse
45 44
from django.utils.encoding import force_text
46 45
from django.utils.html import format_html
47 46
from django.utils.safestring import mark_safe
combo/public/views.py
18 18
import re
19 19
from itertools import chain
20 20

  
21
import django
22 21
from django.conf import settings
23 22
from django.contrib import messages
24 23
from django.contrib.auth import logout as auth_logout
......
54 53

  
55 54
from combo import utils
56 55
from combo.apps.assets.models import Asset
57
from combo.apps.search.models import SearchCell
58 56
from combo.data.models import (
59 57
    CellBase,
60 58
    Page,
combo/utils/crypto.py
19 19
from Cryptodome import Random
20 20
from Cryptodome.Cipher import AES
21 21
from Cryptodome.Protocol.KDF import PBKDF2
22
from django.utils import six
23 22
from django.utils.encoding import force_text
24 23

  
25 24

  
combo/utils/signature.py
21 21
import random
22 22

  
23 23
from django.conf import settings
24
from django.utils import six
25 24
from django.utils.encoding import smart_bytes
26 25
from django.utils.http import quote, urlencode
27 26
from django.utils.six.moves.urllib import parse as urlparse
tests/conftest.py
50 50
    return user
51 51

  
52 52

  
53
@pytest.fixture
54
def normal_user():
55
    try:
56
        user = User.objects.get(username='normal-user')
57
        user.groups = []
58
    except User.DoesNotExist:
59
        user = User.objects.create_user(username='normal-user', email='', password='normal-user')
60
    return user
61

  
62

  
53 63
@pytest.fixture
54 64
def nocache(settings):
55 65
    settings.CACHES = {
tests/test_calendar.py
9 9
from django.utils.six.moves.urllib import parse as urlparse
10 10

  
11 11
from combo.apps.calendar.models import BookingCalendar
12
from combo.apps.calendar.utils import get_calendar, get_chrono_events, get_chrono_service
12
from combo.apps.calendar.utils import get_calendar, get_chrono_service
13 13
from combo.data.models import Page
14 14

  
15 15
pytestmark = pytest.mark.django_db
tests/test_dashboard.py
7 7
from django.apps import apps
8 8
from django.conf import settings
9 9
from django.contrib.auth.models import User
10
from django.core.management import call_command
11 10
from django.test import override_settings
12 11
from django.urls import reverse
13 12
from django.utils.six.moves.urllib import parse as urlparse
14 13

  
15 14
from combo.apps.dashboard.models import DashboardCell, Tile
16
from combo.data.models import CellBase, ConfigJsonCell, Page, TextCell
17
from combo.wsgi import application
15
from combo.data.models import Page, TextCell
18 16

  
19 17
pytestmark = pytest.mark.django_db
20 18

  
tests/test_dataviz.py
1 1
import json
2 2
import urllib.parse
3
from datetime import date, timedelta
3
from datetime import date
4 4
from unittest import mock
5 5

  
6 6
import pytest
7 7
from django.apps import apps
8
from django.contrib.auth.models import Group, User
9
from django.db import connection
10
from django.db.migrations.executor import MigrationExecutor
8
from django.contrib.auth.models import Group
11 9
from django.test import override_settings
12
from django.utils import timezone
13 10
from httmock import HTTMock, remember_called, urlmatch, with_httmock
14 11
from requests.exceptions import HTTPError
15 12

  
16 13
from combo.apps.dataviz.models import ChartNgCell, Gauge, Statistic, UnsupportedDataSet
17 14
from combo.data.models import Page, ValidityInfo
18 15

  
19
from .test_public import login, normal_user
16
from .test_public import login
20 17

  
21 18
pytestmark = pytest.mark.django_db
22 19

  
tests/test_fargo.py
1
import json
2 1
import re
3 2
from unittest import mock
4 3

  
tests/test_gallery_cell.py
3 3
import pytest
4 4
from django.urls import reverse
5 5

  
6
from combo.apps.gallery.models import GalleryCell, Image
6
from combo.apps.gallery.models import GalleryCell
7 7
from combo.data.models import Page
8 8

  
9 9
from .test_manager import login
tests/test_import_export.py
1 1
import base64
2
import datetime
3 2
import json
4 3
import os
5 4
import shutil
tests/test_lingo_payment.py
12 12
from django.conf import settings
13 13
from django.contrib.auth.models import User
14 14
from django.core.management import CommandError, call_command
15
from django.db import transaction
16 15
from django.http.request import QueryDict
17 16
from django.test import override_settings
18 17
from django.urls import reverse
tests/test_notification.py
1 1
import json
2
from datetime import timedelta as timedelta
2
from datetime import timedelta
3 3
from decimal import Decimal
4 4
from unittest import mock
5 5

  
......
9 9
from django.test.client import RequestFactory
10 10
from django.urls import reverse
11 11
from django.utils.encoding import force_text
12
from django.utils.timezone import now, timedelta
12
from django.utils.timezone import now
13 13

  
14 14
from combo.apps.lingo.models import ActiveItems, PaymentBackend, Regie
15 15
from combo.apps.notifications.models import Notification, NotificationsCell
tests/test_public.py
6 6

  
7 7
import pytest
8 8
from django.conf import settings
9
from django.contrib.auth.models import Group, User
9
from django.contrib.auth.models import Group
10 10
from django.core.files import File
11 11
from django.db import connection
12 12
from django.test import override_settings
......
17 17
from django.utils.six.moves.urllib import parse as urlparse
18 18

  
19 19
try:
20
    import mellon
20
    import mellon  # pylint: disable=unused-import
21 21
except ImportError:
22 22
    mellon = None
23 23
import requests
......
25 25
from combo.apps.assets.models import Asset
26 26
from combo.apps.family.models import FamilyInfosCell
27 27
from combo.data.models import (
28
    CellBase,
29 28
    ConfigJsonCell,
30 29
    FeedCell,
31 30
    JsonCell,
......
36 35
    Redirect,
37 36
    TextCell,
38 37
)
39
from combo.wsgi import application
40 38

  
41 39
pytestmark = pytest.mark.django_db
42 40

  
43 41
from .test_manager import login
44 42

  
45 43

  
46
@pytest.fixture
47
def normal_user():
48
    try:
49
        user = User.objects.get(username='normal-user')
50
        user.groups = []
51
    except User.DoesNotExist:
52
        user = User.objects.create_user(username='normal-user', email='', password='normal-user')
53
    return user
54

  
55

  
56 44
def test_missing_index(app):
57 45
    Page.objects.all().delete()
58 46
    resp = app.get('/', status=200)
tests/test_publik.py
4 4

  
5 5
import pytest
6 6
from django.conf import settings
7
from django.contrib.auth.models import Group, User
7
from django.contrib.auth.models import Group
8 8

  
9 9
from combo.data.models import Page
10 10

  
......
17 17
    test_manager.login(app, username='normal-user', password='normal-user')
18 18

  
19 19

  
20
@pytest.fixture
21
def normal_user():
22
    try:
23
        user = User.objects.get(username='normal-user')
24
        user.groups = []
25
    except User.DoesNotExist:
26
        user = User.objects.create_user(username='normal-user', email='', password='normal-user')
27
    return user
28

  
29

  
30 20
class KnownServices:
31 21
    def __init__(self, known_services):
32 22
        self.known_services = known_services
tests/test_pwa.py
1 1
import base64
2
import os
3 2
from unittest import mock
4 3

  
5 4
import pytest
6
import pywebpush
7 5
from django.conf import settings
8 6
from django.core.files import File
9 7
from django.template import Context, Template
tests/test_utils.py
1 1
import pytest
2 2
from django.conf import settings
3
from django.contrib.auth.models import AnonymousUser
4 3
from django.template import Context, RequestContext
5 4
from django.test import override_settings
6 5
from django.test.client import RequestFactory
7
-