Skip to content

Commit

Permalink
Update to latest isort
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Mar 3, 2022
1 parent 181ac0e commit a5cd177
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions code_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ def status(line):
status("Make any missing migrations")
cmd("python manage.py makemigrations")

status("Running isort")
cmd("isort temba")

status("Running black")
cmd("black --line-length=119 temba")

if not args.skip_flake:
status("Running flake8")
cmd("flake8")

status("Running isort")
cmd("isort -rc temba")

# if any code changes were made, exit with error
if cmd("git diff temba locale"):
print("👎 " + colorama.Fore.RED + "Changes to be committed")
Expand Down
18 changes: 9 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ openpyxl = "^3.0.9"
black = "^21.11b1"
coverage = "^5.5"
flake8 = "3.7.7"
isort = "^4.3.16"
isort = "^5.10.1"
codecov = "^2.1.11"
responses = "^0.12.1"
beautifulsoup4 = "^4.9.3"
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ignore=E501,F405,T003,E203,W503

[isort]
multi_line_output = 3
including_trailing_comma = True
force_grid_wrap = 0
line_length = 119
include_trailing_comma = True
Expand Down
2 changes: 1 addition & 1 deletion temba/channels/types/vk/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Form(ClaimViewMixin.Form):
form_class = Form

def form_valid(self, form):
from .type import CONFIG_COMMUNITY_NAME, CONFIG_CALLBACK_VERIFICATION_STRING
from .type import CONFIG_CALLBACK_VERIFICATION_STRING, CONFIG_COMMUNITY_NAME

org = self.request.user.get_org()
community_access_token = form.cleaned_data["community_access_token"]
Expand Down
3 changes: 2 additions & 1 deletion temba/msgs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
@shared_task(track_started=True, name="send_to_flow_node")
def send_to_flow_node(org_id, user_id, text, **kwargs):
from django.contrib.auth.models import User

from temba.contacts.models import Contact
from temba.orgs.models import Org
from temba.flows.models import FlowRun
from temba.orgs.models import Org

org = Org.objects.get(pk=org_id)
user = User.objects.get(pk=user_id)
Expand Down
10 changes: 5 additions & 5 deletions temba/orgs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ def validate_import(self, import_def):

@classmethod
def export_definitions(cls, site_link, components, include_fields=True, include_groups=True):
from temba.contacts.models import ContactField
from temba.campaigns.models import Campaign
from temba.contacts.models import ContactField
from temba.flows.models import Flow
from temba.triggers.models import Trigger

Expand Down Expand Up @@ -698,14 +698,14 @@ def get_receive_channel(self, scheme=None):
return self.get_channel(Channel.ROLE_RECEIVE, scheme=scheme)

def get_call_channel(self):
from temba.contacts.models import URN
from temba.channels.models import Channel
from temba.contacts.models import URN

return self.get_channel(Channel.ROLE_CALL, scheme=URN.TEL_SCHEME)

def get_answer_channel(self):
from temba.contacts.models import URN
from temba.channels.models import Channel
from temba.contacts.models import URN

return self.get_channel(Channel.ROLE_ANSWER, scheme=URN.TEL_SCHEME)

Expand Down Expand Up @@ -1467,7 +1467,7 @@ def generate_dependency_graph(self, include_campaigns=True, include_triggers=Fal
Generates a dict of all exportable flows and campaigns for this org with each object's immediate dependencies
"""
from temba.campaigns.models import Campaign, CampaignEvent
from temba.contacts.models import ContactGroup, ContactField
from temba.contacts.models import ContactField, ContactGroup
from temba.flows.models import Flow

campaign_prefetches = (
Expand Down Expand Up @@ -1562,8 +1562,8 @@ def initialize(self, branding=None, topup_size=None, sample_flows=True):
"""
Initializes an organization, creating all the dependent objects we need for it to work properly.
"""
from temba.middleware import BrandingMiddleware
from temba.contacts.models import ContactField, ContactGroup
from temba.middleware import BrandingMiddleware
from temba.tickets.models import Ticketer, Topic

with transaction.atomic():
Expand Down
1 change: 1 addition & 0 deletions temba/orgs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3764,6 +3764,7 @@ def get(self, request, *args, **kwargs):

def post(self, request, *args, **kwargs):
import stripe

from temba.orgs.models import Org, TopUp

# stripe delivers a JSON payload
Expand Down
3 changes: 2 additions & 1 deletion temba/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def handler500(request):
Context: None
"""
from sentry_sdk import last_event_id
from django.template import loader

from django.http import HttpResponseServerError
from django.template import loader

t = loader.get_template("500.html")
return HttpResponseServerError(t.render({"request": request, "sentry_id": last_event_id()})) # pragma: needs cover
2 changes: 1 addition & 1 deletion temba/utils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def test_timezone_country_code(self):
class TemplateTagTest(TembaTest):
def test_icon(self):
from temba.campaigns.models import Campaign
from temba.triggers.models import Trigger
from temba.flows.models import Flow
from temba.triggers.models import Trigger
from temba.utils.templatetags.temba import icon

campaign = Campaign.create(self.org, self.admin, "Test Campaign", self.create_group("Test group", []))
Expand Down

0 comments on commit a5cd177

Please sign in to comment.