[oe-commits] [bitbake] 16/19: toaster: use // operator instead of /

git at git.openembedded.org git at git.openembedded.org
Wed Jun 1 13:14:54 UTC 2016


rpurdie pushed a commit to branch python3
in repository bitbake.

commit 4ca460ddae87b5c83851e1a3a726b99c5a078a69
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Mon May 30 15:51:20 2016 +0300

    toaster: use // operator instead of /
    
    Division operator works differently in Python 3. It results in
    float unlike in Python 2, where it results in int.
    
    Explicitly used "floor division" operator instead of 'division'
    operator. This should make the code to result in integer under
    both pythons.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/orm/models.py                          | 2 +-
 lib/toaster/toastergui/templatetags/projecttags.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index dd64664..25bc1db 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -424,7 +424,7 @@ class Build(models.Model):
         tf = Task.objects.filter(build = self)
         tfc = tf.count()
         if tfc > 0:
-            completeper = tf.exclude(order__isnull=True).count()*100/tfc
+            completeper = tf.exclude(order__isnull=True).count()*100 // tfc
         else:
             completeper = 0
         return completeper
diff --git a/lib/toaster/toastergui/templatetags/projecttags.py b/lib/toaster/toastergui/templatetags/projecttags.py
index 75f2261..1d68036 100644
--- a/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/lib/toaster/toastergui/templatetags/projecttags.py
@@ -90,7 +90,7 @@ def whitespace_space_filter(value, arg):
 def divide(value, arg):
     if int(arg) == 0:
         return -1
-    return int(value) / int(arg)
+    return int(value) // int(arg)
 
 @register.filter
 def multiply(value, arg):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list