sciveo 0.1.63__tar.gz → 0.1.65__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 (165) hide show
  1. {sciveo-0.1.63 → sciveo-0.1.65}/PKG-INFO +2 -1
  2. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/tools/video_interactive.py +13 -2
  3. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/base.py +5 -5
  4. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/watchdog/process.py +4 -0
  5. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/random.py +13 -0
  6. sciveo-0.1.65/sciveo/version.py +2 -0
  7. sciveo-0.1.65/sciveo/web/__init__.py +0 -0
  8. sciveo-0.1.65/sciveo/web/common.py +138 -0
  9. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/PKG-INFO +2 -1
  10. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/SOURCES.txt +2 -0
  11. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/requires.txt +5 -0
  12. {sciveo-0.1.63 → sciveo-0.1.65}/setup.py +5 -0
  13. sciveo-0.1.63/sciveo/version.py +0 -2
  14. {sciveo-0.1.63 → sciveo-0.1.65}/README.md +0 -0
  15. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/__init__.py +0 -0
  16. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/api/__init__.py +0 -0
  17. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/api/base.py +0 -0
  18. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/api/predictors.py +0 -0
  19. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/api/server.py +0 -0
  20. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/api/upload.py +0 -0
  21. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/cli.py +0 -0
  22. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/common/__init__.py +0 -0
  23. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/common/configuration.py +0 -0
  24. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/common/model.py +0 -0
  25. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/common/optimizers.py +0 -0
  26. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/common/sampling.py +0 -0
  27. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/content/__init__.py +0 -0
  28. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/content/dataset.py +0 -0
  29. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/content/experiment.py +0 -0
  30. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/content/project.py +0 -0
  31. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/content/runner.py +0 -0
  32. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/__init__.py +0 -0
  33. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/capture/__init__.py +0 -0
  34. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/capture/cam.py +0 -0
  35. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/capture/nvr.py +0 -0
  36. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/__init__.py +0 -0
  37. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/base.py +0 -0
  38. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/encoders/__init__.py +0 -0
  39. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/encoders/base.py +0 -0
  40. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/encoders/normalizer.py +0 -0
  41. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/nlp/__init__.py +0 -0
  42. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/nlp/search.py +0 -0
  43. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/time_series/__init__.py +0 -0
  44. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/time_series/dataset.py +0 -0
  45. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/time_series/predictor.py +0 -0
  46. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/time_series/trainer.py +0 -0
  47. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/ml/time_series/window_generator.py +0 -0
  48. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/__init__.py +0 -0
  49. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/base.py +0 -0
  50. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/job_daemon.py +0 -0
  51. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/layouts/__init__.py +0 -0
  52. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/layouts/base.py +0 -0
  53. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/pipeline.py +0 -0
  54. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/postprocessors/__init__.py +0 -0
  55. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/postprocessors/base.py +0 -0
  56. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/postprocessors/default.py +0 -0
  57. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/__init__.py +0 -0
  58. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/audio/__init__.py +0 -0
  59. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/audio/audio.py +0 -0
  60. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/audio/audio_extractor_process.py +0 -0
  61. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/aws.py +0 -0
  62. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/base.py +0 -0
  63. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/file/__init__.py +0 -0
  64. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/file/archive.py +0 -0
  65. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/__init__.py +0 -0
  66. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/album.py +0 -0
  67. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/album_in_image.py +0 -0
  68. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/depth_esimation.py +0 -0
  69. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/embeddings.py +0 -0
  70. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/filters.py +0 -0
  71. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/generators.py +0 -0
  72. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/histogram.py +0 -0
  73. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/mask.py +0 -0
  74. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/object_detection.py +0 -0
  75. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/resize.py +0 -0
  76. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/segmentation.py +0 -0
  77. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/image/watermark.py +0 -0
  78. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/media_info.py +0 -0
  79. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/nlp/__init__.py +0 -0
  80. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/nlp/address.py +0 -0
  81. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/qr.py +0 -0
  82. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/__init__.py +0 -0
  83. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/base.py +0 -0
  84. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/dataset.py +0 -0
  85. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/time_series/__init__.py +0 -0
  86. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/time_series/predictor.py +0 -0
  87. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/sci/time_series/trainer.py +0 -0
  88. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/tpu_base.py +0 -0
  89. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/__init__.py +0 -0
  90. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/generators.py +0 -0
  91. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/motion_detection.py +0 -0
  92. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/resize.py +0 -0
  93. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/video_album.py +0 -0
  94. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/video_frames.py +0 -0
  95. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/processors/video/video_resample.py +0 -0
  96. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/queues.py +0 -0
  97. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/server.py +0 -0
  98. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/web/__init__.py +0 -0
  99. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/pipelines/web/server.py +0 -0
  100. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/media/tools/__init__.py +0 -0
  101. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/__init__.py +0 -0
  102. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/dataset/__init__.py +0 -0
  103. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/dataset/object_detection.py +0 -0
  104. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/evaluation/__init__.py +0 -0
  105. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/evaluation/markdown.py +0 -0
  106. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/evaluation/object_detection.py +0 -0
  107. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/__init__.py +0 -0
  108. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/base.py +0 -0
  109. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/description.py +0 -0
  110. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/embeddings.py +0 -0
  111. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/object_detection.py +0 -0
  112. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/tools.py +0 -0
  113. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/images/transformers.py +0 -0
  114. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/nlp/__init__.py +0 -0
  115. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/nlp/embeddings.py +0 -0
  116. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/nlp/tokenizers/__init__.py +0 -0
  117. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/nlp/tokenizers/bpe.py +0 -0
  118. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/video/__init__.py +0 -0
  119. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/ml/video/description.py +0 -0
  120. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/__init__.py +0 -0
  121. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/monitor.py +0 -0
  122. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/start.py +0 -0
  123. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/watchdog/__init__.py +0 -0
  124. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/monitoring/watchdog/base.py +0 -0
  125. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/network/__init__.py +0 -0
  126. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/network/camera.py +0 -0
  127. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/network/sniffer.py +0 -0
  128. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/network/tools.py +0 -0
  129. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/__init__.py +0 -0
  130. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/array.py +0 -0
  131. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/aws/__init__.py +0 -0
  132. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/aws/priority_queue.py +0 -0
  133. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/aws/s3.py +0 -0
  134. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/common.py +0 -0
  135. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/complexity.py +0 -0
  136. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/compress.py +0 -0
  137. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/configuration.py +0 -0
  138. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/crypto.py +0 -0
  139. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/daemon.py +0 -0
  140. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/draw/__init__.py +0 -0
  141. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/draw/contours.py +0 -0
  142. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/formating.py +0 -0
  143. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/hardware.py +0 -0
  144. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/http.py +0 -0
  145. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/logger.py +0 -0
  146. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/os.py +0 -0
  147. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/queue.py +0 -0
  148. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/remote.py +0 -0
  149. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/simple_counter.py +0 -0
  150. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/synchronized.py +0 -0
  151. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo/tools/timers.py +0 -0
  152. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/dependency_links.txt +0 -0
  153. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/entry_points.txt +0 -0
  154. {sciveo-0.1.63 → sciveo-0.1.65}/sciveo.egg-info/top_level.txt +0 -0
  155. {sciveo-0.1.63 → sciveo-0.1.65}/setup.cfg +0 -0
  156. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_complexity.py +0 -0
  157. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_compress.py +0 -0
  158. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_configuration.py +0 -0
  159. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_crypto.py +0 -0
  160. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_eval_markdown.py +0 -0
  161. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_ml_datasets.py +0 -0
  162. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_monitoring.py +0 -0
  163. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_runner.py +0 -0
  164. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_sampling.py +0 -0
  165. {sciveo-0.1.63 → sciveo-0.1.65}/test/test_tokenizers.py +0 -0
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.63
3
+ Version: 0.1.65
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
7
7
  Provides-Extra: server
