Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmartinx committed Jun 9, 2024
1 parent d54e20c commit c14b812
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 9 additions & 7 deletions modules/decision/search_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from .. import decision_command
from .. import odometry_and_time

# Class requires more than the default 7 allowed instance attributes
# pylint: disable=too-many-instance-attributes


class Corner(Enum):
"""
Expand Down Expand Up @@ -114,12 +117,11 @@ def __get_next_corner(self, corner: Corner) -> Corner:
"""
if corner == Corner.TOP_LEFT:
return Corner.TOP_RIGHT
elif corner == Corner.TOP_RIGHT:
if corner == Corner.TOP_RIGHT:
return Corner.BOTTOM_RIGHT
elif corner == Corner.BOTTOM_RIGHT:
if corner == Corner.BOTTOM_RIGHT:
return Corner.BOTTOM_LEFT
else:
return Corner.TOP_LEFT
return Corner.TOP_LEFT

def __calculate_square_corners(self) -> None:
"""
Expand Down Expand Up @@ -170,9 +172,9 @@ def __calculate_side_of_square(self) -> None:
next_corner = self.__square_corners[self.__get_next_corner(self.__current_side_in_square)]

# Determine if the drone is moving horizontally or vertically along the current side
self.__moving_horizontally = (
self.__current_side_in_square == Corner.TOP_LEFT
or self.__current_side_in_square == Corner.BOTTOM_RIGHT
self.__moving_horizontally = self.__current_side_in_square in (
Corner.TOP_LEFT,
Corner.BOTTOM_RIGHT,
)

# Calculate the length of the current side based on the direction of movement
Expand Down
3 changes: 3 additions & 0 deletions tests/test_search_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
DISTANCE_SQUARED_THRESHOLD = 2.0
SMALL_ADJUSTMENT = 1

# Test functions use test fixture signature names and access class privates
# pylint: disable=redefined-outer-name


@pytest.fixture()
def search_pattern_width_greater_depth() -> Generator[search_pattern.SearchPattern, None, None]:
Expand Down

0 comments on commit c14b812

Please sign in to comment.