feat: improved and documented the search functions
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
2024-06-12 14:18:52 +02:00
parent 684c90a7b4
commit c306da7934
2 changed files with 46 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import inspect
import json
import logging
from datetime import datetime
from itertools import takewhile
from pathlib import Path
from typing import List, Union
@@ -127,3 +128,8 @@ def get_current_millis() -> int:
def get_unix_time() -> int:
return int(datetime.now().timestamp())
def limit_generator(generator, limit: Optional[int] = None):
return takewhile(lambda x: x < limit, generator) if limit is not None else generator