Fix regression with downloader mapper on aria2c and saldl

The setup I had for using asyncio.run with functools.partial didn't actually pan out. A full pass-through lambda is required.

I've also moved the mapped downloader variable to the root of the downloaders package.
This commit is contained in:
rlaphoenix 2023-05-12 12:19:34 +01:00
parent be403bbff4
commit 95802d1e64
2 changed files with 10 additions and 13 deletions

View File

@ -1,6 +1,15 @@
import asyncio
from .aria2c import aria2c from .aria2c import aria2c
from .requests import requests from .requests import requests
from .saldl import saldl from .saldl import saldl
from .downloader import downloader from ..config import config
downloader = {
"aria2c": lambda *args, **kwargs: asyncio.run(aria2c(*args, **kwargs)),
"requests": requests,
"saldl": lambda *args, **kwargs: asyncio.run(saldl(*args, **kwargs))
}[config.downloader]
__ALL__ = (downloader, aria2c, requests, saldl) __ALL__ = (downloader, aria2c, requests, saldl)

View File

@ -1,12 +0,0 @@
import asyncio
from functools import partial
from devine.core.config import config
from devine.core.downloaders import aria2c, requests, saldl
downloader = {
"aria2c": partial(asyncio.run, aria2c),
"requests": requests,
"saldl": partial(asyncio.run, saldl)
}[config.downloader]