spells-mtg 0.9.1__py3-none-any.whl → 0.9.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/__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/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.debug(f"Cache {key} found")
359
+ logging.info(f"Cache {key} found")
360
360
  return cache.read_cache(set_code, key)
361
361
 
362
- logging.debug(f"Cache not found, calculating with signature {cache_args}")
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.debug(f"Calculating agg df for {code}")
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
@@ -100,7 +100,7 @@ def cli() -> int:
100
100
  def _add(set_code: str, force_download=False):
101
101
  download_data_set(set_code, View.DRAFT, force_download=force_download)
102
102
  write_card_file(set_code, force_download=force_download)
103
- get_set_context(set_code)
103
+ get_set_context(set_code, force_download=force_download)
104
104
  download_data_set(set_code, View.GAME, force_download=force_download)
105
105
  return 0
106
106
 
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
@@ -16,7 +17,7 @@ def setup_logging(
16
17
  log_format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
17
18
  ):
18
19
  log_dir = Path(data_home()) / ".logs"
19
- log_dir.mkdir(exist_ok=True)
20
+ log_dir.mkdir(parents=True, exist_ok=True)
20
21
  log_file_path = log_dir / log_file_name
21
22
 
22
23
  handler = logging.handlers.RotatingFileHandler(
@@ -42,8 +43,9 @@ def rotate_logs():
42
43
 
43
44
 
44
45
  @contextmanager
45
- def add_console_logging():
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(callable: Callable) -> Callable:
61
- def wrapped(*args, verbose=False, **kwargs):
62
- if verbose:
63
- with add_console_logging():
64
- return callable(*args, **kwargs)
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
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.9.1
3
+ Version: 0.9.3
4
4
  Summary: analaysis of 17Lands.com public datasets
5
5
  Author-Email: Joel Barnes <oelarnes@gmail.com>
6
6
  License: MIT
@@ -1,18 +1,18 @@
1
- spells/__init__.py,sha256=bpxhRijyI-wxLPRVNathM9N9Cpq3E8uBSqWyYpDGFAI,275
1
+ spells/__init__.py,sha256=8RdhAbk2VN_ExGZN44JnsD6_4VG30XMBe90w5-1gc3U,302
2
2
  spells/cache.py,sha256=JTFA31quGUL8pxy04NLWjEhQd5GEp37Q4PWUMnMuUJU,3797
3
3
  spells/cards.py,sha256=EOXAB_F2yedjf6KquCERCIHl0TSIJIoOe1jv8g4JzOc,3601
4
4
  spells/columns.py,sha256=PztPNLtqKIqIQdiCHYykk7bcYlx0_QRypu3WOsSZb-A,17856
5
5
  spells/config.py,sha256=HDelOKrEbgMIAJfSGqzJbZdf-sInMZXRD-BI2j0QnZI,180
6
- spells/draft_data.py,sha256=_gzxlpnKa5WlxTfwdnxJhvFvGsTY69bCl0cOe4VRlaI,19271
6
+ spells/draft_data.py,sha256=3YHNn-od8shn9DwnLpOws1qcZXiVb96pbKPEG5JMpDk,19286
7
7
  spells/enums.py,sha256=DL7e1xDEvrsTMbA7vJB_Et1DaYkyO4rIEzvIQDz3MZk,4871
8
8
  spells/extension.py,sha256=DVzIedggeGfkD6BD5g-dko9l9BoPgmXWvcQ3NWdEG0U,6991
9
- spells/external.py,sha256=T34oqhyM5cIFvMAMJwlltdFS4CDeouVMbU-6My60OLg,11305
9
+ spells/external.py,sha256=yt2cwAGIiYp9mjzn1sUOtJFxT61JORPbSUQL1M8j9ko,11336
10
10
  spells/filter.py,sha256=J-YTOOAzOQpvIX29tviYL04RVoOUlfsbjBXoQBDCEdQ,3380
11
- spells/log.py,sha256=-GnocAZ7K-032QohHCY5vC2myRhumuUQCTuq1erTmL4,1819
11
+ spells/log.py,sha256=73cYwVqEN5GiEMKNy_stDMApFNEeyVVJMeecVzdAEXU,1844
12
12
  spells/manifest.py,sha256=dOUmj2uZZ17vCWpFwv7B5F6wOIWnoQdZkEB9SDKdx9M,8310
13
13
  spells/schema.py,sha256=DbMvV8PIThJTp0Xzp_XIorlW6JhE1ud1kWRGf5SQ4_c,6406
14
- spells_mtg-0.9.1.dist-info/METADATA,sha256=VcOjIXJ0q-qvg5aVOW-cwO3PfmV4b3DBhKuC5vY_xLc,46731
15
- spells_mtg-0.9.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
16
- spells_mtg-0.9.1.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
17
- spells_mtg-0.9.1.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
18
- spells_mtg-0.9.1.dist-info/RECORD,,
14
+ spells_mtg-0.9.3.dist-info/METADATA,sha256=ZhiDCy0kBePqAa6cueYd7ki_RY7y_WpvHZWitjL0trs,46731
15
+ spells_mtg-0.9.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
16
+ spells_mtg-0.9.3.dist-info/entry_points.txt,sha256=a9Y1omdl9MdnKuIj3aOodgrp-zZII6OCdvqwgP6BFvI,63
17
+ spells_mtg-0.9.3.dist-info/licenses/LICENSE,sha256=tS54XYbJSgmq5zuHhbsQGbNQLJPVgXqhF5nu2CSRMig,1068
18
+ spells_mtg-0.9.3.dist-info/RECORD,,