thds.core 1.31.20250211013621__py3-none-any.whl → 1.31.20250211170628__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 thds.core might be problematic. Click here for more details.

@@ -14,7 +14,7 @@ from typing import Iterator, Tuple
14
14
  from .. import config, home
15
15
  from .json_formatter import ThdsJsonFormatter
16
16
  from .kw_formatter import ThdsCompactFormatter
17
- from .kw_logger import getLogger, make_th_formatters_safe
17
+ from .kw_logger import LOGLEVEL, getLogger, make_th_formatters_safe
18
18
  from .logfmt import mk_default_logfmter
19
19
 
20
20
  _LOG_FILEPATH = os.getenv(
@@ -36,7 +36,6 @@ _LOG_FILEPATH = os.getenv(
36
36
  )
37
37
 
38
38
 
39
- _LOGLEVEL = config.item("thds.core.log.level", logging.INFO, parse=logging.getLevelName)
40
39
  _LOGLEVELS_FILEPATH = config.item("thds.core.log.levels_file", "", parse=lambda s: s.strip())
41
40
  # see _parse_thds_loglevels_file for format of this file.
42
41
 
@@ -57,13 +56,13 @@ _BASE_LOG_CONFIG = {
57
56
  "disable_existing_loggers": False,
58
57
  "formatters": {"default": {"()": _pick_formatter()}},
59
58
  "handlers": {"console": {"class": "logging.StreamHandler", "formatter": "default"}},
60
- "root": {"handlers": ["console"], "level": _LOGLEVEL()},
59
+ "root": {"handlers": ["console"]},
61
60
  }
62
61
 
63
62
 
64
63
  def set_logger_to_console_level(config: dict, logger_name: str, level: int) -> dict:
65
64
  if logger_name == "*":
66
- if level != _LOGLEVEL():
65
+ if level != LOGLEVEL():
67
66
  getLogger(__name__).warning(f"Setting root logger to {logging.getLevelName(level)}")
68
67
  return dict(config, root=dict(config["root"], level=level))
69
68
  loggers = config.get("loggers") or dict()
@@ -96,7 +95,7 @@ def _parse_thds_loglevels_file(filepath: str) -> Iterator[Tuple[str, int]]:
96
95
  The last value encountered for any given logger (or the root) will
97
96
  override any previous values.
98
97
  """
99
- current_level = _LOGLEVEL()
98
+ current_level = LOGLEVEL()
100
99
  if not os.path.exists(filepath):
101
100
  return
102
101
  with open(filepath) as f:
@@ -8,8 +8,10 @@ import logging.config
8
8
  from copy import copy
9
9
  from typing import Any, Dict, MutableMapping, Optional
10
10
 
11
+ from .. import config
11
12
  from ..stack_context import StackContext
12
13
 
14
+ LOGLEVEL = config.item("thds.core.log.level", logging.INFO, parse=logging.getLevelName)
13
15
  _LOGGING_KWARGS = ("exc_info", "stack_info", "stacklevel", "extra")
14
16
  # These are the officially accepted keyword-arguments for a call to
15
17
  # log something with the logger. Anything passed with these names
@@ -72,6 +74,9 @@ def getLogger(name: Optional[str] = None) -> logging.LoggerAdapter:
72
74
  when configuring logging yourself, just put a "%(th_context)s" format specifier somewhere in your
73
75
  log message format.
74
76
  """
77
+ logger = logging.getLogger(name)
78
+ if logger.level == logging.NOTSET:
79
+ logger.setLevel(LOGLEVEL())
75
80
  return KwLogger(logging.getLogger(name), dict())
76
81
 
77
82
 
thds/core/meta.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "git_commit": "e83acfbb545ab3f20b03a45161c1c6d0d342c8e2",
2
+ "git_commit": "f9946d77e2e81fa086911ce48597dce565047489",
3
3
  "git_branch": "main",
4
4
  "git_is_clean": true,
5
- "pyproject_version": "1.31.20250211013621",
5
+ "pyproject_version": "1.31.20250211170628",
6
6
  "thds_user": "runner",
7
7
  "misc": {}
8
8
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: thds.core
3
- Version: 1.31.20250211013621
3
+ Version: 1.31.20250211170628
4
4
  Summary: Core utilities.
5
5
  Author: Trilliant Health
6
6
  Description-Content-Type: text/markdown
@@ -22,7 +22,7 @@ thds/core/iterators.py,sha256=d3iTQDR0gCW1nMRmknQeodR_4THzR9Ajmp8F8KCCFgg,208
22
22
  thds/core/lazy.py,sha256=e1WvG4LsbEydV0igEr_Vl1cq05zlQNIE8MFYT90yglE,3289
23
23
  thds/core/link.py,sha256=kmFJIFvEZc16-7S7IGvtTpzwl3VuvFl3yPlE6WJJ03w,5404
24
24
  thds/core/merge_args.py,sha256=7oj7dtO1-XVkfTM3aBlq3QlZbo8tb6X7E3EVIR-60t8,5781
25
- thds/core/meta.json,sha256=jqs9NLSEW2ZOo8qS-VxkW3F_gsI5Y_G6RgdaIevsNoY,196
25
+ thds/core/meta.json,sha256=LabMqsO8HqHU9yvR-ileqeFfakRn19RZs31RqkYnExU,196
26
26
  thds/core/meta.py,sha256=IPLAKrH06HooPMNf5FeqJvUcM-JljTGXddrAQ5oAX8E,16896
27
27
  thds/core/parallel.py,sha256=HXAn9aIYqNE5rnRN5ypxR6CUucdfzE5T5rJ_MUv-pFk,7590
28
28
  thds/core/pickle_visit.py,sha256=QNMWIi5buvk2zsvx1-D-FKL7tkrFUFDs387vxgGebgU,833
@@ -40,10 +40,10 @@ thds/core/timer.py,sha256=1FfcQ4-Gp6WQFXR0GKeT_8jwtamEfnTukdSbDKTAJVM,5432
40
40
  thds/core/tmp.py,sha256=KgBAwQCmpm7I762eLRu-3MSfH3dKnqlrJkZ5nmPcRbc,3110
41
41
  thds/core/types.py,sha256=Pbo5bF3b14V8eeabpnffWOPJDAGrMcKBCh5e-ZvipJk,70
42
42
  thds/core/log/__init__.py,sha256=bDbZvlxyymY6VrQzD8lCn0egniLEiA9hpNMAXZ7e7wY,1348
43
- thds/core/log/basic_config.py,sha256=WQDpLKFgu-BTdR22LMnGDK3jk4CUbP94JrjSsHgAjjg,6216
43
+ thds/core/log/basic_config.py,sha256=124QSR7rpdKBcor_Nb6yogskVCW_VeSIvBPTblO9Cdc,6113
44
44
  thds/core/log/json_formatter.py,sha256=C5bRsSbAqaQqfTm88jc3mYe3vwKZZLAxET8s7_u7aN0,1757
45
45
  thds/core/log/kw_formatter.py,sha256=9-MVOd2r5NEkYNne9qWyFMeR5lac3w7mjHXsDa681i0,3379
46
- thds/core/log/kw_logger.py,sha256=k9nckB0RRYU-X8Ols-pnxU_UuL6kqvtDs6MOi5JE7XY,3841
46
+ thds/core/log/kw_logger.py,sha256=CyZVPnkUMtrUL2Lyk261AIEPmoP-buf_suFAhQlU1io,4063
47
47
  thds/core/log/logfmt.py,sha256=qS6BbdlOZPRnxmHenVL3uK43OQ30NJUnz92S6d_Yh2A,10360
48
48
  thds/core/sqlite/__init__.py,sha256=tDMzuO76qTtckJHldPQ6nPZ6kcvhhoJrVuuW42JtaSQ,606
49
49
  thds/core/sqlite/connect.py,sha256=l4QaSAI8RjP7Qh2FjmJ3EwRgfGf65Z3-LjtC9ocHM_U,977
@@ -60,8 +60,8 @@ thds/core/sqlite/structured.py,sha256=swCbDoyVT6cE7Kl79Wh_rg5Z1-yrUDJbiVJF4bjset
60
60
  thds/core/sqlite/types.py,sha256=oUkfoKRYNGDPZRk29s09rc9ha3SCk2SKr_K6WKebBFs,1308
61
61
  thds/core/sqlite/upsert.py,sha256=BmKK6fsGVedt43iY-Lp7dnAu8aJ1e9CYlPVEQR2pMj4,5827
62
62
  thds/core/sqlite/write.py,sha256=z0219vDkQDCnsV0WLvsj94keItr7H4j7Y_evbcoBrWU,3458
63
- thds.core-1.31.20250211013621.dist-info/METADATA,sha256=V3wiRkSb8WjTQJlqWoD8bSEuH5N4-iXbefbSKYVIhIU,2123
64
- thds.core-1.31.20250211013621.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
65
- thds.core-1.31.20250211013621.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
66
- thds.core-1.31.20250211013621.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
67
- thds.core-1.31.20250211013621.dist-info/RECORD,,
63
+ thds.core-1.31.20250211170628.dist-info/METADATA,sha256=1z309PVcdM3TkswUS56IbH8ftAXWEL1oi9M3MAZG6PI,2123
64
+ thds.core-1.31.20250211170628.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
65
+ thds.core-1.31.20250211170628.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
66
+ thds.core-1.31.20250211170628.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
67
+ thds.core-1.31.20250211170628.dist-info/RECORD,,