spells-mtg 0.10.9__py3-none-any.whl → 0.10.10__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/cache.py CHANGED
@@ -9,7 +9,9 @@ Caches are cleared per-set when new files are downloaded.
9
9
 
10
10
  from enum import StrEnum
11
11
  import os
12
+ from pathlib import Path
12
13
  import sys
14
+
13
15
  import polars as pl
14
16
 
15
17
 
@@ -70,6 +72,25 @@ def data_home() -> str:
70
72
  )
71
73
 
72
74
 
75
+ def ad_hoc_dir():
76
+ ad_hoc_dir = Path(data_home()) / "ad_hoc"
77
+ if not os.path.isdir(ad_hoc_dir):
78
+ os.makedirs(ad_hoc_dir)
79
+ return ad_hoc_dir
80
+
81
+
82
+ def save_ad_hoc_dataset(df: pl.DataFrame, key: str):
83
+ df.write_parquet(ad_hoc_dir() / f"{key}.parquet")
84
+
85
+
86
+ def read_ad_hoc_dataset(key: str):
87
+ path = ad_hoc_dir() / f"{key}.parquet"
88
+ if os.path.exists(path):
89
+ return pl.read_parquet(ad_hoc_dir() / f"{key}.parquet")
90
+ else:
91
+ return None
92
+
93
+
73
94
  def create_test_data(set_code: str, test_num_drafts: int = 100):
74
95
  """
75
96
  run from prod environment to write test data for `set_code` into
spells/draft_data.py CHANGED
@@ -19,7 +19,7 @@ from polars.exceptions import ColumnNotFoundError
19
19
 
20
20
  from spells import cache
21
21
  import spells.filter
22
- import spells.manifest
22
+ from spells import manifest
23
23
  from spells.columns import ColDef, ColSpec, get_specs
24
24
  from spells.enums import View, ColName, ColType
25
25
  from spells.log import make_verbose
@@ -379,7 +379,7 @@ def _fetch_or_cache(
379
379
 
380
380
  def _base_agg_df(
381
381
  set_code: str,
382
- m: spells.manifest.Manifest,
382
+ m: manifest.Manifest,
383
383
  use_streaming: bool = True,
384
384
  ) -> pl.DataFrame:
385
385
  join_dfs = []
@@ -516,7 +516,7 @@ def summon(
516
516
  this_set_context = None
517
517
 
518
518
  col_def_map = _hydrate_col_defs(code, specs, set_card_context, this_set_context)
519
- m = spells.manifest.create(col_def_map, columns, group_by, filter_spec)
519
+ m = manifest.create(col_def_map, columns, group_by, filter_spec)
520
520
 
521
521
  calc_fn = functools.partial(_base_agg_df, code, m, use_streaming=use_streaming)
522
522
  agg_df = _fetch_or_cache(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.10.9
3
+ Version: 0.10.10
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -1,9 +1,9 @@
1
1
  spells/__init__.py,sha256=0pnh2NLn9FrNKncE9-tBsighp3e8YAsN--_ovUpgWGs,333
2
- spells/cache.py,sha256=5eaxaahfppCOFVEukiPyzGhsE-qv4NPx4Lbu2R-T4pg,5696
2
+ spells/cache.py,sha256=CjMsIOdUz43heJ4IZ5kTWfS_rAeOMFQ1qVAuq3mTWao,6192
3
3
  spells/cards.py,sha256=6stFPhJOzHqvQnkSv9cDeylRa_7L9Y8sOaowiZhzz6I,4174
4
4
  spells/columns.py,sha256=s_PYyg2QaRL6kLWFNKCBEfbMF0x7O7-Yd9SeG1ttYL4,18206
5
5
  spells/config.py,sha256=ixAe_raxKYvJBXyvNBJ-mm6ziRiAvtKLJihyFMnashs,224
6
- spells/draft_data.py,sha256=xoL82NTgTJWxZK1p-6LjxnYzkeYOr-Dc9-_T0m-WZ1Y,19946
6
+ spells/draft_data.py,sha256=1HKYjDu0O8fD2AhUL9Zgw0jVu4lKweJ4KBFMDkH5JLU,19937
7
7
  spells/enums.py,sha256=gbwfon6tQCoKDb-m4hSaHWi9slj82yqaH3qhYMVrsck,4991
8
8
  spells/extension.py,sha256=LBqGbJbe7iSRQkxJK7npkADCfzhdnIwwVvlmTn8xvjQ,8454
9
9
  spells/external.py,sha256=USqOtOVY7Mn39rdUPhmIeGm08s6TDnEV8-N3D14qJzE,11844
@@ -12,8 +12,8 @@ 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.9.dist-info/METADATA,sha256=fTYoWwgKSx9VeSvsd08q7r-Q_KvCn-xcz2tPEHv6Wwo,47369
16
- spells_mtg-0.10.9.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
17
- spells_mtg-0.10.9.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
18
- spells_mtg-0.10.9.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
19
- spells_mtg-0.10.9.dist-info/RECORD,,
15
+ spells_mtg-0.10.10.dist-info/METADATA,sha256=i6Ieaevmfs4OwJD76esBteKTKaf02Miuz_WUUt92WD8,47370
16
+ spells_mtg-0.10.10.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
17
+ spells_mtg-0.10.10.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
18
+ spells_mtg-0.10.10.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
19
+ spells_mtg-0.10.10.dist-info/RECORD,,