Permalink
Browse files

Continue to attack E302 violations

  • Loading branch information...
1 parent 8b3d9d9 commit 19256f300e44b0a682f76fc1dda673862bae49d1 @alex alex committed Nov 2, 2013
Showing with 171 additions and 2 deletions.
  1. +6 −0 django/contrib/formtools/tests/wizard/namedwizardtests/forms.py
  2. +2 −0 django/contrib/formtools/tests/wizard/namedwizardtests/urls.py
  3. +2 −0 django/contrib/formtools/tests/wizard/test_forms.py
  4. +7 −0 django/contrib/formtools/tests/wizard/wizardtests/forms.py
  5. +1 −0 django/contrib/formtools/wizard/forms.py
  6. +2 −0 django/contrib/formtools/wizard/storage/exceptions.py
  7. +1 −0 django/contrib/formtools/wizard/views.py
  8. +1 −0 django/contrib/gis/admin/options.py
  9. +1 −0 django/contrib/gis/db/backends/base.py
  10. +6 −0 django/contrib/gis/db/backends/mysql/compiler.py
  11. +1 −1 django/contrib/gis/db/backends/mysql/creation.py
  12. +1 −0 django/contrib/gis/db/backends/mysql/introspection.py
  13. +1 −0 django/contrib/gis/db/backends/oracle/adapter.py
  14. +7 −0 django/contrib/gis/db/backends/oracle/compiler.py
  15. +1 −0 django/contrib/gis/db/backends/oracle/creation.py
  16. +1 −0 django/contrib/gis/db/backends/oracle/introspection.py
  17. +2 −0 django/contrib/gis/db/backends/oracle/models.py
  18. +5 −0 django/contrib/gis/db/backends/oracle/operations.py
  19. +1 −0 django/contrib/gis/db/backends/postgis/adapter.py
  20. +2 −0 django/contrib/gis/db/backends/postgis/introspection.py
  21. +2 −0 django/contrib/gis/db/backends/postgis/models.py
  22. +6 −0 django/contrib/gis/db/backends/postgis/operations.py
  23. +1 −0 django/contrib/gis/db/backends/spatialite/adapter.py
  24. +1 −0 django/contrib/gis/db/backends/spatialite/base.py
  25. +1 −0 django/contrib/gis/db/backends/spatialite/client.py
  26. +2 −0 django/contrib/gis/db/backends/spatialite/introspection.py
  27. +2 −0 django/contrib/gis/db/backends/spatialite/models.py
  28. +6 −0 django/contrib/gis/db/backends/spatialite/operations.py
  29. +2 −0 django/contrib/gis/db/backends/utils.py
  30. +5 −0 django/contrib/gis/db/models/aggregates.py
  31. +9 −0 django/contrib/gis/db/models/fields.py
  32. +1 −0 django/contrib/gis/db/models/manager.py
  33. +1 −0 django/contrib/gis/db/models/proxy.py
  34. +2 −0 django/contrib/gis/db/models/query.py
  35. +6 −0 django/contrib/gis/db/models/sql/aggregates.py
  36. +7 −0 django/contrib/gis/db/models/sql/compiler.py
  37. +4 −0 django/contrib/gis/db/models/sql/conversion.py
  38. +1 −0 django/contrib/gis/db/models/sql/query.py
  39. +2 −0 django/contrib/gis/db/models/sql/where.py
  40. +5 −0 django/contrib/gis/feeds.py
  41. +1 −0 django/contrib/gis/gdal/base.py
  42. +1 −0 django/contrib/gis/gdal/datasource.py
  43. +1 −0 django/contrib/gis/gdal/driver.py
  44. +2 −0 django/contrib/gis/gdal/envelope.py
  45. +5 −0 django/contrib/gis/gdal/error.py
  46. +1 −0 django/contrib/gis/gdal/feature.py
  47. +12 −0 django/contrib/gis/gdal/field.py
  48. +1 −1 django/contrib/gis/gdal/geometries.py
  49. +1 −0 django/contrib/gis/gdal/layer.py
  50. +1 −0 django/contrib/gis/gdal/srs.py
  51. +2 −0 django/contrib/gis/geoip/base.py
  52. +1 −0 django/contrib/gis/geos/base.py
  53. +2 −0 django/contrib/gis/geos/io.py
  54. +1 −0 django/contrib/gis/geos/mutable_list.py
  55. +1 −0 django/contrib/gis/geos/polygon.py
  56. +1 −0 django/contrib/gis/geos/prepared.py
  57. +2 −0 django/contrib/gis/measure.py
  58. +4 −0 django/contrib/gis/shortcuts.py
  59. +1 −0 django/contrib/gis/sitemaps/georss.py
  60. +3 −0 django/contrib/gis/sitemaps/kml.py
  61. +1 −0 django/contrib/gis/sitemaps/views.py
  62. +1 −0 django/contrib/gis/tests/test_measure.py
  63. +4 −0 django/contrib/gis/tests/utils.py
  64. +1 −0 django/contrib/gis/views.py
  65. +1 −0 django/contrib/sites/management.py
  66. +1 −0 django/contrib/staticfiles/handlers.py
  67. +1 −0 django/contrib/staticfiles/urls.py
