Skip to content

Commit

Permalink
ci: fix basedpyright lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkparekh committed Aug 26, 2024
1 parent 862b7d4 commit 43a6e27
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@ reportUnusedCallResult = false
reportIncompatibleMethodOverride = false
reportInvalidCast = false
reportPrivateLocalImportUsage = false
reportUnsafeMultipleInheritance = false
# Covered by ruff
reportUnusedParameter = false
reportPrivateUsage = false
reportUnusedImport = false
reportPrivateImportUsage = false
reportImplicitStringConcatenation = false
reportDeprecated = false
reportMissingParameterType = false

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
3 changes: 1 addition & 2 deletions src/cogelot/data/transforms/reword.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@
def _consecutive_subsets(iterable: list[str]) -> list[str]:
"""Get all consecutive subsets of an iterable."""
subsets: list[tuple[str, ...]] = [
beginning
for beginning, _, _ in more_itertools.windowed_complete(iterable, 1) # pyright: ignore[reportAssignmentType]
beginning for beginning, _, _ in more_itertools.windowed_complete(iterable, 1)
]
# Add the full list onto the end
subsets.append(tuple(iterable))
Expand Down
4 changes: 2 additions & 2 deletions src/cogelot/entrypoints/generate_training_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def try_generate_episode(env: VIMAEnvBase, *, seed: int, only_keep_success: bool

# Clip action to space
oracle_action = {
k: np.clip(v, env.action_space[k].low, env.action_space[k].high) # type: ignore[reportIndexIssue]
k: np.clip(v, env.action_space[k].low, env.action_space[k].high) # pyright: ignore[reportIndexIssue]
for k, v in oracle_action.items()
}

Expand Down Expand Up @@ -140,7 +140,7 @@ def save_episode(episode: EpisodeOutput, task_output_dir: Path, episode_idx: int

# Save RGB images
logger.debug(f"{output_dir}: Save RGB images")
rgb = obs.pop("rgb") # type: ignore[reportAttributeAccessError]
rgb = obs.pop("rgb") # pyright: ignore[reportAttributeAccessIssue,reportArgumentType]
views = sorted(rgb.keys())
for view in views:
frames = rgb[view]
Expand Down
4 changes: 2 additions & 2 deletions src/cogelot/environment/vima.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _find_prompt_renderer(env: Env[Any, Any]) -> PromptRenderer | None:
if isinstance(env, PromptRenderer):
return env
if getattr(env, "env", None) is not None:
return _find_prompt_renderer(env.env) # type: ignore[attr-defined]
return _find_prompt_renderer(env.env) # pyright: ignore[reportAttributeAccessIssue]
return None


Expand All @@ -49,7 +49,7 @@ def get_task_kwargs(partition: Partition, task: Task) -> dict[str, Any] | None:
return task_kwargs


class VIMAEnvironment(Wrapper): # type: ignore[type-arg]
class VIMAEnvironment(Wrapper): # pyright: ignore[reportMissingTypeArgument]
"""Environment wrapper for VIMA."""

env: VIMAEnvBase
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import os
from pathlib import Path
from typing import Never

import pytest

if os.getenv("_PYTEST_RAISE", "0") != "0":

@pytest.hookimpl(tryfirst=True)
def pytest_exception_interact(call): # type: ignore[no-untyped-def] # noqa: ANN201, ANN001
def pytest_exception_interact(call) -> Never: # noqa: ANN001
raise call.excinfo.value

@pytest.hookimpl(tryfirst=True)
def pytest_internalerror(excinfo): # type: ignore[no-untyped-def] # noqa: ANN201, ANN001
def pytest_internalerror(excinfo) -> Never: # noqa: ANN001
raise excinfo.value


Expand Down

0 comments on commit 43a6e27

Please sign in to comment.