cmdbox 0.1.0__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 (202) hide show
  1. cmdbox-0.1.0/LICENSE +21 -0
  2. cmdbox-0.1.0/MANIFEST.in +18 -0
  3. cmdbox-0.1.0/PKG-INFO +38 -0
  4. cmdbox-0.1.0/README.md +14 -0
  5. cmdbox-0.1.0/cmdbox/__init__.py +3 -0
  6. cmdbox-0.1.0/cmdbox/__main__.py +4 -0
  7. cmdbox-0.1.0/cmdbox/app/__init__.py +0 -0
  8. cmdbox-0.1.0/cmdbox/app/app.py +116 -0
  9. cmdbox-0.1.0/cmdbox/app/client.py +383 -0
  10. cmdbox-0.1.0/cmdbox/app/common.py +444 -0
  11. cmdbox-0.1.0/cmdbox/app/commons/convert.py +249 -0
  12. cmdbox-0.1.0/cmdbox/app/commons/module.py +69 -0
  13. cmdbox-0.1.0/cmdbox/app/commons/redis_client.py +301 -0
  14. cmdbox-0.1.0/cmdbox/app/feature.py +140 -0
  15. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_copy.py +209 -0
  16. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_download.py +209 -0
  17. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_list.py +195 -0
  18. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +193 -0
  19. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_move.py +201 -0
  20. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_remove.py +192 -0
  21. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +192 -0
  22. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_file_upload.py +214 -0
  23. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_client_server_info.py +168 -0
  24. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_gui_start.py +115 -0
  25. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_server_list.py +90 -0
  26. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_server_start.py +105 -0
  27. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_server_stop.py +139 -0
  28. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_web_gencert.py +152 -0
  29. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_web_start.py +130 -0
  30. cmdbox-0.1.0/cmdbox/app/features/cli/cmdbox_web_stop.py +72 -0
  31. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_assets.py +48 -0
  32. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_bbforce_cmd.py +45 -0
  33. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_copyright.py +26 -0
  34. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_del_cmd.py +29 -0
  35. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_del_pipe.py +30 -0
  36. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_do_signin.py +39 -0
  37. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_do_signout.py +22 -0
  38. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_exec_cmd.py +176 -0
  39. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_exec_pipe.py +175 -0
  40. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_filer.py +56 -0
  41. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_filer_upload.py +64 -0
  42. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_get_cmd_choices.py +28 -0
  43. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_get_cmds.py +26 -0
  44. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_get_modes.py +25 -0
  45. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_get_server_opt.py +28 -0
  46. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_gui.py +115 -0
  47. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_gui_callback.py +49 -0
  48. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_list_cmd.py +49 -0
  49. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_list_pipe.py +51 -0
  50. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_load_cmd.py +45 -0
  51. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_load_pipe.py +46 -0
  52. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_raw_cmd.py +53 -0
  53. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_raw_pipe.py +81 -0
  54. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_save_cmd.py +48 -0
  55. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_save_pipe.py +47 -0
  56. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_signin.py +46 -0
  57. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_usesignout.py +25 -0
  58. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_versions_cmdbox.py +25 -0
  59. cmdbox-0.1.0/cmdbox/app/features/web/cmdbox_web_versions_used.py +35 -0
  60. cmdbox-0.1.0/cmdbox/app/filer.py +338 -0
  61. cmdbox-0.1.0/cmdbox/app/options.py +286 -0
  62. cmdbox-0.1.0/cmdbox/app/server.py +212 -0
  63. cmdbox-0.1.0/cmdbox/app/web.py +229 -0
  64. cmdbox-0.1.0/cmdbox/config.yml +3 -0
  65. cmdbox-0.1.0/cmdbox/extensions/features.yml +3 -0
  66. cmdbox-0.1.0/cmdbox/extensions/user_list.txt +4 -0
  67. cmdbox-0.1.0/cmdbox/licenses/LICENSE.Jinja2.3.1.4(BSD License).txt +28 -0
  68. cmdbox-0.1.0/cmdbox/licenses/LICENSE.MarkupSafe.3.0.2(BSD License).txt +28 -0
  69. cmdbox-0.1.0/cmdbox/licenses/LICENSE.PyYAML.6.0.2(MIT License).txt +20 -0
  70. cmdbox-0.1.0/cmdbox/licenses/LICENSE.Pygments.2.18.0(BSD License).txt +25 -0
  71. cmdbox-0.1.0/cmdbox/licenses/LICENSE.Sphinx.8.1.3(BSD License).txt +31 -0
  72. cmdbox-0.1.0/cmdbox/licenses/LICENSE.alabaster.1.0.0(BSD License).txt +34 -0
  73. cmdbox-0.1.0/cmdbox/licenses/LICENSE.annotated-types.0.7.0(MIT License).txt +21 -0
  74. cmdbox-0.1.0/cmdbox/licenses/LICENSE.anyio.4.6.2.post1(MIT License).txt +20 -0
  75. cmdbox-0.1.0/cmdbox/licenses/LICENSE.argcomplete.3.5.1(Apache Software License).txt +177 -0
  76. cmdbox-0.1.0/cmdbox/licenses/LICENSE.babel.2.16.0(BSD License).txt +27 -0
  77. cmdbox-0.1.0/cmdbox/licenses/LICENSE.certifi.2024.8.30(Mozilla Public License 2.0 (MPL 2.0)).txt +20 -0
  78. cmdbox-0.1.0/cmdbox/licenses/LICENSE.cffi.1.17.1(MIT License).txt +26 -0
  79. cmdbox-0.1.0/cmdbox/licenses/LICENSE.charset-normalizer.3.4.0(MIT License).txt +21 -0
  80. cmdbox-0.1.0/cmdbox/licenses/LICENSE.click.8.1.7(BSD License).txt +28 -0
  81. cmdbox-0.1.0/cmdbox/licenses/LICENSE.colorama.0.4.6(BSD License).txt +27 -0
  82. cmdbox-0.1.0/cmdbox/licenses/LICENSE.cryptography.43.0.3(Apache Software License; BSD License).txt +3 -0
  83. cmdbox-0.1.0/cmdbox/licenses/LICENSE.docutils.0.21.2(BSD License; GNU General Public License (GPL); Public Domain; Python Software Foundation License).txt +159 -0
  84. cmdbox-0.1.0/cmdbox/licenses/LICENSE.fastapi.0.115.5(MIT License).txt +21 -0
  85. cmdbox-0.1.0/cmdbox/licenses/LICENSE.gevent.24.11.1(MIT License).txt +25 -0
  86. cmdbox-0.1.0/cmdbox/licenses/LICENSE.greenlet.3.1.1(MIT License).txt +30 -0
  87. cmdbox-0.1.0/cmdbox/licenses/LICENSE.h11.0.14.0(MIT License).txt +22 -0
  88. cmdbox-0.1.0/cmdbox/licenses/LICENSE.idna.3.10(BSD License).txt +31 -0
  89. cmdbox-0.1.0/cmdbox/licenses/LICENSE.imagesize.1.4.1(MIT License).txt +19 -0
  90. cmdbox-0.1.0/cmdbox/licenses/LICENSE.itsdangerous.2.2.0(BSD License).txt +28 -0
  91. cmdbox-0.1.0/cmdbox/licenses/LICENSE.numpy.2.1.3(BSD License).txt +950 -0
  92. cmdbox-0.1.0/cmdbox/licenses/LICENSE.packaging.24.2(Apache Software License; BSD License).txt +3 -0
  93. cmdbox-0.1.0/cmdbox/licenses/LICENSE.pillow.11.0.0(CMU License (MIT-CMU)).txt +1226 -0
  94. cmdbox-0.1.0/cmdbox/licenses/LICENSE.pip.24.0(MIT License).txt +20 -0
  95. cmdbox-0.1.0/cmdbox/licenses/LICENSE.prettytable.3.12.0(BSD License).txt +30 -0
  96. cmdbox-0.1.0/cmdbox/licenses/LICENSE.pycparser.2.22(BSD License).txt +27 -0
  97. cmdbox-0.1.0/cmdbox/licenses/LICENSE.pydantic.2.10.1(MIT License).txt +21 -0
  98. cmdbox-0.1.0/cmdbox/licenses/LICENSE.pydantic_core.2.27.1(MIT License).txt +21 -0
  99. cmdbox-0.1.0/cmdbox/licenses/LICENSE.python-multipart.0.0.17(Apache Software License).txt +14 -0
  100. cmdbox-0.1.0/cmdbox/licenses/LICENSE.redis.5.2.0(MIT License).txt +21 -0
  101. cmdbox-0.1.0/cmdbox/licenses/LICENSE.requests.2.32.3(Apache Software License).txt +175 -0
  102. cmdbox-0.1.0/cmdbox/licenses/LICENSE.setuptools.65.5.0(MIT License).txt +19 -0
  103. cmdbox-0.1.0/cmdbox/licenses/LICENSE.six.1.16.0(MIT License).txt +18 -0
  104. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sniffio.1.3.1(Apache Software License; MIT License).txt +3 -0
  105. cmdbox-0.1.0/cmdbox/licenses/LICENSE.snowballstemmer.2.2.0(BSD License).txt +29 -0
  106. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinx-intl.2.3.0(BSD License).txt +25 -0
  107. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinx-rtd-theme.3.0.2(MIT License).txt +20 -0
  108. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinx-sitemap.2.6.0(MIT License).txt +21 -0
  109. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinx_fontawesome.0.0.6(GNU General Public License v2 (GPLv2)).txt +339 -0
  110. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-applehelp.2.0.0(BSD License).txt +1 -0
  111. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-devhelp.2.0.0(BSD License).txt +1 -0
  112. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-htmlhelp.2.1.0(BSD License).txt +1 -0
  113. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-jquery.4.1(BSD License).txt +1 -0
  114. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-jsmath.1.0.1(BSD License).txt +29 -0
  115. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-qthelp.2.0.0(BSD License).txt +1 -0
  116. cmdbox-0.1.0/cmdbox/licenses/LICENSE.sphinxcontrib-serializinghtml.2.0.0(BSD License).txt +1 -0
  117. cmdbox-0.1.0/cmdbox/licenses/LICENSE.starlette.0.41.3(BSD License).txt +27 -0
  118. cmdbox-0.1.0/cmdbox/licenses/LICENSE.tabulate.0.9.0(MIT License).txt +20 -0
  119. cmdbox-0.1.0/cmdbox/licenses/LICENSE.tomli.2.1.0(MIT License).txt +21 -0
  120. cmdbox-0.1.0/cmdbox/licenses/LICENSE.typing_extensions.4.12.2(Python Software Foundation License).txt +279 -0
  121. cmdbox-0.1.0/cmdbox/licenses/LICENSE.urllib3.2.2.3(MIT License).txt +21 -0
  122. cmdbox-0.1.0/cmdbox/licenses/LICENSE.uvicorn.0.32.1(BSD License).txt +27 -0
  123. cmdbox-0.1.0/cmdbox/licenses/LICENSE.wcwidth.0.2.13(MIT License).txt +27 -0
  124. cmdbox-0.1.0/cmdbox/licenses/LICENSE.wheel.0.45.1(MIT License).txt +21 -0
  125. cmdbox-0.1.0/cmdbox/licenses/LICENSE.zope.event.5.0(Zope Public License).txt +44 -0
  126. cmdbox-0.1.0/cmdbox/licenses/LICENSE.zope.interface.7.1.1(Zope Public License).txt +44 -0
  127. cmdbox-0.1.0/cmdbox/licenses/files.txt +61 -0
  128. cmdbox-0.1.0/cmdbox/logconf_client.yml +30 -0
  129. cmdbox-0.1.0/cmdbox/logconf_gui.yml +30 -0
  130. cmdbox-0.1.0/cmdbox/logconf_server.yml +30 -0
  131. cmdbox-0.1.0/cmdbox/logconf_web.yml +30 -0
  132. cmdbox-0.1.0/cmdbox/version.py +28 -0
  133. cmdbox-0.1.0/cmdbox/web/assets/bootstrap/bootstrap.bundle.min.5.3.0.js +7 -0
  134. cmdbox-0.1.0/cmdbox/web/assets/bootstrap/bootstrap.min.5.3.0.css +6 -0
  135. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/common.js +728 -0
  136. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/favicon.ico +0 -0
  137. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/favicons.zip +0 -0
  138. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/filer_modal.js +152 -0
  139. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/icon.png +0 -0
  140. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/icon3.png +0 -0
  141. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/list_cmd.js +424 -0
  142. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/list_pipe.js +184 -0
  143. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/main.js +96 -0
  144. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/open_capture.js +17 -0
  145. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/open_output_json.js +17 -0
  146. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/signin.js +65 -0
  147. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/view_raw.js +32 -0
  148. cmdbox-0.1.0/cmdbox/web/assets/cmdbox/view_result.js +146 -0
  149. cmdbox-0.1.0/cmdbox/web/assets/encodingjs/LICENSE.txt +21 -0
  150. cmdbox-0.1.0/cmdbox/web/assets/encodingjs/encoding.js +6082 -0
  151. cmdbox-0.1.0/cmdbox/web/assets/encodingjs/encoding.min.js +7 -0
  152. cmdbox-0.1.0/cmdbox/web/assets/filer/filer.js +717 -0
  153. cmdbox-0.1.0/cmdbox/web/assets/filer/main.css +20 -0
  154. cmdbox-0.1.0/cmdbox/web/assets/filer/main.js +14 -0
  155. cmdbox-0.1.0/cmdbox/web/assets/highlight/default.css +117 -0
  156. cmdbox-0.1.0/cmdbox/web/assets/highlight/highlight.min.js +3861 -0
  157. cmdbox-0.1.0/cmdbox/web/assets/highlight/styles/tokyo-night-dark.min.css +8 -0
  158. cmdbox-0.1.0/cmdbox/web/assets/jquery/jquery.min.3.2.0.js +4 -0
  159. cmdbox-0.1.0/cmdbox/web/assets/jquery-linedtextarea/README.md +23 -0
  160. cmdbox-0.1.0/cmdbox/web/assets/jquery-linedtextarea/jquery-linedtextarea-license.txt +25 -0
  161. cmdbox-0.1.0/cmdbox/web/assets/jquery-linedtextarea/jquery-linedtextarea.css +68 -0
  162. cmdbox-0.1.0/cmdbox/web/assets/jquery-linedtextarea/jquery-linedtextarea.html +46 -0
  163. cmdbox-0.1.0/cmdbox/web/assets/jquery-linedtextarea/jquery-linedtextarea.js +149 -0
  164. cmdbox-0.1.0/cmdbox/web/assets/jquery-resizable/jquery-resizable.min.js +1 -0
  165. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/AUTHORS.txt +372 -0
  166. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/LICENSE.txt +43 -0
  167. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
  168. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
  169. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
  170. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
  171. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
  172. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  173. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/jquery-ui.min.css +7 -0
  174. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/jquery-ui.min.js +6 -0
  175. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/jquery-ui.structure.min.css +5 -0
  176. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/jquery-ui.theme.min.css +5 -0
  177. cmdbox-0.1.0/cmdbox/web/assets/jquery-ui/package.json +74 -0
  178. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/css/lightbox.min.css +1 -0
  179. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/images/close.png +0 -0
  180. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/images/loading.gif +0 -0
  181. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/images/next.png +0 -0
  182. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/images/prev.png +0 -0
  183. cmdbox-0.1.0/cmdbox/web/assets/lightbox2/js/lightbox.min.js +15 -0
  184. cmdbox-0.1.0/cmdbox/web/assets/split-pane/split-pane.css +121 -0
  185. cmdbox-0.1.0/cmdbox/web/assets/split-pane/split-pane.js +366 -0
  186. cmdbox-0.1.0/cmdbox/web/assets/tree-menu/css/tree-menu.css +53 -0
  187. cmdbox-0.1.0/cmdbox/web/assets/tree-menu/image/file.png +0 -0
  188. cmdbox-0.1.0/cmdbox/web/assets/tree-menu/image/folder-close.png +0 -0
  189. cmdbox-0.1.0/cmdbox/web/assets/tree-menu/image/folder-open.png +0 -0
  190. cmdbox-0.1.0/cmdbox/web/assets/tree-menu/js/tree-menu.js +27 -0
  191. cmdbox-0.1.0/cmdbox/web/assets_license_list.txt +10 -0
  192. cmdbox-0.1.0/cmdbox/web/filer.html +216 -0
  193. cmdbox-0.1.0/cmdbox/web/gui.html +466 -0
  194. cmdbox-0.1.0/cmdbox/web/signin.html +85 -0
  195. cmdbox-0.1.0/cmdbox.egg-info/PKG-INFO +38 -0
  196. cmdbox-0.1.0/cmdbox.egg-info/SOURCES.txt +200 -0
  197. cmdbox-0.1.0/cmdbox.egg-info/dependency_links.txt +1 -0
  198. cmdbox-0.1.0/cmdbox.egg-info/entry_points.txt +2 -0
  199. cmdbox-0.1.0/cmdbox.egg-info/requires.txt +13 -0
  200. cmdbox-0.1.0/cmdbox.egg-info/top_level.txt +1 -0
  201. cmdbox-0.1.0/setup.cfg +4 -0
  202. cmdbox-0.1.0/setup.py +99 -0
cmdbox-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 hamacom2004jp All Rights Reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ # Files to include
2
+ include cmdbox/*.yml
3
+ include cmdbox/extensions/**
4
+ include cmdbox/docker/**
5
+ include cmdbox/licenses/**
6
+ include cmdbox/tools/**
7
+ include cmdbox/web/**
8
+
9
+ # Files to exclude
10
+ global-exclude *.pyc
11
+ global-exclude *.swp
12
+ global-exclude .DS_Store
13
+ global-exclude cmdbox/extensions/data/*.json
14
+ global-exclude cmdbox/extensions/data/*/*.jpg
15
+ global-exclude cmdbox/extensions/data/*/*.svg
16
+
17
+ # Exclude specific directories
18
+ recursive-exclude * build
cmdbox-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.1
2
+ Name: cmdbox
3
+ Version: 0.1.0
4
+ Summary: cmdbox: An application that executes AI model files in onnx or mmlab format.
5
+ Home-page: https://github.com/hamacom2004jp/cmdbox
6
+ Download-URL: https://github.com/hamacom2004jp/cmdbox
7
+ Author: hamacom2004jp
8
+ Author-email: hamacom2004jp@gmail.com
9
+ Maintainer: hamacom2004jp
10
+ Maintainer-email: hamacom2004jp@gmail.com
11
+ License: MIT
12
+ Keywords: cli restapi redis fastapi
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Information Technology
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Natural Language :: Japanese
19
+ Classifier: Programming Language :: Python
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+
25
+ # cmdbox
26
+
27
+ - プラグイン機構を備えたコマンドラインアプリケーションです。
28
+ - ドキュメントは[こちら](https://hamacom2004jp.github.io/cmdbox/)。
29
+ - cmdboxを使用することで、複雑なオプションを持つコマンドを簡単に実装できます。
30
+ - 実装したコマンドは、RESTAPIとしても呼び出せるようになります。
31
+ - 実装したコマンドは、redisを介してリモートサーバーで実行することが出来ます。
32
+ - 実装したコマンドは、Webコンソールから実行できます。
33
+ - リモートサーバーでコマンドを実行するために、必要なファイルをwebファイラーを使って転送できます。
34
+
35
+
36
+ ## Lisence
37
+
38
+ This project is licensed under the MIT License, see the LICENSE file for details
cmdbox-0.1.0/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # cmdbox
2
+
3
+ - プラグイン機構を備えたコマンドラインアプリケーションです。
4
+ - ドキュメントは[こちら](https://hamacom2004jp.github.io/cmdbox/)。
5
+ - cmdboxを使用することで、複雑なオプションを持つコマンドを簡単に実装できます。
6
+ - 実装したコマンドは、RESTAPIとしても呼び出せるようになります。
7
+ - 実装したコマンドは、redisを介してリモートサーバーで実行することが出来ます。
8
+ - 実装したコマンドは、Webコンソールから実行できます。
9
+ - リモートサーバーでコマンドを実行するために、必要なファイルをwebファイラーを使って転送できます。
10
+
11
+
12
+ ## Lisence
13
+
14
+ This project is licensed under the MIT License, see the LICENSE file for details
@@ -0,0 +1,3 @@
1
+ from cmdbox.version import __version__
2
+
3
+ __all__ = ['__version__']
@@ -0,0 +1,4 @@
1
+ if __name__ == "__main__":
2
+ from cmdbox.app import app
3
+ exit_code = app.main()
4
+ exit(exit_code)
File without changes
@@ -0,0 +1,116 @@
1
+ from cmdbox import version
2
+ from cmdbox.app import common, options
3
+ from pathlib import Path
4
+ from typing import List
5
+ import argparse
6
+ import argcomplete
7
+ import logging
8
+ import time
9
+ import sys
10
+
11
+
12
+ def main(args_list:list=None):
13
+ app = CmdBoxApp()
14
+ return app.main(args_list)[0]
15
+
16
+ class CmdBoxApp:
17
+ def __init__(self, appid:str=version.__appid__, description:str=None, cli_features_packages:List[str]=None):
18
+ """
19
+ コンストラクタ
20
+
21
+ Args:
22
+ appid (str, optional): アプリケーションID. Defaults to version.__appid__.
23
+ description (str, optional): アプリケーションの説明. Defaults to None.
24
+ cli_package_name (str, optional): プラグインのパッケージ名. Defaults to None.
25
+ """
26
+ self.options = options.Options.getInstance()
27
+ self.appid = appid
28
+ self.description = description
29
+ self.cli_features_packages = cli_features_packages
30
+
31
+ def main(self, args_list:list=None, file_dict:dict=dict(), webcall:bool=False):
32
+ """
33
+ コマンドライン引数を処理し、サーバーまたはクライアントを起動し、コマンドを実行する。
34
+ """
35
+ parser = argparse.ArgumentParser(prog=self.appid, description=self.description, exit_on_error=False)
36
+
37
+ # プラグイン読込み
38
+ self.options.load_svcmd('cmdbox.app.features.cli')
39
+ if self.cli_features_packages is not None:
40
+ for cli_features_package in self.cli_features_packages:
41
+ self.options.load_svcmd(cli_features_package)
42
+ self.options.load_features_file('cli', self.options.load_svcmd)
43
+
44
+ # コマンド引数の生成
45
+ opts = self.options.list_options()
46
+ for opt in opts.values():
47
+ default = opt["default"] if opt["default"] is not None and opt["default"] != "" else None
48
+ if opt["action"] is None:
49
+ parser.add_argument(*opt["opts"], help=opt["help"], type=opt["type"], default=default, choices=opt["choices"])
50
+ else:
51
+ parser.add_argument(*opt["opts"], help=opt["help"], default=default, action=opt["action"])
52
+
53
+ argcomplete.autocomplete(parser)
54
+ # mainメソッドの起動時引数がある場合は、その引数を解析する
55
+ try:
56
+ if args_list is not None:
57
+ args = parser.parse_args(args=args_list)
58
+ else:
59
+ args = parser.parse_args()
60
+ except argparse.ArgumentError as e:
61
+ msg = {"error":f"ArgumentError: {e}"}
62
+ common.print_format(msg, False, 0, None, False)
63
+ return 1, msg, None
64
+ # 起動時引数で指定されたオプションをファイルから読み込んだオプションで上書きする
65
+ args_dict = vars(args)
66
+ for key, val in file_dict.items():
67
+ args_dict[key] = val
68
+ # useoptオプションで指定されたオプションファイルを読み込む
69
+ opt = common.loadopt(args.useopt)
70
+ # 最終的に使用するオプションにマージする
71
+ for key, val in args_dict.items():
72
+ args_dict[key] = common.getopt(opt, key, preval=args_dict, withset=True)
73
+ args = argparse.Namespace(**args_dict)
74
+
75
+ tm = time.perf_counter()
76
+ ret = {"success":f"Start command. {args}"}
77
+
78
+ if args.saveopt:
79
+ if args.useopt is None:
80
+ msg = {"warn":f"Please specify the --useopt option."}
81
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append)
82
+ return 1, msg, None
83
+ common.saveopt(opt, args.useopt)
84
+ ret = {"success":f"Save options file. {args.useopt}"}
85
+
86
+ if args.version:
87
+ v = version.__logo__ + '\n' + version.__description__
88
+ common.print_format(v, False, tm, None, False)
89
+ return 0, v, None
90
+
91
+ if args.mode is None:
92
+ msg = {"warn":f"mode is None. Please specify the --help option."}
93
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append)
94
+ return 1, msg, None
95
+
96
+ common.mklogdir(args.data)
97
+ common.copy_sample(args.data)
98
+ common.copy_sample(Path.cwd())
99
+
100
+ logger, _ = common.load_config(args.mode, debug=args.debug, data=args.data, webcall=webcall if args.cmd != 'webcap' else True)
101
+ if logger.level == logging.DEBUG:
102
+ logger.debug(f"args.mode={args.mode}, args.cmd={args.cmd}")
103
+ for m, mo in self.options._options["cmd"].items():
104
+ if type(mo) is not dict: continue
105
+ for c, co in mo.items():
106
+ if type(co) is not dict: continue
107
+ logger.debug(f"loaded features: mode={m}, cmd={c}, {co['feature']}")
108
+
109
+ feature = self.options.get_cmd_attr(args.mode, args.cmd, 'feature')
110
+ if feature is not None:
111
+ status, ret, obj = feature.apprun(logger, args, tm)
112
+ return status, ret, obj
113
+ else:
114
+ msg = {"warn":f"Unkown mode or cmd. mode={args.mode}, cmd={args.cmd}"}
115
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append)
116
+ return 1, msg, None
@@ -0,0 +1,383 @@
1
+ from pathlib import Path
2
+ from cmdbox.app import filer
3
+ from cmdbox.app.commons import convert, redis_client
4
+ import base64
5
+ import logging
6
+
7
+
8
+ class Client(object):
9
+ def __init__(self, logger:logging.Logger, redis_host:str = "localhost", redis_port:int = 6379, redis_password:str = None, svname:str = 'server'):
10
+ """
11
+ Redisサーバーとの通信を行うクラス
12
+
13
+ Args:
14
+ logger (logging): ロガー
15
+ redis_host (str, optional): Redisサーバーのホスト名. Defaults to "localhost".
16
+ redis_port (int, optional): Redisサーバーのポート番号. Defaults to 6379.
17
+ redis_password (str, optional): Redisサーバーのパスワード. Defaults to None.
18
+ svname (str, optional): 推論サーバーのサービス名. Defaults to 'server'.
19
+ """
20
+ self.logger = logger
21
+ if svname is None or svname == "":
22
+ raise Exception("svname is empty.")
23
+ if svname.find('-') >= 0:
24
+ raise ValueError(f"Server name is invalid. '-' is not allowed. svname={svname}")
25
+ self.redis_cli = redis_client.RedisClient(logger, host=redis_host, port=redis_port, password=redis_password, svname=svname)
26
+ self.is_running = False
27
+
28
+ def __exit__(self, a, b, c):
29
+ pass
30
+
31
+ def stop_server(self, retry_count:int=3, retry_interval:int=5, timeout:int = 60):
32
+ """
33
+ Redisサーバーを停止する
34
+
35
+ Args:
36
+ retry_count (int, optional): リトライ回数. Defaults to 3.
37
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
38
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
39
+
40
+ Returns:
41
+ dict: Redisサーバーからの応答
42
+ """
43
+ res_json = self.redis_cli.send_cmd('stop_server', [], retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
44
+ return res_json
45
+
46
+ def file_list(self, svpath:str, recursive:bool, scope:str="client", client_data:Path = None,
47
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
48
+ """
49
+ サーバー上のファイルリストを取得する
50
+
51
+ Args:
52
+ svpath (Path): サーバー上のファイルパス
53
+ recursive (bool): 再帰的に取得するかどうか
54
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
55
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
56
+ retry_count (int, optional): リトライ回数. Defaults to 3.
57
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
58
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
59
+
60
+ Returns:
61
+ dict: Redisサーバーからの応答
62
+ """
63
+ if scope == "client":
64
+ if client_data is not None:
65
+ f = filer.Filer(client_data, self.logger)
66
+ _, res_json = f.file_list(svpath, recursive)
67
+ return res_json
68
+ else:
69
+ self.logger.warning(f"client_data is empty.")
70
+ return {"error": f"client_data is empty."}
71
+ elif scope == "current":
72
+ f = filer.Filer(Path.cwd(), self.logger)
73
+ _, res_json = f.file_list(svpath, recursive)
74
+ return res_json
75
+ elif scope == "server":
76
+ res_json = self.redis_cli.send_cmd('file_list', [convert.str2b64str(str(svpath)), str(recursive)],
77
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
78
+ return res_json
79
+ else:
80
+ self.logger.warning(f"scope is invalid. {scope}")
81
+ return {"error": f"scope is invalid. {scope}"}
82
+
83
+ def file_mkdir(self, svpath:str, scope:str="client", client_data:Path = None,
84
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
85
+ """
86
+ サーバー上にディレクトリを作成する
87
+
88
+ Args:
89
+ svpath (Path): サーバー上のディレクトリパス
90
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
91
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
92
+ retry_count (int, optional): リトライ回数. Defaults to 3.
93
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
94
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
95
+
96
+ Returns:
97
+ dict: Redisサーバーからの応答
98
+ """
99
+ if scope == "client":
100
+ if client_data is not None:
101
+ f = filer.Filer(client_data, self.logger)
102
+ _, res_json = f.file_mkdir(svpath)
103
+ return res_json
104
+ else:
105
+ self.logger.warning(f"client_data is empty.")
106
+ return {"error": f"client_data is empty."}
107
+ elif scope == "current":
108
+ f = filer.Filer(Path.cwd(), self.logger)
109
+ _, res_json = f.file_mkdir(svpath)
110
+ return res_json
111
+ elif scope == "server":
112
+ res_json = self.redis_cli.send_cmd('file_mkdir', [convert.str2b64str(str(svpath))],
113
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
114
+ return res_json
115
+ else:
116
+ self.logger.warning(f"scope is invalid. {scope}")
117
+ return {"error": f"scope is invalid. {scope}"}
118
+
119
+ def file_rmdir(self, svpath:str, scope:str="client", client_data:Path = None,
120
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
121
+ """
122
+ サーバー上のディレクトリを削除する
123
+
124
+ Args:
125
+ svpath (Path): サーバー上のディレクトリパス
126
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
127
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
128
+ retry_count (int, optional): リトライ回数. Defaults to 3.
129
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
130
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
131
+
132
+ Returns:
133
+ dict: Redisサーバーからの応答
134
+ """
135
+ if scope == "client":
136
+ if client_data is not None:
137
+ f = filer.Filer(client_data, self.logger)
138
+ _, res_json = f.file_rmdir(svpath)
139
+ return res_json
140
+ else:
141
+ self.logger.warning(f"client_data is empty.")
142
+ return {"error": f"client_data is empty."}
143
+ elif scope == "current":
144
+ f = filer.Filer(Path.cwd(), self.logger)
145
+ _, res_json = f.file_rmdir(svpath)
146
+ return res_json
147
+ elif scope == "server":
148
+ res_json = self.redis_cli.send_cmd('file_rmdir', [convert.str2b64str(str(svpath))],
149
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
150
+ return res_json
151
+ else:
152
+ self.logger.warning(f"scope is invalid. {scope}")
153
+ return {"error": f"scope is invalid. {scope}"}
154
+
155
+ def file_download(self, svpath:str, download_file:Path, scope:str="client", client_data:Path = None, rpath:str="", img_thumbnail:float=0.0,
156
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
157
+ """
158
+ サーバー上のファイルをダウンロードする
159
+
160
+ Args:
161
+ svpath (Path): サーバー上のファイルパス
162
+ download_file (Path): ローカルのファイルパス
163
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
164
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
165
+ rpath (str, optional): リクエストパス. Defaults to "".
166
+ img_thumbnail (float, optional): サムネイル画像のサイズ. Defaults to 0.0.
167
+ retry_count (int, optional): リトライ回数. Defaults to 3.
168
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
169
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
170
+
171
+ Returns:
172
+ bytes: ダウンロードファイルの内容
173
+ """
174
+ if scope == "client":
175
+ if client_data is not None:
176
+ f = filer.Filer(client_data, self.logger)
177
+ _, res_json = f.file_download(svpath, img_thumbnail)
178
+ else:
179
+ self.logger.warning(f"client_data is empty.")
180
+ return {"error": f"client_data is empty."}
181
+ elif scope == "current":
182
+ f = filer.Filer(Path.cwd(), self.logger)
183
+ _, res_json = f.file_download(svpath, img_thumbnail)
184
+ elif scope == "server":
185
+ res_json = self.redis_cli.send_cmd('file_download', [convert.str2b64str(str(svpath)), str(img_thumbnail)],
186
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
187
+ else:
188
+ self.logger.warning(f"scope is invalid. {scope}")
189
+ return {"error": f"scope is invalid. {scope}"}
190
+ if "success" in res_json:
191
+ res_json["success"]["rpath"] = rpath
192
+ res_json["success"]["svpath"] = svpath
193
+ if download_file is not None:
194
+ if download_file.is_dir():
195
+ download_file = download_file / res_json["success"]["name"]
196
+ if download_file.exists():
197
+ self.logger.warning(f"download_file {download_file} already exists.")
198
+ return {"error": f"download_file {download_file} already exists."}
199
+ with open(download_file, "wb") as f:
200
+ f.write(base64.b64decode(res_json["success"]["data"]))
201
+ del res_json["success"]["data"]
202
+ res_json["success"]["download_file"] = str(download_file.absolute())
203
+ return res_json
204
+
205
+ def file_upload(self, svpath:str, upload_file:Path, scope:str="client", client_data:Path=None, mkdir:bool=False, orverwrite:bool=False,
206
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
207
+ """
208
+ サーバー上にファイルをアップロードする
209
+
210
+ Args:
211
+ svpath (Path): サーバー上のファイルパス
212
+ upload_file (Path): ローカルのファイルパス
213
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
214
+ mkdir (bool, optional): ディレクトリを作成するかどうか. Defaults to False.
215
+ orverwrite (bool, optional): 上書きするかどうか. Defaults to False.
216
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
217
+ retry_count (int, optional): リトライ回数. Defaults to 3.
218
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
219
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
220
+
221
+ Returns:
222
+ dict: Redisサーバーからの応答
223
+ """
224
+ if upload_file is None:
225
+ self.logger.warning(f"upload_file is empty.")
226
+ return {"error": f"upload_file is empty."}
227
+ if not upload_file.exists():
228
+ self.logger.warning(f"input_file {upload_file} does not exist.")
229
+ return {"error": f"input_file {upload_file} does not exist."}
230
+ if upload_file.is_dir():
231
+ self.logger.warning(f"input_file {upload_file} is directory.")
232
+ return {"error": f"input_file {upload_file} is directory."}
233
+ with open(upload_file, "rb") as f:
234
+ if scope == "client":
235
+ if client_data is not None:
236
+ fi = filer.Filer(client_data, self.logger)
237
+ _, res_json = fi.file_upload(svpath, upload_file.name, f.read(), mkdir, orverwrite)
238
+ return res_json
239
+ else:
240
+ self.logger.warning(f"client_data is empty.")
241
+ return {"error": f"client_data is empty."}
242
+ elif scope == "current":
243
+ fi = filer.Filer(Path.cwd(), self.logger)
244
+ _, res_json = fi.file_upload(svpath, upload_file.name, f.read(), mkdir, orverwrite)
245
+ return res_json
246
+ elif scope == "server":
247
+ res_json = self.redis_cli.send_cmd('file_upload',
248
+ [convert.str2b64str(str(svpath)),
249
+ convert.str2b64str(upload_file.name),
250
+ convert.bytes2b64str(f.read()),
251
+ str(mkdir),
252
+ str(orverwrite)],
253
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
254
+ return res_json
255
+ else:
256
+ self.logger.warning(f"scope is invalid. {scope}")
257
+ return {"error": f"scope is invalid. {scope}"}
258
+
259
+ def file_remove(self, svpath:str, scope:str="client", client_data:Path = None,
260
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
261
+ """
262
+ サーバー上のファイルを削除する
263
+
264
+ Args:
265
+ svpath (Path): サーバー上のファイルパス
266
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
267
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
268
+ retry_count (int, optional): リトライ回数. Defaults to 3.
269
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
270
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
271
+
272
+ Returns:
273
+ dict: Redisサーバーからの応答
274
+ """
275
+ if scope == "client":
276
+ if client_data is not None:
277
+ f = filer.Filer(client_data, self.logger)
278
+ _, res_json = f.file_remove(svpath)
279
+ return res_json
280
+ else:
281
+ self.logger.warning(f"client_data is empty.")
282
+ return {"error": f"client_data is empty."}
283
+ elif scope == "current":
284
+ f = filer.Filer(Path.cwd(), self.logger)
285
+ _, res_json = f.file_remove(svpath)
286
+ return res_json
287
+ elif scope == "server":
288
+ res_json = self.redis_cli.send_cmd('file_remove', [convert.str2b64str(str(svpath))],
289
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
290
+ return res_json
291
+ else:
292
+ self.logger.warning(f"scope is invalid. {scope}")
293
+ return {"error": f"scope is invalid. {scope}"}
294
+
295
+ def file_copy(self, from_path:str, to_path:str, orverwrite:bool=False, scope:str="client", client_data:Path = None,
296
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
297
+ """
298
+ サーバー上のファイルをコピーする
299
+
300
+ Args:
301
+ from_path (Path): コピー元のファイルパス
302
+ to_path (Path): コピー先のファイルパス
303
+ orverwrite (bool, optional): 上書きするかどうか. Defaults to False.
304
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
305
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
306
+ retry_count (int, optional): リトライ回数. Defaults to 3.
307
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
308
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
309
+
310
+ Returns:
311
+ dict: Redisサーバーからの応答
312
+ """
313
+ if scope == "client":
314
+ if client_data is not None:
315
+ f = filer.Filer(client_data, self.logger)
316
+ _, res_json = f.file_copy(from_path, to_path, orverwrite)
317
+ return res_json
318
+ else:
319
+ self.logger.warning(f"client_data is empty.")
320
+ return {"error": f"client_data is empty."}
321
+ elif scope == "current":
322
+ f = filer.Filer(Path.cwd(), self.logger)
323
+ _, res_json = f.file_copy(from_path, to_path, orverwrite)
324
+ return res_json
325
+ elif scope == "server":
326
+ res_json = self.redis_cli.send_cmd('file_copy', [convert.str2b64str(str(from_path)), convert.str2b64str(str(to_path)), str(orverwrite)],
327
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
328
+ return res_json
329
+ else:
330
+ self.logger.warning(f"scope is invalid. {scope}")
331
+ return {"error": f"scope is invalid. {scope}"}
332
+
333
+ def file_move(self, from_path:str, to_path:str, scope:str="client", client_data:Path = None,
334
+ retry_count:int=3, retry_interval:int=5, timeout:int = 60):
335
+ """
336
+ サーバー上のファイルを移動する
337
+
338
+ Args:
339
+ from_path (Path): 移動元のファイルパス
340
+ to_path (Path): 移動先のファイルパス
341
+ scope (str, optional): 参照先のスコープ. Defaults to "client".
342
+ client_data (Path, optional): ローカルを参照させる場合のデータフォルダ. Defaults to None.
343
+ retry_count (int, optional): リトライ回数. Defaults to 3.
344
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
345
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
346
+
347
+ Returns:
348
+ dict: Redisサーバーからの応答
349
+ """
350
+ if scope == "client":
351
+ if client_data is not None:
352
+ f = filer.Filer(client_data, self.logger)
353
+ _, res_json = f.file_move(from_path, to_path)
354
+ return res_json
355
+ else:
356
+ self.logger.warning(f"client_data is empty.")
357
+ return {"error": f"client_data is empty."}
358
+ elif scope == "current":
359
+ f = filer.Filer(Path.cwd(), self.logger)
360
+ _, res_json = f.file_move(from_path, to_path)
361
+ return res_json
362
+ elif scope == "server":
363
+ res_json = self.redis_cli.send_cmd('file_move', [convert.str2b64str(str(from_path)), convert.str2b64str(str(to_path))],
364
+ retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
365
+ return res_json
366
+ else:
367
+ self.logger.warning(f"scope is invalid. {scope}")
368
+ return {"error": f"scope is invalid. {scope}"}
369
+
370
+ def server_info(self, retry_count:int=3, retry_interval:int=5, timeout:int = 60):
371
+ """
372
+ サーバーの情報を取得する
373
+
374
+ Args:
375
+ retry_count (int, optional): リトライ回数. Defaults to 3.
376
+ retry_interval (int, optional): リトライ間隔. Defaults to 5.
377
+ timeout (int, optional): タイムアウト時間. Defaults to 60.
378
+
379
+ Returns:
380
+ dict: Redisサーバーからの応答
381
+ """
382
+ res_json = self.redis_cli.send_cmd('server_info', [], retry_count=retry_count, retry_interval=retry_interval, timeout=timeout)
383
+ return res_json