from twisted.internet import defer
from twisted.internet.interfaces import IFinishableConsumer
-from foolscap.api import eventually\r
+from foolscap.api import eventually
from allmydata.util import deferredutil
from allmydata.util.consumer import download_to_data
attrs["permissions"] = perms
# We could set the SSH_FILEXFER_ATTR_FLAGS here:
- # ENCRYPTED would always be true ("The file is stored on disk\r
+ # ENCRYPTED would always be true ("The file is stored on disk
# using file-system level transparent encryption.")
# SYSTEM, HIDDEN, ARCHIVE and SYNC would always be false.
# READONLY and IMMUTABLE would be set according to
def _crypt(self, offset, data):
# FIXME: use random-access AES (pycryptopp ticket #18)
- offset_big = offset // 16\r
- offset_small = offset % 16\r
- iv = binascii.unhexlify("%032x" % offset_big)\r
- cipher = AES(self.key, iv=iv)\r
- cipher.process("\x00"*offset_small)\r
- return cipher.process(data)\r
+ offset_big = offset // 16
+ offset_small = offset % 16
+ iv = binascii.unhexlify("%032x" % offset_big)
+ cipher = AES(self.key, iv=iv)
+ cipher.process("\x00"*offset_small)
+ return cipher.process(data)
def close(self):
self.file.close()
def _read(data):
if noisy: self.log("_read(%r) in readChunk(%r, %r)" % (data, offset, length), level=NOISY)
- # "In response to this request, the server will read as many bytes as it\r
- # can from the file (up to 'len'), and return them in a SSH_FXP_DATA\r
- # message. If an error occurs or EOF is encountered before reading any\r
- # data, the server will respond with SSH_FXP_STATUS. For normal disk\r
- # files, it is guaranteed that this will read the specified number of\r
+ # "In response to this request, the server will read as many bytes as it
+ # can from the file (up to 'len'), and return them in a SSH_FXP_DATA
+ # message. If an error occurs or EOF is encountered before reading any
+ # data, the server will respond with SSH_FXP_STATUS. For normal disk
+ # files, it is guaranteed that this will read the specified number of
# bytes, or up to end of file."
#
# i.e. we respond with an EOF error iff offset is already at EOF.
# This is ok because SFTP makes no guarantee that the request completes
# before the write. In fact it explicitly allows write errors to be delayed
# until close:
- # "One should note that on some server platforms even a close can fail.\r
- # This can happen e.g. if the server operating system caches writes,\r
+ # "One should note that on some server platforms even a close can fail.
+ # This can happen e.g. if the server operating system caches writes,
# and an error occurs while flushing cached writes during the close."
def _write(ign):
path_utf8 = pathstring.split("/")
# <http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.2>
- # "Servers SHOULD interpret a path name component ".." as referring to\r
- # the parent directory, and "." as referring to the current directory."\r
+ # "Servers SHOULD interpret a path name component ".." as referring to
+ # the parent directory, and "." as referring to the current directory."
path = []
for p_utf8 in path_utf8:
if p_utf8 == "..":