pilot.linkstec 0.0.25__tar.gz → 0.0.28__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 (40) hide show
  1. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/PKG-INFO +1 -1
  2. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/pyproject.toml +1 -1
  3. pilot_linkstec-0.0.28/src/pilot/conver/commentRemover.py +100 -0
  4. pilot_linkstec-0.0.28/src/pilot/conver/converfileEncodding.py +49 -0
  5. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/generater/vertexai.py +2 -0
  6. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/job/job_interface.py +1 -0
  7. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot.linkstec.egg-info/PKG-INFO +1 -1
  8. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot.linkstec.egg-info/SOURCES.txt +1 -0
  9. pilot_linkstec-0.0.25/src/pilot/conver/converfileEncodding.py +0 -77
  10. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/LICENSE +0 -0
  11. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/README.md +0 -0
  12. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/setup.cfg +0 -0
  13. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/__init__.py +0 -0
  14. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/config/__init__.py +0 -0
  15. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/config/config_reader.py +0 -0
  16. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/control/__init__.py +0 -0
  17. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/control/control_interface.py +0 -0
  18. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/control/impl/__init__.py +0 -0
  19. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/control/impl/base_controller.py +0 -0
  20. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/conver/__init__.py +0 -0
  21. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/conver/nkf_converter.py +0 -0
  22. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/generater/__init__.py +0 -0
  23. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/job/__init__.py +0 -0
  24. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/job/impl/__init__.py +0 -0
  25. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/job/impl/base_job.py +0 -0
  26. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/logging/__init__.py +0 -0
  27. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/logging/logger.py +0 -0
  28. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/processor/__init__.py +0 -0
  29. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/processor/code_processor.py +0 -0
  30. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/processor/code_processor_pipeline.py +0 -0
  31. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/splitters/__init__.py +0 -0
  32. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/splitters/cobolsplitter.py +0 -0
  33. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/unit/__init__.py +0 -0
  34. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/unit/impl/__init__.py +0 -0
  35. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/unit/impl/base_unit.py +0 -0
  36. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/unit/unit_interface.py +0 -0
  37. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/util/__init__.py +0 -0
  38. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot/util/files.py +0 -0
  39. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot.linkstec.egg-info/dependency_links.txt +0 -0
  40. {pilot_linkstec-0.0.25 → pilot_linkstec-0.0.28}/src/pilot.linkstec.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pilot.linkstec
3
- Version: 0.0.25
3
+ Version: 0.0.28
4
4
  Summary: pilot of the ship, a tool for managing and deploying Python projects.
5
5
  Author-email: wanglr <wanglr1980@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pilot.linkstec"
3
- version = "0.0.25"
3
+ version = "0.0.28"
4
4
  authors = [
5
5
  { name="wanglr", email="wanglr1980@gmail.com" },
6
6
  ]
@@ -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' + nkf_args + [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
@@ -4,3 +4,4 @@ class JobInterface(ABC):
4
4
  @abstractmethod
5
5
  def run(self):
6
6
  pass
7
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pilot.linkstec
3
- Version: 0.0.25
3
+ Version: 0.0.28
4
4
  Summary: pilot of the ship, a tool for managing and deploying Python projects.
5
5
  Author-email: wanglr <wanglr1980@gmail.com>
6
6
  License-Expression: MIT
@@ -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
@@ -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