mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 15:40:54 +00:00
drop async-service dep and copy relevant code into a local async_service
tool, updated for modern handling of ExceptionGroup
This commit is contained in:
18
libp2p/tools/async_service/stats.py
Normal file
18
libp2p/tools/async_service/stats.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Copied from https://github.com/ethereum/async-service
|
||||
|
||||
from typing import (
|
||||
NamedTuple,
|
||||
)
|
||||
|
||||
|
||||
class TaskStats(NamedTuple):
|
||||
total_count: int
|
||||
finished_count: int
|
||||
|
||||
@property
|
||||
def pending_count(self) -> int:
|
||||
return self.total_count - self.finished_count
|
||||
|
||||
|
||||
class Stats(NamedTuple):
|
||||
tasks: TaskStats
|
||||
Reference in New Issue
Block a user