8
8
  Provides-Extra: media
9
9
  Provides-Extra: media-ml
10
+ Provides-Extra: web
10
11
  Provides-Extra: all
11
12
  Provides-Extra: ml
12
13
 
@@ -35,6 +35,7 @@ class BaseInteractiveVideoPlayer:
35
35
  self.progress_lock = threading.Lock()
36
36
  self.frame_lock = threading.Lock()
37
37
  self.ui_video_progress_tag = "video time progress"
38
+ self.current_mouse_pos = (0,0)
38
39
 
39
40
  self.fps_ui = FPSCounter(tag="ui", period=1, print_period=600)
40
41
  self.fps_read = FPSCounter(tag="read", period=1, print_period=600)
@@ -44,6 +45,10 @@ class BaseInteractiveVideoPlayer:
44
45
  threading.Thread(target=self.read, daemon=True)
45
46
  ]
46
47
 
48
+ def _mouse_callback(self, event, x, y, flags, param):
49
+ if event == cv2.EVENT_MOUSEMOVE:
50
+ self.current_mouse_pos = (x, y)
51
+
47
52
  def callback_video_progress(self, x):
48
53
  # debug("callback_video_progress", x)
49
54
  with self.frame_lock:
@@ -79,10 +84,14 @@ class BaseInteractiveVideoPlayer:
79
84
  cv2.setTrackbarPos(self.ui_video_progress_tag, self.frame_tag, self.frame_id)
80
85
 
81
86
  def draw(self, frame, result):
82
- cv2.putText(frame, f"R[{result}]", (30, 80), cv2.FONT_HERSHEY_SIMPLEX, 1.3, (0, 255, 255), 2)
87
+ cv2.putText(frame, f"R[{result}]", (30, 80), cv2.FONT_HERSHEY_SIMPLEX, 1.3, (0, 0, 255), 2)
88
+
89
+ def on_key(self, key):
90
+ pass
83
91
 
84
92
  def run(self, max_display_width=1024):
85
93
  cv2.namedWindow(self.frame_tag, cv2.WINDOW_NORMAL)
94
+ cv2.setMouseCallback(self.frame_tag, self._mouse_callback)
86
95
 
87
96
  self.cap = cv2.VideoCapture(self.path_video)
88
97
 
@@ -108,7 +117,7 @@ class BaseInteractiveVideoPlayer:
108
117
  current_result = self.result.copy()
109
118
 
110
119
  if current_frame is not None:
111
- cv2.putText(current_frame, f"FPS read {round(self.fps_read.value, 1)} ui {round(self.fps_ui.value, 1)} T {round(self.frame_id / self.video_fps, 3)}s", (30, 40), cv2.FONT_HERSHEY_SIMPLEX, 1.3, (0, 255, 0), 4)
120
+ cv2.putText(current_frame, f"FPS read {round(self.fps_read.value, 1)} ui {round(self.fps_ui.value, 1)} T[{self.frame_id}] {round(self.frame_id / self.video_fps, 3)}s", (30, 40), cv2.FONT_HERSHEY_SIMPLEX, 1.3, (0, 255, 0), 4)
112
121
  self.draw(current_frame, current_result)
113
122
  height, width = current_frame.shape[:2]
114
123
  if width > max_display_width:
@@ -128,6 +137,8 @@ class BaseInteractiveVideoPlayer:
128
137
  frame_path = os.path.join(self.path_base, f"{self.file_name_base}-{self.frame_id}.png")
129
138
  cv2.imwrite(frame_path, original_current_frame)
130
139
  debug(f"saved frame {self.frame_id} to {frame_path}")
140
+ else:
141
+ self.on_key(key)
131
142
 
132
143
  self.cap.release()
133
144
  cv2.destroyAllWindows()
@@ -31,16 +31,16 @@ class BaseML:
31
31
  self.init_models()
32
32
 
33
33
  def init_models(self):
34
- warning("init_models not implemented")
34
+ debug("init_models not implemented")
35
35
 
36
36
  def init(self):
37
- warning("init not implemented")
37
+ debug("init not implemented")
38
38
 
39
39
  def post_init(self):
40
- warning("post_init not implemented")
40
+ debug("post_init not implemented")
41
41
 
42
42
  def predict_one(self, x):
43
- warning("predict_one not implemented")
43
+ debug("predict_one not implemented")
44
44
 
45
45
  def predict(self, X):
46
46
  predictions = []
@@ -49,7 +49,7 @@ class BaseML:
49
49
  return predictions
50
50
 
51
51
  def train(self, X, Y_true=None):
52
- warning("train not implemented")
52
+ debug("train not implemented")
53
53
 
54
54
  def describe(self):
55
55
  return f"{type(self).__name__}: {self.model_name}"
@@ -64,13 +64,17 @@ class ProcessWatchDogDaemon(BaseWatchDogDaemon):
64
64
 
65
65
  def check_threads(self, process, pid):
66
66
  current_time = time.time()
67
+ delete_thread_info = []
67
68
  for tid, thr in self.info_threads[pid].items():
68
69
  check_time = int(current_time - thr["last_check"])
69
70
  if check_time > 1.5 * self.period:
71
+ delete_thread_info.append(tid)
70
72
  continue
71
73
  elapsed_time = int(current_time - thr["last_active"])
72
74
  if elapsed_time > self.thread_inactive_threshold:
73
75
  warning(f"⚠️ process[{pid}] thread[{tid}] inactive for {elapsed_time}s.")
76
+ for tid in delete_thread_info:
77
+ self.info_threads[pid].pop(tid, None)
74
78
 
75
79
  def process_value(self, pid):
76
80
  try:
@@ -11,6 +11,19 @@
11
11
 
12
12
  import random
13
13
  import string
14
+ import datetime
15
+ import uuid
16
+
17
+
18
+ def new_guid_uuid():
19
+ return datetime.datetime.now().strftime("%Y%m%d%H%M%S") + "-" + str(uuid.uuid4()).replace("-", "")
20
+
21
+ def random_token(num_characters):
22
+ characters = string.ascii_letters + string.digits
23
+ return ''.join(random.choices(characters, k=num_characters))
24
+
25
+ def new_guid(num_characters=32):
26
+ return datetime.datetime.now().strftime("%Y%m%d%H%M%S") + "-" + random_token(num_characters)
14
27
 
15
28
 
16
29
  def random_password(length):
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.1.65'
File without changes
@@ -0,0 +1,138 @@
1
+ from django.http import JsonResponse, HttpResponseForbidden
2
+ from django.core.paginator import Paginator
3
+ from django.forms.models import model_to_dict
4
+ from django.db.models import Q, Case, Value, When, IntegerField
5
+ from sciveo.tools.logger import *
6
+
7
+
8
+ class SinglePage_:
9
+ def __init__(self, object_list):
10
+ self.object_list = object_list
11
+
12
+ class SinglePaginator_:
13
+ def __init__(self, object_list):
14
+ self.object_list = object_list
15
+ self.count = -1
16
+ self.num_pages = -1
17
+
18
+ def page(self, page_num):
19
+ return SinglePage_(self.object_list)
20
+
21
+ def filter_query(request, model_objects, list_query):
22
+ filter_dict = {}
23
+ for q in list_query:
24
+ if q in request.GET:
25
+ q_list = request.GET.getlist(q)
26
+ filter_dict[f"{q}__in"] = q_list
27
+ model_objects = model_objects.filter(**filter_dict)
28
+
29
+ query_objects = []
30
+ for q in list_query:
31
+ negative_q = f"~{q}"
32
+ if negative_q in request.GET:
33
+ q_list = request.GET.getlist(negative_q)
34
+ for q_value in q_list:
35
+ query_objects.append(~Q(**{q: q_value}))
36
+ if len(query_objects) > 0:
37
+ query = query_objects.pop()
38
+ for q_obj in query_objects:
39
+ query &= q_obj
40
+ model_objects = model_objects.filter(query)
41
+
42
+ return model_objects
43
+
44
+ def admin_required(view_func):
45
+ def wrapper_func(request, *args, **kwargs):
46
+ if request.user.is_authenticated and request.user.is_superuser:
47
+ return view_func(request, *args, **kwargs)
48
+ else:
49
+ return HttpResponseForbidden()
50
+ return wrapper_func
51
+
52
+ def data_model_to_dict(object, fields=None, recursive=True):
53
+ data = model_to_dict(object, fields=fields)
54
+
55
+ for k in ["created_at", "updated_at"]:
56
+ if hasattr(object, k):
57
+ data[k] = getattr(object, k)
58
+
59
+ for k, v in data.items():
60
+ if isinstance(v, list):
61
+ if recursive:
62
+ data[k] = [data_model_to_dict(obj, fields, recursive) for obj in v]
63
+ else:
64
+ data[k] = [str(obj) for obj in v]
65
+ return data
66
+
67
+ def paginated(request, model_objects, order_default="'id'", already_paginated=False):
68
+ page_current = int(request.GET.get('page', 1))
69
+ page_limit = int(request.GET.get('limit', 10))
70
+ order = request.GET.get('order', order_default)[1:-1]
71
+ fields = request.GET.get('fields', None)
72
+ recursive = "recursive" in request.GET
73
+
74
+ try:
75
+ if already_paginated:
76
+ paginator = SinglePaginator_(model_objects)
77
+ else:
78
+ paginator = Paginator(model_objects.order_by(order), page_limit)
79
+
80
+ page = paginator.page(page_current)
81
+
82
+ data = [data_model_to_dict(obj, fields, recursive) for obj in page.object_list]
83
+
84
+ result = {
85
+ "pagination": {
86
+ 'page': page_current,
87
+ 'limit': page_limit,
88
+ 'total_pages': paginator.num_pages,
89
+ 'total_count': paginator.count,
90
+ },
91
+ "data": data
92
+ }
93
+ except Exception as e:
94
+ error("paginated", e)
95
+ result = {"error": str(e)}
96
+
97
+ return JsonResponse(result)
98
+
99
+
100
+ def filter_on_list(queryset, column_name, filter_list):
101
+ """
102
+ Filters the given queryset based on the values of the specified column
103
+ according to the filter_list.
104
+
105
+ Args:
106
+ queryset (QuerySet): The queryset to be sorted.
107
+ column_name (str): The name of the column to sort on.
108
+ filter_list (list): The list defining the desired order.
109
+
110
+ Returns:
111
+ QuerySet: The filtered queryset.
112
+ """
113
+ return queryset.filter(Q(**{column_name + '__in': filter_list}))
114
+
115
+ def sort_on_list(queryset, column_name, sort_list):
116
+ """
117
+ Sorts the given queryset based on the values of the specified column
118
+ according to the order defined in the sort_list.
119
+
120
+ Args:
121
+ queryset (QuerySet): The queryset to be sorted.
122
+ column_name (str): The name of the column to sort on.
123
+ sort_list (list): The list defining the desired order.
124
+
125
+ Returns:
126
+ QuerySet: The sorted queryset.
127
+ """
128
+ # Create a Case/When expression for each value in the desired order
129
+ # Assign a numerical value to each item in the list
130
+ # Use the Case/When expression to annotate each object with its numerical value
131
+ # Use the annotated value to order the queryset
132
+ return queryset.annotate(
133
+ custom_order=Case(
134
+ *[When(**{column_name: value}, then=Value(index)) for index, value in enumerate(sort_list)],
135
+ default=Value(len(sort_list)),
136
+ output_field=IntegerField()
137
+ )
138
+ ).order_by('custom_order')
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.63
3
+ Version: 0.1.65
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
7
7
  Provides-Extra: server
8
8
  Provides-Extra: media
9
9
  Provides-Extra: media-ml
10
+ Provides-Extra: web
10
11
  Provides-Extra: all
11
12
  Provides-Extra: ml
12
13
 
@@ -148,6 +148,8 @@ sciveo/tools/aws/priority_queue.py
148
148
  sciveo/tools/aws/s3.py
149
149
  sciveo/tools/draw/__init__.py
150
150
  sciveo/tools/draw/contours.py
151
+ sciveo/web/__init__.py
152
+ sciveo/web/common.py
151
153
  test/test_complexity.py
152
154
  test/test_compress.py
153
155
  test/test_configuration.py
@@ -91,3 +91,8 @@ fastapi>=0.0.0
91
91
  uvicorn[standard]>=0.0.0
92
92
  flask>=0.0.0
93
93
  waitress>=0.0.0
94
+
95
+ [web]
96
+ django>=0.0.0
97
+ djangorestframework>=0.0.0
98
+ django-allauth>=0.0.0
@@ -36,6 +36,11 @@ extras_require = {
36
36
  'torch>=0.0.0', 'torchvision>=0.0.0',
37
37
  'diffusers>=0.0.0', 'transformers>=0.0.0', 'sentence_transformers>=0.0.0', 'accelerate>=0.0.0', 'annoy>=0.0.0',
38
38
  'ultralytics>=0.0.0'
39
+ ],
40
+ 'web': [
41
+ 'django>=0.0.0',
42
+ 'djangorestframework>=0.0.0',
43
+ 'django-allauth>=0.0.0',
39
44
  ]
40
45
  }
41
46
 
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.1.63'
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
File without changes
File without changes