mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-21 06:45:24 -06:00
docs(core/utils): update docstrings for NA
Signed-off-by: Xuehai Pan <XuehaiPan@pku.edu.cn>
This commit is contained in:
parent
877633cd04
commit
dc562f503f
2 changed files with 22 additions and 10 deletions
16
README.md
16
README.md
|
|
@ -997,17 +997,23 @@ Out[18]: MemoryInfo(total=268435456, free=257622016, used=10813440)
|
|||
>>> from nvitop import NA
|
||||
>>> NA
|
||||
'N/A'
|
||||
|
||||
>>> 'memory usage: {}'.format(NA) # NA is an instance of `str`
|
||||
'memory usage: N/A'
|
||||
>>> NA + 'str'
|
||||
>>> NA.lower() # NA is an instance of `str`
|
||||
'n/a'
|
||||
>>> NA.ljust(5) # NA is an instance of `str`
|
||||
'N/A '
|
||||
>>> NA + 'str' # string contamination if the operand is a string
|
||||
'N/Astr'
|
||||
>>> float(NA) # explicit conversion to float (`math.nan`)
|
||||
|
||||
>>> float(NA) # explicit conversion to float (`math.nan`)
|
||||
nan
|
||||
>>> NA + 1 # auto-casting to float
|
||||
>>> NA + 1 # auto-casting to float if the operand is a number
|
||||
nan
|
||||
>>> NA * 1024 # auto-casting to float
|
||||
>>> NA * 1024 # auto-casting to float if the operand is a number
|
||||
nan
|
||||
>>> NA / (1024 * 1024) # auto-casting to float
|
||||
>>> NA / (1024 * 1024) # auto-casting to float if the operand is a number
|
||||
nan
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -108,17 +108,23 @@ class NaType(str):
|
|||
|
||||
>>> NA
|
||||
'N/A'
|
||||
|
||||
>>> 'memory usage: {}'.format(NA) # NA is an instance of `str`
|
||||
'memory usage: N/A'
|
||||
>>> NA + 'str'
|
||||
>>> NA.lower() # NA is an instance of `str`
|
||||
'n/a'
|
||||
>>> NA.ljust(5) # NA is an instance of `str`
|
||||
'N/A '
|
||||
>>> NA + 'str' # string contamination if the operand is a string
|
||||
'N/Astr'
|
||||
>>> float(NA) # explicit conversion to float (`math.nan`)
|
||||
|
||||
>>> float(NA) # explicit conversion to float (`math.nan`)
|
||||
nan
|
||||
>>> NA + 1 # auto-casting to float
|
||||
>>> NA + 1 # auto-casting to float if the operand is a number
|
||||
nan
|
||||
>>> NA * 1024 # auto-casting to float
|
||||
>>> NA * 1024 # auto-casting to float if the operand is a number
|
||||
nan
|
||||
>>> NA / (1024 * 1024) # auto-casting to float
|
||||
>>> NA / (1024 * 1024) # auto-casting to float if the operand is a number
|
||||
nan
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue