1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed E225 pep8 warnings.

This commit is contained in:
Tim Graham
2013-10-23 06:09:29 -04:00
parent 51d2e1fb23
commit ae48d77ef8
43 changed files with 102 additions and 91 deletions

View File

@@ -456,7 +456,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
def exactly_two(np):
return np == 2
def two_to_three(np):
return np >= 2 and np <=3
return np >= 2 and np <= 3
if (lookup_type in self.distance_functions and
lookup_type != 'dwithin'):
return two_to_three(num_param)

View File

@@ -32,7 +32,7 @@ class GeometryProxy(object):
if isinstance(geom_value, self._klass):
geom = geom_value
elif (geom_value is None) or (geom_value==''):
elif (geom_value is None) or (geom_value == ''):
geom = None
else:
# Otherwise, a Geometry object is built using the field's contents,

View File

@@ -37,7 +37,7 @@ class OGRGeomType(object):
elif isinstance(type_input, six.string_types):
type_input = type_input.lower()
if type_input == 'geometry':
type_input='unknown'
type_input = 'unknown'
num = self._str_types.get(type_input, None)
if num is None:
raise OGRException('Invalid OGR String Type "%s"' % type_input)

View File

@@ -67,5 +67,5 @@ islocal = int_output(lgdal.OSRIsLocal, [c_void_p])
isprojected = int_output(lgdal.OSRIsProjected, [c_void_p])
# Coordinate transformation
new_ct= srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
new_ct = srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
destroy_ct = void_output(std_call('OCTDestroyCoordinateTransformation'), [c_void_p], errcheck=False)

View File

@@ -58,7 +58,7 @@ class LineString(GEOSGeometry):
# Creating a coordinate sequence object because it is easier to
# set the points using GEOSCoordSeq.__setitem__().
cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim==3))
cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim == 3))
for i in xrange(ncoords):
if numpy_coords:

View File

@@ -14,7 +14,7 @@ prepared_destroy.restype = None
# Prepared geometry binary predicate support.
def prepared_predicate(func):
func.argtypes= [PREPGEOM_PTR, GEOM_PTR]
func.argtypes = [PREPGEOM_PTR, GEOM_PTR]
func.restype = c_char
func.errcheck = check_predicate
return func

View File

@@ -12,7 +12,7 @@ class GoogleMapException(Exception):
# 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='
GOOGLE_MAPS_URL = 'http://maps.google.com/maps?file=api&v=%s&key='
class GoogleMap(object):

View File

@@ -52,7 +52,7 @@ class GEvent(object):
def __str__(self):
"Returns the parameter part of a GEvent."
return mark_safe('"%s", %s' %(self.event, self.action))
return mark_safe('"%s", %s' % (self.event, self.action))
@python_2_unicode_compatible
class GOverlayBase(object):
@@ -303,7 +303,7 @@ class GMarker(GOverlayBase):
super(GMarker, self).__init__()
def latlng_from_coords(self, coords):
return 'new GLatLng(%s,%s)' %(coords[1], coords[0])
return 'new GLatLng(%s,%s)' % (coords[1], coords[0])
def options(self):
result = []

View File

@@ -95,7 +95,7 @@ class GoogleZoom(object):
lon = (px[0] - npix) / self._degpp[zoom]
# Calculating the latitude value.
lat = RTOD * (2 * atan(exp((px[1] - npix)/ (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
lat = RTOD * (2 * atan(exp((px[1] - npix) / (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
# Returning the longitude, latitude coordinate pair.
return (lon, lat)

View File

@@ -163,7 +163,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertFalse(invalid.is_valid())
self.assertTrue('Invalid geometry value' in str(invalid.errors))
for invalid in [geo for key, geo in self.geometries.items() if key!='point']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'point']:
self.assertFalse(PointForm(data={'p': invalid.wkt}).is_valid())
def test_multipointfield(self):
@@ -176,7 +176,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(PointForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='multipoint']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'multipoint']:
self.assertFalse(PointForm(data={'p': invalid.wkt}).is_valid())
def test_linestringfield(self):
@@ -189,7 +189,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(LineStringForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='linestring']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'linestring']:
self.assertFalse(LineStringForm(data={'p': invalid.wkt}).is_valid())
def test_multilinestringfield(self):
@@ -202,7 +202,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(LineStringForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='multilinestring']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'multilinestring']:
self.assertFalse(LineStringForm(data={'p': invalid.wkt}).is_valid())
def test_polygonfield(self):
@@ -215,7 +215,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(PolygonForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='polygon']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'polygon']:
self.assertFalse(PolygonForm(data={'p': invalid.wkt}).is_valid())
def test_multipolygonfield(self):
@@ -228,7 +228,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(PolygonForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='multipolygon']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'multipolygon']:
self.assertFalse(PolygonForm(data={'p': invalid.wkt}).is_valid())
def test_geometrycollectionfield(self):
@@ -241,7 +241,7 @@ class SpecializedFieldTest(SimpleTestCase):
self.assertMapWidget(form)
self.assertFalse(GeometryForm().is_valid())
for invalid in [geo for key, geo in self.geometries.items() if key!='geometrycollection']:
for invalid in [geo for key, geo in self.geometries.items() if key != 'geometrycollection']:
self.assertFalse(GeometryForm(data={'g': invalid.wkt}).is_valid())
def test_osm_widget(self):

View File

@@ -272,5 +272,5 @@ def suite():
def run(verbosity=2):
unittest.TextTestRunner(verbosity=verbosity).run(suite())
if __name__=="__main__":
if __name__ == "__main__":
run()

View File

@@ -214,11 +214,11 @@ class BaseTests(object):
@override_settings(
INSTALLED_APPS=filter(
lambda app:app!='django.contrib.messages', settings.INSTALLED_APPS),
lambda app: app != 'django.contrib.messages', settings.INSTALLED_APPS),
MIDDLEWARE_CLASSES=filter(
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
lambda m: 'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
lambda p: 'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
@@ -239,11 +239,11 @@ class BaseTests(object):
@override_settings(
INSTALLED_APPS=filter(
lambda app:app!='django.contrib.messages', settings.INSTALLED_APPS),
lambda app: app != 'django.contrib.messages', settings.INSTALLED_APPS),
MIDDLEWARE_CLASSES=filter(
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
lambda m: 'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
lambda p: 'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)

View File

@@ -15,7 +15,7 @@ class Redirect(models.Model):
verbose_name = _('redirect')
verbose_name_plural = _('redirects')
db_table = 'django_redirect'
unique_together=(('site', 'old_path'),)
unique_together = (('site', 'old_path'),)
ordering = ('old_path',)
def __str__(self):

View File

@@ -29,7 +29,7 @@ class CurrentSiteManager(models.Manager):
try:
field = self.model._meta.get_field(self.__field_name)
if not isinstance(field, (models.ForeignKey, models.ManyToManyField)):
raise TypeError("%s must be a ForeignKey or ManyToManyField." %self.__field_name)
raise TypeError("%s must be a ForeignKey or ManyToManyField." % self.__field_name)
except FieldDoesNotExist:
raise ValueError("%s couldn't find a field named %s in %s." %
(self.__class__.__name__, self.__field_name, self.model._meta.object_name))

View File

@@ -138,7 +138,7 @@ class TranslatableFile(object):
if msgs:
if is_templatized:
# Remove '.py' suffix
if os.name =='nt':
if os.name == 'nt':
# Preserve '.\' prefix on Windows to respect gettext behavior
old = '#: ' + work_file
new = '#: ' + orig_file

View File

@@ -83,7 +83,7 @@ class BoundMethodWeakref(object):
of already-referenced methods.
"""
key = cls.calculateKey(target)
current =cls._allInstances.get(key)
current = cls._allInstances.get(key)
if current is not None:
current.deletionMethods.append(onDelete)
return current

View File

@@ -274,7 +274,7 @@ class PasswordInput(TextInput):
def render(self, name, value, attrs=None):
if not self.render_value:
value=None
value = None
return super(PasswordInput, self).render(name, value, attrs)
class HiddenInput(Input):

View File

@@ -500,7 +500,7 @@ class ImmutableList(tuple):
extend = complain
insert = complain
pop = complain
remove= complain
remove = complain
sort = complain
reverse = complain

View File

@@ -170,7 +170,7 @@ class TimeFormat(Formatter):
def u(self):
"Microseconds; i.e. '000000' to '999999'"
return '%06d' %self.data.microsecond
return '%06d' % self.data.microsecond
def Z(self):
"""

View File

@@ -54,7 +54,7 @@ def _findall(text, substr):
if j == -1:
break
sites.append(j)
i=j+1
i = j + 1
return sites
def strftime(dt, fmt):