Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #16225 -- Removed unused imports. Many thanks to Aymeric August…

…in for the work on the patch and Alex for reviewing.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 24f4764a48e4141923a78c8820e4cd7b411ec0fc 1 parent 956da72
@jezdez jezdez authored
Showing with 307 additions and 484 deletions.
  1. +2 −1  django/bin/profiling/gather_profile_stats.py
  2. +1 −3 django/contrib/admin/templatetags/admin_list.py
  3. +0 −1  django/contrib/admin/widgets.py
  4. +5 −2 django/contrib/admindocs/views.py
  5. +0 −1  django/contrib/auth/__init__.py
  6. +0 −1  django/contrib/auth/backends.py
  7. +3 −2 django/contrib/auth/forms.py
  8. +2 −2 django/contrib/auth/management/__init__.py
  9. +3 −2 django/contrib/auth/models.py
  10. +0 −2  django/contrib/auth/tests/auth_backends.py
  11. +0 −1  django/contrib/auth/tests/forms.py
  12. +1 −1  django/contrib/auth/tests/tokens.py
  13. +0 −6 django/contrib/formtools/preview.py
  14. +0 −1  django/contrib/formtools/utils.py
  15. +0 −1  django/contrib/formtools/wizard/storage/session.py
  16. +0 −3  django/contrib/formtools/wizard/tests/namedwizardtests/tests.py
  17. +0 −1  django/contrib/formtools/wizard/views.py
  18. +0 −1  django/contrib/gis/admin/options.py
  19. +0 −1  django/contrib/gis/admin/widgets.py
  20. +0 −1  django/contrib/gis/db/backends/base.py
  21. +0 −1  django/contrib/gis/db/backends/oracle/models.py
  22. +3 −2 django/contrib/gis/db/backends/spatialite/base.py
  23. +4 −4 django/contrib/gis/db/models/__init__.py
  24. +3 −3 django/contrib/gis/db/models/query.py
  25. +0 −1  django/contrib/gis/db/models/sql/aggregates.py
  26. +1 −1  django/contrib/gis/db/models/sql/where.py
  27. +1 −1  django/contrib/gis/feeds.py
  28. +1 −1  django/contrib/gis/gdal/datasource.py
  29. +0 −1  django/contrib/gis/gdal/feature.py
  30. +2 −1  django/contrib/gis/gdal/libgdal.py
  31. +2 −3 django/contrib/gis/gdal/prototypes/ds.py
  32. +3 −3 django/contrib/gis/gdal/prototypes/generation.py
  33. +3 −6 django/contrib/gis/gdal/prototypes/geom.py
  34. +2 −3 django/contrib/gis/gdal/prototypes/srs.py
  35. +2 −3 django/contrib/gis/gdal/srs.py
  36. +1 −1  django/contrib/gis/gdal/tests/test_driver.py
  37. +11 −8 django/contrib/gis/gdal/tests/test_geom.py
  38. +2 −3 django/contrib/gis/geometry/backend/geos.py
  39. +1 −1  django/contrib/gis/geos/base.py
  40. +2 −2 django/contrib/gis/geos/collections.py
  41. +1 −2  django/contrib/gis/geos/geometry.py
  42. +3 −1 django/contrib/gis/geos/libgeos.py
  43. +0 −1  django/contrib/gis/geos/polygon.py
  44. +13 −13 django/contrib/gis/geos/prototypes/__init__.py
  45. +4 −4 django/contrib/gis/geos/prototypes/geom.py
  46. +1 −1  django/contrib/gis/geos/prototypes/topology.py
  47. +3 −1 django/contrib/gis/geos/tests/test_geos.py
  48. +0 −1  django/contrib/gis/geos/tests/test_geos_mutation.py
  49. +2 −1  django/contrib/gis/geos/tests/test_io.py
  50. +0 −3  django/contrib/gis/management/commands/inspectdb.py
  51. +1 −1  django/contrib/gis/management/commands/ogrinspect.py
  52. +6 −3 django/contrib/gis/maps/google/gmap.py
  53. +1 −1  django/contrib/gis/maps/google/zoom.py
  54. +7 −2 django/contrib/gis/shortcuts.py
  55. +3 −6 django/contrib/gis/tests/distapp/tests.py
  56. +3 −3 django/contrib/gis/tests/geo3d/tests.py
  57. +1 −2  django/contrib/gis/tests/geoapp/feeds.py
  58. +2 −2 django/contrib/gis/tests/geoapp/test_regress.py
  59. +5 −2 django/contrib/gis/tests/geoapp/test_sitemaps.py
  60. +5 −6 django/contrib/gis/tests/geoapp/tests.py
  61. +0 −1  django/contrib/gis/tests/geogapp/tests.py
  62. +4 −4 django/contrib/gis/tests/layermap/tests.py
  63. +2 −1  django/contrib/gis/tests/test_geoip.py
  64. +1 −1  django/contrib/gis/tests/test_spatialrefsys.py
  65. +2 −1  django/contrib/gis/utils/geoip.py
  66. +4 −5 django/contrib/gis/utils/layermapping.py
  67. +1 −1  django/contrib/gis/utils/ogrinspect.py
  68. +0 −1  django/contrib/localflavor/ar/forms.py
  69. +0 −1  django/contrib/localflavor/au/models.py
  70. +0 −4 django/contrib/localflavor/be/forms.py
  71. +0 −1  django/contrib/localflavor/jp/forms.py
  72. +1 −1  django/contrib/localflavor/kw/forms.py
  73. +2 −1  django/contrib/localflavor/no/forms.py
  74. +2 −2 django/contrib/localflavor/pt/forms.py
  75. +0 −3  django/contrib/localflavor/ro/forms.py
  76. +1 −3 django/contrib/localflavor/ru/forms.py
  77. +0 −1  django/contrib/localflavor/se/utils.py
  78. +0 −1  django/contrib/localflavor/us/models.py
  79. +0 −2  django/contrib/localflavor/uy/forms.py
  80. +0 −1  django/contrib/messages/api.py
  81. +0 −1  django/contrib/messages/storage/cookie.py
  82. +0 −2  django/contrib/messages/tests/base.py
  83. +2 −2 django/contrib/messages/tests/cookie.py
  84. +6 −6 django/contrib/messages/tests/fallback.py
  85. +0 −1  django/contrib/messages/tests/urls.py
  86. +0 −1  django/contrib/sessions/backends/base.py
  87. +0 −1  django/contrib/sessions/backends/db.py
  88. +0 −3  django/contrib/sessions/models.py
  89. +1 −1  django/contrib/sitemaps/__init__.py
  90. +1 −2  django/contrib/sitemaps/views.py
  91. +0 −1  django/core/cache/backends/base.py
  92. +7 −4 django/core/cache/backends/db.py
  93. +0 −1  django/core/cache/backends/memcached.py
  94. +1 −2  django/core/handlers/modpython.py
  95. +4 −1 django/core/handlers/profiler-hotshot.py
  96. +0 −2  django/core/handlers/wsgi.py
  97. +5 −5 django/core/mail/__init__.py
  98. +0 −1  django/core/management/commands/reset.py
  99. +1 −2  django/core/serializers/base.py
  100. +0 −1  django/core/servers/basehttp.py
  101. +2 −1  django/core/servers/fastcgi.py
  102. +2 −2 django/db/__init__.py
  103. +0 −1  django/db/backends/__init__.py
  104. +4 −4 django/db/backends/oracle/base.py
  105. +2 −1  django/db/backends/oracle/creation.py
  106. +0 −1  django/db/backends/postgresql_psycopg2/base.py
  107. +0 −2  django/db/backends/postgresql_psycopg2/operations.py
  108. +2 −1  django/db/backends/sqlite3/base.py
  109. +7 −6 django/db/models/base.py
  110. +0 −1  django/db/models/deletion.py
  111. +1 −1  django/db/models/fields/__init__.py
  112. +7 −10 django/db/models/fields/files.py
  113. +2 −4 django/db/models/fields/related.py
  114. +0 −1  django/db/models/loading.py
  115. +0 −1  django/db/models/manager.py
  116. +0 −3  django/db/models/query.py
  117. +0 −1  django/db/models/query_utils.py
  118. +2 −2 django/db/models/sql/compiler.py
  119. +0 −2  django/db/models/sql/subqueries.py
  120. +0 −1  django/db/models/sql/where.py
  121. +0 −2  django/db/transaction.py
  122. +2 −1  django/dispatch/saferef.py
  123. +0 −1  django/forms/extras/widgets.py
  124. +3 −3 django/forms/models.py
  125. +0 −1  django/middleware/http.py
  126. +0 −2  django/template/base.py
  127. +0 −1  django/template/context.py
  128. +0 −1  django/template/debug.py
  129. +6 −4 django/template/defaulttags.py
  130. +2 −4 django/template/loader_tags.py
  131. +0 −2  django/template/loaders/cached.py
  132. +0 −1  django/template/smartif.py
  133. +0 −1  django/templatetags/cache.py
  134. +2 −5 django/templatetags/future.py
  135. +0 −1  django/templatetags/l10n.py
  136. +2 −2 django/test/client.py
  137. +1 −1  django/test/testcases.py
  138. +0 −4 django/test/utils.py
  139. +0 −1  django/utils/cache.py
  140. +0 −1  django/utils/log.py
  141. +11 −4 django/utils/text.py
  142. +0 −1  django/utils/timesince.py
  143. +0 −1  django/utils/translation/trans_null.py
  144. +5 −2 django/utils/translation/trans_real.py
  145. +0 −1  django/utils/version.py
  146. +0 −1  django/views/debug.py
  147. +0 −1  django/views/decorators/http.py
  148. +0 −1  django/views/generic/base.py
  149. +0 −2  django/views/generic/detail.py
  150. +0 −2  django/views/generic/list.py
  151. +1 −1  tests/modeltests/basic/models.py
  152. +0 −1  tests/modeltests/basic/tests.py
  153. +1 −2  tests/modeltests/custom_pk/models.py
  154. +1 −2  tests/modeltests/custom_pk/tests.py
  155. +1 −1  tests/modeltests/delete/models.py
  156. +0 −1  tests/modeltests/field_subclassing/fields.py
  157. +1 −1  tests/modeltests/field_subclassing/models.py
  158. +0 −1  tests/modeltests/files/models.py
  159. +0 −1  tests/modeltests/files/tests.py
  160. +1 −2  tests/modeltests/fixtures/models.py
  161. +1 −4 tests/modeltests/fixtures/tests.py
  162. +0 −1  tests/modeltests/fixtures_model_package/models/__init__.py
  163. +1 −1  tests/modeltests/force_insert_update/models.py
  164. +0 −2  tests/modeltests/get_object_or_404/models.py
  165. +1 −1  tests/modeltests/get_or_create/models.py
  166. +1 −2  tests/modeltests/lookup/models.py
  167. +0 −1  tests/modeltests/lookup/tests.py
  168. +2 −2 tests/modeltests/m2m_through/tests.py
  169. +1 −1  tests/modeltests/many_to_one/tests.py
  170. +0 −1  tests/modeltests/model_forms/models.py
  171. +1 −1  tests/modeltests/model_formsets/tests.py
  172. +1 −1  tests/modeltests/mutually_referential/tests.py
  173. +1 −1  tests/modeltests/one_to_one/models.py
  174. +0 −1  tests/modeltests/pagination/tests.py
  175. +1 −1  tests/modeltests/proxy_model_inheritance/tests.py
  176. +0 −3  tests/modeltests/proxy_models/models.py
  177. +2 −2 tests/modeltests/serializers/tests.py
  178. +1 −1  tests/modeltests/transactions/models.py
  179. +1 −4 tests/modeltests/transactions/tests.py
  180. +1 −2  tests/modeltests/unmanaged_models/tests.py
  181. +0 −1  tests/modeltests/validation/models.py
  182. +0 −2  tests/modeltests/validation/test_unique.py
  183. +0 −2  tests/modeltests/validation/validators.py
  184. +0 −2  tests/regressiontests/admin_filters/tests.py
  185. +4 −3 tests/regressiontests/admin_validation/tests.py
  186. +1 −2  tests/regressiontests/bash_completion/management/commands/test_command.py
  187. +0 −1  tests/regressiontests/cache/tests.py
  188. +1 −1  tests/regressiontests/comment_tests/models.py
  189. +6 −4 tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
  190. +0 −4 tests/regressiontests/comment_tests/tests/feed_tests.py
  191. +0 −1  tests/regressiontests/comment_tests/tests/templatetag_tests.py
  192. +0 −1  tests/regressiontests/csrf_tests/tests.py
  193. +0 −2  tests/regressiontests/datatypes/tests.py
  194. +1 −3 tests/regressiontests/defer_regress/models.py
  195. +0 −2  tests/regressiontests/defer_regress/tests.py
  196. +2 −2 tests/regressiontests/delete_regress/tests.py
  197. +1 −2  tests/regressiontests/expressions_regress/tests.py
  198. +1 −2  tests/regressiontests/extra_regress/tests.py
  199. +1 −1  tests/regressiontests/file_storage/tests.py
  200. +1 −1  tests/regressiontests/file_uploads/tests.py
  201. +1 −2  tests/regressiontests/fixtures_regress/models.py
  202. +2 −3 tests/regressiontests/fixtures_regress/tests.py
  203. +0 −1  tests/regressiontests/forms/localflavor/cl.py
  204. +0 −2  tests/regressiontests/forms/localflavor/in_.py
  205. +0 −1  tests/regressiontests/forms/tests/fields.py
  206. +0 −3  tests/regressiontests/forms/tests/forms.py
  207. +0 −1  tests/regressiontests/forms/tests/media.py
  208. +2 −1  tests/regressiontests/forms/tests/models.py
  209. +0 −3  tests/regressiontests/forms/tests/widgets.py
  210. +0 −1  tests/regressiontests/generic_relations_regress/tests.py
  211. +0 −1  tests/regressiontests/generic_views/base.py
  212. +0 −1  tests/regressiontests/generic_views/dates.py
  213. +0 −1  tests/regressiontests/generic_views/list.py
  214. +2 −1  tests/regressiontests/i18n/forms.py
  215. +1 −1  tests/regressiontests/i18n/patterns/urls/namespace.py
  216. +1 −1  tests/regressiontests/i18n/patterns/urls/wrong.py
  217. +1 −1  tests/regressiontests/i18n/patterns/urls/wrong_namespace.py
  218. +1 −2  tests/regressiontests/introspection/tests.py
  219. +0 −4 tests/regressiontests/localflavor/tests.py
  220. +1 −3 tests/regressiontests/m2m_through_regress/models.py
  221. +1 −1  tests/regressiontests/max_lengths/tests.py
  222. +0 −1  tests/regressiontests/middleware_exceptions/models.py
  223. +2 −3 tests/regressiontests/model_fields/imagefield.py
  224. +4 −8 tests/regressiontests/model_fields/tests.py
  225. +2 −2 tests/regressiontests/model_forms_regress/tests.py
  226. +0 −2  tests/regressiontests/modeladmin/models.py
  227. +0 −1  tests/regressiontests/multiple_database/models.py
  228. +0 −2  tests/regressiontests/select_related_onetoone/tests.py
  229. +2 −3 tests/regressiontests/serializers_regress/tests.py
  230. +0 −2  tests/regressiontests/signals_regress/tests.py
  231. +0 −2  tests/regressiontests/syndication/tests.py
  232. +0 −2  tests/regressiontests/templates/custom.py
  233. +0 −2  tests/regressiontests/templates/loaders.py
  234. +1 −1  tests/regressiontests/templates/response.py
  235. +1 −1  tests/regressiontests/templates/smartif.py
  236. +3 −3 tests/regressiontests/templates/tests.py
  237. +1 −3 tests/regressiontests/test_utils/tests.py
  238. +0 −2  tests/regressiontests/urlpatterns_reverse/middleware.py
  239. +2 −3 tests/regressiontests/urlpatterns_reverse/tests.py
  240. +0 −1  tests/regressiontests/utils/jslex.py
  241. +0 −1  tests/regressiontests/views/tests/debug.py
  242. +0 −3  tests/regressiontests/views/tests/defaults.py
