spells-mtg 0.11.5__tar.gz → 0.11.7__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.5 → spells_mtg-0.11.7}/PKG-INFO +1 -1
  2. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/pyproject.toml +1 -1
  3. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/card_data_files.py +28 -39
  4. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/config.py +1 -0
  5. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/LICENSE +0 -0
  6. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/README.md +0 -0
  7. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/.ruff_cache/.gitignore +0 -0
  8. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/.ruff_cache/0.8.6/17785301476771359756 +0 -0
  9. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/.ruff_cache/CACHEDIR.TAG +0 -0
  10. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/__init__.py +0 -0
  11. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/cache.py +0 -0
  12. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/cards.py +0 -0
  13. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/columns.py +0 -0
  14. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/draft_data.py +0 -0
  15. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/enums.py +0 -0
  16. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/extension.py +0 -0
  17. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/external.py +0 -0
  18. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/filter.py +0 -0
  19. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/log.py +0 -0
  20. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/manifest.py +0 -0
  21. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/schema.py +0 -0
  22. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/spells/utils.py +0 -0
  23. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/tests/__init__.py +0 -0
  24. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/tests/filter_test.py +0 -0
  25. {spells_mtg-0.11.5 → spells_mtg-0.11.7}/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.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
@@ -11,7 +11,7 @@ dependencies = [
11
11
  ]
12
12
  requires-python = ">=3.11"
13
13
  readme = "README.md"
14
- version = "0.11.5"
14
+ version = "0.11.7"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -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)
@@ -1,4 +1,5 @@
1
1
  all_sets = [
2
+ "FIN",
2
3
  "TDM",
3
4
  "DFT",
4
5
  "PIO",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes