Permalink
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...
1 parent 956da72 commit 24f4764a48e4141923a78c8820e4cd7b411ec0fc @jezdez jezdez committed Jul 13, 2011
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
@@ -8,8 +8,9 @@
"""
from hotshot import stats
+import os
import pstats
-import sys, os
+import sys
def gather_stats(p):
profiles = {}
@@ -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
@@ -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
@@ -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_')
@@ -1,4 +1,3 @@
-import datetime
from warnings import warn
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
@@ -1,4 +1,3 @@
-from django.db import connection
from django.contrib.auth.models import User, Permission
@@ -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
@@ -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)\
@@ -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):
@@ -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
@@ -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
@@ -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
@@ -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
@@ -5,7 +5,6 @@
import hashlib
from django.conf import settings
-from django.forms import BooleanField
from django.utils.crypto import salted_hmac
@@ -1,4 +1,3 @@
-from django.core.files.uploadedfile import UploadedFile
from django.contrib.formtools.wizard import storage
@@ -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
@@ -1,4 +1,3 @@
-import copy
import re
from django import forms
@@ -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
@@ -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
@@ -3,7 +3,6 @@
`SpatialRefSys` model the backend.
"""
import re
-from django.conf import settings
from django.contrib.gis import gdal
class BaseSpatialOperations(object):
@@ -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):
@@ -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
@@ -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)
@@ -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
@@ -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.
@@ -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
@@ -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):
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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):
@@ -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):
@@ -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. ####
@@ -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',
@@ -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)
@@ -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)
Oops, something went wrong.

0 comments on commit 24f4764

Please sign in to comment.