View
3  django/bin/profiling/gather_profile_stats.py
@@ -8,8 +8,9 @@
"""
from hotshot import stats
+import os
import pstats
-import sys, os
+import sys
def gather_stats(p):
profiles = {}
View
4 django/contrib/admin/templatetags/admin_list.py
@@ -1,14 +1,12 @@
import datetime
-from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
- ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR)
+ ORDER_VAR, PAGE_VAR, SEARCH_VAR)
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.templatetags.static import static
from django.utils import formats
-from django.utils.datastructures import SortedDict
from django.utils.html import escape, conditional_escape
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
View
1  django/contrib/admin/widgets.py
@@ -4,7 +4,6 @@
import copy
from django import forms
-from django.conf import settings
from django.core.urlresolvers import reverse, NoReverseMatch
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
View
7 django/contrib/admindocs/views.py
@@ -1,4 +1,8 @@
-from django import template, templatetags
+import inspect
+import os
+import re
+
+from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
@@ -12,7 +16,6 @@
from django.utils.importlib import import_module
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
-import inspect, os, re
# Exclude methods starting with these strings from documentation
MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_')
View
1  django/contrib/auth/__init__.py
@@ -1,4 +1,3 @@
-import datetime
from warnings import warn
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
View
1  django/contrib/auth/backends.py
@@ -1,4 +1,3 @@
-from django.db import connection
from django.contrib.auth.models import User, Permission
View
5 django/contrib/auth/forms.py
@@ -1,10 +1,11 @@
from django import forms
-from django.template import Context, loader
+from django.template import loader
from django.utils.http import int_to_base36
from django.utils.itercompat import any
from django.utils.translation import ugettext_lazy as _
-from django.contrib.auth.models import User, UNUSABLE_PASSWORD
+from django.contrib.auth.models import User
+from django.contrib.auth.utils import UNUSABLE_PASSWORD
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
View
4 django/contrib/auth/management/__init__.py
@@ -102,8 +102,8 @@ def get_default_username(check_db=True):
:returns: The username, or an empty string if no username can be
determined.
"""
- from django.contrib.auth.management.commands.createsuperuser import \
- RE_VALID_USERNAME
+ from django.contrib.auth.management.commands.createsuperuser import (
+ RE_VALID_USERNAME)
default_username = get_system_username()
try:
default_username = unicodedata.normalize('NFKD', default_username)\
View
5 django/contrib/auth/models.py
@@ -10,9 +10,10 @@
from django.contrib import auth
from django.contrib.auth.signals import user_logged_in
+# UNUSABLE_PASSWORD is still imported here for backwards compatibility
from django.contrib.auth.utils import (get_hexdigest, make_password,
- check_password, is_password_usable,
- get_random_string, UNUSABLE_PASSWORD)
+ check_password, is_password_usable, get_random_string,
+ UNUSABLE_PASSWORD)
from django.contrib.contenttypes.models import ContentType
def update_last_login(sender, user, **kwargs):
View
2  django/contrib/auth/tests/auth_backends.py
@@ -1,5 +1,3 @@
-import warnings
-
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
View
1  django/contrib/auth/tests/forms.py
@@ -1,6 +1,5 @@
from __future__ import with_statement
import os
-from django.conf import settings
from django.core import mail
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
View
2  django/contrib/auth/tests/tokens.py
@@ -1,7 +1,7 @@
from datetime import date, timedelta
from django.conf import settings
-from django.contrib.auth.models import User, AnonymousUser
+from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
View
6 django/contrib/formtools/preview.py
@@ -2,12 +2,6 @@
Formtools Preview application.
"""
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
-from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
View
1  django/contrib/formtools/utils.py
@@ -5,7 +5,6 @@
import hashlib
from django.conf import settings
-from django.forms import BooleanField
from django.utils.crypto import salted_hmac
View
1  django/contrib/formtools/wizard/storage/session.py
@@ -1,4 +1,3 @@
-from django.core.files.uploadedfile import UploadedFile
from django.contrib.formtools.wizard import storage
View
3  django/contrib/formtools/wizard/tests/namedwizardtests/tests.py
@@ -1,9 +1,6 @@
-import os
-
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
-from django.conf import settings
from django.contrib.auth.models import User
View
1  django/contrib/formtools/wizard/views.py
@@ -1,4 +1,3 @@
-import copy
import re
from django import forms
View
1  django/contrib/gis/admin/options.py
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.gdal import OGRGeomType
View
1  django/contrib/gis/admin/widgets.py
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.forms.widgets import Textarea
from django.template import loader, Context
from django.templatetags.static import static
View
1  django/contrib/gis/db/backends/base.py
@@ -3,7 +3,6 @@
`SpatialRefSys` model the backend.
"""
import re
-from django.conf import settings
from django.contrib.gis import gdal
class BaseSpatialOperations(object):
View
1  django/contrib/gis/db/backends/oracle/models.py
@@ -8,7 +8,6 @@
model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
"""
from django.contrib.gis.db import models
-from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
View
5 django/contrib/gis/db/backends/spatialite/base.py
@@ -3,8 +3,9 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import *
-from django.db.backends.sqlite3.base import DatabaseWrapper as SqliteDatabaseWrapper, \
- _sqlite_extract, _sqlite_date_trunc, _sqlite_regexp
+from django.db.backends.sqlite3.base import (
+ _sqlite_extract, _sqlite_date_trunc, _sqlite_regexp,
+ DatabaseWrapper as SqliteDatabaseWrapper)
from django.contrib.gis.db.backends.spatialite.client import SpatiaLiteClient
from django.contrib.gis.db.backends.spatialite.creation import SpatiaLiteCreation
from django.contrib.gis.db.backends.spatialite.introspection import SpatiaLiteIntrospection
View
8 django/contrib/gis/db/models/__init__.py
@@ -8,7 +8,7 @@
from django.contrib.gis.db.models.manager import GeoManager
# The geographic-enabled fields.
-from django.contrib.gis.db.models.fields import \
- GeometryField, PointField, LineStringField, PolygonField, \
- MultiPointField, MultiLineStringField, MultiPolygonField, \
- GeometryCollectionField
+from django.contrib.gis.db.models.fields import (
+ GeometryField, PointField, LineStringField, PolygonField,
+ MultiPointField, MultiLineStringField, MultiPolygonField,
+ GeometryCollectionField)
View
6 django/contrib/gis/db/models/query.py
@@ -1,9 +1,9 @@
from django.db import connections
-from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
+from django.db.models.query import QuerySet, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
-from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
-from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery, GeoWhereNode
+from django.contrib.gis.db.models.fields import get_srid_info, PointField, LineStringField
+from django.contrib.gis.db.models.sql import AreaField, DistanceField, GeomField, GeoQuery
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Area, Distance
View
1  django/contrib/gis/db/models/sql/aggregates.py
@@ -1,6 +1,5 @@
from django.db.models.sql.aggregates import *
from django.contrib.gis.db.models.fields import GeometryField
-from django.contrib.gis.db.models.sql.conversion import GeomField
class GeoAggregate(Aggregate):
# Default SQL template for spatial aggregates.
View
2  django/contrib/gis/db/models/sql/where.py
@@ -1,4 +1,4 @@
-from django.db.models.fields import Field, FieldDoesNotExist
+from django.db.models.fields import FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import Constraint, WhereNode
View
2  django/contrib/gis/feeds.py
@@ -1,4 +1,4 @@
-from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist
+from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin(object):
View
2  django/contrib/gis/gdal/datasource.py
@@ -34,7 +34,7 @@
val = field.value
"""
# ctypes prerequisites.
-from ctypes import byref, c_void_p
+from ctypes import byref
# The GDAL C library, OGR exceptions, and the Layer object.
from django.contrib.gis.gdal.base import GDALBase
View
1  django/contrib/gis/gdal/feature.py
@@ -3,7 +3,6 @@
from django.contrib.gis.gdal.error import OGRException, OGRIndexError
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
-from django.contrib.gis.gdal.srs import SpatialReference
# ctypes function prototypes
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
View
3  django/contrib/gis/gdal/libgdal.py
@@ -1,4 +1,5 @@
-import os, re, sys
+import os
+import re
from ctypes import c_char_p, CDLL
from ctypes.util import find_library
from django.contrib.gis.gdal.error import OGRException
View
5 django/contrib/gis/gdal/prototypes/ds.py
@@ -6,9 +6,8 @@
from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal
-from django.contrib.gis.gdal.prototypes.generation import \
- const_string_output, double_output, geom_output, int_output, \
- srs_output, void_output, voidptr_output
+from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
+ double_output, geom_output, int_output, srs_output, void_output, voidptr_output)
c_int_p = POINTER(c_int) # shortcut type
View
6 django/contrib/gis/gdal/prototypes/generation.py
@@ -4,9 +4,9 @@
"""
from ctypes import c_char_p, c_double, c_int, c_void_p
-from django.contrib.gis.gdal.prototypes.errcheck import \
- check_arg_errcode, check_errcode, check_geom, check_geom_offset, \
- check_pointer, check_srs, check_str_arg, check_string, check_const_string
+from django.contrib.gis.gdal.prototypes.errcheck import (
+ check_arg_errcode, check_errcode, check_geom, check_geom_offset,
+ check_pointer, check_srs, check_str_arg, check_string, check_const_string)
class gdal_char_p(c_char_p):
pass
View
9 django/contrib/gis/gdal/prototypes/geom.py
@@ -1,12 +1,9 @@
-import re
-from datetime import date
-from ctypes import c_char, c_char_p, c_double, c_int, c_ubyte, c_void_p, POINTER
+from ctypes import c_char_p, c_double, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from django.contrib.gis.gdal.libgdal import lgdal, GEOJSON
from django.contrib.gis.gdal.prototypes.errcheck import check_bool, check_envelope
-from django.contrib.gis.gdal.prototypes.generation import \
- const_string_output, double_output, geom_output, int_output, \
- srs_output, string_output, void_output
+from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
+ double_output, geom_output, int_output, srs_output, string_output, void_output)
### Generation routines specific to this module ###
def env_func(f, argtypes):
View
5 django/contrib/gis/gdal/prototypes/srs.py
@@ -1,8 +1,7 @@
from ctypes import c_char_p, c_int, c_void_p, POINTER
from django.contrib.gis.gdal.libgdal import lgdal, std_call
-from django.contrib.gis.gdal.prototypes.generation import \
- const_string_output, double_output, int_output, \
- srs_output, string_output, void_output
+from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
+ double_output, int_output, srs_output, string_output, void_output)
## Shortcut generation for routines with known parameters.
def srs_double(f):
View
5 django/contrib/gis/gdal/srs.py
@@ -26,12 +26,11 @@
>>> print srs.name
NAD83 / Texas South Central
"""
-import re
-from ctypes import byref, c_char_p, c_int, c_void_p
+from ctypes import byref, c_char_p, c_int
# Getting the error checking routine and exceptions
from django.contrib.gis.gdal.base import GDALBase
-from django.contrib.gis.gdal.error import OGRException, SRSException
+from django.contrib.gis.gdal.error import SRSException
from django.contrib.gis.gdal.prototypes import srs as capi
#### Spatial Reference class. ####
View
2  django/contrib/gis/gdal/tests/test_driver.py
@@ -1,4 +1,4 @@
-import os, os.path, unittest
+import unittest
from django.contrib.gis.gdal import Driver, OGRException
valid_drivers = ('ESRI Shapefile', 'MapInfo File', 'TIGER', 'S57', 'DGN',
View
19 django/contrib/gis/gdal/tests/test_geom.py
@@ -1,8 +1,14 @@
-from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, \
- OGRException, OGRIndexError, SpatialReference, CoordTransform, \
- GDAL_VERSION
-from django.utils import unittest
+from binascii import b2a_hex
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, OGRException,
+ OGRIndexError, SpatialReference, CoordTransform, GDAL_VERSION)
+from django.contrib.gis.gdal.prototypes.geom import GEOJSON
from django.contrib.gis.geometry.test_data import TestDataMixin
+from django.utils import unittest
class OGRGeomTest(unittest.TestCase, TestDataMixin):
"This tests the OGR Geometry."
@@ -92,7 +98,6 @@ def test01c_hex(self):
def test01d_wkb(self):
"Testing WKB input/output."
- from binascii import b2a_hex
for g in self.geometries.hex_wkt:
geom1 = OGRGeometry(g.wkt)
wkb = geom1.wkb
@@ -103,7 +108,6 @@ def test01d_wkb(self):
def test01e_json(self):
"Testing GeoJSON input/output."
- from django.contrib.gis.gdal.prototypes.geom import GEOJSON
if not GEOJSON: return
for g in self.geometries.json_geoms:
geom = OGRGeometry(g.wkt)
@@ -446,9 +450,8 @@ def test16_25D(self):
def test17_pickle(self):
"Testing pickle support."
- import cPickle
g1 = OGRGeometry('LINESTRING(1 1 1,2 2 2,3 3 3)', 'WGS84')
- g2 = cPickle.loads(cPickle.dumps(g1))
+ g2 = pickle.loads(pickle.dumps(g1))
self.assertEqual(g1, g2)
self.assertEqual(4326, g2.srs.srid)
self.assertEqual(g1.srs.wkt, g2.srs.wkt)
View
5 django/contrib/gis/geometry/backend/geos.py
@@ -1,3 +1,2 @@
-from django.contrib.gis.geos import \
- GEOSGeometry as Geometry, \
- GEOSException as GeometryException
+from django.contrib.gis.geos import (
+ GEOSGeometry as Geometry, GEOSException as GeometryException)
View
2  django/contrib/gis/geos/base.py
@@ -1,6 +1,6 @@
from ctypes import c_void_p
from types import NoneType
-from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
+from django.contrib.gis.geos.error import GEOSException
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
View
4 django/contrib/gis/geos/collections.py
@@ -3,9 +3,9 @@
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from ctypes import c_int, c_uint, byref
-from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
+from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import GEOSGeometry
-from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR, GEOS_PREPARE
+from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOS_PREPARE
from django.contrib.gis.geos.linestring import LineString, LinearRing
from django.contrib.gis.geos.point import Point
from django.contrib.gis.geos.polygon import Polygon
View
3  django/contrib/gis/geos/geometry.py
@@ -3,9 +3,8 @@
inherit from this object.
"""
# Python, ctypes and types dependencies.
-import re
import warnings
-from ctypes import addressof, byref, c_double, c_size_t
+from ctypes import addressof, byref, c_double
# super-class for mutable list behavior
from django.contrib.gis.geos.mutable_list import ListMixin
View
4 django/contrib/gis/geos/libgeos.py
@@ -6,7 +6,9 @@
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
-import os, re, sys
+import os
+import re
+import sys
from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER
from ctypes.util import find_library
from django.contrib.gis.geos.error import GEOSException
View
1  django/contrib/gis/geos/polygon.py
@@ -1,5 +1,4 @@
from ctypes import c_uint, byref
-from django.contrib.gis.geos.error import GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gis.geos.libgeos import get_pointer_arr, GEOM_PTR
from django.contrib.gis.geos.linestring import LinearRing
View
26 django/contrib/gis/geos/prototypes/__init__.py
@@ -5,26 +5,26 @@
"""
# Coordinate sequence routines.
-from django.contrib.gis.geos.prototypes.coordseq import create_cs, get_cs, \
- cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz, \
- cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims
+from django.contrib.gis.geos.prototypes.coordseq import (create_cs, get_cs,
+ cs_clone, cs_getordinate, cs_setordinate, cs_getx, cs_gety, cs_getz,
+ cs_setx, cs_sety, cs_setz, cs_getsize, cs_getdims)
# Geometry routines.
-from django.contrib.gis.geos.prototypes.geom import from_hex, from_wkb, from_wkt, \
- create_point, create_linestring, create_linearring, create_polygon, create_collection, \
- destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone, \
- geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid, \
- get_dims, get_num_coords, get_num_geoms, \
- to_hex, to_wkb, to_wkt
+from django.contrib.gis.geos.prototypes.geom import (from_hex, from_wkb, from_wkt,
+ create_point, create_linestring, create_linearring, create_polygon, create_collection,
+ destroy_geom, get_extring, get_intring, get_nrings, get_geomn, geom_clone,
+ geos_normalize, geos_type, geos_typeid, geos_get_srid, geos_set_srid,
+ get_dims, get_num_coords, get_num_geoms,
+ to_hex, to_wkb, to_wkt)
# Miscellaneous routines.
from django.contrib.gis.geos.prototypes.misc import *
# Predicates
-from django.contrib.gis.geos.prototypes.predicates import geos_hasz, geos_isempty, \
- geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses, \
- geos_disjoint, geos_equals, geos_equalsexact, geos_intersects, \
- geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within
+from django.contrib.gis.geos.prototypes.predicates import (geos_hasz, geos_isempty,
+ geos_isring, geos_issimple, geos_isvalid, geos_contains, geos_crosses,
+ geos_disjoint, geos_equals, geos_equalsexact, geos_intersects,
+ geos_intersects, geos_overlaps, geos_relatepattern, geos_touches, geos_within)
# Topology routines
from django.contrib.gis.geos.prototypes.topology import *
View
8 django/contrib/gis/geos/prototypes/geom.py
@@ -1,7 +1,7 @@
-from ctypes import c_char_p, c_int, c_size_t, c_ubyte, c_uint, POINTER
-from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, PREPGEOM_PTR, GEOS_PREPARE
-from django.contrib.gis.geos.prototypes.errcheck import \
- check_geom, check_minus_one, check_sized_string, check_string, check_zero
+from ctypes import c_char_p, c_int, c_size_t, c_ubyte, POINTER
+from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR
+from django.contrib.gis.geos.prototypes.errcheck import (
+ check_geom, check_minus_one, check_sized_string, check_string, check_zero)
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
# This is the return type used by binary output (WKB, HEX) routines.
View
2  django/contrib/gis/geos/prototypes/topology.py
@@ -7,7 +7,7 @@
'geos_linemerge', 'geos_pointonsurface', 'geos_preservesimplify',
'geos_simplify', 'geos_symdifference', 'geos_union', 'geos_relate']
-from ctypes import c_char_p, c_double, c_int
+from ctypes import c_double, c_int
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOS_PREPARE
from django.contrib.gis.geos.prototypes.errcheck import check_geom, check_string
from django.contrib.gis.geos.prototypes.geom import geos_char_p
View
4 django/contrib/gis/geos/tests/test_geos.py
@@ -1,4 +1,6 @@
-import ctypes, random, unittest, sys
+import ctypes
+import random
+import unittest
from django.contrib.gis.geos import *
from django.contrib.gis.geos.base import gdal, numpy, GEOSBase
from django.contrib.gis.geos.libgeos import GEOS_PREPARE
View
1  django/contrib/gis/geos/tests/test_geos_mutation.py
@@ -2,7 +2,6 @@
# Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license.
-import copy
from django.contrib.gis.geos import *
from django.contrib.gis.geos.error import GEOSIndexError
from django.utils import unittest
View
3  django/contrib/gis/geos/tests/test_io.py
@@ -1,4 +1,5 @@
-import binascii, ctypes, unittest
+import binascii
+import unittest
from django.contrib.gis.geos import GEOSGeometry, WKTReader, WKTWriter, WKBReader, WKBWriter, geos_version_info
class GEOSIOTest(unittest.TestCase):
View
3  django/contrib/gis/management/commands/inspectdb.py
@@ -1,6 +1,3 @@
-from optparse import make_option
-
-from django.core.management.base import CommandError
from django.core.management.commands.inspectdb import Command as InspectDBCommand
class Command(InspectDBCommand):
View
2  django/contrib/gis/management/commands/ogrinspect.py
@@ -1,4 +1,4 @@
-import os, sys
+import os
from optparse import make_option
from django.contrib.gis import gdal
from django.contrib.gis.management.base import ArgsCommand, CommandError
View
9 django/contrib/gis/maps/google/gmap.py
@@ -1,15 +1,18 @@
from django.conf import settings
-from django.contrib.gis import geos
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
-class GoogleMapException(Exception): pass
-from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon
+from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker
+
+class GoogleMapException(Exception):
+ pass
+
# The default Google Maps URL (for the API javascript)
# TODO: Internationalize for Japan, UK, etc.
GOOGLE_MAPS_URL='http://maps.google.com/maps?file=api&v=%s&key='
+
class GoogleMap(object):
"A class for generating Google Maps JavaScript."
View
2  django/contrib/gis/maps/google/zoom.py
@@ -1,6 +1,6 @@
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
-from math import pi, sin, cos, log, exp, atan
+from math import pi, sin, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
View
9 django/contrib/gis/shortcuts.py
@@ -1,11 +1,16 @@
-import cStringIO, zipfile
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+import zipfile
+
from django.conf import settings
from django.http import HttpResponse
from django.template import loader
def compress_kml(kml):
"Returns compressed KMZ from the given KML string."
- kmz = cStringIO.StringIO()
+ kmz = StringIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.writestr('doc.kml', kml.encode(settings.DEFAULT_CHARSET))
zf.close()
View
9 django/contrib/gis/tests/distapp/tests.py
@@ -1,15 +1,12 @@
-import os
-from decimal import Decimal
-
from django.db import connection
from django.db.models import Q
-from django.contrib.gis.geos import GEOSGeometry, Point, LineString
+from django.contrib.gis.geos import GEOSGeometry, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatialite
from django.test import TestCase
-from models import AustraliaCity, Interstate, SouthTexasInterstate, \
- SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode
+from models import (AustraliaCity, Interstate, SouthTexasInterstate,
+ SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode)
class DistanceTest(TestCase):
View
6 django/contrib/gis/tests/geo3d/tests.py
@@ -5,9 +5,9 @@
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
-from models import City3D, Interstate2D, Interstate3D, \
- InterstateProj2D, InterstateProj3D, \
- Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D
+from models import (City3D, Interstate2D, Interstate3D,
+ InterstateProj2D, InterstateProj3D,
+ Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D)
data_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data'))
city_file = os.path.join(data_path, 'cities', 'cities.shp')
View
3  django/contrib/gis/tests/geoapp/feeds.py
@@ -1,6 +1,5 @@
from django.contrib.gis import feeds
-from django.contrib.gis.tests.utils import mysql
-from models import City, Country
+from models import City
class TestGeoRSS1(feeds.Feed):
link = '/city/'
View
4 django/contrib/gis/tests/geoapp/test_regress.py
@@ -1,5 +1,5 @@
-import os, unittest
-from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_postgis, no_spatialite
+import unittest
+from django.contrib.gis.tests.utils import no_mysql, no_spatialite
from django.contrib.gis.shortcuts import render_to_kmz
from models import City
View
7 django/contrib/gis/tests/geoapp/test_sitemaps.py
@@ -1,4 +1,7 @@
-import cStringIO
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
from xml.dom import minidom
import zipfile
from django.conf import settings
@@ -60,7 +63,7 @@ def test_geositemap_kml(self):
kml_doc = minidom.parseString(self.client.get(kml_url).content)
elif kml_type == 'kmz':
# Have to decompress KMZ before parsing.
- buf = cStringIO.StringIO(self.client.get(kml_url).content)
+ buf = StringIO(self.client.get(kml_url).content)
zf = zipfile.ZipFile(buf)
self.assertEqual(1, len(zf.filelist))
self.assertEqual('doc.kml', zf.filelist[0].filename)
View
11 django/contrib/gis/tests/geoapp/tests.py
@@ -1,12 +1,11 @@
import re
from django.db import connection
from django.contrib.gis import gdal
-from django.contrib.gis.geos import fromstr, GEOSGeometry, \
- Point, LineString, LinearRing, Polygon, GeometryCollection
-from django.contrib.gis.measure import Distance
-from django.contrib.gis.tests.utils import \
- no_mysql, no_oracle, no_spatialite, \
- mysql, oracle, postgis, spatialite
+from django.contrib.gis.geos import (fromstr, GEOSGeometry,
+ Point, LineString, LinearRing, Polygon, GeometryCollection)
+from django.contrib.gis.tests.utils import (
+ no_mysql, no_oracle, no_spatialite,
+ mysql, oracle, postgis, spatialite)
from django.test import TestCase
from models import Country, City, PennsylvaniaCity, State, Track
View
1  django/contrib/gis/tests/geogapp/tests.py
@@ -79,7 +79,6 @@ def test05_geography_layermapping(self):
def test06_geography_area(self):
"Testing that Area calculations work on geography columns."
- from django.contrib.gis.measure import A
# SELECT ST_Area(poly) FROM geogapp_zipcode WHERE code='77002';
ref_area = 5439084.70637573
tol = 5
View
8 django/contrib/gis/tests/layermap/tests.py
@@ -4,13 +4,13 @@
from django.utils.unittest import TestCase
-from django.contrib.gis.gdal import DataSource, OGRException
+from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeignKey
-from models import \
- City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State, \
- city_mapping, co_mapping, cofeat_mapping, inter_mapping
+from models import (
+ City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State,
+ city_mapping, co_mapping, cofeat_mapping, inter_mapping)
shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data'))
city_shp = os.path.join(shp_path, 'cities', 'cities.shp')
View
3  django/contrib/gis/tests/test_geoip.py
@@ -1,4 +1,5 @@
-import os, unittest
+import os
+import unittest
from django.db import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.utils import GeoIP, GeoIPException
View
2  django/contrib/gis/tests/test_spatialrefsys.py
@@ -1,6 +1,6 @@
from django.db import connection
from django.contrib.gis.gdal import GDAL_VERSION
-from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite
+from django.contrib.gis.tests.utils import no_mysql, oracle, postgis, spatialite
from django.utils import unittest
View
3  django/contrib/gis/utils/geoip.py
@@ -38,7 +38,8 @@
>>> g.geos('24.124.1.80').wkt
'POINT (-95.2087020874023438 39.0392990112304688)'
"""
-import os, re
+import os
+import re
from ctypes import c_char_p, c_float, c_int, Structure, CDLL, POINTER
from ctypes.util import find_library
from django.conf import settings
View
9 django/contrib/gis/utils/layermapping.py
@@ -7,15 +7,14 @@
http://geodjango.org/docs/layermapping.html
"""
import sys
-from datetime import date, datetime
from decimal import Decimal
from django.core.exceptions import ObjectDoesNotExist
from django.db import connections, DEFAULT_DB_ALIAS
from django.contrib.gis.db.models import GeometryField
-from django.contrib.gis.gdal import CoordTransform, DataSource, \
- OGRException, OGRGeometry, OGRGeomType, SpatialReference
-from django.contrib.gis.gdal.field import \
- OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime
+from django.contrib.gis.gdal import (CoordTransform, DataSource,
+ OGRException, OGRGeometry, OGRGeomType, SpatialReference)
+from django.contrib.gis.gdal.field import (
+ OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime)
from django.db import models, transaction
from django.contrib.localflavor.us.models import USStateField
View
2  django/contrib/gis/utils/ogrinspect.py
@@ -8,7 +8,7 @@
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSource
-from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString, OFTTime
+from django.contrib.gis.gdal.field import OFTDate, OFTDateTime, OFTInteger, OFTReal, OFTString
def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False):
"""
View
1  django/contrib/localflavor/ar/forms.py
@@ -6,7 +6,6 @@
from django.forms import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, CharField, Select
-from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
class ARProvinceSelect(Select):
View
1  django/contrib/localflavor/au/models.py
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
View
4 django/contrib/localflavor/be/forms.py
@@ -1,10 +1,6 @@
"""
Belgium-specific Form helpers
"""
-import re
-
-from django.core.validators import EMPTY_VALUES
-from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
View
1  django/contrib/localflavor/jp/forms.py
@@ -2,7 +2,6 @@
JP-specific Form helpers
"""
-from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import RegexField, Select
View
2  django/contrib/localflavor/kw/forms.py
@@ -6,7 +6,7 @@
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
-from django.forms.fields import Field, RegexField
+from django.forms.fields import Field
from django.utils.translation import gettext as _
id_re = re.compile(r'^(?P<initial>\d{1})(?P<yy>\d\d)(?P<mm>\d\d)(?P<dd>\d\d)(?P<mid>\d{4})(?P<checksum>\d{1})')
View
3  django/contrib/localflavor/no/forms.py
@@ -2,7 +2,8 @@
Norwegian-specific Form helpers
"""
-import re, datetime
+import re
+import datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
View
4 django/contrib/localflavor/pt/forms.py
@@ -1,13 +1,13 @@
"""
PT-specific Form helpers
"""
+import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
-from django.forms.fields import Field, RegexField, Select
+from django.forms.fields import Field, RegexField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
-import re
phone_digits_re = re.compile(r'^(\d{9}|(00|\+)\d*)$')
View
3  django/contrib/localflavor/ro/forms.py
@@ -2,9 +2,6 @@
"""
Romanian specific form helpers.
"""
-
-import re
-
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
View
4 django/contrib/localflavor/ru/forms.py
@@ -3,9 +3,7 @@
"""
import re
-from django.core.validators import EMPTY_VALUES
-from django.forms import ValidationError
-from django.forms.fields import CharField, Select, RegexField
+from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
phone_digits_re = re.compile(r'^(?:[78]-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
View
1  django/contrib/localflavor/se/utils.py
@@ -1,4 +1,3 @@
-import re
import datetime
def id_number_checksum(gd):
View
1  django/contrib/localflavor/us/models.py
@@ -1,4 +1,3 @@
-from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.us.us_states import STATE_CHOICES
View
2  django/contrib/localflavor/uy/forms.py
@@ -2,8 +2,6 @@
"""
UY-specific form helpers.
"""
-import re
-
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
View
1  django/contrib/messages/api.py
@@ -1,6 +1,5 @@
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
-from django.utils.functional import lazy, memoize
__all__ = (
'add_message', 'get_messages',
View
1  django/contrib/messages/storage/cookie.py
@@ -1,5 +1,4 @@
from django.conf import settings
-from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils import simplejson as json
View
2  django/contrib/messages/tests/base.py
@@ -1,5 +1,3 @@
-import warnings
-
from django import http
from django.test import TestCase
from django.conf import settings
View
4 django/contrib/messages/tests/cookie.py
@@ -1,7 +1,7 @@
from django.contrib.messages import constants
from django.contrib.messages.tests.base import BaseTest
-from django.contrib.messages.storage.cookie import CookieStorage, \
- MessageEncoder, MessageDecoder
+from django.contrib.messages.storage.cookie import (CookieStorage,
+ MessageEncoder, MessageDecoder)
from django.contrib.messages.storage.base import Message
from django.utils import simplejson as json
from django.conf import settings
View
12 django/contrib/messages/tests/fallback.py
@@ -1,11 +1,11 @@
from django.contrib.messages import constants
-from django.contrib.messages.storage.fallback import FallbackStorage, \
- CookieStorage
+from django.contrib.messages.storage.fallback import (FallbackStorage,
+ CookieStorage)
from django.contrib.messages.tests.base import BaseTest
-from django.contrib.messages.tests.cookie import set_cookie_data, \
- stored_cookie_messages_count
-from django.contrib.messages.tests.session import set_session_data, \
- stored_session_messages_count
+from django.contrib.messages.tests.cookie import (set_cookie_data,
+ stored_cookie_messages_count)
+from django.contrib.messages.tests.session import (set_session_data,
+ stored_session_messages_count)
class FallbackTest(BaseTest):
View
1  django/contrib/messages/tests/urls.py
@@ -2,7 +2,6 @@
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
-from django.shortcuts import render_to_response, redirect
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from django.views.decorators.cache import never_cache
View
1  django/contrib/sessions/backends/base.py
@@ -2,7 +2,6 @@
import hashlib
import os
import random
-import sys
import time
from datetime import datetime, timedelta
try:
View
1  django/contrib/sessions/backends/db.py
@@ -1,5 +1,4 @@
import datetime
-from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
View
3  django/contrib/sessions/models.py
@@ -1,6 +1,3 @@
-import base64
-import cPickle as pickle
-
from django.db import models
from django.utils.translation import ugettext_lazy as _
View
2  django/contrib/sitemaps/__init__.py
@@ -1,4 +1,4 @@
-from django.contrib.sites.models import Site, get_current_site
+from django.contrib.sites.models import Site
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
import urllib
View
3  django/contrib/sitemaps/views.py
@@ -1,8 +1,7 @@
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
-from django.http import HttpResponse, Http404
+from django.http import Http404
from django.template.response import TemplateResponse
-from django.utils.encoding import smart_str
from django.contrib.sites.models import get_current_site
View
1  django/core/cache/backends/base.py
@@ -2,7 +2,6 @@
import warnings
-from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, DjangoRuntimeWarning
from django.utils.encoding import smart_str
from django.utils.importlib import import_module
View
11 django/core/cache/backends/db.py
@@ -1,14 +1,17 @@
"Database cache backend."
-
-from django.core.cache.backends.base import BaseCache
-from django.db import connections, router, transaction, DatabaseError
-import base64, time
+import base64
+import time
from datetime import datetime
+
try:
import cPickle as pickle
except ImportError:
import pickle
+from django.core.cache.backends.base import BaseCache
+from django.db import connections, router, transaction, DatabaseError
+
+
class Options(object):
"""A class that will quack like a Django model _meta class.
View
1  django/core/cache/backends/memcached.py
@@ -4,7 +4,6 @@
from threading import local
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
-from django.utils import importlib
class BaseMemcachedCache(BaseCache):
def __init__(self, server, params, library, value_not_found_exception):
View
3  django/core/handlers/modpython.py
@@ -1,5 +1,4 @@
import os
-from pprint import pformat
import sys
from warnings import warn
@@ -8,7 +7,7 @@
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
-from django.utils.encoding import force_unicode, smart_str, iri_to_uri
+from django.utils.encoding import force_unicode, iri_to_uri
from django.utils.log import getLogger
logger = getLogger('django.request')
View
5 django/core/handlers/profiler-hotshot.py
@@ -1,4 +1,7 @@
-import hotshot, time, os
+import hotshot
+import os
+import time
+
from django.core.handlers.modpython import ModPythonHandler
PROFILE_DATA_DIR = "/var/log/cmsprofile"
View
2  django/core/handlers/wsgi.py
@@ -1,11 +1,9 @@
-from pprint import pformat
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
-import socket
from django import http
from django.core import signals
View
10 django/core/mail/__init__.py
@@ -11,11 +11,11 @@
# django/core/mail.py before the introduction of email
# backends and the subsequent reorganization (See #10355)
from django.core.mail.utils import CachedDnsName, DNS_NAME
-from django.core.mail.message import \
- EmailMessage, EmailMultiAlternatives, \
- SafeMIMEText, SafeMIMEMultipart, \
- DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid, \
- BadHeaderError, forbid_multi_line_headers
+from django.core.mail.message import (
+ EmailMessage, EmailMultiAlternatives,
+ SafeMIMEText, SafeMIMEMultipart,
+ DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid,
+ BadHeaderError, forbid_multi_line_headers)
from django.core.mail.backends.smtp import EmailBackend as _SMTPConnection
def get_connection(backend=None, fail_silently=False, **kwds):
View
1  django/core/management/commands/reset.py
@@ -1,6 +1,5 @@
from optparse import make_option
-from django.conf import settings
from django.core.management.base import AppCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import sql_reset
View
3  django/core/serializers/base.py
@@ -5,8 +5,7 @@
from StringIO import StringIO
from django.db import models
-from django.utils.encoding import smart_str, smart_unicode
-from django.utils import datetime_safe
+from django.utils.encoding import smart_unicode
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
View
1  django/core/servers/basehttp.py
@@ -18,7 +18,6 @@
from wsgiref.util import FileWrapper # for backwards compatibility
import django
-from django.core.exceptions import ImproperlyConfigured
from django.core.management.color import color_style
from django.utils._os import safe_join
from django.views import static
View
3  django/core/servers/fastcgi.py
@@ -12,8 +12,9 @@
pass to this server.
"""
+import os
+import sys
from django.utils import importlib
-import sys, os
__version__ = "0.1"
__all__ = ["runfastcgi"]
View
4 django/db/__init__.py
@@ -1,8 +1,8 @@
from django.conf import settings
from django.core import signals
from django.core.exceptions import ImproperlyConfigured
-from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \
- DatabaseError, IntegrityError
+from django.db.utils import (ConnectionHandler, ConnectionRouter,
+ load_backend, DEFAULT_DB_ALIAS, DatabaseError, IntegrityError)
__all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError',
'IntegrityError', 'DEFAULT_DB_ALIAS')
View
1  django/db/backends/__init__.py
@@ -1,4 +1,3 @@
-import decimal
try:
import thread
except ImportError:
View
8 django/db/backends/oracle/base.py
@@ -6,7 +6,7 @@
import datetime
-from decimal import Decimal
+import decimal
import sys
@@ -730,7 +730,7 @@ def _rowfactory(row, cursor):
# This will normally be an integer from a sequence,
# but it could be a decimal value.
if '.' in value:
- value = Decimal(value)
+ value = decimal.Decimal(value)
else:
value = int(value)
else:
@@ -743,12 +743,12 @@ def _rowfactory(row, cursor):
if scale == 0:
value = int(value)
else:
- value = Decimal(value)
+ value = decimal.Decimal(value)
elif '.' in value:
# No type information. This normally comes from a
# mathematical expression in the SELECT list. Guess int
# or Decimal based on whether it has a decimal point.
- value = Decimal(value)
+ value = decimal.Decimal(value)
else:
value = int(value)
elif desc[1] in (Database.STRING, Database.FIXED_CHAR,
View
3  django/db/backends/oracle/creation.py
@@ -1,4 +1,5 @@
-import sys, time
+import sys
+import time
from django.db.backends.creation import BaseDatabaseCreation
TEST_DATABASE_PREFIX = 'test_'
View
1  django/db/backends/postgresql_psycopg2/base.py
@@ -3,7 +3,6 @@
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
-
import sys
from django.db import utils
View
2  django/db/backends/postgresql_psycopg2/operations.py
@@ -1,5 +1,3 @@
-import re
-
from django.db.backends import BaseDatabaseOperations
View
3  django/db/backends/sqlite3/base.py
@@ -5,9 +5,10 @@
standard library.
"""
+import datetime
+import decimal
import re
import sys
-import datetime
from django.db import utils
from django.db.backends import *
View
13 django/db/models/base.py
@@ -1,28 +1,29 @@
import copy
import sys
-import types
from functools import update_wrapper
from itertools import izip
import django.db.models.manager # Imported to register signal handler.
-from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS
+from django.conf import settings
+from django.core.exceptions import (ObjectDoesNotExist,
+ MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS)
from django.core import validators
from django.db.models.fields import AutoField, FieldDoesNotExist
-from django.db.models.fields.related import (OneToOneRel, ManyToOneRel,
+from django.db.models.fields.related import (ManyToOneRel,
OneToOneField, add_lazy_relation)
+from django.db import (connections, router, transaction, DatabaseError,
+ DEFAULT_DB_ALIAS)
from django.db.models.query import Q
from django.db.models.query_utils import DeferredAttribute
from django.db.models.deletion import Collector
from django.db.models.options import Options
-from django.db import (connections, router, transaction, DatabaseError,
- DEFAULT_DB_ALIAS)
from django.db.models import signals
from django.db.models.loading import register_models, get_model
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import curry
from django.utils.encoding import smart_str, force_unicode
from django.utils.text import get_text_list, capfirst
-from django.conf import settings
+
class ModelBase(type):
"""
View
1  django/db/models/deletion.py
@@ -3,7 +3,6 @@
from django.db import connections, transaction, IntegrityError
from django.db.models import signals, sql
-from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.utils.datastructures import SortedDict
View
2  django/db/models/fields/__init__.py
@@ -17,7 +17,7 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode, force_unicode, smart_str
from django.utils import datetime_safe
-from django.utils.ipv6 import clean_ipv6_address, is_valid_ipv6_address
+from django.utils.ipv6 import clean_ipv6_address
class NOT_PROVIDED:
pass
View
17 django/db/models/fields/files.py
@@ -1,18 +1,14 @@
import datetime
import os
-from django.conf import settings
+from django import forms
from django.db.models.fields import Field
-from django.core.files.base import File, ContentFile
+from django.core.files.base import File
from django.core.files.storage import default_storage
-from django.core.files.images import ImageFile, get_image_dimensions
-from django.core.files.uploadedfile import UploadedFile
-from django.utils.functional import curry
+from django.core.files.images import ImageFile
from django.db.models import signals
from django.utils.encoding import force_unicode, smart_str
-from django.utils.translation import ugettext_lazy, ugettext as _
-from django import forms
-from django.db.models.loading import cache
+from django.utils.translation import ugettext_lazy as _
class FieldFile(File):
def __init__(self, instance, field, name):
@@ -215,7 +211,7 @@ class FileField(Field):
# The descriptor to use for accessing the attribute off of the class.
descriptor_class = FileDescriptor
- description = ugettext_lazy("File path")
+ description = _("File path")
def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs):
for arg in ('primary_key', 'unique'):
@@ -312,6 +308,7 @@ def __set__(self, instance, value):
self.field.update_dimension_fields(instance, force=True)
class ImageFieldFile(ImageFile, FieldFile):
+
def delete(self, save=True):
# Clear the image dimensions cache
if hasattr(self, '_dimensions_cache'):
@@ -321,7 +318,7 @@ def delete(self, save=True):
class ImageField(FileField):
attr_class = ImageFieldFile
descriptor_class = ImageFileDescriptor
- description = ugettext_lazy("File path")
+ description = _("File path")
def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, **kwargs):
self.width_field, self.height_field = width_field, height_field
View
6 django/db/models/fields/related.py
@@ -1,5 +1,4 @@
-from django.conf import settings
-from django.db import connection, router, transaction
+from django.db import connection, router
from django.db.backends import util
from django.db.models import signals, get_model
from django.db.models.fields import (AutoField, Field, IntegerField,
@@ -9,8 +8,7 @@
from django.db.models.query_utils import QueryWrapper
from django.db.models.deletion import CASCADE
from django.utils.encoding import smart_unicode