Skip to content

Commit d038007

Browse files
✏️ Fix linting and formatting
1 parent ebfa4a0 commit d038007

23 files changed

+22
-38
lines changed

.github/workflows/draft-pdf.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
journal: joss
1515
paper-path: paper.md
1616
- name: Upload
17-
uses: actions/upload-artifact@v5
17+
uses: actions/upload-artifact@v4
1818
with:
1919
name: paper
2020
path: paper.pdf

src/hcraft/behaviors/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
""" Module to define HEBGraphs for any HierarchyCraft environment. """
1+
"""Module to define HEBGraphs for any HierarchyCraft environment."""

src/hcraft/behaviors/actions.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module to define Action nodes for the HEBGraph of the HierarchyCraft environment. """
1+
"""Module to define Action nodes for the HEBGraph of the HierarchyCraft environment."""
22

33
from typing import TYPE_CHECKING
44

@@ -13,7 +13,6 @@
1313

1414

1515
class DoTransformation(Action):
16-
1716
"""Perform a transformation."""
1817

1918
def __init__(self, transformation: "Transformation", env: "HcraftEnv") -> None:

src/hcraft/behaviors/behaviors.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module for handcrafted Behavior with HEBGraph in any HierarchyCraft environment. """
1+
"""Module for handcrafted Behavior with HEBGraph in any HierarchyCraft environment."""
22

33
from typing import TYPE_CHECKING, Dict, List, Optional, Union
44

@@ -22,7 +22,6 @@
2222

2323

2424
class GetItem(Behavior):
25-
2625
"""Behavior for getting an item"""
2726

2827
def __init__(
@@ -59,7 +58,6 @@ def build_graph(self) -> HEBGraph:
5958

6059

6160
class DropItem(Behavior):
62-
6361
"""Behavior for dropping an item"""
6462

6563
def __init__(
@@ -96,7 +94,6 @@ def build_graph(self) -> HEBGraph:
9694

9795

9896
class PlaceItem(Behavior):
99-
10097
"""Behavior for getting an item in any of the given zones.
10198
10299
If no zones are given, places in any of the zones were the item can be placed.
@@ -199,7 +196,6 @@ def _item_is_in_stack(self, stacks: Optional[List["Stack"]]) -> bool:
199196

200197

201198
class ReachZone(Behavior):
202-
203199
"""Behavior for going into a zone"""
204200

205201
def __init__(
@@ -232,7 +228,6 @@ def build_graph(self) -> HEBGraph:
232228

233229

234230
class AbleAndPerformTransformation(Behavior):
235-
236231
"""Behavior for abling then performing any transformation."""
237232

238233
def __init__(

src/hcraft/behaviors/feature_conditions.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module to define FeatureCondition nodes for the HEBGraph of the HierarchyCraft environment. """
1+
"""Module to define FeatureCondition nodes for the HEBGraph of the HierarchyCraft environment."""
22

33
from typing import TYPE_CHECKING, Optional
44

@@ -14,7 +14,6 @@
1414

1515

1616
class HasStack(FeatureCondition):
17-
1817
"""FeatureCondition to check if player has an Item in a given quantity."""
1918

2019
def __init__(self, env: "HcraftEnv", stack: Stack) -> None:
@@ -37,7 +36,6 @@ def __call__(self, observation) -> int:
3736

3837

3938
class HasLessStack(FeatureCondition):
40-
4139
"""FeatureCondition to check if player has an Item in less than a given quantity."""
4240

4341
def __init__(self, env: "HcraftEnv", stack: Stack) -> None:
@@ -59,7 +57,6 @@ def __call__(self, observation) -> int:
5957

6058

6159
class IsInZone(FeatureCondition):
62-
6360
"""FeatureCondition to check if player is in a Zone."""
6461

6562
def __init__(self, env: "HcraftEnv", zone: Zone) -> None:
@@ -82,7 +79,6 @@ def __call__(self, observation) -> int:
8279

8380

8481
class HasZoneItem(FeatureCondition):
85-
8682
"""FeatureCondition to check if a Zone has the given property."""
8783

8884
def __init__(

src/hcraft/behaviors/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module for utility functions to apply on handcrafted Behavior. """
1+
"""Module for utility functions to apply on handcrafted Behavior."""
22

33
from typing import Dict, Set, Union
44

src/hcraft/examples/minecraft/env.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=arguments-differ, inconsistent-return-statements
22

3-
""" MineHcraft Environment
3+
"""MineHcraft Environment
44
55
HierarchyCraft environment adapted to the Minecraft inventory
66
@@ -32,7 +32,6 @@
3232

3333

3434
class MineHcraftEnv(HcraftEnv):
35-
3635
"""MineHcraft Environment: A minecraft-like HierarchyCraft Environment.
3736
3837
Default purpose is None (sandbox).

src/hcraft/examples/minecraft/items.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
""" Minecraft Items
1+
"""Minecraft Items
22
33
All used minecraft items.
44
They are three kinds of items: Loots and McItems that can be found,
55
and other items that can only be obtain through hcraft.
66
77
"""
8+
89
from dataclasses import dataclass
910
from typing import List, Optional, Union
1011

src/hcraft/examples/minecraft/tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Minecraft Tools
1+
"""Minecraft Tools
22
33
All used minecraft tools
44

src/hcraft/examples/minecraft/transformations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Minecraft Recipes
1+
"""Minecraft Recipes
22
33
All used Minecraft recipies.
44

src/hcraft/examples/minecraft/zones.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Minecraft Zones
1+
"""Minecraft Zones
22
33
Abstract zones to simulate simply a Minecraft environment.
44

src/hcraft/examples/random_simple/env.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=no-member
22

3-
""" Random HierarchyCraft Environment
3+
"""Random HierarchyCraft Environment
44
55
Generate a random HierarchyCraft environment using basic constructor rules.
66
@@ -18,7 +18,6 @@
1818

1919

2020
class RandomHcraftEnv(HcraftEnv):
21-
2221
"""Random HierarchyCraft Environment"""
2322

2423
def __init__(

src/hcraft/render/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
""" Render : Module for rendering HierarchyCraft environments. """
1+
"""Render : Module for rendering HierarchyCraft environments."""

src/hcraft/render/render.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=no-member
22

3-
""" Rendering of the HierarchyCraft environments """
3+
"""Rendering of the HierarchyCraft environments"""
44

55
import os
66
import sys

src/hcraft/render/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Utilitaries functions for rendering of the HierarchyCraft environments """
1+
"""Utilitaries functions for rendering of the HierarchyCraft environments"""
22

33
import logging
44
import os

src/hcraft/render/widgets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Widgets for rendering of the HierarchyCraft environments """
1+
"""Widgets for rendering of the HierarchyCraft environments"""
22

33
from enum import Enum
44
from typing import TYPE_CHECKING, Dict, List, Optional, Union

src/hcraft/solving_behaviors.py

-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
4141
"""
4242

43-
4443
from typing import TYPE_CHECKING, Dict
4544

4645
from hebg import Behavior
@@ -55,7 +54,6 @@
5554
from hcraft.requirements import RequirementNode, req_node_name
5655
from hcraft.task import GetItemTask, GoToZoneTask, PlaceItemTask, Task
5756

58-
from hebg.unrolling import unroll_graph
5957

6058
if TYPE_CHECKING:
6159
from hcraft.env import HcraftEnv

src/hcraft/task.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def build(self, world: "World"):
147147
else:
148148
zones_slots = np.array([world.slot_from_zone(self.zone)])
149149
zone_item_slot = world.zones_items.index(self.item_stack.item)
150-
self._terminate_zones_items[
151-
zones_slots, zone_item_slot
152-
] = self.item_stack.quantity
150+
self._terminate_zones_items[zones_slots, zone_item_slot] = (
151+
self.item_stack.quantity
152+
)
153153

154154
def _is_terminal(self, state: "HcraftState") -> bool:
155155
if self.zone is None:

src/hcraft/transformation.py

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@
138138
139139
"""
140140

141-
142141
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, Union, Any
143142
from enum import Enum
144143
from dataclasses import dataclass

tests/custom_checks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def check_np_equal(array: np.ndarray, expected_array: np.ndarray):
88
check.is_true(
99
np.all(array == expected_array),
10-
msg=f"Got:\n{array}\nExpected:\n{expected_array}\nDiff:{array-expected_array}",
10+
msg=f"Got:\n{array}\nExpected:\n{expected_array}\nDiff:{array - expected_array}",
1111
)
1212

1313

tests/examples/test_random.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import gymnasium
21
import pytest
32
import pytest_check as check
43

tests/examples/test_recursive.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import networkx as nx
2-
import pytest
32
import pytest_check as check
43
from hcraft.examples.light_recursive import LightRecursiveHcraftEnv
54

tests/planning/test_mineHcraft.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Module testing utils functions for hcraft behaviors. """
1+
"""Module testing utils functions for hcraft behaviors."""
22

33
from pathlib import Path
44
from typing import TYPE_CHECKING

0 commit comments

Comments
 (0)