spells-mtg 0.9.6__py3-none-any.whl → 0.9.8__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 +9 -1
- spells/cards.py +7 -1
- spells/config.py +1 -0
- spells/draft_data.py +9 -1
- spells/external.py +1 -1
- spells/log.py +12 -5
- {spells_mtg-0.9.6.dist-info → spells_mtg-0.9.8.dist-info}/METADATA +1 -1
- spells_mtg-0.9.8.dist-info/RECORD +18 -0
- spells_mtg-0.9.6.dist-info/RECORD +0 -18
- {spells_mtg-0.9.6.dist-info → spells_mtg-0.9.8.dist-info}/WHEEL +0 -0
- {spells_mtg-0.9.6.dist-info → spells_mtg-0.9.8.dist-info}/entry_points.txt +0 -0
- {spells_mtg-0.9.6.dist-info → spells_mtg-0.9.8.dist-info}/licenses/LICENSE +0 -0
spells/__init__.py
CHANGED
|
@@ -7,4 +7,12 @@ from spells.log import setup_logging
|
|
|
7
7
|
|
|
8
8
|
setup_logging()
|
|
9
9
|
|
|
10
|
-
__all__ = [
|
|
10
|
+
__all__ = [
|
|
11
|
+
"summon",
|
|
12
|
+
"view_select",
|
|
13
|
+
"get_names",
|
|
14
|
+
"ColSpec",
|
|
15
|
+
"ColType",
|
|
16
|
+
"ColName",
|
|
17
|
+
"logging",
|
|
18
|
+
]
|
spells/cards.py
CHANGED
|
@@ -78,7 +78,13 @@ def card_df(draft_set_code: str, names: list[str]) -> pl.DataFrame:
|
|
|
78
78
|
draft_set_json = _fetch_mtg_json(draft_set_code)
|
|
79
79
|
booster_info = draft_set_json["data"]["booster"]
|
|
80
80
|
|
|
81
|
-
booster_type =
|
|
81
|
+
booster_type = (
|
|
82
|
+
"play"
|
|
83
|
+
if "play" in booster_info
|
|
84
|
+
else "draft"
|
|
85
|
+
if "draft" in booster_info
|
|
86
|
+
else list(booster_info.keys())[0]
|
|
87
|
+
)
|
|
82
88
|
set_codes = booster_info[booster_type]["sourceSetCodes"]
|
|
83
89
|
set_codes.reverse()
|
|
84
90
|
|
spells/config.py
CHANGED
spells/draft_data.py
CHANGED
|
@@ -148,6 +148,10 @@ def _determine_expression(
|
|
|
148
148
|
)
|
|
149
149
|
)
|
|
150
150
|
except KeyError:
|
|
151
|
+
logging.warning(
|
|
152
|
+
f"KeyError raised in calculation of {col}, probably caused by "
|
|
153
|
+
+ "missing context. Column will have value `None`"
|
|
154
|
+
)
|
|
151
155
|
expr = tuple(pl.lit(None).alias(f"{col}_{name}") for name in names)
|
|
152
156
|
else:
|
|
153
157
|
expr = tuple(map(lambda name: pl.col(f"{col}_{name}"), names))
|
|
@@ -233,7 +237,11 @@ def _infer_dependencies(
|
|
|
233
237
|
):
|
|
234
238
|
dependencies.add(split[0])
|
|
235
239
|
found = True
|
|
236
|
-
|
|
240
|
+
if not found:
|
|
241
|
+
logging.warning(
|
|
242
|
+
f"No column definition found matching dependency {item}! "
|
|
243
|
+
+ "`summon` will fail if called with this column"
|
|
244
|
+
)
|
|
237
245
|
|
|
238
246
|
return dependencies
|
|
239
247
|
|
spells/external.py
CHANGED
spells/log.py
CHANGED
|
@@ -42,8 +42,7 @@ def rotate_logs():
|
|
|
42
42
|
logging.debug("Log file manually rotated")
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
def console_logging(log_level):
|
|
45
|
+
def add_console_handler(log_level):
|
|
47
46
|
console_handler = logging.StreamHandler(sys.stdout)
|
|
48
47
|
console_handler.setLevel(log_level)
|
|
49
48
|
formatter = logging.Formatter(
|
|
@@ -52,19 +51,27 @@ def console_logging(log_level):
|
|
|
52
51
|
console_handler.setFormatter(formatter)
|
|
53
52
|
logger = logging.getLogger()
|
|
54
53
|
logger.addHandler(console_handler)
|
|
54
|
+
return logger, console_handler
|
|
55
|
+
|
|
55
56
|
|
|
57
|
+
@contextmanager
|
|
58
|
+
def console_logging(log_level):
|
|
59
|
+
logger, console_handler = add_console_handler(log_level)
|
|
56
60
|
try:
|
|
57
61
|
yield
|
|
58
62
|
finally:
|
|
59
63
|
logger.removeHandler(console_handler)
|
|
60
64
|
|
|
61
65
|
|
|
62
|
-
def make_verbose(level: int=
|
|
66
|
+
def make_verbose(level: int | None = None) -> Callable:
|
|
63
67
|
def decorator(func: Callable) -> Callable:
|
|
64
68
|
@wraps(func)
|
|
65
|
-
def wrapped(*args, log_to_console: int=level, **kwargs):
|
|
69
|
+
def wrapped(*args, log_to_console: int | None = level, **kwargs):
|
|
70
|
+
if log_to_console is None:
|
|
71
|
+
return func(*args, **kwargs)
|
|
66
72
|
with console_logging(log_to_console):
|
|
67
73
|
return func(*args, **kwargs)
|
|
74
|
+
|
|
68
75
|
return wrapped
|
|
69
|
-
return decorator
|
|
70
76
|
|
|
77
|
+
return decorator
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
spells/__init__.py,sha256=0pnh2NLn9FrNKncE9-tBsighp3e8YAsN--_ovUpgWGs,333
|
|
2
|
+
spells/cache.py,sha256=7XDcltmlpagK2nkhuCCcAQVyrFMYkw9Acr7iVsLs3JU,3799
|
|
3
|
+
spells/cards.py,sha256=uYOnFXroAuUpMB0NuuBcAZ1n5OtNTQyq1mvK3ctls6Q,3710
|
|
4
|
+
spells/columns.py,sha256=PztPNLtqKIqIQdiCHYykk7bcYlx0_QRypu3WOsSZb-A,17856
|
|
5
|
+
spells/config.py,sha256=_t98dc_uY3Wp3d5tsU3CJgVcWOD3wVlwMo98-tN2KRY,213
|
|
6
|
+
spells/draft_data.py,sha256=DpbKEcv-tTCJ1-R9-_lS-H8oejYl-2OEcUDSUDsRtJI,19626
|
|
7
|
+
spells/enums.py,sha256=DL7e1xDEvrsTMbA7vJB_Et1DaYkyO4rIEzvIQDz3MZk,4871
|
|
8
|
+
spells/extension.py,sha256=DVzIedggeGfkD6BD5g-dko9l9BoPgmXWvcQ3NWdEG0U,6991
|
|
9
|
+
spells/external.py,sha256=ukcEWiu6aLJYJgQlRMAH6EmdZ2OZUFPEr54KdWnR5ug,11510
|
|
10
|
+
spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
|
|
11
|
+
spells/log.py,sha256=3avmg65hru8K9npKLvPp1wWWxq-hoEYDUCbxqhPkKUw,2175
|
|
12
|
+
spells/manifest.py,sha256=dOUmj2uZZ17vCWpFwv7B5F6wOIWnoQdZkEB9SDKdx9M,8310
|
|
13
|
+
spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
|
|
14
|
+
spells_mtg-0.9.8.dist-info/METADATA,sha256=TApjATiI8kkKGHCEEEFNhKdmtxUENMD-Qr1VLtDqMic,47007
|
|
15
|
+
spells_mtg-0.9.8.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
16
|
+
spells_mtg-0.9.8.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
|
|
17
|
+
spells_mtg-0.9.8.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
|
|
18
|
+
spells_mtg-0.9.8.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
spells/__init__.py,sha256=8RdhAbk2VN_ExGZN44JnsD6_4VG30XMBe90w5-1gc3U,302
|
|
2
|
-
spells/cache.py,sha256=7XDcltmlpagK2nkhuCCcAQVyrFMYkw9Acr7iVsLs3JU,3799
|
|
3
|
-
spells/cards.py,sha256=m3r4tdGod0PHH92Va0KZT1vUBmu912KiMIf7w4p2R8g,3662
|
|
4
|
-
spells/columns.py,sha256=PztPNLtqKIqIQdiCHYykk7bcYlx0_QRypu3WOsSZb-A,17856
|
|
5
|
-
spells/config.py,sha256=4Q4F_wNsjXjWONA5uLn_Xu2xPoNm0vcPGqNHWd7khIk,202
|
|
6
|
-
spells/draft_data.py,sha256=zwXekeML4Gfr7Ejb71KfunY8O2oj8FrKOvkZc99oliw,19288
|
|
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=mGTrwOpiHyqqlUpEf0r790LceQ500ucb537QZqUnNY4,1948
|
|
12
|
-
spells/manifest.py,sha256=dOUmj2uZZ17vCWpFwv7B5F6wOIWnoQdZkEB9SDKdx9M,8310
|
|
13
|
-
spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
|
|
14
|
-
spells_mtg-0.9.6.dist-info/METADATA,sha256=bFYn3dv3FKAfrm__paesjt5cfBS0EEZAJuFgx1ykCQ4,47007
|
|
15
|
-
spells_mtg-0.9.6.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
16
|
-
spells_mtg-0.9.6.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
|
|
17
|
-
spells_mtg-0.9.6.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
|
|
18
|
-
spells_mtg-0.9.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|