spells-mtg 0.11.5__py3-none-any.whl → 0.11.7__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.

Potentially problematic release.


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

spells/card_data_files.py CHANGED
@@ -18,12 +18,6 @@ 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
- }
26
-
27
21
  ratings_col_defs = {
28
22
  ColName.NAME: pl.col("name").cast(pl.String),
29
23
  ColName.COLOR: pl.col("color").cast(pl.String),
@@ -40,7 +34,8 @@ ratings_col_defs = {
40
34
  ColName.WON_OPENING_HAND: pl.col("opening_hand_game_count")
41
35
  * pl.col("opening_hand_win_rate").cast(pl.Float64),
42
36
  ColName.DRAWN: pl.col("drawn_game_count").cast(pl.Int64),
43
- ColName.WON_DRAWN: pl.col("drawn_win_rate") * pl.col("drawn_game_count").cast(pl.Float64),
37
+ ColName.WON_DRAWN: pl.col("drawn_win_rate")
38
+ * pl.col("drawn_game_count").cast(pl.Float64),
44
39
  ColName.NUM_GIH: pl.col("ever_drawn_game_count").cast(pl.Int64),
45
40
  ColName.NUM_GIH_WON: pl.col("ever_drawn_game_count")
46
41
  * pl.col("ever_drawn_win_rate").cast(pl.Float64),
@@ -58,16 +53,11 @@ deck_color_col_defs = {
58
53
 
59
54
  def deck_color_df(
60
55
  set_code: str,
56
+ start_date: dt.date,
57
+ end_date: dt.date,
61
58
  format: str = "PremierDraft",
62
59
  player_cohort: str = "all",
63
- start_date: dt.date | None = None,
64
- end_date: dt.date | None = None,
65
60
  ):
66
- if start_date is None:
67
- start_date = START_DATE_MAP[set_code]
68
- if end_date is None:
69
- end_date = dt.date.today() - dt.timedelta(days=1)
70
-
71
61
  target_dir, filename = cache.deck_color_file_path(
72
62
  set_code,
73
63
  format,
@@ -106,9 +96,9 @@ def deck_color_df(
106
96
  [
107
97
  pl.lit(set_code).alias(ColName.EXPANSION),
108
98
  pl.lit(format).alias(ColName.EVENT_TYPE),
109
- (pl.lit("Top") if player_cohort == "top" else pl.lit(None)).alias(
110
- ColName.PLAYER_COHORT
111
- ).cast(pl.String),
99
+ (pl.lit("Top") if player_cohort == "top" else pl.lit(None))
100
+ .alias(ColName.PLAYER_COHORT)
101
+ .cast(pl.String),
112
102
  *[val.alias(key) for key, val in deck_color_col_defs.items()],
113
103
  ]
114
104
  )
@@ -119,17 +109,12 @@ def deck_color_df(
119
109
 
120
110
  def base_ratings_df(
121
111
  set_code: str,
112
+ start_date: dt.date,
113
+ end_date: dt.date,
122
114
  format: str = "PremierDraft",
123
115
  player_cohort: str = "all",
124
116
  deck_colors: str | list[str] = "any",
125
- start_date: dt.date | None = None,
126
- end_date: dt.date | None = None,
127
117
  ) -> pl.DataFrame:
128
- if start_date is None:
129
- start_date = START_DATE_MAP[set_code]
130
- if end_date is None:
131
- end_date = dt.date.today() - dt.timedelta(days=1)
132
-
133
118
  if isinstance(deck_colors, str):
134
119
  deck_colors = [deck_colors]
135
120
 
@@ -171,20 +156,24 @@ def base_ratings_df(
171
156
  out=ratings_file_path,
172
157
  )
173
158
 
174
- concat_list.append(pl.read_json(ratings_file_path).with_columns(
175
- (pl.lit(deck_color) if deck_color != "any" else pl.lit(None)).alias(
176
- ColName.MAIN_COLORS
177
- ).cast(pl.String)
178
- ).select(
179
- [
180
- pl.lit(set_code).alias(ColName.EXPANSION),
181
- pl.lit(format).alias(ColName.EVENT_TYPE),
182
- (pl.lit("Top") if player_cohort == "top" else pl.lit(None)).alias(
183
- ColName.PLAYER_COHORT
184
- ).cast(pl.String),
185
- ColName.MAIN_COLORS,
186
- *[val.alias(key) for key, val in ratings_col_defs.items()],
187
- ]
188
- ))
159
+ concat_list.append(
160
+ pl.read_json(ratings_file_path, infer_schema_length=500)
161
+ .with_columns(
162
+ (pl.lit(deck_color) if deck_color != "any" else pl.lit(None))
163
+ .alias(ColName.MAIN_COLORS)
164
+ .cast(pl.String)
165
+ )
166
+ .select(
167
+ [
168
+ pl.lit(set_code).alias(ColName.EXPANSION),
169
+ pl.lit(format).alias(ColName.EVENT_TYPE),
170
+ (pl.lit("Top") if player_cohort == "top" else pl.lit(None))
171
+ .alias(ColName.PLAYER_COHORT)
172
+ .cast(pl.String),
173
+ ColName.MAIN_COLORS,
174
+ *[val.alias(key) for key, val in ratings_col_defs.items()],
175
+ ]
176
+ )
177
+ )
189
178
 
190
179
  return pl.concat(concat_list)
spells/config.py CHANGED
@@ -1,4 +1,5 @@
1
1
  all_sets = [
2
+ "FIN",
2
3
  "TDM",
3
4
  "DFT",
4
5
  "PIO",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.11.5
3
+ Version: 0.11.7
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -3,10 +3,10 @@ spells/.ruff_cache/0.8.6/17785301476771359756,sha256=gPYLG8psuOSo37IefLzTu5wgRrb
3
3
  spells/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
4
4
  spells/__init__.py,sha256=0pnh2NLn9FrNKncE9-tBsighp3e8YAsN--_ovUpgWGs,333
5
5
  spells/cache.py,sha256=6cl0q62erR3LCANPSfxG5-J7JQfLwNdWjzlBpfiL4IE,7174
6
- spells/card_data_files.py,sha256=mqPLJD-wBx_4rn-jyVoa2i-f8-uwyM6R7JACvBVu3Gg,6404
6
+ spells/card_data_files.py,sha256=uEYVmyqIrMwVKTX2HAr8rEZi3WpW3uPzv_6TcZzPQDQ,6036
7
7
  spells/cards.py,sha256=6stFPhJOzHqvQnkSv9cDeylRa_7L9Y8sOaowiZhzz6I,4174
8
8
  spells/columns.py,sha256=s_PYyg2QaRL6kLWFNKCBEfbMF0x7O7-Yd9SeG1ttYL4,18206
9
- spells/config.py,sha256=zpRUZ-6JKALE149L0yfeD1AgqKPaVBGHfD_TdHi-jqE,235
9
+ spells/config.py,sha256=CVE2O-ZPgthbSqAB7Pul2yeFcyLHpL52OiXH7s9yl48,246
10
10
  spells/draft_data.py,sha256=EC7TCAlrWWhDFQtGx6ie-SBTNvdsoPNef7oZ0w9TSW0,21012
11
11
  spells/enums.py,sha256=gbwfon6tQCoKDb-m4hSaHWi9slj82yqaH3qhYMVrsck,4991
12
12
  spells/extension.py,sha256=LBqGbJbe7iSRQkxJK7npkADCfzhdnIwwVvlmTn8xvjQ,8454
@@ -16,8 +16,8 @@ spells/log.py,sha256=3avmg65hru8K9npKLvPp1wWWxq-hoEYDUCbxqhPkKUw,2175
16
16
  spells/manifest.py,sha256=ExWVk17BRw615UmvrV817xwz457yfTNdNMNE_M00aEg,8338
17
17
  spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
18
18
  spells/utils.py,sha256=IO3brrXVvZla0LRTEB5v6NgGqZb_rYA46XtKBURGMNk,1944
19
- spells_mtg-0.11.5.dist-info/METADATA,sha256=A-aXPXsZKoJHsDzge8xRtvskSzBx_aepgiE7L6-Zqyw,47369
20
- spells_mtg-0.11.5.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
21
- spells_mtg-0.11.5.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
22
- spells_mtg-0.11.5.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
23
- spells_mtg-0.11.5.dist-info/RECORD,,
19
+ spells_mtg-0.11.7.dist-info/METADATA,sha256=odFdI4bYRUnk_aiFFnl0nEE5XNTOGwq-scbQ2dCFbjU,47369
20
+ spells_mtg-0.11.7.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
21
+ spells_mtg-0.11.7.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
22
+ spells_mtg-0.11.7.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
23
+ spells_mtg-0.11.7.dist-info/RECORD,,