spells-mtg 0.9.2__py3-none-any.whl → 0.9.4__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/__init__.py +3 -1
- spells/config.py +2 -0
- spells/draft_data.py +4 -3
- spells/external.py +6 -0
- spells/log.py +9 -9
- {spells_mtg-0.9.2.dist-info → spells_mtg-0.9.4.dist-info}/METADATA +1 -1
- spells_mtg-0.9.4.dist-info/RECORD +18 -0
- spells_mtg-0.9.2.dist-info/RECORD +0 -18
- {spells_mtg-0.9.2.dist-info → spells_mtg-0.9.4.dist-info}/WHEEL +0 -0
- {spells_mtg-0.9.2.dist-info → spells_mtg-0.9.4.dist-info}/entry_points.txt +0 -0
- {spells_mtg-0.9.2.dist-info → spells_mtg-0.9.4.dist-info}/licenses/LICENSE +0 -0
spells/__init__.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
1
3
|
from spells.columns import ColSpec
|
|
2
4
|
from spells.enums import ColType, ColName
|
|
3
5
|
from spells.draft_data import summon, view_select, get_names
|
|
@@ -5,4 +7,4 @@ from spells.log import setup_logging
|
|
|
5
7
|
|
|
6
8
|
setup_logging()
|
|
7
9
|
|
|
8
|
-
__all__ = ["summon", "view_select", "get_names", "ColSpec", "ColType", "ColName"]
|
|
10
|
+
__all__ = ["summon", "view_select", "get_names", "ColSpec", "ColType", "ColName", "logging"]
|
spells/config.py
CHANGED
spells/draft_data.py
CHANGED
|
@@ -356,10 +356,11 @@ def _fetch_or_cache(
|
|
|
356
356
|
|
|
357
357
|
if read_cache:
|
|
358
358
|
if cache.cache_exists(set_code, key):
|
|
359
|
-
logging.
|
|
359
|
+
logging.info(f"Cache {key} found")
|
|
360
360
|
return cache.read_cache(set_code, key)
|
|
361
361
|
|
|
362
|
-
logging.
|
|
362
|
+
logging.info("Cache not found, calculating")
|
|
363
|
+
logging.debug(f"Signature:\n{cache_args}")
|
|
363
364
|
df = calc_fn()
|
|
364
365
|
|
|
365
366
|
if write_cache:
|
|
@@ -490,7 +491,7 @@ def summon(
|
|
|
490
491
|
|
|
491
492
|
concat_dfs = []
|
|
492
493
|
for code in codes:
|
|
493
|
-
logging.
|
|
494
|
+
logging.info(f"Calculating agg df for {code}")
|
|
494
495
|
if isinstance(card_context, pl.DataFrame):
|
|
495
496
|
set_card_context = card_context.filter(pl.col("expansion") == code)
|
|
496
497
|
elif isinstance(card_context, dict):
|
spells/external.py
CHANGED
|
@@ -19,6 +19,7 @@ from polars.exceptions import ComputeError
|
|
|
19
19
|
|
|
20
20
|
from spells import cards
|
|
21
21
|
from spells import cache
|
|
22
|
+
from spells.config import all_sets
|
|
22
23
|
from spells.enums import View, ColName
|
|
23
24
|
from spells.schema import schema
|
|
24
25
|
from spells.draft_data import summon
|
|
@@ -49,6 +50,7 @@ def cli() -> int:
|
|
|
49
50
|
cache.spells_print("spells", f"[data home]={data_dir}")
|
|
50
51
|
print()
|
|
51
52
|
usage = """spells [add|refresh|remove|clean] [set_code]
|
|
53
|
+
spells add all
|
|
52
54
|
spells clean all
|
|
53
55
|
spells info
|
|
54
56
|
|
|
@@ -98,6 +100,10 @@ def cli() -> int:
|
|
|
98
100
|
|
|
99
101
|
|
|
100
102
|
def _add(set_code: str, force_download=False):
|
|
103
|
+
if set_code == 'all':
|
|
104
|
+
for code in all_sets:
|
|
105
|
+
_add(code, force_download=force_download)
|
|
106
|
+
|
|
101
107
|
download_data_set(set_code, View.DRAFT, force_download=force_download)
|
|
102
108
|
write_card_file(set_code, force_download=force_download)
|
|
103
109
|
get_set_context(set_code, force_download=force_download)
|
spells/log.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from contextlib import contextmanager
|
|
2
|
+
from functools import wraps
|
|
2
3
|
import logging
|
|
3
4
|
import logging.handlers
|
|
4
5
|
from pathlib import Path
|
|
@@ -42,8 +43,9 @@ def rotate_logs():
|
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
@contextmanager
|
|
45
|
-
def
|
|
46
|
+
def console_logging(log_level):
|
|
46
47
|
console_handler = logging.StreamHandler(sys.stdout)
|
|
48
|
+
console_handler.setLevel(log_level)
|
|
47
49
|
formatter = logging.Formatter(
|
|
48
50
|
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
49
51
|
)
|
|
@@ -57,12 +59,10 @@ def add_console_logging():
|
|
|
57
59
|
logger.removeHandler(console_handler)
|
|
58
60
|
|
|
59
61
|
|
|
60
|
-
def make_verbose(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
else:
|
|
66
|
-
return callable(*args, **kwargs)
|
|
67
|
-
|
|
62
|
+
def make_verbose(func: Callable) -> Callable:
|
|
63
|
+
@wraps(func)
|
|
64
|
+
def wrapped(*args, logging: int=logging.ERROR, **kwargs):
|
|
65
|
+
with console_logging(logging):
|
|
66
|
+
return func(*args, **kwargs)
|
|
68
67
|
return wrapped
|
|
68
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
spells/__init__.py,sha256=8RdhAbk2VN_ExGZN44JnsD6_4VG30XMBe90w5-1gc3U,302
|
|
2
|
+
spells/cache.py,sha256=JTFA31quGUL8pxy04NLWjEhQd5GEp37Q4PWUMnMuUJU,3797
|
|
3
|
+
spells/cards.py,sha256=EOXAB_F2yedjf6KquCERCIHl0TSIJIoOe1jv8g4JzOc,3601
|
|
4
|
+
spells/columns.py,sha256=PztPNLtqKIqIQdiCHYykk7bcYlx0_QRypu3WOsSZb-A,17856
|
|
5
|
+
spells/config.py,sha256=4Q4F_wNsjXjWONA5uLn_Xu2xPoNm0vcPGqNHWd7khIk,202
|
|
6
|
+
spells/draft_data.py,sha256=3YHNn-od8shn9DwnLpOws1qcZXiVb96pbKPEG5JMpDk,19286
|
|
7
|
+
spells/enums.py,sha256=DL7e1xDEvrsTMbA7vJB_Et1DaYkyO4rIEzvIQDz3MZk,4871
|
|
8
|
+
spells/extension.py,sha256=DVzIedggeGfkD6BD5g-dko9l9BoPgmXWvcQ3NWdEG0U,6991
|
|
9
|
+
spells/external.py,sha256=2qNZal_t4Dd1TU8hDGiZG6g4Vely4NALB6uwQbuMtmM,11510
|
|
10
|
+
spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
|
|
11
|
+
spells/log.py,sha256=73cYwVqEN5GiEMKNy_stDMApFNEeyVVJMeecVzdAEXU,1844
|
|
12
|
+
spells/manifest.py,sha256=dOUmj2uZZ17vCWpFwv7B5F6wOIWnoQdZkEB9SDKdx9M,8310
|
|
13
|
+
spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
|
|
14
|
+
spells_mtg-0.9.4.dist-info/METADATA,sha256=QFFmNQRbq3TIPQR4bJl1qJYg1OApV49-FSCISrpWf2E,46731
|
|
15
|
+
spells_mtg-0.9.4.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
16
|
+
spells_mtg-0.9.4.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
|
|
17
|
+
spells_mtg-0.9.4.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
|
|
18
|
+
spells_mtg-0.9.4.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
spells/__init__.py,sha256=bpxhRijyI-wxLPRVNathM9N9Cpq3E8uBSqWyYpDGFAI,275
|
|
2
|
-
spells/cache.py,sha256=JTFA31quGUL8pxy04NLWjEhQd5GEp37Q4PWUMnMuUJU,3797
|
|
3
|
-
spells/cards.py,sha256=EOXAB_F2yedjf6KquCERCIHl0TSIJIoOe1jv8g4JzOc,3601
|
|
4
|
-
spells/columns.py,sha256=PztPNLtqKIqIQdiCHYykk7bcYlx0_QRypu3WOsSZb-A,17856
|
|
5
|
-
spells/config.py,sha256=HDelOKrEbgMIAJfSGqzJbZdf-sInMZXRD-BI2j0QnZI,180
|
|
6
|
-
spells/draft_data.py,sha256=_gzxlpnKa5WlxTfwdnxJhvFvGsTY69bCl0cOe4VRlaI,19271
|
|
7
|
-
spells/enums.py,sha256=DL7e1xDEvrsTMbA7vJB_Et1DaYkyO4rIEzvIQDz3MZk,4871
|
|
8
|
-
spells/extension.py,sha256=DVzIedggeGfkD6BD5g-dko9l9BoPgmXWvcQ3NWdEG0U,6991
|
|
9
|
-
spells/external.py,sha256=yt2cwAGIiYp9mjzn1sUOtJFxT61JORPbSUQL1M8j9ko,11336
|
|
10
|
-
spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
|
|
11
|
-
spells/log.py,sha256=WJwjw8uduK88ZKRRQnunEa0ImzHR0JtS0FN8iqdYPQI,1833
|
|
12
|
-
spells/manifest.py,sha256=dOUmj2uZZ17vCWpFwv7B5F6wOIWnoQdZkEB9SDKdx9M,8310
|
|
13
|
-
spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
|
|
14
|
-
spells_mtg-0.9.2.dist-info/METADATA,sha256=S7KMeod0IjKH676yGO1hHacdpSPd5xdHqvSZbrSOyuw,46731
|
|
15
|
-
spells_mtg-0.9.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
16
|
-
spells_mtg-0.9.2.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
|
|
17
|
-
spells_mtg-0.9.2.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
|
|
18
|
-
spells_mtg-0.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|