From 9f77bf7d6081c43ee8b8a7b6cd740f2fe4bfb3b1 Mon Sep 17 00:00:00 2001 From: Maciej Fijalkowski Date: Tue, 4 Aug 2020 15:49:17 +0200 Subject: [PATCH] futurize uri.py and test_uri.py --- src/allmydata/test/test_uri.py | 8 ++++++++ src/allmydata/uri.py | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/allmydata/test/test_uri.py b/src/allmydata/test/test_uri.py index c04b1259d..de9f42a1e 100644 --- a/src/allmydata/test/test_uri.py +++ b/src/allmydata/test/test_uri.py @@ -1,4 +1,12 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +from future import standard_library +standard_library.install_aliases() +from builtins import str +from builtins import * import os from twisted.trial import unittest from allmydata import uri diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 051b45f79..030d24384 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -1,4 +1,12 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +from future import standard_library +standard_library.install_aliases() +from builtins import * +from builtins import object import re from zope.interface import implementer @@ -80,7 +88,7 @@ class CHKFileURI(_BaseURI): def to_string(self): assert isinstance(self.needed_shares, int) assert isinstance(self.total_shares, int) - assert isinstance(self.size, (int,long)) + assert isinstance(self.size, int) return ('URI:CHK:%s:%s:%d:%d:%d' % (base32.b2a(self.key), @@ -136,7 +144,7 @@ class CHKFileVerifierURI(_BaseURI): def to_string(self): assert isinstance(self.needed_shares, int) assert isinstance(self.total_shares, int) - assert isinstance(self.size, (int,long)) + assert isinstance(self.size, int) return ('URI:CHK-Verifier:%s:%s:%d:%d:%d' % (si_b2a(self.storage_index), @@ -876,7 +884,7 @@ def pack_extension(data): pieces = [] for k in sorted(data.keys()): value = data[k] - if isinstance(value, (int, long)): + if isinstance(value, int): value = "%d" % value assert isinstance(value, str), k assert re.match(r'^[a-zA-Z_\-]+$', k)