pilot.linkstec 0.0.13__tar.gz → 0.0.27__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.
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/PKG-INFO +1 -1
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/pyproject.toml +1 -1
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/config/config_reader.py +0 -2
- pilot_linkstec-0.0.27/src/pilot/conver/commentRemover.py +100 -0
- pilot_linkstec-0.0.27/src/pilot/conver/converfileEncodding.py +49 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/generater/vertexai.py +3 -2
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/job/impl/base_job.py +20 -2
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/job/job_interface.py +1 -0
- pilot_linkstec-0.0.27/src/pilot/logging/logger.py +57 -0
- pilot_linkstec-0.0.27/src/pilot/processor/code_processor.py +8 -0
- pilot_linkstec-0.0.27/src/pilot/processor/code_processor_pipeline.py +14 -0
- pilot_linkstec-0.0.27/src/pilot/unit/impl/__init__.py +0 -0
- pilot_linkstec-0.0.27/src/pilot/util/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot.linkstec.egg-info/PKG-INFO +1 -1
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot.linkstec.egg-info/SOURCES.txt +6 -0
- pilot_linkstec-0.0.13/src/pilot/conver/converfileEncodding.py +0 -77
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/LICENSE +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/README.md +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/setup.cfg +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/config/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/control/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/control/control_interface.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/control/impl/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/control/impl/base_controller.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/conver/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/conver/nkf_converter.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/generater/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/job/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/job/impl/__init__.py +0 -0
- {pilot_linkstec-0.0.13/src/pilot/splitters → pilot_linkstec-0.0.27/src/pilot/logging}/__init__.py +0 -0
- {pilot_linkstec-0.0.13/src/pilot/unit → pilot_linkstec-0.0.27/src/pilot/processor}/__init__.py +0 -0
- {pilot_linkstec-0.0.13/src/pilot/unit/impl → pilot_linkstec-0.0.27/src/pilot/splitters}/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/splitters/cobolsplitter.py +0 -0
- {pilot_linkstec-0.0.13/src/pilot/util → pilot_linkstec-0.0.27/src/pilot/unit}/__init__.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/unit/impl/base_unit.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/unit/unit_interface.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot/util/files.py +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot.linkstec.egg-info/dependency_links.txt +0 -0
- {pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot.linkstec.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
class CommentRemover:
|
|
6
|
+
"""
|
|
7
|
+
ColdFusion (.cfm, .cfc) と JavaScript (.js) のコメント削除クラス
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, file_path: str):
|
|
11
|
+
self.file_path = Path(file_path)
|
|
12
|
+
self.text = ''
|
|
13
|
+
self.cleaned_text = ''
|
|
14
|
+
|
|
15
|
+
def load(self, encoding='utf-8'):
|
|
16
|
+
try:
|
|
17
|
+
with self.file_path.open('r', encoding=encoding) as f:
|
|
18
|
+
self.text = f.read()
|
|
19
|
+
except Exception as e:
|
|
20
|
+
print(f"Failed to load file {self.file_path}: {e}", file=sys.stderr)
|
|
21
|
+
raise
|
|
22
|
+
|
|
23
|
+
def save(self, output_path: str, encoding='utf-8'):
|
|
24
|
+
try:
|
|
25
|
+
with open(output_path, 'w', encoding=encoding) as f:
|
|
26
|
+
f.write(self.cleaned_text)
|
|
27
|
+
except Exception as e:
|
|
28
|
+
print(f"Failed to save file {output_path}: {e}", file=sys.stderr)
|
|
29
|
+
raise
|
|
30
|
+
|
|
31
|
+
def remove_comments(self):
|
|
32
|
+
ext = self.file_path.suffix.lower()
|
|
33
|
+
if ext in ['.cfm', '.cfc']:
|
|
34
|
+
self.cleaned_text = self.remove_coldfusion_comments(self.text)
|
|
35
|
+
elif ext == '.js':
|
|
36
|
+
self.cleaned_text = self.remove_js_comments(self.text)
|
|
37
|
+
elif ext in ['.cbl', '.cob', '.cobol']:
|
|
38
|
+
self.cleaned_text = self.remove_cobol_comments(self.text)
|
|
39
|
+
else:
|
|
40
|
+
print(f"Unsupported file extension: {ext}, no comment removal applied.", file=sys.stderr)
|
|
41
|
+
self.cleaned_text = self.text
|
|
42
|
+
|
|
43
|
+
def remove_coldfusion_comments(self, text: str) -> str:
|
|
44
|
+
pattern_cftag = r'<!---(?:.|\n)*?--->'
|
|
45
|
+
pattern_block = r'/\*(?:.|\n)*?\*/'
|
|
46
|
+
pattern_line = r'//.*?$'
|
|
47
|
+
|
|
48
|
+
text = re.sub(pattern_cftag, '', text, flags=re.MULTILINE)
|
|
49
|
+
text = re.sub(pattern_block, '', text, flags=re.MULTILINE)
|
|
50
|
+
text = re.sub(pattern_line, '', text, flags=re.MULTILINE)
|
|
51
|
+
return text
|
|
52
|
+
|
|
53
|
+
def remove_js_comments(self, text: str) -> str:
|
|
54
|
+
pattern_block = r'/\*(?:.|\n)*?\*/'
|
|
55
|
+
pattern_line = r'//.*?$'
|
|
56
|
+
|
|
57
|
+
text = re.sub(pattern_block, '', text, flags=re.MULTILINE)
|
|
58
|
+
text = re.sub(pattern_line, '', text, flags=re.MULTILINE)
|
|
59
|
+
return text
|
|
60
|
+
|
|
61
|
+
def remove_cobol_comments(self, text: str) -> str:
|
|
62
|
+
"""
|
|
63
|
+
COBOLのコメント行、および方言の行内コメント *>以降を削除
|
|
64
|
+
|
|
65
|
+
・固定形式コメント行
|
|
66
|
+
行頭が '*'(先頭1文字目が*)の行はコメント → 削除
|
|
67
|
+
または7文字目が '*'の行もコメント → 削除
|
|
68
|
+
|
|
69
|
+
・行内コメント (方言)
|
|
70
|
+
'*> '以降はコメント → 削除
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
lines = text.splitlines()
|
|
74
|
+
cleaned_lines = []
|
|
75
|
+
|
|
76
|
+
for line in lines:
|
|
77
|
+
# 固定長形式にあわせて7文字目 (index 6)を判定
|
|
78
|
+
# 行長が7未満でも対応 (存在しなければFalse)
|
|
79
|
+
is_comment_line = False
|
|
80
|
+
|
|
81
|
+
if line.startswith('*'):
|
|
82
|
+
is_comment_line = True
|
|
83
|
+
elif len(line) >= 7 and line[6] == '*':
|
|
84
|
+
is_comment_line = True
|
|
85
|
+
|
|
86
|
+
if is_comment_line:
|
|
87
|
+
# コメント行なのでスキップ
|
|
88
|
+
continue
|
|
89
|
+
|
|
90
|
+
# 行内コメント *> の扱い
|
|
91
|
+
# 行の途中に '*> ' (*>に続く空白も含む) があればその位置で切り捨てる
|
|
92
|
+
comment_pos = line.find('*>')
|
|
93
|
+
if comment_pos != -1:
|
|
94
|
+
# 行内コメント開始位置でカット(空白も含め全部削除)
|
|
95
|
+
# 例えば 'MOVE X TO Y *> このコメント' => 'MOVE X TO Y '
|
|
96
|
+
line = line[:comment_pos].rstrip()
|
|
97
|
+
|
|
98
|
+
cleaned_lines.append(line)
|
|
99
|
+
|
|
100
|
+
return '\n'.join(cleaned_lines)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import sys
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
def nkf_convert(file_path, nkf_args):
|
|
6
|
+
"""
|
|
7
|
+
nkf を使ってファイルの文字コード変換を行う
|
|
8
|
+
|
|
9
|
+
:param file_path: 変換対象のファイルパス
|
|
10
|
+
:param nkf_args: nkf に渡す引数のリスト(例: ['-w'])
|
|
11
|
+
"""
|
|
12
|
+
# nkfコマンドの引数にファイルパスを追加
|
|
13
|
+
cmd = ['nkf'] + nkf_args + [file_path]
|
|
14
|
+
|
|
15
|
+
#cmd = 'nkf32' + ' ' + arg1 + ' '+ arg2 +' '+ file_path
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
# nkfを実行し標準出力を取得
|
|
20
|
+
result = subprocess.run(
|
|
21
|
+
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
|
|
22
|
+
print(f"nkfの実行完了しました: {file_path}")
|
|
23
|
+
except subprocess.CalledProcessError as e:
|
|
24
|
+
print(f"nkfの実行でエラーが発生しました: {e.stderr.decode()}", file=sys.stderr)
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
# nkfの変換結果(バイト列)を返す
|
|
28
|
+
return result.stdout
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#if __name__ == "__main__":
|
|
32
|
+
# 処理対象のルートフォルダパスを指定(適宜変更してください)
|
|
33
|
+
# root_folder = r"d:\work2\src"
|
|
34
|
+
# nkf_convert(root_folder, ['-v'])
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#if __name__ == "__main__":
|
|
39
|
+
# if len(sys.argv) < 3:
|
|
40
|
+
# print(f"使い方: python {sys.argv[0]} <ファイルパス> <nkf引数...>", file=sys.stderr)
|
|
41
|
+
# print(f"例: python {sys.argv[0]} test.txt -w --overwrite", file=sys.stderr)
|
|
42
|
+
# sys.exit(1)
|
|
43
|
+
|
|
44
|
+
# file_path = [r"D:\test\CHKCONST.cpy"]
|
|
45
|
+
# nkf_args = ['-w','--overwrite']
|
|
46
|
+
#nkf_args = ['-g']
|
|
47
|
+
# output = nkf_convert(file_path, nkf_args)
|
|
48
|
+
|
|
49
|
+
|
|
@@ -7,6 +7,8 @@ import os
|
|
|
7
7
|
|
|
8
8
|
class VertexAISingleton:
|
|
9
9
|
_instance: Optional['VertexAISingleton'] = None
|
|
10
|
+
|
|
11
|
+
|
|
10
12
|
_lock = threading.Lock()
|
|
11
13
|
_tokenizer_cache = {}
|
|
12
14
|
encoding = None
|
|
@@ -24,7 +26,7 @@ class VertexAISingleton:
|
|
|
24
26
|
with self._lock:
|
|
25
27
|
if not self._initialized:
|
|
26
28
|
self.model = GenerativeModel(model_name)
|
|
27
|
-
|
|
29
|
+
self.encoding = tiktoken.get_encoding("cl100k_base")
|
|
28
30
|
self._initialized = True
|
|
29
31
|
|
|
30
32
|
def generate_content(self, prompt: str) -> Dict[str, Any]:
|
|
@@ -52,7 +54,6 @@ class VertexAISingleton:
|
|
|
52
54
|
def count_tokens(self, text: str) -> int:
|
|
53
55
|
"""与えられたテキストのトークン数を返す(bert-base-uncasedのみ使用)"""
|
|
54
56
|
try:
|
|
55
|
-
self.encoding = tiktoken.get_encoding("cl100k_base")
|
|
56
57
|
tokens = self.encoding.encode(text)
|
|
57
58
|
return len(tokens)
|
|
58
59
|
except Exception as e:
|
|
@@ -2,11 +2,12 @@ import os
|
|
|
2
2
|
import shutil
|
|
3
3
|
|
|
4
4
|
from pilot.job.job_interface import JobInterface
|
|
5
|
-
from pilot.
|
|
5
|
+
from pilot.logging.logger import get_logger
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class BaseJob(JobInterface):
|
|
9
9
|
def __init__(self):
|
|
10
|
+
self.logger = get_logger(__name__)
|
|
10
11
|
self.config_dto = None
|
|
11
12
|
self._current_step = None
|
|
12
13
|
self._file_path = None
|
|
@@ -15,6 +16,7 @@ class BaseJob(JobInterface):
|
|
|
15
16
|
self._next_step_file_path = None
|
|
16
17
|
self._content = None
|
|
17
18
|
|
|
19
|
+
|
|
18
20
|
@property
|
|
19
21
|
def current_step(self):
|
|
20
22
|
return self._current_step
|
|
@@ -325,4 +327,20 @@ class BaseJob(JobInterface):
|
|
|
325
327
|
open(end_file, 'w', encoding='utf-8').close()
|
|
326
328
|
return end_file
|
|
327
329
|
|
|
328
|
-
return None
|
|
330
|
+
return None
|
|
331
|
+
|
|
332
|
+
def pre_run(self):
|
|
333
|
+
"""
|
|
334
|
+
ジョブ実行前の前処理を行うメソッド。
|
|
335
|
+
必要に応じてサブクラスでオーバーライドして使用する。
|
|
336
|
+
"""
|
|
337
|
+
pass
|
|
338
|
+
|
|
339
|
+
def post_run(self):
|
|
340
|
+
"""
|
|
341
|
+
ジョブ実行後の後処理を行うメソッド。
|
|
342
|
+
必要に応じてサブクラスでオーバーライドして使用する。
|
|
343
|
+
"""
|
|
344
|
+
pass
|
|
345
|
+
|
|
346
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import sys
|
|
3
|
+
import threading
|
|
4
|
+
|
|
5
|
+
# コンソールカラーのコード定義
|
|
6
|
+
RESET = "\x1b[0m"
|
|
7
|
+
COLOR_MAP = {
|
|
8
|
+
logging.DEBUG: "\x1b[37m", # 白色
|
|
9
|
+
logging.INFO: "\x1b[32m", # 緑色
|
|
10
|
+
logging.WARNING: "\x1b[33m", # 黄色
|
|
11
|
+
logging.ERROR: "\x1b[31m", # 赤色
|
|
12
|
+
logging.CRITICAL: "\x1b[41m", # 赤背景白文字
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ColoredFormatter(logging.Formatter):
|
|
17
|
+
def format(self, record):
|
|
18
|
+
color = COLOR_MAP.get(record.levelno, RESET)
|
|
19
|
+
# スレッド名を取得
|
|
20
|
+
thread_name = threading.current_thread().name
|
|
21
|
+
thread_name = thread_name.split('_', 1)[1] if '_' in thread_name else thread_name
|
|
22
|
+
# クラス名、メソッド名、行番号
|
|
23
|
+
prefix = f"{self.formatTime(record, '%Y-%m-%d %H:%M:%S')} " \
|
|
24
|
+
f"[{record.levelname}] " \
|
|
25
|
+
f"[{thread_name}] " \
|
|
26
|
+
f"[{record.module}.{record.funcName}:{record.lineno}]"
|
|
27
|
+
message = super().format(record)
|
|
28
|
+
return f"{color}{prefix} {message}{RESET}"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
_global_logger_configured = False
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def setup_global_logger(log_level: int = logging.INFO):
|
|
35
|
+
global _global_logger_configured
|
|
36
|
+
|
|
37
|
+
if not _global_logger_configured:
|
|
38
|
+
logging.basicConfig(
|
|
39
|
+
level=log_level,
|
|
40
|
+
format='%(message)s'
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
root_logger = logging.getLogger()
|
|
44
|
+
if root_logger.handlers:
|
|
45
|
+
root_logger.handlers.clear()
|
|
46
|
+
|
|
47
|
+
handler = logging.StreamHandler(sys.stdout)
|
|
48
|
+
formatter = ColoredFormatter('%(message)s')
|
|
49
|
+
handler.setFormatter(formatter)
|
|
50
|
+
root_logger.addHandler(handler)
|
|
51
|
+
root_logger.setLevel(log_level)
|
|
52
|
+
|
|
53
|
+
_global_logger_configured = True
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_logger(name: str) -> logging.Logger:
|
|
57
|
+
return logging.getLogger(name)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from pilot.processor.code_processor import CodeProcessor
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CodeProcessorPipeline:
|
|
7
|
+
def __init__(self, processors: List[CodeProcessor]):
|
|
8
|
+
self.processors = processors
|
|
9
|
+
|
|
10
|
+
def run(self, lines: List[str]) -> List[str]:
|
|
11
|
+
result = lines
|
|
12
|
+
for processor in self.processors:
|
|
13
|
+
result = processor.process(result)
|
|
14
|
+
return result
|
|
File without changes
|
|
File without changes
|
|
@@ -13,6 +13,7 @@ src/pilot/control/control_interface.py
|
|
|
13
13
|
src/pilot/control/impl/__init__.py
|
|
14
14
|
src/pilot/control/impl/base_controller.py
|
|
15
15
|
src/pilot/conver/__init__.py
|
|
16
|
+
src/pilot/conver/commentRemover.py
|
|
16
17
|
src/pilot/conver/converfileEncodding.py
|
|
17
18
|
src/pilot/conver/nkf_converter.py
|
|
18
19
|
src/pilot/generater/__init__.py
|
|
@@ -21,6 +22,11 @@ src/pilot/job/__init__.py
|
|
|
21
22
|
src/pilot/job/job_interface.py
|
|
22
23
|
src/pilot/job/impl/__init__.py
|
|
23
24
|
src/pilot/job/impl/base_job.py
|
|
25
|
+
src/pilot/logging/__init__.py
|
|
26
|
+
src/pilot/logging/logger.py
|
|
27
|
+
src/pilot/processor/__init__.py
|
|
28
|
+
src/pilot/processor/code_processor.py
|
|
29
|
+
src/pilot/processor/code_processor_pipeline.py
|
|
24
30
|
src/pilot/splitters/__init__.py
|
|
25
31
|
src/pilot/splitters/cobolsplitter.py
|
|
26
32
|
src/pilot/unit/__init__.py
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import sys
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
def nkf_convert(file_path, nkf_args):
|
|
6
|
-
"""
|
|
7
|
-
nkf を使ってファイルの文字コード変換を行う
|
|
8
|
-
|
|
9
|
-
:param file_path: 変換対象のファイルパス
|
|
10
|
-
:param nkf_args: nkf に渡す引数のリスト(例: ['-w'])
|
|
11
|
-
"""
|
|
12
|
-
# nkfコマンドの引数にファイルパスを追加
|
|
13
|
-
#cmd = ['nkf'] + nkf_args + [file_path]
|
|
14
|
-
|
|
15
|
-
cmd = ['nkf32'] + nkf_args + file_path
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
try:
|
|
19
|
-
# nkfを実行し標準出力を取得
|
|
20
|
-
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
|
|
21
|
-
print(f"nkfの実行完了しました: {file_path}")
|
|
22
|
-
except subprocess.CalledProcessError as e:
|
|
23
|
-
print(f"nkfの実行でエラーが発生しました: {e.stderr.decode()}", file=sys.stderr)
|
|
24
|
-
return None
|
|
25
|
-
|
|
26
|
-
# nkfの変換結果(バイト列)を返す
|
|
27
|
-
return result.stdout
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
#if __name__ == "__main__":
|
|
31
|
-
# 処理対象のルートフォルダパスを指定(適宜変更してください)
|
|
32
|
-
# root_folder = r"d:\work2\src"
|
|
33
|
-
# nkf_convert(root_folder, ['-v'])
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#if __name__ == "__main__":
|
|
38
|
-
# if len(sys.argv) < 3:
|
|
39
|
-
# print(f"使い方: python {sys.argv[0]} <ファイルパス> <nkf引数...>", file=sys.stderr)
|
|
40
|
-
# print(f"例: python {sys.argv[0]} test.txt -w --overwrite", file=sys.stderr)
|
|
41
|
-
# sys.exit(1)
|
|
42
|
-
|
|
43
|
-
# file_path = [r"D:\test\CHKCONST.cpy"]
|
|
44
|
-
# nkf_args = ['-w','--overwrite']
|
|
45
|
-
#nkf_args = ['-g']
|
|
46
|
-
# output = nkf_convert(file_path, nkf_args)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if __name__ == "__main__":
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
target_dir = r'D:\work\fullsource'
|
|
53
|
-
nkf_args = ['-w', '--overwrite']
|
|
54
|
-
#extensions = (
|
|
55
|
-
# '.cfc', '.cfm', '.cob', '.cobol', '.cpy', '.csh', '.css', '.ctl',
|
|
56
|
-
# '.htm', '.html', '.js', '.sh', '.sql', '.tpl', '.txt'
|
|
57
|
-
#)
|
|
58
|
-
extensions = ('.cnd','.cng','int')
|
|
59
|
-
for root, dirs, files in os.walk(target_dir):
|
|
60
|
-
for file in files:
|
|
61
|
-
if file.lower().endswith(extensions):
|
|
62
|
-
filepath = os.path.join(root, file)
|
|
63
|
-
output = nkf_convert([filepath], nkf_args)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
#if output is not None:
|
|
67
|
-
# 結果を標準出力にバイナリのまま書き出す場合
|
|
68
|
-
# sys.stdout.buffer.write(output)
|
|
69
|
-
|
|
70
|
-
# あるいはUTF-8等に応じてデコードして表示する場合
|
|
71
|
-
# 一旦utf-8デコードを試みる例(必要に応じて変更してください)
|
|
72
|
-
# try:
|
|
73
|
-
# decoded_output = output.decode('utf-8')
|
|
74
|
-
# print(decoded_output)
|
|
75
|
-
# except UnicodeDecodeError:
|
|
76
|
-
# print("utf-8へのデコードに失敗しました。バイナリデータとして出力します。", file=sys.stderr)
|
|
77
|
-
# sys.stdout.buffer.write(output)
|
|
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
|
{pilot_linkstec-0.0.13/src/pilot/splitters → pilot_linkstec-0.0.27/src/pilot/logging}/__init__.py
RENAMED
|
File without changes
|
{pilot_linkstec-0.0.13/src/pilot/unit → pilot_linkstec-0.0.27/src/pilot/processor}/__init__.py
RENAMED
|
File without changes
|
{pilot_linkstec-0.0.13/src/pilot/unit/impl → pilot_linkstec-0.0.27/src/pilot/splitters}/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pilot_linkstec-0.0.13 → pilot_linkstec-0.0.27}/src/pilot.linkstec.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|