SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[fix] utils.parse_duration_string - the last three of [00, HH, MM, SS] (#6743)
Markus Heiser2e624bed40eb
diff --git a/searx/utils.py b/searx/utils.pyindex 8a30de909..de795ab8d 100644--- a/searx/utils.py+++ b/searx/utils.py@@ -794,9 +794,10 @@ def js_obj_str_to_json_str(js_obj_str: str) -> str:def parse_duration_string(duration_str: str) -> timedelta | None:- """Parse a time string in format MM:SS or HH:MM:SS and convert it to a `timedelta` object.+ """Parse a time string in format MM:SS or HH:MM:SS and convert it to a+ :obj:`datetime.timedelta` object.- Returns None if the provided string doesn't match any of the formats.+ Returns ``None`` if the provided string doesn't match any of the formats."""duration_str = duration_str.strip()@@ -805,7 +806,7 @@ def parse_duration_string(duration_str: str) -> timedelta | None:try:# prepending ["00"] here inits hours to 0 if they are not provided- time_parts = (["00"] + duration_str.split(":"))[:3]+ time_parts = (["00"] + duration_str.split(":"))[-3:]hours, minutes, seconds = map(int, time_parts)return timedelta(hours=hours, minutes=minutes, seconds=seconds)