halib 0.1.92__tar.gz → 0.1.94__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 (52) hide show
  1. {halib-0.1.92 → halib-0.1.94}/PKG-INFO +2 -2
  2. {halib-0.1.92 → halib-0.1.94}/README.md +1 -1
  3. {halib-0.1.92 → halib-0.1.94}/halib/common.py +53 -10
  4. {halib-0.1.92 → halib-0.1.94}/halib/utils/video.py +6 -0
  5. {halib-0.1.92 → halib-0.1.94}/halib.egg-info/PKG-INFO +2 -2
  6. {halib-0.1.92 → halib-0.1.94}/setup.py +1 -1
  7. {halib-0.1.92 → halib-0.1.94}/.gitignore +0 -0
  8. {halib-0.1.92 → halib-0.1.94}/GDriveFolder.txt +0 -0
  9. {halib-0.1.92 → halib-0.1.94}/LICENSE.txt +0 -0
  10. {halib-0.1.92 → halib-0.1.94}/MANIFEST.in +0 -0
  11. {halib-0.1.92 → halib-0.1.94}/guide_publish_pip.pdf +0 -0
  12. {halib-0.1.92 → halib-0.1.94}/halib/__init__.py +0 -0
  13. {halib-0.1.92 → halib-0.1.94}/halib/cuda.py +0 -0
  14. {halib-0.1.92 → halib-0.1.94}/halib/filetype/__init__.py +0 -0
  15. {halib-0.1.92 → halib-0.1.94}/halib/filetype/csvfile.py +0 -0
  16. {halib-0.1.92 → halib-0.1.94}/halib/filetype/jsonfile.py +0 -0
  17. {halib-0.1.92 → halib-0.1.94}/halib/filetype/textfile.py +0 -0
  18. {halib-0.1.92 → halib-0.1.94}/halib/filetype/videofile.py +0 -0
  19. {halib-0.1.92 → halib-0.1.94}/halib/filetype/yamlfile.py +0 -0
  20. {halib-0.1.92 → halib-0.1.94}/halib/online/__init__.py +0 -0
  21. {halib-0.1.92 → halib-0.1.94}/halib/online/gdrive.py +0 -0
  22. {halib-0.1.92 → halib-0.1.94}/halib/online/gdrive_mkdir.py +0 -0
  23. {halib-0.1.92 → halib-0.1.94}/halib/online/gdrive_test.py +0 -0
  24. {halib-0.1.92 → halib-0.1.94}/halib/online/projectmake.py +0 -0
  25. {halib-0.1.92 → halib-0.1.94}/halib/research/__init__.py +0 -0
  26. {halib-0.1.92 → halib-0.1.94}/halib/research/base_config.py +0 -0
  27. {halib-0.1.92 → halib-0.1.94}/halib/research/base_exp.py +0 -0
  28. {halib-0.1.92 → halib-0.1.94}/halib/research/dataset.py +0 -0
  29. {halib-0.1.92 → halib-0.1.94}/halib/research/metrics.py +0 -0
  30. {halib-0.1.92 → halib-0.1.94}/halib/research/mics.py +0 -0
  31. {halib-0.1.92 → halib-0.1.94}/halib/research/params_gen.py +0 -0
  32. {halib-0.1.92 → halib-0.1.94}/halib/research/perfcalc.py +0 -0
  33. {halib-0.1.92 → halib-0.1.94}/halib/research/perftb.py +0 -0
  34. {halib-0.1.92 → halib-0.1.94}/halib/research/plot.py +0 -0
  35. {halib-0.1.92 → halib-0.1.94}/halib/research/profiler.py +0 -0
  36. {halib-0.1.92 → halib-0.1.94}/halib/research/torchloader.py +0 -0
  37. {halib-0.1.92 → halib-0.1.94}/halib/research/wandb_op.py +0 -0
  38. {halib-0.1.92 → halib-0.1.94}/halib/rich_color.py +0 -0
  39. {halib-0.1.92 → halib-0.1.94}/halib/system/__init__.py +0 -0
  40. {halib-0.1.92 → halib-0.1.94}/halib/system/cmd.py +0 -0
  41. {halib-0.1.92 → halib-0.1.94}/halib/system/filesys.py +0 -0
  42. {halib-0.1.92 → halib-0.1.94}/halib/utils/__init__.py +0 -0
  43. {halib-0.1.92 → halib-0.1.94}/halib/utils/dataclass_util.py +0 -0
  44. {halib-0.1.92 → halib-0.1.94}/halib/utils/dict_op.py +0 -0
  45. {halib-0.1.92 → halib-0.1.94}/halib/utils/gpu_mon.py +0 -0
  46. {halib-0.1.92 → halib-0.1.94}/halib/utils/listop.py +0 -0
  47. {halib-0.1.92 → halib-0.1.94}/halib/utils/tele_noti.py +0 -0
  48. {halib-0.1.92 → halib-0.1.94}/halib.egg-info/SOURCES.txt +0 -0
  49. {halib-0.1.92 → halib-0.1.94}/halib.egg-info/dependency_links.txt +0 -0
  50. {halib-0.1.92 → halib-0.1.94}/halib.egg-info/requires.txt +0 -0
  51. {halib-0.1.92 → halib-0.1.94}/halib.egg-info/top_level.txt +0 -0
  52. {halib-0.1.92 → halib-0.1.94}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.1.92
3
+ Version: 0.1.94
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -52,7 +52,7 @@ Dynamic: summary
52
52
 
53
53
  # Helper package for coding and automation
54
54
 
55
- **Version 0.1.92**
55
+ **Version 0.1.94**
56
56
  + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
57
57
 
58
58
 
@@ -1,6 +1,6 @@
1
1
  # Helper package for coding and automation
2
2
 
3
- **Version 0.1.92**
3
+ **Version 0.1.94**
4
4
  + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
5
5
 
6
6
 
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import re
2
3
  import rich
3
4
  import arrow
@@ -9,6 +10,8 @@ from rich import print
9
10
  from rich.panel import Panel
10
11
  from rich.console import Console
11
12
  from rich.pretty import pprint, Pretty
13
+ from pathlib import PureWindowsPath
14
+
12
15
 
13
16
  console = Console()
14
17
 
@@ -91,18 +94,58 @@ class ConsoleLog:
91
94
  print(f"Exception message: {exc_value}")
92
95
 
93
96
 
94
- def pprint_local_path(local_path, tag=""):
95
- # Create a file URI
96
- file_path = Path(local_path).resolve()
97
- is_file = file_path.is_file()
98
- is_dir = file_path.is_dir()
99
- type_str = "📄" if is_file else "📁" if is_dir else "❓"
100
- file_uri = file_path.as_uri()
97
+ def linux_to_wins_path(path: str) -> str:
98
+ """
99
+ Convert a Linux-style WSL path (/mnt/c/... or /mnt/d/...) to a Windows-style path (C:\...).
100
+ """
101
+ # Handle only /mnt/<drive>/... style
102
+ if (
103
+ path.startswith("/mnt/")
104
+ and len(path) > 6
105
+ and path[5].isalpha()
106
+ and path[6] == "/"
107
+ ):
108
+ drive = path[5].upper() # Extract drive letter
109
+ win_path = f"{drive}:{path[6:]}" # Replace "/mnt/c/" with "C:/"
110
+ else:
111
+ win_path = path # Return unchanged if not a WSL-style path
112
+ # Normalize to Windows-style backslashes
113
+ return str(PureWindowsPath(win_path))
114
+
115
+
116
+ def pprint_local_path(
117
+ local_path: str, get_wins_path: bool = False, tag: str = ""
118
+ ) -> str:
119
+ """
120
+ Pretty-print a local path with emoji and clickable file:// URI.
121
+
122
+ Args:
123
+ local_path: Path to file or directory (Linux or Windows style).
124
+ get_wins_path: If True on Linux, convert WSL-style path to Windows style before printing.
125
+ tag: Optional console log tag.
126
+
127
+ Returns:
128
+ The file URI string.
129
+ """
130
+ p = Path(local_path).resolve()
131
+ type_str = "📄" if p.is_file() else "📁" if p.is_dir() else "❓"
132
+
133
+ if get_wins_path and os.name == "posix":
134
+ # Try WSL → Windows conversion
135
+ converted = linux_to_wins_path(str(p))
136
+ if converted != str(p): # Conversion happened
137
+ file_uri = str(PureWindowsPath(converted).as_uri())
138
+ else:
139
+ file_uri = p.as_uri()
140
+ else:
141
+ file_uri = p.as_uri()
142
+
101
143
  content_str = f"{type_str} [link={file_uri}]{file_uri}[/link]"
102
- if isinstance(tag, str) and len(tag) > 0:
144
+
145
+ if tag:
103
146
  with ConsoleLog(tag):
104
147
  console.print(content_str)
105
148
  else:
106
- # If tag is not provided, just print the link
107
- console.print(f"{content_str}")
149
+ console.print(content_str)
150
+
108
151
  return file_uri
@@ -23,11 +23,17 @@ class VideoUtils:
23
23
  # Get the FPS
24
24
  fps = cap.get(cv2.CAP_PROP_FPS)
25
25
 
26
+ # get frame size
27
+ width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
28
+ height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
29
+
26
30
  # Release the video capture object
27
31
  cap.release()
28
32
 
29
33
  meta_dict = {
30
34
  "video_path": video_path,
35
+ "width": width,
36
+ "height": height,
31
37
  "frame_count": frame_count,
32
38
  "fps": fps
33
39
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.1.92
3
+ Version: 0.1.94
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -52,7 +52,7 @@ Dynamic: summary
52
52
 
53
53
  # Helper package for coding and automation
54
54
 
55
- **Version 0.1.92**
55
+ **Version 0.1.94**
56
56
  + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
57
57
 
58
58
 
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.1.92",
11
+ version="0.1.94",
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