testgres.postgres-configuration 0.2.0__py3-none-any.whl → 0.2.2__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 (41) hide show
  1. testgres/postgres_configuration/abstract/v00/configuration.py +31 -31
  2. testgres/postgres_configuration/core/bugcheck_error.py +52 -29
  3. testgres/postgres_configuration/core/controller_utils.py +181 -146
  4. testgres/postgres_configuration/core/data_verificator.py +10 -6
  5. testgres/postgres_configuration/core/handlers.py +74 -74
  6. testgres/postgres_configuration/core/helpers.py +13 -15
  7. testgres/postgres_configuration/core/model.py +33 -27
  8. testgres/postgres_configuration/core/option/handlers/add/option_handler_to_add__std.py +8 -6
  9. testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py +7 -5
  10. testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py +7 -5
  11. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py +6 -4
  12. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py +8 -6
  13. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py +6 -4
  14. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py +6 -4
  15. testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +4 -4
  16. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py +8 -8
  17. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py +8 -6
  18. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py +8 -6
  19. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py +7 -5
  20. testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +7 -7
  21. testgres/postgres_configuration/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py +9 -5
  22. testgres/postgres_configuration/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py +6 -4
  23. testgres/postgres_configuration/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py +7 -5
  24. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__bool.py +4 -4
  25. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__generic.py +4 -4
  26. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__int.py +1 -1
  27. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__str.py +2 -2
  28. testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py +4 -4
  29. testgres/postgres_configuration/core/raise_error.py +96 -53
  30. testgres/postgres_configuration/core/read_utils.py +29 -24
  31. testgres/postgres_configuration/core/write_utils.py +10 -6
  32. testgres/postgres_configuration/implementation/v00/configuration_base.py +601 -565
  33. testgres/postgres_configuration/implementation/v00/configuration_std.py +35 -34
  34. testgres/postgres_configuration/os/abstract/configuration_os_ops.py +14 -14
  35. testgres/postgres_configuration/os/local/configuration_os_ops.py +16 -16
  36. {testgres_postgres_configuration-0.2.0.dist-info → testgres_postgres_configuration-0.2.2.dist-info}/METADATA +4 -3
  37. testgres_postgres_configuration-0.2.2.dist-info/RECORD +41 -0
  38. {testgres_postgres_configuration-0.2.0.dist-info → testgres_postgres_configuration-0.2.2.dist-info}/WHEEL +1 -1
  39. testgres_postgres_configuration-0.2.0.dist-info/RECORD +0 -41
  40. {testgres_postgres_configuration-0.2.0.dist-info → testgres_postgres_configuration-0.2.2.dist-info}/licenses/LICENSE +0 -0
  41. {testgres_postgres_configuration-0.2.0.dist-info → testgres_postgres_configuration-0.2.2.dist-info}/top_level.txt +0 -0
@@ -81,7 +81,7 @@ class PostgresConfigurationComment(PostgresConfigurationElement):
81
81
 
82
82
  # --------------------------------------------------------------------
83
83
  def Delete(self, withLineIfLast: bool):
84
- assert type(withLineIfLast) == bool
84
+ assert type(withLineIfLast) is bool
85
85
  RaiseError.MethodIsNotImplemented(__class__, "Delete")
86
86
 
87
87
 
@@ -98,16 +98,16 @@ class PostgresConfigurationOption(PostgresConfigurationElement):
98
98
  RaiseError.MethodIsNotImplemented(__class__, "get_Name")
99
99
 
100
100
  # --------------------------------------------------------------------
101
- def get_Value(self) -> any:
101
+ def get_Value(self) -> typing.Any:
102
102
  RaiseError.MethodIsNotImplemented(__class__, "get_Value")
103
103
 
104
104
  # --------------------------------------------------------------------
105
- def set_Value(self, value: any) -> PostgresConfigurationSetOptionValueResult:
105
+ def set_Value(self, value: typing.Any) -> PostgresConfigurationSetOptionValueResult:
106
106
  RaiseError.MethodIsNotImplemented(__class__, "set_Value")
107
107
 
108
108
  # --------------------------------------------------------------------
109
109
  def set_ValueItem(
110
- self, value_item: any
110
+ self, value_item: typing.Any
111
111
  ) -> PostgresConfigurationSetOptionValueResult:
112
112
  assert value_item is not None
113
113
  RaiseError.MethodIsNotImplemented(__class__, "set_ValueItem")
@@ -162,7 +162,7 @@ class PostgresConfigurationInclude(PostgresConfigurationElement):
162
162
 
163
163
  # --------------------------------------------------------------------
164
164
  def Delete(self, withLine: bool):
165
- assert type(withLine) == bool
165
+ assert type(withLine) is bool
166
166
  RaiseError.MethodIsNotImplemented(__class__, "Delete")
167
167
 
168
168
 
@@ -182,27 +182,27 @@ class PostgresConfigurationFileLine(PostgresConfigurationObject):
182
182
  def AddComment(
183
183
  self, text: str, offset: typing.Optional[int]
184
184
  ) -> PostgresConfigurationComment:
185
- assert type(text) == str
186
- assert (offset is None) or (type(offset) == int)
185
+ assert type(text) is str
186
+ assert (offset is None) or (type(offset) is int)
187
187
  RaiseError.MethodIsNotImplemented(__class__, "AddComment")
188
188
 
189
189
  # --------------------------------------------------------------------
190
190
  def AddOption(
191
- self, name: str, value: any, offset: typing.Optional[int]
191
+ self, name: str, value: typing.Any, offset: typing.Optional[int]
192
192
  ) -> PostgresConfigurationOption:
193
- assert type(name) == str
193
+ assert type(name) is str
194
194
  assert name != ""
195
195
  assert value is not None
196
- assert (offset is None) or (type(offset) == int)
196
+ assert (offset is None) or (type(offset) is int)
197
197
  RaiseError.MethodIsNotImplemented(__class__, "AddOption")
198
198
 
199
199
  # --------------------------------------------------------------------
200
200
  def AddInclude(
201
201
  self, path: str, offset: typing.Optional[int]
202
202
  ) -> PostgresConfigurationInclude:
203
- assert type(path) == str
203
+ assert type(path) is str
204
204
  assert path != ""
205
- assert (offset is None) or (type(offset) == int)
205
+ assert (offset is None) or (type(offset) is int)
206
206
  RaiseError.MethodIsNotImplemented(__class__, "AddInclude")
207
207
 
208
208
  # --------------------------------------------------------------------
@@ -271,19 +271,19 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
271
271
 
272
272
  # --------------------------------------------------------------------
273
273
  def AddComment(self, text: str) -> PostgresConfigurationComment:
274
- assert type(text) == str
274
+ assert type(text) is str
275
275
  RaiseError.MethodIsNotImplemented(__class__, "AddComment")
276
276
 
277
277
  # --------------------------------------------------------------------
278
- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption:
279
- assert type(name) == str
278
+ def AddOption(self, name: str, value: typing.Any) -> PostgresConfigurationOption:
279
+ assert type(name) is str
280
280
  assert name != ""
281
281
  assert value is not None
282
282
  RaiseError.MethodIsNotImplemented(__class__, "AddOption")
283
283
 
284
284
  # --------------------------------------------------------------------
285
285
  def AddInclude(self, path: str) -> PostgresConfigurationInclude:
286
- assert type(path) == str
286
+ assert type(path) is str
287
287
  assert path != ""
288
288
  RaiseError.MethodIsNotImplemented(__class__, "AddInclude")
289
289
 
@@ -299,9 +299,9 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
299
299
  # PostgresConfigurationSetOptionValueResult object.
300
300
  #
301
301
  def SetOptionValue(
302
- self, name: str, value: any
302
+ self, name: str, value: typing.Any
303
303
  ) -> PostgresConfigurationSetOptionValueResult:
304
- assert type(name) == str
304
+ assert type(name) is str
305
305
  assert name != ""
306
306
  RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue")
307
307
 
@@ -313,15 +313,15 @@ class PostgresConfigurationFile(PostgresConfigurationObject):
313
313
  # - Value of option.
314
314
  # - None if option is not found in this file.
315
315
  #
316
- def GetOptionValue(self, name: str) -> any:
317
- assert type(name) == str
316
+ def GetOptionValue(self, name: str) -> typing.Any:
317
+ assert type(name) is str
318
318
  RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
319
319
 
320
320
  # --------------------------------------------------------------------
321
321
  def SetOptionValueItem(
322
- self, name: str, value_item: any
322
+ self, name: str, value_item: typing.Any
323
323
  ) -> PostgresConfigurationSetOptionValueResult:
324
- assert type(name) == str
324
+ assert type(name) is str
325
325
  assert name != ""
326
326
  assert value_item is not None
327
327
  RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem")
@@ -375,13 +375,13 @@ class PostgresConfiguration(PostgresConfigurationObject):
375
375
 
