Skip to content

Fix default completed_dir #8531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _to_dict(value: str) -> dict[bytes, Any]:
binary = value.encode()
# b'==' is added to avoid incorrect padding
base64_bytes = base64.b64decode(binary + b"==")
return cast(dict[bytes, Any], lt.bdecode(base64_bytes))
return cast("dict[bytes, Any]", lt.bdecode(base64_bytes))


class DownloadConfig:
Expand All @@ -114,7 +114,7 @@ def __init__(self, config: ConfigObj) -> None:
"""
Create a download config from the given ConfigObj.
"""
self.config: DownloadConfigDict = cast(DownloadConfigDict, config)
self.config: DownloadConfigDict = cast("DownloadConfigDict", config)

@staticmethod
def get_spec_file_name(settings: TriblerConfigManager) -> str:
Expand Down Expand Up @@ -144,7 +144,8 @@ def from_defaults(settings: TriblerConfigManager) -> DownloadConfig:
config.set_hops(0)
config.set_safe_seeding(settings.get("libtorrent/download_defaults/safeseeding_enabled"))
config.set_dest_dir(settings.get("libtorrent/download_defaults/saveas"))
config.set_completed_dir(settings.get("libtorrent/download_defaults/completed_dir"))
if settings.get("libtorrent/download_defaults/completed_dir"):
config.set_completed_dir(settings.get("libtorrent/download_defaults/completed_dir"))

return config

Expand All @@ -158,7 +159,7 @@ def write(self, filename: Path) -> None:
"""
Write the contents of this config to a file.
"""
config_obj = cast(ConfigObj, self.config)
config_obj = cast("ConfigObj", self.config)
config_obj.filename = str(filename)
config_obj.write()

Expand Down