[1.11.x] Removed unused variables that are overwritten.

Backport of ebf34c3cdc from master
This commit is contained in:
Mads Jensen 2017-01-25 15:14:05 +01:00 committed by Tim Graham
parent a69fc396e4
commit c94cb4f865
12 changed files with 4 additions and 16 deletions

View File

@ -302,7 +302,6 @@ class ModelDetailView(BaseAdminDocsView):
}) })
else: else:
arguments = get_func_full_args(func) arguments = get_func_full_args(func)
print_arguments = arguments
# Join arguments with ', ' and in case of default value, # Join arguments with ', ' and in case of default value,
# join it with '='. Use repr() so that strings will be # join it with '='. Use repr() so that strings will be
# correctly displayed. # correctly displayed.

View File

@ -146,7 +146,6 @@ class URLValidator(RegexValidator):
validate_ipv6_address(potential_ip) validate_ipv6_address(potential_ip)
except ValidationError: except ValidationError:
raise ValidationError(self.message, code=self.code) raise ValidationError(self.message, code=self.code)
url = value
# The maximum length of a full host name is 253 characters per RFC 1034 # The maximum length of a full host name is 253 characters per RFC 1034
# section 3.1. It's defined to be 255 bytes or less, but this includes # section 3.1. It's defined to be 255 bytes or less, but this includes

View File

@ -25,7 +25,7 @@ class DatabaseCreation(BaseDatabaseCreation):
with self._nodb_connection.cursor() as cursor: with self._nodb_connection.cursor() as cursor:
try: try:
cursor.execute("CREATE DATABASE %s" % qn(target_database_name)) cursor.execute("CREATE DATABASE %s" % qn(target_database_name))
except Exception as e: except Exception:
if keepdb: if keepdb:
return return
try: try:

View File

@ -41,7 +41,7 @@ class DatabaseCreation(BaseDatabaseCreation):
with self._nodb_connection.cursor() as cursor: with self._nodb_connection.cursor() as cursor:
try: try:
cursor.execute(creation_sql) cursor.execute(creation_sql)
except Exception as e: except Exception:
if keepdb: if keepdb:
return return
try: try:

View File

@ -824,7 +824,6 @@ class SQLCompiler(object):
""" """
Returns an iterator over the results from executing this query. Returns an iterator over the results from executing this query.
""" """
converters = None
if results is None: if results is None:
results = self.execute_sql(MULTI) results = self.execute_sql(MULTI)
fields = [s[0] for s in self.select[0:self.col_count]] fields = [s[0] for s in self.select[0:self.col_count]]

View File

@ -578,15 +578,11 @@ def exhaust(stream_or_iterable):
Raise a MultiPartParserError if the argument is not a stream or an iterable. Raise a MultiPartParserError if the argument is not a stream or an iterable.
""" """
iterator = None
try: try:
iterator = iter(stream_or_iterable) iterator = iter(stream_or_iterable)
except TypeError: except TypeError:
iterator = ChunkIter(stream_or_iterable, 16384) iterator = ChunkIter(stream_or_iterable, 16384)
if iterator is None:
raise MultiPartParserError('multipartparser.exhaust() was passed a non-iterable or stream parameter')
for __ in iterator: for __ in iterator:
pass pass

View File

@ -888,7 +888,7 @@ class Variable(object):
if isinstance(current, BaseContext) and getattr(type(current), bit): if isinstance(current, BaseContext) and getattr(type(current), bit):
raise AttributeError raise AttributeError
current = getattr(current, bit) current = getattr(current, bit)
except (TypeError, AttributeError) as e: except (TypeError, AttributeError):
# Reraise if the exception was raised by a @property # Reraise if the exception was raised by a @property
if not isinstance(current, BaseContext) and bit in dir(current): if not isinstance(current, BaseContext) and bit in dir(current):
raise raise

View File

@ -327,7 +327,6 @@ class DateFormat(TimeFormat):
def W(self): def W(self):
"ISO-8601 week number of year, weeks starting on Monday" "ISO-8601 week number of year, weeks starting on Monday"
# Algorithm from http://www.personal.ecu.edu/mccartyr/ISOwdALG.txt # Algorithm from http://www.personal.ecu.edu/mccartyr/ISOwdALG.txt
week_number = None
jan1_weekday = self.data.replace(month=1, day=1).weekday() + 1 jan1_weekday = self.data.replace(month=1, day=1).weekday() + 1
weekday = self.data.weekday() + 1 weekday = self.data.weekday() + 1
day_of_year = self.z() day_of_year = self.z()

View File

@ -228,7 +228,6 @@ def _explode_shorthand_ip_string(ip_str):
# We've already got a longhand ip_str. # We've already got a longhand ip_str.
return ip_str return ip_str
new_ip = []
hextet = ip_str.split('::') hextet = ip_str.split('::')
# If there is a ::, we need to expand it with zeroes # If there is a ::, we need to expand it with zeroes

View File

@ -208,7 +208,6 @@ class BulkCreateTests(TestCase):
@skipUnlessDBFeature('can_return_ids_from_bulk_insert') @skipUnlessDBFeature('can_return_ids_from_bulk_insert')
def test_set_pk_and_insert_single_item(self): def test_set_pk_and_insert_single_item(self):
countries = []
with self.assertNumQueries(1): with self.assertNumQueries(1):
countries = Country.objects.bulk_create([self.data[0]]) countries = Country.objects.bulk_create([self.data[0]])
self.assertEqual(len(countries), 1) self.assertEqual(len(countries), 1)
@ -216,7 +215,6 @@ class BulkCreateTests(TestCase):
@skipUnlessDBFeature('can_return_ids_from_bulk_insert') @skipUnlessDBFeature('can_return_ids_from_bulk_insert')
def test_set_pk_and_query_efficiency(self): def test_set_pk_and_query_efficiency(self):
countries = []
with self.assertNumQueries(1): with self.assertNumQueries(1):
countries = Country.objects.bulk_create(self.data) countries = Country.objects.bulk_create(self.data)
self.assertEqual(len(countries), 4) self.assertEqual(len(countries), 4)

View File

@ -77,7 +77,7 @@ class MigrationTestBase(TransactionTestCase):
), ),
) )
def assertFKNotExists(self, table, columns, to, value=True): def assertFKNotExists(self, table, columns, to):
return self.assertFKExists(table, columns, to, False) return self.assertFKExists(table, columns, to, False)
@contextmanager @contextmanager

View File

@ -422,7 +422,6 @@ class ResolverTests(SimpleTestCase):
e = cm.exception e = cm.exception
# make sure we at least matched the root ('/') url resolver: # make sure we at least matched the root ('/') url resolver:
self.assertIn('tried', e.args[0]) self.assertIn('tried', e.args[0])
tried = e.args[0]['tried']
self.assertEqual( self.assertEqual(
len(e.args[0]['tried']), len(e.args[0]['tried']),
len(url_types_names), len(url_types_names),