376
376
  # interface ----------------------------------------------------------
377
377
  def AddTopLevelFile(self, path: str) -> PostgresConfigurationFile:
378
- assert type(path) == str
378
+ assert type(path) is str
379
379
  assert path != ""
380
380
  RaiseError.MethodIsNotImplemented(__class__, "AddTopLevelFile")
381
381
 
382
382
  # --------------------------------------------------------------------
383
- def AddOption(self, name: str, value: any) -> PostgresConfigurationOption:
384
- assert type(name) == str
383
+ def AddOption(self, name: str, value: typing.Any) -> PostgresConfigurationOption:
384
+ assert type(name) is str
385
385
  assert name != ""
386
386
  assert value is not None
387
387
  RaiseError.MethodIsNotImplemented(__class__, "AddOption")
@@ -398,9 +398,9 @@ class PostgresConfiguration(PostgresConfigurationObject):
398
398
  # PostgresConfigurationSetOptionValueResult object.
399
399
  #
400
400
  def SetOptionValue(
401
- self, name: str, value: any
401
+ self, name: str, value: typing.Any
402
402
  ) -> PostgresConfigurationSetOptionValueResult:
403
- assert type(name) == str
403
+ assert type(name) is str
404
404
  RaiseError.MethodIsNotImplemented(__class__, "SetOptionValue")
405
405
 
406
406
  # --------------------------------------------------------------------
@@ -411,15 +411,15 @@ class PostgresConfiguration(PostgresConfigurationObject):
411
411
  # - Value of option.
412
412
  # - None if option is not found.
413
413
  #
414
- def GetOptionValue(self, name: str) -> any:
415
- assert type(name) == str
414
+ def GetOptionValue(self, name: str) -> typing.Any:
415
+ assert type(name) is str
416
416
  RaiseError.MethodIsNotImplemented(__class__, "GetOptionValue")
417
417
 
418
418
  # --------------------------------------------------------------------
419
419
  def SetOptionValueItem(
420
- self, name: str, value_item: any
420
+ self, name: str, value_item: typing.Any
421
421
  ) -> PostgresConfigurationSetOptionValueResult:
422
- assert type(name) == str
422
+ assert type(name) is str
423
423
  assert value_item is not None
424
424
  RaiseError.MethodIsNotImplemented(__class__, "SetOptionValueItem")
425
425
 
@@ -1,23 +1,26 @@
1
1
  # //////////////////////////////////////////////////////////////////////////////
2
2
  # Postgres Pro. PostgreSQL Configuration Python Library.
3
3
 
4
+ import typing
4
5
 
5
6
  # //////////////////////////////////////////////////////////////////////////////
6
7
  # BugCheckError
7
8
 
8
9
 
9
10
  class BugCheckError:
11
+ @staticmethod
10
12
  def UnkObjectDataType(objectType: type):
11
13
  assert objectType is not None
12
- assert type(objectType) == type
14
+ assert type(objectType) is type
13
15
 
14
16
  errMsg = "[BUG CHECK] Unknown object data type [{0}].".format(objectType)
15
17
  raise Exception(errMsg)
16
18
 
17
19
  # --------------------------------------------------------------------
20
+ @staticmethod
18
21
  def MultipleDefOfOptionIsFound(optName: str, count: int):
19
- assert type(optName) == str
20
- assert type(count) == int
22
+ assert type(optName) is str
23
+ assert type(count) is int
21
24
 
22
25
  errMsg = (
23
26
  "[BUG CHECK] Multiple definitition of option [{0}] is found - {1}.".format(
@@ -27,9 +30,10 @@ class BugCheckError:
27
30
  raise Exception(errMsg)
28
31
 
29
32
  # --------------------------------------------------------------------
33
+ @staticmethod
30
34
  def UnkOptObjectDataType(optName: str, optDataType: type):
31
- assert type(optName) == str
32
- assert type(optDataType) == type
35
+ assert type(optName) is str
36
+ assert type(optDataType) is type
33
37
 
34
38
  errMsg = (
35
39
  "[BUG CHECK] Unknown type of the option object data [{0}] - {1}.".format(
@@ -39,9 +43,10 @@ class BugCheckError:
39
43
  raise Exception(errMsg)
40
44
 
41
45
  # --------------------------------------------------------------------
46
+ @staticmethod
42
47
  def MultipleDefOfFileIsFound(fileName: str, count: int):
43
- assert type(fileName) == str
44
- assert type(count) == int
48
+ assert type(fileName) is str
49
+ assert type(count) is int
45
50
 
46
51
  errMsg = (
47
52
  "[BUG CHECK] Multiple definitition of file [{0}] is found - {1}.".format(
@@ -51,9 +56,10 @@ class BugCheckError:
51
56
  raise Exception(errMsg)
52
57
 
53
58
  # --------------------------------------------------------------------
59
+ @staticmethod
54
60
  def UnkFileObjectDataType(fileName: str, fileDataType: type):
55
- assert type(fileName) == str
56
- assert type(fileDataType) == type
61
+ assert type(fileName) is str
62
+ assert type(fileDataType) is type
57
63
 
58
64
  errMsg = "[BUG CHECK] Unknown type of the file object data [{0}] - {1}.".format(
59
65
  fileName, fileDataType.__name__
@@ -61,8 +67,9 @@ class BugCheckError:
61
67
  raise Exception(errMsg)
62
68
 
63
69
  # --------------------------------------------------------------------
64
- def UnkFileDataStatus(filePath: str, fileStatus: any):
65
- assert type(filePath) == str
70
+ @staticmethod
71
+ def UnkFileDataStatus(filePath: str, fileStatus: typing.Any):
72
+ assert type(filePath) is str
66
73
  assert fileStatus is not None
67
74
 
68
75
  errMsg = "[BUG CHECK] Unknown file data status [{0}] - {1}.".format(
@@ -71,9 +78,10 @@ class BugCheckError:
71
78
  raise Exception(errMsg)
72
79
 
73
80
  # --------------------------------------------------------------------
81
+ @staticmethod
74
82
  def FileIsNotFoundInIndex(fileKey: str, filePath: str):
75
- assert type(fileKey) == str
76
- assert type(filePath) == str
83
+ assert type(fileKey) is str
84
+ assert type(filePath) is str
77
85
 
78
86
  errMsg = "[BUG CHECK] File [{0}][{1}] is not found in index.".format(
79
87
  fileKey, filePath
@@ -81,37 +89,43 @@ class BugCheckError:
81
89
  raise Exception(errMsg)
82
90
 
83
91
  # --------------------------------------------------------------------
92
+ @staticmethod
84
93
  def OptionIsNotFoundInIndex(optName: str):
85
- assert type(optName) == str
94
+ assert type(optName) is str
86
95
 
87
96
  errMsg = "[BUG CHECK] Option [{0}] is not found in index.".format(optName)
88
97
  raise Exception(errMsg)
89
98
 
90
99
  # --------------------------------------------------------------------
100
+ @staticmethod
91
101
  def OptionIsNotFoundInFileLine(optName: str):
92
- assert type(optName) == str
102
+ assert type(optName) is str
93
103
 
94
104
  errMsg = "[BUG CHECK] Option [{0}] is not found in file line.".format(optName)
95
105
  raise Exception(errMsg)
96
106
 
97
107
  # --------------------------------------------------------------------
108
+ @staticmethod
98
109
  def CommentIsNotFoundInFileLine():
99
110
  errMsg = "[BUG CHECK] Comment is not found in file line."
100
111
  raise Exception(errMsg)
101
112
 
102
113
  # --------------------------------------------------------------------
114
+ @staticmethod
103
115
  def IncludeIsNotFoundInFileLine():
104
116
  errMsg = "[BUG CHECK] Include is not found in file line."
105
117
  raise Exception(errMsg)
106
118
 
107
119
  # --------------------------------------------------------------------
120
+ @staticmethod
108
121
  def FileLineIsNotFoundInFile():
109
122
  errMsg = "[BUG CHECK] FileLine is not found in file."
110
123
  raise Exception(errMsg)
111
124
 
112
125
  # --------------------------------------------------------------------
126
+ @staticmethod
113
127
  def OptionHandlerToPrepareSetValueIsNotDefined(name: str):
114
- assert type(name) == str
128
+ assert type(name) is str
115
129
 
116
130
  errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValue for [{0}] is not defined.".format(
117
131
  name
@@ -119,8 +133,9 @@ class BugCheckError:
119
133
  raise Exception(errMsg)
120
134
 
121
135
  # --------------------------------------------------------------------
136
+ @staticmethod
122
137
  def OptionHandlerToPrepareGetValueIsNotDefined(name: str):
123
- assert type(name) == str
138
+ assert type(name) is str
124
139
 
125
140
  errMsg = "[BUG CHECK] OptionHandlerToPrepareGetValue for [{0}] is not defined.".format(
126
141
  name
@@ -128,8 +143,9 @@ class BugCheckError:
128
143
  raise Exception(errMsg)
129
144
 
130
145
  # --------------------------------------------------------------------
146
+ @staticmethod
131
147
  def OptionHandlerToPrepareSetValueItemIsNotDefined(name: str):
132
- assert type(name) == str
148
+ assert type(name) is str
133
149
 
134
150
  errMsg = "[BUG CHECK] OptionHandlerToPrepareSetValueItem for [{0}] is not defined.".format(
135
151
  name
@@ -137,8 +153,9 @@ class BugCheckError:
137
153
  raise Exception(errMsg)
138
154
 
139
155
  # --------------------------------------------------------------------
156
+ @staticmethod
140
157
  def OptionHandlerToSetValueIsNotDefined(name: str):
141
- assert type(name) == str
158
+ assert type(name) is str
142
159
 
143
160
  errMsg = "[BUG CHECK] OptionHandlerToSetValue for [{0}] is not defined.".format(
144
161
  name
@@ -146,8 +163,9 @@ class BugCheckError:
146
163
  raise Exception(errMsg)
147
164
 
148
165
  # --------------------------------------------------------------------
166
+ @staticmethod
149
167
  def OptionHandlerToGetValueIsNotDefined(name: str):
150
- assert type(name) == str
168
+ assert type(name) is str
151
169
 
152
170
  errMsg = "[BUG CHECK] OptionHandlerToGetValue for [{0}] is not defined.".format(
153
171
  name
@@ -155,8 +173,9 @@ class BugCheckError:
155
173
  raise Exception(errMsg)
156
174
 
157
175
  # --------------------------------------------------------------------
176
+ @staticmethod
158
177
  def OptionHandlerToAddOptionIsNotDefined(name: str):
159
- assert type(name) == str
178
+ assert type(name) is str
160
179
 
161
180
  errMsg = (
162
181
  "[BUG CHECK] OptionHandlerToAddOption for [{0}] is not defined.".format(
@@ -166,8 +185,9 @@ class BugCheckError:
166
185
  raise Exception(errMsg)
167
186
 
168
187
  # --------------------------------------------------------------------
188
+ @staticmethod
169
189
  def OptionHandlerToSetValueItemIsNotDefined(name: str):
170
- assert type(name) == str
190
+ assert type(name) is str
171
191
 
172
192
  errMsg = (
173
193
  "[BUG CHECK] OptionHandlerToSetValueItem for [{0}] is not defined.".format(
@@ -177,8 +197,9 @@ class BugCheckError:
177
197
  raise Exception(errMsg)
178
198
 
179
199
  # --------------------------------------------------------------------
200
+ @staticmethod
180
201
  def OptionHandlerToWriteIsNotDefined(name: str):
181
- assert type(name) == str
202
+ assert type(name) is str
182
203
 
183
204
  errMsg = "[BUG CHECK] OptionHandlerToWrite for [{0}] is not defined.".format(
184
205
  name
@@ -186,16 +207,17 @@ class BugCheckError:
186
207
  raise Exception(errMsg)
187
208
 
188
209
  # --------------------------------------------------------------------
210
+ @staticmethod
189
211
  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
212
+ assert type(bugcheckSrc) is str
213
+ assert type(bugcheckPoint) is str
214
+ assert explain is None or type(explain) is str
193
215
 
194
216
  errMsg = "[BUG CHECK] Unexpected situation in [{0}][{1}].".format(
195
217
  bugcheckSrc, bugcheckPoint
196
218
  )
197
219
 
198
- if not (explain is None) and explain != "":
220
+ if explain is not None and explain != "":
199
221
  errMsg += " "
200
222
  errMsg += explain
201
223
 
@@ -204,10 +226,11 @@ class BugCheckError:
204
226
  raise Exception(errMsg)
205
227
 
206
228
  # --------------------------------------------------------------------
229
+ @staticmethod
207
230
  def UnknownOptionValueType(optionName: str, typeOfOptionValue: type):
208
- assert type(optionName) == str
231
+ assert type(optionName) is str
209
232
  assert optionName != ""
210
- assert type(typeOfOptionValue) == type
233
+ assert type(typeOfOptionValue) is type
211
234
 
212
235
  errMsg = "[BUG CHECK] Unknown value type [{1}] of option [{0}].".format(
213
236
  optionName, typeOfOptionValue.__name__