From b1ff1499538698774a962ccf9603830ddb2d9d4f Mon Sep 17 00:00:00 2001 From: Bill Tucker Date: Wed, 8 May 2019 14:17:47 -0400 Subject: [PATCH] INCR-207 ran python-modernize and isort as described in the case. (#20430) --- .../management/commands/create_dot_application.py | 3 ++- .../management/commands/edx_clear_expired_tokens.py | 2 +- .../management/commands/generate_jwt_signing_key.py | 11 +++++------ .../commands/tests/test_clear_expired_tokens.py | 2 ++ .../commands/tests/test_create_dot_application.py | 2 -- .../commands/tests/test_generate_jwt_signing_key.py | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py index f7d781b924..cea2ebb59b 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py @@ -4,13 +4,14 @@ Management command for creating a Django OAuth Toolkit Application model. Also creates an oauth_dispatch application access if scopes are provided. """ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import logging from django.contrib.auth.models import User from django.core.management.base import BaseCommand from oauth2_provider.models import get_application_model + from openedx.core.djangoapps.oauth_dispatch.models import ApplicationAccess logger = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/edx_clear_expired_tokens.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/edx_clear_expired_tokens.py index bac0f7e34b..2ed07490a7 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/edx_clear_expired_tokens.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/edx_clear_expired_tokens.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import logging from datetime import timedelta diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/generate_jwt_signing_key.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/generate_jwt_signing_key.py index 6e3e3d65d0..0d6e2ba1ef 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/generate_jwt_signing_key.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/generate_jwt_signing_key.py @@ -2,20 +2,19 @@ Management command for generating an asymmetric keypair to sign JSON Web Tokens. """ # pylint: disable=missing-docstring -from __future__ import print_function, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals -import logging import json +import logging import random import string - from argparse import RawTextHelpFormatter -from django.conf import settings -from django.core.management.base import BaseCommand from Cryptodome.PublicKey import RSA +from django.conf import settings +from django.core.management.base import BaseCommand from jwkest import jwk - +from six.moves import range log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_clear_expired_tokens.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_clear_expired_tokens.py index db71e2f325..9390f2953e 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_clear_expired_tokens.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_clear_expired_tokens.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import unittest from datetime import timedelta diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_create_dot_application.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_create_dot_application.py index 5e143cd19a..5e886d3c08 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_create_dot_application.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_create_dot_application.py @@ -4,7 +4,6 @@ Tests the ``create_dot_application`` management command. from __future__ import absolute_import, unicode_literals import ddt - from django.core.management import call_command from django.test import TestCase from oauth2_provider.models import get_application_model @@ -14,7 +13,6 @@ from student.tests.factories import UserFactory from ..create_dot_application import Command - Application = get_application_model() diff --git a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py index 4ba06aab2b..df81d09419 100644 --- a/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py +++ b/openedx/core/djangoapps/oauth_dispatch/management/commands/tests/test_generate_jwt_signing_key.py @@ -2,19 +2,19 @@ Tests the ``generate_jwt_signing_key`` management command. """ # pylint: disable=missing-docstring +from __future__ import absolute_import + import sys from contextlib import contextmanager from StringIO import StringIO import ddt -from mock import patch - from django.core.management import call_command from django.test import TestCase +from mock import patch from openedx.core.djangolib.testing.utils import skip_unless_lms - COMMAND_NAME = 'generate_jwt_signing_key' LOGGER = 'openedx.core.djangoapps.oauth_dispatch.management.commands.generate_jwt_signing_key.log.info' TEST_KEY_IDENTIFIER = 'some_key_identifier'