spells-mtg 0.10.2__py3-none-any.whl → 0.10.3__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/draft_data.py +9 -1
- spells/extension.py +18 -0
- {spells_mtg-0.10.2.dist-info → spells_mtg-0.10.3.dist-info}/METADATA +3 -3
- {spells_mtg-0.10.2.dist-info → spells_mtg-0.10.3.dist-info}/RECORD +7 -7
- {spells_mtg-0.10.2.dist-info → spells_mtg-0.10.3.dist-info}/WHEEL +0 -0
- {spells_mtg-0.10.2.dist-info → spells_mtg-0.10.3.dist-info}/entry_points.txt +0 -0
- {spells_mtg-0.10.2.dist-info → spells_mtg-0.10.3.dist-info}/licenses/LICENSE +0 -0
spells/draft_data.py
CHANGED
|
@@ -612,4 +612,12 @@ def view_select(
|
|
|
612
612
|
else:
|
|
613
613
|
base_df = base_df_prefilter
|
|
614
614
|
|
|
615
|
-
|
|
615
|
+
select_defs = [col_def_map[c] for c in columns]
|
|
616
|
+
select_names = []
|
|
617
|
+
for d in select_defs:
|
|
618
|
+
if d.col_type == ColType.NAME_SUM:
|
|
619
|
+
select_names.extend([expr.meta.output_name() for expr in d.expr])
|
|
620
|
+
else:
|
|
621
|
+
select_names.append(d.expr.meta.output_name())
|
|
622
|
+
|
|
623
|
+
return base_df.select(select_names)
|
spells/extension.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
1
3
|
import math
|
|
2
4
|
|
|
3
5
|
import polars as pl
|
|
@@ -13,6 +15,19 @@ def print_ext(ext: dict[str, ColSpec]) -> None:
|
|
|
13
15
|
print("\t" + key)
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
def seen_greatest_name_fn(attr: str) -> Callable:
|
|
19
|
+
def inner(names: list[str]) -> pl.Expr:
|
|
20
|
+
expr = pl.lit(None)
|
|
21
|
+
for name in names:
|
|
22
|
+
expr = (
|
|
23
|
+
pl.when(pl.col(f"seen_{attr}_is_greatest_{name}"))
|
|
24
|
+
.then(pl.lit(name))
|
|
25
|
+
.otherwise(expr)
|
|
26
|
+
)
|
|
27
|
+
return expr
|
|
28
|
+
return inner
|
|
29
|
+
|
|
30
|
+
|
|
16
31
|
def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
|
|
17
32
|
ext = {
|
|
18
33
|
f"seen_{attr}": ColSpec(
|
|
@@ -41,6 +56,9 @@ def context_cols(attr, silent: bool = False) -> dict[str, ColSpec]:
|
|
|
41
56
|
expr=lambda name: pl.col(f"seen_{attr}_{name}")
|
|
42
57
|
== pl.col(f"greatest_{attr}_seen"),
|
|
43
58
|
),
|
|
59
|
+
f"seen_greatest_{attr}_name": ColSpec(
|
|
60
|
+
col_type=ColType.GROUP_BY, expr=seen_greatest_name_fn(attr)
|
|
61
|
+
),
|
|
44
62
|
f"seen_{attr}_greater": ColSpec(
|
|
45
63
|
col_type=ColType.NAME_SUM,
|
|
46
64
|
expr=lambda name: pl.col(f"seen_{attr}_{name}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spells-mtg
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.3
|
|
4
4
|
Summary: analaysis of 17Lands.com public datasets
|
|
5
5
|
Author-Email: Joel Barnes <oelarnes@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -304,7 +304,7 @@ summon(
|
|
|
304
304
|
set_context: pl.DataFrame | dict[str, Any] | None = None,
|
|
305
305
|
read_cache: bool = True,
|
|
306
306
|
write_cache: bool = True,
|
|
307
|
-
use_streaming: bool =
|
|
307
|
+
use_streaming: bool = True,
|
|
308
308
|
log_to_console: int = logging.ERROR,
|
|
309
309
|
) -> polars.DataFrame
|
|
310
310
|
```
|
|
@@ -365,7 +365,7 @@ Used to define extensions in `summon`
|
|
|
365
365
|
and `AGG` must be derivable at the individual row level on one or both base views. `CARD_ATTR` must be derivable at the individual row level from the card file. `AGG` can depend on any column present after
|
|
366
366
|
summing over groups, and can include polars Expression aggregations. Arbitrarily long chains of aggregate dependencies are supported.
|
|
367
367
|
|
|
368
|
-
- `expr`: A polars expression or function returning a polars expression giving the derivation of the column value at the first level where it is defined.
|
|
368
|
+
- `expr`: A polars expression or function returning a polars expression giving the derivation of the column value at the first level where it is defined. The name is inferred from the dictionary key in the extensions argument, you do not need to specify an alias.
|
|
369
369
|
- For `NAME_SUM` columns, `expr` must be a function of `name` which will result in a list of expressions mapped over all card names.
|
|
370
370
|
- `PICK_SUM` columns can also be functions on `name`, in which case the value will be a function of the value of the `PICK` field.
|
|
371
371
|
- `AGG` columns that depend on `NAME_SUM` columns reference the prefix (`cdef.name`) only, since the unpivot has occured prior to selection.
|
|
@@ -3,17 +3,17 @@ spells/cache.py,sha256=7XDcltmlpagK2nkhuCCcAQVyrFMYkw9Acr7iVsLs3JU,3799
|
|
|
3
3
|
spells/cards.py,sha256=6stFPhJOzHqvQnkSv9cDeylRa_7L9Y8sOaowiZhzz6I,4174
|
|
4
4
|
spells/columns.py,sha256=tQPhFpG4vOMIjV111p8DK4V-d_8634xoE-csBzou_sw,18008
|
|
5
5
|
spells/config.py,sha256=_t98dc_uY3Wp3d5tsU3CJgVcWOD3wVlwMo98-tN2KRY,213
|
|
6
|
-
spells/draft_data.py,sha256=
|
|
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=
|
|
8
|
+
spells/extension.py,sha256=sqlMSzJgNLj_B1QY97TAnPPLmCTFI8ixqae_929upJ0,7509
|
|
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.
|
|
16
|
-
spells_mtg-0.10.
|
|
17
|
-
spells_mtg-0.10.
|
|
18
|
-
spells_mtg-0.10.
|
|
19
|
-
spells_mtg-0.10.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|