diff options
author | Hartmut Goebel <h.goebel@crazy-compilers.com> | 2019-03-10 21:17:39 +0100 |
---|---|---|
committer | Hartmut Goebel <h.goebel@crazy-compilers.com> | 2019-03-10 21:17:39 +0100 |
commit | 1b292596c1cbb211c22542607f6f5d15f2dc0465 (patch) | |
tree | ae4d64f525c43bb81ad601f1e76287d383ba1b31 /contrib | |
parent | 3d6ba937a5a5046b3d531c17691d5d1155daae71 (diff) | |
download | gnunet-1b292596c1cbb211c22542607f6f5d15f2dc0465.tar.gz gnunet-1b292596c1cbb211c22542607f6f5d15f2dc0465.zip |
Fix Python code: remove imports from `python-future`.
I missed in 3d6ba937a5a5046b3d531c17691d5d1155daae71 that `future`
also provides the modules `past` and `builtins`.
Imports of `builtins` can simply be removed for Python-3-only code.
`past.old_div` had to be replaces by the "old" div-operatot `//`,
while `past.xrange` was unused.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/scripts/gdb-iterate-dll.py | 1 | ||||
-rwxr-xr-x | contrib/scripts/gnunet-chk.py.in | 8 | ||||
-rw-r--r-- | contrib/scripts/gnunet_pyexpect.py.in | 1 | ||||
-rw-r--r-- | contrib/scripts/terminate.py.in | 1 |
4 files changed, 2 insertions, 9 deletions
diff --git a/contrib/scripts/gdb-iterate-dll.py b/contrib/scripts/gdb-iterate-dll.py index 9e6478e9f..79d46aa96 100644 --- a/contrib/scripts/gdb-iterate-dll.py +++ b/contrib/scripts/gdb-iterate-dll.py | |||
@@ -1,4 +1,3 @@ | |||
1 | from builtins import str | ||
2 | from gdb import * | 1 | from gdb import * |
3 | 2 | ||
4 | 3 | ||
diff --git a/contrib/scripts/gnunet-chk.py.in b/contrib/scripts/gnunet-chk.py.in index ab0bc635f..0fb591627 100755 --- a/contrib/scripts/gnunet-chk.py.in +++ b/contrib/scripts/gnunet-chk.py.in | |||
@@ -21,10 +21,6 @@ | |||
21 | # Brief: Computes GNUNET style Content Hash Key for a given file | 21 | # Brief: Computes GNUNET style Content Hash Key for a given file |
22 | # Author: Sree Harsha Totakura | 22 | # Author: Sree Harsha Totakura |
23 | 23 | ||
24 | from builtins import str | ||
25 | from builtins import range | ||
26 | from past.utils import old_div | ||
27 | from builtins import object | ||
28 | from hashlib import sha512 | 24 | from hashlib import sha512 |
29 | import logging | 25 | import logging |
30 | import os | 26 | import os |
@@ -252,7 +248,7 @@ def compute_chk_offset_(depth, end_offset): | |||
252 | bds = compute_tree_size_(depth) | 248 | bds = compute_tree_size_(depth) |
253 | if (depth > 0): | 249 | if (depth > 0): |
254 | end_offset -= 1 | 250 | end_offset -= 1 |
255 | ret = old_div(end_offset, bds) | 251 | ret = end_offset // bds |
256 | return ret % CHK_PER_INODE | 252 | return ret % CHK_PER_INODE |
257 | 253 | ||
258 | 254 | ||
@@ -276,7 +272,7 @@ def compute_iblock_size_(depth, offset): | |||
276 | ret = CHK_PER_INODE | 272 | ret = CHK_PER_INODE |
277 | else: | 273 | else: |
278 | bds /= CHK_PER_INODE | 274 | bds /= CHK_PER_INODE |
279 | ret = old_div(mod, bds) | 275 | ret = mod // bds |
280 | if (mod % bds) is not 0: | 276 | if (mod % bds) is not 0: |
281 | ret += 1 | 277 | ret += 1 |
282 | return ret | 278 | return ret |
diff --git a/contrib/scripts/gnunet_pyexpect.py.in b/contrib/scripts/gnunet_pyexpect.py.in index 9611fc0ae..188436f51 100644 --- a/contrib/scripts/gnunet_pyexpect.py.in +++ b/contrib/scripts/gnunet_pyexpect.py.in | |||
@@ -19,7 +19,6 @@ | |||
19 | # | 19 | # |
20 | # Testcase for gnunet-peerinfo | 20 | # Testcase for gnunet-peerinfo |
21 | 21 | ||
22 | from builtins import object | ||
23 | import os | 22 | import os |
24 | import re | 23 | import re |
25 | import subprocess | 24 | import subprocess |
diff --git a/contrib/scripts/terminate.py.in b/contrib/scripts/terminate.py.in index 9ed356502..161b4db61 100644 --- a/contrib/scripts/terminate.py.in +++ b/contrib/scripts/terminate.py.in | |||
@@ -21,7 +21,6 @@ | |||
21 | # For other platforms it's equivalent to Popen.kill () | 21 | # For other platforms it's equivalent to Popen.kill () |
22 | # Requires pywin32 on W32. | 22 | # Requires pywin32 on W32. |
23 | 23 | ||
24 | from builtins import object | ||
25 | import sys | 24 | import sys |
26 | import subprocess | 25 | import subprocess |
27 | import os | 26 | import os |