Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Deko committed Apr 19, 2024
1 parent b8c1c27 commit 0c0cb7d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
9 changes: 6 additions & 3 deletions alune/adb.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""
Module for all ADB (Android Debug Bridge) related methods.
"""

import os.path
import random

from adb_shell.adb_device_async import AdbDeviceTcpAsync
from adb_shell.auth.keygen import keygen
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
import cv2
from loguru import logger
import numpy
from numpy import ndarray
from loguru import logger

from alune.images import ClickButton
from alune.images import ImageButton
Expand All @@ -23,6 +24,7 @@ class ADB:
Class to hold the connection to an ADB connection via TCP.
USB connection is possible, but not supported at the moment.
"""

def __init__(self):
"""
Initiates base values for the ADB instance.
Expand Down Expand Up @@ -73,9 +75,10 @@ async def _connect_to_device(self, port: int = 5555):
except OSError:
self._device = None
logger.warning(f"Failed to connect to ADB session with device localhost:{port}")
# Silly hack to attempt to fall back on port 5556, in case the default port was in use when their adb session started
# Silly hack to attempt to fall back on port 5556,
# in case the default port was in use when their adb session started
if port == 5555:
await self._connect_to_device(self, port=(port + 1))
await self._connect_to_device(port + 1)

def is_connected(self) -> bool:
"""
Expand Down
13 changes: 8 additions & 5 deletions alune/helpers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from loguru import logger
"""
Collection of helper methods.
"""

import sys

def raise_and_exit(
error: str,
exit_code: int = 1
) -> None:
from loguru import logger


def raise_and_exit(error: str, exit_code: int = 1) -> None:
"""
Raise the given text as an error and then exit the application
Expand Down
1 change: 1 addition & 0 deletions alune/images.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module to handle anything related to images and buttons (images that result in a click) we use.
"""

from dataclasses import dataclass
from enum import auto
from enum import StrEnum
Expand Down
1 change: 1 addition & 0 deletions alune/screen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module for image recognition on the screen.
"""

from dataclasses import dataclass

import cv2
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from enum import auto
from enum import StrEnum
from random import Random
import sys

from adb_shell.exceptions import TcpTimeoutException
from loguru import logger
Expand All @@ -25,6 +24,7 @@ class GameState(StrEnum):
"""
State the game or app is in.
"""

LOADING = auto()
MAIN_MENU = auto()
CHOOSE_MODE = auto()
Expand Down

0 comments on commit 0c0cb7d

Please sign in to comment.