Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
Applying isort.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Feb 24, 2020
1 parent d186cfe commit 1576329
Show file tree
Hide file tree
Showing 161 changed files with 525 additions and 610 deletions.
1 change: 0 additions & 1 deletion addressfield/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from .widgets import AddressWidget


basepath = path.dirname(__file__)
filepath = path.abspath(path.join(basepath, "static", "addressfield.min.json"))
with open(filepath, encoding='utf8') as address_data:
Expand Down
1 change: 0 additions & 1 deletion addressfield/widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import forms

from django_countries import countries
from django_select2.forms import Select2Widget

Expand Down
1 change: 1 addition & 0 deletions hypha/apply/activity/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin

from .models import Event, Message


Expand Down
3 changes: 1 addition & 2 deletions hypha/apply/activity/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from django import forms
from django.core.exceptions import ValidationError
from django.utils.safestring import mark_safe

from pagedown.widgets import PagedownWidget

from .models import Activity, VISIBILILTY_HELP_TEXT, VISIBILITY
from .models import VISIBILILTY_HELP_TEXT, VISIBILITY, Activity


class CommentForm(forms.ModelForm):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import argparse
import json

from datetime import datetime, timezone

from django.contrib.auth import get_user_model
Expand Down
6 changes: 3 additions & 3 deletions hypha/apply/activity/messaging.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import json
import requests
import logging
from collections import defaultdict

from django.db import models
import requests
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.db import models
from django.template.loader import render_to_string
from django.utils import timezone

from .models import TEAM, ALL
from .models import ALL, TEAM
from .options import MESSAGES
from .tasks import send_mail

Expand Down
3 changes: 1 addition & 2 deletions hypha/apply/activity/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Case, When, Value
from django.db.models import Case, Value, When
from django.db.models.functions import Concat

from .options import MESSAGES


COMMENT = 'comment'
ACTION = 'action'

Expand Down
1 change: 0 additions & 1 deletion hypha/apply/activity/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from celery import Celery

from django.conf import settings
from django.core.mail import EmailMessage

Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/templatetags/activity_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from hypha.apply.projects.models import Contract
from hypha.apply.review.models import Review

from ..models import TEAM, ALL, REVIEWER
from ..models import ALL, REVIEWER, TEAM

register = template.Library()

Expand Down
9 changes: 8 additions & 1 deletion hypha/apply/activity/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
import factory
from django.utils import timezone

from hypha.apply.activity.models import Activity, Event, TEAM, Message, MESSAGES, REVIEWER
from hypha.apply.activity.models import (
MESSAGES,
REVIEWER,
TEAM,
Activity,
Event,
Message,
)
from hypha.apply.funds.tests.factories import ApplicationSubmissionFactory
from hypha.apply.users.tests.factories import UserFactory

Expand Down
20 changes: 8 additions & 12 deletions hypha/apply/activity/tests/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,35 @@
from unittest.mock import Mock, patch

import responses

from django.contrib.messages import get_messages
from django.core import mail
from django.test import TestCase, override_settings
from django.contrib.messages import get_messages

from hypha.apply.utils.testing import make_request
from hypha.apply.funds.tests.factories import (
ApplicationSubmissionFactory,
AssignedReviewersFactory,
AssignedWithRoleReviewersFactory,
)
from hypha.apply.projects.tests.factories import PaymentRequestFactory, ProjectFactory
from hypha.apply.review.tests.factories import ReviewFactory
from hypha.apply.users.tests.factories import (
ApplicantFactory,
ReviewerFactory,
StaffFactory,
UserFactory
)
from hypha.apply.projects.tests.factories import (
ProjectFactory,
PaymentRequestFactory
UserFactory,
)
from hypha.apply.utils.testing import make_request

from ..models import Activity, Event, Message, TEAM, ALL
from ..messaging import (
AdapterBase,
MESSAGES,
ActivityAdapter,
AdapterBase,
EmailAdapter,
MessengerBackend,
neat_related,
MESSAGES,
SlackAdapter,
neat_related,
)
from ..models import ALL, TEAM, Activity, Event, Message
from .factories import CommentFactory, EventFactory, MessageFactory


Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.test import TestCase

from .factories import CommentFactory
from ..models import Activity
from .factories import CommentFactory


class TestActivityOnlyIncludesCurrent(TestCase):
Expand Down
1 change: 0 additions & 1 deletion hypha/apply/activity/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.test import TestCase

from ..tasks import send_mail

from .factories import MessageFactory


Expand Down
1 change: 0 additions & 1 deletion hypha/apply/activity/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.urls import include, path


app_name = 'activity'


Expand Down
6 changes: 3 additions & 3 deletions hypha/apply/activity/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from django.views.generic import CreateView
from django.utils import timezone
from django.views.generic import CreateView

from hypha.apply.utils.views import DelegatedViewMixin

from .forms import CommentForm
from .messaging import messenger, MESSAGES
from .models import Activity, COMMENT
from .messaging import MESSAGES, messenger
from .models import COMMENT, Activity


class ActivityContextMixin:
Expand Down
2 changes: 0 additions & 2 deletions hypha/apply/api/v1/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import mistune

from django.contrib.auth import get_user_model

from django_bleach.templatetags.bleach_tags import bleach_value
from rest_framework import serializers

Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/api/v1/tests/test_serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.test import override_settings, TestCase
from django.test import TestCase, override_settings

from hypha.apply.funds.tests.factories import ApplicationSubmissionFactory
from hypha.apply.review.tests.factories import ReviewFactory
Expand Down
3 changes: 1 addition & 2 deletions hypha/apply/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.test import TestCase, override_settings
from django.urls import reverse_lazy

from hypha.apply.activity.models import Activity, APPLICANT, ALL
from hypha.apply.activity.models import ALL, APPLICANT, Activity
from hypha.apply.activity.tests.factories import CommentFactory

from hypha.apply.users.tests.factories import UserFactory


Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/api/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
RoundLabDetail,
RoundLabList,
SubmissionAction,
SubmissionList,
SubmissionDetail,
SubmissionList,
)

app_name = 'v1'
Expand Down
30 changes: 15 additions & 15 deletions hypha/apply/api/v1/views.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
from django.db import transaction
from django.db.models import Q, Prefetch
from django.db.models import Prefetch, Q
from django.utils import timezone

from wagtail.core.models import Page

from django_filters import rest_framework as filters
from rest_framework import generics, mixins, permissions
from rest_framework.exceptions import NotFound, PermissionDenied, ValidationError
from rest_framework.response import Response
from rest_framework.exceptions import (NotFound, PermissionDenied,
ValidationError)
from rest_framework_api_key.permissions import HasAPIKey
from django_filters import rest_framework as filters

from hypha.apply.funds.models import ApplicationSubmission, RoundsAndLabs
from hypha.apply.funds.workflow import PHASES
from wagtail.core.models import Page

from hypha.apply.activity.models import Activity, COMMENT
from hypha.apply.activity.messaging import messenger, MESSAGES
from hypha.apply.activity.messaging import MESSAGES, messenger
from hypha.apply.activity.models import COMMENT, Activity
from hypha.apply.determinations.views import DeterminationCreateOrUpdateView
from hypha.apply.funds.models import (
ApplicationSubmission,
FundType,
LabType,
RoundsAndLabs,
)
from hypha.apply.funds.workflow import PHASES
from hypha.apply.review.models import Review
from hypha.apply.funds.models import FundType, LabType

from .pagination import StandardResultsSetPagination
from .permissions import IsApplyStaffUser, IsAuthor
from .serializers import (
CommentSerializer,
CommentCreateSerializer,
CommentEditSerializer,
CommentSerializer,
RoundLabDetailSerializer,
RoundLabSerializer,
SubmissionActionSerializer,
SubmissionListSerializer,
SubmissionDetailSerializer,
SubmissionListSerializer,
)


