Skip to content

Commit 96fd555

Browse files
committed
Removed a ton of unused local vars
1 parent 0ee8aa5 commit 96fd555

File tree

18 files changed

+47
-68
lines changed

18 files changed

+47
-68
lines changed

django/contrib/auth/tests/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ def remote_user_auth_view(request):
2323
return HttpResponse(t.render(c))
2424

2525
def auth_processor_no_attr_access(request):
26-
r1 = render_to_response('context_processors/auth_attrs_no_access.html',
26+
render_to_response('context_processors/auth_attrs_no_access.html',
2727
RequestContext(request, {}, processors=[context_processors.auth]))
2828
# *After* rendering, we check whether the session was accessed
2929
return render_to_response('context_processors/auth_attrs_test_access.html',
3030
{'session_accessed':request.session.accessed})
3131

3232
def auth_processor_attr_access(request):
33-
r1 = render_to_response('context_processors/auth_attrs_access.html',
33+
render_to_response('context_processors/auth_attrs_access.html',
3434
RequestContext(request, {}, processors=[context_processors.auth]))
3535
return render_to_response('context_processors/auth_attrs_test_access.html',
3636
{'session_accessed':request.session.accessed})

django/contrib/gis/db/backends/spatialite/creation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def sql_indexes_for_field(self, model, f, style):
7474

7575
if isinstance(f, GeometryField):
7676
gqn = self.connection.ops.geo_quote_name
77-
qn = self.connection.ops.quote_name
7877
db_table = model._meta.db_table
7978

8079
output.append(style.SQL_KEYWORD('SELECT ') +

django/contrib/gis/geos/tests/test_geos.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def test_polygon_comparison(self):
469469

470470
def test_multipolygons(self):
471471
"Testing MultiPolygon objects."
472-
prev = fromstr('POINT (0 0)')
472+
fromstr('POINT (0 0)')
473473
for mp in self.geometries.multipolygons:
474474
mpoly = fromstr(mp.wkt)
475475
self.assertEqual(mpoly.geom_type, 'MultiPolygon')
@@ -709,7 +709,7 @@ def test_mutable_geometries(self):
709709
new = Point(random.randint(21, 100), random.randint(21, 100))
710710
# Testing the assignment
711711
mp[i] = new
712-
s = str(new) # what was used for the assignment is still accessible
712+
str(new) # what was used for the assignment is still accessible
713713
self.assertEqual(mp[i], new)
714714
self.assertEqual(mp[i].wkt, new.wkt)
715715
self.assertNotEqual(pnt, mp[i])
@@ -730,7 +730,7 @@ def test_mutable_geometries(self):
730730
self.assertNotEqual(mpoly[i], poly)
731731
# Testing the assignment
732732
mpoly[i] = poly
733-
s = str(poly) # Still accessible
733+
str(poly) # Still accessible
734734
self.assertEqual(mpoly[i], poly)
735735
self.assertNotEqual(mpoly[i], old_poly)
736736

django/contrib/gis/management/commands/ogrinspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def handle(self, *args, **options):
9393
show_mapping = options.pop('mapping', False)
9494

9595
# Getting rid of settings that `_ogrinspect` doesn't like.
96-
verbosity = options.pop('verbosity', False)
97-
settings = options.pop('settings', False)
96+
options.pop('verbosity', False)
97+
options.pop('settings', False)
9898

9999
# Returning the output of ogrinspect with the given arguments
100100
# and options.

django/contrib/gis/tests/geoapp/test_regress.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_kmz(self):
3737
'description' : name,
3838
'kml' : '<Point><coordinates>5.0,23.0</coordinates></Point>'
3939
}]
40-
kmz = render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
40+
render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
4141

4242
@no_spatialite
4343
@no_mysql
@@ -52,8 +52,8 @@ def test_extent(self):
5252
def test_unicode_date(self):
5353
"Testing dates are converted properly, even on SpatiaLite. See #16408."
5454
founded = datetime(1857, 5, 23)
55-
mansfield = PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)',
56-
founded=founded)
55+
PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)',
56+
founded=founded)
5757
self.assertEqual(founded, PennsylvaniaCity.objects.datetimes('founded', 'day')[0])
5858
self.assertEqual(founded, PennsylvaniaCity.objects.aggregate(Min('founded'))['founded__min'])
5959

