summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-10-02 14:49:26 +0200
committerTim Graham <timograham@gmail.com>2017-10-02 08:49:26 -0400
commitd896809a3ae8dfe45864f284c3ef45bfbb2e5ba1 (patch)
tree295f2a149d8657e8988f81f5890aee2474f9ab6d
parentf0ffa3f4ea277f9814285085fde20baff60fc386 (diff)
Refs #23919 -- Removed unneeded float()/int() calls.
-rw-r--r--django/contrib/humanize/templatetags/humanize.py2
-rw-r--r--django/core/paginator.py2
-rw-r--r--django/db/models/fields/__init__.py2
-rw-r--r--django/template/defaulttags.py2
-rw-r--r--tests/delete/tests.py2
5 files changed, 5 insertions, 5 deletions
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
index c119395fde..fa644fd3a1 100644
--- a/django/contrib/humanize/templatetags/humanize.py
+++ b/django/contrib/humanize/templatetags/humanize.py
@@ -130,7 +130,7 @@ def intword(value):
for exponent, converters in intword_converters:
large_number = 10 ** exponent
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 value
diff --git a/django/core/paginator.py b/django/core/paginator.py
index b07be513d3..6c9a2dac91 100644
--- a/django/core/paginator.py
+++ b/django/core/paginator.py
@@ -95,7 +95,7 @@ class Paginator:
if self.count == 0 and not self.allow_empty_first_page:
return 0
hits = max(1, self.count - self.orphans)
- return int(ceil(hits / float(self.per_page)))
+ return ceil(hits / self.per_page)
@property
def page_range(self):
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index b0ab271723..b2e9b18351 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1631,7 +1631,7 @@ class DurationField(Field):
if value is None:
return None
# 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):
converters = []
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 5f56bb0d1f..3d97b0ceb0 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -486,7 +486,7 @@ class WidthRatioNode(Node):
value = float(value)
max_value = float(max_value)
ratio = (value / max_value) * max_width
- result = str(int(round(ratio)))
+ result = str(round(ratio))
except ZeroDivisionError:
return '0'
except (ValueError, TypeError, OverflowError):
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index 98467efb6a..b27181e963 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -325,7 +325,7 @@ class DeletionTests(TestCase):
# Calculate the number of queries needed.
batch_size = connection.ops.bulk_batch_size(['pk'], objs)
# 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
# each batch.
fetches_to_mem = 1 + batches