Skip to content

Commit

Permalink
style: Run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
bellisk committed Jun 20, 2024
1 parent 9496e3c commit 729c13e
Show file tree
Hide file tree
Showing 23 changed files with 75 additions and 96 deletions.
10 changes: 5 additions & 5 deletions ckanext/subscribe/action.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# encoding: utf-8

import logging
import datetime
import logging

import ckan.plugins as p
from ckan.logic import validate # put in toolkit?
from ckan.lib.mailer import MailerException
from ckan.logic import validate # put in toolkit?

from ckanext.subscribe.model import Subscription, Frequency
from ckanext.subscribe import (
schema,
dictization,
email_verification,
email_auth,
email_verification,
notification,
schema,
)
from ckanext.subscribe.model import Frequency, Subscription

log = logging.getLogger(__name__)
_check_access = p.toolkit.check_access
Expand Down
2 changes: 1 addition & 1 deletion ckanext/subscribe/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

from ckan.plugins.toolkit import _, check_access, auth_allow_anonymous_access
from ckan.plugins.toolkit import _, auth_allow_anonymous_access, check_access


@auth_allow_anonymous_access
Expand Down
2 changes: 1 addition & 1 deletion ckanext/subscribe/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
import datetime
import sys
import time

import ckan.lib.cli as cli
Expand Down
14 changes: 7 additions & 7 deletions ckanext/subscribe/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
import ckan.lib.helpers as h
from ckan import model
from ckan.common import g
from ckan.lib.mailer import MailerException
from ckan.plugins.toolkit import (
ValidationError,
BaseController,
ObjectNotFound,
get_action,
ValidationError,
_,
request,
BaseController,
abort,
render,
redirect_to,
config,
get_action,
redirect_to,
render,
request,
)
from ckan.lib.mailer import MailerException

from ckanext.subscribe import email_auth
from ckanext.subscribe import model as subscribe_model
Expand Down
4 changes: 2 additions & 2 deletions ckanext/subscribe/dictization.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import uuid

from ckan.lib.dictization import table_dict_save, table_dictize
from ckan import model
from ckan.lib.dictization import table_dict_save, table_dictize

from ckanext.subscribe.model import Subscription, Frequency
from ckanext.subscribe.model import Frequency, Subscription


def subscription_save(subscription_dict, context):
Expand Down
3 changes: 2 additions & 1 deletion ckanext/subscribe/email_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import datetime
import random
import string
from six import text_type

import ckan.plugins as p
from ckan import model
from six import text_type

from ckanext.subscribe import mailer
from ckanext.subscribe.interfaces import ISubscribe
from ckanext.subscribe.model import LoginCode
Expand Down
3 changes: 2 additions & 1 deletion ckanext/subscribe/email_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import datetime
import random
import string
from six import text_type

import ckan.plugins as p
from ckan import model
from six import text_type

from ckanext.subscribe import mailer
from ckanext.subscribe.interfaces import ISubscribe

Expand Down
8 changes: 4 additions & 4 deletions ckanext/subscribe/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from ckan.plugins.interfaces import Interface

from ckanext.subscribe.utils import get_footer_contents as subscribe_get_footer_contents
from ckanext.subscribe.utils import filter_activities as subscribe_filter_activities
from ckanext.subscribe.utils import get_email_vars as subscribe_get_email_vars
from ckanext.subscribe.utils import get_footer_contents as subscribe_get_footer_contents
from ckanext.subscribe.utils import (
get_manage_email_contents as subscribe_get_manage_email_contents,
)
from ckanext.subscribe.utils import (
get_subscription_confirmation_email_contents as subscribe_get_subscription_confirmation_email_contents,
get_notification_email_contents as subscribe_get_notification_email_contents,
)
from ckanext.subscribe.utils import (
get_notification_email_contents as subscribe_get_notification_email_contents,
get_subscription_confirmation_email_contents as subscribe_get_subscription_confirmation_email_contents,
)
from ckanext.subscribe.utils import (
get_verification_email_contents as subscribe_get_verification_email_contents,
)
from ckanext.subscribe.utils import filter_activities as subscribe_filter_activities