django/contrib/gis/tests/geoapp/tests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_geometryfield(self):
183183
def test_inherited_geofields(self):
184184
"Test GeoQuerySet methods on inherited Geometry fields."
185185
# Creating a Pennsylvanian city.
186-
mansfield = PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)')
186+
PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)')
187187

188188
# All transformation SQL will need to be performed on the
189189
# _parent_ table.
@@ -410,7 +410,6 @@ def test_centroid(self):
410410
def test_diff_intersection_union(self):
411411
"Testing the `difference`, `intersection`, `sym_difference`, and `union` GeoQuerySet methods."
412412
geom = Point(5, 23)
413-
tol = 1
414413
qs = Country.objects.all().difference(geom).sym_difference(geom).union(geom)
415414

416415
# XXX For some reason SpatiaLite does something screwey with the Texas geometry here. Also,
@@ -692,7 +691,7 @@ def test_snap_to_grid(self):
692691
'12.46472 43.89555,12.45917 43.89611,12.41639 43.90472,'
693692
'12.41222 43.90610,12.40782 43.91366,12.40389 43.92667,'
694693
'12.40500 43.94833,12.40889 43.95499,12.41580 43.95795)))')
695-
sm = Country.objects.create(name='San Marino', mpoly=fromstr(wkt))
694+
Country.objects.create(name='San Marino', mpoly=fromstr(wkt))
696695

697696
# Because floating-point arithmetic isn't exact, we set a tolerance
698697
# to pass into GEOS `equals_exact`.

django/contrib/gis/tests/geogapp/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test03_distance_method(self):
4242
"Testing GeoQuerySet.distance() support on non-point geography fields."
4343
# `GeoQuerySet.distance` is not allowed geometry fields.
4444
htown = City.objects.get(name='Houston')
45-
qs = Zipcode.objects.distance(htown.point)
45+
Zipcode.objects.distance(htown.point)
4646

4747
def test04_invalid_operators_functions(self):
4848
"Ensuring exceptions are raised for operators & functions invalid on geography fields."

django/contrib/gis/tests/layermap/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def test_init(self):
5858
# ensuring that a LayerMapError is raised.
5959
for bad_map in (bad1, bad2, bad3):
6060
with self.assertRaises(LayerMapError):
61-
lm = LayerMapping(City, city_shp, bad_map)
61+
LayerMapping(City, city_shp, bad_map)
6262

6363
# A LookupError should be thrown for bogus encodings.
6464
with self.assertRaises(LookupError):
65-
lm = LayerMapping(City, city_shp, city_mapping, encoding='foobar')
65+
LayerMapping(City, city_shp, city_mapping, encoding='foobar')
6666

6767
def test_simple_layermap(self):
6868
"Test LayerMapping import of a simple point shapefile."

django/contrib/gis/tests/relatedapp/tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test04b_related_union_aggregate(self):
119119
def test05_select_related_fk_to_subclass(self):
120120
"Testing that calling select_related on a query over a model with an FK to a model subclass works"
121121
# Regression test for #9752.
122-
l = list(DirectoryEntry.objects.all().select_related())
122+
list(DirectoryEntry.objects.all().select_related())
123123

124124
def test06_f_expressions(self):
125125
"Testing F() expressions on GeometryFields."
@@ -134,15 +134,15 @@ def test06_f_expressions(self):
134134
c1 = pcity.location.point
135135
c2 = c1.transform(2276, clone=True)
136136
b2 = c2.buffer(100)
137-
p1 = Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)
137+
Parcel.objects.create(name='P1', city=pcity, center1=c1, center2=c2, border1=b1, border2=b2)
138138

139139
# Now creating a second Parcel where the borders are the same, just
140140
# in different coordinate systems. The center points are also the
141141
# same (but in different coordinate systems), and this time they
142142
# actually correspond to the centroid of the border.
143143
c1 = b1.centroid
144144
c2 = c1.transform(2276, clone=True)
145-
p2 = Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)
145+
Parcel.objects.create(name='P2', city=pcity, center1=c1, center2=c2, border1=b1, border2=b1)
146146

