Skip to content

Commit

Permalink
Replace relative imports for imports outside of the immediate module (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Oct 30, 2024
1 parent 2d709c3 commit 99225cb
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 68 deletions.
9 changes: 5 additions & 4 deletions etna/alerts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from wagtail.models import Site

from ..alerts.models import Alert
from ..alerts.templatetags import alert_tags
from ..collections.models import ExplorerIndexPage, TopicExplorerPage
from ..home.models import HomePage
from etna.collections.models import ExplorerIndexPage, TopicExplorerPage
from etna.home.models import HomePage

from .models import Alert
from .templatetags import alert_tags


def rich_text_msg(level):
Expand Down
5 changes: 2 additions & 3 deletions etna/articles/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
SectionDepthAwareStructBlock,
SubHeadingBlock,
)

from ..media.blocks import MediaBlock
from ..records.blocks import RecordLinksBlock
from etna.media.blocks import MediaBlock
from etna.records.blocks import RecordLinksBlock


class SectionContentBlock(blocks.StreamBlock):
Expand Down
3 changes: 1 addition & 2 deletions etna/blog/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
SubHeadingBlock,
YouTubeBlock,
)

from ..media.blocks import MediaBlock
from etna.media.blocks import MediaBlock


class SectionContentBlock(blocks.StreamBlock):
Expand Down
5 changes: 3 additions & 2 deletions etna/ciim/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

import responses

from ...records.api import get_records_client
from ...records.models import Record
from etna.records.api import get_records_client
from etna.records.models import Record

from ..exceptions import ClientAPIError, DoesNotExist, MultipleObjectsReturned
from .factories import create_record, create_search_response

Expand Down
14 changes: 7 additions & 7 deletions etna/collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@

from rest_framework import serializers

from etna.core.models import (
BasePage,
BasePageWithRequiredIntro,
ContentWarningMixin,
RequiredHeroImageMixin,
)
from etna.core.serializers import (
DefaultPageSerializer,
HighlightImageSerializer,
ImageSerializer,
)
from etna.core.utils import skos_id_from_text

from ..core.models import (
BasePage,
BasePageWithRequiredIntro,
ContentWarningMixin,
RequiredHeroImageMixin,
)
from ..core.utils import skos_id_from_text
from .blocks import (
ExplorerIndexPageStreamBlock,
FeaturedArticlesBlock,
Expand Down
3 changes: 1 addition & 2 deletions etna/collections/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

import responses

from etna.ciim.tests.factories import create_record, create_response
from etna.core.test_utils import prevent_request_warnings

from ...ciim.tests.factories import create_record, create_response


class TestRecordChooseView(WagtailPageTestCase):
def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion etna/core/tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import responses

from ...ciim.tests.factories import create_record, create_response
from etna.ciim.tests.factories import create_record, create_response

CONDITIONALLY_PROTECTED_URLS = (
reverse_lazy("search-catalogue"),
Expand Down
5 changes: 2 additions & 3 deletions etna/generic_pages/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
WarningTextBlock,
YouTubeBlock,
)

from ..media.blocks import MediaBlock
from ..records.blocks import RecordLinksBlock
from etna.media.blocks import MediaBlock
from etna.records.blocks import RecordLinksBlock


class SectionContentBlock(blocks.StreamBlock):
Expand Down
5 changes: 3 additions & 2 deletions etna/people/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from wagtail.models import Site

from ...articles.models import FocusedArticlePage
from ...images.models import CustomImage
from etna.articles.models import FocusedArticlePage
from etna.images.models import CustomImage

from ..models import AuthorTag, PeopleIndexPage, PersonPage


Expand Down
2 changes: 1 addition & 1 deletion etna/records/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from wagtail import blocks
from wagtail.api import APIField

from etna.ciim.exceptions import ClientAPIError
from etna.core.blocks.image import APIImageChooserBlock

from ..ciim.exceptions import ClientAPIError
from .api import records_client


Expand Down
11 changes: 6 additions & 5 deletions etna/records/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

from pyquery import PyQuery as pq

from ..analytics.mixins import DataLayerMixin
from ..ciim.constants import (
from etna.analytics.mixins import DataLayerMixin
from etna.ciim.constants import (
ARCHIVE_NRA_RECORDS_COLLECTION,
ARCHIVE_RECORD_CREATORS_COLLECTION,
TNA_URLS,
)
from ..ciim.models import APIModel
from ..ciim.utils import (
from etna.ciim.models import APIModel
from etna.ciim.utils import (
NOT_PROVIDED,
ValueExtractionError,
extract,
Expand All @@ -30,13 +30,14 @@
format_link,
strip_html,
)
from ..records.classes import (
from etna.records.classes import (
AccessionsInfo,
ArchiveCollections,
CollectionInfo,
ContactInfo,
FurtherInfo,
)

from .converters import IAIDConverter

logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion etna/records/templatetags/records_tags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django import template
from django.conf import settings

from ...ciim.constants import TNA_URLS, LevelKeys, NonTNALevelKeys
from etna.ciim.constants import TNA_URLS, LevelKeys, NonTNALevelKeys

from ..field_labels import FIELD_LABELS
from ..models import Record

Expand Down
5 changes: 2 additions & 3 deletions etna/records/tests/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

import responses

from etna.articles.models import ArticleIndexPage, ArticlePage
from etna.ciim.tests.factories import create_record, create_response
from etna.images.models import CustomImage

from ...articles.models import ArticleIndexPage, ArticlePage
from ...ciim.tests.factories import create_record, create_response

TEST_RECORD_DATA = {
"iaid": "C123456",
"reference_number": "ZZ/TEST/1",
Expand Down
5 changes: 3 additions & 2 deletions etna/records/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

import responses

from ...ciim.tests.factories import create_media, create_record, create_response
from ...ciim.utils import ValueExtractionError
from etna.ciim.tests.factories import create_media, create_record, create_response
from etna.ciim.utils import ValueExtractionError

from ..api import get_records_client
from ..models import Image, Record

Expand Down
3 changes: 1 addition & 2 deletions etna/records/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@

import responses

from etna.ciim.tests.factories import create_media, create_record, create_response
from etna.core.test_utils import prevent_request_warnings
from etna.records.views.records import SEARCH_URL_RETAIN_DELTA

from ...ciim.tests.factories import create_media, create_record, create_response

User = get_user_model()


Expand Down
2 changes: 1 addition & 1 deletion etna/records/transforms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..ciim.utils import pluck
from etna.ciim.utils import pluck


def transform_image_result(result):
Expand Down
7 changes: 4 additions & 3 deletions etna/records/views/choosers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from generic_chooser.views import BaseChosenView, ChooserMixin, ChooserViewSet

from ...ciim.client import Stream
from ...ciim.exceptions import ClientAPIError
from ...ciim.paginator import APIPaginator
from etna.ciim.client import Stream
from etna.ciim.exceptions import ClientAPIError
from etna.ciim.paginator import APIPaginator

from ..api import records_client
from ..models import Record

Expand Down
5 changes: 3 additions & 2 deletions etna/records/views/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from django.shortcuts import Http404, render
from django.views.decorators.cache import cache_control

from ...ciim.exceptions import ClientAPIError, DoesNotExist
from ...ciim.utils import convert_sort_key_to_index
from etna.ciim.exceptions import ClientAPIError, DoesNotExist
from etna.ciim.utils import convert_sort_key_to_index

from ..api import records_client
from ..models import Image

Expand Down
7 changes: 4 additions & 3 deletions etna/records/views/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
from django.urls import reverse
from django.utils import timezone

from ...ciim.constants import TNA_URLS
from ...ciim.exceptions import DoesNotExist
from ...ciim.paginator import APIPaginator
from etna.ciim.constants import TNA_URLS
from etna.ciim.exceptions import DoesNotExist
from etna.ciim.paginator import APIPaginator

from ..api import records_client

SEARCH_URL_RETAIN_DELTA = timezone.timedelta(hours=48)
Expand Down
11 changes: 5 additions & 6 deletions etna/search/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@

from wagtail.models import get_page_models

from etna.core.fields import END_OF_MONTH, DateInputField
from etna.core.models import BasePage

from ..ciim.client import SortBy, SortOrder
from ..ciim.constants import (
from etna.ciim.client import SortBy, SortOrder
from etna.ciim.constants import (
CATALOGUE_BUCKETS,
COLLECTION_CHOICES,
LEVEL_CHOICES,
TYPE_CHOICES,
WEBSITE_BUCKETS,
)
from ..collections.models import TimePeriodExplorerPage, TopicExplorerPage
from etna.collections.models import TimePeriodExplorerPage, TopicExplorerPage
from etna.core.fields import END_OF_MONTH, DateInputField
from etna.core.models import BasePage


class SearchFilterCheckboxList(forms.widgets.CheckboxSelectMultiple):
Expand Down
8 changes: 4 additions & 4 deletions etna/search/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

import responses

from etna.articles.factories import ArticlePageFactory
from etna.articles.models import ArticleIndexPage, ArticlePage
from etna.ciim.constants import DEFAULT_AGGREGATIONS, Aggregation, Bucket, BucketList
from etna.ciim.tests.factories import create_response, create_search_response
from etna.core.test_utils import prevent_request_warnings
from etna.home.models import HomePage

from ...articles.factories import ArticlePageFactory
from ...articles.models import ArticleIndexPage, ArticlePage
from ...ciim.tests.factories import create_response, create_search_response
from ...home.models import HomePage
from ..forms import CatalogueSearchForm
from ..views import CatalogueSearchView

Expand Down
19 changes: 10 additions & 9 deletions etna/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from wagtail.query import PageQuerySet
from wagtail.search.backends.database.postgres.postgres import PostgresSearchResults

from ..analytics.mixins import SearchDataLayerMixin
from ..articles.models import ArticleIndexPage, ArticlePage
from ..ciim.client import Aggregation, SortBy, SortOrder, Stream, Template
from ..ciim.constants import (
from etna.analytics.mixins import SearchDataLayerMixin
from etna.articles.models import ArticleIndexPage, ArticlePage
from etna.ciim.client import Aggregation, SortBy, SortOrder, Stream, Template
from etna.ciim.constants import (
CATALOGUE_BUCKETS,
CLOSURE_CLOSED_STATUS,
FEATURED_BUCKETS,
Expand All @@ -34,9 +34,9 @@
Display,
SearchTabs,
)
from ..ciim.paginator import APIPaginator
from ..ciim.utils import underscore_to_camelcase
from ..collections.models import (
from etna.ciim.paginator import APIPaginator
from etna.ciim.utils import underscore_to_camelcase
from etna.collections.models import (
ExplorerIndexPage,
PageTimePeriod,
PageTopic,
Expand All @@ -45,8 +45,9 @@
TopicExplorerIndexPage,
TopicExplorerPage,
)
from ..home.models import HomePage
from ..records.api import records_client
from etna.home.models import HomePage
from etna.records.api import records_client

from .forms import (
CatalogueSearchForm,
FeaturedSearchForm,
Expand Down

0 comments on commit 99225cb

Please sign in to comment.