ran python-modernize and isort on openedx/core/djangoapps/user_authn (#20976)

This commit is contained in:
Aarif
2019-07-11 12:25:22 +05:00
committed by GitHub
parent 868a891b29
commit a6ff5e3005
10 changed files with 20 additions and 11 deletions

View File

@@ -2,9 +2,11 @@
User Authentication Configuration
"""
from __future__ import absolute_import
from django.apps import AppConfig
from openedx.core.djangoapps.plugins.constants import ProjectType, PluginURLs
from openedx.core.djangoapps.plugins.constants import PluginURLs, ProjectType
class UserAuthnConfig(AppConfig):

View File

@@ -1,7 +1,7 @@
"""
Utility functions for setting "logged in" cookies used by subdomains.
"""
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
import json
import logging
@@ -13,10 +13,10 @@ from django.contrib.auth.models import User
from django.dispatch import Signal
from django.urls import NoReverseMatch, reverse
from django.utils.http import cookie_date
from edx_rest_framework_extensions.auth.jwt import cookies as jwt_cookies
from edx_rest_framework_extensions.auth.jwt.constants import JWT_DELIMITER
from oauth2_provider.models import Application
from openedx.core.djangoapps.oauth_dispatch.adapters import DOTAdapter
from openedx.core.djangoapps.oauth_dispatch.api import create_dot_access_token
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_from_token
@@ -24,7 +24,6 @@ from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewi
from openedx.core.djangoapps.user_authn.exceptions import AuthFailedError
from student.models import CourseEnrollment
log = logging.getLogger(__name__)

View File

@@ -1,5 +1,7 @@
""" User Authn related Exceptions. """
from __future__ import absolute_import
from openedx.core.djangolib.markup import Text

View File

@@ -1,10 +1,12 @@
""" URLs for User Authentication """
from __future__ import absolute_import
from django.conf import settings
from django.conf.urls import include, url
from openedx.core.djangoapps.user_api.accounts import settings_views
from .views import login_form, login, deprecated
from .views import deprecated, login, login_form
urlpatterns = [
# TODO this should really be declared in the user_api app

View File

@@ -6,11 +6,12 @@ For now, this is needed because of difference in CMS and LMS that have
not yet been cleaned up.
"""
from __future__ import absolute_import
from django.conf import settings
from django.conf.urls import url
from .views import auto_auth, login, logout, deprecated
from .views import auto_auth, deprecated, login, logout
urlpatterns = [
url(r'^create_account$', deprecated.create_account, name='create_account'),

View File

@@ -1,6 +1,8 @@
"""
Utility functions used during user authentication.
"""
from __future__ import absolute_import
from django.conf import settings
from django.utils import http
from oauth2_provider.models import Application

View File

@@ -20,7 +20,6 @@ from django.views.decorators.http import require_http_methods
from ratelimitbackend.exceptions import RateLimitException
import third_party_auth
from third_party_auth import pipeline, provider
from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.password_policy import compliance as password_policy_compliance
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
@@ -31,6 +30,7 @@ from openedx.core.djangolib.markup import HTML, Text
from student.forms import send_password_reset_email_for_user
from student.models import LoginFailures
from student.views import send_reactivation_email_for_user
from third_party_auth import pipeline, provider
from track import segment
from util.json_request import JsonResponse
from util.password_policy_validators import normalize_password

View File

@@ -14,6 +14,7 @@ from django.utils.translation import ugettext as _
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_http_methods
import third_party_auth
from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site
@@ -32,7 +33,6 @@ from openedx.features.enterprise_support.utils import (
update_logistration_context_for_enterprise
)
from student.helpers import get_next_url_for_login_page
import third_party_auth
from third_party_auth import pipeline
from third_party_auth.decorators import xframe_allow_whitelisted

View File

@@ -2,7 +2,6 @@
from __future__ import absolute_import
import edx_oauth2_provider
from six.moves.urllib.parse import parse_qs, urlsplit, urlunsplit # pylint: disable=import-error
import six.moves.urllib.parse as parse # pylint: disable=import-error
from django.conf import settings
from django.contrib.auth import logout
@@ -10,6 +9,7 @@ from django.shortcuts import redirect
from django.utils.http import urlencode
from django.views.generic import TemplateView
from provider.oauth2.models import Client
from six.moves.urllib.parse import parse_qs, urlsplit, urlunsplit # pylint: disable=import-error
from openedx.core.djangoapps.user_authn.cookies import delete_logged_in_cookies
from openedx.core.djangoapps.user_authn.utils import is_safe_login_or_logout_redirect

View File

@@ -18,6 +18,8 @@ from django.test.client import Client
from django.test.utils import override_settings
from django.urls import NoReverseMatch, reverse
from mock import patch
from six.moves import range
from openedx.core.djangoapps.password_policy.compliance import (
NonCompliantPasswordException,
NonCompliantPasswordWarning
@@ -26,7 +28,6 @@ from openedx.core.djangoapps.user_api.config.waffle import PREVENT_AUTH_USER_WRI
from openedx.core.djangoapps.user_authn.cookies import jwt_cookies
from openedx.core.djangoapps.user_authn.tests.utils import setup_login_oauth_client
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from six.moves import range
from student.tests.factories import RegistrationFactory, UserFactory, UserProfileFactory