Skip to content

Commit

Permalink
Python 3.13 (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisoro authored Jan 20, 2025
1 parent 19b4638 commit 9d7e626
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: "pip"

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.9.2
hooks:
- id: ruff
args: [--fix]
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/imageproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_pc_info():
result[key]["current_clock_speed"] = cpu.CurrentClockSpeed
result[key]["max_clock_speed"] = cpu.MaxClockSpeed
LOGGER.info(
f"CPU: Name: {result[key]["name"]}, Cores: {result[key]["cores"]}, Threads: {result[key]["threads"]}, Current Clock Speed: {result[key]["current_clock_speed"]}, Max Clock Speed: {result[key]["max_clock_speed"]}"
f"CPU: Name: {result[key]['name']}, Cores: {result[key]['cores']}, Threads: {result[key]['threads']}, Current Clock Speed: {result[key]['current_clock_speed']}, Max Clock Speed: {result[key]['max_clock_speed']}"
)
i += 1 # noqa SIM113
except Exception:
Expand All @@ -102,7 +102,7 @@ def get_pc_info():
result[key] = {}
result[key]["name"] = gpu.Name.strip()
result[key]["vram"] = max(gpu.AdapterRAM / 1024**3, 0) if gpu.AdapterRAM is not None else 0
LOGGER.info(f"GPU: Name: {result[key]["name"]}, VRAM: {result[key]["vram"]} GB")
LOGGER.info(f"GPU: Name: {result[key]['name']}, VRAM: {result[key]['vram']} GB")
i += 1
except Exception:
pass
Expand All @@ -118,7 +118,7 @@ def get_pc_info():
result[key]["speed"] = memory.Speed
result[key]["capacity"] = int(memory.Capacity) / 1024**3 if memory.Capacity is not None else 0
LOGGER.info(
f"RAM: Manufacturer: {result[key]["manufacturer"]}, Speed: {result[key]["speed"]}, Capacity: {result[key]["capacity"]} GB"
f"RAM: Manufacturer: {result[key]['manufacturer']}, Speed: {result[key]['speed']}, Capacity: {result[key]['capacity']} GB"
)
i += 1
except Exception:
Expand All @@ -133,7 +133,7 @@ def get_pc_info():
result[key] = {}
result[key]["model"] = disk_drive.Model.strip()
result[key]["size"] = int(disk_drive.Size) / 1024**3 if disk_drive.Size is not None else 0
LOGGER.info(f"Drive: Model: {result[key]["model"]}, Size: {result[key]["size"]} GB")
LOGGER.info(f"Drive: Model: {result[key]['model']}, Size: {result[key]['size']} GB")
i += 1
except Exception:
pass
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.12
- python=3.13
- pip
- pip:
- -r requirements.txt
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.ruff]
indent-width = 4
line-length = 140
target-version = "py312"
target-version = "py313"


[tool.ruff.format]
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./dependencies/tesserocr-2.7.0-cp312-cp312-win_amd64.whl
./dependencies/tesserocr-2.7.1-cp313-cp313-win_amd64.whl
beautifultable
colorama
coverage
Expand All @@ -9,8 +9,8 @@ lxml
mouse
mss
natsort
numpy<2
opencv-python==4.10.0.82
numpy
opencv-python==4.11.0.86
Pillow
pre-commit
psutil
Expand All @@ -28,7 +28,7 @@ pytweening
pywin32
pyyaml
rapidfuzz
ruamel.yaml==0.18.6
ruamel.yaml~=0.18.0
ruff
selenium
seleniumbase
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

TP = concurrent.futures.ThreadPoolExecutor()

__version__ = "5.8.10"
__version__ = "5.8.11"
2 changes: 1 addition & 1 deletion src/gui/importer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def save_as_profile(file_name: str, profile: ProfileModel, url: str):
save_path.parent.mkdir(parents=True, exist_ok=True)
with open(save_path, "w", encoding="utf-8") as file:
file.write(f"# {url}\n")
file.write(f"# {datetime.datetime.now(tz=datetime.UTC).strftime("%Y-%m-%d %H:%M:%S")} (v{__version__})\n")
file.write(f"# {datetime.datetime.now(tz=datetime.UTC).strftime('%Y-%m-%d %H:%M:%S')} (v{__version__})\n")
file.write(
_to_yaml_str(
profile,
Expand Down
2 changes: 1 addition & 1 deletion src/gui/importer/d4builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def import_d4builds(url: str, driver: ChromiumDriver = None):
finished_filters.append({filter_name: item_filter})
profile = ProfileModel(name="imported profile", Affixes=sorted(finished_filters, key=lambda x: next(iter(x))), Uniques=unique_filters)
save_as_profile(
file_name=f"d4build_{class_name}_{datetime.datetime.now(tz=datetime.UTC).strftime("%Y_%m_%d_%H_%M_%S")}", profile=profile, url=url
file_name=f"d4build_{class_name}_{datetime.datetime.now(tz=datetime.UTC).strftime('%Y_%m_%d_%H_%M_%S')}", profile=profile, url=url
)
LOGGER.info("Finished")

Expand Down
4 changes: 2 additions & 2 deletions src/gui/importer/diablo_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ def import_diablo_trade(url: str, max_listings: int, driver: seleniumbase.Driver
except Exception as exc:
LOGGER.exception(msg := "Failed to validate profile. Dumping data for debugging.")
with open(
IniConfigLoader().user_dir / f"diablo_trade_dump_{datetime.datetime.now(tz=datetime.UTC).strftime("%Y_%m_%d_%H_%M_%S")}.json",
IniConfigLoader().user_dir / f"diablo_trade_dump_{datetime.datetime.now(tz=datetime.UTC).strftime('%Y_%m_%d_%H_%M_%S')}.json",
"w",
) as f:
json.dump(all_listings, f, indent=4, sort_keys=True)
raise DiabloTradeException(msg) from exc

LOGGER.info(f"Saving profile with {len(profile.Affixes)} filters")
save_as_profile(
file_name=f"diablo_trade_{datetime.datetime.now(tz=datetime.UTC).strftime("%Y_%m_%d_%H_%M_%S")}", profile=profile, url=url
file_name=f"diablo_trade_{datetime.datetime.now(tz=datetime.UTC).strftime('%Y_%m_%d_%H_%M_%S')}", profile=profile, url=url
)
LOGGER.info("Finished")

Expand Down
4 changes: 2 additions & 2 deletions src/gui/importer/maxroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def import_maxroll(url: str):
if not build_name:
build_name = all_data["class"]
if active_profile["name"]:
build_name += f"_{active_profile["name"]}"
build_name += f"_{active_profile['name']}"
save_as_profile(file_name=build_name, profile=profile, url=url)
LOGGER.info("Finished")

Expand Down Expand Up @@ -149,7 +149,7 @@ def _find_item_affixes(mapping_data: dict, item_affixes: dict) -> list[Affix]:
attr_param = affix["attributes"][0]["param"]
for skill_data in mapping_data["skills"].values():
if skill_data["id"] == attr_param:
attr_desc = f"to {skill_data["name"]}"
attr_desc = f"to {skill_data['name']}"
break
else:
if affix["attributes"][0]["param"] == -1460542966 and affix["attributes"][0]["id"] == 1033:
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qt_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def on_worker_finished():
"https://diablo.trade/listings/items?exactPrice=true&itemType=equipment&price=50000000,999999999999&rarity=legendary&sold=true&sort=newest\n\n"
"Please note that only legendary items are supported at the moment. The listing must also have an exact price.\n"
"You can create such a filter by using the one above as a base and then add your custom data to it.\n"
f"It will then create a file based on the listings in: {IniConfigLoader().user_dir / "profiles"}"
f"It will then create a file based on the listings in: {IniConfigLoader().user_dir / 'profiles'}"
)
instructions_text.setReadOnly(True)
font_metrics = instructions_text.fontMetrics()
Expand Down Expand Up @@ -237,7 +237,7 @@ def on_worker_finished():
"https://d4builds.gg/builds/ef414fbd-81cd-49d1-9c8d-4938b278e2ee\n"
"or\n"
"https://mobalytics.gg/diablo-4/builds/barbarian/bash\n\n"
f"It will create a file based on the label of the build in the planer in: {IniConfigLoader().user_dir / "profiles"}\n\n"
f"It will create a file based on the label of the build in the planer in: {IniConfigLoader().user_dir / 'profiles'}\n\n"
"For d4builds you need to specify your browser in the params.ini file"
)
instructions_text.setReadOnly(True)
Expand Down
2 changes: 1 addition & 1 deletion src/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def setup(log_level: str = "DEBUG") -> None:
threading.excepthook = _log_unhandled_exceptions
# create rotating file handler
rotating_handler = logging.handlers.RotatingFileHandler(
LOG_DIR / f"log_{datetime.datetime.now(tz=datetime.UTC).strftime("%Y_%m_%d_%H_%M_%S")}.txt",
LOG_DIR / f"log_{datetime.datetime.now(tz=datetime.UTC).strftime('%Y_%m_%d_%H_%M_%S')}.txt",
mode="w",
maxBytes=10 * 1024**2,
backupCount=1000,
Expand Down
2 changes: 1 addition & 1 deletion src/loot_mover.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def move_items_to_inventory():
unhandled_slots, _ = chest.get_item_slots()

LOGGER.debug(
f"Stash tab {i} - Number of stash items: {len(unhandled_slots)} - Number of empty inventory " f"spaces: {empty_slot_count}"
f"Stash tab {i} - Number of stash items: {len(unhandled_slots)} - Number of empty inventory spaces: {empty_slot_count}"
)

item_move_count, _ = _move_items(inv, unhandled_slots, empty_slot_count, move_item_type)
Expand Down
1 change: 1 addition & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import tesserocr # noqa # Note: Somehow needed, otherwise the binary has an issue with tesserocr
import logging
import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion src/template_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _process_cv_result(template: Template, img: np.ndarray) -> bool:
if not suppress_debug and len(matches) > 1 and mode == "all":
LOGGER.debug(
"Found the following matches:\n"
+ ", ".join([f" {template_match.name} ({template_match.score*100:.1f}% confidence)" for template_match in matches])
+ ", ".join([f" {template_match.name} ({template_match.score * 100:.1f}% confidence)" for template_match in matches])
)
elif not suppress_debug:
LOGGER.debug(f"Could not find desired templates: {ref}")
Expand Down

0 comments on commit 9d7e626

Please sign in to comment.