Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlamallama committed Feb 1, 2024
1 parent 3c101e4 commit 56bd54c
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 100 deletions.
14 changes: 3 additions & 11 deletions home/export_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@
from wagtail.models import Locale, Page # type: ignore
from wagtail.query import PageQuerySet # type: ignore

from home.models import (
ContentPage,
ContentPageIndex,
HomePage,
MessengerBlock,
SMSBlock,
USSDBlock,
VariationBlock,
ViberBlock,
WhatsappBlock,
)
from home.models import (ContentPage, ContentPageIndex, HomePage,
MessengerBlock, SMSBlock, USSDBlock, VariationBlock,
ViberBlock, WhatsappBlock)

HP_CTYPE = HomePage._meta.verbose_name
CP_CTYPE = ContentPage._meta.verbose_name
Expand Down
21 changes: 6 additions & 15 deletions home/import_content_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,9 @@
from wagtail.models.sites import Site # type: ignore
from wagtail.rich_text import RichText # type: ignore

from home.models import (
ContentPage,
ContentPageIndex,
ContentQuickReply,
ContentTrigger,
HomePage,
MessengerBlock,
SMSBlock,
USSDBlock,
ViberBlock,
WhatsappBlock,
)
from home.models import (ContentPage, ContentPageIndex, ContentQuickReply,
ContentTrigger, HomePage, MessengerBlock, SMSBlock,
USSDBlock, ViberBlock, WhatsappBlock)

PageId = tuple[str, Locale]

Expand Down Expand Up @@ -64,9 +55,9 @@ def __init__(
self.locale = locale
self.locale_map: dict[str, Locale] = {}
self.shadow_pages: dict[PageId, ShadowContentPage] = {}
self.go_to_page_buttons: dict[PageId, dict[int, list[dict[str, Any]]]] = (
defaultdict(lambda: defaultdict(list))
)
self.go_to_page_buttons: dict[
PageId, dict[int, list[dict[str, Any]]]
] = defaultdict(lambda: defaultdict(list))

def locale_from_display_name(self, langname: str) -> Locale:
if langname not in self.locale_map:
Expand Down
6 changes: 2 additions & 4 deletions home/migrations/0032_alter_pageview_timestamp.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Generated by Django 4.1.9 on 2023-06-21 09:23

from django.contrib.postgres.operations import (
AddIndexConcurrently,
RemoveIndexConcurrently,
)
from django.contrib.postgres.operations import (AddIndexConcurrently,
RemoveIndexConcurrently)
from django.db import migrations, models


Expand Down
5 changes: 3 additions & 2 deletions home/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import re

from django.conf import settings
Expand All @@ -14,7 +15,8 @@
from taggit.models import ItemBase, TagBase, TaggedItemBase
from wagtail import blocks
from wagtail.api import APIField
from wagtail.blocks import StreamBlockValidationError, StructBlockValidationError
from wagtail.blocks import (StreamBlockValidationError,
StructBlockValidationError)
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
from wagtail.documents.blocks import DocumentChooserBlock
from wagtail.fields import StreamField
Expand All @@ -40,7 +42,6 @@
ObjectList,
TabbedInterface,
)
import logging

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion home/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from wagtail.models.sites import Site # type: ignore

from home.constants import AGE_CHOICES, GENDER_CHOICES, RELATIONSHIP_STATUS_CHOICES
from home.constants import (AGE_CHOICES, GENDER_CHOICES,
RELATIONSHIP_STATUS_CHOICES)
from home.models import SiteSettings

PFOption = tuple[str, list[str]]
Expand Down
14 changes: 3 additions & 11 deletions home/tests/page_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@
from wagtail.blocks import RichTextBlock, StructBlock # type: ignore
from wagtail.models import Page # type: ignore

from home.models import (
ContentPage,
ContentPageIndex,
ContentQuickReply,
ContentTrigger,
MessengerBlock,
SMSBlock,
USSDBlock,
ViberBlock,
WhatsappBlock,
)
from home.models import (ContentPage, ContentPageIndex, ContentQuickReply,
ContentTrigger, MessengerBlock, SMSBlock, USSDBlock,
ViberBlock, WhatsappBlock)

TPage = TypeVar("TPage", bound=Page)

Expand Down
24 changes: 5 additions & 19 deletions home/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,11 @@
from wagtail import blocks

from home.content_import_export import import_content
from home.models import (
ContentPage,
HomePage,
OrderedContentSet,
PageView,
VariationBlock,
)

from .page_builder import (
MBlk,
MBody,
PageBuilder,
SBlk,
SBody,
UBlk,
UBody,
WABlk,
WABody,
)
from home.models import (ContentPage, HomePage, OrderedContentSet, PageView,
VariationBlock)

from .page_builder import (MBlk, MBody, PageBuilder, SBlk, SBody, UBlk, UBody,
WABlk, WABody)
from .utils import create_page


Expand Down
19 changes: 3 additions & 16 deletions home/tests/test_content_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,9 @@
from home.models import ContentPage, ContentPageIndex, HomePage

from .helpers import set_profile_field_options
from .page_builder import (
MBlk,
MBody,
NextBtn,
PageBtn,
PageBuilder,
SBlk,
SBody,
UBlk,
UBody,
VarMsg,
VBlk,
VBody,
WABlk,
WABody,
)
from .page_builder import (MBlk, MBody, NextBtn, PageBtn, PageBuilder, SBlk,
SBody, UBlk, UBody, VarMsg, VBlk, VBody, WABlk,
WABody)

ExpDict = dict[str, Any]
ExpPair = tuple[ExpDict, ExpDict]
Expand Down
11 changes: 2 additions & 9 deletions home/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@
from wagtail.blocks import StructBlockValidationError
from wagtail.images import get_image_model

from home.models import (
GoToPageButton,
HomePage,
NextMessageButton,
PageView,
SMSBlock,
USSDBlock,
WhatsappBlock,
)
from home.models import (GoToPageButton, HomePage, NextMessageButton, PageView,
SMSBlock, USSDBlock, WhatsappBlock)

from .page_builder import PageBuilder, WABlk, WABody
from .utils import create_page, create_page_rating
Expand Down
14 changes: 2 additions & 12 deletions home/tests/test_page_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,8 @@
from home.models import ContentPage, ContentPageIndex, HomePage

from .helpers import set_profile_field_options
from .page_builder import (
MBlk,
MBody,
NextBtn,
PageBtn,
PageBuilder,
VarMsg,
VBlk,
VBody,
WABlk,
WABody,
)
from .page_builder import (MBlk, MBody, NextBtn, PageBtn, PageBuilder, VarMsg,
VBlk, VBody, WABlk, WABody)


def unwagtail(val): # type: ignore[no-untyped-def] # No type info
Expand Down

0 comments on commit 56bd54c

Please sign in to comment.