Detailed per-node plotting of pub/callback timings, datastructure fixes
This commit is contained in:
parent
5c8086e796
commit
062e641ee7
4 changed files with 694 additions and 218 deletions
16
utils.py
Normal file
16
utils.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from typing import Callable, Iterable, Optional, TypeVar
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
def filter_none(ls: Iterable[Optional[T]]) -> filter[T]:
|
||||
return filter(lambda x: x is not None, ls)
|
||||
|
||||
S = TypeVar("S")
|
||||
def safe_map(func: Callable[[T], S], ls: Iterable[T]) -> map[Optional[S]]:
|
||||
def safe_func(arg):
|
||||
try:
|
||||
return func(arg)
|
||||
except:
|
||||
return None
|
||||
|
||||
return map(safe_func, ls)
|
Loading…
Add table
Add a link
Reference in a new issue