testgres.postgres-configuration 0.2.3__py3-none-any.whl → 0.4.0__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.
- testgres/postgres_configuration/abstract/v00/configuration.py +5 -5
- testgres/postgres_configuration/core/bugcheck_error.py +69 -22
- testgres/postgres_configuration/core/controller_utils.py +13 -1
- testgres/postgres_configuration/core/data_verificator.py +1 -0
- testgres/postgres_configuration/core/handlers.py +2 -2
- testgres/postgres_configuration/core/helpers.py +11 -10
- testgres/postgres_configuration/core/model.py +27 -7
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +1 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +1 -0
- testgres/postgres_configuration/core/write_utils.py +4 -0
- testgres/postgres_configuration/implementation/v00/configuration_base.py +218 -174
- testgres/postgres_configuration/implementation/v00/configuration_std.py +27 -12
- testgres/postgres_configuration/os/abstract/configuration_os_ops.py +10 -4
- testgres/postgres_configuration/os/local/configuration_os_ops.py +10 -8
- {testgres_postgres_configuration-0.2.3.dist-info → testgres_postgres_configuration-0.4.0.dist-info}/METADATA +1 -1
- {testgres_postgres_configuration-0.2.3.dist-info → testgres_postgres_configuration-0.4.0.dist-info}/RECORD +19 -19
- {testgres_postgres_configuration-0.2.3.dist-info → testgres_postgres_configuration-0.4.0.dist-info}/WHEEL +1 -1
- {testgres_postgres_configuration-0.2.3.dist-info → testgres_postgres_configuration-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {testgres_postgres_configuration-0.2.3.dist-info → testgres_postgres_configuration-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -21,7 +21,7 @@ class PostgresConfigurationObject:
|
|
|
21
21
|
RaiseError.MethodIsNotImplemented(__class__, "get_Configuration")
|
|
22
22
|
|
|
23
23
|
# --------------------------------------------------------------------
|
|
24
|
-
def get_Parent(self) -> PostgresConfigurationObject:
|
|
24
|
+
def get_Parent(self) -> typing.Optional[PostgresConfigurationObject]:
|
|
25
25
|
RaiseError.MethodIsNotImplemented(__class__, "get_Parent")
|
|
26
26
|
|
|
27
27
|
|
|
@@ -49,7 +49,7 @@ class PostgresConfigurationSetOptionValueResult:
|
|
|
49
49
|
|
|
50
50
|
# interface -----------------------------------------------------------
|
|
51
51
|
@property
|
|
52
|
-
def Option(self) -> PostgresConfigurationOption:
|
|
52
|
+
def Option(self) -> typing.Optional[PostgresConfigurationOption]:
|
|
53
53
|
RaiseError.GetPropertyIsNotImplemented(__class__, "Option")
|
|
54
54
|
|
|
55
55
|
# ---------------------------------------------------------------------
|
|
@@ -80,7 +80,7 @@ class PostgresConfigurationComment(PostgresConfigurationElement):
|
|
|
80
80
|
RaiseError.MethodIsNotImplemented(__class__, "get_Text")
|
|
81
81
|
|
|
82
82
|
# --------------------------------------------------------------------
|
|
83
|
-
def Delete(self, withLineIfLast: bool):
|
|
83
|
+
def Delete(self, withLineIfLast: bool) -> None:
|
|
84
84
|
assert type(withLineIfLast) is bool
|
|
85
85
|
RaiseError.MethodIsNotImplemented(__class__, "Delete")
|
|
86
86
|
|
|
@@ -144,7 +144,7 @@ class PostgresConfigurationOptions(typing.Iterable[PostgresConfigurationOption])
|
|
|
144
144
|
RaiseError.MethodIsNotImplemented(__class__, "__len__")
|
|
145
145
|
|
|
146
146
|
# --------------------------------------------------------------------
|
|
147
|
-
def __iter__(self) ->
|
|
147
|
+
def __iter__(self) -> PostgresConfigurationOptionsIterator:
|
|
148
148
|
RaiseError.MethodIsNotImplemented(__class__, "__iter__")
|
|
149
149
|
|
|
150
150
|
|
|
@@ -161,7 +161,7 @@ class PostgresConfigurationInclude(PostgresConfigurationElement):
|
|
|
161
161
|
RaiseError.MethodIsNotImplemented(__class__, "get_File")
|
|
162
162
|
|
|
163
163
|
# --------------------------------------------------------------------
|
|
164
|
-
def Delete(self, withLine: bool):
|
|
164
|
+
def Delete(self, withLine: bool) -> None:
|
|
165
165
|
assert type(withLine) is bool
|
|
166
166
|
RaiseError.MethodIsNotImplemented(__class__, "Delete")
|
|
167
167
|
|
|
@@ -9,7 +9,9 @@ import typing
|
|
|
9
9
|
|
|
10
10
|
class BugCheckError:
|
|
11
11
|
@staticmethod
|
|
12
|
-
def UnkObjectDataType(
|
|
12
|
+
def UnkObjectDataType(
|
|
13
|
+
objectType: type,
|
|
14
|
+
) -> typing.NoReturn:
|
|
13
15
|
assert objectType is not None
|
|
14
16
|
assert type(objectType) is type
|
|
15
17
|
|
|
@@ -18,7 +20,10 @@ class BugCheckError:
|
|
|
18
20
|
|
|
19
21
|
# --------------------------------------------------------------------
|
|
20
22
|
@staticmethod
|
|
21
|
-
def MultipleDefOfOptionIsFound(
|
|
23
|
+
def MultipleDefOfOptionIsFound(
|
|
24
|
+
optName: str,
|
|
25
|
+
count: int,
|
|
26
|
+
) -> typing.NoReturn:
|
|
22
27
|
assert type(optName) is str
|
|
23
28
|
assert type(count) is int
|
|
24
29
|
|
|
@@ -31,7 +36,10 @@ class BugCheckError:
|
|
|
31
36
|
|
|
32
37
|
# --------------------------------------------------------------------
|
|
33
38
|
@staticmethod
|
|
34
|
-
def UnkOptObjectDataType(
|
|
39
|
+
def UnkOptObjectDataType(
|
|
40
|
+
optName: str,
|
|
41
|
+
optDataType: type,
|
|
42
|
+
) -> typing.NoReturn:
|
|
35
43
|
assert type(optName) is str
|
|
36
44
|
assert type(optDataType) is type
|
|
37
45
|
|
|
@@ -44,7 +52,10 @@ class BugCheckError:
|
|
|
44
52
|
|
|
45
53
|
# --------------------------------------------------------------------
|
|
46
54
|
@staticmethod
|
|
47
|
-
def MultipleDefOfFileIsFound(
|
|
55
|
+
def MultipleDefOfFileIsFound(
|
|
56
|
+
fileName: str,
|
|
57
|
+
count: int,
|
|
58
|
+
) -> typing.NoReturn:
|
|
48
59
|
assert type(fileName) is str
|
|
49
60
|
assert type(count) is int
|
|
50
61
|
|
|
@@ -57,7 +68,10 @@ class BugCheckError:
|
|
|
57
68
|
|
|
58
69
|
# --------------------------------------------------------------------
|
|
59
70
|
@staticmethod
|
|
60
|
-
def UnkFileObjectDataType(
|
|
71
|
+
def UnkFileObjectDataType(
|
|
72
|
+
fileName: str,
|
|
73
|
+
fileDataType: type,
|
|
74
|
+
) -> typing.NoReturn:
|
|
61
75
|
assert type(fileName) is str
|
|
62
76
|
assert type(fileDataType) is type
|
|
63
77
|
|
|
@@ -68,7 +82,10 @@ class BugCheckError:
|
|
|
68
82
|
|
|
69
83
|
# --------------------------------------------------------------------
|
|
70
84
|
@staticmethod
|
|
71
|
-
def UnkFileDataStatus(
|
|
85
|
+
def UnkFileDataStatus(
|
|
86
|
+
filePath: str,
|
|
87
|
+
fileStatus: typing.Any,
|
|
88
|
+
) -> typing.NoReturn:
|
|
72
89
|
assert type(filePath) is str
|
|
73
90
|
assert fileStatus is not None
|
|
74
91
|
|
|
@@ -79,7 +96,10 @@ class BugCheckError:
|
|
|
79
96
|
|
|
80
97
|
# --------------------------------------------------------------------
|
|
81
98
|
@staticmethod
|
|
82
|
-
def FileIsNotFoundInIndex(
|
|
99
|
+
def FileIsNotFoundInIndex(
|
|
100
|
+
fileKey: str,
|
|
101
|
+
filePath: str,
|
|
102
|
+
) -> typing.NoReturn:
|
|
83
103
|
assert type(fileKey) is str
|
|
84
104
|
assert type(filePath) is str
|
|
85
105
|
|
|
@@ -90,7 +110,9 @@ class BugCheckError:
|
|
|
90
110
|
|
|
91
111
|
# --------------------------------------------------------------------
|
|
92
112
|
@staticmethod
|
|
93
|
-
def OptionIsNotFoundInIndex(
|
|
113
|
+
def OptionIsNotFoundInIndex(
|
|
114
|
+
optName: str,
|
|
115
|
+
) -> typing.NoReturn:
|
|
94
116
|
assert type(optName) is str
|
|
95
117
|
|
|
96
118
|
errMsg = "[BUG CHECK] Option [{0}] is not found in index.".format(optName)
|
|
@@ -98,7 +120,9 @@ class BugCheckError:
|
|
|
98
120
|
|
|
99
121
|
# --------------------------------------------------------------------
|
|
100
122
|
@staticmethod
|
|
101
|
-
def OptionIsNotFoundInFileLine(
|
|
123
|
+
def OptionIsNotFoundInFileLine(
|
|
124
|
+
optName: str,
|
|
125
|
+
) -> typing.NoReturn:
|
|
102
126
|
assert type(optName) is str
|
|
103
127
|
|
|
104
128
|
errMsg = "[BUG CHECK] Option [{0}] is not found in file line.".format(optName)
|
|
@@ -106,25 +130,27 @@ class BugCheckError:
|
|
|
106
130
|
|
|
107
131
|
# --------------------------------------------------------------------
|
|
108
132
|
@staticmethod
|
|
109
|
-
def CommentIsNotFoundInFileLine():
|
|
133
|
+
def CommentIsNotFoundInFileLine() -> typing.NoReturn:
|
|
110
134
|
errMsg = "[BUG CHECK] Comment is not found in file line."
|
|
111
135
|
raise Exception(errMsg)
|
|
112
136
|
|
|
113
137
|
# --------------------------------------------------------------------
|
|
114
138
|
@staticmethod
|
|
115
|
-
def IncludeIsNotFoundInFileLine():
|
|
139
|
+
def IncludeIsNotFoundInFileLine() -> typing.NoReturn:
|
|
116
140
|
errMsg = "[BUG CHECK] Include is not found in file line."
|
|
117
141
|
raise Exception(errMsg)
|
|
118
142
|
|
|
119
143
|
# --------------------------------------------------------------------
|
|
120
144
|
@staticmethod
|
|
121
|
-
def FileLineIsNotFoundInFile():
|
|
145
|
+
def FileLineIsNotFoundInFile() -> typing.NoReturn:
|
|
122
146
|
errMsg = "[BUG CHECK] FileLine is not found in file."
|
|
123
147
|
raise Exception(errMsg)
|
|
124
148
|
|
|
125
149
|
# --------------------------------------------------------------------
|
|
126
150
|
@staticmethod
|
|
127
|
-
def OptionHandlerToPrepareSetValueIsNotDefined(
|
|
151
|
+
def OptionHandlerToPrepareSetValueIsNotDefined(
|
|
152
|
+
name: str,
|
|
153
|
+
) -> typing.NoReturn:
|
|
128
154
|
assert type(name) is str
|
|
129
155
|
|
|
130
156
|
errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValue for [{0}] is not defined.".format(
|
|
@@ -134,7 +160,9 @@ class BugCheckError:
|
|
|
134
160
|
|
|
135
161
|
# --------------------------------------------------------------------
|
|
136
162
|
@staticmethod
|
|
137
|
-
def OptionHandlerToPrepareGetValueIsNotDefined(
|
|
163
|
+
def OptionHandlerToPrepareGetValueIsNotDefined(
|
|
164
|
+
name: str,
|
|
165
|
+
) -> typing.NoReturn:
|
|
138
166
|
assert type(name) is str
|
|
139
167
|
|
|
140
168
|
errMsg = "[BUG CHECK] OptionHandlerToPrepareGetValue for [{0}] is not defined.".format(
|
|
@@ -144,7 +172,9 @@ class BugCheckError:
|
|
|
144
172
|
|
|
145
173
|
# --------------------------------------------------------------------
|
|
146
174
|
@staticmethod
|
|
147
|
-
def OptionHandlerToPrepareSetValueItemIsNotDefined(
|
|
175
|
+
def OptionHandlerToPrepareSetValueItemIsNotDefined(
|
|
176
|
+
name: str,
|
|
177
|
+
) -> typing.NoReturn:
|
|
148
178
|
assert type(name) is str
|
|
149
179
|
|
|
150
180
|
errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValueItem for [{0}] is not defined.".format(
|
|
@@ -154,7 +184,9 @@ class BugCheckError:
|
|
|
154
184
|
|
|
155
185
|
# --------------------------------------------------------------------
|
|
156
186
|
@staticmethod
|
|
157
|
-
def OptionHandlerToSetValueIsNotDefined(
|
|
187
|
+
def OptionHandlerToSetValueIsNotDefined(
|
|
188
|
+
name: str,
|
|
189
|
+
) -> typing.NoReturn:
|
|
158
190
|
assert type(name) is str
|
|
159
191
|
|
|
160
192
|
errMsg = "[BUG CHECK] OptionHandlerToSetValue for [{0}] is not defined.".format(
|
|
@@ -164,7 +196,9 @@ class BugCheckError:
|
|
|
164
196
|
|
|
165
197
|
# --------------------------------------------------------------------
|
|
166
198
|
@staticmethod
|
|
167
|
-
def OptionHandlerToGetValueIsNotDefined(
|
|
199
|
+
def OptionHandlerToGetValueIsNotDefined(
|
|
200
|
+
name: str,
|
|
201
|
+
) -> typing.NoReturn:
|
|
168
202
|
assert type(name) is str
|
|
169
203
|
|
|
170
204
|
errMsg = "[BUG CHECK] OptionHandlerToGetValue for [{0}] is not defined.".format(
|
|
@@ -174,7 +208,9 @@ class BugCheckError:
|
|
|
174
208
|
|
|
175
209
|
# --------------------------------------------------------------------
|
|
176
210
|
@staticmethod
|
|
177
|
-
def OptionHandlerToAddOptionIsNotDefined(
|
|
211
|
+
def OptionHandlerToAddOptionIsNotDefined(
|
|
212
|
+
name: str,
|
|
213
|
+
) -> typing.NoReturn:
|
|
178
214
|
assert type(name) is str
|
|
179
215
|
|
|
180
216
|
errMsg = (
|
|
@@ -186,7 +222,9 @@ class BugCheckError:
|
|
|
186
222
|
|
|
187
223
|
# --------------------------------------------------------------------
|
|
188
224
|
@staticmethod
|
|
189
|
-
def OptionHandlerToSetValueItemIsNotDefined(
|
|
225
|
+
def OptionHandlerToSetValueItemIsNotDefined(
|
|
226
|
+
name: str,
|
|
227
|
+
) -> typing.NoReturn:
|
|
190
228
|
assert type(name) is str
|
|
191
229
|
|
|
192
230
|
errMsg = (
|
|
@@ -198,7 +236,9 @@ class BugCheckError:
|
|
|
198
236
|
|
|
199
237
|
# --------------------------------------------------------------------
|
|
200
238
|
@staticmethod
|
|
201
|
-
def OptionHandlerToWriteIsNotDefined(
|
|
239
|
+
def OptionHandlerToWriteIsNotDefined(
|
|
240
|
+
name: str,
|
|
241
|
+
) -> typing.NoReturn:
|
|
202
242
|
assert type(name) is str
|
|
203
243
|
|
|
204
244
|
errMsg = "[BUG CHECK] OptionHandlerToWrite for [{0}] is not defined.".format(
|
|
@@ -208,7 +248,11 @@ class BugCheckError:
|
|
|
208
248
|
|
|
209
249
|
# --------------------------------------------------------------------
|
|
210
250
|
@staticmethod
|
|
211
|
-
def UnexpectedSituation(
|
|
251
|
+
def UnexpectedSituation(
|
|
252
|
+
bugcheckSrc: str,
|
|
253
|
+
bugcheckPoint: str,
|
|
254
|
+
explain: str,
|
|
255
|
+
) -> typing.NoReturn:
|
|
212
256
|
assert type(bugcheckSrc) is str
|
|
213
257
|
assert type(bugcheckPoint) is str
|
|
214
258
|
assert explain is None or type(explain) is str
|
|
@@ -227,7 +271,10 @@ class BugCheckError:
|
|
|
227
271
|
|
|
228
272
|
# --------------------------------------------------------------------
|
|
229
273
|
@staticmethod
|
|
230
|
-
def UnknownOptionValueType(
|
|
274
|
+
def UnknownOptionValueType(
|
|
275
|
+
optionName: str,
|
|
276
|
+
typeOfOptionValue: type,
|
|
277
|
+
) -> typing.NoReturn:
|
|
231
278
|
assert type(optionName) is str
|
|
232
279
|
assert optionName != ""
|
|
233
280
|
assert type(typeOfOptionValue) is type
|
|
@@ -407,6 +407,8 @@ class DataControllerUtils:
|
|
|
407
407
|
if fileData.m_Path == newFilePath:
|
|
408
408
|
RaiseError.FileIsAlreadyRegistered(newFilePath)
|
|
409
409
|
|
|
410
|
+
continue
|
|
411
|
+
|
|
410
412
|
return __class__.Helper__FinishCreateTopLevelFile(cfgData, newFilePath)
|
|
411
413
|
|
|
412
414
|
# --------------------------------------------------------------------
|
|
@@ -436,6 +438,8 @@ class DataControllerUtils:
|
|
|
436
438
|
if fileData.m_Path == newFilePath:
|
|
437
439
|
return fileData
|
|
438
440
|
|
|
441
|
+
continue
|
|
442
|
+
|
|
439
443
|
newFileData = PgCfgModel__FileData(cfgData, newFilePath)
|
|
440
444
|
|
|
441
445
|
__class__.Helper__RegFileInCfgData(cfgData, newFileData) # raise
|
|
@@ -482,6 +486,8 @@ class DataControllerUtils:
|
|
|
482
486
|
if ptr is fileLineData:
|
|
483
487
|
return iFileLine
|
|
484
488
|
|
|
489
|
+
continue
|
|
490
|
+
|
|
485
491
|
assert iFileLine == cFileLines
|
|
486
492
|
return iFileLine
|
|
487
493
|
|
|
@@ -508,6 +514,8 @@ class DataControllerUtils:
|
|
|
508
514
|
if ptr.m_Element is elementData:
|
|
509
515
|
return iItem
|
|
510
516
|
|
|
517
|
+
continue
|
|
518
|
+
|
|
511
519
|
assert iItem == cItems
|
|
512
520
|
return iItem
|
|
513
521
|
|
|
@@ -631,6 +639,8 @@ class DataControllerUtils:
|
|
|
631
639
|
if ptr is fileData:
|
|
632
640
|
break
|
|
633
641
|
|
|
642
|
+
continue
|
|
643
|
+
|
|
634
644
|
assert i >= 0
|
|
635
645
|
assert i <= len(indexItemData)
|
|
636
646
|
|
|
@@ -645,7 +655,7 @@ class DataControllerUtils:
|
|
|
645
655
|
if len(indexItemData) == 0: # it is an abnormal situation
|
|
646
656
|
filesByStrKeyDictionary.pop(fileKey)
|
|
647
657
|
elif len(indexItemData) == 1:
|
|
648
|
-
filesByStrKeyDictionary[fileKey]
|
|
658
|
+
filesByStrKeyDictionary[fileKey] = indexItemData[0]
|
|
649
659
|
|
|
650
660
|
return
|
|
651
661
|
|
|
@@ -727,6 +737,8 @@ class DataControllerUtils:
|
|
|
727
737
|
if ptr is optionData:
|
|
728
738
|
break
|
|
729
739
|
|
|
740
|
+
continue
|
|
741
|
+
|
|
730
742
|
assert i >= 0
|
|
731
743
|
assert i <= len(data)
|
|
732
744
|
|
|
@@ -266,8 +266,8 @@ class OptionHandlerToAddOption(OptionHandler):
|
|
|
266
266
|
super().__init__()
|
|
267
267
|
|
|
268
268
|
# interface ----------------------------------------------------------
|
|
269
|
-
def AddOption(self, ctx:
|
|
270
|
-
assert type(ctx) is
|
|
269
|
+
def AddOption(self, ctx: OptionHandlerCtxToAddOption) -> typing.Any:
|
|
270
|
+
assert type(ctx) is OptionHandlerCtxToAddOption
|
|
271
271
|
RaiseError.MethodIsNotImplemented(__class__, "AddOption")
|
|
272
272
|
|
|
273
273
|
|
|
@@ -12,41 +12,40 @@ import typing
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Helpers:
|
|
15
|
+
@staticmethod
|
|
15
16
|
def ExtractOptionDataName(option: typing.Union[str, OptionData]) -> str:
|
|
16
17
|
assert type(option) is str or type(option) is OptionData
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if typeOption is str:
|
|
19
|
+
if type(option) is str:
|
|
21
20
|
return option
|
|
22
21
|
|
|
23
|
-
if
|
|
22
|
+
if type(option) is OptionData:
|
|
24
23
|
return option.m_Name
|
|
25
24
|
|
|
26
|
-
BugCheckError.UnkObjectDataType(
|
|
25
|
+
BugCheckError.UnkObjectDataType(type(option))
|
|
27
26
|
|
|
28
27
|
# --------------------------------------------------------------------
|
|
28
|
+
@staticmethod
|
|
29
29
|
def ExtractFirstOptionFromIndexItem(
|
|
30
30
|
optionName: str, indexItem: typing.Union[OptionData, typing.List[OptionData]]
|
|
31
31
|
) -> OptionData:
|
|
32
32
|
assert type(optionName) is str
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if typeOfIndexItem is OptionData:
|
|
34
|
+
if type(indexItem) is OptionData:
|
|
37
35
|
assert indexItem.m_Name == optionName
|
|
38
36
|
return indexItem
|
|
39
37
|
|
|
40
|
-
if
|
|
38
|
+
if type(indexItem) is list:
|
|
41
39
|
assert len(indexItem) > 1
|
|
42
40
|
assert indexItem[0] is not None
|
|
43
41
|
assert type(indexItem[0]) is OptionData
|
|
44
42
|
assert indexItem[0].m_Name == optionName
|
|
45
43
|
return indexItem[0]
|
|
46
44
|
|
|
47
|
-
BugCheckError.UnkOptObjectDataType(optionName,
|
|
45
|
+
BugCheckError.UnkOptObjectDataType(optionName, type(indexItem))
|
|
48
46
|
|
|
49
47
|
# --------------------------------------------------------------------
|
|
48
|
+
@staticmethod
|
|
50
49
|
def DoesContainerContainsValue__NotNullAndExact(
|
|
51
50
|
container: typing.Iterable, value: typing.Any
|
|
52
51
|
) -> bool:
|
|
@@ -60,10 +59,12 @@ class Helpers:
|
|
|
60
59
|
|
|
61
60
|
if x == value:
|
|
62
61
|
return True
|
|
62
|
+
continue
|
|
63
63
|
|
|
64
64
|
return False
|
|
65
65
|
|
|
66
66
|
# --------------------------------------------------------------------
|
|
67
|
+
@staticmethod
|
|
67
68
|
def NormalizeFilePath(
|
|
68
69
|
cfgOsOps: ConfigurationOsOps, baseFolder: str, filePath: str
|
|
69
70
|
) -> str:
|
|
@@ -195,8 +195,8 @@ class FileLineData(ObjectData):
|
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
class FileStatus(enum.Enum):
|
|
198
|
-
IS_NEW
|
|
199
|
-
EXISTS
|
|
198
|
+
IS_NEW = 0
|
|
199
|
+
EXISTS = 1
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -204,6 +204,8 @@ class FileStatus(enum.Enum):
|
|
|
204
204
|
|
|
205
205
|
|
|
206
206
|
class FileData(ObjectData):
|
|
207
|
+
T_OPTIONS_BY_NAME = typing.Dict[str, OptionData]
|
|
208
|
+
|
|
207
209
|
m_Parent: ConfigurationData
|
|
208
210
|
|
|
209
211
|
m_Status: FileStatus
|
|
@@ -212,7 +214,7 @@ class FileData(ObjectData):
|
|
|
212
214
|
m_Path: str
|
|
213
215
|
m_Lines: typing.List[FileLineData]
|
|
214
216
|
|
|
215
|
-
m_OptionsByName:
|
|
217
|
+
m_OptionsByName: T_OPTIONS_BY_NAME
|
|
216
218
|
|
|
217
219
|
# --------------------------------------------------------------------
|
|
218
220
|
def __init__(self, parent: ConfigurationData, path: str):
|
|
@@ -256,15 +258,33 @@ class FileData(ObjectData):
|
|
|
256
258
|
|
|
257
259
|
|
|
258
260
|
class ConfigurationData(ObjectData):
|
|
261
|
+
T_OPTION_OR_OPTIONS = typing.Union[
|
|
262
|
+
OptionData,
|
|
263
|
+
typing.List[OptionData],
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
T_ALL_OPTIONS_BY_NAME = typing.Dict[
|
|
267
|
+
str,
|
|
268
|
+
T_OPTION_OR_OPTIONS,
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
T_FILE_OR_FILES = typing.Union[
|
|
272
|
+
FileData,
|
|
273
|
+
typing.List[FileData],
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
T_ALL_FILES_BY_NAME = typing.Dict[
|
|
277
|
+
str,
|
|
278
|
+
T_FILE_OR_FILES,
|
|
279
|
+
]
|
|
280
|
+
|
|
259
281
|
m_DataDir: str
|
|
260
282
|
m_OsOps: ConfigurationOsOps
|
|
261
283
|
|
|
262
284
|
m_Files: typing.List[FileData]
|
|
263
285
|
|
|
264
|
-
m_AllOptionsByName:
|
|
265
|
-
|
|
266
|
-
]
|
|
267
|
-
m_AllFilesByName: typing.Dict[str, typing.Union[FileData, typing.List[FileData]]]
|
|
286
|
+
m_AllOptionsByName: T_ALL_OPTIONS_BY_NAME
|
|
287
|
+
m_AllFilesByName: T_ALL_FILES_BY_NAME
|
|
268
288
|
|
|
269
289
|
# --------------------------------------------------------------------
|
|
270
290
|
def __init__(self, data_dir: str, osOps: ConfigurationOsOps):
|
|
@@ -33,6 +33,7 @@ class WriteUtils:
|
|
|
33
33
|
result += sep
|
|
34
34
|
result += __class__.Helper__PackStrListItem2(str(x))
|
|
35
35
|
sep = ","
|
|
36
|
+
continue
|
|
36
37
|
|
|
37
38
|
return result
|
|
38
39
|
|
|
@@ -63,6 +64,7 @@ class WriteUtils:
|
|
|
63
64
|
result += "\\\\"
|
|
64
65
|
else:
|
|
65
66
|
result += ch
|
|
67
|
+
continue
|
|
66
68
|
|
|
67
69
|
result += "'"
|
|
68
70
|
|
|
@@ -87,6 +89,7 @@ class WriteUtils:
|
|
|
87
89
|
result += '""'
|
|
88
90
|
else:
|
|
89
91
|
result += ch
|
|
92
|
+
continue
|
|
90
93
|
|
|
91
94
|
if needQuote:
|
|
92
95
|
result += '"'
|
|
@@ -111,6 +114,7 @@ class WriteUtils:
|
|
|
111
114
|
return True
|
|
112
115
|
if ch == ",":
|
|
113
116
|
return True
|
|
117
|
+
continue
|
|
114
118
|
|
|
115
119
|
|
|
116
120
|
# //////////////////////////////////////////////////////////////////////////////
|