pilot.linkstec 0.0.13__py3-none-any.whl → 0.0.15__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 pilot.linkstec might be problematic. Click here for more details.

@@ -24,7 +24,7 @@ class VertexAISingleton:
24
24
  with self._lock:
25
25
  if not self._initialized:
26
26
  self.model = GenerativeModel(model_name)
27
-
27
+ self.encoding = tiktoken.get_encoding("cl100k_base")
28
28
  self._initialized = True
29
29
 
30
30
  def generate_content(self, prompt: str) -> Dict[str, Any]:
@@ -52,7 +52,6 @@ class VertexAISingleton:
52
52
  def count_tokens(self, text: str) -> int:
53
53
  """与えられたテキストのトークン数を返す(bert-base-uncasedのみ使用)"""
54
54
  try:
55
- self.encoding = tiktoken.get_encoding("cl100k_base")
56
55
  tokens = self.encoding.encode(text)
57
56
  return len(tokens)
58
57
  except Exception as e:
@@ -325,4 +325,20 @@ class BaseJob(JobInterface):
325
325
  open(end_file, 'w', encoding='utf-8').close()
326
326
  return end_file
327
327
 
328
- return None
328
+ return None
329
+
330
+ def pre_run(self):
331
+ """
332
+ ジョブ実行前の前処理を行うメソッド。
333
+ 必要に応じてサブクラスでオーバーライドして使用する。
334
+ """
335
+ pass
336
+
337
+ def post_run(self):
338
+ """
339
+ ジョブ実行後の後処理を行うメソッド。
340
+ 必要に応じてサブクラスでオーバーライドして使用する。
341
+ """
342
+ pass
343
+
344
+
File without changes
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pilot.linkstec
3
- Version: 0.0.13
3
+ Version: 0.0.15
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
@@ -9,11 +9,13 @@ pilot/conver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  pilot/conver/converfileEncodding.py,sha256=UqjcWO0bzkuTRHLEWrWJkeo3p-P7WuYE7jFKveyPekA,2781
10
10
  pilot/conver/nkf_converter.py,sha256=JqgThmXcdnTGMsLIHUEwe8sc0VGMqDaKCIQTg-UE3WE,1148
11
11
  pilot/generater/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- pilot/generater/vertexai.py,sha256=_MLmDuiVdEsAbKCTEM6KPbALnTXNTcIht2QMm-p9Kjs,2585
12
+ pilot/generater/vertexai.py,sha256=v-hEvPwsUtrxP57yu9f5pUBj7BGImegO4lv10QWM1XA,2591
13
13
  pilot/job/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  pilot/job/job_interface.py,sha256=LL0hfuFfnKnkpQD99jv1hkaAIAFM-JJPrX3PFxN6O_A,120
15
15
  pilot/job/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- pilot/job/impl/base_job.py,sha256=c8ANXdJZDuO0KEorPhO41uwr0tMTaY1jis0e_Ep3jtg,13572
16
+ pilot/job/impl/base_job.py,sha256=rxh2WgKBf3yJ_x0aPFMGpP8aKjPiGbD4767OqseuZWg,14015
17
+ pilot/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ pilot/logging/logger.py,sha256=TF7eGr3w8GK5v4sf71lDt97uVoBtCgqrZuCdbMmeQBU,1815
17
19
  pilot/splitters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
20
  pilot/splitters/cobolsplitter.py,sha256=oPwxKRjA7TyXWaWV3jdy59lJZy1mRn6yxD9ivqFYCuY,5461
19
21
  pilot/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -22,8 +24,8 @@ pilot/unit/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
24
  pilot/unit/impl/base_unit.py,sha256=LsFPpL28aSNv5rsZhfKv6CWhAw1XR4n-A6FOn2RBrZo,1272
23
25
  pilot/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
26
  pilot/util/files.py,sha256=v9uzfzo3Aq4xgnUIASEZeBJoA2nD9Qz_EA3P-FwzGFQ,1896
25
- pilot_linkstec-0.0.13.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
26
- pilot_linkstec-0.0.13.dist-info/METADATA,sha256=qh87JuOVrhmDgpaPgiTFTT63nVI5MGcXZJtxYMAilOg,679
27
- pilot_linkstec-0.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- pilot_linkstec-0.0.13.dist-info/top_level.txt,sha256=BijnVJdXnIPxxx3s60M848seL4Z12gNUPod6KPJxK9c,6
29
- pilot_linkstec-0.0.13.dist-info/RECORD,,
27
+ pilot_linkstec-0.0.15.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
28
+ pilot_linkstec-0.0.15.dist-info/METADATA,sha256=cnelVXeTfz-4eAEBKxVqV0l9tBz2ndYw6vlPMKbZyBo,679
29
+ pilot_linkstec-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ pilot_linkstec-0.0.15.dist-info/top_level.txt,sha256=BijnVJdXnIPxxx3s60M848seL4Z12gNUPod6KPJxK9c,6
31
+ pilot_linkstec-0.0.15.dist-info/RECORD,,