mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-05-02 17:12:59 +00:00
Merge pull request #946 from tahoe-lafs/3574.port-stats
Port stats to Python 3
This commit is contained in:
commit
dc5ac4a112
0
newsfragments/3574.minor
Normal file
0
newsfragments/3574.minor
Normal file
@ -1,4 +1,15 @@
|
|||||||
"""Implementation of the deep stats class."""
|
"""Implementation of the deep stats class.
|
||||||
|
|
||||||
|
Ported to Python 3.
|
||||||
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from future.utils import PY2
|
||||||
|
if PY2:
|
||||||
|
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
@ -13,7 +24,7 @@ from allmydata.util import mathutil
|
|||||||
class DeepStats(object):
|
class DeepStats(object):
|
||||||
"""Deep stats object.
|
"""Deep stats object.
|
||||||
|
|
||||||
Holds results of the deep-stats opetation.
|
Holds results of the deep-stats operation.
|
||||||
Used for json generation in the API."""
|
Used for json generation in the API."""
|
||||||
|
|
||||||
# Json API version.
|
# Json API version.
|
||||||
@ -121,7 +132,7 @@ class DeepStats(object):
|
|||||||
h[bucket] += 1
|
h[bucket] += 1
|
||||||
|
|
||||||
def get_results(self):
|
def get_results(self):
|
||||||
"""Returns deep-stats resutls."""
|
"""Returns deep-stats results."""
|
||||||
stats = self.stats.copy()
|
stats = self.stats.copy()
|
||||||
for key in self.histograms:
|
for key in self.histograms:
|
||||||
h = self.histograms[key]
|
h = self.histograms[key]
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
|
"""
|
||||||
|
Ported to Python 3.
|
||||||
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
# Python 2 compatibility
|
|
||||||
from future.utils import PY2
|
from future.utils import PY2
|
||||||
if PY2:
|
if PY2:
|
||||||
from future.builtins import str # noqa: F401
|
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
from twisted.application.internet import TimerService
|
from twisted.application.internet import TimerService
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
"""
|
||||||
|
Ported to Python 3.
|
||||||
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from future.utils import PY2
|
||||||
|
if PY2:
|
||||||
|
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||||
|
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
|
@ -34,6 +34,7 @@ PORTED_MODULES = [
|
|||||||
"allmydata.crypto.error",
|
"allmydata.crypto.error",
|
||||||
"allmydata.crypto.rsa",
|
"allmydata.crypto.rsa",
|
||||||
"allmydata.crypto.util",
|
"allmydata.crypto.util",
|
||||||
|
"allmydata.deep_stats",
|
||||||
"allmydata.dirnode",
|
"allmydata.dirnode",
|
||||||
"allmydata.hashtree",
|
"allmydata.hashtree",
|
||||||
"allmydata.immutable.checker",
|
"allmydata.immutable.checker",
|
||||||
@ -69,6 +70,7 @@ PORTED_MODULES = [
|
|||||||
"allmydata.mutable.servermap",
|
"allmydata.mutable.servermap",
|
||||||
"allmydata.node",
|
"allmydata.node",
|
||||||
"allmydata.nodemaker",
|
"allmydata.nodemaker",
|
||||||
|
"allmydata.stats",
|
||||||
"allmydata.storage_client",
|
"allmydata.storage_client",
|
||||||
"allmydata.storage.common",
|
"allmydata.storage.common",
|
||||||
"allmydata.storage.crawler",
|
"allmydata.storage.crawler",
|
||||||
@ -166,6 +168,7 @@ PORTED_TEST_MODULES = [
|
|||||||
"allmydata.test.test_repairer",
|
"allmydata.test.test_repairer",
|
||||||
"allmydata.test.test_spans",
|
"allmydata.test.test_spans",
|
||||||
"allmydata.test.test_statistics",
|
"allmydata.test.test_statistics",
|
||||||
|
"allmydata.test.test_stats",
|
||||||
"allmydata.test.test_storage",
|
"allmydata.test.test_storage",
|
||||||
"allmydata.test.test_storage_client",
|
"allmydata.test.test_storage_client",
|
||||||
"allmydata.test.test_storage_web",
|
"allmydata.test.test_storage_web",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user