Skip to content

Commit

Permalink
Chore: publish; Update: save fig log; pl for dict key
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanHeng committed Mar 9, 2024
1 parent 7f9667c commit c517902
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

VERSION = '0.37.2'
VERSION = '0.37.3'
DESCRIPTION = 'Machine Learning project startup utilities'
LONG_DESCRIPTION = 'My commonly used utilities for machine learning projects'

Expand All @@ -13,7 +13,7 @@
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url='https://github.com/StefanHeng/stef-util',
download_url='https://github.com/StefanHeng/stef-util/archive/refs/tags/v0.37.2.tar.gz',
download_url='https://github.com/StefanHeng/stef-util/archive/refs/tags/v0.37.3.tar.gz',
packages=find_packages(),
include_package_data=True,
install_requires=[
Expand Down
11 changes: 10 additions & 1 deletion stefutil/prettier.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def _log_val(v):
for k, v_ in d.items():
if align == 'curr' and max_c is not None:
k = f'{k:<{max_c}}'
# no coloring, but still try to make it more compact, e.g. string tuple processing
k = PrettyLogger.i(k, with_color=False, for_path=for_path)
if omit_none_val and v_ is None:
pairs.append(k)
else:
Expand Down Expand Up @@ -973,4 +975,11 @@ def check_align_edge():
(d3, 2)
]:
print(pl.i(d, align_keys=aln, indent=True))
check_align_edge()
# check_align_edge()

def check_dict_tup_key():
d = {(1, 2): 3, ('foo', 'bar'): 4}
print(pl.i(d))
d = dict(a=1, b=2)
print(pl.i(d))
check_dict_tup_key()
4 changes: 2 additions & 2 deletions stefutil/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import List, Dict, Union

from stefutil.container import get
from stefutil.os_n_file import stem
from stefutil.prettier import now, ca, get_logger, pl


Expand Down Expand Up @@ -139,5 +140,4 @@ def save_fig(
args.update(kwargs)
plt.savefig(path, **args)
if self.verbose:
d_log = dict(title=title, path=path)
logger.info(f'Saved figure w/ {pl.i(d_log)}')
logger.info(f'Saved figure to {pl.i(stem(path, top_n=2))}')

0 comments on commit c517902

Please sign in to comment.