pilot.linkstec 0.0.92__py3-none-any.whl → 0.0.93__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.
- pilot/config/config_reader.py +43 -81
- {pilot_linkstec-0.0.92.dist-info → pilot_linkstec-0.0.93.dist-info}/METADATA +1 -1
- {pilot_linkstec-0.0.92.dist-info → pilot_linkstec-0.0.93.dist-info}/RECORD +6 -6
- {pilot_linkstec-0.0.92.dist-info → pilot_linkstec-0.0.93.dist-info}/WHEEL +0 -0
- {pilot_linkstec-0.0.92.dist-info → pilot_linkstec-0.0.93.dist-info}/licenses/LICENSE +0 -0
- {pilot_linkstec-0.0.92.dist-info → pilot_linkstec-0.0.93.dist-info}/top_level.txt +0 -0
pilot/config/config_reader.py
CHANGED
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
import configparser
|
|
2
|
-
import inspect
|
|
3
2
|
import os
|
|
3
|
+
import inspect
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import
|
|
6
|
-
|
|
5
|
+
from typing import List
|
|
7
6
|
|
|
8
7
|
@dataclass
|
|
9
8
|
class ConfigDTO:
|
|
10
|
-
project: str
|
|
11
|
-
log_level: str
|
|
12
|
-
threads: int
|
|
13
|
-
lm_studio_api_url: str
|
|
14
|
-
lm_studio_model_name: str
|
|
15
9
|
work_space: str
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
threads: int
|
|
11
|
+
project: str
|
|
18
12
|
steps: list[str]
|
|
19
|
-
|
|
13
|
+
skipsteps: list[str]
|
|
14
|
+
runsteps: list[str]
|
|
15
|
+
multisteps: list[str]
|
|
20
16
|
|
|
21
17
|
class ConfigReader:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
self.config.optionxform = str
|
|
42
|
-
with open(filepath, 'r', encoding='utf-8') as f:
|
|
43
|
-
content = f.read()
|
|
44
|
-
if not content.lstrip().startswith('['):
|
|
45
|
-
content = '[DEFAULT]\n' + content
|
|
46
|
-
self.config.read_string(content)
|
|
47
|
-
|
|
48
|
-
self._loaded = True
|
|
49
|
-
except Exception as e:
|
|
50
|
-
print(f"設定ファイル読み込みエラー: {e}")
|
|
51
|
-
raise
|
|
18
|
+
def __init__(self, filename = None):
|
|
19
|
+
filepath = None
|
|
20
|
+
if filename is None:
|
|
21
|
+
filepath = self.find_config_path()
|
|
22
|
+
|
|
23
|
+
if filename is not None:
|
|
24
|
+
cwd = os.getcwd()
|
|
25
|
+
filepath = os.path.join(cwd, 'config', filename)
|
|
26
|
+
if not os.path.exists(filepath):
|
|
27
|
+
raise FileNotFoundError(f"Configuration file not found: {filepath}")
|
|
28
|
+
|
|
29
|
+
self.config = configparser.ConfigParser()
|
|
30
|
+
self.config.optionxform = str
|
|
31
|
+
|
|
32
|
+
with open(filepath, 'r', encoding='utf-8') as f:
|
|
33
|
+
content = f.read()
|
|
34
|
+
if not content.lstrip().startswith('['):
|
|
35
|
+
content = '[DEFAULT]\n' + content
|
|
36
|
+
self.config.read_string(content)
|
|
52
37
|
|
|
53
38
|
@classmethod
|
|
54
39
|
def find_config_path(cls):
|
|
@@ -67,11 +52,10 @@ class ConfigReader:
|
|
|
67
52
|
|
|
68
53
|
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
|
69
54
|
fallback_path = os.path.join(base_dir, 'config', 'control.properties')
|
|
70
|
-
|
|
71
55
|
if os.path.exists(fallback_path):
|
|
72
56
|
return fallback_path
|
|
73
57
|
|
|
74
|
-
raise FileNotFoundError("control.properties
|
|
58
|
+
raise FileNotFoundError("control.properties not found in expected locations")
|
|
75
59
|
|
|
76
60
|
def get(self, section, option, fallback=None, cast_type=str):
|
|
77
61
|
try:
|
|
@@ -87,47 +71,25 @@ class ConfigReader:
|
|
|
87
71
|
return fallback
|
|
88
72
|
|
|
89
73
|
def get_dto(self) -> ConfigDTO:
|
|
90
|
-
|
|
91
|
-
log_level = self.get('DEFAULT', 'log_level', fallback='INFO')
|
|
92
|
-
threads = self.get('DEFAULT', 'threads', fallback=1, cast_type=int)
|
|
93
|
-
lm_studio_api_url = self.get('DEFAULT', 'lm_studio_api_url', fallback='.')
|
|
94
|
-
lm_studio_model_name = self.get('DEFAULT', 'lm_studio_model_name', fallback='.')
|
|
74
|
+
input_path = self.get('DEFAULT', 'input_path', fallback='.')
|
|
95
75
|
work_space = self.get('DEFAULT', 'work_space', fallback='.')
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
threads = int(self.get('DEFAULT', 'threads', fallback=1))
|
|
77
|
+
project = self.get('DEFAULT', 'project', fallback='')
|
|
98
78
|
steps_str = self.get('DEFAULT', 'steps', fallback='')
|
|
99
|
-
|
|
100
79
|
steps = [s.strip() for s in steps_str.split(',')] if steps_str else []
|
|
80
|
+
skipsteps_str = self.get('DEFAULT', 'skipsteps', fallback='')
|
|
81
|
+
skipsteps = [s.strip() for s in skipsteps_str.split(',')] if skipsteps_str else []
|
|
82
|
+
runsteps_str = self.get('DEFAULT', 'runsteps', fallback='')
|
|
83
|
+
runsteps = [s.strip() for s in runsteps_str.split(',')] if runsteps_str else []
|
|
84
|
+
multisteps_str = self.get('DEFAULT', 'multisteps', fallback='')
|
|
85
|
+
multisteps = [s.strip() for s in multisteps_str.split(',')] if multisteps_str else []
|
|
101
86
|
|
|
102
87
|
return ConfigDTO(
|
|
103
|
-
project=project,
|
|
104
|
-
log_level=log_level,
|
|
105
|
-
threads=threads,
|
|
106
|
-
lm_studio_api_url=lm_studio_api_url,
|
|
107
|
-
lm_studio_model_name=lm_studio_model_name,
|
|
108
88
|
work_space=work_space,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
steps=steps
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
_global_config: Optional[ConfigDTO] = None
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def init_config(filepath=None):
|
|
120
|
-
global _global_config
|
|
121
|
-
try:
|
|
122
|
-
config_reader = ConfigReader(filepath)
|
|
123
|
-
_global_config = config_reader.get_dto()
|
|
124
|
-
except Exception as e:
|
|
125
|
-
print(f"設定初期化エラー: {e}")
|
|
126
|
-
raise
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def get_config() -> ConfigDTO:
|
|
130
|
-
global _global_config
|
|
131
|
-
if _global_config is None:
|
|
132
|
-
raise RuntimeError("設定が初期化されていません。init_config() を最初に呼び出してください。")
|
|
133
|
-
return _global_config
|
|
89
|
+
threads=threads,
|
|
90
|
+
project=project,
|
|
91
|
+
steps=steps,
|
|
92
|
+
skipsteps=skipsteps,
|
|
93
|
+
runsteps=runsteps,
|
|
94
|
+
multisteps=multisteps
|
|
95
|
+
)
|
|
@@ -12,7 +12,7 @@ pilot/base/split_file_base.py,sha256=CuPI9XHlSTTkLRNXW6SNEKkdSZBOMuy685e2TcnWPkY
|
|
|
12
12
|
pilot/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
pilot/client/ai_client.py,sha256=0n_YbjEb_QbgDAnUt_d1fJ4xYVzZmMxfJBNE5Yff9io,2919
|
|
14
14
|
pilot/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
pilot/config/config_reader.py,sha256=
|
|
15
|
+
pilot/config/config_reader.py,sha256=MchG-9j-Xfy8AquL_6tlvqQR65MFJ3c3hwWBl6IF2jw,3750
|
|
16
16
|
pilot/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
pilot/control/control_interface.py,sha256=zGv380oQgAKPAIHDHeFdPYzhj2Ngo2T66NWlNloA7vY,124
|
|
18
18
|
pilot/control/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -71,8 +71,8 @@ pilot/unit/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
71
71
|
pilot/unit/impl/base_unit.py,sha256=pF3R1TxoJtDIt5MCggSPO1H5jFI-wO1gQosz4haYTQo,1308
|
|
72
72
|
pilot/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
73
|
pilot/util/files.py,sha256=v9uzfzo3Aq4xgnUIASEZeBJoA2nD9Qz_EA3P-FwzGFQ,1896
|
|
74
|
-
pilot_linkstec-0.0.
|
|
75
|
-
pilot_linkstec-0.0.
|
|
76
|
-
pilot_linkstec-0.0.
|
|
77
|
-
pilot_linkstec-0.0.
|
|
78
|
-
pilot_linkstec-0.0.
|
|
74
|
+
pilot_linkstec-0.0.93.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
75
|
+
pilot_linkstec-0.0.93.dist-info/METADATA,sha256=Ty1Ol3qT93jIibsagJ-5yMMuSam8mY0J_65wxJWR9Mk,679
|
|
76
|
+
pilot_linkstec-0.0.93.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
77
|
+
pilot_linkstec-0.0.93.dist-info/top_level.txt,sha256=BijnVJdXnIPxxx3s60M848seL4Z12gNUPod6KPJxK9c,6
|
|
78
|
+
pilot_linkstec-0.0.93.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|