mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-21 06:45:24 -06:00
chore(api): update type annotations
This commit is contained in:
parent
c730af2106
commit
00ab574e85
3 changed files with 9 additions and 10 deletions
|
|
@ -855,9 +855,10 @@ class _StatisticsMaintainer: # pylint: disable=missing-class-docstring,missing-
|
|||
self.last_timestamp = timestamp
|
||||
|
||||
def mean(self) -> float:
|
||||
if self.integral is None:
|
||||
return math.nan
|
||||
|
||||
if self.has_nan:
|
||||
if self.integral is None:
|
||||
return math.nan
|
||||
return self.integral / (self.last_timestamp - self.start_timestamp)
|
||||
|
||||
timestamp = timer()
|
||||
|
|
@ -865,12 +866,12 @@ class _StatisticsMaintainer: # pylint: disable=missing-class-docstring,missing-
|
|||
return integral / (timestamp - self.start_timestamp)
|
||||
|
||||
def min(self) -> float:
|
||||
if self.has_nan or self.min_value is None:
|
||||
if self.min_value is None:
|
||||
return math.nan
|
||||
return self.min_value
|
||||
|
||||
def max(self) -> float:
|
||||
if self.has_nan or self.max_value is None:
|
||||
if self.max_value is None:
|
||||
return math.nan
|
||||
return self.max_value
|
||||
|
||||
|
|
|
|||
|
|
@ -452,10 +452,10 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi
|
|||
|
||||
_pid: int
|
||||
_host: HostProcess
|
||||
_ident: tuple
|
||||
_device: Device
|
||||
_hash: int | None
|
||||
_username: str | None
|
||||
_ident: tuple
|
||||
_hash: int | None
|
||||
|
||||
# pylint: disable-next=too-many-arguments
|
||||
def __new__(
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ SIZE_UNITS: dict[str | None, int] = {
|
|||
'MB': 1000**2,
|
||||
'GB': 1000**3,
|
||||
'TB': 1000**4,
|
||||
'PB': 1000**4,
|
||||
'PB': 1000**5,
|
||||
}
|
||||
"""Units of storage and memory measurements."""
|
||||
SIZE_PATTERN: re.Pattern = re.compile(
|
||||
|
|
@ -694,9 +694,7 @@ class Snapshot:
|
|||
"""Support ``for name in snapshot`` syntax and ``*`` tuple unpack ``[*snapshot]`` syntax."""
|
||||
|
||||
def gen() -> Generator[str, None, None]:
|
||||
for name in self.__dict__:
|
||||
if name not in ('real', 'timestamp'):
|
||||
yield name
|
||||
yield from (name for name in self.__dict__ if name not in ('real', 'timestamp'))
|
||||
|
||||
return gen()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue