spells-mtg 0.9.2__tar.gz → 0.9.3__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spells-mtg
3
- Version: 0.9.2
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
@@ -11,7 +11,7 @@ dependencies = [
11
11
  ]
12
12
  requires-python = ">=3.11"
13
13
  readme = "README.md"
14
- version = "0.9.2"
14
+ version = "0.9.3"
15
15
 
16
16
  [project.license]
17
17
  text = "MIT"
@@ -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"]
@@ -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):
@@ -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 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
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes