halib 0.1.44__py3-none-any.whl → 0.1.45__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.
halib/__init__.py CHANGED
@@ -32,6 +32,7 @@ __all__ = [
32
32
  "timebudget",
33
33
  "tqdm",
34
34
  "warnings",
35
+ "time"
35
36
  ]
36
37
  import warnings
37
38
  warnings.filterwarnings("ignore", message="Unable to import Axes3D")
@@ -43,6 +44,7 @@ import arrow
43
44
  import numpy as np
44
45
  import pandas as pd
45
46
  import os
47
+ import time
46
48
 
47
49
  # my own modules
48
50
  from .filetype import *
halib/filetype/csvfile.py CHANGED
@@ -8,6 +8,7 @@ from tqdm import tqdm
8
8
  from loguru import logger
9
9
  from itables import init_notebook_mode, show
10
10
  import pygwalker as pyg
11
+ import textwrap
11
12
 
12
13
  console = Console()
13
14
 
@@ -42,9 +43,14 @@ def fn_insert_rows(df, singleRow_or_rowList):
42
43
  df = pd.concat([df, new_row_df], ignore_index=True)
43
44
  return df
44
45
 
46
+ # Auto-wrap function for each cell
47
+ def auto_wrap(cell, width=40):
48
+ return textwrap.fill(str(cell), width=width)
45
49
 
46
- def fn_display_df(df):
47
- print(tabulate(df, headers="keys", tablefmt="psql", numalign="right"))
50
+ def fn_display_df(df, max_col_width=40):
51
+ # Apply wrapping
52
+ wrapped_df = df.applymap(lambda x: auto_wrap(x, width=max_col_width))
53
+ print(tabulate(wrapped_df, headers="keys", tablefmt="psql", numalign="right"))
48
54
 
49
55
  def showdf(df, display_mode="itable", in_jupyter=True, all_interactive=False):
50
56
  if display_mode == "itable":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.44
3
+ Version: 0.1.45
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -43,8 +43,9 @@ Requires-Dist: tube-dl
43
43
 
44
44
  Helper package for coding and automation
45
45
 
46
- **Version 0.1.44**
46
+ **Version 0.1.45**
47
47
  + filter the warning message of `UserWarning: Unable to import Axes3D.`
48
+ + auto_wrap_text for `fn_display_df` to avoid long text in the table
48
49
 
49
50
  **Version 0.1.42**
50
51
  + add <rich_color.py>: add basic color list (for easy usage)
@@ -1,4 +1,4 @@
1
- halib/__init__.py,sha256=OSsDQl9ezXpRi9u32oC6r0g9P1Kc3NdlysNoPYtO-OA,1486
1
+ halib/__init__.py,sha256=UCoFqzUTQLedi7obvV816QyTV13cRj3kvbLTist6t2w,1511
2
2
  halib/common.py,sha256=28kBN56Ema1A1pIDF2B8BydepXy799L21o2cc01SANc,2039
3
3
  halib/csvfile.py,sha256=Eoeni0NIbNG3mB5ESWAvNwhJxOjmCaPd1qqYRHImbvk,1567
4
4
  halib/cuda.py,sha256=1bvtBY8QvTWdLaxalzK9wqXPl0Ft3AfhcrebupxGzEA,1010
@@ -17,7 +17,7 @@ halib/textfile.py,sha256=EhVFrit-nRBJx18e6rtIqcE1cSbgsLnMXe_kdhi1EPI,399
17
17
  halib/torchloader.py,sha256=-q9YE-AoHZE1xQX2dgNxdqtucEXYs4sQ22WXdl6EGfI,6500
18
18
  halib/videofile.py,sha256=NTLTZ-j6YD47duw2LN2p-lDQDglYFP1LpEU_0gzHLdI,4737
19
19
  halib/filetype/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- halib/filetype/csvfile.py,sha256=8GO2y6NbLR3yyJgU3mBRP6c0bvwAUkbfuqj82UicfYI,5268
20
+ halib/filetype/csvfile.py,sha256=YjLiJVvf-Nxdv5ki-hDw8SQUf8TBGBqTwjmo8Z9SsEQ,5530
21
21
  halib/filetype/jsonfile.py,sha256=9LBdM7LV9QgJA1bzJRkq69qpWOP22HDXPGirqXTgSCw,480
22
22
  halib/filetype/textfile.py,sha256=QtuI5PdLxu4hAqSeafr3S8vCXwtvgipWV4Nkl7AzDYM,399
23
23
  halib/filetype/videofile.py,sha256=4nfVAYYtoT76y8P4WYyxNna4Iv1o2iV6xaMcUzNPC4s,4736
@@ -33,8 +33,8 @@ halib/sys/filesys.py,sha256=ERpnELLDKJoTIIKf-AajgkY62nID4qmqmX5TkE95APU,2931
33
33
  halib/system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  halib/system/cmd.py,sha256=b2x7JPcNnFjLGheIESVYvqAb-w2UwBM1PAwYxMZ5YjA,228
35
35
  halib/system/filesys.py,sha256=ERpnELLDKJoTIIKf-AajgkY62nID4qmqmX5TkE95APU,2931
36
- halib-0.1.44.dist-info/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
37
- halib-0.1.44.dist-info/METADATA,sha256=6SWkAVuPzp5uEK6uhmMTspSDPoCM6YhjnPSK6YAV-q8,3657
38
- halib-0.1.44.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
39
- halib-0.1.44.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
40
- halib-0.1.44.dist-info/RECORD,,
36
+ halib-0.1.45.dist-info/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
37
+ halib-0.1.45.dist-info/METADATA,sha256=fetsCvQ8g19aHDdltIDkds_6hK6D4hAsi_n2jl-jibM,3726
38
+ halib-0.1.45.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
39
+ halib-0.1.45.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
40
+ halib-0.1.45.dist-info/RECORD,,
File without changes