Fixing python-modernize issues.

This commit is contained in:
arbisoft
2019-07-10 15:05:56 +05:00
parent 92c7a43011
commit 451ac18766
10 changed files with 25 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
"""
Django admin page for theming models
"""
from __future__ import absolute_import
from django.contrib import admin
from .models import SiteTheme

View File

@@ -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/'}

View File

@@ -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

View File

@@ -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"<Theme: {name} at '{path}'>".format(name=self.name, path=self.path)
# pylint: disable=line-too-long
return u"<Theme: {name} at '{path}'>".format(name=self.name, path=self.path) # xss-lint: disable=python-wrap-html
def __repr__(self):
return self.__unicode__()

View File

@@ -1,4 +1,6 @@
from __future__ import absolute_import
from django.contrib.staticfiles.storage import staticfiles_storage

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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(