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.
- testgres/postgres_configuration/__init__.py +22 -0
- testgres/postgres_configuration/abstract/v00/configuration.py +435 -0
- testgres/postgres_configuration/core/bugcheck_error.py +219 -0
- testgres/postgres_configuration/core/controller_utils.py +982 -0
- testgres/postgres_configuration/core/data_verificator.py +60 -0
- testgres/postgres_configuration/core/handlers.py +483 -0
- testgres/postgres_configuration/core/helpers.py +95 -0
- testgres/postgres_configuration/core/model.py +296 -0
- testgres/postgres_configuration/core/option/handlers/add/option_handler_to_add__std.py +38 -0
- testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py +36 -0
- testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py +36 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py +31 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py +41 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py +31 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py +31 -0
- testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py +46 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py +115 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py +41 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py +44 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py +37 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py +63 -0
- testgres/postgres_configuration/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py +37 -0
- testgres/postgres_configuration/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py +38 -0
- testgres/postgres_configuration/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py +38 -0
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__bool.py +42 -0
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__generic.py +51 -0
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__int.py +27 -0
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__str.py +36 -0
- testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py +37 -0
- testgres/postgres_configuration/core/raise_error.py +365 -0
- testgres/postgres_configuration/core/read_utils.py +308 -0
- testgres/postgres_configuration/core/write_utils.py +112 -0
- testgres/postgres_configuration/implementation/v00/configuration_base.py +4408 -0
- testgres/postgres_configuration/implementation/v00/configuration_std.py +538 -0
- testgres/postgres_configuration/os/abstract/configuration_os_ops.py +98 -0
- testgres/postgres_configuration/os/local/configuration_os_ops.py +154 -0
- testgres_postgres_configuration-0.1.0.dist-info/METADATA +25 -0
- testgres_postgres_configuration-0.1.0.dist-info/RECORD +40 -0
- testgres_postgres_configuration-0.1.0.dist-info/WHEEL +5 -0
- testgres_postgres_configuration-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
# Postgres Pro. PostgreSQL Configuration Python Library.
|
|
3
|
+
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
# class WriteUtils
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WriteUtils:
|
|
11
|
+
def Pack_StrList2(strList: list) -> str:
|
|
12
|
+
assert strList is not None
|
|
13
|
+
assert type(strList) == list
|
|
14
|
+
|
|
15
|
+
result = ""
|
|
16
|
+
sep = ""
|
|
17
|
+
|
|
18
|
+
index: typing.Set[str] = set()
|
|
19
|
+
assert type(index) == set
|
|
20
|
+
|
|
21
|
+
for x in strList:
|
|
22
|
+
assert x is not None
|
|
23
|
+
assert type(x) == str
|
|
24
|
+
|
|
25
|
+
v = str(x)
|
|
26
|
+
|
|
27
|
+
if v in index:
|
|
28
|
+
continue
|
|
29
|
+
|
|
30
|
+
index.add(v)
|
|
31
|
+
|
|
32
|
+
result += sep
|
|
33
|
+
result += __class__.Helper__PackStrListItem2(str(x))
|
|
34
|
+
sep = ","
|
|
35
|
+
|
|
36
|
+
return result
|
|
37
|
+
|
|
38
|
+
# --------------------------------------------------------------------
|
|
39
|
+
def Pack_Str(text: str) -> str:
|
|
40
|
+
assert text is not None
|
|
41
|
+
assert type(text) == str
|
|
42
|
+
|
|
43
|
+
result = "'"
|
|
44
|
+
|
|
45
|
+
for ch in text:
|
|
46
|
+
if ch == "\0":
|
|
47
|
+
result += "\\000"
|
|
48
|
+
elif ch == "'": # SINGLE QUOTE
|
|
49
|
+
result += "\\'"
|
|
50
|
+
elif ch == "\b":
|
|
51
|
+
result += "\\b"
|
|
52
|
+
elif ch == "\f":
|
|
53
|
+
result += "\\f"
|
|
54
|
+
elif ch == "\n":
|
|
55
|
+
result += "\\n"
|
|
56
|
+
elif ch == "\r":
|
|
57
|
+
result += "\\r"
|
|
58
|
+
elif ch == "\t":
|
|
59
|
+
result += "\\t"
|
|
60
|
+
elif ch == "\\":
|
|
61
|
+
result += "\\\\"
|
|
62
|
+
else:
|
|
63
|
+
result += ch
|
|
64
|
+
|
|
65
|
+
result += "'"
|
|
66
|
+
|
|
67
|
+
return result
|
|
68
|
+
|
|
69
|
+
# Helper Methods -----------------------------------------------------
|
|
70
|
+
def Helper__PackStrListItem2(itemText: str) -> str:
|
|
71
|
+
assert itemText is not None
|
|
72
|
+
assert type(itemText) == str
|
|
73
|
+
|
|
74
|
+
needQuote = __class__.Helper__StrList__DoesItemNeedToQuote(itemText)
|
|
75
|
+
|
|
76
|
+
result = ""
|
|
77
|
+
|
|
78
|
+
if needQuote:
|
|
79
|
+
result += '"'
|
|
80
|
+
|
|
81
|
+
for ch in itemText:
|
|
82
|
+
if ch == '"': # DOUBLE QUOTE
|
|
83
|
+
assert needQuote
|
|
84
|
+
result += '""'
|
|
85
|
+
else:
|
|
86
|
+
result += ch
|
|
87
|
+
|
|
88
|
+
if needQuote:
|
|
89
|
+
result += '"'
|
|
90
|
+
|
|
91
|
+
return result
|
|
92
|
+
|
|
93
|
+
# --------------------------------------------------------------------
|
|
94
|
+
def Helper__StrList__DoesItemNeedToQuote(itemText: str) -> bool:
|
|
95
|
+
assert itemText is not None
|
|
96
|
+
assert type(itemText) == str
|
|
97
|
+
|
|
98
|
+
if itemText == "":
|
|
99
|
+
return True
|
|
100
|
+
|
|
101
|
+
for ch in itemText:
|
|
102
|
+
if ch == '"':
|
|
103
|
+
return True
|
|
104
|
+
if ch == " ":
|
|
105
|
+
return True
|
|
106
|
+
if ch == "\t":
|
|
107
|
+
return True
|
|
108
|
+
if ch == ",":
|
|
109
|
+
return True
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# //////////////////////////////////////////////////////////////////////////////
|