Removed most of absolute_import imports

Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
This commit is contained in:
Claude Paroz 2013-07-29 19:19:04 +02:00
parent 402b4a7a20
commit 5c1143910e
264 changed files with 194 additions and 366 deletions

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import unittest import unittest

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django import http from django import http
from django.conf import settings from django.conf import settings
from django.contrib import comments from django.contrib import comments

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django import template from django import template
from django.conf import settings from django.conf import settings
from django.contrib import comments from django.contrib import comments

View File

@ -2,8 +2,6 @@
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only. This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
""" """
from __future__ import absolute_import
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.contrib.formtools.tests.tests import TestFormPreview from django.contrib.formtools.tests.tests import TestFormPreview

View File

@ -11,8 +11,6 @@
Grab GeoIP.dat.gz and GeoLiteCity.dat.gz, and unzip them in the directory Grab GeoIP.dat.gz and GeoLiteCity.dat.gz, and unzip them in the directory
corresponding to settings.GEOIP_PATH. corresponding to settings.GEOIP_PATH.
""" """
from __future__ import absolute_import
try: try:
from .base import GeoIP, GeoIPException from .base import GeoIP, GeoIPException
HAS_GEOIP = True HAS_GEOIP = True

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import os import os
import re import re

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.contrib.gis import feeds from django.contrib.gis import feeds

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from .feeds import feed_dict from .feeds import feed_dict

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless
from xml.dom import minidom from xml.dom import minidom

View File

@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from datetime import datetime from datetime import datetime
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from io import BytesIO from io import BytesIO
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import re import re
import unittest import unittest

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.conf.urls import patterns from django.conf.urls import patterns

View File

@ -1,7 +1,7 @@
""" """
Tests for geography support in PostGIS 1.5+ Tests for geography support in PostGIS 1.5+
""" """
from __future__ import absolute_import from __future__ import unicode_literals
import os import os
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import os import os
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,5 +1,5 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from copy import copy from copy import copy
from decimal import Decimal from decimal import Decimal

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from unittest import skipUnless from unittest import skipUnless

View File

@ -1,4 +1,2 @@
from __future__ import absolute_import
from django.contrib.messages.api import * from django.contrib.messages.api import *
from django.contrib.messages.constants import * from django.contrib.messages.constants import *

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import hashlib import hashlib
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import os import os
from subprocess import PIPE, Popen from subprocess import PIPE, Popen

View File

@ -4,6 +4,7 @@ Serialize data to/from JSON
# Avoid shadowing the standard library json module # Avoid shadowing the standard library json module
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import unicode_literals
import datetime import datetime
import decimal import decimal

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.datastructures import EmptyResultSet
from django.db.models.sql.subqueries import * from django.db.models.sql.subqueries import *
from django.db.models.sql.query import * from django.db.models.sql.query import *

View File

@ -2,8 +2,6 @@
Code to manage the creation and SQL rendering of 'where' constraints. Code to manage the creation and SQL rendering of 'where' constraints.
""" """
from __future__ import absolute_import
import collections import collections
import datetime import datetime
from itertools import repeat from itertools import repeat

View File

@ -2,8 +2,6 @@
Django validation and HTML form handling. Django validation and HTML form handling.
""" """
from __future__ import absolute_import
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.forms.fields import * from django.forms.fields import *
from django.forms.forms import * from django.forms.forms import *

View File

@ -1,3 +1 @@
from __future__ import absolute_import
from django.forms.extras.widgets import * from django.forms.extras.widgets import *

View File

@ -2,7 +2,7 @@
Field classes. Field classes.
""" """
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import copy import copy
import datetime import datetime

View File

@ -2,7 +2,7 @@
Form classes Form classes
""" """
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import copy import copy
import warnings import warnings

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.forms import Form from django.forms import Form

View File

@ -3,7 +3,7 @@ Helper functions for creating Form classes from Django models
and database field objects. and database field objects.
""" """
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import warnings import warnings

View File

@ -2,7 +2,7 @@
HTML Widget classes HTML Widget classes
""" """
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import copy import copy
from itertools import chain from itertools import chain

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.utils.encoding import force_str from django.utils.encoding import force_str
from django.utils import six from django.utils import six

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import copy import copy
import os import os

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime
import time import time

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import re import re
from functools import partial from functools import partial

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from django.core.paginator import Paginator from django.core.paginator import Paginator

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import warnings import warnings
from django.contrib.admin.util import quote from django.contrib.admin.util import quote

View File

@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns from django.conf.urls import patterns
from . import views from . import views

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from django import forms from django import forms

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django.contrib.admin.helpers import InlineAdminForm from django.contrib.admin.helpers import InlineAdminForm

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include from django.conf.urls import patterns, include
from . import admin from . import admin

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory
from django.contrib import admin from django.contrib import admin

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.contrib import admin from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from ..models.foo import Foo from ..models.foo import Foo

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.db import models from django.db import models
from ..admin import foo from ..admin import foo

View File

@ -1,3 +1 @@
from __future__ import absolute_import
from ..complex_app.models.bar import Bar from ..complex_app.models.bar import Bar

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from datetime import datetime from datetime import datetime

View File

@ -1,9 +1,10 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from django.test.utils import str_prefix
from .models import Song, Book, Album, TwoAlbumFKAndAnE, State, City from .models import Song, Book, Album, TwoAlbumFKAndAnE, State, City
@ -185,7 +186,8 @@ class ValidationTestCase(TestCase):
readonly_fields = ("title", "nonexistant") readonly_fields = ("title", "nonexistant")
self.assertRaisesMessage(ImproperlyConfigured, self.assertRaisesMessage(ImproperlyConfigured,
"SongAdmin.readonly_fields[1], 'nonexistant' is not a callable or an attribute of 'SongAdmin' or found in the model 'Song'.", str_prefix("SongAdmin.readonly_fields[1], %(_)s'nonexistant' is not a callable "
"or an attribute of 'SongAdmin' or found in the model 'Song'."),
SongAdmin.validate, SongAdmin.validate,
Song) Song)
@ -195,7 +197,8 @@ class ValidationTestCase(TestCase):
readonly_fields=['i_dont_exist'] # Missing attribute readonly_fields=['i_dont_exist'] # Missing attribute
self.assertRaisesMessage(ImproperlyConfigured, self.assertRaisesMessage(ImproperlyConfigured,
"CityInline.readonly_fields[0], 'i_dont_exist' is not a callable or an attribute of 'CityInline' or found in the model 'City'.", str_prefix("CityInline.readonly_fields[0], %(_)s'i_dont_exist' is not a callable "
"or an attribute of 'CityInline' or found in the model 'City'."),
CityInline.validate, CityInline.validate,
City) City)

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import tempfile import tempfile
import os import os

View File

@ -1,7 +1,7 @@
""" """
A second, custom AdminSite -- see tests.CustomAdminSiteTests. A second, custom AdminSite -- see tests.CustomAdminSiteTests.
""" """
from __future__ import absolute_import from __future__ import unicode_literals
from django.conf.urls import patterns from django.conf.urls import patterns
from django.contrib import admin from django.contrib import admin

View File

@ -1,5 +1,5 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import os import os
import re import re

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include from django.conf.urls import patterns, include
from . import views, customadmin, admin from . import views, customadmin, admin

View File

@ -1,5 +1,5 @@
# encoding: utf-8 # encoding: utf-8
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from datetime import datetime, timedelta from datetime import datetime, timedelta
from unittest import TestCase from unittest import TestCase

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include from django.conf.urls import patterns, include
from . import widgetadmin from . import widgetadmin

View File

@ -1,8 +1,3 @@
"""
"""
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from . import models from . import models
@ -47,4 +42,4 @@ site.register(models.Bee)
site.register(models.Advisor) site.register(models.Advisor)
site.register(models.School, SchoolAdmin) site.register(models.School, SchoolAdmin)

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import datetime import datetime
from decimal import Decimal from decimal import Decimal

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime
import pickle import pickle

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import copy import copy
import os import os

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends. # Unit and doctests for specific database backends.
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime
from decimal import Decimal from decimal import Decimal

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from datetime import datetime from datetime import datetime
import threading import threading

View File

@ -4,8 +4,6 @@ gets called *again* for each FileField. This test will fail if calling a
ModelForm's save() method causes Model.save() to be called more than once. ModelForm's save() method causes Model.save() to be called more than once.
""" """
from __future__ import absolute_import
import os import os
import shutil import shutil
import unittest import unittest

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from .models import Story from .models import Story

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from operator import attrgetter from operator import attrgetter

View File

@ -2,7 +2,7 @@
# Unit tests for cache framework # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file. # Uses whatever cache backend is set in the test settings file.
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import hashlib import hashlib
import os import os

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from .models import Person from .models import Person

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.comments.forms import CommentForm from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib import comments from django.contrib import comments
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
import time import time
from django.conf import settings from django.conf import settings

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment
from django.contrib.comments.moderation import (moderator, CommentModerator, from django.contrib.comments.moderation import (moderator, CommentModerator,
AlreadyModerated) AlreadyModerated)

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import re import re

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from xml.etree import ElementTree as ET from xml.etree import ElementTree as ET
from django.conf import settings from django.conf import settings

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment
from . import CommentTestCase from . import CommentTestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.contrib.auth.models import User, Permission from django.contrib.auth.models import User, Permission
from django.contrib.comments import signals from django.contrib.comments import signals

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.contrib.comments.forms import CommentForm from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.contrib.comments.feeds import LatestCommentFeed from django.contrib.comments.feeds import LatestCommentFeed

View File

@ -1,6 +1,3 @@
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from django.views.decorators.http import condition, etag, last_modified from django.views.decorators.http import condition, etag, last_modified
from django.http import HttpResponse from django.http import HttpResponse

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.conf.urls import patterns from django.conf.urls import patterns

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from . import views from . import views

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from datetime import date from datetime import date

View File

@ -6,7 +6,7 @@ By default, Django adds an ``"id"`` field to each model. But you can override
this behavior by explicitly adding ``primary_key=True`` to a field. this behavior by explicitly adding ``primary_key=True`` to a field.
""" """
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
from django.db import transaction, IntegrityError from django.db import transaction, IntegrityError
from django.test import TestCase, skipIfDBFeature from django.test import TestCase, skipIfDBFeature

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals from __future__ import unicode_literals
import datetime import datetime

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import datetime import datetime

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import datetime import datetime

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.db.models.query_utils import DeferredAttribute, InvalidQuery from django.db.models.query_utils import DeferredAttribute, InvalidQuery
from django.test import TestCase from django.test import TestCase

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from operator import attrgetter from operator import attrgetter

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.db import models, IntegrityError, connection from django.db import models, IntegrityError, connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
import datetime import datetime

View File

@ -2,7 +2,5 @@
Unit-tests for the dispatch project Unit-tests for the dispatch project
""" """
from __future__ import absolute_import
from .test_dispatcher import DispatcherTests, ReceiverTestCase from .test_dispatcher import DispatcherTests, ReceiverTestCase
from .test_saferef import SaferefTests from .test_saferef import SaferefTests

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import unicode_literals
from django.db.models import Max from django.db.models import Max
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.db.models.loading import get_app from django.db.models.loading import get_app
from django.test import TestCase from django.test import TestCase

Some files were not shown because too many files have changed in this diff Show More