فهرست منبع

pre-commit autoupdate (#413)

Mark Towers 1 سال پیش
والد
کامیت
bdb182fce5

+ 5 - 5
.pre-commit-config.yaml

@@ -1,17 +1,17 @@
 ---
 repos:
   - repo: https://github.com/python/black
-    rev: 22.3.0
+    rev: 23.12.1
     hooks:
       - id: black
   - repo: https://github.com/codespell-project/codespell
-    rev: v2.1.0
+    rev: v2.2.6
     hooks:
       - id: codespell
         args:
           - --ignore-words-list=linz
   - repo: https://github.com/PyCQA/flake8
-    rev: 4.0.1
+    rev: 7.0.0
     hooks:
       - id: flake8
         args:
@@ -22,7 +22,7 @@ repos:
           - --show-source
           - --statistics
   - repo: https://github.com/PyCQA/isort
-    rev: 5.12.0
+    rev: 5.13.2
     hooks:
       - id: isort
         args: ["--profile", "black"]
@@ -36,7 +36,7 @@ repos:
 #          - --convention=google
 #        additional_dependencies: ["toml"]
   - repo: https://github.com/asottile/pyupgrade
-    rev: v2.32.0
+    rev: v3.15.0
     hooks:
       - id: pyupgrade
         args: ["--py37-plus"]

+ 0 - 1
docs/_scripts/gen_gifs.py

@@ -49,7 +49,6 @@ for env_spec in tqdm(gymnasium.envs.registry.values()):
                 state, info = env.reset()
                 terminated, truncated = False, False
                 while not (terminated or truncated) and len(frames) <= LENGTH:
-
                     frame = env.render()
                     frames.append(Image.fromarray(frame))
                     action = env.action_space.sample()

+ 1 - 1
docs/content/create_env_tutorial.md

@@ -204,7 +204,7 @@ class SimpleEnv(MiniGridEnv):
         # Generate the surrounding walls
         self.grid.wall_rect(0, 0, width, height)
 
-        # Generate verical separation wall
+        # Generate vertical separation wall
         for i in range(0, height):
             self.grid.set(5, i, Wall())
         

+ 0 - 3
minigrid/core/mission.py

@@ -169,7 +169,6 @@ class MissionSpace(spaces.Space[str]):
     def __eq__(self, other) -> bool:
         """Check whether ``other`` is equivalent to this instance."""
         if isinstance(other, MissionSpace):
-
             # Check that place holder lists are the same
             if self.ordered_placeholders is not None:
                 # Check length
@@ -189,10 +188,8 @@ class MissionSpace(spaces.Space[str]):
                     other_mission = other.mission_func(*test_placeholders)
                     return mission == other_mission
             else:
-
                 # Check that other is also None
                 if other.ordered_placeholders is None:
-
                     # Check mission string is the same
                     mission = self.mission_func()
                     other_mission = other.mission_func()

+ 0 - 1
minigrid/envs/babyai/other.py

@@ -160,7 +160,6 @@ class FindObjS5(RoomGridLevel):
     """
 
     def __init__(self, room_size=5, max_steps: int | None = None, **kwargs):
-
         if max_steps is None:
             max_steps = 20 * room_size**2
 

+ 0 - 1
minigrid/envs/fourrooms.py

@@ -91,7 +91,6 @@ class FourRoomsEnv(MiniGridEnv):
 
         # For each row of rooms
         for j in range(0, 2):
-
             # For each column
             for i in range(0, 2):
                 xL = i * room_w

+ 0 - 1
minigrid/envs/gotoobject.py

@@ -64,7 +64,6 @@ class GoToObjectEnv(MiniGridEnv):
     """
 
     def __init__(self, size=6, numObjs=2, max_steps: int | None = None, **kwargs):
-
         self.numObjs = numObjs
         self.size = size
         # Types of objects to be generated

+ 0 - 2
minigrid/envs/multiroom.py

@@ -145,7 +145,6 @@ class MultiRoomEnv(MiniGridEnv):
 
         # For each room
         for idx, room in enumerate(roomList):
-
             topX, topY = room.top
             sizeX, sizeY = room.size
 
@@ -242,7 +241,6 @@ class MultiRoomEnv(MiniGridEnv):
 
         # Try placing the next room
         for i in range(0, 8):
-
             # Pick which wall to place the out door on
             wallSet = {0, 1, 2, 3}
             wallSet.remove(entryDoorWall)

+ 0 - 1
minigrid/envs/playground.py

@@ -43,7 +43,6 @@ class PlaygroundEnv(MiniGridEnv):
 
         # For each row of rooms
         for j in range(0, 3):
-
             # For each column
             for i in range(0, 3):
                 xL = i * roomW

+ 0 - 7
minigrid/envs/wfc/graphtransforms.py

@@ -51,7 +51,6 @@ class GraphTransforms:
 
     @staticmethod
     def minigrid_to_bitmap(grids):
-
         layout = grids[..., 0]
         bitmap = np.zeros_like(layout)
         bitmap[layout == 2] = 1
@@ -97,7 +96,6 @@ class GraphTransforms:
     def minigrid_layout_to_dense_graph(
         layouts: np.ndarray, remove_border=True, node_attr=None, edge_config=None
     ) -> tuple[list[nx.Graph], dict[str, list[nx.Graph]]]:
-
         assert (
             layouts.ndim == 3
         ), f"Wrong dimensions for minigrid layout, expected 3 dimensions, got {layouts.ndim}."
@@ -165,7 +163,6 @@ class GraphTransforms:
         dim_grid: tuple,
         edge_config: dict[str, EdgeDescriptor] = None,
     ) -> tuple[list[nx.Graph], dict[str, list[nx.Graph]]]:
-
         graphs = []
         edge_graphs = defaultdict(list)
         for m in range(features[list(features.keys())[0]].shape[0]):
@@ -191,7 +188,6 @@ class GraphTransforms:
     def graph_features_to_minigrid(
         graph_features: dict[str, np.ndarray], shape: tuple[int, int], padding=1
     ) -> np.ndarray:
-
         features = graph_features.copy()
         node_attributes = list(features.keys())
 
@@ -285,7 +281,6 @@ class GraphTransforms:
     def get_node_features(
         graph: nx.Graph, pattern_shape, node_attributes: list[str] = None, reshape=True
     ) -> tuple[np.ndarray, list[str]]:
-
         if node_attributes is None:
             # Get node attributes from some node
             node_attributes = list(next(iter(graph.nodes.data()))[1].keys())
@@ -313,7 +308,6 @@ class GraphTransforms:
     def dense_graph_to_minigrid(
         graph: nx.Graph, shape: tuple[int, int], padding=1
     ) -> np.ndarray:
-
         pattern_shape = (shape[0] - 2 * padding, shape[1] - 2 * padding)
         features, node_attributes = GraphTransforms.get_node_features(
             graph, pattern_shape, node_attributes=None
@@ -340,7 +334,6 @@ class GraphTransforms:
         node_attr: list[str],
         dim_grid: tuple[int, int],
     ) -> dict[str, nx.Graph]:
-
         navigable_nodes = ["empty", "start", "goal", "moss"]
         non_navigable_nodes = ["wall", "lava"]
         assert all([isinstance(n, tuple) for n in graph.nodes])

+ 0 - 1
tests/test_envs.py

@@ -260,7 +260,6 @@ def test_interactive_mode(env_id):
 
 
 def test_mission_space():
-
     # Test placeholders
     mission_space = MissionSpace(
         mission_func=lambda color, obj_type: f"Get the {color} {obj_type}.",

+ 1 - 1
tests/utils.py

@@ -38,7 +38,7 @@ def assert_equals(a, b, prefix=None):
         b: second data structure
         prefix: prefix for failed assertion message for types and dicts
     """
-    assert type(a) == type(b), f"{prefix}Differing types: {a} and {b}"
+    assert type(a) is type(b), f"{prefix}Differing types: {a} and {b}"
     if isinstance(a, dict):
         assert list(a.keys()) == list(b.keys()), f"{prefix}Key sets differ: {a} and {b}"