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 /src | |
parent | 3d6ba937a5a5046b3d531c17691d5d1155daae71 (diff) |
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 'src')
-rw-r--r-- | src/consensus/consensus-simulation.py.in | 8 | ||||
-rw-r--r-- | src/integration-tests/gnunet_pyexpect.py.in | 1 | ||||
-rw-r--r-- | src/integration-tests/gnunet_testing.py.in | 2 | ||||
-rw-r--r-- | src/revocation/test_local_revocation.py.in | 1 |
4 files changed, 2 insertions, 10 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in index 23639b195..39daf81c6 100644 --- a/src/consensus/consensus-simulation.py.in +++ b/src/consensus/consensus-simulation.py.in @@ -17,13 +17,9 @@ # # SPDX-License-Identifier: AGPL3.0-or-later -from builtins import str -from builtins import range -from past.utils import old_div import argparse import random from math import ceil, log, floor -from past.builtins import xrange def bsc(n): @@ -40,7 +36,7 @@ def bsc(n): def simulate(k, n, verbose): assert k < n - largest_arc = old_div(int(2**ceil(log(n, 2))), 2) + largest_arc = int(2**ceil(log(n, 2))) // 2 num_ghosts = (2 * largest_arc) - n if verbose: print("we have", num_ghosts, "ghost peers") @@ -106,4 +102,4 @@ if __name__ == "__main__": sum = 0.0 for n in range(0, args.r): sum += simulate(args.k, args.n, args.verbose) - print(old_div(sum, args.r)) + print(sum // args.r) diff --git a/src/integration-tests/gnunet_pyexpect.py.in b/src/integration-tests/gnunet_pyexpect.py.in index 000b8f99a..d757634a5 100644 --- a/src/integration-tests/gnunet_pyexpect.py.in +++ b/src/integration-tests/gnunet_pyexpect.py.in @@ -19,7 +19,6 @@ # # Testcase for gnunet-peerinfo -from builtins import object import os import re import subprocess diff --git a/src/integration-tests/gnunet_testing.py.in b/src/integration-tests/gnunet_testing.py.in index 667c3fff5..c3596d232 100644 --- a/src/integration-tests/gnunet_testing.py.in +++ b/src/integration-tests/gnunet_testing.py.in @@ -19,8 +19,6 @@ # # Functions for integration testing -from builtins import object -from builtins import str import os import subprocess import sys diff --git a/src/revocation/test_local_revocation.py.in b/src/revocation/test_local_revocation.py.in index 979a55d83..4cc6119ca 100644 --- a/src/revocation/test_local_revocation.py.in +++ b/src/revocation/test_local_revocation.py.in @@ -19,7 +19,6 @@ # # Testcase for ego revocation -from builtins import str import sys import os import subprocess |