Skip to content

Commit 3420cd4

Browse files
flound1129claude
andcommitted
chore: remove deprecated function wrappers and fix bytes bug
Remove unused deprecated wrappers with no callers in the codebase: - common.py: decode_string(), utf8_encoded() - client.py: start_classic_mode(), stop_classic_mode(), is_classicmode() - torrent.py: set_prioritize_first_last(), set_save_path() Fix Python 2 bytes-formatting bug in client.py start_daemon() where b'--config=%s' % config mixed bytes format strings with encoded paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bb7a30a commit 3420cd4

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

deluge/common.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from urllib.parse import unquote_plus, urljoin
3232
from urllib.request import pathname2url
3333

34-
from deluge.decorators import deprecated
3534
from deluge.error import InvalidPathError
3635

3736
try:
@@ -1107,18 +1106,6 @@ def decode_bytes(byte_str, encoding='utf8'):
11071106
return ''
11081107

11091108

1110-
@deprecated
1111-
def decode_string(byte_str, encoding='utf8'):
1112-
"""Deprecated: Use decode_bytes"""
1113-
return decode_bytes(byte_str, encoding)
1114-
1115-
1116-
@deprecated
1117-
def utf8_encoded(str_, encoding='utf8'):
1118-
"""Deprecated: Use encode or decode_bytes if needed"""
1119-
return decode_bytes(str_, encoding).encode('utf8')
1120-
1121-
11221109
def utf8_encode_structure(data):
11231110
"""Recursively convert all unicode keys and values in a data structure to utf8.
11241111

deluge/core/torrent.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from deluge.common import decode_bytes
2828
from deluge.configmanager import ConfigManager, get_config_dir
2929
from deluge.core.authmanager import AUTH_LEVEL_ADMIN
30-
from deluge.decorators import deprecated
3130
from deluge.event import (
3231
TorrentFolderRenamedEvent,
3332
TorrentStateChangedEvent,
@@ -387,11 +386,6 @@ def set_max_download_speed(self, m_down_speed):
387386
value = int(m_down_speed * 1024)
388387
self.handle.set_download_limit(value)
389388

390-
@deprecated
391-
def set_prioritize_first_last(self, prioritize):
392-
"""Deprecated: Use set_prioritize_first_last_pieces."""
393-
self.set_prioritize_first_last_pieces(prioritize)
394-
395389
def set_prioritize_first_last_pieces(self, prioritize):
396390
"""Prioritize the first and last pieces in the torrent.
397391
@@ -570,11 +564,6 @@ def set_file_priorities(self, file_priorities):
570564
if self.options['prioritize_first_last_pieces']:
571565
self.set_prioritize_first_last_pieces(True)
572566

573-
@deprecated
574-
def set_save_path(self, download_location):
575-
"""Deprecated: Use set_download_location."""
576-
self.set_download_location(download_location)
577-
578567
def set_download_location(self, download_location):
579568
"""The location for downloading torrent data."""
580569
self.options['download_location'] = download_location

deluge/ui/client.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from deluge import error
1818
from deluge.common import VersionSplit, get_localhost_auth, get_version
19-
from deluge.decorators import deprecated
2019
from deluge.transfer import DelugeTransferProtocol
2120

2221
RPC_RESPONSE = 1
@@ -646,16 +645,6 @@ def stop_standalone(self):
646645
self._daemon_proxy = None
647646
self.__started_standalone = False
648647

649-
@deprecated
650-
def start_classic_mode(self):
651-
"""Deprecated: Use start_standalone"""
652-
self.start_standalone()
653-
654-
@deprecated
655-
def stop_classic_mode(self):
656-
"""Deprecated: Use stop_standalone"""
657-
self.stop_standalone()
658-
659648
def start_daemon(self, port, config):
660649
"""Starts a daemon process.
661650
@@ -667,10 +656,8 @@ def start_daemon(self, port, config):
667656
bool: True is successfully started the daemon, False otherwise.
668657
669658
"""
670-
# subprocess.popen does not work with unicode args (with non-ascii characters) on windows
671-
config = config.encode(sys.getfilesystemencoding())
672659
try:
673-
subprocess.Popen(['deluged', '--port=%s' % port, b'--config=%s' % config])
660+
subprocess.Popen(['deluged', f'--port={port}', f'--config={config}'])
674661
except OSError as ex:
675662
from errno import ENOENT
676663

@@ -714,11 +701,6 @@ def is_standalone(self):
714701
"""
715702
return self.__started_standalone
716703

717-
@deprecated
718-
def is_classicmode(self):
719-
"""Deprecated: Use is_standalone"""
720-
self.is_standalone()
721-
722704
def connected(self):
723705
"""
724706
Check to see if connected to a daemon.

0 commit comments

Comments
 (0)