From 86b1f2d7dd7c9cb787f7f02b7214efd8ef408f50 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Wed, 21 Jan 2026 16:37:38 +0800 Subject: [PATCH] chore: fix grammar and typos --- .pre-commit-config.yaml | 2 +- README.md | 2 +- docs/source/index.rst | 2 +- nvitop/api/collector.py | 6 +++--- nvitop/api/device.py | 6 +++--- nvitop/api/libcuda.py | 4 ++-- nvitop/api/libcudart.py | 4 ++-- nvitop/api/libnvml.py | 2 +- nvitop/api/process.py | 4 ++-- nvitop/cli.py | 2 +- nvitop/select.py | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc24404..389d935 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: args: [--ignore-case] files: ^docs/source/spelling_wordlist\.txt$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.11 + rev: v0.14.13 hooks: - id: ruff-check args: [--fix, --exit-non-zero-on-fix] diff --git a/README.md b/README.md index 656cee3..e1358ba 100644 --- a/README.md +++ b/README.md @@ -366,7 +366,7 @@ coloring: --colorful Use gradient colors to get spectrum-like bar charts. This option is only available when the terminal supports 256 colors. You may need to set environment variable `TERM="xterm-256color"`. Note that the terminal multiplexer, such as `tmux`, may - override the `TREM` variable. + override the `TERM` variable. --force-color Force colorize even when `stdout` is not a TTY terminal. --light Tweak visual results for light theme terminals in monitor mode. Set variable `NVITOP_MONITOR_MODE="light"` on light terminals for convenience. diff --git a/docs/source/index.rst b/docs/source/index.rst index 1abbea1..e71cce5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -58,7 +58,7 @@ Install from PyPI (|PyPI Package|_): .. note:: - Python 3.8+ is required, and Python versions lower than 3.8 is not supported. + Python 3.8+ is required, and Python versions lower than 3.8 are not supported. Install from conda-forge (|Conda-forge Package|_): diff --git a/nvitop/api/collector.py b/nvitop/api/collector.py index 5a90c54..85d5caa 100644 --- a/nvitop/api/collector.py +++ b/nvitop/api/collector.py @@ -78,7 +78,7 @@ def take_snapshots( A named tuple containing two lists of snapshots. Note: - If not arguments are specified, all devices and all GPU processes will + If no arguments are specified, all devices and all GPU processes will be returned. Examples: @@ -216,7 +216,7 @@ def collect_in_background( on_start (Optional[Callable[[ResourceMetricCollector], None]]): A function to initialize the daemon thread and collector. on_stop (Optional[Callable[[ResourceMetricCollector], None]]): - A function that do some necessary cleanup after the daemon thread is stopped. + A function that does some necessary cleanup after the daemon thread is stopped. tag (str): The tag prefix used for metrics results. start (bool): @@ -670,7 +670,7 @@ class ResourceMetricCollector: # pylint: disable=too-many-instance-attributes ) def __del__(self) -> None: - """Clean up the demon thread on destruction.""" + """Clean up the daemon thread on destruction.""" self._daemon_running.clear() # pylint: disable-next=too-many-branches,too-many-locals,too-many-statements diff --git a/nvitop/api/device.py b/nvitop/api/device.py index da0225a..9b45047 100644 --- a/nvitop/api/device.py +++ b/nvitop/api/device.py @@ -17,7 +17,7 @@ """The live classes for GPU devices. The core classes are :class:`Device` and :class:`CudaDevice` (also aliased as :attr:`Device.cuda`). -The type of returned instance created by ``Class(args)`` is depending on the given arguments. +The type of the returned instance created by ``Class(args)`` depends on the given arguments. ``Device()`` returns: @@ -612,7 +612,7 @@ class Device: # pylint: disable=too-many-instance-attributes,too-many-public-me - (uuid: str) -> Union[PhysicalDevice, MigDevice] # depending on the UUID value - (bus_id: str) -> PhysicalDevice - Note: This method takes exact 1 non-None argument. + Note: This method takes exactly 1 non-None argument. Returns: Union[PhysicalDevice, MigDevice] A :class:`PhysicalDevice` instance or a :class:`MigDevice` instance. @@ -2892,7 +2892,7 @@ class CudaDevice(Device): - (nvml_index: int) -> CudaDevice - (nvml_index: (int, int)) -> CudaMigDevice - Note: This method takes exact 1 non-None argument. + Note: This method takes exactly 1 non-None argument. Returns: Union[CudaDevice, CudaMigDevice] A :class:`CudaDevice` instance or a :class:`CudaMigDevice` instance. diff --git a/nvitop/api/libcuda.py b/nvitop/api/libcuda.py index 81550d2..eb4e662 100644 --- a/nvitop/api/libcuda.py +++ b/nvitop/api/libcuda.py @@ -191,7 +191,7 @@ CUDA_ERROR_MPS_SERVER_NOT_READY = 807 CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808 """This error indicates that the hardware resources required to create MPS client have been exhausted.""" CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809 -"""This error indicates the the hardware resources required to support device connections have been exhausted.""" +"""This error indicates that the hardware resources required to support device connections have been exhausted.""" CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900 """This error indicates that the operation is not permitted when the stream is capturing.""" CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901 @@ -294,7 +294,7 @@ def _extract_cuda_errors_as_classes() -> None: Each CUDA Error gets a new :class:`CUDAError` subclass. This way try-except blocks can filter appropriate exceptions more easily. - :class:`CUDAError` is a parent class. Each ``CUDA_ERROR_*`` gets it's own subclass. + :class:`CUDAError` is a parent class. Each ``CUDA_ERROR_*`` gets its own subclass. e.g. :data:`CUDA_ERROR_INVALID_VALUE` will be turned into :class:`CUDAError_InvalidValue`. """ this_module = _sys.modules[__name__] diff --git a/nvitop/api/libcudart.py b/nvitop/api/libcudart.py index 006d5d2..b6403fd 100644 --- a/nvitop/api/libcudart.py +++ b/nvitop/api/libcudart.py @@ -231,7 +231,7 @@ cudaErrorMpsServerNotReady = 807 cudaErrorMpsMaxClientsReached = 808 """This error indicates that the hardware resources required to create MPS client have been exhausted.""" cudaErrorMpsMaxConnectionsReached = 809 -"""This error indicates the the hardware resources required to device connections have been exhausted.""" +"""This error indicates that the hardware resources required for device connections have been exhausted.""" cudaErrorMpsClientTerminated = 810 """This error indicates that the MPS client has been terminated by the server. To continue using CUDA, the process must be terminated and relaunched.""" cudaErrorCdpNotSupported = 811 @@ -342,7 +342,7 @@ def _extract_cuda_errors_as_classes() -> None: Each CUDA Error gets a new :class:`cudaError` subclass. This way try-except blocks can filter appropriate exceptions more easily. - :class:`cudaError` is a parent class. Each ``cudaError*`` gets it's own subclass. + :class:`cudaError` is a parent class. Each ``cudaError*`` gets its own subclass. e.g. :data:`cudaErrorInvalidValue` will be turned into :class:`cudaError_InvalidValue`. """ this_module = _sys.modules[__name__] diff --git a/nvitop/api/libnvml.py b/nvitop/api/libnvml.py index 1eddb2e..6391f97 100644 --- a/nvitop/api/libnvml.py +++ b/nvitop/api/libnvml.py @@ -546,7 +546,7 @@ if not _pynvml_installation_corrupted: try: ptr = _nvmlGetFunctionPointer(symbol) except NVMLError_FunctionNotFound: - LOGGER.debug('Failed to found symbol `%s`.', symbol) + LOGGER.debug('Failed to find symbol `%s`.', symbol) return None LOGGER.debug('Found symbol `%s`.', symbol) return ptr diff --git a/nvitop/api/process.py b/nvitop/api/process.py index a490902..479725f 100644 --- a/nvitop/api/process.py +++ b/nvitop/api/process.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""The live classes for process running on the host and the GPU devices.""" +"""The live classes for processes running on the host and the GPU devices.""" # pylint: disable=too-many-lines @@ -559,7 +559,7 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi Raises: AttributeError: - If the attribute is not defined in either :class:`GpuProcess` nor :class:`HostProcess`. + If the attribute is not defined in either :class:`GpuProcess` or :class:`HostProcess`. host.NoSuchProcess: If the process is gone. host.AccessDenied: diff --git a/nvitop/cli.py b/nvitop/cli.py index fcc6d35..5a8da80 100644 --- a/nvitop/cli.py +++ b/nvitop/cli.py @@ -112,7 +112,7 @@ def parse_arguments() -> argparse.Namespace: 'Use gradient colors to get spectrum-like bar charts. This option is only available\n' 'when the terminal supports 256 colors. You may need to set environment variable\n' '`TERM="xterm-256color"`. Note that the terminal multiplexer, such as `tmux`, may\n' - 'override the `TREM` variable.' + 'override the `TERM` variable.' ), ) coloring.add_argument( diff --git a/nvitop/select.py b/nvitop/select.py index 385f88e..9ab1eff 100644 --- a/nvitop/select.py +++ b/nvitop/select.py @@ -148,7 +148,7 @@ def select_devices( """Select a subset of devices satisfying the specified criteria. Note: - The *min count* constraint may not be satisfied if the no enough devices are available. This + The *min count* constraint may not be satisfied if not enough devices are available. This constraint is only enforced when there are both MIG and non-MIG devices present. Examples: @@ -456,7 +456,7 @@ def parse_arguments() -> argparse.Namespace: metavar='TOL', help=( 'The constraints tolerance (in percentage). (default: 0, i.e., strict)\n' - 'This option can loose the constraints if the requested resource is not available.\n' + 'This option can loosen the constraints if the requested resource is not available.\n' 'For example, set `--tolerance=20` will accept a device with only 4GiB of free\n' 'memory when set `--min-free-memory=5GiB`.' ),