Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ jobs:
- run: uv sync
- run: uv run ruff format --check --diff .
- run: uv run ruff check
- run: uv run isort -c --diff nle/
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
repos:
- hooks:
- id: ruff
args: [--fix]
- id: ruff-format
repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.3
Expand All @@ -17,8 +18,3 @@ repos:
language: system
name: clang-format
repo: local
- hooks:
- id: isort
name: isort (python)
repo: https://github.com/pycqa/isort
rev: 5.13.2
4 changes: 2 additions & 2 deletions nle/dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nle._pyconverter import Converter
import nle.dataset.db
from nle.dataset.populate_db import add_altorg_directory, add_nledata_directory
from nle._pyconverter import Converter
from nle.dataset.dataset import TtyrecDataset
from nle.dataset.populate_db import add_altorg_directory, add_nledata_directory
2 changes: 1 addition & 1 deletion nle/env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import gymnasium as gym
from gymnasium.envs import registration

from nle.env.base import NLE, DUNGEON_SHAPE
from nle.env.base import DUNGEON_SHAPE, NLE

_version = "v0"

Expand Down
14 changes: 7 additions & 7 deletions nle/nethack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) Facebook, Inc. and its affiliates.
from nle.nethack.actions import * # noqa: F403
from nle._pynethack.nethack import * # noqa: F403
from nle.nethack.actions import * # noqa: F403
from nle.nethack.nethack import (
Nethack,
NETHACKOPTIONS,
DUNGEON_SHAPE,
BLSTATS_SHAPE,
MESSAGE_SHAPE,
INV_SIZE,
PROGRAM_STATE_SHAPE,
DUNGEON_SHAPE,
INTERNAL_SHAPE,
INV_SIZE,
MESSAGE_SHAPE,
NETHACKOPTIONS,
OBSERVATION_DESC,
PROGRAM_STATE_SHAPE,
TTYREC_VERSION,
Nethack,
tty_render,
)
5 changes: 1 addition & 4 deletions nle/scripts/collect_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
# Original version from:
# https://github.com/pytorch/pytorch/blob/fa5bc9fa/torch/utils/collect_env.py

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

import locale
import os
Expand Down
23 changes: 13 additions & 10 deletions nle/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

import numpy as np
import pytest
from test_converter import COLSROWS
from test_converter import FINALFRAME
from test_converter import FINALFRAMECOLORS
from test_converter import TIMESTAMPS
from test_converter import getfilename
from test_db import conn # noqa: F401
from test_db import mockdata # noqa: F401

from nle.dataset import dataset
from nle.dataset import db
from test_converter import (
COLSROWS,
FINALFRAME,
FINALFRAMECOLORS,
TIMESTAMPS,
getfilename,
)
from test_db import (
conn, # noqa: F401
mockdata, # noqa: F401
)

from nle.dataset import dataset, db


class TestDataset:
Expand Down
3 changes: 1 addition & 2 deletions nle/tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import test_converter

import nle.env.tasks
from nle.dataset import db
from nle.dataset import populate_db
from nle.dataset import db, populate_db

TTYRECS = [
("aaa", test_converter.TTYREC_2020),
Expand Down
3 changes: 1 addition & 2 deletions nle/tests/test_nethack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import numpy as np
import pytest

from nle import _pynethack
from nle import nethack
from nle import _pynethack, nethack

# MORE + compass directions + long compass directions.
ACTIONS = [
Expand Down
6 changes: 4 additions & 2 deletions nle/tests/test_populate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import pytest # NOQA: F401
from test_converter import getfilename
from test_db import conn # NOQA: F401
from test_db import mockdata # NOQA: F401
from test_db import (
conn, # NOQA: F401
mockdata, # NOQA: F401
)

from nle import nethack

Expand Down
21 changes: 1 addition & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ dev = ["nle[dev]"]
agent = ["torch>=1.3.1"]
dev = [
"pre-commit>=2.0.1",
"isort>=5.13.2",
"cmake_format>=0.6.10",
"memory-profiler>=0.60.0",
"pytest>=6.2.5",
Expand All @@ -55,31 +54,13 @@ dev = [
]
all = ["nle[agent,dev]"]

[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| src
| win/rl/nethack_rl
)/
'''

[tool.isort]
force_single_line = true
profile = "black"
skip_glob = "**/__init__.py"

[tool.ruff]
# See https://docs.astral.sh/ruff/rules/.
extend-exclude = ["third_party"]
exclude = ["win/rl/nle"]
[tool.ruff.lint]
ignore = ["B008", "B905", "C901", "E501", "E731"]
select = ["B", "B9", "C", "E", "F", "W", "R"]
select = ["B", "B9", "C", "E", "F", "I", "R", "W"]
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.per-file-ignores]
Expand Down
12 changes: 0 additions & 12 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading