From 6031b220f5a1a7f3d3bdff7630441c25fc38d10e Mon Sep 17 00:00:00 2001 From: Bill Tucker Date: Tue, 7 May 2019 14:15:24 -0400 Subject: [PATCH] INCR-208: run python-modernize and isort (#20434) * INCR-208: run python-modernize and isort This change supports python2 -> python3 transition. * INCR-208: combine import statements for cleaner look. * INCR-208: combine import from __future__ statements for cleaner look. --- openedx/core/djangoapps/oauth_dispatch/adapters/dop.py | 1 + openedx/core/djangoapps/oauth_dispatch/adapters/dot.py | 1 + .../djangoapps/oauth_dispatch/dot_overrides/backends.py | 1 + .../djangoapps/oauth_dispatch/dot_overrides/validators.py | 3 +-- .../core/djangoapps/oauth_dispatch/dot_overrides/views.py | 3 +-- .../djangoapps/oauth_dispatch/migrations/0001_initial.py | 4 ++-- .../0002_scopedapplication_scopedapplicationorganization.py | 6 +++--- .../oauth_dispatch/migrations/0003_application_data.py | 2 +- .../oauth_dispatch/migrations/0004_auto_20180626_1349.py | 6 +++--- .../migrations/0005_applicationaccess_type.py | 4 ++-- .../migrations/0006_drop_application_id_constraints.py | 4 ++-- .../migrations/0007_restore_application_id_constraints.py | 4 ++-- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/openedx/core/djangoapps/oauth_dispatch/adapters/dop.py b/openedx/core/djangoapps/oauth_dispatch/adapters/dop.py index e9a1eee5da..8948e9a92a 100644 --- a/openedx/core/djangoapps/oauth_dispatch/adapters/dop.py +++ b/openedx/core/djangoapps/oauth_dispatch/adapters/dop.py @@ -2,6 +2,7 @@ Adapter to isolate django-oauth2-provider dependencies """ +from __future__ import absolute_import from provider.oauth2 import models from provider import constants, scope diff --git a/openedx/core/djangoapps/oauth_dispatch/adapters/dot.py b/openedx/core/djangoapps/oauth_dispatch/adapters/dot.py index c83e1c4cff..5994860427 100644 --- a/openedx/core/djangoapps/oauth_dispatch/adapters/dot.py +++ b/openedx/core/djangoapps/oauth_dispatch/adapters/dot.py @@ -2,6 +2,7 @@ Adapter to isolate django-oauth-toolkit dependencies """ +from __future__ import absolute_import from oauth2_provider import models from openedx.core.djangoapps.oauth_dispatch.models import RestrictedApplication diff --git a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/backends.py b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/backends.py index 664d0d7916..27682a0291 100644 --- a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/backends.py +++ b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/backends.py @@ -1,6 +1,7 @@ """ Custom authentication backends. """ +from __future__ import absolute_import from django.contrib.auth.backends import AllowAllUsersModelBackend as UserModelBackend from ratelimitbackend.backends import RateLimitMixin diff --git a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/validators.py b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/validators.py index 5c9aa5ddb6..77e9e45857 100644 --- a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/validators.py +++ b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/validators.py @@ -1,8 +1,7 @@ """ Classes that override default django-oauth-toolkit behavior """ -from __future__ import unicode_literals - +from __future__ import unicode_literals, absolute_import from datetime import datetime, timedelta from django.contrib.auth import authenticate, get_user_model diff --git a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/views.py b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/views.py index 04329e2b64..6e59fbfc92 100644 --- a/openedx/core/djangoapps/oauth_dispatch/dot_overrides/views.py +++ b/openedx/core/djangoapps/oauth_dispatch/dot_overrides/views.py @@ -1,8 +1,7 @@ """ Classes that override default django-oauth-toolkit behavior """ -from __future__ import unicode_literals - +from __future__ import unicode_literals, absolute_import from oauth2_provider.exceptions import OAuthToolkitError from oauth2_provider.http import HttpResponseUriRedirect from oauth2_provider.models import get_access_token_model, get_application_model diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0001_initial.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0001_initial.py index 67ac35c2a3..f257e36a99 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0001_initial.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0001_initial.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.db import migrations, models from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0002_scopedapplication_scopedapplicationorganization.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0002_scopedapplication_scopedapplicationorganization.py index 17e78f09a4..44958c9daf 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0002_scopedapplication_scopedapplicationorganization.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0002_scopedapplication_scopedapplicationorganization.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-20 18:22 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django_mysql.models import oauth2_provider.generators import oauth2_provider.validators +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0003_application_data.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0003_application_data.py index 2727d5960f..0277e88654 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0003_application_data.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0003_application_data.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-05 13:19 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from django.conf import settings from django.db import migrations diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0004_auto_20180626_1349.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0004_auto_20180626_1349.py index 63266b36c8..8ec37e3708 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0004_auto_20180626_1349.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0004_auto_20180626_1349.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-26 17:49 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django_mysql.models +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py index 5692f63b5a..7106ec9d92 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-29 18:18 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0006_drop_application_id_constraints.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0006_drop_application_id_constraints.py index 0738e0b264..3a79ab4df2 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0006_drop_application_id_constraints.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0006_drop_application_id_constraints.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-23 14:58 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0007_restore_application_id_constraints.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0007_restore_application_id_constraints.py index 8a2b93a63c..e8c3791c5f 100644 --- a/openedx/core/djangoapps/oauth_dispatch/migrations/0007_restore_application_id_constraints.py +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0007_restore_application_id_constraints.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-23 15:12 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration):