Initial commit
This commit is contained in:
commit
ee3c2358ff
12 changed files with 622 additions and 0 deletions
14
lyrics_dl/utils.py
Normal file
14
lyrics_dl/utils.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from typing import Iterator, Optional, TypeVar
|
||||
|
||||
|
||||
def threshold_equal(a: float, b: float, epsilon: float) -> bool:
|
||||
return abs(a - b) <= epsilon
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
def next_or_none(iterator: Iterator[T]) -> Optional[T]:
|
||||
try:
|
||||
return next(iterator)
|
||||
except StopIteration:
|
||||
return None
|
Loading…
Add table
Add a link
Reference in a new issue