expand partial/lambda into full functions for clarity

This commit is contained in:
Jean-Paul Calderone 2021-01-25 08:23:40 -05:00
parent 5a0c913f58
commit e0fa228622

View File

@ -19,9 +19,6 @@ except ImportError:
pass
import os, time, weakref, itertools
from functools import (
partial,
)
import attr
@ -1076,8 +1073,18 @@ class EncryptAnUploadable(object):
d.addCallback(lambda ignored: self._get_encryptor())
accum = _Accum(length)
action = partial(self._read_encrypted, accum, hash_only)
condition = lambda: accum.remaining == 0
def action():
"""
Read some bytes into the accumulator.
"""
return self._read_encrypted(accum, hash_only)
def condition():
"""
Check to see if the accumulator has all the data.
"""
return accum.remaining == 0
d.addCallback(lambda ignored: until(action, condition))
d.addCallback(lambda ignored: accum.ciphertext)