diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fcb9eb6..acc08d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,14 +12,14 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.22 + rev: v0.16.10 hooks: - id: ruff args: [--fix] exclude: \.ipynb$ - id: ruff-format - repo: https://github.com/PyCQA/isort - rev: 9.0.0b1 + rev: 9.0.2 hooks: - id: isort args: ["--profile", "black", "--filter-files"] @@ -28,7 +28,7 @@ repos: hooks: - id: pyupgrade - repo: https://github.com/PyCQA/autoflake - rev: v2.3.3 + rev: v2.4.0 hooks: - id: autoflake args: ["--remove-all-unused-imports", "--in-place"] diff --git a/data_loader.py b/data_loader.py index e33a997..9ee0846 100644 --- a/data_loader.py +++ b/data_loader.py @@ -91,7 +91,7 @@ def __getitem__(self, index: int, max_retries: int = 10): raise RuntimeError( f"VideoIter:: failed to load a sample after {max_retries} retries" ) from e - index = np.random.choice(range(0, self.__len__())) + index = np.random.choice(range(self.__len__())) trace_back = sys.exc_info()[2] if trace_back is not None: line = str(trace_back.tb_lineno) diff --git a/features_loader.py b/features_loader.py index 8731345..7674eb1 100644 --- a/features_loader.py +++ b/features_loader.py @@ -65,7 +65,7 @@ def __getitem__(self, index: int, max_retries: int = 10) -> tuple[Tensor, Tensor raise RuntimeError( f"FeaturesLoader:: failed to load a sample after {max_retries} retries" ) from e - index = np.random.choice(range(0, self.__len__())) + index = np.random.choice(range(self.__len__())) logging.warning( f"FeaturesLoader:: ERROR!! (Force using another index:\n{index})\n{e}" ) diff --git a/utils/functional_video.py b/utils/functional_video.py index 864ef99..0f010e5 100644 --- a/utils/functional_video.py +++ b/utils/functional_video.py @@ -68,9 +68,7 @@ def to_tensor(clip): """ _is_tensor_video_clip(clip) if not clip.dtype == torch.uint8: - raise TypeError( - f"clip tensor should have data type uint8. Got {str(clip.dtype)}" - ) + raise TypeError(f"clip tensor should have data type uint8. Got {clip.dtype!s}") return clip.float().permute(3, 0, 1, 2) / 255.0 diff --git a/utils/transforms_video.py b/utils/transforms_video.py index 2040664..788105b 100644 --- a/utils/transforms_video.py +++ b/utils/transforms_video.py @@ -9,11 +9,11 @@ from . import functional_video as F __all__ = [ - "RandomResizedCropVideo", "CenterCropVideo", "NormalizeVideo", - "ToTensorVideo", "RandomHorizontalFlipVideo", + "RandomResizedCropVideo", + "ToTensorVideo", ]