spells-mtg 0.11.7__tar.gz → 0.11.8__tar.gz

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.

Potentially problematic release.


This version of spells-mtg might be problematic. Click here for more details.

Files changed (25) hide show
  1. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/PKG-INFO +1 -1
  2. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/pyproject.toml +1 -1
  3. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/card_data_files.py +21 -4
  4. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/draft_data.py +16 -11
  5. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/LICENSE +0 -0
  6. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/README.md +0 -0
  7. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/.ruff_cache/.gitignore +0 -0
  8. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/.ruff_cache/0.8.6/17785301476771359756 +0 -0
  9. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/.ruff_cache/CACHEDIR.TAG +0 -0
  10. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/__init__.py +0 -0
  11. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/cache.py +0 -0
  12. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/cards.py +0 -0
  13. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/columns.py +0 -0
  14. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/config.py +0 -0
  15. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/enums.py +0 -0
  16. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/extension.py +0 -0
  17. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/external.py +0 -0
  18. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/filter.py +0 -0
  19. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/log.py +0 -0
  20. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/manifest.py +0 -0
  21. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/schema.py +0 -0
  22. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/spells/utils.py +0 -0
  23. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/tests/__init__.py +0 -0
  24. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/tests/filter_test.py +0 -0
  25. {spells_mtg-0.11.7 → spells_mtg-0.11.8}/tests/utils_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.11.7
3
+ Version: 0.11.8
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -11,7 +11,7 @@ dependencies = [
11
11
  ]
12
12
  requires-python = ">=3.11"
13
13
  readme = "README.md"
14
- version = "0.11.7"
14
+ version = "0.11.8"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -18,6 +18,13 @@ DECK_COLOR_DATA_TEMPLATE = (
18
18
  "{user_group_param}&start_date={start_date_str}&end_date={end_date_str}&combine_splash=true"
19
19
  )
20
20
 
21
+ START_DATE_MAP = {
22
+ "DFT": dt.date(2025, 2, 11),
23
+ "TDM": dt.date(2025, 4, 8),
24
+ "FIN": dt.date(2025, 6, 10),
25
+ "EOE": dt.date(2025, 7, 29),
26
+ }
27
+
21
28
  ratings_col_defs = {
22
29
  ColName.NAME: pl.col("name").cast(pl.String),
23
30
  ColName.COLOR: pl.col("color").cast(pl.String),
@@ -53,11 +60,16 @@ deck_color_col_defs = {
53
60
 
54
61
  def deck_color_df(
55
62
  set_code: str,
56
- start_date: dt.date,
57
- end_date: dt.date,
58
63
  format: str = "PremierDraft",
59
64
  player_cohort: str = "all",
65
+ start_date: dt.date | None = None,
66
+ end_date: dt.date | None = None,
60
67
  ):
68
+ if start_date is None:
69
+ start_date = START_DATE_MAP[set_code]
70
+ if end_date is None:
71
+ end_date = dt.date.today() - dt.timedelta(days=1)
72
+
61
73
  target_dir, filename = cache.deck_color_file_path(
62
74
  set_code,
63
75
  format,
@@ -109,12 +121,17 @@ def deck_color_df(
109
121
 
110
122
  def base_ratings_df(
111
123
  set_code: str,
112
- start_date: dt.date,
113
- end_date: dt.date,
114
124
  format: str = "PremierDraft",
115
125
  player_cohort: str = "all",
116
126
  deck_colors: str | list[str] = "any",
127
+ start_date: dt.date | None = None,
128
+ end_date: dt.date | None = None,
117
129
  ) -> pl.DataFrame:
130
+ if start_date is None:
131
+ start_date = START_DATE_MAP[set_code]
132
+ if end_date is None:
133
+ end_date = dt.date.today() - dt.timedelta(days=1)
134
+
118
135
  if isinstance(deck_colors, str):
119
136
  deck_colors = [deck_colors]
120
137
 
@@ -49,20 +49,25 @@ def _cache_key(args) -> str:
49
49
  @functools.lru_cache(maxsize=None)
50
50
  def get_names(set_code: str) -> list[str]:
51
51
  card_fp = cache.data_file_path(set_code, View.CARD)
52
- card_view = pl.read_parquet(card_fp)
53
- card_names_set = frozenset(card_view.get_column("name").to_list())
52
+ try:
53
+ card_view = pl.read_parquet(card_fp)
54
+ card_names_set = frozenset(card_view.get_column("name").to_list())
54
55
 
55
- draft_fp = cache.data_file_path(set_code, View.DRAFT)
56
- draft_view = pl.scan_parquet(draft_fp)
57
- cols = draft_view.collect_schema().names()
56
+ draft_fp = cache.data_file_path(set_code, View.DRAFT)
57
+ draft_view = pl.scan_parquet(draft_fp)
58
+ cols = draft_view.collect_schema().names()
58
59
 
59
- prefix = "pack_card_"
60
- names = [col[len(prefix) :] for col in cols if col.startswith(prefix)]
61
- draft_names_set = frozenset(names)
60
+ prefix = "pack_card_"
61
+ names = [col[len(prefix) :] for col in cols if col.startswith(prefix)]
62
+ draft_names_set = frozenset(names)
63
+
64
+ assert (
65
+ draft_names_set == card_names_set
66
+ ), "names mismatch between card and draft file"
67
+ except FileNotFoundError:
68
+ ratings_data = base_ratings_df(set_code)
69
+ names = list(ratings_data['name'])
62
70
 
63
- assert (
64
- draft_names_set == card_names_set
65
- ), "names mismatch between card and draft file"
66
71
  return names
67
72
 
68
73
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes