Skip to content

Commit bdd57c7

Browse files
committed
Use ruff rather than black and isort for linting
1 parent 04b51bb commit bdd57c7

File tree

13 files changed

+58
-71
lines changed

13 files changed

+58
-71
lines changed

.github/workflows/lint_python.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ jobs:
2020
- run: uv sync
2121
- run: uv run ruff format --check --diff .
2222
- run: uv run ruff check
23-
- run: uv run isort -c --diff nle/

.github/workflows/test_and_deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
python-version: '3.10'
5454
- name: Ensure latest pip, wheel & setuptools
5555
run: python -m pip install -q --upgrade pip wheel setuptools
56+
- name: Install dependencies
57+
run: |
58+
brew install cmake
5659
- uses: actions/checkout@v4
5760
- name: Generate sdist
5861
run: |
@@ -79,6 +82,9 @@ jobs:
7982
python-version: 3.13
8083
- name: Ensure latest pip, wheel & setuptools
8184
run: python -m pip install -q --upgrade pip wheel setuptools
85+
- name: Install dependencies
86+
run: |
87+
brew install cmake
8288
- uses: actions/checkout@v4
8389
- name: Generate sdist
8490
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
repos:
33
- hooks:
44
- id: ruff
5+
args: [--fix]
56
- id: ruff-format
67
repo: https://github.com/astral-sh/ruff-pre-commit
78
rev: v0.4.3
@@ -17,8 +18,3 @@ repos:
1718
language: system
1819
name: clang-format
1920
repo: local
20-
- hooks:
21-
- id: isort
22-
name: isort (python)
23-
repo: https://github.com/pycqa/isort
24-
rev: 5.13.2

nle/dataset/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from nle._pyconverter import Converter
21
import nle.dataset.db
3-
from nle.dataset.populate_db import add_altorg_directory, add_nledata_directory
2+
from nle._pyconverter import Converter
43
from nle.dataset.dataset import TtyrecDataset
4+
from nle.dataset.populate_db import add_altorg_directory, add_nledata_directory

nle/env/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import gymnasium as gym
33
from gymnasium.envs import registration
44

5-
from nle.env.base import NLE, DUNGEON_SHAPE
5+
from nle.env.base import DUNGEON_SHAPE, NLE
66

77
_version = "v0"
88

nle/nethack/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Copyright (c) Facebook, Inc. and its affiliates.
2-
from nle.nethack.actions import * # noqa: F403
32
from nle._pynethack.nethack import * # noqa: F403
3+
from nle.nethack.actions import * # noqa: F403
44
from nle.nethack.nethack import (
5-
Nethack,
6-
NETHACKOPTIONS,
7-
DUNGEON_SHAPE,
85
BLSTATS_SHAPE,
9-
MESSAGE_SHAPE,
10-
INV_SIZE,
11-
PROGRAM_STATE_SHAPE,
6+
DUNGEON_SHAPE,
127
INTERNAL_SHAPE,
8+
INV_SIZE,
9+
MESSAGE_SHAPE,
10+
NETHACKOPTIONS,
1311
OBSERVATION_DESC,
12+
PROGRAM_STATE_SHAPE,
1413
TTYREC_VERSION,
14+
Nethack,
1515
tty_render,
1616
)

nle/scripts/collect_env.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
# Original version from:
77
# https://github.com/pytorch/pytorch/blob/fa5bc9fa/torch/utils/collect_env.py
88

9-
from __future__ import absolute_import
10-
from __future__ import division
11-
from __future__ import print_function
12-
from __future__ import unicode_literals
9+
from __future__ import absolute_import, division, print_function, unicode_literals
1310

1411
import locale
1512
import os

nle/tests/test_dataset.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44

55
import numpy as np
66
import pytest
7-
from test_converter import COLSROWS
8-
from test_converter import FINALFRAME
9-
from test_converter import FINALFRAMECOLORS
10-
from test_converter import TIMESTAMPS
11-
from test_converter import getfilename
12-
from test_db import conn # noqa: F401
13-
from test_db import mockdata # noqa: F401
14-
15-
from nle.dataset import dataset
16-
from nle.dataset import db
7+
from test_converter import (
8+
COLSROWS,
9+
FINALFRAME,
10+
FINALFRAMECOLORS,
11+
TIMESTAMPS,
12+
getfilename,
13+
)
14+
from test_db import (
15+
conn, # noqa: F401
16+
mockdata, # noqa: F401
17+
)
18+
19+
from nle.dataset import dataset, db
1720

1821

1922
class TestDataset:

nle/tests/test_db.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import test_converter
55

66
import nle.env.tasks
7-
from nle.dataset import db
8-
from nle.dataset import populate_db
7+
from nle.dataset import db, populate_db
98

109
TTYRECS = [
1110
("aaa", test_converter.TTYREC_2020),

nle/tests/test_nethack.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import numpy as np
88
import pytest
99

10-
from nle import _pynethack
11-
from nle import nethack
10+
from nle import _pynethack, nethack
1211

1312
# MORE + compass directions + long compass directions.
1413
ACTIONS = [

0 commit comments

Comments
 (0)