testgres.postgres-configuration 0.1.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.
Files changed (40) hide show
  1. testgres/postgres_configuration/__init__.py +22 -0
  2. testgres/postgres_configuration/abstract/v00/configuration.py +435 -0
  3. testgres/postgres_configuration/core/bugcheck_error.py +219 -0
  4. testgres/postgres_configuration/core/controller_utils.py +982 -0
  5. testgres/postgres_configuration/core/data_verificator.py +60 -0
  6. testgres/postgres_configuration/core/handlers.py +483 -0
  7. testgres/postgres_configuration/core/helpers.py +95 -0
  8. testgres/postgres_configuration/core/model.py +296 -0
  9. testgres/postgres_configuration/core/option/handlers/add/option_handler_to_add__std.py +38 -0
  10. testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py +36 -0
  11. testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py +36 -0
  12. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py +31 -0
  13. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py +41 -0
  14. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py +31 -0
  15. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py +31 -0
  16. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +46 -0
  17. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py +115 -0
  18. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py +41 -0
  19. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py +44 -0
  20. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py +37 -0
  21. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +63 -0
  22. testgres/postgres_configuration/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py +37 -0
  23. testgres/postgres_configuration/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py +38 -0
  24. testgres/postgres_configuration/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py +38 -0
  25. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__bool.py +42 -0
  26. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__generic.py +51 -0
  27. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__int.py +27 -0
  28. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__str.py +36 -0
  29. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py +37 -0
  30. testgres/postgres_configuration/core/raise_error.py +365 -0
  31. testgres/postgres_configuration/core/read_utils.py +308 -0
  32. testgres/postgres_configuration/core/write_utils.py +112 -0
  33. testgres/postgres_configuration/implementation/v00/configuration_base.py +4408 -0
  34. testgres/postgres_configuration/implementation/v00/configuration_std.py +538 -0
  35. testgres/postgres_configuration/os/abstract/configuration_os_ops.py +98 -0
  36. testgres/postgres_configuration/os/local/configuration_os_ops.py +154 -0
  37. testgres_postgres_configuration-0.1.0.dist-info/METADATA +25 -0
  38. testgres_postgres_configuration-0.1.0.dist-info/RECORD +40 -0
  39. testgres_postgres_configuration-0.1.0.dist-info/WHEEL +5 -0
  40. testgres_postgres_configuration-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,22 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ # fmt: off
5
+ from .implementation.v00.configuration_std import PostgresConfiguration_Std as PostgresConfiguration
6
+
7
+ from .implementation.v00.configuration_std import PostgresConfigurationReader_Std as PostgresConfigurationReader
8
+
9
+ from .implementation.v00.configuration_std import PostgresConfigurationWriter_Std as PostgresConfigurationWriter
10
+ # fmt: on
11
+
12
+ # //////////////////////////////////////////////////////////////////////////////
13
+
14
+
15
+ __all__ = [
16
+ "PostgresConfiguration",
17
+ "PostgresConfigurationReader",
18
+ "PostgresConfigurationWriter",
19
+ ]
20
+
21
+
22
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,435 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ...core.raise_error import RaiseError
7
+
8
+ import typing
9
+ import enum
10
+
11
+ # //////////////////////////////////////////////////////////////////////////////
12
+ # class PostgresConfigurationObject
13
+
14
+
15
+ class PostgresConfigurationObject:
16
+ def __init__(self):
17
+ pass
18
+
19
+ # interface ----------------------------------------------------------
20
+ def get_Configuration(self) -> PostgresConfiguration:
21
+ RaiseError.MethodIsNotImplemented(__class__, "get_Configuration")
22
+
23
+ # --------------------------------------------------------------------
24
+ def get_Parent(self) -> PostgresConfigurationObject:
25
+ RaiseError.MethodIsNotImplemented(__class__, "get_Parent")
26
+
27
+
28
+ # //////////////////////////////////////////////////////////////////////////////
29
+ # class PostgresConfigurationSetOptionValueEventID
30
+
31
+
32
+ class PostgresConfigurationSetOptionValueEventID(enum.Enum):
33
+ NONE = 0
34
+ OPTION_WAS_UPDATED = 1
35
+ OPTION_WAS_ADDED = 2
36
+ OPTION_WAS_DELETED = 3
37
+
38
+ VALUE_ITEM_WAS_ALREADY_DEFINED = 4
39
+ VALUE_ITEM_WAS_ADDED = 5
40
+
41
+
42
+ # //////////////////////////////////////////////////////////////////////////////
43
+ # class PostgresConfigurationSetOptionValueResult
44
+
45
+
46
+ class PostgresConfigurationSetOptionValueResult:
47
+ def __init__(self):
48
+ pass
49
+
50
+ # interface -----------------------------------------------------------
51
+ @property
52
+ def Option(self) -> PostgresConfigurationOption:
53
+ RaiseError.GetPropertyIsNotImplemented(__class__, "Option")
54
+
55
+ # ---------------------------------------------------------------------
56
+ @property
57
+ def EventID(self) -> PostgresConfigurationSetOptionValueEventID:
58
+ RaiseError.GetPropertyIsNotImplemented(__class__, "EventID")
59
+
60
+
61
+ # //////////////////////////////////////////////////////////////////////////////
62
+ # class PostgresConfigurationElement
63
+
64
+
65
+ class PostgresConfigurationElement(PostgresConfigurationObject):
66
+ def __init__(self):
67
+ super().__init__()
68
+
69
+
70
+ # //////////////////////////////////////////////////////////////////////////////
71
+ # class PostgresConfigurationComment
72
+
73
+
74
+ class PostgresConfigurationComment(PostgresConfigurationElement):
75
+ def __init__(self):
76
+ super().__init__()
77
+
78
+ # interface ----------------------------------------------------------
79
+ def get_Text(self) -> str:
80
+ RaiseError.MethodIsNotImplemented(__class__, "get_Text")
81
+
82
+ # --------------------------------------------------------------------
83
+ def Delete(self, withLineIfLast: bool):
84
+ assert type(withLineIfLast) == bool
85
+ RaiseError.MethodIsNotImplemented(__class__, "Delete")
86
+
87
+
88
+ # //////////////////////////////////////////////////////////////////////////////
89
+ # class PostgresConfigurationOption
90
+
91
+
92
+ class PostgresConfigurationOption(PostgresConfigurationElement):
93
+ def __init__(self):
94
+ super().__init__()
95
+
96
+ # interface ----------------------------------------------------------
97
+ def get_Name(self) -> str:
98
+ RaiseError.MethodIsNotImplemented(__class__, "get_Name")
99
+
100
+ # --------------------------------------------------------------------
101
+ def get_Value(self) -> any:
102
+ RaiseError.MethodIsNotImplemented(__class__, "get_Value")
103
+
104
+ # --------------------------------------------------------------------
105
+ def set_Value(self, value: any) -> PostgresConfigurationSetOptionValueResult:
106
+ RaiseError.MethodIsNotImplemented(__class__, "set_Value")
107
+
108
+ # --------------------------------------------------------------------
109
+ def set_ValueItem(
110
+ self, value_item: any
111
+ ) -> PostgresConfigurationSetOptionValueResult:
112
+ assert value_item is not None
113
+ RaiseError.MethodIsNotImplemented(__class__, "set_ValueItem")
114
+
115
+
116
+ # //////////////////////////////////////////////////////////////////////////////
117
+ # class PostgresConfigurationOptionsIterator
118
+
119
+
120
+ class PostgresConfigurationOptionsIterator(
121
+ typing.Iterator[PostgresConfigurationOption]
122
+ ):
123
+ def __init__(self):
124
+ pass
125
+
126
+ # interface ----------------------------------------------------------
127
+ def __iter__(self) -> PostgresConfigurationOptionsIterator:
128
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
129
+
130
+ def __next__(self) -> PostgresConfigurationOption:
131
+ RaiseError.MethodIsNotImplemented(__class__, "__next__")
132
+
133
+
134
+ # //////////////////////////////////////////////////////////////////////////////
135
+ # class PostgresConfigurationOptions
136
+
137
+
138
+ class PostgresConfigurationOptions(typing.Iterable[PostgresConfigurationOption]):
139
+ def __init__(self):
140
+ pass
141
+
142
+ # interface ----------------------------------------------------------
143
+ def __len__(self) -> int:
144
+ RaiseError.MethodIsNotImplemented(__class__, "__len__")
145
+
146
+ # --------------------------------------------------------------------
147
+ def __iter__(self) -> PostgresConfigurationFileLinesIterator:
148
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
149
+
150
+
151
+ # //////////////////////////////////////////////////////////////////////////////
152
+ # class PostgresConfigurationInclude
153
+
154
+
155
+ class PostgresConfigurationInclude(PostgresConfigurationElement):
156
+ def __init__(self):
157
+ super().__init__()
158
+
159
+ # interface ----------------------------------------------------------
160
+ def get_File(self) -> PostgresConfigurationFile:
161
+ RaiseError.MethodIsNotImplemented(__class__, "get_File")
162
+
163
+ # --------------------------------------------------------------------
164
+ def Delete(self, withLine: bool):
165
+ assert type(withLine) == bool
166
+ RaiseError.MethodIsNotImplemented(__class__, "Delete")
167
+
168
+
169
+ # //////////////////////////////////////////////////////////////////////////////
170
+ # class PostgresConfigurationFileLine
171
+
172
+
173
+ class PostgresConfigurationFileLine(PostgresConfigurationObject):
174
+ def __init__(self):
175
+ super().__init__()
176
+
177
+ # interface ----------------------------------------------------------
178
+ def __len__(self) -> int:
179
+ RaiseError.MethodIsNotImplemented(__class__, "__len__")
180
+
181
+ # --------------------------------------------------------------------
182
+ def AddComment(
183
+ self, text: str, offset: typing.Optional[int]
184
+ ) -> PostgresConfigurationComment:
185
+ assert type(text) == str
186
+ assert (offset is None) or (type(offset) == int)
187
+ RaiseError.MethodIsNotImplemented(__class__, "AddComment")
188
+
189
+ # --------------------------------------------------------------------
190
+ def AddOption(
191
+ self, name: str, value: any, offset: typing.Optional[int]
192
+ ) -> PostgresConfigurationOption:
193
+ assert type(name) == str
194
+ assert name != ""
195
+ assert value is not None
196
+ assert (offset is None) or (type(offset) == int)
197
+ RaiseError.MethodIsNotImplemented(__class__, "AddOption")
198
+
199
+ # --------------------------------------------------------------------
200
+ def AddInclude(
201
+ self, path: str, offset: typing.Optional[int]
202
+ ) -> PostgresConfigurationInclude:
203
+ assert type(path) == str
204
+ assert path != ""
205
+ assert (offset is None) or (type(offset) == int)
206
+ RaiseError.MethodIsNotImplemented(__class__, "AddInclude")
207
+
208
+ # --------------------------------------------------------------------
209
+ def Clear(self) -> None:
210
+ RaiseError.MethodIsNotImplemented(__class__, "Clear")
211
+
212
+
213
+ # //////////////////////////////////////////////////////////////////////////////
214
+ # class PostgresConfigurationFileLinesIterator
215
+
216
+
217
+ class PostgresConfigurationFileLinesIterator(
218
+ typing.Iterator[PostgresConfigurationFileLine]
219
+ ):
220
+ def __init__(self):
221
+ pass
222
+
223
+ # interface ----------------------------------------------------------
224
+ def __iter__(self) -> PostgresConfigurationFileLinesIterator:
225
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
226
+
227
+ def __next__(self) -> PostgresConfigurationFileLine:
228
+ RaiseError.MethodIsNotImplemented(__class__, "__next__")
229
+
230
+
231
+ # //////////////////////////////////////////////////////////////////////////////
232
+ # class PostgresConfigurationFileLines
233
+
234
+
235
+ class PostgresConfigurationFileLines(typing.Iterable[PostgresConfigurationFileLine]):
236
+ def __init__(self):
237
+ pass
238
+
239
+ # interface ----------------------------------------------------------
240
+ def __len__(self) -> int:
241
+ RaiseError.MethodIsNotImplemented(__class__, "__len__")
242
+
243
+ # --------------------------------------------------------------------
244
+ def __iter__(self) -> PostgresConfigurationFileLinesIterator:
245
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
246
+
247
+
248
+ # //////////////////////////////////////////////////////////////////////////////
249
+ # class PostgresConfigurationFile
250
+
251
+
252
+ class PostgresConfigurationFile(PostgresConfigurationObject):
253
+ def __init__(self):
254
+ super().__init__()
255
+
256
+ # interface ----------------------------------------------------------
257
+ def __len__(self) -> int:
258
+ RaiseError.MethodIsNotImplemented(__class__, "__len__")
259
+
260
+ # --------------------------------------------------------------------
261
+ def get_Path(self) -> str:
262
+ RaiseError.MethodIsNotImplemented(__class__, "get_Path")
263
+
264
+ # --------------------------------------------------------------------
265
+ def get_Lines(self) -> PostgresConfigurationFileLines:
266
+ RaiseError.MethodIsNotImplemented(__class__, "get_Lines")
267
+
268
+ # --------------------------------------------------------------------
269
+ def AddEmptyLine(self) -> PostgresConfigurationFileLine:
270
+ RaiseError.MethodIsNotImplemented(__class__, "AddEmptyLine")
271
+
272
+ # --------------------------------------------------------------------
273
+ def AddComment(self, text: str) -> PostgresConfigurationComment:
274
+ assert type(text) == str
275
+ RaiseError.MethodIsNotImplemented(__class__, "AddComment")
276
+
277
+ # --------------------------------------------------------------------
278
+ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption:
279
+ assert type(name) == str
280
+ assert name != ""
281
+ assert value is not None
282
+ RaiseError.MethodIsNotImplemented(__class__, "AddOption")
283
+
284
+ # --------------------------------------------------------------------
285
+ def AddInclude(self, path: str) -> PostgresConfigurationInclude:
286
+ assert type(path) == str
287
+ assert path != ""
288
+ RaiseError.MethodIsNotImplemented(__class__, "AddInclude")
289
+
290
+ # --------------------------------------------------------------------
291
+ #
292
+ # Method for inserting, updating and deleting of an option.
293
+ #
294
+ # It finds a suitable file or uses/creates default file (auto.conf).
295
+ #
296
+ # Set of None will delete an option from all files.
297
+ #
298
+ # Return:
299
+ # PostgresConfigurationSetOptionValueResult object.
300
+ #
301
+ def SetOptionValue(
302
+ self, name: str, value: any
303
+ ) -> PostgresConfigurationSetOptionValueResult:
304
+ assert type(name) == str
305
+ assert name != ""
306
+ RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue")
307
+
308
+ # --------------------------------------------------------------------
309
+ #
310
+ # Method for getting a value of option.
311
+ #
312
+ # Return:
313
+ # - Value of option.
314
+ # - None if option is not found in this file.
315
+ #
316
+ def GetOptionValue(self, name: str) -> any:
317
+ assert type(name) == str
318
+ RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
319
+
320
+ # --------------------------------------------------------------------
321
+ def SetOptionValueItem(
322
+ self, name: str, value_item: any
323
+ ) -> PostgresConfigurationSetOptionValueResult:
324
+ assert type(name) == str
325
+ assert name != ""
326
+ assert value_item is not None
327
+ RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem")
328
+
329
+
330
+ # //////////////////////////////////////////////////////////////////////////////
331
+ # class PostgresConfigurationFilesIterator
332
+
333
+
334
+ class PostgresConfigurationFilesIterator(typing.Iterator[PostgresConfigurationFile]):
335
+ def __init__(self):
336
+ pass
337
+
338
+ # interface ----------------------------------------------------------
339
+ def __iter__(self) -> PostgresConfigurationFilesIterator:
340
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
341
+
342
+ def __next__(self) -> PostgresConfigurationFile:
343
+ RaiseError.MethodIsNotImplemented(__class__, "__next__")
344
+
345
+
346
+ # //////////////////////////////////////////////////////////////////////////////
347
+ # class PostgresConfigurationFiles
348
+
349
+
350
+ class PostgresConfigurationFiles(typing.Iterable[PostgresConfigurationFile]):
351
+ def __init__(self):
352
+ pass
353
+
354
+ # interface ----------------------------------------------------------
355
+ def __len__(self) -> int:
356
+ RaiseError.MethodIsNotImplemented(__class__, "__len__")
357
+
358
+ # --------------------------------------------------------------------
359
+ def __iter__(self) -> PostgresConfigurationFilesIterator:
360
+ RaiseError.MethodIsNotImplemented(__class__, "__iter__")
361
+
362
+ # --------------------------------------------------------------------
363
+ def GetFileByName(self, file_name: str) -> PostgresConfigurationFile:
364
+ assert file_name is not None
365
+ RaiseError.MethodIsNotImplemented(__class__, "GetFileByName")
366
+
367
+
368
+ # //////////////////////////////////////////////////////////////////////////////
369
+ # class PostgresConfiguration
370
+
371
+
372
+ class PostgresConfiguration(PostgresConfigurationObject):
373
+ def __init__(self):
374
+ pass
375
+
376
+ # interface ----------------------------------------------------------
377
+ def AddTopLevelFile(self, path: str) -> PostgresConfigurationFile:
378
+ assert type(path) == str
379
+ assert path != ""
380
+ RaiseError.MethodIsNotImplemented(__class__, "AddTopLevelFile")
381
+
382
+ # --------------------------------------------------------------------
383
+ def AddOption(self, name: str, value: any) -> PostgresConfigurationOption:
384
+ assert type(name) == str
385
+ assert name != ""
386
+ assert value is not None
387
+ RaiseError.MethodIsNotImplemented(__class__, "AddOption")
388
+
389
+ # --------------------------------------------------------------------
390
+ #
391
+ # Method for inserting, updating and deleting of an option.
392
+ #
393
+ # It finds a suitable file or uses/creates default file (auto.conf).
394
+ #
395
+ # Set of None will delete an option from all files.
396
+ #
397
+ # Return:
398
+ # PostgresConfigurationSetOptionValueResult object.
399
+ #
400
+ def SetOptionValue(
401
+ self, name: str, value: any
402
+ ) -> PostgresConfigurationSetOptionValueResult:
403
+ assert type(name) == str
404
+ RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue")
405
+
406
+ # --------------------------------------------------------------------
407
+ #
408
+ # Method for getting a value of option.
409
+ #
410
+ # Return:
411
+ # - Value of option.
412
+ # - None if option is not found.
413
+ #
414
+ def GetOptionValue(self, name: str) -> any:
415
+ assert type(name) == str
416
+ RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
417
+
418
+ # --------------------------------------------------------------------
419
+ def SetOptionValueItem(
420
+ self, name: str, value_item: any
421
+ ) -> PostgresConfigurationSetOptionValueResult:
422
+ assert type(name) == str
423
+ assert value_item is not None
424
+ RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem")
425
+
426
+ # --------------------------------------------------------------------
427
+ def get_AllFiles(self) -> PostgresConfigurationFiles:
428
+ RaiseError.MethodIsNotImplemented(__class__, "get_AllFiles")
429
+
430
+ # --------------------------------------------------------------------
431
+ def get_AllOptions(self) -> PostgresConfigurationOptions:
432
+ RaiseError.GetPropertyIsNotImplemented(__class__, "get_AllOptions")
433
+
434
+
435
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,219 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+
5
+ # //////////////////////////////////////////////////////////////////////////////
6
+ # BugCheckError
7
+
8
+
9
+ class BugCheckError:
10
+ def UnkObjectDataType(objectType: type):
11
+ assert objectType is not None
12
+ assert type(objectType) == type
13
+
14
+ errMsg = "[BUG CHECK] Unknown object data type [{0}].".format(objectType)
15
+ raise Exception(errMsg)
16
+
17
+ # --------------------------------------------------------------------
18
+ def MultipleDefOfOptionIsFound(optName: str, count: int):
19
+ assert type(optName) == str
20
+ assert type(count) == int
21
+
22
+ errMsg = (
23
+ "[BUG CHECK] Multiple definitition of option [{0}] is found - {1}.".format(
24
+ optName, count
25
+ )
26
+ )
27
+ raise Exception(errMsg)
28
+
29
+ # --------------------------------------------------------------------
30
+ def UnkOptObjectDataType(optName: str, optDataType: type):
31
+ assert type(optName) == str
32
+ assert type(optDataType) == type
33
+
34
+ errMsg = (
35
+ "[BUG CHECK] Unknown type of the option object data [{0}] - {1}.".format(
36
+ optName, optDataType.__name__
37
+ )
38
+ )
39
+ raise Exception(errMsg)
40
+
41
+ # --------------------------------------------------------------------
42
+ def MultipleDefOfFileIsFound(fileName: str, count: int):
43
+ assert type(fileName) == str
44
+ assert type(count) == int
45
+
46
+ errMsg = (
47
+ "[BUG CHECK] Multiple definitition of file [{0}] is found - {1}.".format(
48
+ fileName, count
49
+ )
50
+ )
51
+ raise Exception(errMsg)
52
+
53
+ # --------------------------------------------------------------------
54
+ def UnkFileObjectDataType(fileName: str, fileDataType: type):
55
+ assert type(fileName) == str
56
+ assert type(fileDataType) == type
57
+
58
+ errMsg = "[BUG CHECK] Unknown type of the file object data [{0}] - {1}.".format(
59
+ fileName, fileDataType.__name__
60
+ )
61
+ raise Exception(errMsg)
62
+
63
+ # --------------------------------------------------------------------
64
+ def UnkFileDataStatus(filePath: str, fileStatus: any):
65
+ assert type(filePath) == str
66
+ assert fileStatus is not None
67
+
68
+ errMsg = "[BUG CHECK] Unknown file data status [{0}] - {1}.".format(
69
+ filePath, fileStatus
70
+ )
71
+ raise Exception(errMsg)
72
+
73
+ # --------------------------------------------------------------------
74
+ def FileIsNotFoundInIndex(fileKey: str, filePath: str):
75
+ assert type(fileKey) == str
76
+ assert type(filePath) == str
77
+
78
+ errMsg = "[BUG CHECK] File [{0}][{1}] is not found in index.".format(
79
+ fileKey, filePath
80
+ )
81
+ raise Exception(errMsg)
82
+
83
+ # --------------------------------------------------------------------
84
+ def OptionIsNotFoundInIndex(optName: str):
85
+ assert type(optName) == str
86
+
87
+ errMsg = "[BUG CHECK] Option [{0}] is not found in index.".format(optName)
88
+ raise Exception(errMsg)
89
+
90
+ # --------------------------------------------------------------------
91
+ def OptionIsNotFoundInFileLine(optName: str):
92
+ assert type(optName) == str
93
+
94
+ errMsg = "[BUG CHECK] Option [{0}] is not found in file line.".format(optName)
95
+ raise Exception(errMsg)
96
+
97
+ # --------------------------------------------------------------------
98
+ def CommentIsNotFoundInFileLine():
99
+ errMsg = "[BUG CHECK] Comment is not found in file line."
100
+ raise Exception(errMsg)
101
+
102
+ # --------------------------------------------------------------------
103
+ def IncludeIsNotFoundInFileLine():
104
+ errMsg = "[BUG CHECK] Include is not found in file line."
105
+ raise Exception(errMsg)
106
+
107
+ # --------------------------------------------------------------------
108
+ def FileLineIsNotFoundInFile():
109
+ errMsg = "[BUG CHECK] FileLine is not found in file."
110
+ raise Exception(errMsg)
111
+
112
+ # --------------------------------------------------------------------
113
+ def OptionHandlerToPrepareSetValueIsNotDefined(name: str):
114
+ assert type(name) == str
115
+
116
+ errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValue for [{0}] is not defined.".format(
117
+ name
118
+ )
119
+ raise Exception(errMsg)
120
+
121
+ # --------------------------------------------------------------------
122
+ def OptionHandlerToPrepareGetValueIsNotDefined(name: str):
123
+ assert type(name) == str
124
+
125
+ errMsg = "[BUG CHECK] OptionHandlerToPrepareGetValue for [{0}] is not defined.".format(
126
+ name
127
+ )
128
+ raise Exception(errMsg)
129
+
130
+ # --------------------------------------------------------------------
131
+ def OptionHandlerToPrepareSetValueItemIsNotDefined(name: str):
132
+ assert type(name) == str
133
+
134
+ errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValueItem for [{0}] is not defined.".format(
135
+ name
136
+ )
137
+ raise Exception(errMsg)
138
+
139
+ # --------------------------------------------------------------------
140
+ def OptionHandlerToSetValueIsNotDefined(name: str):
141
+ assert type(name) == str
142
+
143
+ errMsg = "[BUG CHECK] OptionHandlerToSetValue for [{0}] is not defined.".format(
144
+ name
145
+ )
146
+ raise Exception(errMsg)
147
+
148
+ # --------------------------------------------------------------------
149
+ def OptionHandlerToGetValueIsNotDefined(name: str):
150
+ assert type(name) == str
151
+
152
+ errMsg = "[BUG CHECK] OptionHandlerToGetValue for [{0}] is not defined.".format(
153
+ name
154
+ )
155
+ raise Exception(errMsg)
156
+
157
+ # --------------------------------------------------------------------
158
+ def OptionHandlerToAddOptionIsNotDefined(name: str):
159
+ assert type(name) == str
160
+
161
+ errMsg = (
162
+ "[BUG CHECK] OptionHandlerToAddOption for [{0}] is not defined.".format(
163
+ name
164
+ )
165
+ )
166
+ raise Exception(errMsg)
167
+
168
+ # --------------------------------------------------------------------
169
+ def OptionHandlerToSetValueItemIsNotDefined(name: str):
170
+ assert type(name) == str
171
+
172
+ errMsg = (
173
+ "[BUG CHECK] OptionHandlerToSetValueItem for [{0}] is not defined.".format(
174
+ name
175
+ )
176
+ )
177
+ raise Exception(errMsg)
178
+
179
+ # --------------------------------------------------------------------
180
+ def OptionHandlerToWriteIsNotDefined(name: str):
181
+ assert type(name) == str
182
+
183
+ errMsg = "[BUG CHECK] OptionHandlerToWrite for [{0}] is not defined.".format(
184
+ name
185
+ )
186
+ raise Exception(errMsg)
187
+
188
+ # --------------------------------------------------------------------
189
+ def UnexpectedSituation(bugcheckSrc: str, bugcheckPoint: str, explain: str):
190
+ assert type(bugcheckSrc) == str
191
+ assert type(bugcheckPoint) == str
192
+ assert explain is None or type(explain) == str
193
+
194
+ errMsg = "[BUG CHECK] Unexpected situation in [{0}][{1}].".format(
195
+ bugcheckSrc, bugcheckPoint
196
+ )
197
+
198
+ if not (explain is None) and explain != "":
199
+ errMsg += " "
200
+ errMsg += explain
201
+
202
+ assert errMsg[-1] == "."
203
+
204
+ raise Exception(errMsg)
205
+
206
+ # --------------------------------------------------------------------
207
+ def UnknownOptionValueType(optionName: str, typeOfOptionValue: type):
208
+ assert type(optionName) == str
209
+ assert optionName != ""
210
+ assert type(typeOfOptionValue) == type
211
+
212
+ errMsg = "[BUG CHECK] Unknown value type [{1}] of option [{0}].".format(
213
+ optionName, typeOfOptionValue.__name__
214
+ )
215
+
216
+ raise Exception(errMsg)
217
+
218
+
219
+ # //////////////////////////////////////////////////////////////////////////////