class ISubscribe(Interface):
Expand Down
8 changes: 3 additions & 5 deletions ckanext/subscribe/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

# For sending HTML emails. Based on core ckan's mailer

from time import time
import smtplib
import socket


from email import utils
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import utils
from time import time

import ckan
import ckan.plugins as p
Expand Down
9 changes: 4 additions & 5 deletions ckanext/subscribe/model.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import logging
import datetime
import logging
from enum import Enum

from sqlalchemy import Table, Column, types

from ckan import model
from ckan.model.meta import metadata, mapper, Session
from ckan.model.types import make_uuid
from ckan.model.domain_object import DomainObject
from ckan.model.meta import Session, mapper, metadata
from ckan.model.types import make_uuid
from sqlalchemy import Column, Table, types

log = logging.getLogger(__name__)

Expand Down
16 changes: 5 additions & 11 deletions ckanext/subscribe/notification.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import datetime
from collections import defaultdict

from ckan import model
from ckan.model import Package, Group, Member
from ckan.lib.dictization import model_dictize
import ckan.plugins.toolkit as toolkit
from ckan import model
from ckan import plugins as p
from ckan.lib.dictization import model_dictize
from ckan.lib.email_notifications import string_to_timedelta
from ckan.model import Group, Member, Package

from ckanext.subscribe import dictization, email_auth, notification_email
from ckanext.subscribe.interfaces import ISubscribe
from ckanext.subscribe import dictization
from ckanext.subscribe.model import (
Subscription,
Subscribe,
Frequency,
)
from ckanext.subscribe import notification_email
from ckanext.subscribe import email_auth
from ckanext.subscribe.model import Frequency, Subscribe, Subscription

log = __import__("logging").getLogger(__name__)

Expand Down
5 changes: 2 additions & 3 deletions ckanext/subscribe/notification_email.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from webhelpers.html import HTML

from ckan import plugins as p
from ckan import model
from ckan import plugins as p
from webhelpers.html import HTML

from ckanext.subscribe import mailer
from ckanext.subscribe.interfaces import ISubscribe
Expand Down
3 changes: 1 addition & 2 deletions ckanext/subscribe/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit

from ckanext.subscribe import action
from ckanext.subscribe import auth
from ckanext.subscribe import action, auth
from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.interfaces import ISubscribe

Expand Down
2 changes: 1 addition & 1 deletion ckanext/subscribe/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ckan.plugins as p
from ckan.common import _

from ckanext.subscribe.model import Subscription, Frequency
from ckanext.subscribe.model import Frequency, Subscription

get_validator = p.toolkit.get_validator
Invalid = p.toolkit.Invalid
Expand Down
5 changes: 2 additions & 3 deletions ckanext/subscribe/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

import datetime

import factory

import ckan.lib.dictization.model_dictize as model_dictize
import ckan.plugins as p
import ckan.tests.factories as ckan_factories
import factory
from ckan import model
from ckan.lib.dictization import table_dictize
import ckan.lib.dictization.model_dictize as model_dictize

import ckanext.subscribe.model
from ckanext.subscribe import dictization
Expand Down
13 changes: 6 additions & 7 deletions ckanext/subscribe/tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
import datetime

import mock
from nose.tools import assert_equal as eq
from nose.tools import assert_raises, assert_in

from ckan.tests import helpers, factories
from ckan.plugins.toolkit import ValidationError
from ckan import model
from ckan.plugins.toolkit import ValidationError
from ckan.tests import factories, helpers
from nose.tools import assert_equal as eq
from nose.tools import assert_in, assert_raises

from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.tests.factories import (
DatasetActivity,
Subscription,
SubscriptionLowLevel,
DatasetActivity,
)
from ckanext.subscribe import model as subscribe_model


