Skip to content

Commit

Permalink
Fix part of oppia#3905: Add lint checks for alphabetical import order (
Browse files Browse the repository at this point in the history
…oppia#4343)

* Fixes part of oppia#3905

* Corrected import order

* Files corrected

* set check to True

* Review changes made
  • Loading branch information
apb7 authored and seanlip committed Jan 6, 2018
1 parent aff3fbd commit 60067ed
Show file tree
Hide file tree
Showing 96 changed files with 169 additions and 119 deletions.
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
force_single_line=true
force_sort_within_sections=true
known_third_party=browsermobproxy,cloudstorage,google.appengine,jinja2,mapreduce,mutagen,numpy,pipeline,pylint,requests,selenium,skulpt,webapp2,webapp2_extras,webtest,yaml
line_length=80
sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER
1 change: 1 addition & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import json
import os


def parse_json_from_js(js_file):
"""Extracts JSON object from JS file."""
text = js_file.read()
Expand Down
5 changes: 3 additions & 2 deletions constants_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

import os

import constants #pylint: disable=relative-import
from core.tests import test_utils #pylint: disable=relative-import
import constants # pylint: disable=relative-import
from core.tests import test_utils # pylint: disable=relative-import


class ConstantsTests(test_utils.GenericTestBase):

Expand Down
4 changes: 2 additions & 2 deletions core/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import logging
import random

import jinja2

from core import jobs
from core import jobs_registry
from core.controllers import base
Expand All @@ -38,6 +36,8 @@
import feconf
import utils

import jinja2

current_user_services = models.Registry.import_current_user_services()


Expand Down
1 change: 0 additions & 1 deletion core/controllers/admin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from core.domain import stats_domain
from core.domain import stats_services
from core.tests import test_utils

import feconf

BOTH_MODERATOR_AND_ADMIN_EMAIL = 'moderator.and.admin@example.com'
Expand Down
10 changes: 5 additions & 5 deletions core/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Base constants and handlers."""

import base64
import Cookie
import base64
import datetime
import hmac
import json
Expand All @@ -26,10 +26,6 @@
import traceback
import urlparse

import jinja2
import webapp2
from google.appengine.api import users

from core.domain import config_domain
from core.domain import config_services
from core.domain import rights_manager
Expand All @@ -40,6 +36,10 @@
import jinja_utils
import utils

from google.appengine.api import users
import jinja2
import webapp2

app_identity_services = models.Registry.import_app_identity_services()
current_user_services = models.Registry.import_current_user_services()
(user_models,) = models.Registry.import_models([models.NAMES.user])
Expand Down
1 change: 0 additions & 1 deletion core/controllers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import main
import utils


import webapp2
import webtest

Expand Down
1 change: 0 additions & 1 deletion core/controllers/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from core.domain import acl_decorators
from core.domain import classifier_services
from core.domain import config_domain

import feconf


Expand Down
2 changes: 1 addition & 1 deletion core/controllers/collection_editor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Tests for the collection editor page."""

from core.domain import collection_services
from core.domain import collection_domain
from core.domain import collection_services
from core.domain import rights_manager
from core.domain import user_services
from core.tests import test_utils
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/creator_dashboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from core.domain import feedback_domain
from core.domain import feedback_services
from core.domain import rating_services
from core.domain import subscription_services
from core.domain import rights_manager
from core.domain import stats_jobs_continuous_test
from core.domain import subscription_services
from core.domain import user_jobs_continuous
from core.domain import user_jobs_continuous_test
from core.domain import user_services
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import logging

from pipeline import pipeline

from core import jobs
from core.controllers import base
from core.domain import acl_decorators
Expand All @@ -28,6 +26,8 @@
from core.platform import models
import utils

from pipeline import pipeline

(job_models,) = models.Registry.import_models([models.NAMES.job])

