aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-02-05 21:51:34 +0100
committerGravatar Numerlor <[email protected]>2021-02-05 21:51:34 +0100
commit49527d94dd792ee3ac81d6f3ee309fcd4f2c63ad (patch)
treeac56ddd873d5128c155e18d99b9eec08504a530b
parentAvoid from import on _batch_parser (diff)
Remove unnecessary use of partial
run_in_executor can provide args to the func it's passed in, making the use of partial unnecessary. This will also make it more convenient to move to asyncio.to_thread when the codebase is switched to python 3.9
-rw-r--r--bot/exts/info/doc/_batch_parser.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/bot/exts/info/doc/_batch_parser.py b/bot/exts/info/doc/_batch_parser.py
index d18a455d8..b3f72bb89 100644
--- a/bot/exts/info/doc/_batch_parser.py
+++ b/bot/exts/info/doc/_batch_parser.py
@@ -5,7 +5,6 @@ import logging
import time
from collections import defaultdict
from contextlib import suppress
-from functools import partial
from operator import attrgetter
from typing import Dict, List, NamedTuple, Union
@@ -114,7 +113,9 @@ class BatchParser:
async with bot.instance.http_session.get(doc_item.url) as response:
soup = await bot.instance.loop.run_in_executor(
None,
- partial(BeautifulSoup, await response.text(encoding="utf8"), "lxml")
+ BeautifulSoup,
+ await response.text(encoding="utf8"),
+ "lxml",
)
self._queue.extend(QueueItem(item, soup) for item in self._page_doc_items[doc_item.url])
@@ -145,10 +146,7 @@ class BatchParser:
# if we already parsed an equal item, we can just skip it.
continue
- markdown = await bot.instance.loop.run_in_executor(
- None,
- partial(get_symbol_markdown, soup, item),
- )
+ markdown = await bot.instance.loop.run_in_executor(None, get_symbol_markdown, soup, item)
if markdown is not None:
scheduling.create_task(doc_cache.set(item, markdown))
else: