spells-mtg 0.3.0__py3-none-any.whl → 0.3.1__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/cards.py CHANGED
@@ -76,7 +76,10 @@ def _extract_value(set_code: str, name: str, card_dict: dict, field: CardAttr):
76
76
 
77
77
  def card_df(draft_set_code: str, names: list[str]) -> pl.DataFrame:
78
78
  draft_set_json = _fetch_mtg_json(draft_set_code)
79
- set_codes = draft_set_json["data"]["booster"]["play"]["sourceSetCodes"]
79
+ booster_info = draft_set_json["data"]["booster"]
80
+
81
+ booster_type = "play" if "play" in booster_info else "draft"
82
+ set_codes = booster_info[booster_type]["sourceSetCodes"]
80
83
  set_codes.reverse()
81
84
 
82
85
  card_data_map = {}
spells/columns.py CHANGED
@@ -510,6 +510,20 @@ _column_specs = [
510
510
  expr=pl.col(ColName.MANA_VALUE) * pl.col(ColName.DECK),
511
511
  dependencies=[ColName.MANA_VALUE, ColName.DECK],
512
512
  ),
513
+ ColumnSpec(
514
+ name=ColName.DECK_LANDS,
515
+ col_type=ColType.CARD_SUM,
516
+ expr=pl.when(pl.col(ColName.CARD_TYPE).str.contains("Land"))
517
+ .then(pl.col(ColName.DECK))
518
+ .otherwise(0),
519
+ dependencies=[ColName.CARD_TYPE, ColName.DECK],
520
+ ),
521
+ ColumnSpec(
522
+ name=ColName.DECK_SPELLS,
523
+ col_type=ColType.CARD_SUM,
524
+ expr=pl.col(ColName.DECK) - pl.col(ColName.DECK_SPELLS),
525
+ dependencies=[ColName.DECK, ColName.DECK_SPELLS],
526
+ ),
513
527
  ColumnSpec(
514
528
  name=ColName.MANA_COST,
515
529
  col_type=ColType.CARD_ATTR,
@@ -733,6 +747,18 @@ _column_specs = [
733
747
  expr=pl.col(ColName.DECK_MANA_VALUE) / pl.col(ColName.DECK),
734
748
  dependencies=[ColName.DECK_MANA_VALUE, ColName.DECK],
735
749
  ),
750
+ ColumnSpec(
751
+ name=ColName.DECK_LANDS_AVG,
752
+ col_type=ColType.AGG,
753
+ expr=pl.col(ColName.DECK_LANDS) / pl.col(ColName.NUM_GAMES),
754
+ dependencies=[ColName.DECK_LANDS, ColName.NUM_GAMES],
755
+ ),
756
+ ColumnSpec(
757
+ name=ColName.DECK_SPELLS_AVG,
758
+ col_type=ColType.AGG,
759
+ expr=pl.col(ColName.DECK_SPELLS) / pl.col(ColName.NUM_GAMES),
760
+ dependencies=[ColName.DECK_SPELLS, ColName.NUM_GAMES],
761
+ ),
736
762
  ]
737
763
 
738
764
  col_spec_map = {col.name: col for col in _column_specs}
spells/enums.py CHANGED
@@ -117,6 +117,8 @@ class ColName(StrEnum):
117
117
  SUBTYPE = "subtype"
118
118
  MANA_VALUE = "mana_value"
119
119
  DECK_MANA_VALUE = "deck_mana_value"
120
+ DECK_LANDS = "deck_lands"
121
+ DECK_SPELLS = "deck_spells"
120
122
  MANA_COST = "mana_cost"
121
123
  POWER = "power"
122
124
  TOUGHNESS = "toughness"
@@ -157,3 +159,5 @@ class ColName(StrEnum):
157
159
  GIH_WR_STDEV = "gh_wr_stdev"
158
160
  GIH_WR_Z = "gih_wr_z"
159
161
  DECK_MANA_VALUE_AVG = "deck_mana_value_avg"
162
+ DECK_LANDS_AVG = "deck_lands_avg"
163
+ DECK_SPELLS_AVG = "deck_spells_avg"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -424,6 +424,7 @@ A table of all included columns. Columns can be referenced by enum or by string
424
424
  | `CARD_TYPE` | `"card_type"` | `CARD` | `CARD_ATTR` | | String |
