Skip to content

Commit

Permalink
Update pre-commit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts committed Aug 9, 2024
1 parent 16bb976 commit 23d7d0c
Show file tree
Hide file tree
Showing 63 changed files with 1,207 additions and 1,139 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docs-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
folder: _build
clean-exclude: |
v*.*/
main
main
2 changes: 1 addition & 1 deletion .github/workflows/manual-build-docs-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
folder: _build
clean-exclude: |
v*.*/
main
main
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
password: ${{ secrets.pypi_password }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,3 @@ dmypy.json

# Cython debug symbols
cython_debug/

37 changes: 31 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args:
- --ignore-words-list=ser,theses,bu,ois
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
args:
- '--per-file-ignores=**/__init__.py:F401,F403,E402'
# - '--per-file-ignores=*/__init__.py:F401'
- --ignore=E203,W503,E741,E731
- --max-complexity=30
- --max-line-length=456
- --show-source
- --statistics
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
exclude: "__init__.py"
- repo: https://github.com/python/black
rev: 23.3.0
rev: 24.4.2
hooks:
- id: black
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,3 @@ Master theses
* [Multi-Agent Reinforcement Learning with Application on Traffic Flow Control](https://www.diva-portal.org/smash/get/diva2:1573441/FULLTEXT01.pdf) (Jun 2021)
* [Deep Reinforcement Learning for Automated Parking](https://repositorio-aberto.up.pt/bitstream/10216/136074/2/494682.pdf) (Aug 2021)
* [Deep Reinforcement Learning and Imitation Learning for Autonomous Driving in a Minimalist Environment](https://www.academia.edu/107587654/Deep_Reinforcement_Learning_and_Imitation_Learning_for_Autonomous_Driving_in_a_Minimalist_Environment) (Jun 2021)


2 changes: 1 addition & 1 deletion docs/404.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ hide-toc: true

# 404

## Page Not Found
## Page Not Found
2 changes: 1 addition & 1 deletion docs/bibliography/biblio.bib
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ @misc{Qi2017pointnet
eprint={1612.00593},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
}
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import highway_env # noqa: F401


project = "highway-env"
copyright = "2023 Farama Foundation"
author = "Farama Foundation"
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ bibliography/index
Github <https://github.com/Farama-Foundation/HighwayEnv>
Contribute to the Docs <https://github.com/Farama-Foundation/HighwayEnv/blob/main/docs/README.md>
```
```
22 changes: 11 additions & 11 deletions docs/observations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ For instance, consider a vehicle at 25m on the right-lane of the ego-vehicle and
```{eval-rst}
.. table:: $15$ m/s
== == == == == == == == == ==
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
== == == == == == == == == ==
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
== == == == == == == == == ==
```

Expand Down Expand Up @@ -287,18 +287,18 @@ The top row corresponds to the left-lane, the middle row corresponds to the lane

The {py:class}`~highway_env.envs.common.observation.LidarObservation` divides the space around the vehicle into angular sectors, and returns an array with one row per angular sector and two columns:
- distance to the nearest collidable object (vehicles or obstacles)
- component of the objects's relative velocity along that direction
- component of the objects's relative velocity along that direction

The angular sector of index 0 corresponds to an angle 0 (east), and then each index/sector increases the angle (south, west, north).
The angular sector of index 0 corresponds to an angle 0 (east), and then each index/sector increases the angle (south, west, north).

For example, for a grid of 8 cells, an obstacle 10 meters away in the south and moving towards the north at 1m/s would lead to the following observation:

```{eval-rst}
.. table:: the Lidar observation
.. table:: the Lidar observation
=== ===
0 0
0 0
0 0
0 0
10 -1
0 0
0 0
Expand All @@ -324,7 +324,7 @@ Here is an example of what the distance grid may look like in the parking env:
"vehicles_count": 3,
})
env.reset()
plt.imshow(env.render())
plt.show()
```
Expand Down
1 change: 1 addition & 0 deletions docs/scripts/move_404.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import sys


if __name__ == "__main__":
if len(sys.argv) < 2:
print("Provide a path")
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ rewards/index
graphics/index
multi_agent
make_your_own
```
```
40 changes: 21 additions & 19 deletions highway_env/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import sys

import gymnasium as gym


__version__ = "1.9.0"

try:
Expand All @@ -15,99 +18,98 @@
# Hide pygame support prompt
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"

from gymnasium.envs.registration import register
from highway_env.envs.common.abstract import MultiAgentWrapper


def _register_highway_envs():
"""Import the envs module so that envs register themselves."""

from highway_env.envs.common.abstract import MultiAgentWrapper

# exit_env.py
register(
gym.register(
id="exit-v0",
entry_point="highway_env.envs:ExitEnv",
)

# highway_env.py
register(
gym.register(
id="highway-v0",
entry_point="highway_env.envs:HighwayEnv",
)

register(
gym.register(
id="highway-fast-v0",
entry_point="highway_env.envs:HighwayEnvFast",
)

# intersection_env.py
register(
gym.register(
id="intersection-v0",
entry_point="highway_env.envs:IntersectionEnv",
)

register(
gym.register(
id="intersection-v1",
entry_point="highway_env.envs:ContinuousIntersectionEnv",
)

register(
gym.register(
id="intersection-multi-agent-v0",
entry_point="highway_env.envs:MultiAgentIntersectionEnv",
)

register(
gym.register(
id="intersection-multi-agent-v1",
entry_point="highway_env.envs:MultiAgentIntersectionEnv",
additional_wrappers=(MultiAgentWrapper.wrapper_spec(),),
)

# lane_keeping_env.py
register(
gym.register(
id="lane-keeping-v0",
entry_point="highway_env.envs:LaneKeepingEnv",
max_episode_steps=200,
)

# merge_env.py
register(
gym.register(
id="merge-v0",
entry_point="highway_env.envs:MergeEnv",
)

# parking_env.py
register(
gym.register(
id="parking-v0",
entry_point="highway_env.envs:ParkingEnv",
)

register(
gym.register(
id="parking-ActionRepeat-v0",
entry_point="highway_env.envs:ParkingEnvActionRepeat",
)

register(
gym.register(
id="parking-parked-v0", entry_point="highway_env.envs:ParkingEnvParkedVehicles"
)

# racetrack_env.py
register(
gym.register(
id="racetrack-v0",
entry_point="highway_env.envs:RacetrackEnv",
)

# roundabout_env.py
register(
gym.register(
id="roundabout-v0",
entry_point="highway_env.envs:RoundaboutEnv",
)

# two_way_env.py
register(
gym.register(
id="two-way-v0", entry_point="highway_env.envs:TwoWayEnv", max_episode_steps=15
)

# u_turn_env.py
register(id="u-turn-v0", entry_point="highway_env.envs:UTurnEnv")
gym.register(id="u-turn-v0", entry_point="highway_env.envs:UTurnEnv")


_register_highway_envs()
35 changes: 25 additions & 10 deletions highway_env/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
from highway_env.envs.highway_env import *
from highway_env.envs.merge_env import *
from highway_env.envs.parking_env import *
from highway_env.envs.roundabout_env import *
from highway_env.envs.two_way_env import *
from highway_env.envs.intersection_env import *
from highway_env.envs.lane_keeping_env import *
from highway_env.envs.u_turn_env import *
from highway_env.envs.exit_env import *
from highway_env.envs.racetrack_env import *
from highway_env.envs.exit_env import ExitEnv
from highway_env.envs.highway_env import HighwayEnv, HighwayEnvFast
from highway_env.envs.intersection_env import IntersectionEnv
from highway_env.envs.lane_keeping_env import LaneKeepingEnv
from highway_env.envs.merge_env import MergeEnv
from highway_env.envs.parking_env import ParkingEnv
from highway_env.envs.racetrack_env import RacetrackEnv
from highway_env.envs.roundabout_env import RoundaboutEnv
from highway_env.envs.two_way_env import TwoWayEnv
from highway_env.envs.u_turn_env import UTurnEnv


__all__ = [
"ExitEnv",
"HighwayEnv",
"HighwayEnvFast",
"IntersectionEnv",
"LaneKeepingEnv",
"MergeEnv",
"ParkingEnv",
"RacetrackEnv",
"RoundaboutEnv",
"TwoWayEnv",
"UTurnEnv",
]
Loading

0 comments on commit 23d7d0c

Please sign in to comment.