Skip to content

Commit

Permalink
chore(pre-commit): update pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Jul 31, 2024
1 parent 51f08cd commit 623b1e5
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: debug-statements
- id: double-quote-string-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.5.5
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -38,7 +38,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py37-plus] # sync with requires-python
Expand Down
2 changes: 1 addition & 1 deletion nvitop-exporter/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@contextlib.contextmanager
def vcs_version(name: str, path: Path | str) -> Generator[ModuleType, None, None]:
def vcs_version(name: str, path: Path | str) -> Generator[ModuleType]:
"""Context manager to update version string in a version module."""
path = Path(path).absolute()
assert path.is_file()
Expand Down
2 changes: 1 addition & 1 deletion nvitop/api/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def deactivate(self, tag: str | None = None) -> ResourceMetricCollector:
stop = deactivate

@contextlib.contextmanager
def context(self, tag: str) -> Generator[ResourceMetricCollector, None, None]:
def context(self, tag: str) -> Generator[ResourceMetricCollector]:
"""A context manager for starting and stopping resource metric collection.
Args:
Expand Down
4 changes: 2 additions & 2 deletions nvitop/api/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2324,7 +2324,7 @@ def as_snapshot(self) -> Snapshot:

# Modified from psutil (https://github.com/giampaolo/psutil)
@contextlib.contextmanager
def oneshot(self) -> Generator[None, None, None]:
def oneshot(self) -> Generator[None]:
"""A utility context manager which considerably speeds up the retrieval of multiple device information at the same time.
Internally different device info (e.g. memory_info, utilization_rates, ...) may be fetched
Expand Down Expand Up @@ -3080,7 +3080,7 @@ def _does_any_device_support_mig_mode(uuids: Iterable[str] | None = None) -> boo


@contextlib.contextmanager
def _global_physical_device(device: PhysicalDevice) -> Generator[PhysicalDevice, None, None]:
def _global_physical_device(device: PhysicalDevice) -> Generator[PhysicalDevice]:
global _GLOBAL_PHYSICAL_DEVICE # pylint: disable=global-statement

with _GLOBAL_PHYSICAL_DEVICE_LOCK:
Expand Down
4 changes: 2 additions & 2 deletions nvitop/api/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def children(self, recursive: bool = False) -> list[HostProcess]:
return [HostProcess(child.pid) for child in super().children(recursive)]

@contextlib.contextmanager
def oneshot(self) -> Generator[None, None, None]:
def oneshot(self) -> Generator[None]:
"""A utility context manager which considerably speeds up the retrieval of multiple process information at the same time.
Internally different process info (e.g. name, ppid, uids, gids, ...) may be fetched by using
Expand Down Expand Up @@ -1026,7 +1026,7 @@ def take_snapshots( # batched version of `as_snapshot`

@classmethod
@contextlib.contextmanager
def failsafe(cls) -> Generator[None, None, None]:
def failsafe(cls) -> Generator[None]:
"""A context manager that enables fallback values for methods that fail.
Examples:
Expand Down
2 changes: 1 addition & 1 deletion nvitop/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def __setitem__(self, name: str, value: Any) -> None:
def __iter__(self) -> Iterator[str]:
"""Support ``for name in snapshot`` syntax and ``*`` tuple unpack ``[*snapshot]`` syntax."""

def gen() -> Generator[str, None, None]:
def gen() -> Generator[str]:
yield from (name for name in self.__dict__ if name not in {'real', 'timestamp'})

return gen()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ warn_unused_ignores = true

[[tool.mypy.overrides]]
module = ['nvitop.callbacks.*', 'nvitop.gui.*']
ignore_errors= true
ignore_errors = true

[tool.pydocstyle]
convention = "google"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@contextlib.contextmanager
def vcs_version(name: str, path: Path | str) -> Generator[ModuleType, None, None]:
def vcs_version(name: str, path: Path | str) -> Generator[ModuleType]:
"""Context manager to update version string in a version module."""
path = Path(path).absolute()
assert path.is_file()
Expand Down

0 comments on commit 623b1e5

Please sign in to comment.