halib 0.1.28__tar.gz → 0.1.30__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.28/halib.egg-info → halib-0.1.30}/PKG-INFO +5 -1
- {halib-0.1.28 → halib-0.1.30}/README.md +4 -0
- {halib-0.1.28 → halib-0.1.30}/halib/tele_noti.py +16 -5
- {halib-0.1.28 → halib-0.1.30/halib.egg-info}/PKG-INFO +5 -1
- {halib-0.1.28 → halib-0.1.30}/halib.egg-info/requires.txt +1 -0
- {halib-0.1.28 → halib-0.1.30}/setup.py +1 -1
- {halib-0.1.28 → halib-0.1.30}/.gitignore +0 -0
- {halib-0.1.28 → halib-0.1.30}/GDriveFolder.txt +0 -0
- {halib-0.1.28 → halib-0.1.30}/LICENSE.txt +0 -0
- {halib-0.1.28 → halib-0.1.30}/guide_publish_pip.pdf +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/__init__.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/cuda.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/__init__.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/csvfile.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/jsonfile.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/textfile.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/videofile.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/filetype/yamlfile.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/listop.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/online/__init__.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/online/gdrive.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/online/gdrive_mkdir.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/online/gdrive_test.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/online/projectmake.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/plot.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/system/__init__.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/system/cmd.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib/system/filesys.py +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib.egg-info/SOURCES.txt +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib.egg-info/dependency_links.txt +0 -0
- {halib-0.1.28 → halib-0.1.30}/halib.egg-info/top_level.txt +0 -0
- {halib-0.1.28 → halib-0.1.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: halib
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.30
|
4
4
|
Summary: Small library for common tasks
|
5
5
|
Author: Hoang Van Ha
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
@@ -15,6 +15,10 @@ License-File: LICENSE.txt
|
|
15
15
|
|
16
16
|
Helper package for coding and automation
|
17
17
|
|
18
|
+
**Version 0.1.29**
|
19
|
+
|
20
|
+
+ for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
|
21
|
+
---
|
18
22
|
**Version 0.1.24**
|
19
23
|
|
20
24
|
+ rename `sys` to `system` to avoid conflict with built-in `sys` module
|
@@ -1,5 +1,9 @@
|
|
1
1
|
Helper package for coding and automation
|
2
2
|
|
3
|
+
**Version 0.1.29**
|
4
|
+
|
5
|
+
+ for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
|
6
|
+
---
|
3
7
|
**Version 0.1.24**
|
4
8
|
|
5
9
|
+ rename `sys` to `system` to avoid conflict with built-in `sys` module
|
@@ -7,12 +7,14 @@ import telegram
|
|
7
7
|
import pandas as pd
|
8
8
|
|
9
9
|
from rich.pretty import pprint
|
10
|
+
from rich.console import Console
|
10
11
|
import plotly.graph_objects as go
|
11
12
|
|
12
13
|
from .system import filesys as fs
|
13
14
|
from .filetype import textfile, csvfile
|
14
15
|
|
15
16
|
from argparse import ArgumentParser
|
17
|
+
tele_console = Console()
|
16
18
|
|
17
19
|
def parse_args():
|
18
20
|
parser = ArgumentParser(
|
@@ -82,11 +84,15 @@ def compose_message_and_img_path(
|
|
82
84
|
):
|
83
85
|
context_msg = f">> Project: {project} \n>> File: {target_file} \n>> Last {num_last_lines} lines:"
|
84
86
|
msg_df = get_watcher_message_df(target_file, num_last_lines)
|
85
|
-
|
87
|
+
try:
|
88
|
+
img_path = df2img(msg_df, output_img_dir, decimal_places, out_img_scale)
|
89
|
+
except Exception as e:
|
90
|
+
pprint(f"Error: {e}")
|
91
|
+
img_path = None
|
86
92
|
return context_msg, img_path
|
87
93
|
|
88
94
|
|
89
|
-
async def send_to_telegram(cfg_dict):
|
95
|
+
async def send_to_telegram(cfg_dict, interval_in_sec):
|
90
96
|
# pprint(cfg_dict)
|
91
97
|
token = cfg_dict["telegram"]["token"]
|
92
98
|
chat_id = cfg_dict["telegram"]["chat_id"]
|
@@ -110,9 +116,14 @@ async def send_to_telegram(cfg_dict):
|
|
110
116
|
out_img_scale,
|
111
117
|
output_img_dir,
|
112
118
|
)
|
113
|
-
|
119
|
+
# calculate the next time to send message
|
120
|
+
next_time = pd.Timestamp.now() + pd.Timedelta(seconds=interval_in_sec)
|
121
|
+
tele_console.rule()
|
122
|
+
tele_console.print("[green] Send message to telegram [/green]")
|
123
|
+
tele_console.print(f"[red] Next message will be sent at <{next_time}> [/red]")
|
114
124
|
await bot.send_message(text=context_msg, chat_id=chat_id)
|
115
|
-
|
125
|
+
if img_path:
|
126
|
+
await bot.send_photo(chat_id=chat_id, photo=open(img_path, "rb"))
|
116
127
|
except Exception as e:
|
117
128
|
pprint(f'Error: {e}')
|
118
129
|
pprint('Message not sent to telegram')
|
@@ -125,7 +136,7 @@ async def run_forever(cfg_path):
|
|
125
136
|
interval_in_sec = int(interval_in_min * 60)
|
126
137
|
pprint(f'Message will be sent every {interval_in_min} minutes or {interval_in_sec} seconds')
|
127
138
|
while True:
|
128
|
-
await send_to_telegram(cfg_dict)
|
139
|
+
await send_to_telegram(cfg_dict, interval_in_sec)
|
129
140
|
await asyncio.sleep(interval_in_sec)
|
130
141
|
|
131
142
|
async def main():
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: halib
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.30
|
4
4
|
Summary: Small library for common tasks
|
5
5
|
Author: Hoang Van Ha
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
@@ -15,6 +15,10 @@ License-File: LICENSE.txt
|
|
15
15
|
|
16
16
|
Helper package for coding and automation
|
17
17
|
|
18
|
+
**Version 0.1.29**
|
19
|
+
|
20
|
+
+ for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
|
21
|
+
---
|
18
22
|
**Version 0.1.24**
|
19
23
|
|
20
24
|
+ rename `sys` to `system` to avoid conflict with built-in `sys` module
|
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
|