425
425
  | `SUBTYPE` | `"subtype"` | `CARD` | `CARD_ATTR` | | String |
426
426
  | `MANA_VALUE` | `"mana_value"` | `CARD` | `CARD_ATTR` | | Float |
427
+ | `DECK_MANA_VALUE` | `"deck_mana_value"` | | `CARD_SUM` | `DECK` * `MANA_VALUE` | Float |
427
428
  | `MANA_COST` | `"mana_cost"` | `CARD` | `CARD_ATTR` | | String |
428
429
  | `POWER` | `"power"` | `CARD` | `CARD_ATTR` | | Float |
429
430
  | `TOUGHNESS` | `"toughness"` | `CARD` | `CARD_ATTR` | | Float |
@@ -462,6 +463,7 @@ A table of all included columns. Columns can be referenced by enum or by string
462
463
  | `GIH_WR_VAR` | `"gih_wr_var"` | | `AGG` | Game-weighted Variance | Float |
463
464
  | `GIH_WR_STDEV` | `"gh_wr_stdev"` | | `AGG` | Sqrt of `GIH_WR_VAR` | Float |
464
465
  | `GIH_WR_Z` | `"gih_wr_z"` | | `AGG` |`GIH_WR_EXCESS` / `GIH_WR_STDEV` | Float |
466
+ | `DECK_MANA_VALUE_AVG` | `"deck_mana_value_avg"` | | `AGG` | `DECK_MANA_VALUE ` / `DECK` | Float |
465
467
 
466
468
  # Roadmap to 1.0
467
469
 
@@ -1,15 +1,15 @@
1
1
  spells/__init__.py,sha256=QCPWQySUK2SZtCU-mSZLsn7vrNLJMDsRwil8gmAzmdk,151
2
2
  spells/cache.py,sha256=4v7h8D3TtaT0R_EdiRNhdcQrXzdH_CukezO6oAXvNEY,2956
3
- spells/cards.py,sha256=6seKpgI4TlJxI20bvcgt5VpxzsbCnnjWneDWpneJJ6Y,3497
4
- spells/columns.py,sha256=_x7vVSh-55TJRjV7LQ29Kj_Ek__ef4pvxUsX57s9Iwo,22488
3
+ spells/cards.py,sha256=EOXAB_F2yedjf6KquCERCIHl0TSIJIoOe1jv8g4JzOc,3601
4
+ spells/columns.py,sha256=QIM-dV00Pe5En9EozPWpH_u5f8VSgxd0Pxd2QxYuOFk,23423
5
5
  spells/draft_data.py,sha256=ABIQoUD8MKnc2goTUGY33dOxCpH8ydXXuQnbHMNULZs,10999
6
- spells/enums.py,sha256=t-1PrBUqbxZRShDOgmTHkhiHIOIMHTbD7RUgKiQdx-c,4621
6
+ spells/enums.py,sha256=_yvb9AFPofRYwf0gndFteGQS9bSzHy2_HphYYhFr9Ro,4761
7
7
  spells/external.py,sha256=qe6wOBDhPN4CZNQvYRq6G-OpIZcWTZzJjySgnf2Gu1o,10258
8
8
  spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
9
9
  spells/manifest.py,sha256=oGkWuBYquJYmtaIp2O-x5nFKD5TkU5lzS-vera69jyU,7244
10
10
  spells/schema.py,sha256=z8Qn2SiHG4T6YfPsz8xHLGMjU_Ofm76-Vrquh3b9B64,6422
11
- spells_mtg-0.3.0.dist-info/METADATA,sha256=hhHnMORK-fcalrC-Y416Eyfx-ZBaldqZYaXKpMSh7a8,42882
12
- spells_mtg-0.3.0.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
13
- spells_mtg-0.3.0.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
14
- spells_mtg-0.3.0.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
15
- spells_mtg-0.3.0.dist-info/RECORD,,
11
+ spells_mtg-0.3.1.dist-info/METADATA,sha256=3K1GrMa-GXcb3J-0Xg71Vqi93LxoynWwLQ8UmcjhVxM,43073
12
+ spells_mtg-0.3.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
13
+ spells_mtg-0.3.1.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
14
+ spells_mtg-0.3.1.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
15
+ spells_mtg-0.3.1.dist-info/RECORD,,