[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated (abf25faba -> c886489c9)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated (abf25faba -> c886489c9) |
Date: |
Tue, 12 Feb 2019 12:10:24 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a change to branch master
in repository gnunet.
from abf25faba another issue with the #5511 patch
new db602e98e util: futurize gnunet-qr
new 551ed5af9 util: futurize contrib/scripts/gnunet-chk
new 65d93b3c0 util: futurize contrib/scripts/gnunet_pyexpect
new 5a0c847dd util: futurize contrib/scripts/pydiffer
new 47bf17d21 util: futurize contrib/scripts/terminate
new cf521c41f util: futurize consensus/consensus-simulation
new 7ea95acef util: futurize fs/test_gnunet_fs_psd
new 9524905c9 util: futurize revocation/test_local_revocation
new c886489c9 Merge branch 'master' of gnunet.org:gnunet
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
contrib/scripts/gnunet-chk.py.in | 14 ++++++++++----
contrib/scripts/gnunet_pyexpect.py.in | 1 +
contrib/scripts/pydiffer.py.in | 3 ++-
contrib/scripts/terminate.py.in | 1 +
src/consensus/consensus-simulation.py.in | 18 +++++++++++-------
src/fs/test_gnunet_fs_psd.py.in | 1 +
src/revocation/test_local_revocation.py.in | 1 +
src/util/gnunet-qr.py.in | 4 +++-
8 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/contrib/scripts/gnunet-chk.py.in b/contrib/scripts/gnunet-chk.py.in
index c60211556..1f5a0726c 100755
--- a/contrib/scripts/gnunet-chk.py.in
+++ b/contrib/scripts/gnunet-chk.py.in
@@ -21,6 +21,12 @@
# Brief: Computes GNUNET style Content Hash Key for a given file
# Author: Sree Harsha Totakura
+from __future__ import print_function
+from __future__ import division
+from builtins import str
+from builtins import range
+from past.utils import old_div
+from builtins import object
from hashlib import sha512
import logging
import os
@@ -90,7 +96,7 @@ def sha512_hash(data):
return hash_obj.digest()
-class AESKey:
+class AESKey(object):
"""Class for AES Keys. Contains the main key and the initialization
vector. """
@@ -177,7 +183,7 @@ def aes_decrypt(aes_key, data):
return ptext
-class Chk:
+class Chk(object):
"""Class for the content hash key."""
key = None
query = None
@@ -248,7 +254,7 @@ def compute_chk_offset_(depth, end_offset):
bds = compute_tree_size_(depth)
if (depth > 0):
end_offset -= 1
- ret = end_offset / bds
+ ret = old_div(end_offset, bds)
return ret % CHK_PER_INODE
@@ -272,7 +278,7 @@ def compute_iblock_size_(depth, offset):
ret = CHK_PER_INODE
else:
bds /= CHK_PER_INODE
- ret = mod / bds
+ ret = old_div(mod, bds)
if (mod % bds) is not 0:
ret += 1
return ret
diff --git a/contrib/scripts/gnunet_pyexpect.py.in
b/contrib/scripts/gnunet_pyexpect.py.in
index 810d5b321..4202da8d0 100644
--- a/contrib/scripts/gnunet_pyexpect.py.in
+++ b/contrib/scripts/gnunet_pyexpect.py.in
@@ -19,6 +19,7 @@
#
# Testcase for gnunet-peerinfo
from __future__ import print_function
+from builtins import object
import os
import re
import subprocess
diff --git a/contrib/scripts/pydiffer.py.in b/contrib/scripts/pydiffer.py.in
index 10145371c..1dbe856db 100644
--- a/contrib/scripts/pydiffer.py.in
+++ b/contrib/scripts/pydiffer.py.in
@@ -1,4 +1,5 @@
address@hidden@
+from __future__ import print_function
import os
import sys
import difflib
@@ -23,7 +24,7 @@ def dc_getdiff(dc, old, new):
for f in dc.diff_files:
r = getdiff(os.path.join(old, f), os.path.join(new, f))
diff.extend(r)
- for dn, dc in dc.subdirs.items():
+ for dn, dc in list(dc.subdirs.items()):
r = dc_getdiff(dc, os.path.join(old, dn), os.path.join(new, dn))
diff.extend(r)
return diff
diff --git a/contrib/scripts/terminate.py.in b/contrib/scripts/terminate.py.in
index 161b4db61..9ed356502 100644
--- a/contrib/scripts/terminate.py.in
+++ b/contrib/scripts/terminate.py.in
@@ -21,6 +21,7 @@
# For other platforms it's equivalent to Popen.kill ()
# Requires pywin32 on W32.
+from builtins import object
import sys
import subprocess
import os
diff --git a/src/consensus/consensus-simulation.py.in
b/src/consensus/consensus-simulation.py.in
index 38e29230a..161015d00 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -19,6 +19,10 @@
from __future__ import absolute_import
from __future__ import print_function
+from __future__ import division
+from builtins import str
+from builtins import range
+from past.utils import old_div
import argparse
import random
from math import ceil, log, floor
@@ -39,18 +43,18 @@ def bsc(n):
def simulate(k, n, verbose):
assert k < n
- largest_arc = int(2**ceil(log(n, 2))) / 2
+ largest_arc = old_div(int(2**ceil(log(n, 2))), 2)
num_ghosts = (2 * largest_arc) - n
if verbose:
print("we have", num_ghosts, "ghost peers")
# n.b. all peers with idx<k are evil
- peers = range(n)
+ peers = list(range(n))
# py2-3 compatible, backwards.
# refer to http://python-future.org/compatible_idioms.html#xrange
- info = [1 << x for x in xrange(n)]
+ info = [1 << x for x in range(n)]
def done_p():
- for x in xrange(k, n):
+ for x in range(k, n):
if bsc(info[x]) < n-k:
return False
return True
@@ -63,7 +67,7 @@ def simulate(k, n, verbose):
if verbose:
print("-- subround --")
new_info = [x for x in info]
- for peer_physical in xrange(n):
+ for peer_physical in range(n):
peer_logical = peers[peer_physical]
peer_type = None
partner_logical = (peer_logical + arc) % n
@@ -105,6 +109,6 @@ if __name__ == "__main__":
args = parser.parse_args()
sum = 0.0
- for n in xrange(0, args.r):
+ for n in range(0, args.r):
sum += simulate(args.k, args.n, args.verbose)
- print(sum / args.r)
+ print(old_div(sum, args.r))
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in
index 416ab5db3..d5a036c28 100755
--- a/src/fs/test_gnunet_fs_psd.py.in
+++ b/src/fs/test_gnunet_fs_psd.py.in
@@ -18,6 +18,7 @@
# SPDX-License-Identifier: AGPL3.0-or-later
#
# Testcase for file-sharing command-line tools (publish, search, download)
+from __future__ import print_function
import sys
import os
import subprocess
diff --git a/src/revocation/test_local_revocation.py.in
b/src/revocation/test_local_revocation.py.in
index 212e8e777..5caa616ca 100644
--- a/src/revocation/test_local_revocation.py.in
+++ b/src/revocation/test_local_revocation.py.in
@@ -19,6 +19,7 @@
#
# Testcase for ego revocation
from __future__ import print_function
+from builtins import str
import sys
import os
import subprocess
diff --git a/src/util/gnunet-qr.py.in b/src/util/gnunet-qr.py.in
index a5918fdf8..6c9d208f7 100755
--- a/src/util/gnunet-qr.py.in
+++ b/src/util/gnunet-qr.py.in
@@ -1,4 +1,6 @@
address@hidden@
+from __future__ import print_function
+from builtins import str
import sys
import getopt
import subprocess
@@ -100,7 +102,7 @@ if __name__ == '__main__':
cmd += " " + str(a)
if (verbose):
print('Running `' + cmd +'`')
- res=subprocess.call(args)
+ res = subprocess.call(args)
if (0 != res):
print('Failed to add URI ' + str(symbol.data))
else:
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] branch master updated (abf25faba -> c886489c9),
gnunet <=
- [GNUnet-SVN] [gnunet] 02/09: util: futurize contrib/scripts/gnunet-chk, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 01/09: util: futurize gnunet-qr, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 04/09: util: futurize contrib/scripts/pydiffer, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 03/09: util: futurize contrib/scripts/gnunet_pyexpect, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 05/09: util: futurize contrib/scripts/terminate, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 07/09: util: futurize fs/test_gnunet_fs_psd, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 08/09: util: futurize revocation/test_local_revocation, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 09/09: Merge branch 'master' of gnunet.org:gnunet, gnunet, 2019/02/12
- [GNUnet-SVN] [gnunet] 06/09: util: futurize consensus/consensus-simulation, gnunet, 2019/02/12