@@ -14,21 +14,25 @@
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
temp_storage = FileSystemStorage(location=temp_storage_location)
+
class Page1(forms.Form):
name = forms.CharField(max_length=100)
user = forms.ModelChoiceField(queryset=User.objects.all())
thirsty = forms.NullBooleanField()
+
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.CharField(max_length=100)
file1 = forms.FileField()
+
class Page3(forms.Form):
random_crap = forms.CharField(max_length=100)
Page4 = formset_factory(Page3, extra=2)
+
class ContactWizard(NamedUrlWizardView):
file_storage = temp_storage
@@ -44,8 +48,10 @@ def done(self, form_list, **kwargs):
c['this_will_fail'] = self.get_cleaned_data_for_step('this_will_fail')
return HttpResponse(Template('').render(c))
+
class SessionContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
+
class CookieContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
@@ -2,13 +2,15 @@
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
+
def get_named_session_wizard():
return SessionContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
url_name='nwiz_session',
done_step_name='nwiz_session_done'
)
+
def get_named_cookie_wizard():
return CookieContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('form4', Page4)],
@@ -81,12 +81,14 @@ def get_form_kwargs(self, step, *args, **kwargs):
kwargs['test'] = True
return kwargs
+
class TestWizardWithInitAttrs(TestWizard):
form_list = [Step1, Step2]
condition_dict = {'step2': True}
initial_dict = {'start': {'name': 'value1'}}
instance_dict = {'start': User()}
+
class FormTests(TestCase):
def test_form_init(self):
testform = TestWizard.get_initkwargs([Step1, Step2])
@@ -15,21 +15,25 @@
temp_storage_location = tempfile.mkdtemp(dir=os.environ.get('DJANGO_TEST_TEMP_DIR'))
temp_storage = FileSystemStorage(location=temp_storage_location)
+
class Page1(forms.Form):
name = forms.CharField(max_length=100)
user = forms.ModelChoiceField(queryset=User.objects.all())
thirsty = forms.NullBooleanField()
+
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.CharField(max_length=100)
file1 = forms.FileField()
+
class Page3(forms.Form):
random_crap = forms.CharField(max_length=100)
Page4 = formset_factory(Page3, extra=2)
+
class ContactWizard(WizardView):
file_storage = temp_storage
@@ -51,15 +55,18 @@ def get_context_data(self, form, **kwargs):
context.update({'another_var': True})
return context
+
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email')
UserFormSet = modelformset_factory(User, form=UserForm)
+
class SessionContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'
+
class CookieContactWizard(ContactWizard):
storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage'
@@ -1,5 +1,6 @@
from django import forms
+
class ManagementForm(forms.Form):
"""
``ManagementForm`` is used to keep track of the current wizard step.
@@ -1,7 +1,9 @@
from django.core.exceptions import ImproperlyConfigured
+
class MissingStorage(ImproperlyConfigured):
pass
+
class NoFileStorageConfigured(ImproperlyConfigured):
pass
@@ -28,6 +28,7 @@ def normalize_name(name):
new = re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', name)
return new.lower().strip('_')
+
class StepsHelper(object):
def __init__(self, wizard):
@@ -3,6 +3,7 @@
from django.contrib.gis.gdal import OGRGeomType
from django.contrib.gis.db import models
+
class GeoModelAdmin(ModelAdmin):
"""
The administration options class for Geographic models. Map settings
@@ -143,6 +143,7 @@ def geometry_columns(self):
def spatial_ref_sys(self):
raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_ref_sys() method')
+
@python_2_unicode_compatible
class SpatialRefSysMixin(object):
"""
@@ -3,6 +3,7 @@
SQLCompiler = compiler.SQLCompiler
+
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
def resolve_columns(self, row, fields=()):
"""
@@ -19,17 +20,22 @@ def resolve_columns(self, row, fields=()):
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
pass
+
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
pass
+
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
pass
+
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
pass
+
class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
pass
+
class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler):
pass
@@ -1,7 +1,7 @@
from django.db.backends.mysql.creation import DatabaseCreation
-class MySQLCreation(DatabaseCreation):
+class MySQLCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
from django.contrib.gis.db.models.fields import GeometryField
output = super(MySQLCreation, self).sql_indexes_for_field(model, f, style)
@@ -3,6 +3,7 @@
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.mysql.introspection import DatabaseIntrospection
+
class MySQLIntrospection(DatabaseIntrospection):
# Updating the data_types_reverse dictionary with the appropriate
# type for Geometry fields.
@@ -1,5 +1,6 @@
from cx_Oracle import CLOB
from django.contrib.gis.db.backends.adapter import WKTAdapter
+
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
@@ -3,23 +3,30 @@
SQLCompiler = compiler.SQLCompiler
+
class GeoSQLCompiler(BaseGeoSQLCompiler, SQLCompiler):
pass
+
class SQLInsertCompiler(compiler.SQLInsertCompiler, GeoSQLCompiler):
pass
+
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, GeoSQLCompiler):
pass
+
class SQLUpdateCompiler(compiler.SQLUpdateCompiler, GeoSQLCompiler):
pass
+
class SQLAggregateCompiler(compiler.SQLAggregateCompiler, GeoSQLCompiler):
pass
+
class SQLDateCompiler(compiler.SQLDateCompiler, GeoSQLCompiler):
pass
+
class SQLDateTimeCompiler(compiler.SQLDateTimeCompiler, GeoSQLCompiler):
pass
@@ -1,6 +1,7 @@
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.utils import truncate_name
+
class OracleCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
@@ -3,6 +3,7 @@
from django.db.backends.oracle.introspection import DatabaseIntrospection
from django.utils import six
+
class OracleIntrospection(DatabaseIntrospection):
# Associating any OBJECTVAR instances with GeometryField. Of course,
# this won't work right on Oracle objects that aren't MDSYS.SDO_GEOMETRY,
@@ -11,6 +11,7 @@
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
+
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"Maps to the Oracle USER_SDO_GEOM_METADATA table."
@@ -42,6 +43,7 @@ def geom_col_name(cls):
def __str__(self):
return '%s - %s (SRID: %s)' % (self.table_name, self.column_name, self.srid)
+
class SpatialRefSys(models.Model, SpatialRefSysMixin):
"Maps to the Oracle MDSYS.CS_SRS table."
cs_name = models.CharField(max_length=68)
@@ -28,6 +28,7 @@ def __init__(self, func, **kwargs):
kwargs.setdefault('result', 'TRUE')
super(SDOOperation, self).__init__(func, **kwargs)
+
class SDODistance(SpatialFunction):
"Class for Distance queries."
sql_template = ('%(function)s(%(geo_col)s, %(geometry)s, %(tolerance)s) '
@@ -39,13 +40,15 @@ def __init__(self, op, tolerance=0.05):
tolerance=tolerance,
operator=op, result='%s')
+
class SDODWithin(SpatialFunction):
dwithin_func = 'SDO_WITHIN_DISTANCE'
sql_template = "%(function)s(%(geo_col)s, %(geometry)s, %%s) = 'TRUE'"
def __init__(self):
super(SDODWithin, self).__init__(self.dwithin_func)
+
class SDOGeomRelate(SpatialFunction):
"Class for using SDO_GEOM.RELATE."
relate_func = 'SDO_GEOM.RELATE'
@@ -58,6 +61,7 @@ def __init__(self, mask, tolerance=0.05):
super(SDOGeomRelate, self).__init__(self.relate_func, operator='=',
mask=mask, tolerance=tolerance)
+
class SDORelate(SpatialFunction):
"Class for using SDO_RELATE."
masks = 'TOUCH|OVERLAPBDYDISJOINT|OVERLAPBDYINTERSECT|EQUAL|INSIDE|COVEREDBY|CONTAINS|COVERS|ANYINTERACT|ON'
@@ -73,6 +77,7 @@ def __init__(self, mask):
# Valid distance types and substitutions
dtypes = (Decimal, Distance, float) + six.integer_types
+
class OracleOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = "django.contrib.gis.db.backends.oracle.compiler"
@@ -6,6 +6,7 @@
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
+
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
@@ -1,9 +1,11 @@
from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection
from django.contrib.gis.gdal import OGRGeomType
+
class GeoIntrospectionError(Exception):
pass
+
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# introspection is actually performed.
@@ -5,6 +5,7 @@
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
+
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"""
@@ -44,6 +45,7 @@ def __str__(self):
(self.f_table_name, self.f_geometry_column,
self.coord_dimension, self.type, self.srid)
+
class SpatialRefSys(models.Model, SpatialRefSysMixin):
"""
The 'spatial_ref_sys' table from PostGIS. See the PostGIS
@@ -22,15 +22,18 @@ class PostGISOperator(SpatialOperation):
def __init__(self, operator):
super(PostGISOperator, self).__init__(operator=operator)
+
class PostGISFunction(SpatialFunction):
"For PostGIS function calls (e.g., `ST_Contains(table, geom)`)."
def __init__(self, prefix, function, **kwargs):
super(PostGISFunction, self).__init__(prefix + function, **kwargs)
+
class PostGISFunctionParam(PostGISFunction):
"For PostGIS functions that take another parameter (e.g. DWithin, Relate)."
sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s)'
+
class PostGISDistance(PostGISFunction):
"For PostGIS distance operations."
dist_func = 'Distance'
@@ -40,6 +43,7 @@ def __init__(self, prefix, operator):
super(PostGISDistance, self).__init__(prefix, self.dist_func,
operator=operator)
+
class PostGISSpheroidDistance(PostGISFunction):
"For PostGIS spherical distance operations (using the spheroid)."
dist_func = 'distance_spheroid'
@@ -50,10 +54,12 @@ def __init__(self, prefix, operator):
super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,
operator=operator)
+
class PostGISSphereDistance(PostGISDistance):
"For PostGIS spherical distance operations."
dist_func = 'distance_sphere'
+
class PostGISRelate(PostGISFunctionParam):
"For PostGIS Relate(<geom>, <pattern>) calls."
pattern_regex = re.compile(r'^[012TF\*]{9}$')
@@ -1,6 +1,7 @@
from django.db.backends.sqlite3.base import Database
from django.contrib.gis.db.backends.adapter import WKTAdapter
+
class SpatiaLiteAdapter(WKTAdapter):
"SQLite adaptor for geometry objects."
def __conform__(self, protocol):
Oops, something went wrong. Retry.

0 comments on commit 19256f3

Please sign in to comment.