* INCR-240: Run python-modernize and isort on openedx/core/djangoapps/util

* INCR-240: [ADD] Missing module docstring at ratelimit
This commit is contained in:
Amit
2019-05-10 18:23:05 +03:00
committed by Michael Youngstrom
parent 8ac7177793
commit 13fc8a7dd5
9 changed files with 28 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
"""
Configuration for the openedx.core.djangoapps.util Django application
"""
from __future__ import absolute_import
from django.apps import AppConfig

View File

@@ -1,6 +1,7 @@
"""
Custom forms-related types
"""
from __future__ import absolute_import
from django.core.exceptions import ValidationError
from django.forms import Field, MultipleHiddenInput, NullBooleanField, Select

View File

@@ -3,7 +3,10 @@ Django-based logging utilities
UserIdFilter: A logging.Filter that adds userid to the logging context
"""
from __future__ import absolute_import
from logging import Filter
from crum import get_current_user

View File

@@ -1,3 +1,8 @@
"""
Code to get ip from request.
"""
from __future__ import absolute_import
from ipware.ip import get_ip

View File

@@ -1,10 +1,12 @@
"""
Code to delete rows from a table within a Django mgmt command using best practices.
"""
from __future__ import absolute_import
import logging
import time
from django.core.management.base import CommandError, BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
log = logging.getLogger(__name__)

View File

@@ -2,6 +2,8 @@
Signal handler for exceptions.
"""
# pylint: disable=unused-argument
from __future__ import absolute_import
import logging
from celery.signals import task_postrun

View File

@@ -1,17 +1,19 @@
""" Mixins for setting up particular course structures (such as split tests or cohorted content) """
from __future__ import absolute_import
from datetime import datetime
from pytz import UTC
from openedx.core.djangoapps.django_comment_common.models import Role
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.djangoapps.django_comment_common.models import Role
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.partitions.partitions import UserPartition, Group
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.partitions.partitions import Group, UserPartition
class ContentGroupTestCase(ModuleStoreTestCase):

View File

@@ -13,13 +13,16 @@ There are two common use cases:
the message will be shown on the subsequent page. This is typically
used to show a success message to the use.
"""
from __future__ import absolute_import
from abc import abstractmethod
from enum import Enum
import six
from django.contrib import messages
from django.utils.translation import ugettext as _
from openedx.core.djangolib.markup import Text, HTML
from openedx.core.djangolib.markup import HTML, Text
class UserMessageType(Enum):
@@ -172,7 +175,7 @@ class UserMessageCollection():
"""
return UserMessage(
type=_get_message_type_for_level(message.level),
message_html=unicode(message.message),
message_html=six.text_type(message.message),
)
django_messages = messages.get_messages(request)

View File

@@ -1,6 +1,7 @@
"""
Custom user-related utility code.
"""
from __future__ import absolute_import
from django.contrib.auth.models import AnonymousUser