Use isort to format Python imports (#3251)

This commit is contained in:
Francesco Lodolo 2024-06-05 06:09:35 +02:00 коммит произвёл GitHub
Родитель d650739031
Коммит 1f7b2929d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
196 изменённых файлов: 455 добавлений и 287 удалений

Просмотреть файл

@ -1,7 +1,8 @@
# Generated by Django 1.11.28 on 2020-03-08 19:27
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 2.2.13 on 2020-07-03 07:09
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

Просмотреть файл

@ -1,8 +1,9 @@
from django import forms
from django.contrib.auth.models import User
from django.forms.models import inlineformset_factory
from django.core.exceptions import ValidationError
from django.forms.models import inlineformset_factory
from pontoon.base.forms import HtmlField
from pontoon.base.models import (
Entity,
ExternalResource,
@ -10,7 +11,6 @@ from pontoon.base.models import (
Project,
Repository,
)
from pontoon.base.forms import HtmlField
from pontoon.tags.models import Tag

Просмотреть файл

@ -1,9 +1,9 @@
from django.urls import include, path
from . import views
import pontoon.tags.admin.views as tags_admin_views
from . import views
urlpatterns = [
# Admin Home

Просмотреть файл

@ -4,7 +4,7 @@ import logging
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db import transaction, IntegrityError
from django.db import IntegrityError, transaction
from django.db.models import Max
from django.http import Http404, HttpResponse, HttpResponseForbidden, JsonResponse
from django.shortcuts import render
@ -20,7 +20,6 @@ from pontoon.administration.forms import (
TagInlineFormSet,
)
from pontoon.base import utils
from pontoon.base.utils import require_AJAX
from pontoon.base.models import (
Entity,
Locale,
@ -30,9 +29,10 @@ from pontoon.base.models import (
TranslatedResource,
Translation,
)
from pontoon.base.utils import require_AJAX
from pontoon.pretranslation.tasks import pretranslate
from pontoon.sync.models import SyncLog
from pontoon.sync.tasks import sync_project
from pontoon.pretranslation.tasks import pretranslate
log = logging.getLogger(__name__)

Просмотреть файл

@ -6,12 +6,13 @@ views and don't allow user to tamper with the state of an account.
import importlib
from django.urls import path
from allauth.account import views as account_views
from allauth.socialaccount import providers, views as socialaccount_views
from django.conf import settings
from django.contrib.auth import views
from django.urls import path
from allauth.account import views as account_views
from allauth.socialaccount import views as socialaccount_views, providers
if settings.AUTHENTICATION_METHOD == "django":
urlpatterns = [

Просмотреть файл

@ -1,15 +1,14 @@
import graphene
from graphene_django import DjangoObjectType
from graphene_django.debug import DjangoDebug
from pontoon.api.util import get_fields
from pontoon.base.models import (
Locale as LocaleModel,
Project as ProjectModel,
ProjectLocale as ProjectLocaleModel,
)
from pontoon.tags.models import Tag as TagModel

Просмотреть файл

@ -1,9 +1,10 @@
import sys
from itertools import product
import pytest
from pontoon.base.models import Project, ProjectLocale
from pontoon.base.models import Project, ProjectLocale
from pontoon.test.factories import ProjectFactory

Просмотреть файл

@ -2,6 +2,7 @@ import importlib
import sys
import pytest
from django.urls import clear_url_caches

Просмотреть файл

@ -4,17 +4,15 @@ from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.models import User
from django.forms.models import ModelForm
from django.forms import ChoiceField
from django.forms.models import ModelForm
from django.urls import reverse
from django.utils.html import format_html
from pontoon.actionlog.models import ActionLog
from pontoon.base import models
from pontoon.base import utils
from pontoon.terminology.models import Term
from pontoon.base import models, utils
from pontoon.teams.utils import log_user_groups
from pontoon.terminology.models import Term
AGGREGATED_STATS_FIELDS = (

Просмотреть файл

@ -1,6 +1,7 @@
import os
import dotenv
from celery import Celery

Просмотреть файл

@ -1,9 +1,9 @@
import logging
from django.conf import settings
from raygun4py import raygunprovider
from django.conf import settings
log = logging.getLogger(__name__)

Просмотреть файл

@ -1,4 +1,4 @@
from fluent.syntax import ast, FluentParser
from fluent.syntax import FluentParser, ast
from fluent.syntax.serializer import serialize_expression

Просмотреть файл

@ -1,10 +1,10 @@
from pathlib import Path
import bleach
from django import forms
from django.conf import settings
from pathlib import Path
from pontoon.base import utils
from pontoon.base.models import (
Locale,

Просмотреть файл

@ -2,8 +2,8 @@ import os
from urllib.parse import urlparse
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from pontoon.base.models import User

Просмотреть файл

@ -8,11 +8,13 @@ from allauth.socialaccount.providers.github.provider import GitHubProvider
from allauth.socialaccount.providers.gitlab.provider import GitLabProvider
from allauth.socialaccount.providers.google.provider import GoogleProvider
from allauth.socialaccount.providers.keycloak.provider import KeycloakProvider
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
FXA_PROVIDER_ID = FirefoxAccountsProvider.id
GITHUB_PROVIDER_ID = GitHubProvider.id
GITLAB_PROVIDER_ID = GitLabProvider.id

Просмотреть файл

@ -1,7 +1,7 @@
import requests
from urllib.parse import urljoin
import requests
from django.core.cache import cache
from django.core.management.base import BaseCommand
from django.urls import reverse

Просмотреть файл

@ -1,11 +1,13 @@
from raygun4py.middleware.django import Provider
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseForbidden
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.deprecation import MiddlewareMixin
from pontoon.base.utils import is_ajax
from raygun4py.middleware.django import Provider
class RaygunExceptionMiddleware(Provider, MiddlewareMixin):

Просмотреть файл

@ -1,13 +1,16 @@
# Generated by Django 2.2.11 on 2021-02-25 06:22
import dirtyfields.dirtyfields
from django.conf import settings
import jsonfield.fields
import django.contrib.postgres.fields
from django.contrib.postgres.operations import CreateExtension
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
from django.conf import settings
from django.contrib.postgres.operations import CreateExtension
from django.db import migrations, models
import pontoon.base.models

Просмотреть файл

@ -1,8 +1,8 @@
# Generated by Django 2.2.11 on 2021-02-25 06:33
from django.conf import settings
from django.db import migrations
from django.conf import settings
MIGRATION_0002_LOCALES = [
{

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 2.2.13 on 2020-07-03 07:10
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 2.2.11 on 2020-07-02 18:47
import django.contrib.postgres.fields
from django.db import migrations, models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 2.2.13 on 2020-07-23 19:29
import django.contrib.postgres.fields
from django.db import migrations, models

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 2.2.13 on 2020-10-20 18:30
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.1.3 on 2021-02-03 14:15
import django.contrib.postgres.fields
from django.db import migrations, models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.1.3 on 2021-03-10 19:45
import django.contrib.postgres.fields
from django.db import migrations, models

Просмотреть файл

@ -1,7 +1,7 @@
# Generated by Django 3.2.4 on 2021-08-19 13:46
from django.db import migrations
from django.db.models import Func, F, Value, TextField
from django.db.models import F, Func, TextField, Value
from pontoon.sync import KEY_SEPARATOR

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.4 on 2021-09-02 06:28
from django.db import migrations, models
import pontoon.base.models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.10 on 2022-03-15 14:08
from django.db import migrations, models
import pontoon.base.models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.15 on 2023-02-23 16:02
from django.db import migrations
from pontoon.base.models import Project, ChangedEntityLocale
from pontoon.base.models import ChangedEntityLocale, Project
def remove_changed_entity_locale_entries_for_repository_projects(apps, schema_editor):

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 3.2.15 on 2023-06-21 18:54
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 3.2.15 on 2023-11-22 06:52
from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.24 on 2024-04-09 14:57
import django.contrib.postgres.fields
from django.db import migrations, models

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 4.2.11 on 2024-05-22 12:25
from django.db import migrations, models
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

Просмотреть файл

@ -16,6 +16,7 @@ from pontoon.base.models.user import User
from pontoon.base.models.user_profile import UserProfile
from pontoon.db import IContainsCollate # noqa
__all__ = [
"AggregatedStats",
"ChangedEntityLocale",

Просмотреть файл

@ -3,10 +3,11 @@ from operator import ior
from re import findall, match
from dirtyfields import DirtyFieldsMixin
from jsonfield import JSONField
from django.db import models
from django.db.models import F, Prefetch, Q
from django.utils import timezone
from jsonfield import JSONField
from pontoon.base import utils
from pontoon.base.models.locale import Locale

Просмотреть файл

@ -2,6 +2,7 @@ import json
import logging
import requests
from django.conf import settings
from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
@ -10,6 +11,7 @@ from django.db.models import F, Prefetch
from pontoon.base.models.aggregated_stats import AggregatedStats
log = logging.getLogger(__name__)
@ -399,8 +401,8 @@ class Locale(AggregatedStats):
def parts_stats(self, project):
"""Get locale-project paths with stats."""
from pontoon.base.models.translated_resource import TranslatedResource
from pontoon.base.models.project_locale import ProjectLocale
from pontoon.base.models.translated_resource import TranslatedResource
def get_details(parts):
return parts.order_by("title").values(

Просмотреть файл

@ -1,14 +1,17 @@
import logging
import re
from os import sep
from os.path import join
from urllib.parse import urlparse
from jsonfield import JSONField
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from django.db import models
from django.utils.functional import cached_property
from jsonfield import JSONField
log = logging.getLogger(__name__)

Просмотреть файл

@ -1,4 +1,5 @@
from dirtyfields import DirtyFieldsMixin
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models import Count, Q

Просмотреть файл

@ -1,6 +1,7 @@
from math import ceil, floor
import Levenshtein
from django.db import models
from django.db.models import Case, ExpressionWrapper, F, Value, When
from django.db.models.functions import Cast, Length, Substr

Просмотреть файл

@ -1,12 +1,13 @@
from hashlib import md5
from urllib.parse import quote, urlencode
from guardian.shortcuts import get_objects_for_user
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count
from django.urls import reverse
from guardian.shortcuts import get_objects_for_user
from pontoon.actionlog.models import ActionLog

Просмотреть файл

@ -1,20 +1,20 @@
from guardian.models import GroupObjectPermission
from django.contrib.auth.models import User, Group, Permission
from django.contrib.auth.models import Group, Permission, User
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_save, pre_save, post_delete, pre_delete
from django.db.models.signals import post_delete, post_save, pre_delete, pre_save
from django.dispatch import receiver
from pontoon.base import errors
from pontoon.base.models import (
Locale,
LocaleCodeHistory,
Project,
ProjectLocale,
ProjectSlugHistory,
TranslatedResource,
UserProfile,
ProjectSlugHistory,
LocaleCodeHistory,
)

Просмотреть файл

@ -1,8 +1,9 @@
import html
import datetime
import html
import json
import markupsafe
from allauth.socialaccount import providers
from allauth.utils import get_request_param
from bleach.linkifier import Linker
@ -18,6 +19,7 @@ from django.utils.http import url_has_allowed_host_and_scheme
from pontoon.base.fluent import get_simple_preview
register = template.Library()

Просмотреть файл

@ -1,19 +1,21 @@
import json
import os
import tempfile
from contextlib import contextmanager
from unittest.mock import patch
import factory
from factory import LazyAttribute, SelfAttribute, Sequence, SubFactory
from factory.django import DjangoModelFactory
from django.contrib.auth.models import (
Group,
User,
)
from django.template.defaultfilters import slugify
from django.test import TestCase as BaseTestCase, Client as BaseClient
import factory
from factory import LazyAttribute, Sequence, SubFactory, SelfAttribute
from factory.django import DjangoModelFactory
from django.test import Client as BaseClient, TestCase as BaseTestCase
from pontoon.base.models import (
ChangedEntityLocale,

Просмотреть файл

@ -1,12 +1,12 @@
from unittest.mock import patch, call
from unittest.mock import call, patch
import pytest
from pontoon.base.models import (
get_word_count,
Entity,
Translation,
TranslatedResource,
Translation,
get_word_count,
)
from pontoon.test.factories import (
EntityFactory,

Просмотреть файл

@ -1,6 +1,7 @@
import pytest
from pontoon.base.tests import ProjectFactory, ProjectLocaleFactory
from pontoon.base.models import Project, ProjectLocale
from pontoon.base.tests import ProjectFactory, ProjectLocaleFactory
@pytest.fixture

Просмотреть файл

@ -1,4 +1,4 @@
from unittest.mock import patch, call
from unittest.mock import call, patch
import pytest

Просмотреть файл

@ -4,7 +4,6 @@ from django.db.models import Q
from pontoon.base.utils import aware_datetime
from pontoon.contributors.utils import users_with_translations_counts
from pontoon.test.factories import (
EntityFactory,
TranslationFactory,

Просмотреть файл

@ -1,13 +1,13 @@
import pytest
from pontoon.base.models import ChangedEntityLocale, Entity, Project
from pontoon.sync import KEY_SEPARATOR
from pontoon.test.factories import (
EntityFactory,
ResourceFactory,
TermFactory,
TranslationFactory,
)
from pontoon.sync import KEY_SEPARATOR
@pytest.fixture

Просмотреть файл

@ -1,19 +1,21 @@
import functools
import os
from unittest.mock import patch
import pytest
from django.contrib.auth.models import AnonymousUser
from pontoon.base.models import ProjectLocale, Project, Repository
from pontoon.base.models import Project, ProjectLocale, Repository
from pontoon.test.factories import (
ChangedEntityLocaleFactory,
EntityFactory,
LocaleFactory,
ProjectFactory,
ProjectLocaleFactory,
RepositoryFactory,
ResourceFactory,
ProjectFactory,
LocaleFactory,
)

Просмотреть файл

@ -1,5 +1,6 @@
import os
from unittest.mock import call, patch, Mock
from unittest.mock import Mock, call, patch
from urllib.parse import urlparse
import pytest

Просмотреть файл

@ -3,11 +3,12 @@ Test consistency of calculations between `calculate_stats` and `translation.save
"""
import pytest
from pontoon.base.models import TranslatedResource
from pontoon.checks.models import (
Error,
Warning,
FailedCheck,
Warning,
)

Просмотреть файл

@ -1,8 +1,9 @@
from unittest.mock import patch, call
from unittest.mock import call, patch
import pytest
from pontoon.base.models import Project, Translation, TranslationMemoryEntry
from pontoon.base.utils import aware_datetime
from pontoon.test.factories import (
EntityFactory,
ProjectLocaleFactory,
@ -10,7 +11,6 @@ from pontoon.test.factories import (
TranslatedResourceFactory,
TranslationFactory,
)
from pontoon.base.utils import aware_datetime
@pytest.mark.django_db

Просмотреть файл

@ -1,6 +1,7 @@
from collections import defaultdict
import pytest
from collections import defaultdict
from django.contrib.auth.models import User

Просмотреть файл

@ -1,7 +1,7 @@
import pytest
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from pontoon.base.admin import UserAdmin

Просмотреть файл

@ -1,8 +1,9 @@
from collections import OrderedDict
from textwrap import dedent
import pytest
from collections import OrderedDict
from fluent.syntax import FluentParser
from textwrap import dedent
from pontoon.base.fluent import (
get_simple_preview,

Просмотреть файл

@ -1,13 +1,13 @@
import pytest
from datetime import timedelta
import pytest
from pontoon.base.templatetags.helpers import (
format_datetime,
format_timedelta,
metric_prefix,
nospam,
to_json,
metric_prefix,
)
from pontoon.base.utils import aware_datetime

Просмотреть файл

@ -1,10 +1,9 @@
import pytest
from django.contrib.auth import get_user_model
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.urls.exceptions import NoReverseMatch
from django.http import HttpResponseRedirect
from pontoon.base.models import Project
from pontoon.base.utils import (
@ -12,18 +11,17 @@ from pontoon.base.utils import (
extension_in,
get_m2m_changes,
get_object_or_none,
latest_datetime,
get_search_phrases,
is_email,
latest_datetime,
)
from pontoon.test.factories import (
ProjectFactory,
ResourceFactory,
LocaleFactory,
ProjectSlugHistoryFactory,
ProjectLocaleFactory,
LocaleCodeHistoryFactory,
LocaleFactory,
ProjectFactory,
ProjectLocaleFactory,
ProjectSlugHistoryFactory,
ResourceFactory,
)

Просмотреть файл

@ -1,11 +1,12 @@
import json
from unittest.mock import MagicMock, PropertyMock, patch
import pytest
from django.http import Http404
from pontoon.base.views import AjaxFormView, AjaxFormPostView
from pontoon.base.views import AjaxFormPostView, AjaxFormView
def test_view_ajax_form(rf):

Просмотреть файл

@ -1,4 +1,5 @@
import json
from unittest.mock import patch
import pytest

Просмотреть файл

@ -2,9 +2,9 @@ from unittest.mock import MagicMock, PropertyMock, patch
import pytest
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpResponse
from django.urls import reverse
from django.contrib.auth.models import User, AnonymousUser
@patch("pontoon.base.views.get_object_or_404")

Просмотреть файл

@ -1,7 +1,9 @@
import os
from datetime import datetime
import pytest
from lxml import etree
from django.urls import reverse

Просмотреть файл

@ -3,6 +3,7 @@ from django.views.generic import RedirectView, TemplateView
from . import views
urlpatterns = [
# Terms
path(

Просмотреть файл

@ -3,29 +3,31 @@ import functools
import io
import os
import re
import requests
import tempfile
import time
import zipfile
from collections import defaultdict
from datetime import datetime, timedelta, timezone
from guardian.decorators import permission_required as guardian_permission_required
from urllib.parse import urljoin
from xml.sax.saxutils import escape, quoteattr
import requests
from guardian.decorators import permission_required as guardian_permission_required
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.db.models import Prefetch, Q
from django.db.models.query import QuerySet
from django.http import HttpResponseBadRequest, Http404
from django.shortcuts import redirect, get_object_or_404
from django.http import Http404, HttpResponseBadRequest
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.utils.timezone import make_aware, now
from django.utils.text import slugify
from django.utils.timezone import make_aware, now
from django.utils.translation import trans_real
UNUSABLE_SEARCH_CHAR = ""
@ -197,10 +199,10 @@ def get_download_content(slug, code, part):
:arg str part: Resource path.
"""
# Avoid circular import; someday we should refactor to avoid.
from pontoon.base.models import Entity, Locale, Project, Resource
from pontoon.sync import formats
from pontoon.sync.utils import source_to_locale_path
from pontoon.sync.vcs.project import VCSProject
from pontoon.base.models import Entity, Locale, Project, Resource
project = get_object_or_404(Project, slug=slug)
locale = get_object_or_404(Locale, code=code)
@ -321,9 +323,6 @@ def handle_upload_content(slug, code, part, f, user):
:arg User user: User uploading the file.
"""
# Avoid circular import; someday we should refactor to avoid.
from pontoon.sync import formats
from pontoon.sync.changeset import ChangeSet
from pontoon.sync.vcs.project import VCSProject
from pontoon.base.models import (
Entity,
Locale,
@ -332,6 +331,9 @@ def handle_upload_content(slug, code, part, f, user):
TranslatedResource,
Translation,
)
from pontoon.sync import formats
from pontoon.sync.changeset import ChangeSet
from pontoon.sync.vcs.project import VCSProject
project = get_object_or_404(Project, slug=slug)
locale = get_object_or_404(Locale, code=code)

Просмотреть файл

@ -5,11 +5,13 @@ from collections import defaultdict
from datetime import datetime
from urllib.parse import urlparse
from notifications.signals import notify
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage
from django.core.paginator import EmptyPage, Paginator
from django.db import transaction
from django.db.models import Q
from django.http import (
@ -27,12 +29,9 @@ from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition, require_POST
from django.views.generic.edit import FormView
from notifications.signals import notify
from pontoon.actionlog.models import ActionLog
from pontoon.actionlog.utils import log_action
from pontoon.base import forms
from pontoon.base import utils
from pontoon.base import forms, utils
from pontoon.base.models import (
Comment,
Entity,

Просмотреть файл

@ -2,8 +2,8 @@ from django.utils import timezone
from pontoon.actionlog.models import ActionLog
from pontoon.base.models import (
TranslationMemoryEntry,
Translation,
TranslationMemoryEntry,
)
from pontoon.batch import utils

Просмотреть файл

@ -3,7 +3,7 @@ import pytest
from django.urls import reverse
from pontoon.checks.utils import bulk_run_checks
from pontoon.test.factories import TranslationFactory, ProjectLocaleFactory
from pontoon.test.factories import ProjectLocaleFactory, TranslationFactory
@pytest.fixture

Просмотреть файл

@ -1,18 +1,17 @@
from copy import deepcopy
from django.utils import timezone
from pontoon.base.models import Entity, Resource
from pontoon.checks import DB_FORMATS
from pontoon.checks.libraries import run_checks
from fluent.syntax import (
FluentParser,
FluentSerializer,
visitor,
)
from django.utils import timezone
from pontoon.base.models import Entity, Resource
from pontoon.checks import DB_FORMATS
from pontoon.checks.libraries import run_checks
parser = FluentParser()
serializer = FluentSerializer()

Просмотреть файл

@ -10,13 +10,13 @@ from pontoon.base.models import (
Entity,
Locale,
Project,
TranslationMemoryEntry,
Translation,
TranslatedResource,
Translation,
TranslationMemoryEntry,
)
from pontoon.base.utils import (
require_AJAX,
readonly_exists,
require_AJAX,
)
from pontoon.batch import forms
from pontoon.batch.actions import ACTIONS_FN_MAP

Просмотреть файл

@ -1,4 +1,5 @@
from django.contrib import admin
from pontoon.checks import models

Просмотреть файл

@ -1,6 +1,4 @@
from . import compare_locales
from . import translate_toolkit
from . import pontoon_db, pontoon_non_db
from . import compare_locales, pontoon_db, pontoon_non_db, translate_toolkit
def run_checks(

Просмотреть файл

@ -7,7 +7,6 @@ from compare_locales.parser.base import Junk
from compare_locales.parser.dtd import DTDEntityMixin
from compare_locales.parser.fluent import FluentParser
from compare_locales.parser.properties import PropertiesEntityMixin
from compare_locales.paths import File
from pontoon.sync.utils import escape_apostrophes

Просмотреть файл

@ -1,4 +1,5 @@
from collections import defaultdict
from fluent.syntax import FluentParser, ast
from fluent.syntax.visitor import Visitor

Просмотреть файл

@ -2,11 +2,11 @@ from celery import (
group,
signature,
)
from django.core.management.base import BaseCommand
from pontoon.base.models import Translation
from pontoon.checks import DB_FORMATS
from pontoon.checks.tasks import check_translations

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 1.11.28 on 2020-03-08 19:52
from django.db import migrations, models
import django.db.migrations.operations.special
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True

Просмотреть файл

@ -7,6 +7,7 @@ from django.db import transaction
from pontoon.base.models import Translation
from pontoon.checks.utils import bulk_run_checks
log = logging.getLogger(__name__)

Просмотреть файл

@ -7,9 +7,9 @@ import pytest
from pontoon.checks.libraries.compare_locales import (
CompareDTDEntity,
cast_to_compare_locales,
ComparePropertiesEntity,
UnsupportedResourceTypeError,
cast_to_compare_locales,
run_checks,
)

Просмотреть файл

@ -1,5 +1,5 @@
from textwrap import dedent
from unittest.mock import patch, MagicMock, ANY
from unittest.mock import ANY, MagicMock, patch
import pytest

Просмотреть файл

@ -1,15 +1,15 @@
import pytest
from pontoon.base.models import Translation, Resource
from pontoon.checks.utils import (
save_failed_checks,
get_failed_checks_db_objects,
bulk_run_checks,
)
from pontoon.base.models import Resource, Translation
from pontoon.checks.models import (
Error,
Warning,
FailedCheck,
Warning,
)
from pontoon.checks.utils import (
bulk_run_checks,
get_failed_checks_db_objects,
save_failed_checks,
)

Просмотреть файл

@ -9,7 +9,7 @@ def bulk_run_checks(translations):
To avoid performance problems, translations have to prefetch entities and locales objects.
"""
from pontoon.checks.libraries import run_checks
from pontoon.checks.models import Warning, Error
from pontoon.checks.models import Error, Warning
warnings, errors = [], []
if not translations:
@ -46,7 +46,7 @@ def get_failed_checks_db_objects(translation, failed_checks):
:arg Translation translation: instance of translation
:arg dict failed_checks: dictionary with failed checks
"""
from pontoon.checks.models import Warning, Error
from pontoon.checks.models import Error, Warning
warnings = []
errors = []

Просмотреть файл

@ -3,9 +3,12 @@ from unittest.mock import patch
from urllib.parse import urlencode
import pytest
from dateutil.relativedelta import relativedelta
from django.test.client import RequestFactory
from django.utils import timezone
from pontoon.actionlog.models import ActionLog
from pontoon.base.models import User
from pontoon.base.utils import convert_to_unix_time

Просмотреть файл

@ -1,12 +1,12 @@
import pytest
from collections import OrderedDict
from datetime import datetime, timedelta
from unittest.mock import patch
import pytest
from django.http import HttpResponse
from django.urls import reverse
from django.utils.timezone import now, make_aware
from django.utils.timezone import make_aware, now
from pontoon.base.models import User
from pontoon.base.tests import (

Просмотреть файл

@ -1,10 +1,12 @@
import datetime
import jwt
from collections import defaultdict
from dateutil.relativedelta import relativedelta
from urllib.parse import urlencode
import jwt
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import EmailMessage

Просмотреть файл

@ -2,6 +2,7 @@ import json
import logging
from dateutil.relativedelta import relativedelta
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
@ -10,20 +11,20 @@ from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import Q
from django.http import (
Http404,
HttpResponse,
HttpResponseBadRequest,
JsonResponse,
Http404,
)
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
from django.utils.html import escape
from django.views.decorators.http import require_POST
from django.views.generic import TemplateView
from django.utils.html import escape
from pontoon.base import forms
from pontoon.base.models import Locale, Project, UserProfile
from pontoon.base.utils import require_AJAX, get_locale_or_redirect
from pontoon.base.utils import get_locale_or_redirect, require_AJAX
from pontoon.contributors import utils
from pontoon.settings import VIEW_CACHE_TIMEOUT
from pontoon.uxactionlog.utils import log_ux_action

Просмотреть файл

@ -4,9 +4,9 @@ Collation lookups allow a user to set text-collation to search queries.
import pytest
from pontoon.db import IContainsCollate # noqa
from pontoon.base.models import Entity
from pontoon.base.tests import EntityFactory
from pontoon.db import IContainsCollate # noqa
@pytest.fixture

Просмотреть файл

@ -7,7 +7,9 @@ with debug_sql():
"""
import logging
from contextlib import contextmanager
from django.db import connection

Просмотреть файл

@ -1,8 +1,6 @@
from django.contrib import admin
from pontoon.homepage import models
from pontoon.homepage import forms
from pontoon.homepage import forms, models
class HomepageAdmin(admin.ModelAdmin):

Просмотреть файл

@ -1,6 +1,7 @@
from django import forms
from django_ace import AceWidget
from django import forms
from pontoon.homepage import models

Просмотреть файл

@ -1,8 +1,9 @@
# Generated by Django 3.1.3 on 2021-02-25 23:53
from django.db import migrations
from pathlib import Path
from django.db import migrations
def get_homepage_content():
module_dir = Path(__file__).parent.parent

Просмотреть файл

@ -2,6 +2,7 @@ from django.urls import path
from . import views
urlpatterns = [
# Homepage
path("", views.homepage, name="pontoon.homepage"),

Просмотреть файл

@ -1,11 +1,11 @@
from django.shortcuts import render, redirect
from django.urls import reverse
from django.template import Template, Context
from django.http import Http404
from django.shortcuts import redirect, render
from django.template import Context, Template
from django.urls import reverse
from pontoon.base.models import Locale
from pontoon.base.utils import get_locale_or_redirect, get_project_locale_from_request
from pontoon.homepage.models import Homepage
from pontoon.base.utils import get_project_locale_from_request, get_locale_or_redirect
def homepage(request):

Просмотреть файл

@ -1,8 +1,10 @@
# Generated by Django 3.1.3 on 2020-12-10 17:55
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
import pontoon.insights.models

Просмотреть файл

@ -1,9 +1,10 @@
# Generated by Django 3.1.3 on 2020-12-23 15:07
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [

Просмотреть файл

@ -1,7 +1,9 @@
# Generated by Django 3.2.4 on 2021-08-24 06:45
import datetime
from django.db import migrations, models
import pontoon.insights.models

Просмотреть файл

@ -1,7 +1,9 @@
# Generated by Django 3.2.4 on 2021-09-30 13:39
import datetime
from django.db import migrations, models
import pontoon.insights.models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.4 on 2021-11-29 21:24
import datetime
from django.db import migrations, models

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56
from datetime import timedelta
from django.db import migrations
from django.db.models import F

Просмотреть файл

@ -1,6 +1,7 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56
from datetime import timedelta
from django.db import migrations
from django.db.models import F

Просмотреть файл

@ -2,9 +2,10 @@
import statistics
from sacrebleu.metrics import CHRF
from django.db import migrations
from django.db.models import F
from sacrebleu.metrics import CHRF
chrfpp = CHRF(word_order=2)

Просмотреть файл

@ -1,4 +1,5 @@
from datetime import timedelta
from django.db import models
from django.utils import timezone

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше