halib 0.1.39__tar.gz → 0.1.41__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.
- {halib-0.1.39/halib.egg-info → halib-0.1.41}/PKG-INFO +7 -1
- {halib-0.1.39 → halib-0.1.41}/README.md +6 -0
- {halib-0.1.39 → halib-0.1.41}/halib/__init__.py +5 -0
- {halib-0.1.39 → halib-0.1.41}/halib/common.py +0 -1
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/csvfile.py +26 -0
- halib-0.1.41/halib/rich_color.py +259 -0
- {halib-0.1.39 → halib-0.1.41/halib.egg-info}/PKG-INFO +7 -1
- {halib-0.1.39 → halib-0.1.41}/halib.egg-info/SOURCES.txt +1 -0
- {halib-0.1.39 → halib-0.1.41}/halib.egg-info/requires.txt +4 -2
- {halib-0.1.39 → halib-0.1.41}/setup.py +1 -1
- {halib-0.1.39 → halib-0.1.41}/.gitignore +0 -0
- {halib-0.1.39 → halib-0.1.41}/GDriveFolder.txt +0 -0
- {halib-0.1.39 → halib-0.1.41}/LICENSE.txt +0 -0
- {halib-0.1.39 → halib-0.1.41}/guide_publish_pip.pdf +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/cuda.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/dataset.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/__init__.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/jsonfile.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/textfile.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/videofile.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/filetype/yamlfile.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/listop.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/online/__init__.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/online/gdrive.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/online/gdrive_mkdir.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/online/gdrive_test.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/online/projectmake.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/plot.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/system/__init__.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/system/cmd.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/system/filesys.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/tele_noti.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib/torchloader.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib.egg-info/dependency_links.txt +0 -0
- {halib-0.1.39 → halib-0.1.41}/halib.egg-info/top_level.txt +0 -0
- {halib-0.1.39 → halib-0.1.41}/setup.cfg +0 -0
- {halib-0.1.39 → halib-0.1.41}/test/test15.py +0 -0
- {halib-0.1.39 → halib-0.1.41}/test/test_df_creator.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: halib
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.41
|
4
4
|
Summary: Small library for common tasks
|
5
5
|
Author: Hoang Van Ha
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
@@ -14,6 +14,12 @@ Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE.txt
|
15
15
|
|
16
16
|
Helper package for coding and automation
|
17
|
+
**Version 0.1.41**
|
18
|
+
+ add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
|
19
|
+
|
20
|
+
**Version 0.1.40**
|
21
|
+
|
22
|
+
+ update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
|
17
23
|
|
18
24
|
**Version 0.1.38**
|
19
25
|
|
@@ -1,4 +1,10 @@
|
|
1
1
|
Helper package for coding and automation
|
2
|
+
**Version 0.1.41**
|
3
|
+
+ add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
|
4
|
+
|
5
|
+
**Version 0.1.40**
|
6
|
+
|
7
|
+
+ update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
|
2
8
|
|
3
9
|
**Version 0.1.38**
|
4
10
|
|
@@ -23,6 +23,10 @@ __all__ = [
|
|
23
23
|
"tcuda",
|
24
24
|
"timebudget",
|
25
25
|
"tqdm",
|
26
|
+
"rcolor_all_str",
|
27
|
+
"rcolor_palette",
|
28
|
+
"rcolor_str",
|
29
|
+
"rcolor_palette_all"
|
26
30
|
]
|
27
31
|
|
28
32
|
import numpy as np
|
@@ -48,3 +52,4 @@ import arrow
|
|
48
52
|
import omegaconf
|
49
53
|
from omegaconf import OmegaConf
|
50
54
|
from omegaconf.dictconfig import DictConfig
|
55
|
+
from .rich_color import rcolor_str, rcolor_palette, rcolor_palette_all, rcolor_all_str
|
@@ -6,6 +6,8 @@ from rich import inspect
|
|
6
6
|
from rich.pretty import pprint
|
7
7
|
from tqdm import tqdm
|
8
8
|
from loguru import logger
|
9
|
+
from itables import init_notebook_mode, show
|
10
|
+
import pygwalker as pyg
|
9
11
|
|
10
12
|
console = Console()
|
11
13
|
|
@@ -44,6 +46,30 @@ def fn_insert_rows(df, singleRow_or_rowList):
|
|
44
46
|
def fn_display_df(df):
|
45
47
|
print(tabulate(df, headers="keys", tablefmt="psql", numalign="right"))
|
46
48
|
|
49
|
+
def showdf(df, display_mode="itable", in_jupyter=True, all_interactive=False):
|
50
|
+
if display_mode == "itable":
|
51
|
+
if in_jupyter:
|
52
|
+
init_notebook_mode(all_interactive=all_interactive)
|
53
|
+
show(
|
54
|
+
df,
|
55
|
+
# layout={"top1": "searchPanes"},
|
56
|
+
# searchPanes={"layout": "column-3", "cascadePanes": True},
|
57
|
+
caption="table caption",
|
58
|
+
layout={"top1": "searchBuilder"},
|
59
|
+
buttons=["csvHtml5", "excelHtml5", "colvis"],
|
60
|
+
search={"regex": True, "caseInsensitive": True},
|
61
|
+
paging=False, # no paging
|
62
|
+
scrollY="300px", # height of table
|
63
|
+
scrollCollapse=True,
|
64
|
+
showIndex=True, # show row no.
|
65
|
+
select=True, # allow row selected
|
66
|
+
keys=True, # enable navigate using arrow keys
|
67
|
+
)
|
68
|
+
elif display_mode == "pygwalker":
|
69
|
+
return pyg.walk(df)
|
70
|
+
else:
|
71
|
+
raise ValueError("Invalid display mode, current support [itable, pygwalker]")
|
72
|
+
|
47
73
|
|
48
74
|
def fn_config_display_pd(
|
49
75
|
max_rows=None,
|
@@ -0,0 +1,259 @@
|
|
1
|
+
from rich.console import Console
|
2
|
+
from rich.pretty import pprint
|
3
|
+
from rich.table import Table
|
4
|
+
from rich.text import Text
|
5
|
+
from rich.panel import Panel
|
6
|
+
|
7
|
+
# List of colors
|
8
|
+
# ! https://rich.readthedocs.io/en/stable/appendix/colors.html
|
9
|
+
all_colors = [
|
10
|
+
"black",
|
11
|
+
"red",
|
12
|
+
"green",
|
13
|
+
"yellow",
|
14
|
+
"blue",
|
15
|
+
"magenta",
|
16
|
+
"cyan",
|
17
|
+
"white",
|
18
|
+
"bright_black",
|
19
|
+
"bright_red",
|
20
|
+
"bright_green",
|
21
|
+
"bright_yellow",
|
22
|
+
"bright_blue",
|
23
|
+
"bright_magenta",
|
24
|
+
"bright_cyan",
|
25
|
+
"bright_white",
|
26
|
+
"grey0",
|
27
|
+
"navy_blue",
|
28
|
+
"dark_blue",
|
29
|
+
"blue3",
|
30
|
+
"blue1",
|
31
|
+
"dark_green",
|
32
|
+
"deep_sky_blue4",
|
33
|
+
"dodger_blue3",
|
34
|
+
"dodger_blue2",
|
35
|
+
"green4",
|
36
|
+
"spring_green4",
|
37
|
+
"turquoise4",
|
38
|
+
"deep_sky_blue3",
|
39
|
+
"dodger_blue1",
|
40
|
+
"dark_cyan",
|
41
|
+
"light_sea_green",
|
42
|
+
"deep_sky_blue2",
|
43
|
+
"deep_sky_blue1",
|
44
|
+
"green3",
|
45
|
+
"spring_green3",
|
46
|
+
"cyan3",
|
47
|
+
"dark_turquoise",
|
48
|
+
"turquoise2",
|
49
|
+
"green1",
|
50
|
+
"spring_green2",
|
51
|
+
"spring_green1",
|
52
|
+
"medium_spring_green",
|
53
|
+
"cyan2",
|
54
|
+
"cyan1",
|
55
|
+
"purple4",
|
56
|
+
"purple3",
|
57
|
+
"blue_violet",
|
58
|
+
"grey37",
|
59
|
+
"medium_purple4",
|
60
|
+
"slate_blue3",
|
61
|
+
"royal_blue1",
|
62
|
+
"chartreuse4",
|
63
|
+
"pale_turquoise4",
|
64
|
+
"steel_blue",
|
65
|
+
"steel_blue3",
|
66
|
+
"cornflower_blue",
|
67
|
+
"dark_sea_green4",
|
68
|
+
"cadet_blue",
|
69
|
+
"sky_blue3",
|
70
|
+
"chartreuse3",
|
71
|
+
"sea_green3",
|
72
|
+
"aquamarine3",
|
73
|
+
"medium_turquoise",
|
74
|
+
"steel_blue1",
|
75
|
+
"sea_green2",
|
76
|
+
"sea_green1",
|
77
|
+
"dark_slate_gray2",
|
78
|
+
"dark_red",
|
79
|
+
"dark_magenta",
|
80
|
+
"orange4",
|
81
|
+
"light_pink4",
|
82
|
+
"plum4",
|
83
|
+
"medium_purple3",
|
84
|
+
"slate_blue1",
|
85
|
+
"wheat4",
|
86
|
+
"grey53",
|
87
|
+
"light_slate_grey",
|
88
|
+
"medium_purple",
|
89
|
+
"light_slate_blue",
|
90
|
+
"yellow4",
|
91
|
+
"dark_sea_green",
|
92
|
+
"light_sky_blue3",
|
93
|
+
"sky_blue2",
|
94
|
+
"chartreuse2",
|
95
|
+
"pale_green3",
|
96
|
+
"dark_slate_gray3",
|
97
|
+
"sky_blue1",
|
98
|
+
"chartreuse1",
|
99
|
+
"light_green",
|
100
|
+
"aquamarine1",
|
101
|
+
"dark_slate_gray1",
|
102
|
+
"deep_pink4",
|
103
|
+
"medium_violet_red",
|
104
|
+
"dark_violet",
|
105
|
+
"purple",
|
106
|
+
"medium_orchid3",
|
107
|
+
"medium_orchid",
|
108
|
+
"dark_goldenrod",
|
109
|
+
"rosy_brown",
|
110
|
+
"grey63",
|
111
|
+
"medium_purple2",
|
112
|
+
"medium_purple1",
|
113
|
+
"dark_khaki",
|
114
|
+
"navajo_white3",
|
115
|
+
"grey69",
|
116
|
+
"light_steel_blue3",
|
117
|
+
"light_steel_blue",
|
118
|
+
"dark_olive_green3",
|
119
|
+
"dark_sea_green3",
|
120
|
+
"light_cyan3",
|
121
|
+
"light_sky_blue1",
|
122
|
+
"green_yellow",
|
123
|
+
"dark_olive_green2",
|
124
|
+
"pale_green1",
|
125
|
+
"dark_sea_green2",
|
126
|
+
"pale_turquoise1",
|
127
|
+
"red3",
|
128
|
+
"deep_pink3",
|
129
|
+
"magenta3",
|
130
|
+
"dark_orange3",
|
131
|
+
"indian_red",
|
132
|
+
"hot_pink3",
|
133
|
+
"hot_pink2",
|
134
|
+
"orchid",
|
135
|
+
"orange3",
|
136
|
+
"light_salmon3",
|
137
|
+
"light_pink3",
|
138
|
+
"pink3",
|
139
|
+
"plum3",
|
140
|
+
"violet",
|
141
|
+
"gold3",
|
142
|
+
"light_goldenrod3",
|
143
|
+
"tan",
|
144
|
+
"misty_rose3",
|
145
|
+
"thistle3",
|
146
|
+
"plum2",
|
147
|
+
"yellow3",
|
148
|
+
"khaki3",
|
149
|
+
"light_yellow3",
|
150
|
+
"grey84",
|
151
|
+
"light_steel_blue1",
|
152
|
+
"yellow2",
|
153
|
+
"dark_olive_green1",
|
154
|
+
"dark_sea_green1",
|
155
|
+
"honeydew2",
|
156
|
+
"light_cyan1",
|
157
|
+
"red1",
|
158
|
+
"deep_pink2",
|
159
|
+
"deep_pink1",
|
160
|
+
"magenta2",
|
161
|
+
"magenta1",
|
162
|
+
"orange_red1",
|
163
|
+
"indian_red1",
|
164
|
+
"hot_pink",
|
165
|
+
"medium_orchid1",
|
166
|
+
"dark_orange",
|
167
|
+
"salmon1",
|
168
|
+
"light_coral",
|
169
|
+
"pale_violet_red1",
|
170
|
+
"orchid2",
|
171
|
+
"orchid1",
|
172
|
+
"orange1",
|
173
|
+
"sandy_brown",
|
174
|
+
"light_salmon1",
|
175
|
+
"light_pink1",
|
176
|
+
"pink1",
|
177
|
+
"plum1",
|
178
|
+
"gold1",
|
179
|
+
"light_goldenrod2",
|
180
|
+
"navajo_white1",
|
181
|
+
"misty_rose1",
|
182
|
+
"thistle1",
|
183
|
+
"yellow1",
|
184
|
+
"light_goldenrod1",
|
185
|
+
"khaki1",
|
186
|
+
"wheat1",
|
187
|
+
"cornsilk1",
|
188
|
+
"grey100",
|
189
|
+
"grey3",
|
190
|
+
"grey7",
|
191
|
+
"grey11",
|
192
|
+
"grey15",
|
193
|
+
"grey19",
|
194
|
+
"grey23",
|
195
|
+
"grey27",
|
196
|
+
"grey30",
|
197
|
+
"grey35",
|
198
|
+
"grey39",
|
199
|
+
"grey42",
|
200
|
+
"grey46",
|
201
|
+
"grey50",
|
202
|
+
"grey54",
|
203
|
+
"grey58",
|
204
|
+
"grey62",
|
205
|
+
"grey66",
|
206
|
+
"grey70",
|
207
|
+
"grey74",
|
208
|
+
"grey78",
|
209
|
+
"grey82",
|
210
|
+
"grey85",
|
211
|
+
"grey89",
|
212
|
+
"grey93",
|
213
|
+
]
|
214
|
+
|
215
|
+
def rcolor_all_str():
|
216
|
+
pprint(all_colors)
|
217
|
+
|
218
|
+
def rcolor_str(in_str, color="white"):
|
219
|
+
assert color in all_colors, f"color must be one of {all_colors}"
|
220
|
+
return f"[{color}]{in_str}[/{color}]"
|
221
|
+
|
222
|
+
def rcolor_palette(color_list):
|
223
|
+
# make sure all colors are valid (in all_colors)
|
224
|
+
for color in color_list:
|
225
|
+
assert (
|
226
|
+
color in all_colors
|
227
|
+
), f"color must be a valid color. call <rcolor_all_str()> or <rcolor_palette_all()> to see all valid colors"
|
228
|
+
# Initialize console
|
229
|
+
console = Console()
|
230
|
+
|
231
|
+
# Create a table with horizontal lines and six columns
|
232
|
+
table = Table(show_header=True, header_style="bold magenta", show_lines=True)
|
233
|
+
|
234
|
+
# Define the columns
|
235
|
+
table.add_column("Color Name 1", style="bold")
|
236
|
+
table.add_column("Sample 1", style="bold")
|
237
|
+
table.add_column("Color Name 2", style="bold")
|
238
|
+
table.add_column("Sample 2", style="bold")
|
239
|
+
table.add_column("Color Name 3", style="bold")
|
240
|
+
table.add_column("Sample 3", style="bold")
|
241
|
+
|
242
|
+
# Adjust the number of rows needed for the table
|
243
|
+
num_colors = len(color_list)
|
244
|
+
num_rows = (num_colors + 2) // 3 # Ceiling division to ensure all colors fit
|
245
|
+
|
246
|
+
# Add rows to the table
|
247
|
+
for i in range(num_rows):
|
248
|
+
color1 = color_list[i * 3] if i * 3 < num_colors else ""
|
249
|
+
color2 = color_list[i * 3 + 1] if i * 3 + 1 < num_colors else ""
|
250
|
+
color3 = color_list[i * 3 + 2] if i * 3 + 2 < num_colors else ""
|
251
|
+
filled_rect1 = Text(" " * 10, style=f"on {color1}") if color1 else ""
|
252
|
+
filled_rect2 = Text(" " * 10, style=f"on {color2}") if color2 else ""
|
253
|
+
filled_rect3 = Text(" " * 10, style=f"on {color3}") if color3 else ""
|
254
|
+
table.add_row(color1, filled_rect1, color2, filled_rect2, color3, filled_rect3)
|
255
|
+
|
256
|
+
# Print the table
|
257
|
+
console.print(table)
|
258
|
+
def rcolor_palette_all():
|
259
|
+
rcolor_palette(all_colors)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: halib
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.41
|
4
4
|
Summary: Small library for common tasks
|
5
5
|
Author: Hoang Van Ha
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
@@ -14,6 +14,12 @@ Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE.txt
|
15
15
|
|
16
16
|
Helper package for coding and automation
|
17
|
+
**Version 0.1.41**
|
18
|
+
+ add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
|
19
|
+
|
20
|
+
**Version 0.1.40**
|
21
|
+
|
22
|
+
+ update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
|
17
23
|
|
18
24
|
**Version 0.1.38**
|
19
25
|
|
@@ -3,7 +3,6 @@ click
|
|
3
3
|
enlighten
|
4
4
|
kaleido==0.1.*
|
5
5
|
loguru
|
6
|
-
matplotlib
|
7
6
|
more-itertools
|
8
7
|
moviepy
|
9
8
|
networkx
|
@@ -12,15 +11,18 @@ omegaconf
|
|
12
11
|
opencv-python
|
13
12
|
pandas
|
14
13
|
Pillow
|
15
|
-
plotly
|
16
14
|
Pyarrow
|
17
15
|
pycurl
|
18
16
|
python-telegram-bot
|
19
17
|
requests
|
20
18
|
rich
|
21
19
|
scikit-learn
|
20
|
+
matplotlib
|
22
21
|
seaborn
|
22
|
+
plotly
|
23
|
+
pygwalker
|
23
24
|
tabulate
|
25
|
+
itables
|
24
26
|
timebudget
|
25
27
|
tqdm
|
26
28
|
tube_dl
|
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
|
File without changes
|