summaryrefslogtreecommitdiffstats
path: root/deluge/transfer.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 15:05:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-19 16:15:47 +0000
commitb686174b07bd56af4e5ffaa23c24f27f417fc305 (patch)
tree1ce335620d99341d94e88c159c0b9b0f6f0de5a0 /deluge/transfer.py
parentAdding debian version 2.0.3-4. (diff)
downloaddeluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.tar.xz
deluge-b686174b07bd56af4e5ffaa23c24f27f417fc305.zip
Merging upstream version 2.1.1 (Closes: #1026291).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/transfer.py')
-rw-r--r--deluge/transfer.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/deluge/transfer.py b/deluge/transfer.py
index 6b26549..ed7d6dd 100644
--- a/deluge/transfer.py
+++ b/deluge/transfer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Bro <bro.development@gmail.com>
# Copyright (C) 2018 Andrew Resch <andrewresch@gmail.com>
@@ -8,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import struct
import zlib
@@ -24,12 +21,12 @@ MESSAGE_HEADER_FORMAT = '!BI'
MESSAGE_HEADER_SIZE = struct.calcsize(MESSAGE_HEADER_FORMAT)
-class DelugeTransferProtocol(Protocol, object):
+class DelugeTransferProtocol(Protocol):
"""
Deluge RPC wire protocol.
- Data messages are transfered with a header containing a protocol version
- and the length of the data to be transfered (payload).
+ Data messages are transferred with a header containing a protocol version
+ and the length of the data to be transferred (payload).
The format is::
@@ -51,12 +48,12 @@ class DelugeTransferProtocol(Protocol, object):
"""
Transfer the data.
- :param data: data to be transfered in a data structure serializable by rencode.
+ :param data: data to be transferred in a data structure serializable by rencode.
"""
body = zlib.compress(rencode.dumps(data))
body_len = len(body)
message = struct.pack(
- '{}{}s'.format(MESSAGE_HEADER_FORMAT, body_len),
+ f'{MESSAGE_HEADER_FORMAT}{body_len}s',
PROTOCOL_VERSION,
body_len,
body,
@@ -68,8 +65,8 @@ class DelugeTransferProtocol(Protocol, object):
"""
This method is called whenever data is received.
- :param data: a message as transfered by transfer_message, or a part of such
- a messsage.
+ :param data: a message as transferred by transfer_message, or a part of such
+ a message.
Global variables:
_buffer - contains the data received
@@ -120,7 +117,7 @@ class DelugeTransferProtocol(Protocol, object):
def _handle_complete_message(self, data):
"""
- Handles a complete message as it is transfered on the network.
+ Handles a complete message as it is transferred on the network.
:param data: a zlib compressed string encoded with rencode.