feat: improved and documented the search functions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user