class TestSubscribeSignup(object):
Expand Down
7 changes: 3 additions & 4 deletions ckanext/subscribe/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# encoding: utf-8

from nose.tools import assert_raises, assert_in

import ckan.tests.helpers as helpers
import ckan.tests.factories as factories
import ckan.logic as logic
import ckan.tests.factories as factories
import ckan.tests.helpers as helpers
from ckan import model
from nose.tools import assert_in, assert_raises


class TestSubscribeSignupToDataset(object):
Expand Down
14 changes: 5 additions & 9 deletions ckanext/subscribe/tests/test_controller.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# encoding: utf-8

import mock
import datetime

from nose.tools import assert_equal, assert_in

from ckan.tests.helpers import FunctionalTestBase, reset_db, submit_and_follow
import mock
from ckan.tests.factories import Dataset, Group, Organization
from ckan.tests.helpers import FunctionalTestBase, reset_db, submit_and_follow
from nose.tools import assert_equal, assert_in

from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.tests.factories import (
Subscription,
SubscriptionLowLevel,
)
from ckanext.subscribe import email_auth
from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.tests.factories import Subscription, SubscriptionLowLevel

eq = assert_equal

Expand Down
7 changes: 2 additions & 5 deletions ckanext/subscribe/tests/test_email_verification.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# encoding: utf-8

from nose.tools import assert_equal

from ckan import plugins as p
from ckan.tests import factories as ckan_factories
from ckan.tests import helpers
from nose.tools import assert_equal

from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.email_verification import (
get_verification_email_vars,
)
from ckanext.subscribe.email_verification import get_verification_email_vars
from ckanext.subscribe.tests import factories
from ckanext.subscribe.utils import get_footer_contents, get_verification_email_contents

Expand Down
19 changes: 9 additions & 10 deletions ckanext/subscribe/tests/test_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
import datetime

import mock
from nose.tools import assert_equal, assert_in

from ckan.tests import helpers
from ckan.tests.factories import Dataset, Organization, Group
from ckan import model
from ckan.tests import helpers
from ckan.tests.factories import Dataset, Group, Organization
from nose.tools import assert_equal, assert_in

from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe import notification as subscribe_notification
from ckanext.subscribe.model import Frequency
from ckanext.subscribe.notification import (
send_any_immediate_notifications,
dictize_notifications,
get_daily_notifications,
get_immediate_notifications,
send_weekly_notifications_if_its_time_to,
get_weekly_notifications,
most_recent_weekly_notification_datetime,
send_any_immediate_notifications,
send_daily_notifications_if_its_time_to,
get_daily_notifications,
send_emails,
dictize_notifications,
most_recent_weekly_notification_datetime,
send_weekly_notifications_if_its_time_to,
)
from ckanext.subscribe import notification as subscribe_notification
from ckanext.subscribe.tests import factories

eq = assert_equal
Expand Down
11 changes: 5 additions & 6 deletions ckanext/subscribe/tests/test_notification_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

import datetime

import ckan.tests.factories as ckan_factories
import mock
from ckan.tests import helpers
from nose.tools import assert_equal, assert_in
from webhelpers.html import literal

from ckan.tests import helpers
import ckan.tests.factories as ckan_factories

from ckanext.subscribe import model as subscribe_model
from ckanext.subscribe.notification import dictize_notifications
from ckanext.subscribe.notification_email import (
send_notification_email,
get_notification_email_vars,
dataset_link_from_activity,
dataset_href_from_activity,
dataset_link_from_activity,
get_notification_email_vars,
send_notification_email,
)
from ckanext.subscribe.tests import factories
from ckanext.subscribe.utils import get_notification_email_contents
Expand Down
3 changes: 1 addition & 2 deletions ckanext/subscribe/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# encoding: utf-8
from jinja2 import Template

import ckan.plugins as p
from ckan import model
from ckan.model import Activity
from jinja2 import Template

config = p.toolkit.config

Expand Down
Loading

0 comments on commit 729c13e

Please sign in to comment.