mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 00:24:13 +00:00
remove trailing whitespace
This commit is contained in:
parent
dddc2d0378
commit
c6ae255847
@ -13,7 +13,7 @@ class RepairResults:
|
||||
|
||||
class RepairRequiresWritecapError(Exception):
|
||||
"""Repair currently requires a writecap."""
|
||||
|
||||
|
||||
class MustForceRepairError(Exception):
|
||||
pass
|
||||
|
||||
|
@ -265,8 +265,8 @@ def corrupt(res, s, offset, shnums_to_corrupt=None, offset_offset=0):
|
||||
return res
|
||||
|
||||
class Filenode(unittest.TestCase, testutil.ShouldFailMixin):
|
||||
# this used to be in Publish, but we removed the limit. Some of
|
||||
# these tests test whether the new code correctly allows files
|
||||
# this used to be in Publish, but we removed the limit. Some of
|
||||
# these tests test whether the new code correctly allows files
|
||||
# larger than the limit.
|
||||
OLD_MAX_SEGMENT_SIZE = 3500000
|
||||
def setUp(self):
|
||||
@ -1792,7 +1792,7 @@ class LessFakeClient(FakeClient):
|
||||
|
||||
def __init__(self, basedir, num_peers=10):
|
||||
self._num_peers = num_peers
|
||||
peerids = [tagged_hash("peerid", "%d" % i)[:20]
|
||||
peerids = [tagged_hash("peerid", "%d" % i)[:20]
|
||||
for i in range(self._num_peers)]
|
||||
self.storage_broker = StorageFarmBroker(None, True)
|
||||
for peerid in peerids:
|
||||
|
@ -72,7 +72,7 @@ def survival_pmf_via_bd(p_list):
|
||||
Note that this function does little to no error checking and is
|
||||
intended for internal use and testing only.
|
||||
"""
|
||||
pmf_list = [ binomial_distribution_pmf(p_list.count(p), p)
|
||||
pmf_list = [ binomial_distribution_pmf(p_list.count(p), p)
|
||||
for p in set(p_list) ]
|
||||
return reduce(convolve, pmf_list)
|
||||
|
||||
@ -90,7 +90,7 @@ def survival_pmf_via_conv(p_list):
|
||||
def print_pmf(pmf, n=4, out=sys.stdout):
|
||||
"""
|
||||
Print a PMF in a readable form, with values rounded to n
|
||||
significant digits.
|
||||
significant digits.
|
||||
"""
|
||||
for k, p in enumerate(pmf):
|
||||
print >>out, "i=" + str(k) + ":", round_sigfigs(p, n)
|
||||
@ -124,7 +124,7 @@ def find_k(p_list, target_loss_prob):
|
||||
|
||||
def find_k_from_pmf(pmf, target_loss_prob):
|
||||
"""
|
||||
Find the highest k value that achieves the targeted loss
|
||||
Find the highest k value that achieves the targeted loss
|
||||
probability, given the share survival PMF given in pmf.
|
||||
"""
|
||||
assert valid_pmf(pmf)
|
||||
@ -151,11 +151,11 @@ def repair_count_pmf(survival_pmf, k):
|
||||
# Probability of 0 to repair is the probability of all shares
|
||||
# surviving plus the probability of less than k surviving.
|
||||
pmf = [ survival_pmf[n] + sum(survival_pmf[0:k]) ]
|
||||
|
||||
|
||||
# Probability of more than 0, up to N-k to repair
|
||||
for i in range(1, n-k+1):
|
||||
pmf.append(survival_pmf[n-i])
|
||||
|
||||
|
||||
# Probability of more than N-k to repair is 0, because that means
|
||||
# there are less than k available and the file is irreparable.
|
||||
for i in range(n-k+1, n+1):
|
||||
@ -220,14 +220,14 @@ def convolve(list_a, list_b):
|
||||
"""
|
||||
n = len(list_a)
|
||||
m = len(list_b)
|
||||
|
||||
|
||||
result = []
|
||||
for i in range(n + m - 1):
|
||||
sum = 0.0
|
||||
|
||||
lower = max(0, i - n + 1)
|
||||
upper = min(m - 1, i)
|
||||
|
||||
|
||||
for j in range(lower, upper+1):
|
||||
sum += list_a[i-j] * list_b[j]
|
||||
|
||||
@ -250,8 +250,8 @@ def binomial_distribution_pmf(n, p):
|
||||
|
||||
result = []
|
||||
for k in range(n+1):
|
||||
result.append(math.pow(p , k ) *
|
||||
math.pow(1 - p, n - k) *
|
||||
result.append(math.pow(p , k ) *
|
||||
math.pow(1 - p, n - k) *
|
||||
binomial_coeff(n, k))
|
||||
|
||||
assert valid_pmf(result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user