mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
fix: remove TypeVar and manually ignore type error
This commit is contained in:
parent
8f3219b5f4
commit
d7d5941bf6
1 changed files with 3 additions and 5 deletions
|
@ -35,9 +35,6 @@ MATCH_MULTI_SPACE = re.compile(r" +")
|
||||||
MATCH_ERRONEOUS_WHITE_SPACE = re.compile(r"\n\s*\n")
|
MATCH_ERRONEOUS_WHITE_SPACE = re.compile(r"\n\s*\n")
|
||||||
""" Matches multiple new lines and removes erroneous white space """
|
""" Matches multiple new lines and removes erroneous white space """
|
||||||
|
|
||||||
N = typing.TypeVar("N", bound=numbers.Number)
|
|
||||||
""" Reusable TypeVar for refrencing inhereters of Number """
|
|
||||||
|
|
||||||
|
|
||||||
def clean(recipe_data: Recipe | dict, translator: Translator, url=None) -> Recipe:
|
def clean(recipe_data: Recipe | dict, translator: Translator, url=None) -> Recipe:
|
||||||
"""Main entrypoint to clean a recipe extracted from the web
|
"""Main entrypoint to clean a recipe extracted from the web
|
||||||
|
@ -396,7 +393,7 @@ def clean_yield(yields: str | list[str] | None) -> tuple[float, float, str]:
|
||||||
return servings_qty, yld_qty, yld_str
|
return servings_qty, yld_qty, yld_str
|
||||||
|
|
||||||
|
|
||||||
def clean_time(time_entry: str | timedelta | N | None, translator: Translator) -> None | str:
|
def clean_time(time_entry: str | timedelta | int | float | None, translator: Translator) -> None | str:
|
||||||
"""_summary_
|
"""_summary_
|
||||||
|
|
||||||
Supported Structures:
|
Supported Structures:
|
||||||
|
@ -417,7 +414,8 @@ def clean_time(time_entry: str | timedelta | N | None, translator: Translator) -
|
||||||
|
|
||||||
match time_entry:
|
match time_entry:
|
||||||
case numbers.Number():
|
case numbers.Number():
|
||||||
time_delta = timedelta(minutes=time_entry)
|
# type checked by case statement
|
||||||
|
time_delta = timedelta(minutes=time_entry) # type: ignore
|
||||||
return pretty_print_timedelta(time_delta, translator)
|
return pretty_print_timedelta(time_delta, translator)
|
||||||
case str(time_entry):
|
case str(time_entry):
|
||||||
if not time_entry.strip():
|
if not time_entry.strip():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue