spells-mtg 0.10.3__py3-none-any.whl → 0.10.5__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/extension.py CHANGED
@@ -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)
@@ -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
@@ -5,15 +5,15 @@ spells/columns.py,sha256=tQPhFpG4vOMIjV111p8DK4V-d_8634xoE-csBzou_sw,18008
5
5
  spells/config.py,sha256=_t98dc_uY3Wp3d5tsU3CJgVcWOD3wVlwMo98-tN2KRY,213
6
6
  spells/draft_data.py,sha256=xoL82NTgTJWxZK1p-6LjxnYzkeYOr-Dc9-_T0m-WZ1Y,19946
7
7
  spells/enums.py,sha256=MwJ9694AVoaKE22WlFjzHPcRfrU0DKI2_mrWC6_YjhE,4931
8
- spells/extension.py,sha256=sqlMSzJgNLj_B1QY97TAnPPLmCTFI8ixqae_929upJ0,7509
8
+ spells/extension.py,sha256=LBqGbJbe7iSRQkxJK7npkADCfzhdnIwwVvlmTn8xvjQ,8454
9
9
  spells/external.py,sha256=XZpZ0mn8_BmiF76xEiu2KblZ-dwOxmbs6vrDftl2XbI,11846
10
10
  spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
11
11
  spells/log.py,sha256=3avmg65hru8K9npKLvPp1wWWxq-hoEYDUCbxqhPkKUw,2175
12
12
  spells/manifest.py,sha256=iOmhxIVMHu_Av3nd23zGjmUwLvZ2hAM0oc1ErPzZ_oE,8341
13
13
  spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
14
14
  spells/utils.py,sha256=IO3brrXVvZla0LRTEB5v6NgGqZb_rYA46XtKBURGMNk,1944
15
- spells_mtg-0.10.3.dist-info/METADATA,sha256=m6PPLlYg905iivI0pXkrmeg7TTPUkOSEvFE7Dx8cMEU,47227
16
- spells_mtg-0.10.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
17
- spells_mtg-0.10.3.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
18
- spells_mtg-0.10.3.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
19
- spells_mtg-0.10.3.dist-info/RECORD,,
15
+ spells_mtg-0.10.5.dist-info/METADATA,sha256=RVb22q0WHU2DVO6AMF2lM_d-Lo3pEQW4kVJytUtArGQ,47227
16
+ spells_mtg-0.10.5.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
17
+ spells_mtg-0.10.5.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
18
+ spells_mtg-0.10.5.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
19
+ spells_mtg-0.10.5.dist-info/RECORD,,