Skip to content

Commit

Permalink
fixed pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rmicheev committed Jan 15, 2024
1 parent 3307a9e commit 2b79d54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/pygats/pygats.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TestException(Exception):
"""
Test exception class stores msg when error occurs
"""
def __init__(self, img, msg):
def __init__(self, msg):
self.message = msg


Expand Down Expand Up @@ -264,7 +264,6 @@ def failed(msg: Optional[str] = 'Тест не успешен'):
function generates exception while error occurs
Args:
img (PIL.Image, optional): image or screenshot
msg (Optional[str]): failed text
Raises:
Expand Down Expand Up @@ -336,7 +335,7 @@ def move_to(ctx: Context, img_path: str):
except pyautogui.ImageNotFoundException:
failed(msg='Изображение не найдено')
if center is None:
failed(img_path, 'Изображение не найдено')
failed('Изображение не найдено')
if sys.platform == 'darwin':
pyautogui.moveTo(center.x / 2, center.y / 2)
else:
Expand Down Expand Up @@ -393,19 +392,19 @@ def click(ctx: Context, button_path: str, area: Optional[str] = ''):
except pyautogui.ImageNotFoundException:
failed(msg='Изображение не найдено')
if area_location is None:
failed(area, fail_message)
failed(fail_message)
try:
box = pyautogui.locate(button_path, area, confidence=0.8)
except pyautogui.ImageNotFoundException:
failed(msg='Изображение не найдено')
if box is None:
failed(area, fail_message)
failed(fail_message)

x = area_location.left + box.left + box.width / 2
y = area_location.top + box.top + box.height / 2
center = pyautogui.Point(x, y)
if center is None:
failed(button_path, fail_message)
failed(fail_message)

print(f'Перемещаем указатель мыши в координаты {center}')
if sys.platform == 'darwin':
Expand Down
10 changes: 5 additions & 5 deletions src/pygats/recog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from typing import Optional
import pyautogui
import pytesseract
from Levenshtein import ratio
from PIL import Image
from pygats.pygats import step, passed, failed
import mss
import numpy as np
import cv2 as cv
from Levenshtein import ratio
from PIL import Image
from pygats.pygats import step, passed, failed


@dataclass
Expand Down Expand Up @@ -122,7 +122,7 @@ def check_text(ctx, img: Image, txt):
if not found:
_, found = find_text(img, txt, extend=True)
if not found:
failed(img, f'{txt.content} не найден на изображении')
failed(f'{txt.content} не найден на изображении')
passed()


Expand All @@ -142,7 +142,7 @@ def check_text_on_screen(ctx, txt):
if not found:
_, found = find_text(img, txt, extend=True)
if not found:
failed(img, f'{txt.content} не найден на экране')
failed(f'{txt.content} не найден на экране')
passed()


Expand Down

0 comments on commit 2b79d54

Please sign in to comment.