dycw-utilities 0.129.5__py3-none-any.whl → 0.129.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.129.5
3
+ Version: 0.129.6
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=VYvwBtGYvSwQY0mv7POe3-AmpXnW7P3VB6J_-XdD9Vk,60
1
+ utilities/__init__.py,sha256=Odk_y5HDH2OquSZJAdWdoTST_nZpx27fTwquoNg32dI,60
2
2
  utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
3
3
  utilities/asyncio.py,sha256=3n5EIcSq2xtEF1i4oR0oY2JmBq3NyugeHKFK39Mt22s,37987
4
4
  utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
@@ -29,7 +29,7 @@ utilities/iterables.py,sha256=mDqw2_0MUVp-P8FklgcaVTi2TXduH0MxbhTDzzhSBho,44915
29
29
  utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
30
30
  utilities/libcst.py,sha256=Jto5ppzRzsxn4AD32IS8n0lbgLYXwsVJB6EY8giNZyY,4974
31
31
  utilities/lightweight_charts.py,sha256=0xNfcsrgFI0R9xL25LtSm-W5yhfBI93qQNT6HyaXAhg,2769
32
- utilities/logging.py,sha256=hqV_KSX4itxwplxH8tTYx3IopF6M75SMnlQvTjfJBSM,24653
32
+ utilities/logging.py,sha256=9vo6vz4sDMoF2nkc8eT-eWpymBb5QboIu0kMhEwPiqk,25206
33
33
  utilities/loguru.py,sha256=MEMQVWrdECxk1e3FxGzmOf21vWT9j8CAir98SEXFKPA,3809
34
34
  utilities/luigi.py,sha256=fpH9MbxJDuo6-k9iCXRayFRtiVbUtibCJKugf7ygpv0,5988
35
35
  utilities/math.py,sha256=-mQgbah-dPJwOEWf3SonrFoVZ2AVxMgpeQ3dfVa-oJA,26764
@@ -89,7 +89,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
89
89
  utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
90
90
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
91
91
  utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
92
- dycw_utilities-0.129.5.dist-info/METADATA,sha256=GBhDqoji8XSD0ML-I_7PBcUZMS3_zFhbIM3UXxUZ3CU,12803
93
- dycw_utilities-0.129.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
- dycw_utilities-0.129.5.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.129.5.dist-info/RECORD,,
92
+ dycw_utilities-0.129.6.dist-info/METADATA,sha256=tC_nJcnk-38KjYuNvAhfUg4mKnytwE71-7ndZfBs0bQ,12803
93
+ dycw_utilities-0.129.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
+ dycw_utilities-0.129.6.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.129.6.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.129.5"
3
+ __version__ = "0.129.6"
utilities/logging.py CHANGED
@@ -415,16 +415,26 @@ def add_filters(handler: Handler, /, *filters: _FilterType) -> None:
415
415
 
416
416
  def basic_config(
417
417
  *,
418
- format: str = "{asctime} | {name} | {levelname:8} | {message}", # noqa: A002
418
+ logger: LoggerOrName | None = None,
419
+ format_: str = "{asctime} | {name} | {levelname:8} | {message}",
419
420
  level: LogLevel = "INFO",
420
421
  ) -> None:
421
422
  """Do the basic config."""
422
- basicConfig(
423
- format=format,
424
- datefmt=maybe_sub_pct_y("%Y-%m-%d %H:%M:%S"),
425
- style="{",
426
- level=level,
427
- )
423
+ datefmt = maybe_sub_pct_y("%Y-%m-%d %H:%M:%S")
424
+ if logger is None:
425
+ basicConfig(format=format_, datefmt=datefmt, style="{", level=level)
426
+ else:
427
+ logger_use = get_logger(logger=logger)
428
+ logger_use.setLevel(level)
429
+ logger_use.addHandler(handler := StreamHandler())
430
+ handler.setLevel(level)
431
+ try:
432
+ from coloredlogs import ColoredFormatter
433
+ except ModuleNotFoundError: # pragma: no cover
434
+ formatter = Formatter(fmt=format_, datefmt=datefmt, style="{")
435
+ else:
436
+ formatter = ColoredFormatter(fmt=format_, datefmt=datefmt, style="{")
437
+ handler.setFormatter(formatter)
428
438
 
429
439
 
430
440
  ##