Remove unused code

This commit is contained in:
Edward Betts 2023-11-09 07:39:16 +01:00
parent 00773cd5f9
commit e7004a08f4

View file

@ -8,7 +8,6 @@ import typing
import requests import requests
from . import utils from . import utils
from .category import Category
from .type import CallParams, Entity from .type import CallParams, Entity
wikidata_url = "https://www.wikidata.org/w/api.php" wikidata_url = "https://www.wikidata.org/w/api.php"
@ -200,30 +199,6 @@ def host_from_site(site: str) -> str:
return hosts[site] return hosts[site]
def process_cats(cats: list[dict[str, str]], site: str) -> list[Category]:
"""Process categories."""
return [Category(cat["title"], site) for cat in cats]
def get_categories(titles: list[str], site: str) -> list[tuple[str, list[Category]]]:
"""Get categories for pages with given titles."""
params: CallParams = {
"prop": "categories",
"clshow": "!hidden",
"cllimit": "max",
}
from_wiki = mediawiki_query(titles, params, site)
title_and_cats = []
for i in from_wiki:
if "categories" not in i:
continue
cats = process_cats(i["categories"], site)
if not cats:
continue
title_and_cats.append((i["title"], cats))
return title_and_cats
def get_history(title: str, site: str) -> list[Page]: def get_history(title: str, site: str) -> list[Page]:
"""Get history of a page.""" """Get history of a page."""
params: CallParams = { params: CallParams = {