spells-mtg 0.10.3__tar.gz → 0.10.5__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.10.3
3
+ Version: 0.10.5
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.10.3"
14
+ version = "0.10.5"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -25,10 +25,11 @@ def seen_greatest_name_fn(attr: str) -> Callable:
25
25
  .otherwise(expr)
26
26
  )
27
27
  return expr
28
+
28
29
  return inner
29
30
 
30
31
 
31
- def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
32
+ def context_cols(attr, silent: bool = True) -> dict[str, ColSpec]:
32
33
  ext = {
33
34
  f"seen_{attr}": ColSpec(
34
35
  col_type=ColType.NAME_SUM,
@@ -49,7 +50,26 @@ def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
49
50
  else card_context[name][attr],
50
51
  ),
51
52
  f"pick_{attr}": ColSpec(
52
- col_type=ColType.AGG, expr=pl.col(f"pick_{attr}_sum") / pl.col("num_taken")
53
+ col_type=ColType.GROUP_BY, expr=pl.col(f"pick_{attr}_sum")
54
+ ),
55
+ f"pool_{attr}": ColSpec(
56
+ col_type=ColType.NAME_SUM,
57
+ expr=(
58
+ lambda name, card_context: pl.lit(None)
59
+ if card_context[name].get(attr) is None
60
+ or math.isnan(card_context[name][attr])
61
+ else card_context[name][attr] * pl.col(f"pool_{name}")
62
+ ),
63
+ ),
64
+ f"pool_{attr}_sum": ColSpec(
65
+ col_type=ColType.PICK_SUM,
66
+ expr=lambda names: pl.sum_horizontal(
67
+ [pl.col(f"pool_{attr}_{name}") for name in names]
68
+ ),
69
+ ),
70
+ f"pool_pick_{attr}_sum": ColSpec(
71
+ col_type=ColType.PICK_SUM,
72
+ expr=pl.col(f"pick_{attr}_sum") + pl.col(f"pool_{attr}_sum"),
53
73
  ),
54
74
  f"seen_{attr}_is_greatest": ColSpec(
55
75
  col_type=ColType.NAME_SUM,
@@ -75,6 +95,12 @@ def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
75
95
  [pl.col(f"seen_{attr}_{name}") for name in names]
76
96
  ),
77
97
  ),
98
+ f"seen_{attr}_pack_sum": ColSpec(
99
+ col_type=ColType.PICK_SUM,
100
+ expr=lambda names: pl.sum_horizontal(
101
+ [pl.col(f"seen_{attr}_{name}") for name in names]
102
+ ),
103
+ ),
78
104
  f"least_{attr}_seen": ColSpec(
79
105
  col_type=ColType.PICK_SUM,
80
106
  expr=lambda names: pl.min_horizontal(
@@ -145,7 +171,7 @@ def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
145
171
  return ext
146
172
 
147
173
 
148
- def stat_cols(attr: str, silent: bool = False) -> dict[str, ColSpec]:
174
+ def stat_cols(attr: str, silent: bool = True) -> dict[str, ColSpec]:
149
175
  ext = {
150
176
  f"{attr}_deck_weight_group": ColSpec(
151
177
  col_type=ColType.AGG, expr=pl.col(f"{attr}") * pl.col(ColName.DECK)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes