testgres.postgres-configuration 0.4.0__py3-none-any.whl → 0.5.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 +69 -18
- testgres/postgres_configuration/core/bugcheck_error.py +104 -74
- testgres/postgres_configuration/core/data_verificator.py +7 -3
- testgres/postgres_configuration/core/handlers.py +139 -41
- testgres/postgres_configuration/core/helpers.py +10 -4
- testgres/postgres_configuration/core/model.py +38 -38
- testgres/postgres_configuration/core/model_s_multi_index.py +204 -0
- testgres/postgres_configuration/core/{controller_utils.py → model_utils.py} +468 -257
- testgres/postgres_configuration/core/option/handlers/add/option_handler_to_add__std.py +9 -2
- testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py +7 -2
- testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py +7 -2
- testgres/postgres_configuration/core/option/handlers/instances.py +249 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py +5 -1
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py +11 -7
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py +5 -1
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py +5 -1
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +6 -2
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py +23 -8
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py +12 -7
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py +17 -7
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py +11 -5
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +13 -3
- testgres/postgres_configuration/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py +8 -2
- testgres/postgres_configuration/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py +8 -2
- testgres/postgres_configuration/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py +8 -2
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__bool.py +11 -5
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__generic.py +8 -6
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__int.py +5 -1
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__str.py +5 -1
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py +5 -1
- testgres/postgres_configuration/core/raise_error.py +290 -122
- testgres/postgres_configuration/core/read_utils.py +6 -3
- testgres/postgres_configuration/core/write_utils.py +2 -0
- testgres/postgres_configuration/exceptions.py +94 -0
- testgres/postgres_configuration/implementation/v00/configuration_base.py +745 -2721
- testgres/postgres_configuration/implementation/v00/configuration_base_ds_standard.py +1098 -0
- testgres/postgres_configuration/implementation/v00/configuration_base_ds_strict.py +1228 -0
- testgres/postgres_configuration/implementation/v00/configuration_base_r.py +694 -0
- testgres/postgres_configuration/implementation/v00/configuration_base_w.py +556 -0
- testgres/postgres_configuration/implementation/v00/configuration_std.py +135 -321
- testgres_postgres_configuration-0.5.0.dist-info/METADATA +137 -0
- testgres_postgres_configuration-0.5.0.dist-info/RECORD +48 -0
- {testgres_postgres_configuration-0.4.0.dist-info → testgres_postgres_configuration-0.5.0.dist-info}/WHEEL +1 -1
- testgres_postgres_configuration-0.4.0.dist-info/METADATA +0 -34
- testgres_postgres_configuration-0.4.0.dist-info/RECORD +0 -41
- {testgres_postgres_configuration-0.4.0.dist-info → testgres_postgres_configuration-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {testgres_postgres_configuration-0.4.0.dist-info → testgres_postgres_configuration-0.5.0.dist-info}/top_level.txt +0 -0
|
@@ -102,12 +102,16 @@ class PostgresConfigurationOption(PostgresConfigurationElement):
|
|
|
102
102
|
RaiseError.MethodIsNotImplemented(__class__, "get_Value")
|
|
103
103
|
|
|
104
104
|
# --------------------------------------------------------------------
|
|
105
|
-
def set_Value(
|
|
105
|
+
def set_Value(
|
|
106
|
+
self,
|
|
107
|
+
value: typing.Any,
|
|
108
|
+
) -> PostgresConfigurationSetOptionValueResult:
|
|
106
109
|
RaiseError.MethodIsNotImplemented(__class__, "set_Value")
|
|
107
110
|
|
|
108
111
|
# --------------------------------------------------------------------
|
|
109
112
|
def set_ValueItem(
|
|
110
|
-
self,
|
|
113
|
+
self,
|
|
114
|
+
value_item: typing.Any,
|
|
111
115
|
) -> PostgresConfigurationSetOptionValueResult:
|
|
112
116
|
assert value_item is not None
|
|
113
117
|
RaiseError.MethodIsNotImplemented(__class__, "set_ValueItem")
|
|
@@ -127,6 +131,7 @@ class PostgresConfigurationOptionsIterator(
|
|
|
127
131
|
def __iter__(self) -> PostgresConfigurationOptionsIterator:
|
|
128
132
|
RaiseError.MethodIsNotImplemented(__class__, "__iter__")
|
|
129
133
|
|
|
134
|
+
# --------------------------------------------------------------------
|
|
130
135
|
def __next__(self) -> PostgresConfigurationOption:
|
|
131
136
|
RaiseError.MethodIsNotImplemented(__class__, "__next__")
|
|
132
137
|
|
|
@@ -161,7 +166,10 @@ class PostgresConfigurationInclude(PostgresConfigurationElement):
|
|
|
161
166
|
RaiseError.MethodIsNotImplemented(__class__, "get_File")
|
|
162
167
|
|
|
163
168
|
# --------------------------------------------------------------------
|
|
164
|
-
def Delete(
|
|
169
|
+
def Delete(
|
|
170
|
+
self,
|
|
171
|
+
withLine: bool,
|
|
172
|
+
) -> None:
|
|
165
173
|
assert type(withLine) is bool
|
|
166
174
|
RaiseError.MethodIsNotImplemented(__class__, "Delete")
|
|
167
175
|
|
|
@@ -180,7 +188,9 @@ class PostgresConfigurationFileLine(PostgresConfigurationObject):
|
|
|
180
188
|
|
|
181
189
|
# --------------------------------------------------------------------
|
|
182
190
|
def AddComment(
|
|
183
|
-
self,
|
|
191
|
+
self,
|
|
192
|
+
text: str,
|
|
193
|
+
offset: typing.Optional[int],
|
|
184
194
|
) -> PostgresConfigurationComment:
|
|
185
195
|
assert type(text) is str
|
|
186
196
|
assert (offset is None) or (type(offset) is int)
|
|
@@ -188,7 +198,10 @@ class PostgresConfigurationFileLine(PostgresConfigurationObject):
|
|
|
188
198
|
|
|
189
199
|
# --------------------------------------------------------------------
|
|
190
200
|
def AddOption(
|
|
191
|
-
self,
|
|
201
|
+
self,
|
|
202
|
+
name: str,
|
|
203
|
+
value: typing.Any,
|
|
204
|
+
offset: typing.Optional[int],
|
|
192
205
|
) -> PostgresConfigurationOption:
|
|
193
206
|
assert type(name) is str
|
|
194
207
|
assert name != ""
|
|
@@ -198,7 +211,9 @@ class PostgresConfigurationFileLine(PostgresConfigurationObject):
|
|
|
198
211
|
|
|
199
212
|
# --------------------------------------------------------------------
|
|
200
213
|
def AddInclude(
|
|
201
|
-
self,
|
|
214
|
+
self,
|
|
215
|
+
path: str,
|
|
216
|
+
offset: typing.Optional[int],
|
|
202
217
|
) -> PostgresConfigurationInclude:
|
|
203
218
|
assert type(path) is str
|
|
204
219
|
assert path != ""
|
|
@@ -224,6 +239,7 @@ class PostgresConfigurationFileLinesIterator(
|
|
|
224
239
|
def __iter__(self) -> PostgresConfigurationFileLinesIterator:
|
|
225
240
|
RaiseError.MethodIsNotImplemented(__class__, "__iter__")
|
|
226
241
|
|
|
242
|
+
# --------------------------------------------------------------------
|
|
227
243
|
def __next__(self) -> PostgresConfigurationFileLine:
|
|
228
244
|
RaiseError.MethodIsNotImplemented(__class__, "__next__")
|
|
229
245
|
|
|
@@ -270,19 +286,29 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
|
|
|
270
286
|
RaiseError.MethodIsNotImplemented(__class__, "AddEmptyLine")
|
|
271
287
|
|
|
272
288
|
# --------------------------------------------------------------------
|
|
273
|
-
def AddComment(
|
|
289
|
+
def AddComment(
|
|
290
|
+
self,
|
|
291
|
+
text: str,
|
|
292
|
+
) -> PostgresConfigurationComment:
|
|
274
293
|
assert type(text) is str
|
|
275
294
|
RaiseError.MethodIsNotImplemented(__class__, "AddComment")
|
|
276
295
|
|
|
277
296
|
# --------------------------------------------------------------------
|
|
278
|
-
def AddOption(
|
|
297
|
+
def AddOption(
|
|
298
|
+
self,
|
|
299
|
+
name: str,
|
|
300
|
+
value: typing.Any,
|
|
301
|
+
) -> PostgresConfigurationOption:
|
|
279
302
|
assert type(name) is str
|
|
280
303
|
assert name != ""
|
|
281
304
|
assert value is not None
|
|
282
305
|
RaiseError.MethodIsNotImplemented(__class__, "AddOption")
|
|
283
306
|
|
|
284
307
|
# --------------------------------------------------------------------
|
|
285
|
-
def AddInclude(
|
|
308
|
+
def AddInclude(
|
|
309
|
+
self,
|
|
310
|
+
path: str,
|
|
311
|
+
) -> PostgresConfigurationInclude:
|
|
286
312
|
assert type(path) is str
|
|
287
313
|
assert path != ""
|
|
288
314
|
RaiseError.MethodIsNotImplemented(__class__, "AddInclude")
|
|
@@ -299,7 +325,9 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
|
|
|
299
325
|
# PostgresConfigurationSetOptionValueResult object.
|
|
300
326
|
#
|
|
301
327
|
def SetOptionValue(
|
|
302
|
-
self,
|
|
328
|
+
self,
|
|
329
|
+
name: str,
|
|
330
|
+
value: typing.Any,
|
|
303
331
|
) -> PostgresConfigurationSetOptionValueResult:
|
|
304
332
|
assert type(name) is str
|
|
305
333
|
assert name != ""
|
|
@@ -313,13 +341,18 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
|
|
|
313
341
|
# - Value of option.
|
|
314
342
|
# - None if option is not found in this file.
|
|
315
343
|
#
|
|
316
|
-
def GetOptionValue(
|
|
344
|
+
def GetOptionValue(
|
|
345
|
+
self,
|
|
346
|
+
name: str,
|
|
347
|
+
) -> typing.Any:
|
|
317
348
|
assert type(name) is str
|
|
318
349
|
RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
|
|
319
350
|
|
|
320
351
|
# --------------------------------------------------------------------
|
|
321
352
|
def SetOptionValueItem(
|
|
322
|
-
self,
|
|
353
|
+
self,
|
|
354
|
+
name: str,
|
|
355
|
+
value_item: typing.Any,
|
|
323
356
|
) -> PostgresConfigurationSetOptionValueResult:
|
|
324
357
|
assert type(name) is str
|
|
325
358
|
assert name != ""
|
|
@@ -339,6 +372,7 @@ class PostgresConfigurationFilesIterator(typing.Iterator[PostgresConfigurationFi
|
|
|
339
372
|
def __iter__(self) -> PostgresConfigurationFilesIterator:
|
|
340
373
|
RaiseError.MethodIsNotImplemented(__class__, "__iter__")
|
|
341
374
|
|
|
375
|
+
# --------------------------------------------------------------------
|
|
342
376
|
def __next__(self) -> PostgresConfigurationFile:
|
|
343
377
|
RaiseError.MethodIsNotImplemented(__class__, "__next__")
|
|
344
378
|
|
|
@@ -360,7 +394,10 @@ class PostgresConfigurationFiles(typing.Iterable[PostgresConfigurationFile]):
|
|
|
360
394
|
RaiseError.MethodIsNotImplemented(__class__, "__iter__")
|
|
361
395
|
|
|
362
396
|
# --------------------------------------------------------------------
|
|
363
|
-
def GetFileByName(
|
|
397
|
+
def GetFileByName(
|
|
398
|
+
self,
|
|
399
|
+
file_name: str,
|
|
400
|
+
) -> PostgresConfigurationFile:
|
|
364
401
|
assert file_name is not None
|
|
365
402
|
RaiseError.MethodIsNotImplemented(__class__, "GetFileByName")
|
|
366
403
|
|
|
@@ -374,13 +411,20 @@ class PostgresConfiguration(PostgresConfigurationObject):
|
|
|
374
411
|
pass
|
|
375
412
|
|
|
376
413
|
# interface ----------------------------------------------------------
|
|
377
|
-
def AddTopLevelFile(
|
|
414
|
+
def AddTopLevelFile(
|
|
415
|
+
self,
|
|
416
|
+
path: str,
|
|
417
|
+
) -> PostgresConfigurationFile:
|
|
378
418
|
assert type(path) is str
|
|
379
419
|
assert path != ""
|
|
380
420
|
RaiseError.MethodIsNotImplemented(__class__, "AddTopLevelFile")
|
|
381
421
|
|
|
382
422
|
# --------------------------------------------------------------------
|
|
383
|
-
def AddOption(
|
|
423
|
+
def AddOption(
|
|
424
|
+
self,
|
|
425
|
+
name: str,
|
|
426
|
+
value: typing.Any,
|
|
427
|
+
) -> PostgresConfigurationOption:
|
|
384
428
|
assert type(name) is str
|
|
385
429
|
assert name != ""
|
|
386
430
|
assert value is not None
|
|
@@ -398,7 +442,9 @@ class PostgresConfiguration(PostgresConfigurationObject):
|
|
|
398
442
|
# PostgresConfigurationSetOptionValueResult object.
|
|
399
443
|
#
|
|
400
444
|
def SetOptionValue(
|
|
401
|
-
self,
|
|
445
|
+
self,
|
|
446
|
+
name: str,
|
|
447
|
+
value: typing.Any,
|
|
402
448
|
) -> PostgresConfigurationSetOptionValueResult:
|
|
403
449
|
assert type(name) is str
|
|
404
450
|
RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue")
|
|
@@ -411,13 +457,18 @@ class PostgresConfiguration(PostgresConfigurationObject):
|
|
|
411
457
|
# - Value of option.
|
|
412
458
|
# - None if option is not found.
|
|
413
459
|
#
|
|
414
|
-
def GetOptionValue(
|
|
460
|
+
def GetOptionValue(
|
|
461
|
+
self,
|
|
462
|
+
name: str,
|
|
463
|
+
) -> typing.Any:
|
|
415
464
|
assert type(name) is str
|
|
416
465
|
RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
|
|
417
466
|
|
|
418
467
|
# --------------------------------------------------------------------
|
|
419
468
|
def SetOptionValueItem(
|
|
420
|
-
self,
|
|
469
|
+
self,
|
|
470
|
+
name: str,
|
|
471
|
+
value_item: typing.Any,
|
|
421
472
|
) -> PostgresConfigurationSetOptionValueResult:
|
|
422
473
|
assert type(name) is str
|
|
423
474
|
assert value_item is not None
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# //////////////////////////////////////////////////////////////////////////////
|
|
2
2
|
# Postgres Pro. PostgreSQL Configuration Python Library.
|
|
3
3
|
|
|
4
|
+
from ..exceptions import PostgresConfigBugCheckException
|
|
5
|
+
|
|
4
6
|
import typing
|
|
5
7
|
|
|
6
8
|
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -13,10 +15,12 @@ class BugCheckError:
|
|
|
13
15
|
objectType: type,
|
|
14
16
|
) -> typing.NoReturn:
|
|
15
17
|
assert objectType is not None
|
|
16
|
-
assert
|
|
18
|
+
assert isinstance(objectType, type)
|
|
17
19
|
|
|
18
|
-
errMsg = "
|
|
19
|
-
|
|
20
|
+
errMsg = "Unknown object data type [{0}].".format(
|
|
21
|
+
objectType,
|
|
22
|
+
)
|
|
23
|
+
__class__.Helper__Raise(errMsg)
|
|
20
24
|
|
|
21
25
|
# --------------------------------------------------------------------
|
|
22
26
|
@staticmethod
|
|
@@ -27,12 +31,11 @@ class BugCheckError:
|
|
|
27
31
|
assert type(optName) is str
|
|
28
32
|
assert type(count) is int
|
|
29
33
|
|
|
30
|
-
errMsg = (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
+
errMsg = "Multiple definitition of option [{0}] is found - {1}.".format(
|
|
35
|
+
optName,
|
|
36
|
+
count,
|
|
34
37
|
)
|
|
35
|
-
|
|
38
|
+
__class__.Helper__Raise(errMsg)
|
|
36
39
|
|
|
37
40
|
# --------------------------------------------------------------------
|
|
38
41
|
@staticmethod
|
|
@@ -41,14 +44,13 @@ class BugCheckError:
|
|
|
41
44
|
optDataType: type,
|
|
42
45
|
) -> typing.NoReturn:
|
|
43
46
|
assert type(optName) is str
|
|
44
|
-
assert
|
|
47
|
+
assert isinstance(optDataType, type)
|
|
45
48
|
|
|
46
|
-
errMsg = (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
49
|
+
errMsg = "Unknown type of the option object data [{0}] - {1}.".format(
|
|
50
|
+
optName,
|
|
51
|
+
optDataType.__name__,
|
|
50
52
|
)
|
|
51
|
-
|
|
53
|
+
__class__.Helper__Raise(errMsg)
|
|
52
54
|
|
|
53
55
|
# --------------------------------------------------------------------
|
|
54
56
|
@staticmethod
|
|
@@ -59,12 +61,11 @@ class BugCheckError:
|
|
|
59
61
|
assert type(fileName) is str
|
|
60
62
|
assert type(count) is int
|
|
61
63
|
|
|
62
|
-
errMsg = (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
64
|
+
errMsg = "Multiple definitition of file [{0}] is found - {1}.".format(
|
|
65
|
+
fileName,
|
|
66
|
+
count,
|
|
66
67
|
)
|
|
67
|
-
|
|
68
|
+
__class__.Helper__Raise(errMsg)
|
|
68
69
|
|
|
69
70
|
# --------------------------------------------------------------------
|
|
70
71
|
@staticmethod
|
|
@@ -73,12 +74,13 @@ class BugCheckError:
|
|
|
73
74
|
fileDataType: type,
|
|
74
75
|
) -> typing.NoReturn:
|
|
75
76
|
assert type(fileName) is str
|
|
76
|
-
assert
|
|
77
|
+
assert isinstance(fileDataType, type)
|
|
77
78
|
|
|
78
|
-
errMsg = "
|
|
79
|
-
fileName,
|
|
79
|
+
errMsg = "Unknown type of the file object data [{0}] - {1}.".format(
|
|
80
|
+
fileName,
|
|
81
|
+
fileDataType.__name__,
|
|
80
82
|
)
|
|
81
|
-
|
|
83
|
+
__class__.Helper__Raise(errMsg)
|
|
82
84
|
|
|
83
85
|
# --------------------------------------------------------------------
|
|
84
86
|
@staticmethod
|
|
@@ -89,10 +91,11 @@ class BugCheckError:
|
|
|
89
91
|
assert type(filePath) is str
|
|
90
92
|
assert fileStatus is not None
|
|
91
93
|
|
|
92
|
-
errMsg = "
|
|
93
|
-
filePath,
|
|
94
|
+
errMsg = "Unknown file data status [{0}] - {1}.".format(
|
|
95
|
+
filePath,
|
|
96
|
+
fileStatus,
|
|
94
97
|
)
|
|
95
|
-
|
|
98
|
+
__class__.Helper__Raise(errMsg)
|
|
96
99
|
|
|
97
100
|
# --------------------------------------------------------------------
|
|
98
101
|
@staticmethod
|
|
@@ -103,10 +106,20 @@ class BugCheckError:
|
|
|
103
106
|
assert type(fileKey) is str
|
|
104
107
|
assert type(filePath) is str
|
|
105
108
|
|
|
106
|
-
errMsg = "
|
|
107
|
-
fileKey,
|
|
109
|
+
errMsg = "File [{0}][{1}] is not found in index.".format(
|
|
110
|
+
fileKey,
|
|
111
|
+
filePath,
|
|
108
112
|
)
|
|
109
|
-
|
|
113
|
+
__class__.Helper__Raise(errMsg)
|
|
114
|
+
|
|
115
|
+
# --------------------------------------------------------------------
|
|
116
|
+
@staticmethod
|
|
117
|
+
def FileIsAlreadyRegistered(
|
|
118
|
+
file_path: str,
|
|
119
|
+
) -> typing.NoReturn:
|
|
120
|
+
errMsg = "File [{}] is already registered.".format(file_path)
|
|
121
|
+
|
|
122
|
+
__class__.Helper__Raise(errMsg)
|
|
110
123
|
|
|
111
124
|
# --------------------------------------------------------------------
|
|
112
125
|
@staticmethod
|
|
@@ -115,8 +128,8 @@ class BugCheckError:
|
|
|
115
128
|
) -> typing.NoReturn:
|
|
116
129
|
assert type(optName) is str
|
|
117
130
|
|
|
118
|
-
errMsg = "
|
|
119
|
-
|
|
131
|
+
errMsg = "Option [{0}] is not found in index.".format(optName)
|
|
132
|
+
__class__.Helper__Raise(errMsg)
|
|
120
133
|
|
|
121
134
|
# --------------------------------------------------------------------
|
|
122
135
|
@staticmethod
|
|
@@ -125,26 +138,26 @@ class BugCheckError:
|
|
|
125
138
|
) -> typing.NoReturn:
|
|
126
139
|
assert type(optName) is str
|
|
127
140
|
|
|
128
|
-
errMsg = "
|
|
129
|
-
|
|
141
|
+
errMsg = "Option [{0}] is not found in file line.".format(optName)
|
|
142
|
+
__class__.Helper__Raise(errMsg)
|
|
130
143
|
|
|
131
144
|
# --------------------------------------------------------------------
|
|
132
145
|
@staticmethod
|
|
133
146
|
def CommentIsNotFoundInFileLine() -> typing.NoReturn:
|
|
134
|
-
errMsg = "
|
|
135
|
-
|
|
147
|
+
errMsg = "Comment is not found in file line."
|
|
148
|
+
__class__.Helper__Raise(errMsg)
|
|
136
149
|
|
|
137
150
|
# --------------------------------------------------------------------
|
|
138
151
|
@staticmethod
|
|
139
152
|
def IncludeIsNotFoundInFileLine() -> typing.NoReturn:
|
|
140
|
-
errMsg = "
|
|
141
|
-
|
|
153
|
+
errMsg = "Include is not found in file line."
|
|
154
|
+
__class__.Helper__Raise(errMsg)
|
|
142
155
|
|
|
143
156
|
# --------------------------------------------------------------------
|
|
144
157
|
@staticmethod
|
|
145
158
|
def FileLineIsNotFoundInFile() -> typing.NoReturn:
|
|
146
|
-
errMsg = "
|
|
147
|
-
|
|
159
|
+
errMsg = "FileLine is not found in file."
|
|
160
|
+
__class__.Helper__Raise(errMsg)
|
|
148
161
|
|
|
149
162
|
# --------------------------------------------------------------------
|
|
150
163
|
@staticmethod
|
|
@@ -153,10 +166,10 @@ class BugCheckError:
|
|
|
153
166
|
) -> typing.NoReturn:
|
|
154
167
|
assert type(name) is str
|
|
155
168
|
|
|
156
|
-
errMsg = "
|
|
157
|
-
name
|
|
169
|
+
errMsg = "OptionHandlerToPrepareSetValue for [{0}] is not defined.".format(
|
|
170
|
+
name,
|
|
158
171
|
)
|
|
159
|
-
|
|
172
|
+
__class__.Helper__Raise(errMsg)
|
|
160
173
|
|
|
161
174
|
# --------------------------------------------------------------------
|
|
162
175
|
@staticmethod
|
|
@@ -165,10 +178,10 @@ class BugCheckError:
|
|
|
165
178
|
) -> typing.NoReturn:
|
|
166
179
|
assert type(name) is str
|
|
167
180
|
|
|
168
|
-
errMsg = "
|
|
169
|
-
name
|
|
181
|
+
errMsg = "OptionHandlerToPrepareGetValue for [{0}] is not defined.".format(
|
|
182
|
+
name,
|
|
170
183
|
)
|
|
171
|
-
|
|
184
|
+
__class__.Helper__Raise(errMsg)
|
|
172
185
|
|
|
173
186
|
# --------------------------------------------------------------------
|
|
174
187
|
@staticmethod
|
|
@@ -177,10 +190,10 @@ class BugCheckError:
|
|
|
177
190
|
) -> typing.NoReturn:
|
|
178
191
|
assert type(name) is str
|
|
179
192
|
|
|
180
|
-
errMsg = "
|
|
181
|
-
name
|
|
193
|
+
errMsg = "OptionHandlerToPrepareSetValueItem for [{0}] is not defined.".format(
|
|
194
|
+
name,
|
|
182
195
|
)
|
|
183
|
-
|
|
196
|
+
__class__.Helper__Raise(errMsg)
|
|
184
197
|
|
|
185
198
|
# --------------------------------------------------------------------
|
|
186
199
|
@staticmethod
|
|
@@ -189,10 +202,10 @@ class BugCheckError:
|
|
|
189
202
|
) -> typing.NoReturn:
|
|
190
203
|
assert type(name) is str
|
|
191
204
|
|
|
192
|
-
errMsg = "
|
|
193
|
-
name
|
|
205
|
+
errMsg = "OptionHandlerToSetValue for [{0}] is not defined.".format(
|
|
206
|
+
name,
|
|
194
207
|
)
|
|
195
|
-
|
|
208
|
+
__class__.Helper__Raise(errMsg)
|
|
196
209
|
|
|
197
210
|
# --------------------------------------------------------------------
|
|
198
211
|
@staticmethod
|
|
@@ -201,10 +214,10 @@ class BugCheckError:
|
|
|
201
214
|
) -> typing.NoReturn:
|
|
202
215
|
assert type(name) is str
|
|
203
216
|
|
|
204
|
-
errMsg = "
|
|
205
|
-
name
|
|
217
|
+
errMsg = "OptionHandlerToGetValue for [{0}] is not defined.".format(
|
|
218
|
+
name,
|
|
206
219
|
)
|
|
207
|
-
|
|
220
|
+
__class__.Helper__Raise(errMsg)
|
|
208
221
|
|
|
209
222
|
# --------------------------------------------------------------------
|
|
210
223
|
@staticmethod
|
|
@@ -213,12 +226,10 @@ class BugCheckError:
|
|
|
213
226
|
) -> typing.NoReturn:
|
|
214
227
|
assert type(name) is str
|
|
215
228
|
|
|
216
|
-
errMsg = (
|
|
217
|
-
|
|
218
|
-
name
|
|
219
|
-
)
|
|
229
|
+
errMsg = "OptionHandlerToAddOption for [{0}] is not defined.".format(
|
|
230
|
+
name,
|
|
220
231
|
)
|
|
221
|
-
|
|
232
|
+
__class__.Helper__Raise(errMsg)
|
|
222
233
|
|
|
223
234
|
# --------------------------------------------------------------------
|
|
224
235
|
@staticmethod
|
|
@@ -227,12 +238,10 @@ class BugCheckError:
|
|
|
227
238
|
) -> typing.NoReturn:
|
|
228
239
|
assert type(name) is str
|
|
229
240
|
|
|
230
|
-
errMsg = (
|
|
231
|
-
|
|
232
|
-
name
|
|
233
|
-
)
|
|
241
|
+
errMsg = "OptionHandlerToSetValueItem for [{0}] is not defined.".format(
|
|
242
|
+
name,
|
|
234
243
|
)
|
|
235
|
-
|
|
244
|
+
__class__.Helper__Raise(errMsg)
|
|
236
245
|
|
|
237
246
|
# --------------------------------------------------------------------
|
|
238
247
|
@staticmethod
|
|
@@ -241,10 +250,10 @@ class BugCheckError:
|
|
|
241
250
|
) -> typing.NoReturn:
|
|
242
251
|
assert type(name) is str
|
|
243
252
|
|
|
244
|
-
errMsg = "
|
|
245
|
-
name
|
|
253
|
+
errMsg = "OptionHandlerToWrite for [{0}] is not defined.".format(
|
|
254
|
+
name,
|
|
246
255
|
)
|
|
247
|
-
|
|
256
|
+
__class__.Helper__Raise(errMsg)
|
|
248
257
|
|
|
249
258
|
# --------------------------------------------------------------------
|
|
250
259
|
@staticmethod
|
|
@@ -257,8 +266,9 @@ class BugCheckError:
|
|
|
257
266
|
assert type(bugcheckPoint) is str
|
|
258
267
|
assert explain is None or type(explain) is str
|
|
259
268
|
|
|
260
|
-
errMsg = "
|
|
261
|
-
bugcheckSrc,
|
|
269
|
+
errMsg = "Unexpected situation in [{0}][{1}].".format(
|
|
270
|
+
bugcheckSrc,
|
|
271
|
+
bugcheckPoint,
|
|
262
272
|
)
|
|
263
273
|
|
|
264
274
|
if explain is not None and explain != "":
|
|
@@ -267,7 +277,7 @@ class BugCheckError:
|
|
|
267
277
|
|
|
268
278
|
assert errMsg[-1] == "."
|
|
269
279
|
|
|
270
|
-
|
|
280
|
+
__class__.Helper__Raise(errMsg)
|
|
271
281
|
|
|
272
282
|
# --------------------------------------------------------------------
|
|
273
283
|
@staticmethod
|
|
@@ -277,13 +287,33 @@ class BugCheckError:
|
|
|
277
287
|
) -> typing.NoReturn:
|
|
278
288
|
assert type(optionName) is str
|
|
279
289
|
assert optionName != ""
|
|
280
|
-
assert
|
|
290
|
+
assert isinstance(typeOfOptionValue, type)
|
|
291
|
+
|
|
292
|
+
errMsg = "Unknown value type [{1}] of option [{0}].".format(
|
|
293
|
+
optionName,
|
|
294
|
+
typeOfOptionValue.__name__,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
__class__.Helper__Raise(errMsg)
|
|
298
|
+
|
|
299
|
+
# --------------------------------------------------------------------
|
|
300
|
+
@staticmethod
|
|
301
|
+
def UnsupportedPgConfStrategy(
|
|
302
|
+
strategy: typing.Any,
|
|
303
|
+
) -> typing.NoReturn:
|
|
281
304
|
|
|
282
|
-
errMsg = "
|
|
283
|
-
|
|
305
|
+
errMsg = "Unsupported data strategy {!r}.".format(
|
|
306
|
+
strategy,
|
|
284
307
|
)
|
|
285
308
|
|
|
286
|
-
|
|
309
|
+
__class__.Helper__Raise(errMsg)
|
|
310
|
+
|
|
311
|
+
# Helper methods -----------------------------------------------------
|
|
312
|
+
@staticmethod
|
|
313
|
+
def Helper__Raise(msg: str) -> typing.NoReturn:
|
|
314
|
+
assert type(msg) is str
|
|
315
|
+
assert msg != ""
|
|
316
|
+
raise PostgresConfigBugCheckException(msg)
|
|
287
317
|
|
|
288
318
|
|
|
289
319
|
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -9,7 +9,7 @@ from .raise_error import RaiseError
|
|
|
9
9
|
|
|
10
10
|
class DataVerificator:
|
|
11
11
|
@staticmethod
|
|
12
|
-
def CheckOptionName(name: str):
|
|
12
|
+
def CheckOptionName(name: str) -> None:
|
|
13
13
|
if name is None:
|
|
14
14
|
RaiseError.OptionNameIsNone()
|
|
15
15
|
|
|
@@ -20,6 +20,7 @@ class DataVerificator:
|
|
|
20
20
|
RaiseError.OptionNameIsEmpty()
|
|
21
21
|
|
|
22
22
|
# TODO: Add an extended verification of an option name
|
|
23
|
+
return
|
|
23
24
|
|
|
24
25
|
# --------------------------------------------------------------------
|
|
25
26
|
sm_InvalidCommentSymbols: str = "\n\r\0"
|
|
@@ -41,7 +42,7 @@ class DataVerificator:
|
|
|
41
42
|
|
|
42
43
|
# --------------------------------------------------------------------
|
|
43
44
|
@staticmethod
|
|
44
|
-
def CheckCommentText(text: str):
|
|
45
|
+
def CheckCommentText(text: str) -> None:
|
|
45
46
|
assert text is not None
|
|
46
47
|
assert type(text) is str
|
|
47
48
|
|
|
@@ -51,15 +52,18 @@ class DataVerificator:
|
|
|
51
52
|
RaiseError.CommentTextContainsInvalidSymbols()
|
|
52
53
|
|
|
53
54
|
# OK
|
|
55
|
+
return
|
|
54
56
|
|
|
55
57
|
# --------------------------------------------------------------------
|
|
56
58
|
@staticmethod
|
|
57
|
-
def CheckStringOfFilePath(text: str):
|
|
59
|
+
def CheckStringOfFilePath(text: str) -> None:
|
|
58
60
|
assert text is not None
|
|
59
61
|
assert type(text) is str
|
|
60
62
|
|
|
61
63
|
if text == "":
|
|
62
64
|
RaiseError.FilePathIsEmpty()
|
|
63
65
|
|
|
66
|
+
return
|
|
67
|
+
|
|
64
68
|
|
|
65
69
|
# //////////////////////////////////////////////////////////////////////////////
|