Skip to content

Commit 9eb009c

Browse files
authored
[CI] Fix linter (#3121)
1 parent 0592fdc commit 9eb009c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+341
-171
lines changed

.github/unittest/helpers/coverage_run_parallel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
import sys
1818
import tempfile
1919
from pathlib import Path
20-
from typing import List
2120

2221

23-
def write_config(config_path: Path, argv: List[str]) -> None:
22+
def write_config(config_path: Path, argv: list[str]) -> None:
2423
"""
2524
Write a coverage.py config that is equivalent to the command line arguments passed here.
2625
Args:
@@ -42,7 +41,7 @@ def write_config(config_path: Path, argv: List[str]) -> None:
4241
)
4342

4443

45-
def main(argv: List[str]) -> int:
44+
def main(argv: list[str]) -> int:
4645
if len(argv) < 1:
4746
print( # noqa
4847
"Usage: 'python coverage_run_parallel.py <command> [command arguments]'"

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
echo '::group::Setup environment'
3131
CONDA_PATH=$(which conda)
3232
eval "$(${CONDA_PATH} shell.bash hook)"
33-
conda create --name ci --quiet --yes python=3.8 pip
33+
conda create --name ci --quiet --yes python=3.11 pip
3434
conda activate ci
3535
echo '::endgroup::'
3636
@@ -58,7 +58,7 @@ jobs:
5858
echo '::group::Setup environment'
5959
CONDA_PATH=$(which conda)
6060
eval "$(${CONDA_PATH} shell.bash hook)"
61-
conda create --name ci --quiet --yes -c conda-forge python=3.8 ncurses=5 libgcc
61+
conda create --name ci --quiet --yes -c conda-forge python=3.11 ncurses=5 libgcc
6262
conda activate ci
6363
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
6464
echo '::endgroup::'

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@ repos:
1717
additional_dependencies:
1818
- black == 22.3.0
1919
- usort == 1.0.3
20-
- libcst == 0.4.7
20+
- libcst == 1.0.1
2121

2222
- repo: https://github.com/pycqa/flake8
23-
rev: 7.3.0
23+
rev: 6.1.0
2424
hooks:
2525
- id: flake8
2626
args: [--config=setup.cfg]
2727
additional_dependencies:
2828
- flake8-bugbear==22.10.27
2929
- flake8-comprehensions==3.10.1
30-
- torchfix==0.0.2
31-
- flake8-print==5.0.0
30+
- flake8-print==4.0.1
3231

3332
- repo: https://github.com/PyCQA/pydocstyle
3433
rev: 6.3.0
@@ -40,7 +39,7 @@ repos:
4039
rev: v3.20.0
4140
hooks:
4241
- id: pyupgrade
43-
args: [--py38-plus]
42+
args: [--py311-plus]
4443

4544
- repo: local
4645
hooks:

benchmarks/ecosystem/vmas_rllib_vs_torchrl_sampling_performance.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import time
1111
from pathlib import Path
12-
from typing import Dict
1312

1413
import numpy as np
1514

@@ -93,7 +92,7 @@ def on_train_result(
9392
- result["timers"]["learn_time_ms"]
9493
)
9594

96-
def env_creator(config: Dict):
95+
def env_creator(config: dict):
9796
env = vmas.make_env(
9897
scenario=config["scenario_name"],
9998
num_envs=config["num_envs"],

docs/source/content_generation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
import shutil
33
from pathlib import Path
4-
from typing import List
54

65
FILE_DIR = os.path.dirname(__file__)
76
KNOWLEDGE_GEN_DIR = "reference/generated/knowledge_base"
@@ -10,7 +9,7 @@
109
TUTORIALS_MEDIA_GEN_DIR = "reference/generated/tutorials/media"
1110

1211

13-
def _get_file_content(name: str) -> List[str]:
12+
def _get_file_content(name: str) -> list[str]:
1413
"""A function to get the content of a reference file.
1514
1615
Given the name of a knowledge base file, populates a file template. The result can be used to link a knowledge base

setup.cfg

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ per-file-ignores =
2424
torchrl/objectives/sac.py: TOR101
2525
torchrl/objectives/td3.py: TOR101
2626
torchrl/objectives/value/advantages.py: TOR101
27-
tutorials/*/**.py: T201
28-
examples/*.py: T201
29-
packaging/verify_nightly_version.py: T201
30-
test/opengl_rendering.py: T201
31-
*/**/run-clang-format.py: T201
32-
packaging/*/**.py: T201
27+
tutorials/*/**.py: T001, T201
28+
examples/*.py: T001, T201
29+
packaging/verify_nightly_version.py: T001, T201
30+
test/opengl_rendering.py: T001, T201
31+
*/**/run-clang-format.py: T001, T201
32+
packaging/*/**.py: T001, T201
33+
.github/unittest/linux_sota/scripts/test_sota.py: T001
34+
docs/source/conf.py: T001
35+
test/test_libs.py: T001
36+
torchrl/_utils.py: T002
3337

3438
exclude = venv
3539
extend-select = B901, C401, C408, C409, TOR0, TOR1, TOR2

sota-implementations/grpo/grpo_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from __future__ import annotations
66

77
import time
8-
from typing import Any, Callable, Literal
8+
from collections.abc import Callable
9+
from typing import Any, Literal
910

1011
import torch
1112
from omegaconf import DictConfig

sota-implementations/redq/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# LICENSE file in the root directory of this source tree.
55
from __future__ import annotations
66

7+
from collections.abc import Callable, Sequence
8+
79
from copy import copy
8-
from typing import Callable, Sequence
910

1011
import torch
1112
from omegaconf import OmegaConf

test/_utils_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import sys
1212
import time
1313
import unittest
14+
from collections.abc import Callable
1415
from functools import wraps
15-
from typing import Callable
1616

1717
import pytest
1818
import torch

test/llm/test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import argparse
99
import importlib.util
10-
from typing import Mapping
10+
from collections.abc import Mapping
1111

1212
import pytest
1313
import torch

0 commit comments

Comments
 (0)