Fix typing issues in debug_tools.
This commit is contained in:
@@ -11,9 +11,10 @@ desc: Debugging tools for AuDaGe.
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from enum import IntEnum
|
||||
from typing import Any
|
||||
|
||||
|
||||
def print_and_return(value: any) -> any:
|
||||
def print_and_return(value: Any) -> Any:
|
||||
print(value)
|
||||
return value
|
||||
|
||||
@@ -24,7 +25,7 @@ def catch(
|
||||
*args,
|
||||
handle: Callable = lambda e: e,
|
||||
**kwargs,
|
||||
) -> any:
|
||||
) -> Any:
|
||||
"""Function for catching errors in-line.
|
||||
|
||||
Parameters
|
||||
@@ -48,16 +49,16 @@ def catch(
|
||||
"""
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except exception as e:
|
||||
except exception as e: # ty: ignore[invalid-exception-caught]
|
||||
return handle(e)
|
||||
|
||||
|
||||
class TimeUnit(IntEnum):
|
||||
"""Conversion ratios to/from nanoseconds for various time units."""
|
||||
|
||||
NS = 1e9
|
||||
US = 1e6
|
||||
MS = 1e3
|
||||
NS = 1_000_000_000
|
||||
US = 1_000_000
|
||||
MS = 1_000
|
||||
S = 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user