tensorneko-util 0.3.14__tar.gz → 0.3.15__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.
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/PKG-INFO +3 -2
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/README.md +20 -2
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/setup.py +2 -1
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/setup_util.py +2 -1
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/__init__.py +7 -0
- tensorneko_util-0.3.15/src/tensorneko_util/_rich.py +2 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/json/json_writer.py +2 -1
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/video/video_writer.py +2 -1
- tensorneko_util-0.3.15/src/tensorneko_util/msg/__init__.py +3 -0
- tensorneko_util-0.3.15/src/tensorneko_util/msg/gotify.py +48 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/eventbus/bus.py +16 -13
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/eventbus/event.py +1 -16
- tensorneko_util-0.3.15/src/tensorneko_util/version.txt +1 -0
- tensorneko_util-0.3.15/src/tensorneko_util/visualization/watcher/web/dist/assets/index.9f626faa.js +188 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/web/dist/index.html +1 -1
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util.egg-info/PKG-INFO +3 -2
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util.egg-info/SOURCES.txt +4 -1
- tensorneko_util-0.3.14/src/tensorneko_util/version.txt +0 -1
- tensorneko_util-0.3.14/src/tensorneko_util/visualization/watcher/web/dist/assets/index.493c52c5.js +0 -188
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/LICENSE +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/setup.cfg +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/audio_lib.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/blocking.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/parallel.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/tqdm.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/backend/visual_lib.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/debug/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/debug/logger.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/debug/parser.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/_default_backends.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/audio/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/audio/audio_data.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/audio/audio_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/audio/audio_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/hdf5/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/hdf5/hdf5_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/hdf5/hdf5_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/image/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/image/image_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/image/image_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/json/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/json/json_data.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/json/json_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/matlab/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/matlab/mat_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/matlab/mat_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/npy/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/npy/npy_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/npy/npy_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/pickle/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/pickle/pickle_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/pickle/pickle_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/text/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/text/text_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/text/text_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/toml/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/toml/toml_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/toml/toml_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/video/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/video/video_data.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/video/video_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/yaml/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/yaml/yaml_reader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/yaml/yaml_writer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/notebook/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/notebook/display.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/crop.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/_utils.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/abstract_face_detector.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/anime_face_detector.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/facexzoo_face_detector.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/face_detector/opencv_face_detector.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/ffmpeg.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/image.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/preprocess/video.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/average_meter.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/bimap.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/dispatched_misc.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/dispatcher.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/downloader.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/eventbus/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/eventbus/decorator.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/args.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/array/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/array/abstract_seq.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/array/seq.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/array/stream.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/func.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/monad/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/monad/eval.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/monad/monad.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/monad/option.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/fp/underscore.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/misc.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/ref.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/registry.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/server.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/singleton.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/timer.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/type.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/window_merger.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/color.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/image_browser/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/image_browser/server.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/image_browser/web/index.html +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/matplotlib.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/multi_plots.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/seaborn.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/tensorboard.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/__init__.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/component.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/server.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/view.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/visualization/watcher/web/dist/assets/index.cf95019d.css +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util.egg-info/dependency_links.txt +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util.egg-info/requires.txt +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util.egg-info/top_level.txt +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/test/test_library_info.py +0 -0
- {tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/test/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tensorneko_util
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.15
|
|
4
4
|
Summary: The Utils for Library TensorNeko.
|
|
5
5
|
Home-page: https://github.com/ControlNet/tensorneko
|
|
6
6
|
Author: ControlNet
|
|
@@ -8,7 +8,7 @@ Author-email: smczx@hotmail.com
|
|
|
8
8
|
License: UNKNOWN
|
|
9
9
|
Project-URL: Bug Tracker, https://github.com/ControlNet/tensorneko/issues
|
|
10
10
|
Project-URL: Source Code, https://github.com/ControlNet/tensorneko
|
|
11
|
-
Keywords: deep learning,pytorch,AI
|
|
11
|
+
Keywords: deep learning,pytorch,AI,data processing
|
|
12
12
|
Platform: UNKNOWN
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.7
|
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
20
|
Classifier: License :: OSI Approved :: MIT License
|
|
20
21
|
Classifier: Operating System :: OS Independent
|
|
21
22
|
Classifier: Intended Audience :: Developers
|
|
@@ -34,11 +34,18 @@ To use the library without PyTorch and PyTorch Lightning, you can install the ut
|
|
|
34
34
|
pip install tensorneko_util
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Some cpu bound functions are implemented by `pyo3`, and you can install the optimized version with below command.
|
|
37
|
+
Some cpu bound functions are implemented by rust-based `pyo3`, and you can install the optimized version with below command.
|
|
38
38
|
```shell
|
|
39
39
|
pip install tensorneko_lib
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
Some CLI tools are provided in the `tensorneko_tool` package, and you can install it with below command.
|
|
43
|
+
```shell
|
|
44
|
+
pipx install tensorneko_tool # or `pip install tensorneko_tool`
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then you can use the CLI tools `tensorneko` in the terminal.
|
|
48
|
+
|
|
42
49
|
## Neko Layers, Modules and Architectures
|
|
43
50
|
|
|
44
51
|
Build an MLP with linear layers. The activation and normalization will be placed in the hidden layers.
|
|
@@ -481,7 +488,7 @@ This library provides event bus based reactive tools. The API integrates the Pyt
|
|
|
481
488
|
# useful decorators for default event bus
|
|
482
489
|
from tensorneko.util import subscribe
|
|
483
490
|
# Event base type
|
|
484
|
-
from tensorneko.util import Event
|
|
491
|
+
from tensorneko.util import Event, EventBus
|
|
485
492
|
|
|
486
493
|
class LogEvent(Event):
|
|
487
494
|
def __init__(self, message: str):
|
|
@@ -511,6 +518,7 @@ if __name__ == '__main__':
|
|
|
511
518
|
# emit an event, and then the event handler will be invoked
|
|
512
519
|
# The sequential order is not guaranteed
|
|
513
520
|
LogEvent("Hello world!")
|
|
521
|
+
EventBus.default.wait() # it's not blocking, need to call wait manually before exit.
|
|
514
522
|
# one possible output:
|
|
515
523
|
# Hello world! in another thread
|
|
516
524
|
# Hello world! async
|
|
@@ -646,3 +654,13 @@ Functions list (in `tensorneko`):
|
|
|
646
654
|
- `with_printed_shape`
|
|
647
655
|
- `is_bad_num`
|
|
648
656
|
- `count_parameters`
|
|
657
|
+
|
|
658
|
+
## TensorNeko Tools
|
|
659
|
+
|
|
660
|
+
Some CLI tools are provided in the `tensorneko_tool` package.
|
|
661
|
+
|
|
662
|
+
The `gotify` can send a message to the Gotify server, with the environment variables `GOTIFY_URL` and `GOTIFY_TOKEN` set.
|
|
663
|
+
|
|
664
|
+
```shell
|
|
665
|
+
tensorneko gotify "Script finished!"
|
|
666
|
+
```
|
|
@@ -27,7 +27,7 @@ setuptools.setup(
|
|
|
27
27
|
"Bug Tracker": "https://github.com/ControlNet/tensorneko/issues",
|
|
28
28
|
"Source Code": "https://github.com/ControlNet/tensorneko",
|
|
29
29
|
},
|
|
30
|
-
keywords=["deep learning", "pytorch", "AI"],
|
|
30
|
+
keywords=["deep learning", "pytorch", "AI", "data processing"],
|
|
31
31
|
package_dir={"": "src"},
|
|
32
32
|
packages=setuptools.find_packages(where="src", include=["tensorneko", "tensorneko.*"]),
|
|
33
33
|
package_data={
|
|
@@ -43,6 +43,7 @@ setuptools.setup(
|
|
|
43
43
|
"Programming Language :: Python :: 3.9",
|
|
44
44
|
"Programming Language :: Python :: 3.10",
|
|
45
45
|
"Programming Language :: Python :: 3.11",
|
|
46
|
+
"Programming Language :: Python :: 3.12",
|
|
46
47
|
"License :: OSI Approved :: MIT License",
|
|
47
48
|
"Operating System :: OS Independent",
|
|
48
49
|
"Intended Audience :: Developers",
|
|
@@ -26,7 +26,7 @@ setuptools.setup(
|
|
|
26
26
|
"Bug Tracker": "https://github.com/ControlNet/tensorneko/issues",
|
|
27
27
|
"Source Code": "https://github.com/ControlNet/tensorneko",
|
|
28
28
|
},
|
|
29
|
-
keywords=["deep learning", "pytorch", "AI"],
|
|
29
|
+
keywords=["deep learning", "pytorch", "AI", "data processing"],
|
|
30
30
|
package_dir={"": "src"},
|
|
31
31
|
packages=setuptools.find_packages(where="src", include=["tensorneko_util", "tensorneko_util.*"]),
|
|
32
32
|
package_data={
|
|
@@ -46,6 +46,7 @@ setuptools.setup(
|
|
|
46
46
|
"Programming Language :: Python :: 3.9",
|
|
47
47
|
"Programming Language :: Python :: 3.10",
|
|
48
48
|
"Programming Language :: Python :: 3.11",
|
|
49
|
+
"Programming Language :: Python :: 3.12",
|
|
49
50
|
"License :: OSI Approved :: MIT License",
|
|
50
51
|
"Operating System :: OS Independent",
|
|
51
52
|
"Intended Audience :: Developers",
|
|
@@ -7,6 +7,7 @@ from . import visualization
|
|
|
7
7
|
from . import preprocess
|
|
8
8
|
from . import io
|
|
9
9
|
from . import debug
|
|
10
|
+
from . import msg
|
|
10
11
|
from .io import read, write
|
|
11
12
|
|
|
12
13
|
__all__ = [
|
|
@@ -16,9 +17,15 @@ __all__ = [
|
|
|
16
17
|
"preprocess",
|
|
17
18
|
"io",
|
|
18
19
|
"debug",
|
|
20
|
+
"msg",
|
|
19
21
|
"read",
|
|
20
22
|
"write",
|
|
21
23
|
]
|
|
22
24
|
|
|
25
|
+
try:
|
|
26
|
+
from . import _rich
|
|
27
|
+
except ImportError:
|
|
28
|
+
pass
|
|
29
|
+
|
|
23
30
|
with open(os.path.join(dirname(__file__), "version.txt"), "r", encoding="UTF-8") as file:
|
|
24
31
|
__version__ = file.read()
|
{tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/json/json_writer.py
RENAMED
|
@@ -16,7 +16,8 @@ class JsonWriter:
|
|
|
16
16
|
import orjson
|
|
17
17
|
with open(path, "w", encoding=encoding) as file:
|
|
18
18
|
if indent == 4:
|
|
19
|
-
|
|
19
|
+
warnings.warn("orjson does not support indent 4, will use indent 2 instead.")
|
|
20
|
+
option = orjson.OPT_INDENT_2
|
|
20
21
|
elif indent == 2:
|
|
21
22
|
option = orjson.OPT_INDENT_2
|
|
22
23
|
else:
|
{tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/io/video/video_writer.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import pathlib
|
|
2
2
|
import warnings
|
|
3
|
+
from subprocess import Popen
|
|
3
4
|
from typing import Optional, Union
|
|
4
5
|
|
|
5
6
|
import numpy as np
|
|
@@ -116,7 +117,7 @@ class VideoWriter:
|
|
|
116
117
|
if not VisualLib.ffmpeg_available():
|
|
117
118
|
raise ValueError("FFMPEG is not installed.")
|
|
118
119
|
import ffmpeg
|
|
119
|
-
pipe = ffmpeg.input("pipe:", format="rawvideo", pix_fmt="rgb24", s=f"{video.shape[2]}x{video.shape[1]}") \
|
|
120
|
+
pipe: Popen = ffmpeg.input("pipe:", format="rawvideo", pix_fmt="rgb24", s=f"{video.shape[2]}x{video.shape[1]}") \
|
|
120
121
|
.output(path, format=ext[1:], pix_fmt="rgb24", r=video_fps) \
|
|
121
122
|
.overwrite_output() \
|
|
122
123
|
.run_async(pipe_stdin=True)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import socket
|
|
4
|
+
import urllib.request
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from urllib.error import HTTPError
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def push_gotify(message: str, url: Optional[str] = None, token: Optional[str] = None, title: Optional[str] = None,
|
|
10
|
+
priority: int = 0
|
|
11
|
+
):
|
|
12
|
+
"""
|
|
13
|
+
Push a message to a Gotify server.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
message (``str``): The message to be sent.
|
|
17
|
+
url (``str``, optional): The URL of the Gotify server. If not provided, it will be read from the environment variable GOTIFY_URL.
|
|
18
|
+
token (``str``, optional): The token for the Gotify server. If not provided, it will be read from the environment variable GOTIFY_TOKEN.
|
|
19
|
+
title (``str``, optional): The title of the message. Default is the hostname of the machine.
|
|
20
|
+
priority (``int``, optional): The priority of the message. Default is 0.
|
|
21
|
+
|
|
22
|
+
Examples::
|
|
23
|
+
|
|
24
|
+
push_gotify("This is a test message", "<URL>", "<APP_TOKEN>")
|
|
25
|
+
# then the message will be sent to the Gotify server.
|
|
26
|
+
# title = "<HOST_NAME>", message = "This is a test message", priority = 0
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
title = title or socket.gethostname()
|
|
30
|
+
url = url or os.environ.get("GOTIFY_URL")
|
|
31
|
+
if url is None:
|
|
32
|
+
raise ValueError("URL is not provided. Input url argument or set the environment variable GOTIFY_URL.")
|
|
33
|
+
token = token or os.environ.get("GOTIFY_TOKEN")
|
|
34
|
+
if token is None:
|
|
35
|
+
raise ValueError("Token is not provided. Input token argument or set the environment variable GOTIFY_TOKEN.")
|
|
36
|
+
url = f"{url.rstrip('/')}/message?token={token}"
|
|
37
|
+
data = json.dumps(
|
|
38
|
+
{"title": title, "message": message, "priority": priority}
|
|
39
|
+
).encode("utf-8")
|
|
40
|
+
req = urllib.request.Request(url, data=data, method="POST", headers={
|
|
41
|
+
"Content-Type": "application/json",
|
|
42
|
+
"User-Agent": "TensorNeko"
|
|
43
|
+
})
|
|
44
|
+
try:
|
|
45
|
+
with urllib.request.urlopen(req) as res:
|
|
46
|
+
pass
|
|
47
|
+
except HTTPError as e:
|
|
48
|
+
print(e.read().decode("utf-8"))
|
|
@@ -6,7 +6,8 @@ from abc import ABC, abstractmethod
|
|
|
6
6
|
from concurrent.futures import wait
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from enum import Enum
|
|
9
|
-
from typing import Dict, Type, Callable, TYPE_CHECKING, Any, Coroutine, Union, Set, TypeVar
|
|
9
|
+
from typing import Dict, Type, Callable, TYPE_CHECKING, Any, Coroutine, Union, Set, TypeVar, List
|
|
10
|
+
from concurrent.futures import Future
|
|
10
11
|
|
|
11
12
|
from ...backend.parallel import ExecutorPool, ParallelType
|
|
12
13
|
|
|
@@ -99,12 +100,7 @@ class EventBus:
|
|
|
99
100
|
.. code-block:: python
|
|
100
101
|
|
|
101
102
|
# useful decorators for default event bus
|
|
102
|
-
from tensorneko.util import
|
|
103
|
-
subscribe, # run in the main thread
|
|
104
|
-
subscribe_thread, # run in a new thread
|
|
105
|
-
subscribe_async, # run async
|
|
106
|
-
subscribe_process # run in a new process
|
|
107
|
-
)
|
|
103
|
+
from tensorneko.util import subscribe
|
|
108
104
|
# Event base type
|
|
109
105
|
from tensorneko.util import Event
|
|
110
106
|
|
|
@@ -117,15 +113,15 @@ class EventBus:
|
|
|
117
113
|
def log_information(event: LogEvent):
|
|
118
114
|
print(event.message)
|
|
119
115
|
|
|
120
|
-
@
|
|
116
|
+
@subscribe.thread
|
|
121
117
|
def log_information_thread(event: LogEvent):
|
|
122
118
|
print(event.message, "in another thread")
|
|
123
119
|
|
|
124
|
-
@
|
|
120
|
+
@subscribe.coro
|
|
125
121
|
async def log_information_async(event: LogEvent):
|
|
126
122
|
print(event.message, "async")
|
|
127
123
|
|
|
128
|
-
@
|
|
124
|
+
@subscribe.process
|
|
129
125
|
def log_information_process(event: LogEvent):
|
|
130
126
|
print(event.message, "in a new process")
|
|
131
127
|
|
|
@@ -171,6 +167,7 @@ class EventBus:
|
|
|
171
167
|
|
|
172
168
|
def __init__(self):
|
|
173
169
|
self.listeners: Dict[Type[E], Set[Listener]] = {}
|
|
170
|
+
self.futures: List[Future] = []
|
|
174
171
|
|
|
175
172
|
def register(self,
|
|
176
173
|
event_type: Type[E],
|
|
@@ -185,7 +182,7 @@ class EventBus:
|
|
|
185
182
|
self.listeners[event_type] = set()
|
|
186
183
|
self.listeners[event_type].add(Listener(func, func_name, emit_type))
|
|
187
184
|
|
|
188
|
-
def emit(self, event: E
|
|
185
|
+
def emit(self, event: E) -> None:
|
|
189
186
|
event_type: Type[E] = type(event)
|
|
190
187
|
if event_type in self.listeners:
|
|
191
188
|
normal_listeners = set()
|
|
@@ -216,8 +213,14 @@ class EventBus:
|
|
|
216
213
|
for listener in normal_listeners:
|
|
217
214
|
listener.func(event)
|
|
218
215
|
|
|
219
|
-
|
|
220
|
-
|
|
216
|
+
self.futures.extend(futures)
|
|
217
|
+
|
|
218
|
+
def wait(self):
|
|
219
|
+
"""
|
|
220
|
+
Wait for all the futures to be completed.
|
|
221
|
+
"""
|
|
222
|
+
wait(self.futures)
|
|
223
|
+
self.futures.clear()
|
|
221
224
|
|
|
222
225
|
@staticmethod
|
|
223
226
|
async def emit_async(async_listeners: Set[Listener], event: E) -> None:
|
{tensorneko_util-0.3.14 → tensorneko_util-0.3.15}/src/tensorneko_util/util/eventbus/event.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from contextlib import contextmanager
|
|
2
1
|
from typing import TypeVar
|
|
3
2
|
|
|
4
3
|
from .bus import EventBus
|
|
@@ -9,24 +8,10 @@ class EventMeta(type):
|
|
|
9
8
|
def __call__(cls, *args, **kwargs):
|
|
10
9
|
event = super().__call__(*args, **kwargs)
|
|
11
10
|
event.bus = kwargs.get("bus", EventBus.default)
|
|
12
|
-
event.bus.emit(event
|
|
11
|
+
event.bus.emit(event)
|
|
13
12
|
return event
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
_blocking_flag = True
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@contextmanager
|
|
20
|
-
def no_blocking():
|
|
21
|
-
"""
|
|
22
|
-
Context manager to disable blocking event handler.
|
|
23
|
-
"""
|
|
24
|
-
global _blocking_flag
|
|
25
|
-
_blocking_flag = False
|
|
26
|
-
yield
|
|
27
|
-
_blocking_flag = True
|
|
28
|
-
|
|
29
|
-
|
|
30
15
|
class Event(metaclass=EventMeta):
|
|
31
16
|
bus: EventBus
|
|
32
17
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.15
|