# The default retention time is 2 days.
Expand Down
1 change: 1 addition & 0 deletions core/controllers/custom_landing_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""Controllers for custom landing pages."""

import random

from core.controllers import base
from core.domain import acl_decorators

Expand Down
11 changes: 5 additions & 6 deletions core/controllers/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@

"""Controllers for the editor view."""

import StringIO
import datetime
import imghdr
import logging
import re
import StringIO

import jinja2
import mutagen
from mutagen import mp3

from constants import constants
from core.controllers import base
Expand All @@ -45,10 +41,13 @@
from core.domain import value_generators_domain
from core.domain import visualization_registry
from core.platform import models

import feconf
import utils

import jinja2
import mutagen
from mutagen import mp3

app_identity_services = models.Registry.import_app_identity_services()
current_user_services = models.Registry.import_current_user_services()
(user_models,) = models.Registry.import_models([models.NAMES.user])
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/editor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

"""Tests for the exploration editor page."""

import StringIO
import datetime
import logging
import os
import StringIO
import zipfile

from core import jobs_registry
Expand All @@ -27,8 +27,8 @@
from core.domain import event_services
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import stats_jobs_continuous_test
from core.domain import rights_manager
from core.domain import stats_jobs_continuous_test
from core.domain import user_services
from core.platform import models
from core.platform.taskqueue import gae_taskqueue_services as taskqueue_services
Expand Down
1 change: 0 additions & 1 deletion core/controllers/email_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from core.domain import user_query_services
from core.domain import user_services
from core.platform import models

import feconf

(user_models,) = models.Registry.import_models([models.NAMES.user])
Expand Down
1 change: 0 additions & 1 deletion core/controllers/email_dashboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from core.platform import models
from core.tests import test_utils

import feconf

(user_models, email_models) = models.Registry.import_models(
Expand Down
1 change: 0 additions & 1 deletion core/controllers/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from core.platform import models
import feconf


transaction_services = models.Registry.import_transaction_services()


Expand Down
5 changes: 3 additions & 2 deletions core/controllers/feedback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

"""Tests for the feedback controllers."""

import feconf
from core.tests import test_utils
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import feedback_services
from core.domain import rights_manager
from core.domain import user_services
from core.platform import models
from core.tests import test_utils
import feconf

(feedback_models,) = models.Registry.import_models([models.NAMES.feedback])


Expand Down
4 changes: 2 additions & 2 deletions core/controllers/incoming_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

"""Controllers for incoming email handlers."""

from google.appengine.api import mail

from core.controllers import base
from core.domain import acl_decorators
from core.domain import feedback_services
from core.platform import models

from google.appengine.api import mail

(email_models,) = models.Registry.import_models([models.NAMES.email])


Expand Down
1 change: 1 addition & 0 deletions core/controllers/learner_dashboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from core.tests import test_utils
import feconf


class LearnerDashboardHandlerTest(test_utils.GenericTestBase):

OWNER_EMAIL = 'owner@example.com'
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/learner_playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from constants import constants
from core.controllers import base
from core.domain import acl_decorators
from core.domain import learner_progress_services
from core.domain import learner_playlist_services
from core.domain import learner_progress_services


class LearnerPlaylistHandler(base.BaseHandler):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import string

from constants import constants
from core.domain import acl_decorators
from core.controllers import base
from core.domain import acl_decorators
from core.domain import collection_services
from core.domain import exp_services
from core.domain import summary_services
Expand Down
1 change: 0 additions & 1 deletion core/controllers/library_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import feconf
import utils


CAN_EDIT_STR = 'can_edit'


Expand Down
1 change: 0 additions & 1 deletion core/controllers/profile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""Tests for the profile page."""

from constants import constants

from core.domain import exp_services
from core.domain import rights_manager
from core.domain import subscription_services
Expand Down
1 change: 1 addition & 0 deletions core/controllers/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from core.domain import question_services
import feconf


class QuestionsBatchHandler(base.BaseHandler):
"""This handler completes requests for questions batch."""

Expand Down
4 changes: 2 additions & 2 deletions core/controllers/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import logging
import random

import jinja2

from constants import constants
from core.controllers import base
from core.domain import acl_decorators
Expand All @@ -42,6 +40,8 @@
import feconf
import utils

import jinja2

MAX_SYSTEM_RECOMMENDATIONS = 4

DEFAULT_TWITTER_SHARE_MESSAGE_PLAYER = config_domain.ConfigProperty(
Expand Down
1 change: 1 addition & 0 deletions core/domain/acl_decorators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from core.domain import user_services
from core.tests import test_utils
import feconf

import webapp2
import webtest

Expand Down
2 changes: 1 addition & 1 deletion core/domain/activity_jobs_one_off_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# limitations under the License.

from core.domain import activity_jobs_one_off
from core.domain import collection_services
from core.domain import collection_domain
from core.domain import collection_services
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import rights_manager
Expand Down
1 change: 1 addition & 0 deletions core/domain/activity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from constants import constants
from core.domain import activity_domain
from core.platform import models

(activity_models,) = models.Registry.import_models([models.NAMES.activity])


Expand Down
2 changes: 0 additions & 2 deletions core/domain/classifier_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
"""Services for classifier data models."""

import datetime

import logging

from core.domain import classifier_domain
from core.domain import classifier_registry
from core.domain import exp_domain
from core.domain import interaction_registry
from core.platform import models

import feconf

(classifier_models, exp_models) = models.Registry.import_models(
Expand Down
1 change: 0 additions & 1 deletion core/domain/collection_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import feconf
import utils


# Do not modify the values of these constants. This is to preserve backwards
# compatibility with previous change dicts.
COLLECTION_PROPERTY_TITLE = 'title'
Expand Down
1 change: 0 additions & 1 deletion core/domain/config_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Domain objects for configuration properties."""

from core.platform import models

import feconf
import schema_utils

Expand Down
1 change: 1 addition & 0 deletions core/domain/email_subscription_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from core.domain import email_manager


def inform_subscribers(creator_id, exploration_id, exploration_title):
email_manager.send_emails_to_subscribers(
creator_id, exploration_id, exploration_title)
Loading

0 comments on commit 60067ed

Please sign in to comment.