From fa64806bdaacfe2fefd5bf7c285dc1ea62a6e1f9 Mon Sep 17 00:00:00 2001 From: Jiuguang Wang Date: Sun, 29 Oct 2023 14:34:32 -0400 Subject: [PATCH] Update pre-commit hook versions --- .pre-commit-config.yaml | 10 +++++----- pyproject.toml | 10 +++++----- test/test_setup.py | 2 +- test/test_visualization.py | 2 +- .../utils/non_habitat_policy/rnn_state_encoder.py | 5 ++++- vlfm/utils/geometry_utils.py | 3 +-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 13392d6..ea0613d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ -# Copyright [2023] Boston Dynamics AI Institute, Inc. +# Copyright (c) 2023 Boston Dynamics AI Institute LLC. All rights reserved. repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.263' + rev: 'v0.1.0' hooks: - id: ruff args: ['--fix', '--config', 'pyproject.toml'] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-yaml args: ['--unsafe'] @@ -21,7 +21,7 @@ repos: - id: check-shebang-scripts-are-executable - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.10.0 hooks: - id: black language_version: python3.9 @@ -29,7 +29,7 @@ repos: verbose: true - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.2.0 + rev: v1.6.1 hooks: - id: mypy pass_filenames: false diff --git a/pyproject.toml b/pyproject.toml index 1074931..37006be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,9 +29,9 @@ dependencies = [ [project.optional-dependencies] dev = [ - "pre-commit >= 3.1.1", - "pytest >= 7.2.1", - "pytest-cov >= 4.0.0", + "pre-commit >= 3.5.0", + "pytest >= 7.3.1", + "pytest-cov >= 4.1.0", ] habitat = [ "habitat-sim @ git+https://github.com/facebookresearch/habitat-sim.git@v0.2.4", @@ -118,7 +118,7 @@ preview = true # mypy configuration [tool.mypy] -python_version = "3.9" +python_version = "3.10" disallow_untyped_defs = true ignore_missing_imports = true explicit_package_bases = true @@ -127,5 +127,5 @@ strict_equality = true warn_unreachable = true warn_redundant_casts = true no_implicit_optional = true -files = ['vlfm'] +files = ['vlfm', 'test'] exclude = '^(docker|.*external|.*thirdparty|.*install|.*build|.*_experimental)/' diff --git a/test/test_setup.py b/test/test_setup.py index 3847d66..c4126d2 100644 --- a/test/test_setup.py +++ b/test/test_setup.py @@ -7,7 +7,7 @@ from vlfm.utils.generate_dummy_policy import save_dummy_policy -def test_load_and_save_config(): +def test_load_and_save_config() -> None: if not os.path.exists("data"): os.makedirs("data") diff --git a/test/test_visualization.py b/test/test_visualization.py index cb0c969..e984058 100644 --- a/test/test_visualization.py +++ b/test/test_visualization.py @@ -7,7 +7,7 @@ from vlfm.utils.visualization import generate_text_image -def test_visualization(): +def test_visualization() -> None: if not os.path.exists("build"): os.makedirs("build") diff --git a/vlfm/policy/utils/non_habitat_policy/rnn_state_encoder.py b/vlfm/policy/utils/non_habitat_policy/rnn_state_encoder.py index 30e0ea2..2c7b4f1 100755 --- a/vlfm/policy/utils/non_habitat_policy/rnn_state_encoder.py +++ b/vlfm/policy/utils/non_habitat_policy/rnn_state_encoder.py @@ -141,7 +141,10 @@ def build_rnn_inputs( rnn_states: torch.Tensor, not_dones: torch.Tensor, rnn_build_seq_info: Dict[str, torch.Tensor], -) -> Tuple[PackedSequence, torch.Tensor,]: +) -> Tuple[ + PackedSequence, + torch.Tensor, +]: r"""Create a PackedSequence input for an RNN such that each set of steps that are part of the same episode are all part of a batch in the PackedSequence. diff --git a/vlfm/utils/geometry_utils.py b/vlfm/utils/geometry_utils.py index e03e7e9..7c06fbe 100644 --- a/vlfm/utils/geometry_utils.py +++ b/vlfm/utils/geometry_utils.py @@ -83,8 +83,7 @@ def calculate_vfov(hfov: float, width: int, height: int) -> float: """ # Calculate the diagonal field of view (DFOV) dfov = 2 * math.atan( - math.tan(hfov / 2) - * math.sqrt((width**2 + height**2) / (width**2 + height**2)) + math.tan(hfov / 2) * math.sqrt((width**2 + height**2) / (width**2 + height**2)) ) # Calculate the vertical field of view (VFOV)