cmdbox 0.6.5__py3-none-any.whl → 0.6.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cmdbox might be problematic. Click here for more details.
- cmdbox/app/client.py +384 -384
- cmdbox/app/feature.py +1 -1
- cmdbox/app/features/cli/_cmdbox_vision_install.py +0 -9
- cmdbox/app/features/cli/_cmdbox_vision_predict.py +0 -9
- cmdbox/app/features/cli/cmdbox_audit_createdb.py +1 -11
- cmdbox/app/features/cli/cmdbox_audit_delete.py +0 -9
- cmdbox/app/features/cli/cmdbox_audit_search.py +0 -9
- cmdbox/app/features/cli/cmdbox_audit_write.py +0 -9
- cmdbox/app/features/cli/cmdbox_excel_cell_details.py +436 -0
- cmdbox/app/features/cli/cmdbox_excel_cell_search.py +276 -0
- cmdbox/app/features/cli/cmdbox_excel_cell_values.py +258 -0
- cmdbox/app/features/cli/cmdbox_excel_sheet_list.py +159 -0
- cmdbox/app/features/cli/cmdbox_tts_install.py +0 -9
- cmdbox/app/features/cli/cmdbox_tts_say.py +0 -9
- cmdbox/app/features/cli/cmdbox_tts_start.py +0 -9
- cmdbox/app/features/cli/cmdbox_tts_stop.py +0 -9
- cmdbox/app/features/cli/excel_base.py +301 -0
- cmdbox/app/web.py +9 -4
- cmdbox/extensions/features.yml +3 -0
- cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +0 -9
- cmdbox/licenses/LICENSE_Authlib_1_6_5_BSD_License.txt +29 -0
- cmdbox/licenses/LICENSE_Mako_1_3_10_MIT_License.txt +19 -0
- cmdbox/licenses/LICENSE_SQLAlchemy_2_0_43_MIT.txt +19 -0
- cmdbox/licenses/LICENSE_Werkzeug_3_1_1_BSD_License.txt +28 -0
- cmdbox/licenses/LICENSE_absolufy-imports_0_3_1_MIT_License.txt +21 -0
- cmdbox/licenses/LICENSE_aiohappyeyeballs_2_6_1_Python_Software_Foundation_License.txt +279 -0
- cmdbox/licenses/LICENSE_aiohttp_3_12_15_Apache-2_0_AND_MIT.txt +13 -0
- cmdbox/licenses/LICENSE_aiosignal_1_4_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_alembic_1_16_5_UNKNOWN.txt +19 -0
- cmdbox/licenses/LICENSE_attrs_25_3_0_UNKNOWN.txt +21 -0
- cmdbox/licenses/LICENSE_cachetools_6_2_0_MIT_License.txt +20 -0
- cmdbox/licenses/LICENSE_cloudpickle_3_1_1_BSD_License.txt +1 -0
- cmdbox/licenses/LICENSE_cyclopts_3_24_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_debugpy_1_8_17_MIT_License.txt +24 -0
- cmdbox/licenses/LICENSE_distro_1_9_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_dnspython_2_8_0_ISC_License-ISCL.txt +35 -0
- cmdbox/licenses/LICENSE_docstring_parser_0_17_0_MIT_License.txt +21 -0
- cmdbox/licenses/LICENSE_email-validator_2_3_0_The_Unlicense-Unlicense.txt +27 -0
- cmdbox/licenses/LICENSE_et_xmlfile_2_0_0_MIT_License.txt +298 -0
- cmdbox/licenses/LICENSE_exceptiongroup_1_3_0_MIT_License.txt +73 -0
- cmdbox/licenses/LICENSE_fastmcp_2_12_4_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_fastuuid_0_13_5_BSD_License.txt +29 -0
- cmdbox/licenses/LICENSE_filelock_3_19_1_The_Unlicense-Unlicense.txt +24 -0
- cmdbox/licenses/LICENSE_frozenlist_1_7_0_Apache-2_0.txt +201 -0
- cmdbox/licenses/LICENSE_fsspec_2025_9_0_UNKNOWN.txt +29 -0
- cmdbox/licenses/LICENSE_google-adk_1_15_1_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-api-core_2_25_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-api-python-client_2_184_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_google-auth-httplib2_0_2_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_google-auth_2_41_1_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_google-cloud-aiplatform_1_119_0_Apache_2_0.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-appengine-logging_1_6_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-audit-log_0_3_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-bigquery_3_38_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-bigtable_2_32_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-core_2_4_3_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-logging_3_12_1_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-monitoring_2_27_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-resource-manager_1_14_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-secret-manager_2_24_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-spanner_3_58_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-speech_2_33_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-storage_2_19_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-cloud-trace_1_16_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-crc32c_1_7_1_Apache_2_0.txt +202 -0
- cmdbox/licenses/LICENSE_google-genai_1_40_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_google-resumable-media_2_7_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_googleapis-common-protos_1_70_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/{LICENSE_hyperframe_6_1_0_MIT_License.txt → LICENSE_graphviz_0_21_UNKNOWN.txt} +1 -1
- cmdbox/licenses/LICENSE_grpc-google-iam-v1_0_14_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_grpc-interceptor_0_15_4_MIT_License.txt +21 -0
- cmdbox/licenses/LICENSE_grpcio-status_1_75_1_Apache_Software_License.txt +610 -0
- cmdbox/licenses/LICENSE_grpcio_1_75_1_Apache_Software_License.txt +610 -0
- cmdbox/licenses/LICENSE_httpcore_1_0_9_BSD_License.txt +27 -0
- cmdbox/licenses/LICENSE_httplib2_0_31_0_MIT_License.txt +23 -0
- cmdbox/licenses/LICENSE_httpx-sse_0_4_1_MIT.txt +21 -0
- cmdbox/licenses/LICENSE_httpx_0_28_1_BSD_License.txt +12 -0
- cmdbox/licenses/LICENSE_huggingface-hub_0_35_3_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_isodate_0_7_2_BSD_License.txt +26 -0
- cmdbox/licenses/LICENSE_jiter_0_11_0_MIT_License.txt +1 -0
- cmdbox/licenses/LICENSE_jsonschema-path_0_3_4_Apache_Software_License.txt +201 -0
- cmdbox/licenses/{LICENSE_priority_2_0_0_MIT_License.txt → LICENSE_jsonschema-specifications_2025_9_1_UNKNOWN.txt} +2 -2
- cmdbox/licenses/{LICENSE_hpack_4_1_0_MIT_License.txt → LICENSE_jsonschema_4_25_1_UNKNOWN.txt} +1 -3
- cmdbox/licenses/LICENSE_lazy-object-proxy_1_12_0_UNKNOWN.txt +20 -0
- cmdbox/licenses/LICENSE_litellm_1_77_5_MIT_License.txt +26 -0
- cmdbox/licenses/LICENSE_mcp_1_16_0_MIT_License.txt +21 -0
- cmdbox/licenses/LICENSE_multidict_6_6_4_Apache_License_2_0.txt +13 -0
- cmdbox/licenses/LICENSE_openai_2_1_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_openapi-core_0_19_5_BSD_License.txt +29 -0
- cmdbox/licenses/LICENSE_openapi-pydantic_0_5_1_MIT_License.txt +40 -0
- cmdbox/licenses/LICENSE_openapi-schema-validator_0_6_3_BSD_License.txt +29 -0
- cmdbox/licenses/LICENSE_openapi-spec-validator_0_7_2_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_openpyxl_3_1_5_MIT_License.txt +23 -0
- cmdbox/licenses/LICENSE_opentelemetry-api_1_37_0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-exporter-gcp-logging_1_9_0a0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-exporter-gcp-monitoring_1_9_0a0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-exporter-gcp-trace_1_9_0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-exporter-otlp-proto-common_1_37_0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-exporter-otlp-proto-http_1_37_0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-proto_1_37_0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-resourcedetector-gcp_1_9_0a0_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-sdk_1_37_0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_opentelemetry-semantic-conventions_0_58b0_UNKNOWN.txt +201 -0
- cmdbox/licenses/LICENSE_parse_1_20_2_MIT_License.txt +19 -0
- cmdbox/licenses/LICENSE_pathable_0_4_4_Apache_Software_License.txt +201 -0
- cmdbox/licenses/LICENSE_propcache_0_3_2_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_proto-plus_1_26_1_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_protobuf_6_32_1_3-Clause_BSD_License.txt +32 -0
- cmdbox/licenses/LICENSE_pyasn1_0_6_1_BSD_License.txt +24 -0
- cmdbox/licenses/LICENSE_pyasn1_modules_0_4_2_BSD_License.txt +24 -0
- cmdbox/licenses/LICENSE_pydantic-settings_2_11_0_MIT_License.txt +21 -0
- cmdbox/licenses/LICENSE_pyparsing_3_2_5_UNKNOWN.txt +18 -0
- cmdbox/licenses/LICENSE_pyperclip_1_11_0_BSD_License.txt +27 -0
- cmdbox/licenses/LICENSE_python-dateutil_2_9_0_post0_Apache_Software_License-BSD_License.txt +54 -0
- cmdbox/licenses/LICENSE_python-dotenv_1_1_1_BSD_License.txt +27 -0
- cmdbox/licenses/LICENSE_pywin32_311_Python_Software_Foundation_License.txt +1 -0
- cmdbox/licenses/LICENSE_referencing_0_36_2_UNKNOWN.txt +19 -0
- cmdbox/licenses/LICENSE_regex_2025_9_18_UNKNOWN.txt +208 -0
- cmdbox/licenses/LICENSE_rfc3339-validator_0_1_4_MIT_License.txt +22 -0
- cmdbox/licenses/LICENSE_rich-rst_1_3_1_MIT_License.txt +7 -0
- cmdbox/licenses/LICENSE_rpds-py_0_27_1_UNKNOWN.txt +19 -0
- cmdbox/licenses/LICENSE_rsa_4_9_1_Apache_Software_License.txt +13 -0
- cmdbox/licenses/LICENSE_shapely_2_1_2_BSD_License.txt +29 -0
- cmdbox/licenses/LICENSE_sqlalchemy-spanner_1_16_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_sqlparse_0_5_3_BSD_License.txt +25 -0
- cmdbox/licenses/LICENSE_sse-starlette_3_0_2_UNKNOWN.txt +27 -0
- cmdbox/licenses/LICENSE_tenacity_8_5_0_Apache_Software_License.txt +202 -0
- cmdbox/licenses/LICENSE_tiktoken_0_11_0_MIT_License-Copyright-c-2022_OpenAI-Shantanu_Jain-Permission_is_hereby_granted-free_of_charge-to_any_per.txt +21 -0
- cmdbox/licenses/LICENSE_tokenizers_0_22_1_Apache_Software_License.txt +1 -0
- cmdbox/licenses/LICENSE_tqdm_4_67_1_MIT_License-Mozilla_Public_License_2_0-MPL_2_0.txt +49 -0
- cmdbox/licenses/LICENSE_tzlocal_5_3_1_MIT_License.txt +19 -0
- cmdbox/licenses/LICENSE_uritemplate_4_2_0_BSD_3-Clause_OR_Apache-2_0.txt +3 -0
- cmdbox/licenses/LICENSE_uvicorn_0_37_0_BSD_License.txt +28 -0
- cmdbox/licenses/LICENSE_watchdog_6_0_0_Apache_Software_License.txt +16 -0
- cmdbox/licenses/LICENSE_websockets_15_0_1_BSD_License.txt +24 -0
- cmdbox/licenses/LICENSE_yarl_1_20_1_Apache_Software_License.txt +202 -0
- cmdbox/licenses/files.txt +146 -14
- cmdbox/version.py +2 -2
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/METADATA +27 -29
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/RECORD +153 -37
- cmdbox/licenses/LICENSE_Hypercorn_0_17_3_MIT_License.txt +0 -22
- cmdbox/licenses/LICENSE_h2_4_3_0_MIT_License.txt +0 -21
- /cmdbox/licenses/{LICENSE_MarkupSafe_3_0_2_BSD_License.txt → LICENSE_MarkupSafe_3_0_3_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_PyYAML_6_0_2_MIT_License.txt → LICENSE_PyYAML_6_0_3_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_anyio_4_10_0_UNKNOWN.txt → LICENSE_anyio_4_11_0_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_cryptography_46_0_1_UNKNOWN.txt → LICENSE_cryptography_46_0_2_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_fastapi_0_116_2_MIT_License.txt → LICENSE_fastapi_0_118_0_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_pydantic_2_11_9_MIT_License.txt → LICENSE_pydantic_2_11_10_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_typing-inspection_0_4_1_UNKNOWN.txt → LICENSE_typing-inspection_0_4_2_UNKNOWN.txt} +0 -0
- /cmdbox/licenses/{LICENSE_wcwidth_0_2_13_MIT_License.txt → LICENSE_wcwidth_0_2_14_MIT_License.txt} +0 -0
- /cmdbox/licenses/{LICENSE_zope_interface_8_0_Zope_Public_License.txt → LICENSE_zope_interface_8_0_1_Zope_Public_License.txt} +0 -0
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/WHEEL +0 -0
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/entry_points.txt +0 -0
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/licenses/LICENSE +0 -0
- {cmdbox-0.6.5.dist-info → cmdbox-0.6.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from cmdbox.app import common, filer
|
|
2
|
+
from cmdbox.app.commons import convert, redis_client
|
|
3
|
+
from cmdbox.app.features.cli import excel_base
|
|
4
|
+
from cmdbox.app.options import Options
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Dict, Any, List, Tuple
|
|
7
|
+
import argparse
|
|
8
|
+
import logging
|
|
9
|
+
import json
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExcelSheetList(excel_base.ExcelBase):
|
|
13
|
+
def get_cmd(self):
|
|
14
|
+
"""
|
|
15
|
+
この機能のコマンドを返します
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
str: コマンド
|
|
19
|
+
"""
|
|
20
|
+
return 'sheet_list'
|
|
21
|
+
|
|
22
|
+
def get_option(self):
|
|
23
|
+
"""
|
|
24
|
+
この機能のオプションを返します
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
Dict[str, Any]: オプション
|
|
28
|
+
"""
|
|
29
|
+
opt = super().get_option()
|
|
30
|
+
opt['description_ja'] = "データフォルダ配下のExcelファイルのシート一覧を取得します。"
|
|
31
|
+
opt['description_en'] = "Retrieves the list of sheets in an Excel file located within the data folder."
|
|
32
|
+
return opt
|
|
33
|
+
|
|
34
|
+
def chk_args(self, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[bool, str, Any]:
|
|
35
|
+
"""
|
|
36
|
+
引数のチェックを行います
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
args (argparse.Namespace): 引数
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Tuple[bool, str]: チェック結果, メッセージ
|
|
43
|
+
"""
|
|
44
|
+
if args.svname is None:
|
|
45
|
+
msg = dict(warn=f"Please specify the --svname option.")
|
|
46
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
47
|
+
return self.RESP_WARN, msg, None
|
|
48
|
+
if args.scope is None:
|
|
49
|
+
msg = dict(warn=f"Please specify the --scope option.")
|
|
50
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
51
|
+
return self.RESP_WARN, msg, None
|
|
52
|
+
if args.svpath is None:
|
|
53
|
+
msg = dict(warn=f"Please specify the --svpath option.")
|
|
54
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
55
|
+
return self.RESP_WARN, msg, None
|
|
56
|
+
return self.RESP_SUCCESS, None, None
|
|
57
|
+
|
|
58
|
+
def excel_proc(self, abspath:Path, args:argparse.Namespace, logger:logging.Logger, tm:float, pf:List[Dict[str, float]]=[]) -> Dict[str, Any]:
|
|
59
|
+
"""
|
|
60
|
+
Excel処理のベース
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
abspath (Path): Excelファイルの絶対パス
|
|
64
|
+
args (argparse.Namespace): 引数
|
|
65
|
+
logger (logging.Logger): ロガー
|
|
66
|
+
tm (float): 処理時間
|
|
67
|
+
pf (List[Dict[str, float]]): パフォーマンス情報
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Dict[str, Any]: 結果
|
|
71
|
+
"""
|
|
72
|
+
res_json = self.sheet_list(abspath, logger)
|
|
73
|
+
return res_json
|
|
74
|
+
|
|
75
|
+
def get_svparam(self, args:argparse.Namespace) -> List[str]:
|
|
76
|
+
"""
|
|
77
|
+
サーバーに送信するパラメーターを返します
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
args (argparse.Namespace): 引数
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
List[str]: サーバーに送信するパラメーター
|
|
84
|
+
"""
|
|
85
|
+
ret = [convert.str2b64str(str(args.svpath))]
|
|
86
|
+
return ret
|
|
87
|
+
|
|
88
|
+
def is_cluster_redirect(self):
|
|
89
|
+
"""
|
|
90
|
+
クラスター宛のメッセージの場合、メッセージを転送するかどうかを返します
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
bool: メッセージを転送する場合はTrue
|
|
94
|
+
"""
|
|
95
|
+
return False
|
|
96
|
+
|
|
97
|
+
def svrun(self, data_dir:Path, logger:logging.Logger, redis_cli:redis_client.RedisClient, msg:List[str],
|
|
98
|
+
sessions:Dict[str, Dict[str, Any]]) -> int:
|
|
99
|
+
"""
|
|
100
|
+
この機能のサーバー側の実行を行います
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
data_dir (Path): データディレクトリ
|
|
104
|
+
logger (logging.Logger): ロガー
|
|
105
|
+
redis_cli (redis_client.RedisClient): Redisクライアント
|
|
106
|
+
msg (List[str]): 受信メッセージ
|
|
107
|
+
sessions (Dict[str, Dict[str, Any]]): セッション情報
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
int: 終了コード
|
|
111
|
+
"""
|
|
112
|
+
svpath = convert.b64str2str(msg[2])
|
|
113
|
+
|
|
114
|
+
try:
|
|
115
|
+
f = filer.Filer(data_dir, logger)
|
|
116
|
+
chk, abspath, res = f._file_exists(svpath)
|
|
117
|
+
if not chk:
|
|
118
|
+
logger.warning(f"File not found. {svpath}")
|
|
119
|
+
redis_cli.rpush(msg[1], res)
|
|
120
|
+
return self.RESP_WARN
|
|
121
|
+
res = self.sheet_list(abspath, logger)
|
|
122
|
+
redis_cli.rpush(msg[1], res)
|
|
123
|
+
except Exception as e:
|
|
124
|
+
logger.warning(f"Failed to sheet list: {e}", exc_info=True)
|
|
125
|
+
redis_cli.rpush(msg[1], dict(warn=f"Failed to sheet list: {e}"))
|
|
126
|
+
return self.RESP_WARN
|
|
127
|
+
return self.RESP_SUCCESS
|
|
128
|
+
|
|
129
|
+
def sheet_list(self, filepath:str, logger:logging.Logger) -> Dict[str, Any]:
|
|
130
|
+
"""
|
|
131
|
+
指定したワークブックのシート一覧を取得します。
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
filepath (str): ワークブックのパス
|
|
135
|
+
logger (logging.Logger): ロガー
|
|
136
|
+
Returns:
|
|
137
|
+
dict: シートの情報
|
|
138
|
+
"""
|
|
139
|
+
wb:Workbook = None
|
|
140
|
+
try:
|
|
141
|
+
from openpyxl.cell import Cell
|
|
142
|
+
from openpyxl.workbook.workbook import Workbook
|
|
143
|
+
from openpyxl.worksheet.worksheet import Worksheet
|
|
144
|
+
import openpyxl
|
|
145
|
+
|
|
146
|
+
wb:Workbook = openpyxl.load_workbook(filename=filepath, read_only=True)
|
|
147
|
+
sheetinfo = {}
|
|
148
|
+
for sheet in wb.worksheets:
|
|
149
|
+
sheetinfo[sheet.title] = dict(max_row=sheet.max_row, max_column=sheet.max_column, sheet_state=sheet.sheet_state)
|
|
150
|
+
|
|
151
|
+
res = dict(success=sheetinfo)
|
|
152
|
+
return res
|
|
153
|
+
except Exception as e:
|
|
154
|
+
msg = dict(warn=f"Failed to sheet list: {e}")
|
|
155
|
+
logger.warning(f"Failed to sheet list: {e}", exc_info=True)
|
|
156
|
+
return msg
|
|
157
|
+
finally:
|
|
158
|
+
if wb is not None:
|
|
159
|
+
wb.close()
|
|
@@ -98,15 +98,6 @@ class TtsInstall(feature.UnsupportEdgeFeature):
|
|
|
98
98
|
description_en="Specify the wheel file for the TTS engine."),
|
|
99
99
|
]
|
|
100
100
|
)
|
|
101
|
-
|
|
102
|
-
def get_svcmd(self):
|
|
103
|
-
"""
|
|
104
|
-
この機能のサーバー側のコマンドを返します
|
|
105
|
-
|
|
106
|
-
Returns:
|
|
107
|
-
str: サーバー側のコマンド
|
|
108
|
-
"""
|
|
109
|
-
return 'tts_install'
|
|
110
101
|
|
|
111
102
|
def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
|
|
112
103
|
"""
|
|
@@ -90,15 +90,6 @@ class TtsSay(cmdbox_tts_start.TtsStart):
|
|
|
90
90
|
return self.RESP_WARN, ret, cl
|
|
91
91
|
return self.RESP_SUCCESS, ret, cl
|
|
92
92
|
|
|
93
|
-
def get_svcmd(self):
|
|
94
|
-
"""
|
|
95
|
-
この機能のサーバー側のコマンドを返します
|
|
96
|
-
|
|
97
|
-
Returns:
|
|
98
|
-
str: サーバー側のコマンド
|
|
99
|
-
"""
|
|
100
|
-
return 'tts_say'
|
|
101
|
-
|
|
102
93
|
def is_cluster_redirect(self):
|
|
103
94
|
"""
|
|
104
95
|
クラスター宛のメッセージの場合、メッセージを転送するかどうかを返します
|
|
@@ -190,15 +190,6 @@ class TtsStart(feature.UnsupportEdgeFeature):
|
|
|
190
190
|
description_en="Specify the model of the TTS engine to use."),
|
|
191
191
|
]
|
|
192
192
|
)
|
|
193
|
-
|
|
194
|
-
def get_svcmd(self):
|
|
195
|
-
"""
|
|
196
|
-
この機能のサーバー側のコマンドを返します
|
|
197
|
-
|
|
198
|
-
Returns:
|
|
199
|
-
str: サーバー側のコマンド
|
|
200
|
-
"""
|
|
201
|
-
return 'tts_start'
|
|
202
193
|
|
|
203
194
|
def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
|
|
204
195
|
"""
|
|
@@ -28,15 +28,6 @@ class TtsStop(cmdbox_tts_start.TtsStart):
|
|
|
28
28
|
opt['description_en'] = "Stops the Text-to-Speech (TTS) engine."
|
|
29
29
|
return opt
|
|
30
30
|
|
|
31
|
-
def get_svcmd(self):
|
|
32
|
-
"""
|
|
33
|
-
この機能のサーバー側のコマンドを返します
|
|
34
|
-
|
|
35
|
-
Returns:
|
|
36
|
-
str: サーバー側のコマンド
|
|
37
|
-
"""
|
|
38
|
-
return 'tts_stop'
|
|
39
|
-
|
|
40
31
|
def svrun(self, data_dir:Path, logger:logging.Logger, redis_cli:redis_client.RedisClient, msg:List[str],
|
|
41
32
|
sessions:Dict[str, Dict[str, Any]]) -> int:
|
|
42
33
|
"""
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
from cmdbox.app import common, client, filer, feature
|
|
2
|
+
from cmdbox.app.commons import convert
|
|
3
|
+
from cmdbox.app.options import Options
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Dict, Any, Tuple, List, Union
|
|
6
|
+
import argparse
|
|
7
|
+
import logging
|
|
8
|
+
import html
|
|
9
|
+
import re
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExcelBase(feature.ResultEdgeFeature):
|
|
13
|
+
def get_mode(self) -> Union[str, List[str]]:
|
|
14
|
+
"""
|
|
15
|
+
この機能のモードを返します
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
Union[str, List[str]]: モード
|
|
19
|
+
"""
|
|
20
|
+
return 'excel'
|
|
21
|
+
|
|
22
|
+
def get_option(self):
|
|
23
|
+
"""
|
|
24
|
+
この機能のオプションを返します
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
Dict[str, Any]: オプション
|
|
28
|
+
"""
|
|
29
|
+
return dict(
|
|
30
|
+
use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False, use_agent=True,
|
|
31
|
+
description_ja="",
|
|
32
|
+
description_en="",
|
|
33
|
+
choice=[
|
|
34
|
+
dict(opt="host", type=Options.T_STR, default=self.default_host, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
35
|
+
description_ja="Redisサーバーのサービスホストを指定します。",
|
|
36
|
+
description_en="Specify the service host of the Redis server."),
|
|
37
|
+
dict(opt="port", type=Options.T_INT, default=self.default_port, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
38
|
+
description_ja="Redisサーバーのサービスポートを指定します。",
|
|
39
|
+
description_en="Specify the service port of the Redis server."),
|
|
40
|
+
dict(opt="password", type=Options.T_STR, default=self.default_pass, required=True, multi=False, hide=True, choice=None, web="mask",
|
|
41
|
+
description_ja="Redisサーバーのアクセスパスワード(任意)を指定します。省略時は `password` を使用します。",
|
|
42
|
+
description_en="Specify the access password of the Redis server (optional). If omitted, `password` is used."),
|
|
43
|
+
dict(opt="svname", type=Options.T_STR, default=self.default_svname, required=True, multi=False, hide=True, choice=None, web="readonly",
|
|
44
|
+
description_ja="サーバーのサービス名を指定します。省略時は `server` を使用します。",
|
|
45
|
+
description_en="Specify the service name of the inference server. If omitted, `server` is used."),
|
|
46
|
+
dict(opt="scope", type=Options.T_STR, default="client", required=True, multi=False, hide=False, choice=["client", "current", "server"],
|
|
47
|
+
description_ja="参照先スコープを指定します。指定可能な画像タイプは `client` , `current` , `server` です。",
|
|
48
|
+
description_en="Specifies the scope to be referenced. When omitted, 'client' is used.",
|
|
49
|
+
choice_show=dict(client=["client_data"]),
|
|
50
|
+
test_true={"server":"server",
|
|
51
|
+
"client":"client",
|
|
52
|
+
"current":"current"}),
|
|
53
|
+
dict(opt="svpath", type=Options.T_FILE, default="/", required=True, multi=False, hide=False, choice=None,
|
|
54
|
+
description_ja="サーバーのデータフォルダ以下のパスを指定します。省略時は `/` を使用します。",
|
|
55
|
+
description_en="Specify the directory path to get the list of files.",
|
|
56
|
+
test_true={"server":"/"}),
|
|
57
|
+
dict(opt="client_data", type=Options.T_STR, default=None, required=False, multi=False, hide=False, choice=None,
|
|
58
|
+
description_ja="ローカルを参照させる場合のデータフォルダのパスを指定します。",
|
|
59
|
+
description_en="Specify the path of the data folder when local is referenced.",
|
|
60
|
+
test_true={"server":None,
|
|
61
|
+
"client":common.HOME_DIR / f".{self.ver.__appid__}",
|
|
62
|
+
"current":None}),
|
|
63
|
+
dict(opt="retry_count", type=Options.T_INT, default=3, required=False, multi=False, hide=True, choice=None,
|
|
64
|
+
description_ja="Redisサーバーへの再接続回数を指定します。0以下を指定すると永遠に再接続を行います。",
|
|
65
|
+
description_en="Specifies the number of reconnections to the Redis server.If less than 0 is specified, reconnection is forever."),
|
|
66
|
+
dict(opt="retry_interval", type=Options.T_INT, default=5, required=False, multi=False, hide=True, choice=None,
|
|
67
|
+
description_ja="Redisサーバーに再接続までの秒数を指定します。",
|
|
68
|
+
description_en="Specifies the number of seconds before reconnecting to the Redis server."),
|
|
69
|
+
dict(opt="timeout", type=Options.T_INT, default="15", required=False, multi=False, hide=True, choice=None,
|
|
70
|
+
description_ja="サーバーの応答が返ってくるまでの最大待ち時間を指定。",
|
|
71
|
+
description_en="Specify the maximum waiting time until the server responds."),
|
|
72
|
+
dict(opt="output_json", short="o", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="out",
|
|
73
|
+
description_ja="処理結果jsonの保存先ファイルを指定。",
|
|
74
|
+
description_en="Specify the destination file for saving the processing result json."),
|
|
75
|
+
dict(opt="output_json_append", short="a", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
|
|
76
|
+
description_ja="処理結果jsonファイルを追記保存します。",
|
|
77
|
+
description_en="Save the processing result json file by appending."),
|
|
78
|
+
dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
79
|
+
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
|
|
80
|
+
description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
|
|
81
|
+
dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
|
|
82
|
+
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
|
|
83
|
+
description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
|
|
84
|
+
dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
|
|
85
|
+
description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
|
|
86
|
+
description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
OPENPYXL_TYPE_TO_STRING = {
|
|
91
|
+
"n": "numeric",
|
|
92
|
+
"s": "string",
|
|
93
|
+
"f": "formula",
|
|
94
|
+
"b": "boolean",
|
|
95
|
+
"e": "error",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
|
|
99
|
+
"""
|
|
100
|
+
この機能の実行を行います
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
logger (logging.Logger): ロガー
|
|
104
|
+
args (argparse.Namespace): 引数
|
|
105
|
+
tm (float): 実行開始時間
|
|
106
|
+
pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
|
|
110
|
+
"""
|
|
111
|
+
chk, msg, _ = self.chk_args(args, tm, pf)
|
|
112
|
+
if chk != self.RESP_SUCCESS:
|
|
113
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
114
|
+
return self.RESP_WARN, msg, None
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
client_data = Path(args.client_data.replace('"','')) if args.client_data is not None else None
|
|
118
|
+
if args.scope == "client":
|
|
119
|
+
if client_data is not None:
|
|
120
|
+
f = filer.Filer(client_data, logger)
|
|
121
|
+
chk, abspath, msg = f._file_exists(args.svpath)
|
|
122
|
+
if not chk:
|
|
123
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
124
|
+
return self.RESP_WARN, msg, None
|
|
125
|
+
res = self.excel_proc(abspath, args, logger, tm, pf)
|
|
126
|
+
if 'success' not in res:
|
|
127
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
128
|
+
return self.RESP_WARN, res, None
|
|
129
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
130
|
+
return self.RESP_SUCCESS, res, None
|
|
131
|
+
else:
|
|
132
|
+
msg = dict(warn=f"client_data is empty.")
|
|
133
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
134
|
+
return self.RESP_WARN, msg, None
|
|
135
|
+
elif args.scope == "current":
|
|
136
|
+
f = filer.Filer(Path.cwd(), logger)
|
|
137
|
+
chk, abspath, msg = f._file_exists(args.svpath)
|
|
138
|
+
if not chk:
|
|
139
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
140
|
+
return self.RESP_WARN, msg, None
|
|
141
|
+
res = self.excel_proc(abspath, args, logger, tm, pf)
|
|
142
|
+
if 'success' not in res:
|
|
143
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
144
|
+
return self.RESP_WARN, res, None
|
|
145
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
146
|
+
return self.RESP_SUCCESS, res, None
|
|
147
|
+
elif args.scope == "server":
|
|
148
|
+
cl = client.Client(logger, redis_host=args.host, redis_port=args.port, redis_password=args.password, svname=args.svname)
|
|
149
|
+
res = cl.redis_cli.send_cmd(self.get_svcmd(), self.get_svparam(args),
|
|
150
|
+
retry_count=args.retry_count, retry_interval=args.retry_interval, timeout=args.timeout)
|
|
151
|
+
if 'success' not in res:
|
|
152
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
153
|
+
return self.RESP_WARN, res, None
|
|
154
|
+
common.print_format(res, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
155
|
+
return self.RESP_SUCCESS, res, None
|
|
156
|
+
else:
|
|
157
|
+
logger.warning(f"scope is invalid. {args.scope}")
|
|
158
|
+
return dict(warn=f"scope is invalid. {args.scope}")
|
|
159
|
+
except Exception as e:
|
|
160
|
+
logger.warning(f"Exception occurred. {e}", exc_info=True)
|
|
161
|
+
return self.RESP_WARN, dict(warn=f"Exception occurred. {e}"), None
|
|
162
|
+
|
|
163
|
+
def chk_args(self, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[bool, str, Any]:
|
|
164
|
+
"""
|
|
165
|
+
引数のチェックを行います
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
args (argparse.Namespace): 引数
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Tuple[bool, str]: チェック結果, メッセージ
|
|
172
|
+
"""
|
|
173
|
+
if args.svname is None:
|
|
174
|
+
msg = dict(warn=f"Please specify the --svname option.")
|
|
175
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
176
|
+
return self.RESP_WARN, msg, None
|
|
177
|
+
if args.scope is None:
|
|
178
|
+
msg = dict(warn=f"Please specify the --scope option.")
|
|
179
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
180
|
+
return self.RESP_WARN, msg, None
|
|
181
|
+
if args.svpath is None:
|
|
182
|
+
msg = dict(warn=f"Please specify the --svpath option.")
|
|
183
|
+
common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
|
|
184
|
+
return self.RESP_WARN, msg, None
|
|
185
|
+
return self.RESP_SUCCESS, None, None
|
|
186
|
+
|
|
187
|
+
def excel_proc(self, abspath:Path, args:argparse.Namespace, logger:logging.Logger, tm:float, pf:List[Dict[str, float]]=[]) -> Dict[str, Any]:
|
|
188
|
+
"""
|
|
189
|
+
Excel処理のベース
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
abspath (Path): Excelファイルの絶対パス
|
|
193
|
+
args (argparse.Namespace): 引数
|
|
194
|
+
logger (logging.Logger): ロガー
|
|
195
|
+
tm (float): 処理時間
|
|
196
|
+
pf (List[Dict[str, float]]): パフォーマンス情報
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
Dict[str, Any]: 結果
|
|
200
|
+
"""
|
|
201
|
+
raise NotImplementedError("Excel processing is not implemented.")
|
|
202
|
+
|
|
203
|
+
def get_svparam(self, args:argparse.Namespace) -> List[str]:
|
|
204
|
+
"""
|
|
205
|
+
サーバーに送信するパラメーターを返します
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
args (argparse.Namespace): 引数
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
List[str]: サーバーに送信するパラメーター
|
|
212
|
+
"""
|
|
213
|
+
raise NotImplementedError("Get svparam is not implemented.")
|
|
214
|
+
|
|
215
|
+
def format_cell(self, output_cell_format:str, otxt:str, val:str, logger:logging.Logger) -> str:
|
|
216
|
+
"""
|
|
217
|
+
テキストをフォーマットに応じて、valをフォーマットします
|
|
218
|
+
|
|
219
|
+
Args:
|
|
220
|
+
output_cell_format (str): 出力フォーマット
|
|
221
|
+
otxt (str): 追加先のテキスト
|
|
222
|
+
val (str): セルの値
|
|
223
|
+
logger (logging.Logger): ロガー
|
|
224
|
+
|
|
225
|
+
Returns:
|
|
226
|
+
str: 追加後のテキスト
|
|
227
|
+
"""
|
|
228
|
+
val = str(val) if val is not None else ""
|
|
229
|
+
otxt = otxt if otxt is not None else ""
|
|
230
|
+
ret = ""
|
|
231
|
+
if output_cell_format == 'csv':
|
|
232
|
+
ret = val.replace("\n", " ").replace("\r", "")
|
|
233
|
+
ret = ret.replace('"', '""')
|
|
234
|
+
ret = ret if ret.find(",")>-1 else f'"{ret}"'
|
|
235
|
+
if otxt and not otxt.endswith("\n"):
|
|
236
|
+
ret = f",{ret}"
|
|
237
|
+
elif output_cell_format == 'md':
|
|
238
|
+
ret = val.replace("\n", " ").replace("\r", "")
|
|
239
|
+
ret = ret.replace('|', r'\|')
|
|
240
|
+
if otxt and not otxt.endswith("\n"):
|
|
241
|
+
ret = f"{ret}|"
|
|
242
|
+
else:
|
|
243
|
+
ret = f"|{ret}|"
|
|
244
|
+
elif output_cell_format == 'html':
|
|
245
|
+
ret = html.escape(val)
|
|
246
|
+
ret = ret.replace("\n", "<br/>").replace("\r", "")
|
|
247
|
+
ret = f"<td>{ret}</td>"
|
|
248
|
+
return ret
|
|
249
|
+
|
|
250
|
+
def format_newline(self, output_cell_format:str, otxt:str, logger:logging.Logger) -> str:
|
|
251
|
+
"""
|
|
252
|
+
テキストをフォーマットに応じて改行を追加します
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
output_cell_format (str): 出力フォーマット
|
|
256
|
+
otxt (str): 追加先のテキスト
|
|
257
|
+
logger (logging.Logger): ロガー
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
str: 追加後のテキスト
|
|
261
|
+
"""
|
|
262
|
+
otxt = otxt if otxt is not None else ""
|
|
263
|
+
ret = ""
|
|
264
|
+
if output_cell_format == 'csv':
|
|
265
|
+
ret = f"{otxt}\n" if otxt else "\n"
|
|
266
|
+
elif output_cell_format == 'md':
|
|
267
|
+
ret = f"{otxt}\n" if otxt else "\n"
|
|
268
|
+
elif output_cell_format == 'html':
|
|
269
|
+
if otxt and otxt.find(r"<TTRR/>") > -1:
|
|
270
|
+
pre = re.sub(r'<TTRR/>.*', '', otxt, flags=re.DOTALL)
|
|
271
|
+
post = re.sub(r'.+<TTRR/>', '', otxt, flags=re.DOTALL)
|
|
272
|
+
ret = f"{pre}<tr>{post}</tr>\n<TTRR/>"
|
|
273
|
+
elif otxt:
|
|
274
|
+
ret = f"<tr>{otxt}</tr>\n<TTRR/>"
|
|
275
|
+
elif not otxt:
|
|
276
|
+
ret = "<tr></tr>\n<TTRR/>"
|
|
277
|
+
return ret
|
|
278
|
+
|
|
279
|
+
def format_table(self, output_cell_format:str, otxt:str, logger:logging.Logger) -> str:
|
|
280
|
+
"""
|
|
281
|
+
テキストをフォーマットに応じてテーブルを構成します
|
|
282
|
+
Args:
|
|
283
|
+
output_cell_format (str): 出力フォーマット
|
|
284
|
+
otxt (str): 追加先のテキスト
|
|
285
|
+
logger (logging.Logger): ロガー
|
|
286
|
+
Returns:
|
|
287
|
+
str: 追加後のテキスト
|
|
288
|
+
"""
|
|
289
|
+
otxt = otxt if otxt is not None else ""
|
|
290
|
+
ret = ""
|
|
291
|
+
if output_cell_format == 'csv':
|
|
292
|
+
ret = f"{otxt}\n" if otxt else "\n"
|
|
293
|
+
elif output_cell_format == 'md':
|
|
294
|
+
ret = f"{otxt}\n" if otxt else "\n"
|
|
295
|
+
elif output_cell_format == 'html':
|
|
296
|
+
otxt = re.sub(r'<TTRR/>.*', '', otxt, flags=re.DOTALL)
|
|
297
|
+
if otxt:
|
|
298
|
+
ret = f"<table>{otxt}</table>\n"
|
|
299
|
+
elif not otxt:
|
|
300
|
+
ret = "\n"
|
|
301
|
+
return ret
|
cmdbox/app/web.py
CHANGED
|
@@ -933,7 +933,7 @@ class Web:
|
|
|
933
933
|
if platform.system() == "Windows":
|
|
934
934
|
os.system(f"taskkill /F /PID {pid}")
|
|
935
935
|
else:
|
|
936
|
-
os.kill(int(pid), signal.
|
|
936
|
+
os.kill(int(pid), signal.SIGKILL)
|
|
937
937
|
self.logger.info(f"Stop web.")
|
|
938
938
|
else:
|
|
939
939
|
self.logger.warning(f"pid is empty.")
|
|
@@ -999,9 +999,14 @@ class ThreadedASGI:
|
|
|
999
999
|
|
|
1000
1000
|
def start(self):
|
|
1001
1001
|
if self.force_single:
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1002
|
+
if platform.system() == "Windows":
|
|
1003
|
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
1004
|
+
self.thread.start()
|
|
1005
|
+
asyncio.run(self.wait_for_started())
|
|
1006
|
+
else:
|
|
1007
|
+
self.thread.start()
|
|
1008
|
+
task = asyncio.get_event_loop().create_task(self.wait_for_started())
|
|
1009
|
+
# task.result()
|
|
1005
1010
|
else:
|
|
1006
1011
|
async def run():
|
|
1007
1012
|
self.server.run()
|
cmdbox/extensions/features.yml
CHANGED
|
@@ -46,6 +46,9 @@ agentrule: # Specifies a list of rules that determi
|
|
|
46
46
|
- mode: client
|
|
47
47
|
cmds: [file_download, file_list, http, server_info]
|
|
48
48
|
rule: allow
|
|
49
|
+
- mode: excel
|
|
50
|
+
cmds: [cell_details, cell_search, cell_values, sheet_list]
|
|
51
|
+
rule: allow
|
|
49
52
|
- mode: server
|
|
50
53
|
cmds: [list]
|
|
51
54
|
rule: allow
|
|
@@ -65,15 +65,6 @@ class ServerTime(feature.Feature):
|
|
|
65
65
|
description_en="Specify the maximum waiting time until the server responds."),
|
|
66
66
|
])
|
|
67
67
|
|
|
68
|
-
def get_svcmd(self):
|
|
69
|
-
"""
|
|
70
|
-
この機能のサーバー側のコマンドを返します
|
|
71
|
-
|
|
72
|
-
Returns:
|
|
73
|
-
str: サーバー側のコマンド
|
|
74
|
-
"""
|
|
75
|
-
return 'server_time'
|
|
76
|
-
|
|
77
68
|
def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
|
|
78
69
|
"""
|
|
79
70
|
この機能の実行を行います
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017, Hsiaoming Yang
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2006-2025 the Mako authors and contributors <see AUTHORS file>.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2005-2025 SQLAlchemy authors and contributors <see AUTHORS file>.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|