147147
# Should return the second Parcel, which has the center within the
148148
# border.
@@ -263,7 +263,7 @@ def test13c_count(self):
263263
@no_oracle
264264
def test13_select_related_null_fk(self):
265265
"Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381."
266-
no_author = Book.objects.create(title='Without Author')
266+
Book.objects.create(title='Without Author')
267267
b = Book.objects.select_related('author').get(title='Without Author')
268268
# Should be `None`, and not a 'dummy' model.
269269
self.assertEqual(None, b.author)
@@ -294,7 +294,7 @@ def test15_invalid_select_related(self):
294294
# This triggers TypeError when `get_default_columns` has no `local_only`
295295
# keyword. The TypeError is swallowed if QuerySet is actually
296296
# evaluated as list generation swallows TypeError in CPython.
297-
sql = str(qs.query)
297+
str(qs.query)
298298

299299
def test16_annotated_date_queryset(self):
300300
"Ensure annotated date querysets work if spatial backend is used. See #14648."

django/contrib/gis/tests/test_measure.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,16 @@ def testAddition(self):
6464
self.assertEqual(d4.m, -200)
6565

6666
with self.assertRaises(TypeError):
67-
d5 = d1 + 1
68-
self.fail('Distance + number should raise TypeError')
67+
d1 + 1
6968

7069
with self.assertRaises(TypeError):
71-
d5 = d1 - 1
72-
self.fail('Distance - number should raise TypeError')
70+
d1 - 1
7371

7472
with self.assertRaises(TypeError):
7573
d1 += 1
76-
self.fail('Distance += number should raise TypeError')
7774

7875
with self.assertRaises(TypeError):
7976
d1 -= 1
80-
self.fail('Distance -= number should raise TypeError')
8177

8278
def testMultiplication(self):
8379
"Test multiplication & division"
@@ -103,11 +99,9 @@ def testMultiplication(self):
10399

104100
with self.assertRaises(TypeError):
105101
d1 *= D(m=1)
106-
self.fail('Distance *= Distance should raise TypeError')
107102

108103
with self.assertRaises(TypeError):
109104
d1 /= D(m=1)
110-
self.fail('Distance /= Distance should raise TypeError')
111105

112106
def testUnitConversions(self):
113107
"Testing default units during maths"
@@ -196,20 +190,16 @@ def testAddition(self):
196190
self.assertEqual(a4.sq_m, -200)
197191

198192
with self.assertRaises(TypeError):
199-
a5 = a1 + 1
200-
self.fail('Area + number should raise TypeError')
193+
a1 + 1
201194

202195
with self.assertRaises(TypeError):
203-
a5 = a1 - 1
204-
self.fail('Area - number should raise TypeError')
196+
a1 - 1
205197

206198
with self.assertRaises(TypeError):
207199
a1 += 1
208-
self.fail('Area += number should raise TypeError')
209200

210201
with self.assertRaises(TypeError):
211202
a1 -= 1
212-
self.fail('Area -= number should raise TypeError')
213203

214204
def testMultiplication(self):
215205
"Test multiplication & division"
@@ -228,20 +218,16 @@ def testMultiplication(self):
228218
self.assertEqual(a4.sq_m, 10)
229219

230220
with self.assertRaises(TypeError):
231-
a5 = a1 * A(sq_m=1)
232-
self.fail('Area * Area should raise TypeError')
221+
a1 * A(sq_m=1)
233222

234223
with self.assertRaises(TypeError):
235224
a1 *= A(sq_m=1)
236-
self.fail('Area *= Area should raise TypeError')
237225

238226
with self.assertRaises(TypeError):
239-
a5 = a1 / A(sq_m=1)
240-
self.fail('Area / Area should raise TypeError')
227+
a1 / A(sq_m=1)
241228

242229
with self.assertRaises(TypeError):
243230
a1 /= A(sq_m=1)
244-
self.fail('Area /= Area should raise TypeError')
245231

246232
def testUnitConversions(self):
247233
"Testing default units during maths"

0 commit comments

Comments
 (0)