Expand Down
1 change: 0 additions & 1 deletion hypha/apply/categories/admin_helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib.admin.utils import quote

from wagtail.contrib.modeladmin.helpers import ButtonHelper


Expand Down
1 change: 0 additions & 1 deletion hypha/apply/categories/admin_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.contrib.admin.utils import unquote
from django.shortcuts import get_object_or_404

from wagtail.contrib.modeladmin.views import CreateView


Expand Down
5 changes: 2 additions & 3 deletions hypha/apply/categories/blocks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from django import forms
from django.utils.functional import cached_property, SimpleLazyObject
from django.utils.functional import SimpleLazyObject, cached_property
from django.utils.translation import ugettext_lazy as _

from django_select2.forms import Select2MultipleWidget
from wagtail.core.blocks import BooleanBlock, CharBlock, ChooserBlock, TextBlock
from wagtail.core.utils import resolve_model_string

from hypha.apply.stream_forms.blocks import OptionalFormFieldBlock
from django_select2.forms import Select2MultipleWidget


class ModelChooserBlock(ChooserBlock):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.core.management.base import BaseCommand
from django.db import transaction

from hypha.apply.categories.models import Category, Option
from hypha.apply.categories.categories_seed import CATEGORIES
from hypha.apply.categories.models import Category, Option


class Command(BaseCommand):
Expand Down
10 changes: 2 additions & 8 deletions hypha/apply/categories/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
from django.db import models
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _

from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.admin.edit_handlers import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
)
from treebeard.mp_tree import MP_Node
from wagtail.admin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel
from wagtail.admin.forms import WagtailAdminModelForm
from wagtail.core.fields import RichTextField
from wagtail.core.models import Orderable
from wagtail.search import index

from treebeard.mp_tree import MP_Node


class Option(Orderable):
value = models.CharField(max_length=255)
Expand Down
9 changes: 3 additions & 6 deletions hypha/apply/dashboard/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from hypha.apply.funds.tests.factories import (
ApplicationSubmissionFactory,
ApplicationRevisionFactory,
ApplicationSubmissionFactory,
InvitedToProposalFactory,
)
from hypha.apply.projects.models import (
Expand All @@ -11,17 +11,14 @@
SUBMITTED,
UNDER_REVIEW,
)
from hypha.apply.projects.tests.factories import (
PaymentRequestFactory,
ProjectFactory
)
from hypha.apply.projects.tests.factories import PaymentRequestFactory, ProjectFactory
from hypha.apply.review.tests.factories import ReviewFactory, ReviewOpinionFactory
from hypha.apply.users.groups import APPROVER_GROUP_NAME
from hypha.apply.users.tests.factories import (
ApplicantFactory,
GroupFactory,
ReviewerFactory,
StaffFactory
StaffFactory,
)
from hypha.apply.utils.testing.tests import BaseViewTestCase

Expand Down
1 change: 0 additions & 1 deletion hypha/apply/dashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from .views import DashboardView


app_name = 'dashboard'

urlpatterns = [
Expand Down
9 changes: 3 additions & 6 deletions hypha/apply/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
SubmissionsTable,
SummarySubmissionsTable,
SummarySubmissionsTableWithRole,
review_filter_for_user
review_filter_for_user,
)
from hypha.apply.projects.filters import ProjectListFilter
from hypha.apply.projects.models import (
PaymentRequest,
Project
)
from hypha.apply.projects.models import PaymentRequest, Project
from hypha.apply.projects.tables import (
PaymentRequestsDashboardTable,
ProjectsDashboardTable
ProjectsDashboardTable,
)
from hypha.apply.utils.views import ViewDispatcher

Expand Down
Loading

0 comments on commit 1576329

Please sign in to comment.