Skip to content

Commit

Permalink
Revert type change to set_current_lang and instead concat inside extr…
Browse files Browse the repository at this point in the history
…act()
  • Loading branch information
freddyheppell committed Aug 12, 2024
1 parent 55cd131 commit 11b4ee7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/wpextract/parse/translations/_pickers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from collections.abc import Sequence
from typing import Optional, Union
from typing import Optional

from bs4 import BeautifulSoup, Tag
from langcodes import Language
Expand Down Expand Up @@ -93,14 +93,12 @@ def extract(self) -> None:
"""
pass

def set_current_lang(self, lang: Union[str, list[str]]) -> None:
def set_current_lang(self, lang: str) -> None:
"""Set the language of this doc.
Args:
lang: The locale string
"""
lang = attr_concat(lang)

self.current_language = Language.get(lang, normalize=True)

def add_translation(self, href: str, lang: str) -> None:
Expand Down Expand Up @@ -210,7 +208,7 @@ def extract(self) -> None:
"""
current_lang = self._root_select_one(".lang-item.current-lang a")

self.set_current_lang(current_lang["lang"])
self.set_current_lang(attr_concat(current_lang["lang"]))

other_langs = self.root_el.select(
".lang-item:not(.no-translation):not(.current-lang) a"
Expand Down

0 comments on commit 11b4ee7

Please sign in to comment.