halib 0.2.30__tar.gz → 0.2.31__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.
Files changed (57) hide show
  1. {halib-0.2.30 → halib-0.2.31}/PKG-INFO +2 -2
  2. {halib-0.2.30 → halib-0.2.31}/README.md +1 -1
  3. {halib-0.2.30 → halib-0.2.31}/halib/common/common.py +24 -13
  4. {halib-0.2.30 → halib-0.2.31}/halib.egg-info/PKG-INFO +2 -2
  5. {halib-0.2.30 → halib-0.2.31}/setup.py +1 -1
  6. {halib-0.2.30 → halib-0.2.31}/.gitignore +0 -0
  7. {halib-0.2.30 → halib-0.2.31}/GDriveFolder.txt +0 -0
  8. {halib-0.2.30 → halib-0.2.31}/LICENSE.txt +0 -0
  9. {halib-0.2.30 → halib-0.2.31}/MANIFEST.in +0 -0
  10. {halib-0.2.30 → halib-0.2.31}/halib/__init__.py +0 -0
  11. {halib-0.2.30 → halib-0.2.31}/halib/common/__init__.py +0 -0
  12. {halib-0.2.30 → halib-0.2.31}/halib/common/rich_color.py +0 -0
  13. {halib-0.2.30 → halib-0.2.31}/halib/exp/__init__.py +0 -0
  14. {halib-0.2.30 → halib-0.2.31}/halib/exp/core/__init__.py +0 -0
  15. {halib-0.2.30 → halib-0.2.31}/halib/exp/core/base_config.py +0 -0
  16. {halib-0.2.30 → halib-0.2.31}/halib/exp/core/base_exp.py +0 -0
  17. {halib-0.2.30 → halib-0.2.31}/halib/exp/core/param_gen.py +0 -0
  18. {halib-0.2.30 → halib-0.2.31}/halib/exp/core/wandb_op.py +0 -0
  19. {halib-0.2.30 → halib-0.2.31}/halib/exp/data/__init__.py +0 -0
  20. {halib-0.2.30 → halib-0.2.31}/halib/exp/data/dataclass_util.py +0 -0
  21. {halib-0.2.30 → halib-0.2.31}/halib/exp/data/dataset.py +0 -0
  22. {halib-0.2.30 → halib-0.2.31}/halib/exp/data/torchloader.py +0 -0
  23. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/__init__.py +0 -0
  24. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/flop_calc.py +0 -0
  25. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/gpu_mon.py +0 -0
  26. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/perfcalc.py +0 -0
  27. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/perfmetrics.py +0 -0
  28. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/perftb.py +0 -0
  29. {halib-0.2.30 → halib-0.2.31}/halib/exp/perf/profiler.py +0 -0
  30. {halib-0.2.30 → halib-0.2.31}/halib/exp/viz/__init__.py +0 -0
  31. {halib-0.2.30 → halib-0.2.31}/halib/exp/viz/plot.py +0 -0
  32. {halib-0.2.30 → halib-0.2.31}/halib/filetype/__init__.py +0 -0
  33. {halib-0.2.30 → halib-0.2.31}/halib/filetype/csvfile.py +0 -0
  34. {halib-0.2.30 → halib-0.2.31}/halib/filetype/ipynb.py +0 -0
  35. {halib-0.2.30 → halib-0.2.31}/halib/filetype/jsonfile.py +0 -0
  36. {halib-0.2.30 → halib-0.2.31}/halib/filetype/textfile.py +0 -0
  37. {halib-0.2.30 → halib-0.2.31}/halib/filetype/videofile.py +0 -0
  38. {halib-0.2.30 → halib-0.2.31}/halib/filetype/yamlfile.py +0 -0
  39. {halib-0.2.30 → halib-0.2.31}/halib/online/__init__.py +0 -0
  40. {halib-0.2.30 → halib-0.2.31}/halib/online/gdrive.py +0 -0
  41. {halib-0.2.30 → halib-0.2.31}/halib/online/gdrive_mkdir.py +0 -0
  42. {halib-0.2.30 → halib-0.2.31}/halib/online/projectmake.py +0 -0
  43. {halib-0.2.30 → halib-0.2.31}/halib/online/tele_noti.py +0 -0
  44. {halib-0.2.30 → halib-0.2.31}/halib/system/__init__.py +0 -0
  45. {halib-0.2.30 → halib-0.2.31}/halib/system/_list_pc.csv +0 -0
  46. {halib-0.2.30 → halib-0.2.31}/halib/system/cmd.py +0 -0
  47. {halib-0.2.30 → halib-0.2.31}/halib/system/filesys.py +0 -0
  48. {halib-0.2.30 → halib-0.2.31}/halib/system/path.py +0 -0
  49. {halib-0.2.30 → halib-0.2.31}/halib/utils/__init__.py +0 -0
  50. {halib-0.2.30 → halib-0.2.31}/halib/utils/dict.py +0 -0
  51. {halib-0.2.30 → halib-0.2.31}/halib/utils/list.py +0 -0
  52. {halib-0.2.30 → halib-0.2.31}/halib/utils/slack.py +0 -0
  53. {halib-0.2.30 → halib-0.2.31}/halib.egg-info/SOURCES.txt +0 -0
  54. {halib-0.2.30 → halib-0.2.31}/halib.egg-info/dependency_links.txt +0 -0
  55. {halib-0.2.30 → halib-0.2.31}/halib.egg-info/requires.txt +0 -0
  56. {halib-0.2.30 → halib-0.2.31}/halib.egg-info/top_level.txt +0 -0
  57. {halib-0.2.30 → halib-0.2.31}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.2.30
3
+ Version: 0.2.31
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -57,7 +57,7 @@ Dynamic: summary
57
57
 
58
58
  ## v0.2.x (Experiment & Core Updates)
59
59
 
60
- ### **v0.2.30**
60
+ ### **v0.2.31**
61
61
 
62
62
  - ✨ **New Feature:**: add `common.common.log_func` as decorator to log function entry, exit, with execution time and arguments.
63
63
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## v0.2.x (Experiment & Core Updates)
4
4
 
5
- ### **v0.2.30**
5
+ ### **v0.2.31**
6
6
 
7
7
  - ✨ **New Feature:**: add `common.common.log_func` as decorator to log function entry, exit, with execution time and arguments.
8
8
 
@@ -261,39 +261,50 @@ def pprint_local_path(
261
261
 
262
262
 
263
263
  def log_func(
264
- func: Optional[Callable] = None, *, log_time: bool = False, log_args: bool = False
264
+ func: Optional[Callable] = None,
265
+ *,
266
+ log_time: bool = False,
267
+ log_args: bool = False,
268
+ skip_idxs: Optional[List[int]] = None, # New parameter
265
269
  ):
266
270
  """
267
- A decorator that logs the start/end of a function.
268
- Supports both @log_func and @log_func(log_time=True) usage.
271
+ Enhanced decorator that logs arguments line-by-line and allows skipping indices.
269
272
  """
270
- # 1. HANDLE ARGUMENTS: If called as @log_func(log_time=True), func is None.
271
- # We return a 'partial' function that remembers the args and waits for the func.
272
273
  if func is None:
273
- return functools.partial(log_func, log_time=log_time, log_args=log_args)
274
+ return functools.partial(
275
+ log_func, log_time=log_time, log_args=log_args, skip_idxs=skip_idxs
276
+ )
274
277
 
275
- # 2. HANDLE DECORATION: If called as @log_func, func is the actual function.
276
278
  @functools.wraps(func)
277
279
  def wrapper(*args, **kwargs):
278
- # Safe way to get name (handles partials/lambdas)
279
280
  func_name = getattr(func, "__name__", "Unknown_Func")
281
+ skip_list = skip_idxs or []
280
282
 
281
- # Note: Ensure 'ConsoleLog' context manager is available in your scope
282
283
  with ConsoleLog(func_name):
283
284
  start = time.perf_counter()
284
285
  try:
285
286
  result = func(*args, **kwargs)
286
287
  finally:
287
- # We use finally to ensure logging happens even if func crashes
288
288
  end = time.perf_counter()
289
289
 
290
290
  if log_time or log_args:
291
-
292
291
  console.print(pad_string(f"Func <{func_name}> summary", 80))
292
+
293
+ if log_args:
294
+ console.print(f"--- Arguments for {func_name} ---")
295
+ # Log Positional Args line-by-line
296
+ for i, val in enumerate(args):
297
+ if i in skip_list:
298
+ console.print(f" arg[{i}]: <SKIPPED>")
299
+ continue
300
+ pprint(f" arg[{i}]: \n {val}")
301
+
302
+ # Log Keyword Args line-by-line
303
+ for k, v in kwargs.items():
304
+ pprint(f" {k}: \n {v}")
305
+
293
306
  if log_time:
294
307
  console.print(f"{func_name} took {end - start:.6f} seconds")
295
- if log_args:
296
- console.print(f"Args: {args}, Kwargs: {kwargs}")
297
308
 
298
309
  return result
299
310
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.2.30
3
+ Version: 0.2.31
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -57,7 +57,7 @@ Dynamic: summary
57
57
 
58
58
  ## v0.2.x (Experiment & Core Updates)
59
59
 
60
- ### **v0.2.30**
60
+ ### **v0.2.31**
61
61
 
62
62
  - ✨ **New Feature:**: add `common.common.log_func` as decorator to log function entry, exit, with execution time and arguments.
63
63
 
@@ -8,7 +8,7 @@ with open("requirements.txt", "r", encoding="utf-8") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.2.30",
11
+ version="0.2.31",
12
12
  author="Hoang Van Ha",
13
13
  author_email="hoangvanhauit@gmail.com",
14
14
  description="Small library for common tasks",
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes