Refs #23919 -- Removed unneeded float()/int() calls.
This commit is contained in:
parent
f0ffa3f4ea
commit
d896809a3a
|
@ -130,7 +130,7 @@ def intword(value):
|
||||||
for exponent, converters in intword_converters:
|
for exponent, converters in intword_converters:
|
||||||
large_number = 10 ** exponent
|
large_number = 10 ** exponent
|
||||||
if value < large_number * 1000:
|
if value < large_number * 1000:
|
||||||
new_value = value / float(large_number)
|
new_value = value / large_number
|
||||||
return _check_for_i18n(new_value, *converters(new_value))
|
return _check_for_i18n(new_value, *converters(new_value))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Paginator:
|
||||||
if self.count == 0 and not self.allow_empty_first_page:
|
if self.count == 0 and not self.allow_empty_first_page:
|
||||||
return 0
|
return 0
|
||||||
hits = max(1, self.count - self.orphans)
|
hits = max(1, self.count - self.orphans)
|
||||||
return int(ceil(hits / float(self.per_page)))
|
return ceil(hits / self.per_page)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def page_range(self):
|
def page_range(self):
|
||||||
|
|
|
@ -1631,7 +1631,7 @@ class DurationField(Field):
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return None
|
||||||
# Discard any fractional microseconds due to floating point arithmetic.
|
# Discard any fractional microseconds due to floating point arithmetic.
|
||||||
return int(round(value.total_seconds() * 1000000))
|
return round(value.total_seconds() * 1000000)
|
||||||
|
|
||||||
def get_db_converters(self, connection):
|
def get_db_converters(self, connection):
|
||||||
converters = []
|
converters = []
|
||||||
|
|
|
@ -486,7 +486,7 @@ class WidthRatioNode(Node):
|
||||||
value = float(value)
|
value = float(value)
|
||||||
max_value = float(max_value)
|
max_value = float(max_value)
|
||||||
ratio = (value / max_value) * max_width
|
ratio = (value / max_value) * max_width
|
||||||
result = str(int(round(ratio)))
|
result = str(round(ratio))
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
return '0'
|
return '0'
|
||||||
except (ValueError, TypeError, OverflowError):
|
except (ValueError, TypeError, OverflowError):
|
||||||
|
|
|
@ -325,7 +325,7 @@ class DeletionTests(TestCase):
|
||||||
# Calculate the number of queries needed.
|
# Calculate the number of queries needed.
|
||||||
batch_size = connection.ops.bulk_batch_size(['pk'], objs)
|
batch_size = connection.ops.bulk_batch_size(['pk'], objs)
|
||||||
# The related fetches are done in batches.
|
# The related fetches are done in batches.
|
||||||
batches = int(ceil(float(len(objs)) / batch_size))
|
batches = ceil(len(objs) / batch_size)
|
||||||
# One query for Avatar.objects.all() and then one related fast delete for
|
# One query for Avatar.objects.all() and then one related fast delete for
|
||||||
# each batch.
|
# each batch.
|
||||||
fetches_to_mem = 1 + batches
|
fetches_to_mem = 1 + batches
|
||||||
|
|
Loading…
Reference in New Issue