draftomen 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. draftomen/__init__.py +17 -0
  2. draftomen/assets/draftomen.icns +0 -0
  3. draftomen/assets/draftomen.ico +0 -0
  4. draftomen/assets/draftomen_logo.png +0 -0
  5. draftomen/audit.py +606 -0
  6. draftomen/backtest.py +449 -0
  7. draftomen/benchmark.py +834 -0
  8. draftomen/carddb.py +1869 -0
  9. draftomen/cardimages.py +313 -0
  10. draftomen/cli.py +891 -0
  11. draftomen/config.py +133 -0
  12. draftomen/deckbuilder.py +2723 -0
  13. draftomen/events.py +772 -0
  14. draftomen/logfollow.py +451 -0
  15. draftomen/mock_session.py +745 -0
  16. draftomen/paths.py +120 -0
  17. draftomen/pickengine.py +1117 -0
  18. draftomen/pool.py +1259 -0
  19. draftomen/preferences.py +289 -0
  20. draftomen/qml/AboutDialog.qml +156 -0
  21. draftomen/qml/AppBar.qml +120 -0
  22. draftomen/qml/BacktestView.qml +316 -0
  23. draftomen/qml/BuildView.qml +1151 -0
  24. draftomen/qml/CardPreview.qml +434 -0
  25. draftomen/qml/DimensionalButton.qml +42 -0
  26. draftomen/qml/DimensionalComboBox.qml +182 -0
  27. draftomen/qml/DimensionalSurface.qml +118 -0
  28. draftomen/qml/DimensionalTabButton.qml +41 -0
  29. draftomen/qml/LiveDraftView.qml +468 -0
  30. draftomen/qml/Main.qml +175 -0
  31. draftomen/qml/NavigationRail.qml +226 -0
  32. draftomen/qml/PoolSummaryPanel.qml +322 -0
  33. draftomen/qml/PrivacyDialog.qml +96 -0
  34. draftomen/qml/RecentPickThumbnail.qml +83 -0
  35. draftomen/qml/RecentPicksGallery.qml +333 -0
  36. draftomen/qml/RecommendationRow.qml +404 -0
  37. draftomen/qml/SettingsSwitch.qml +141 -0
  38. draftomen/qml/SettingsView.qml +531 -0
  39. draftomen/qml/StateBanner.qml +189 -0
  40. draftomen/qml/StatusStrip.qml +84 -0
  41. draftomen/qml/Theme.qml +71 -0
  42. draftomen/qml/qmldir +23 -0
  43. draftomen/qt_adapter.py +884 -0
  44. draftomen/qt_gui.py +338 -0
  45. draftomen/qt_mock.py +63 -0
  46. draftomen/ranking.py +126 -0
  47. draftomen/replay.py +480 -0
  48. draftomen/session.py +3668 -0
  49. draftomen/setinfo.py +26 -0
  50. draftomen/seventeen.py +2766 -0
  51. draftomen/splash.py +617 -0
  52. draftomen/tui.py +4007 -0
  53. draftomen/watch.py +336 -0
  54. draftomen-0.3.0.dist-info/METADATA +156 -0
  55. draftomen-0.3.0.dist-info/RECORD +59 -0
  56. draftomen-0.3.0.dist-info/WHEEL +5 -0
  57. draftomen-0.3.0.dist-info/entry_points.txt +6 -0
  58. draftomen-0.3.0.dist-info/licenses/LICENSE +21 -0
  59. draftomen-0.3.0.dist-info/top_level.txt +1 -0
draftomen/paths.py ADDED
@@ -0,0 +1,120 @@
1
+ """Path resolution for Draftomen.
2
+ Keep OS-specific Player.log defaults isolated from the rest of the package.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import platform
8
+ from os import PathLike
9
+ from pathlib import Path, PureWindowsPath
10
+ from typing import TypeAlias
11
+
12
+ PathInput: TypeAlias = str | PathLike[str]
13
+ ResolvedPath: TypeAlias = Path | PureWindowsPath
14
+
15
+ MACOS_PLAYER_LOG_RELATIVE_PATH = Path(
16
+ "Library",
17
+ "Logs",
18
+ "Wizards Of The Coast",
19
+ "MTGA",
20
+ "Player.log",
21
+ )
22
+ WINDOWS_PLAYER_LOG_RELATIVE_PATH = PureWindowsPath(
23
+ "AppData",
24
+ "LocalLow",
25
+ "Wizards Of The Coast",
26
+ "MTGA",
27
+ "Player.log",
28
+ )
29
+ APP_DATA_DIRECTORY_NAME = ".draftomen"
30
+
31
+
32
+ class UnsupportedPlatformError(RuntimeError):
33
+ """Raised when no default Player.log path exists for the OS.
34
+ Pass an explicit path to support unsupported environments.
35
+ """
36
+
37
+
38
+ def app_data_dir(
39
+ home: PathInput | None = None,
40
+ *,
41
+ system: str | None = None,
42
+ ) -> ResolvedPath:
43
+ """Return Draftomen's per-user app data directory.
44
+ The directory lives under the current OS user's home path.
45
+ """
46
+
47
+ current_system = platform.system() if system is None else system
48
+ if current_system == "Windows":
49
+ return _windows_home(home=home) / APP_DATA_DIRECTORY_NAME
50
+
51
+ return _posix_home(home=home) / APP_DATA_DIRECTORY_NAME
52
+
53
+
54
+ def default_player_log_path(
55
+ *,
56
+ home: PathInput | None = None,
57
+ system: str | None = None,
58
+ ) -> ResolvedPath:
59
+ """Return the default MTG Arena Player.log path for the OS.
60
+ macOS is primary, Windows is best-effort, and other OSes require override.
61
+ """
62
+
63
+ current_system = platform.system() if system is None else system
64
+ if current_system == "Darwin":
65
+ return _posix_home(home=home) / MACOS_PLAYER_LOG_RELATIVE_PATH
66
+
67
+ if current_system == "Windows":
68
+ return _windows_home(home=home) / WINDOWS_PLAYER_LOG_RELATIVE_PATH
69
+
70
+ raise UnsupportedPlatformError(
71
+ "No default MTG Arena Player.log path is known for "
72
+ f"{current_system}. Pass --log-path to use an explicit file."
73
+ )
74
+
75
+
76
+ def resolve_player_log_path(
77
+ log_path: PathInput | None = None,
78
+ *,
79
+ home: PathInput | None = None,
80
+ system: str | None = None,
81
+ ) -> ResolvedPath:
82
+ """Resolve Player.log, honoring an explicit override first.
83
+ Without an override, return the platform default for the current user.
84
+ """
85
+
86
+ current_system = platform.system() if system is None else system
87
+ if log_path is not None:
88
+ if current_system == "Windows":
89
+ return PureWindowsPath(log_path)
90
+
91
+ return Path(log_path).expanduser()
92
+
93
+ return default_player_log_path(home=home, system=current_system)
94
+
95
+
96
+ def resolve_log_path(
97
+ log_path: PathInput | None = None,
98
+ *,
99
+ home: PathInput | None = None,
100
+ system: str | None = None,
101
+ ) -> ResolvedPath:
102
+ """Compatibility wrapper for Player.log resolution.
103
+ Prefer resolve_player_log_path in new code.
104
+ """
105
+
106
+ return resolve_player_log_path(log_path=log_path, home=home, system=system)
107
+
108
+
109
+ def _posix_home(home: PathInput | None = None) -> Path:
110
+ if home is None:
111
+ return Path.home()
112
+
113
+ return Path(home).expanduser()
114
+
115
+
116
+ def _windows_home(home: PathInput | None = None) -> PureWindowsPath:
117
+ if home is None:
118
+ return PureWindowsPath(Path.home())
119
+
120
+ return PureWindowsPath(home)