spells-mtg 0.11.12__py3-none-any.whl → 0.11.14__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/columns.py +62 -144
- spells/draft_data.py +6 -4
- {spells_mtg-0.11.12.dist-info → spells_mtg-0.11.14.dist-info}/METADATA +1 -1
- {spells_mtg-0.11.12.dist-info → spells_mtg-0.11.14.dist-info}/RECORD +7 -7
- {spells_mtg-0.11.12.dist-info → spells_mtg-0.11.14.dist-info}/WHEEL +0 -0
- {spells_mtg-0.11.12.dist-info → spells_mtg-0.11.14.dist-info}/entry_points.txt +0 -0
- {spells_mtg-0.11.12.dist-info → spells_mtg-0.11.14.dist-info}/licenses/LICENSE +0 -0
spells/columns.py
CHANGED
|
@@ -40,6 +40,11 @@ default_columns = [
|
|
|
40
40
|
ColName.GIH_WR,
|
|
41
41
|
]
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
def agg_col(expr: pl.Expr) -> ColSpec:
|
|
45
|
+
return ColSpec(col_type=ColType.AGG, expr=expr)
|
|
46
|
+
|
|
47
|
+
|
|
43
48
|
_specs: dict[str, ColSpec] = {
|
|
44
49
|
ColName.NAME: ColSpec(
|
|
45
50
|
col_type=ColType.GROUP_BY,
|
|
@@ -168,7 +173,8 @@ _specs: dict[str, ColSpec] = {
|
|
|
168
173
|
),
|
|
169
174
|
ColName.PICK_INDEX: ColSpec(
|
|
170
175
|
col_type=ColType.GROUP_BY,
|
|
171
|
-
expr=lambda set_context: pl.col(ColName.PICK_NUMBER)
|
|
176
|
+
expr=lambda set_context: pl.col(ColName.PICK_NUMBER)
|
|
177
|
+
+ pl.col(ColName.PACK_NUMBER) * set_context["picks_per_pack"],
|
|
172
178
|
),
|
|
173
179
|
ColName.TAKEN_AT: ColSpec(
|
|
174
180
|
col_type=ColType.PICK_SUM,
|
|
@@ -441,149 +447,61 @@ _specs: dict[str, ColSpec] = {
|
|
|
441
447
|
ColName.IMAGE_URL: ColSpec(
|
|
442
448
|
col_type=ColType.CARD_ATTR,
|
|
443
449
|
),
|
|
444
|
-
ColName.PICKED_MATCH_WR:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
),
|
|
456
|
-
ColName.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
),
|
|
460
|
-
ColName.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
),
|
|
464
|
-
ColName.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
),
|
|
468
|
-
ColName.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
),
|
|
472
|
-
ColName.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
),
|
|
480
|
-
ColName.
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
),
|
|
484
|
-
ColName.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
),
|
|
488
|
-
ColName.
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
),
|
|
496
|
-
ColName.
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
),
|
|
500
|
-
ColName.IWD: ColSpec(
|
|
501
|
-
col_type=ColType.AGG,
|
|
502
|
-
expr=pl.col(ColName.GIH_WR) - pl.col(ColName.GNS_WR),
|
|
503
|
-
),
|
|
504
|
-
ColName.NUM_IN_POOL: ColSpec(
|
|
505
|
-
col_type=ColType.AGG,
|
|
506
|
-
expr=pl.col(ColName.DECK) + pl.col(ColName.SIDEBOARD),
|
|
507
|
-
),
|
|
508
|
-
ColName.NUM_IN_POOL_TOTAL: ColSpec(
|
|
509
|
-
col_type=ColType.AGG,
|
|
510
|
-
expr=pl.col(ColName.NUM_IN_POOL).sum(),
|
|
511
|
-
),
|
|
512
|
-
ColName.IN_POOL_WR: ColSpec(
|
|
513
|
-
col_type=ColType.AGG,
|
|
514
|
-
expr=(pl.col(ColName.WON_DECK) + pl.col(ColName.WON_SIDEBOARD))
|
|
515
|
-
/ pl.col(ColName.NUM_IN_POOL),
|
|
516
|
-
),
|
|
517
|
-
ColName.DECK_TOTAL: ColSpec(
|
|
518
|
-
col_type=ColType.AGG,
|
|
519
|
-
expr=pl.col(ColName.DECK).sum(),
|
|
520
|
-
),
|
|
521
|
-
ColName.WON_DECK_TOTAL: ColSpec(
|
|
522
|
-
col_type=ColType.AGG,
|
|
523
|
-
expr=pl.col(ColName.WON_DECK).sum(),
|
|
524
|
-
),
|
|
525
|
-
ColName.GP_WR_MEAN: ColSpec(
|
|
526
|
-
col_type=ColType.AGG,
|
|
527
|
-
expr=pl.col(ColName.WON_DECK_TOTAL) / pl.col(ColName.DECK_TOTAL),
|
|
528
|
-
),
|
|
529
|
-
ColName.GP_WR_EXCESS: ColSpec(
|
|
530
|
-
col_type=ColType.AGG,
|
|
531
|
-
expr=pl.col(ColName.GP_WR) - pl.col(ColName.GP_WR_MEAN),
|
|
532
|
-
),
|
|
533
|
-
ColName.GP_WR_VAR: ColSpec(
|
|
534
|
-
col_type=ColType.AGG,
|
|
535
|
-
expr=(pl.col(ColName.GP_WR_EXCESS).pow(2) * pl.col(ColName.NUM_GP)).sum()
|
|
536
|
-
/ pl.col(ColName.DECK_TOTAL),
|
|
537
|
-
),
|
|
538
|
-
ColName.GP_WR_STDEV: ColSpec(
|
|
539
|
-
col_type=ColType.AGG,
|
|
540
|
-
expr=pl.col(ColName.GP_WR_VAR).sqrt(),
|
|
541
|
-
),
|
|
542
|
-
ColName.GP_WR_Z: ColSpec(
|
|
543
|
-
col_type=ColType.AGG,
|
|
544
|
-
expr=pl.col(ColName.GP_WR_EXCESS) / pl.col(ColName.GP_WR_STDEV),
|
|
545
|
-
),
|
|
546
|
-
ColName.GIH_TOTAL: ColSpec(
|
|
547
|
-
col_type=ColType.AGG,
|
|
548
|
-
expr=pl.col(ColName.NUM_GIH).sum(),
|
|
549
|
-
),
|
|
550
|
-
ColName.WON_GIH_TOTAL: ColSpec(
|
|
551
|
-
col_type=ColType.AGG,
|
|
552
|
-
expr=pl.col(ColName.NUM_GIH_WON).sum(),
|
|
553
|
-
),
|
|
554
|
-
ColName.GIH_WR_MEAN: ColSpec(
|
|
555
|
-
col_type=ColType.AGG,
|
|
556
|
-
expr=pl.col(ColName.WON_GIH_TOTAL) / pl.col(ColName.GIH_TOTAL),
|
|
557
|
-
),
|
|
558
|
-
ColName.GIH_WR_EXCESS: ColSpec(
|
|
559
|
-
col_type=ColType.AGG,
|
|
560
|
-
expr=pl.col(ColName.GIH_WR) - pl.col(ColName.GIH_WR_MEAN),
|
|
561
|
-
),
|
|
562
|
-
ColName.GIH_WR_VAR: ColSpec(
|
|
563
|
-
col_type=ColType.AGG,
|
|
564
|
-
expr=(pl.col(ColName.GIH_WR_EXCESS).pow(2) * pl.col(ColName.NUM_GIH)).sum()
|
|
565
|
-
/ pl.col(ColName.GIH_TOTAL),
|
|
566
|
-
),
|
|
567
|
-
ColName.GIH_WR_STDEV: ColSpec(
|
|
568
|
-
col_type=ColType.AGG,
|
|
569
|
-
expr=pl.col(ColName.GIH_WR_VAR).sqrt(),
|
|
570
|
-
),
|
|
571
|
-
ColName.GIH_WR_Z: ColSpec(
|
|
572
|
-
col_type=ColType.AGG,
|
|
573
|
-
expr=pl.col(ColName.GIH_WR_EXCESS) / pl.col(ColName.GIH_WR_STDEV),
|
|
574
|
-
),
|
|
575
|
-
ColName.DECK_MANA_VALUE_AVG: ColSpec(
|
|
576
|
-
col_type=ColType.AGG,
|
|
577
|
-
expr=pl.col(ColName.DECK_MANA_VALUE) / pl.col(ColName.DECK_SPELLS),
|
|
578
|
-
),
|
|
579
|
-
ColName.DECK_LANDS_AVG: ColSpec(
|
|
580
|
-
col_type=ColType.AGG,
|
|
581
|
-
expr=pl.col(ColName.DECK_LANDS) / pl.col(ColName.NUM_GAMES),
|
|
582
|
-
),
|
|
583
|
-
ColName.DECK_SPELLS_AVG: ColSpec(
|
|
584
|
-
col_type=ColType.AGG,
|
|
585
|
-
expr=pl.col(ColName.DECK_SPELLS) / pl.col(ColName.NUM_GAMES),
|
|
586
|
-
),
|
|
450
|
+
ColName.PICKED_MATCH_WR: agg_col(
|
|
451
|
+
pl.col(ColName.EVENT_MATCH_WINS_SUM) / pl.col(ColName.EVENT_MATCHES_SUM)
|
|
452
|
+
),
|
|
453
|
+
ColName.TROPHY_RATE: agg_col(
|
|
454
|
+
pl.col(ColName.IS_TROPHY_SUM) / pl.col(ColName.NUM_TAKEN),
|
|
455
|
+
),
|
|
456
|
+
ColName.GAME_WR: agg_col(
|
|
457
|
+
pl.col(ColName.NUM_WON) / pl.col(ColName.NUM_GAMES),
|
|
458
|
+
),
|
|
459
|
+
ColName.ALSA: agg_col(pl.col(ColName.LAST_SEEN) / pl.col(ColName.NUM_SEEN)),
|
|
460
|
+
ColName.ATA: agg_col(pl.col(ColName.TAKEN_AT) / pl.col(ColName.NUM_TAKEN)),
|
|
461
|
+
ColName.NUM_GP: agg_col(pl.col(ColName.DECK)),
|
|
462
|
+
ColName.PCT_GP: agg_col(
|
|
463
|
+
pl.col(ColName.DECK) / (pl.col(ColName.DECK) + pl.col(ColName.SIDEBOARD))
|
|
464
|
+
),
|
|
465
|
+
ColName.GP_WR: agg_col(pl.col(ColName.WON_DECK) / pl.col(ColName.DECK)),
|
|
466
|
+
ColName.NUM_OH: agg_col(pl.col(ColName.OPENING_HAND)),
|
|
467
|
+
ColName.OH_WR: agg_col(
|
|
468
|
+
pl.col(ColName.WON_OPENING_HAND) / pl.col(ColName.OPENING_HAND)
|
|
469
|
+
),
|
|
470
|
+
ColName.NUM_GIH: agg_col(pl.col(ColName.OPENING_HAND) + pl.col(ColName.DRAWN)),
|
|
471
|
+
ColName.NUM_GIH_WON: agg_col(
|
|
472
|
+
pl.col(ColName.WON_OPENING_HAND) + pl.col(ColName.WON_DRAWN)
|
|
473
|
+
),
|
|
474
|
+
ColName.GIH_WR: agg_col(pl.col(ColName.NUM_GIH_WON) / pl.col(ColName.NUM_GIH)),
|
|
475
|
+
ColName.GNS_WR: agg_col(pl.col(ColName.WON_NUM_GNS) / pl.col(ColName.NUM_GNS)),
|
|
476
|
+
ColName.IWD: agg_col(pl.col(ColName.GIH_WR) - pl.col(ColName.GNS_WR)),
|
|
477
|
+
ColName.NUM_IN_POOL: agg_col(pl.col(ColName.DECK) + pl.col(ColName.SIDEBOARD)),
|
|
478
|
+
ColName.NUM_IN_POOL_TOTAL: agg_col(pl.col(ColName.NUM_IN_POOL).sum()),
|
|
479
|
+
ColName.IN_POOL_WR: agg_col(
|
|
480
|
+
(pl.col(ColName.WON_DECK) + pl.col(ColName.WON_SIDEBOARD))
|
|
481
|
+
/ pl.col(ColName.NUM_IN_POOL)
|
|
482
|
+
),
|
|
483
|
+
ColName.DECK_TOTAL: agg_col(pl.col(ColName.DECK).sum()),
|
|
484
|
+
ColName.WON_DECK_TOTAL: agg_col(pl.col(ColName.WON_DECK).sum()),
|
|
485
|
+
ColName.GP_WR_MEAN: agg_col(pl.col(ColName.WON_DECK_TOTAL) / pl.col(ColName.DECK_TOTAL)),
|
|
486
|
+
ColName.GP_WR_EXCESS: agg_col(pl.col(ColName.GP_WR) - pl.col(ColName.GP_WR_MEAN)),
|
|
487
|
+
ColName.GP_WR_VAR: agg_col((pl.col(ColName.GP_WR_EXCESS).pow(2) * pl.col(ColName.NUM_GP)).sum()
|
|
488
|
+
/ pl.col(ColName.DECK_TOTAL)
|
|
489
|
+
),
|
|
490
|
+
ColName.GP_WR_STDEV: agg_col(pl.col(ColName.GP_WR_VAR).sqrt()),
|
|
491
|
+
ColName.GP_WR_Z: agg_col(pl.col(ColName.GP_WR_EXCESS) / pl.col(ColName.GP_WR_STDEV)),
|
|
492
|
+
ColName.GIH_TOTAL: agg_col(pl.col(ColName.NUM_GIH).sum()),
|
|
493
|
+
ColName.WON_GIH_TOTAL: agg_col(pl.col(ColName.NUM_GIH_WON).sum()),
|
|
494
|
+
ColName.GIH_WR_MEAN: agg_col(pl.col(ColName.WON_GIH_TOTAL) / pl.col(ColName.GIH_TOTAL)),
|
|
495
|
+
ColName.GIH_WR_EXCESS: agg_col(pl.col(ColName.GIH_WR) - pl.col(ColName.GIH_WR_MEAN)),
|
|
496
|
+
ColName.GIH_WR_VAR: agg_col(
|
|
497
|
+
(pl.col(ColName.GIH_WR_EXCESS).pow(2) * pl.col(ColName.NUM_GIH)).sum()
|
|
498
|
+
/ pl.col(ColName.GIH_TOTAL)
|
|
499
|
+
),
|
|
500
|
+
ColName.GIH_WR_STDEV: agg_col(pl.col(ColName.GIH_WR_VAR).sqrt()),
|
|
501
|
+
ColName.GIH_WR_Z: agg_col(pl.col(ColName.GIH_WR_EXCESS) / pl.col(ColName.GIH_WR_STDEV)),
|
|
502
|
+
ColName.DECK_MANA_VALUE_AVG: agg_col(pl.col(ColName.DECK_MANA_VALUE) / pl.col(ColName.DECK_SPELLS)),
|
|
503
|
+
ColName.DECK_LANDS_AVG: agg_col(pl.col(ColName.DECK_LANDS) / pl.col(ColName.NUM_GAMES)),
|
|
504
|
+
ColName.DECK_SPELLS_AVG: agg_col(pl.col(ColName.DECK_SPELLS) / pl.col(ColName.NUM_GAMES)),
|
|
587
505
|
}
|
|
588
506
|
|
|
589
507
|
for item in ColName:
|
spells/draft_data.py
CHANGED
|
@@ -347,7 +347,10 @@ def _view_select(
|
|
|
347
347
|
cdefs = [col_def_map[c] for c in sorted(view_cols)]
|
|
348
348
|
select = []
|
|
349
349
|
for cdef in cdefs:
|
|
350
|
-
if
|
|
350
|
+
if isinstance(df, pl.DataFrame) and cdef.name in df.columns:
|
|
351
|
+
base_cols = base_cols.union(frozenset({cdef.name}))
|
|
352
|
+
select.append(cdef.name)
|
|
353
|
+
elif is_agg_view:
|
|
351
354
|
if cdef.col_type == ColType.AGG:
|
|
352
355
|
base_cols = base_cols.union(cdef.dependencies)
|
|
353
356
|
select.append(cdef.expr)
|
|
@@ -471,7 +474,7 @@ def _base_agg_df(
|
|
|
471
474
|
|
|
472
475
|
if group_by:
|
|
473
476
|
joined_df = functools.reduce(
|
|
474
|
-
lambda prev, curr: prev.join(curr, on=group_by, how="
|
|
477
|
+
lambda prev, curr: prev.join(curr, on=group_by, how="full", coalesce=True),
|
|
475
478
|
join_dfs,
|
|
476
479
|
)
|
|
477
480
|
else:
|
|
@@ -565,11 +568,10 @@ def summon(
|
|
|
565
568
|
select_df = _view_select(
|
|
566
569
|
card_df, card_cols, m.col_def_map, is_agg_view=False
|
|
567
570
|
)
|
|
568
|
-
agg_df = agg_df.join(select_df, on="name", how="
|
|
571
|
+
agg_df = agg_df.join(select_df, on="name", how="full", coalesce=True)
|
|
569
572
|
else:
|
|
570
573
|
assert len(codes) == 1, "Only one set supported for loading from card data file"
|
|
571
574
|
assert codes[0] == cdfs.set_code, "Wrong set file specified"
|
|
572
|
-
assert cdfs.format == "PremierDraft", "Only PremierDraft supported"
|
|
573
575
|
agg_df = base_ratings_df(
|
|
574
576
|
set_code=cdfs.set_code,
|
|
575
577
|
format=cdfs.format,
|
|
@@ -5,9 +5,9 @@ spells/__init__.py,sha256=0pnh2NLn9FrNKncE9-tBsighp3e8YAsN--_ovUpgWGs,333
|
|
|
5
5
|
spells/cache.py,sha256=6cl0q62erR3LCANPSfxG5-J7JQfLwNdWjzlBpfiL4IE,7174
|
|
6
6
|
spells/card_data_files.py,sha256=HSD2z_5t6UEuE8S9rcBJBLlNxlPSeI9JE5lRLYrayD4,6626
|
|
7
7
|
spells/cards.py,sha256=6stFPhJOzHqvQnkSv9cDeylRa_7L9Y8sOaowiZhzz6I,4174
|
|
8
|
-
spells/columns.py,sha256=
|
|
8
|
+
spells/columns.py,sha256=HsmOSunZHs0RMyXoSo-gAVWMNZqMYs3IrO5v5-99BqM,16678
|
|
9
9
|
spells/config.py,sha256=Nym660bbYt4ijzC5scVJ6PVOh-4vBi4hfFusBIPxcZk,257
|
|
10
|
-
spells/draft_data.py,sha256=
|
|
10
|
+
spells/draft_data.py,sha256=iYsfmVRPy67GS3Epv8xakYVZQZIr0JbrZMFG0_wpLm4,21380
|
|
11
11
|
spells/enums.py,sha256=gbwfon6tQCoKDb-m4hSaHWi9slj82yqaH3qhYMVrsck,4991
|
|
12
12
|
spells/extension.py,sha256=LBqGbJbe7iSRQkxJK7npkADCfzhdnIwwVvlmTn8xvjQ,8454
|
|
13
13
|
spells/external.py,sha256=I-f_vMx-h2kvunUlZthsauaeDn42vcRk0wvTURfImzs,11848
|
|
@@ -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.
|
|
20
|
-
spells_mtg-0.11.
|
|
21
|
-
spells_mtg-0.11.
|
|
22
|
-
spells_mtg-0.11.
|
|
23
|
-
spells_mtg-0.11.
|
|
19
|
+
spells_mtg-0.11.14.dist-info/METADATA,sha256=Dasl06rVqIDp4nCaJ_x_G-m1YQNf-9I-ISNaW3pXnbs,47370
|
|
20
|
+
spells_mtg-0.11.14.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
21
|
+
spells_mtg-0.11.14.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
|
|
22
|
+
spells_mtg-0.11.14.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
|
|
23
|
+
spells_mtg-0.11.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|