From 451ac1876621565170914fa203a01623da7f9bcf Mon Sep 17 00:00:00 2001 From: arbisoft Date: Wed, 10 Jul 2019 15:05:56 +0500 Subject: [PATCH] Fixing python-modernize issues. --- openedx/core/djangoapps/theming/admin.py | 2 ++ openedx/core/djangoapps/theming/apps.py | 4 +++- openedx/core/djangoapps/theming/checks.py | 3 +++ openedx/core/djangoapps/theming/helpers_dirs.py | 6 +++++- openedx/core/djangoapps/theming/helpers_static.py | 2 ++ openedx/core/djangoapps/theming/middleware.py | 2 ++ openedx/core/djangoapps/theming/models.py | 2 ++ openedx/core/djangoapps/theming/paver_helpers.py | 3 ++- openedx/core/djangoapps/theming/template_loaders.py | 2 ++ openedx/core/djangoapps/theming/urls.py | 3 ++- 10 files changed, 25 insertions(+), 4 deletions(-) diff --git a/openedx/core/djangoapps/theming/admin.py b/openedx/core/djangoapps/theming/admin.py index f8bce31414..5c465ad84f 100644 --- a/openedx/core/djangoapps/theming/admin.py +++ b/openedx/core/djangoapps/theming/admin.py @@ -1,6 +1,8 @@ """ Django admin page for theming models """ +from __future__ import absolute_import + from django.contrib import admin from .models import SiteTheme diff --git a/openedx/core/djangoapps/theming/apps.py b/openedx/core/djangoapps/theming/apps.py index e0da5456b8..2ff8a01b06 100644 --- a/openedx/core/djangoapps/theming/apps.py +++ b/openedx/core/djangoapps/theming/apps.py @@ -1,7 +1,9 @@ +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 plugin_urls_config = {PluginURLs.NAMESPACE: u'theming', PluginURLs.REGEX: r'^theming/'} diff --git a/openedx/core/djangoapps/theming/checks.py b/openedx/core/djangoapps/theming/checks.py index bc6c12ba9f..fc0ecd9d1e 100644 --- a/openedx/core/djangoapps/theming/checks.py +++ b/openedx/core/djangoapps/theming/checks.py @@ -1,7 +1,10 @@ """ Settings validations for the theming app """ +from __future__ import absolute_import + import os + import six from django.conf import settings from django.core.checks import Error, Tags, register diff --git a/openedx/core/djangoapps/theming/helpers_dirs.py b/openedx/core/djangoapps/theming/helpers_dirs.py index 7439aed5e9..73f8777bc1 100644 --- a/openedx/core/djangoapps/theming/helpers_dirs.py +++ b/openedx/core/djangoapps/theming/helpers_dirs.py @@ -2,7 +2,10 @@ Code which dynamically discovers comprehensive themes. Deliberately uses no Django settings, as the discovery happens during the initial setup of Django settings. """ +from __future__ import absolute_import + import os + from path import Path @@ -127,7 +130,8 @@ class Theme(object): return hash((self.theme_dir_name, self.path)) def __unicode__(self): - return u"".format(name=self.name, path=self.path) + # pylint: disable=line-too-long + return u"".format(name=self.name, path=self.path) # xss-lint: disable=python-wrap-html def __repr__(self): return self.__unicode__() diff --git a/openedx/core/djangoapps/theming/helpers_static.py b/openedx/core/djangoapps/theming/helpers_static.py index 9fc54c9e03..5dde345b16 100644 --- a/openedx/core/djangoapps/theming/helpers_static.py +++ b/openedx/core/djangoapps/theming/helpers_static.py @@ -1,4 +1,6 @@ +from __future__ import absolute_import + from django.contrib.staticfiles.storage import staticfiles_storage diff --git a/openedx/core/djangoapps/theming/middleware.py b/openedx/core/djangoapps/theming/middleware.py index d2f25321e5..2f082a1fed 100644 --- a/openedx/core/djangoapps/theming/middleware.py +++ b/openedx/core/djangoapps/theming/middleware.py @@ -5,6 +5,8 @@ Note: This middleware depends on "django_sites_extensions" app So it must be added to INSTALLED_APPS in django settings files. """ +from __future__ import absolute_import + from django.conf import settings from .models import SiteTheme diff --git a/openedx/core/djangoapps/theming/models.py b/openedx/core/djangoapps/theming/models.py index e77e2860a3..04e77f6ebf 100644 --- a/openedx/core/djangoapps/theming/models.py +++ b/openedx/core/djangoapps/theming/models.py @@ -1,6 +1,8 @@ """ Django models supporting the Comprehensive Theming subsystem """ +from __future__ import absolute_import + from django.contrib.sites.models import Site from django.db import models diff --git a/openedx/core/djangoapps/theming/paver_helpers.py b/openedx/core/djangoapps/theming/paver_helpers.py index 52d7d1f2f0..06237a2403 100644 --- a/openedx/core/djangoapps/theming/paver_helpers.py +++ b/openedx/core/djangoapps/theming/paver_helpers.py @@ -2,7 +2,8 @@ This file contains helpers for paver commands, Django is not initialized in paver commands. So, django settings, models etc. can not be used here. """ -from __future__ import print_function +from __future__ import absolute_import, print_function + import os from path import Path diff --git a/openedx/core/djangoapps/theming/template_loaders.py b/openedx/core/djangoapps/theming/template_loaders.py index a989b2f71c..6467faa298 100644 --- a/openedx/core/djangoapps/theming/template_loaders.py +++ b/openedx/core/djangoapps/theming/template_loaders.py @@ -1,6 +1,8 @@ """ Theming aware template loaders. """ +from __future__ import absolute_import + from django.template.loaders.filesystem import Loader as FilesystemLoader from edxmako.makoloader import MakoLoader diff --git a/openedx/core/djangoapps/theming/urls.py b/openedx/core/djangoapps/theming/urls.py index 6d6b1fd6fb..bba24e4caf 100644 --- a/openedx/core/djangoapps/theming/urls.py +++ b/openedx/core/djangoapps/theming/urls.py @@ -2,12 +2,13 @@ Defines URLs for theming views. """ +from __future__ import absolute_import + from django.conf.urls import url from .helpers import is_comprehensive_theming_enabled from .views import ThemingAdministrationFragmentView - if is_comprehensive_theming_enabled(): urlpatterns = [ url(