Skip to content

Commit

Permalink
Fix pylint errors + remove YAML dependency (#239)
Browse files Browse the repository at this point in the history
* Fix pylint errors

* Remove ruamel YAML dependency
  • Loading branch information
Pbatch authored Sep 16, 2024
1 parent a6b86f8 commit e6430b3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ disable=raw-checker-failed,
R0903, # too-few-public-methods
R0913, # too-many-arguments
R0914, # too-many-locals
R0915, # too-many-statements
W0718, # broad-exception-caught

# Enable the message, report, category or checker with the given id(s). You can
Expand Down
12 changes: 10 additions & 2 deletions clashroyalebuildabot/gui/gameplay_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ def __init__(self):
"The visualizer is disabled. Enable it in the Settings tab."
)
self.inactiveIndicator.setStyleSheet(
"background-color: #FFA500; color: white; padding: 5px; height: fit-content; width: fit-content;"
" ".join(
[
"background-color: #FFA500;",
"color: white;",
"padding: 5px;",
"height: fit-content;",
"width: fit-content;",
]
)
)
self.inactiveIndicator.setMaximumHeight(30)
layout = QVBoxLayout()
Expand All @@ -24,7 +32,7 @@ def __init__(self):
self.setLayout(layout)

def update_frame(self, annotated_image):
height, width, channel = annotated_image.shape
height, width, _ = annotated_image.shape
bytes_per_line = 3 * width
q_image = QImage(
annotated_image.data.tobytes(),
Expand Down
5 changes: 2 additions & 3 deletions clashroyalebuildabot/gui/layout_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ def setup_top_bar(main_window):
)
text_layout.addWidget(server_name)

server_details = QLabel(
'<a href="https://github.com/Pbatch/ClashRoyaleBuildABot">https://github.com/Pbatch/ClashRoyaleBuildABot</a>'
)
url = "https://github.com/Pbatch/ClashRoyaleBuildABot"
server_details = QLabel(f'<a href="{url}">{url}</a>')
server_details.setOpenExternalLinks(True)
server_details.setStyleSheet("color: #57A6FF;")
text_layout.addWidget(server_details)
Expand Down
8 changes: 4 additions & 4 deletions clashroyalebuildabot/gui/utils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import os

from loguru import logger
from ruamel.yaml import YAML
import yaml

from clashroyalebuildabot.constants import SRC_DIR

yaml = YAML()


def load_config():
config = None
try:
config_path = os.path.join(SRC_DIR, "config.yaml")
with open(config_path, encoding="utf-8") as file:
return yaml.load(file)
config = yaml.safe_load(file)
except Exception as e:
logger.error(f"Can't parse config, stacktrace: {e}")
return config


def save_config(config):
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ dependencies = [
"scipy>=1.13.1",
"rich>=13.7.1",
"loguru>=0.7.2",
"PyYAML",
"PyYAML>=6.0.1",
"pybind11>=2.12",
"requests>=2.25.1",
"PyQt6>=6.7.1",
"av",
"tqdm",
"opencv-python==4.10.0.84",
Expand All @@ -31,8 +32,7 @@ dependencies = [
"flake8==7.0.0",
"isort==5.13.2",
"pylint==3.1.0",
"ruamel.yaml>=0.18.6",
"PyQt6>=6.7.1"

]
[project.optional-dependencies]
cpu = [
Expand Down

0 comments on commit e6430b3

Please sign in to comment.