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,115 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....raise_error import RaiseError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValue
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValue
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ import typing
13
+
14
+ # //////////////////////////////////////////////////////////////////////////////
15
+ # OptionHandlerToPrepareSetValue__Std__Bool
16
+
17
+
18
+ class OptionHandlerToPrepareSetValue__Std__Bool(OptionHandlerToPrepareSetValue):
19
+ def __init__(self):
20
+ super().__init__()
21
+
22
+ # check
23
+ assert not any(set(__class__.sm_Str_True).intersection(__class__.sm_Str_False))
24
+
25
+ # prefixes are checked
26
+ assert not any(
27
+ [
28
+ x1
29
+ for x1 in __class__.sm_Str_True
30
+ if any([x2 for x2 in __class__.sm_Str_False if x2.startswith(x1)])
31
+ ]
32
+ )
33
+ assert not any(
34
+ [
35
+ x1
36
+ for x1 in __class__.sm_Str_False
37
+ if any([x2 for x2 in __class__.sm_Str_True if x2.startswith(x1)])
38
+ ]
39
+ )
40
+
41
+ # interface ----------------------------------------------------------
42
+ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
43
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValue
44
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
45
+ assert type(ctx.OptionName) == str
46
+ assert ctx.OptionValue is not None
47
+
48
+ optionValue = ctx.OptionValue
49
+ optionValueType = type(optionValue)
50
+
51
+ if optionValueType == bool:
52
+ return optionValue
53
+
54
+ if optionValueType == int:
55
+ assert type(optionValue) == int
56
+
57
+ if optionValue == 0:
58
+ return False
59
+
60
+ if optionValue == 1:
61
+ return True
62
+
63
+ RaiseError.CantConvertOptionValue(ctx.OptionName, optionValueType, bool)
64
+
65
+ if optionValueType == str:
66
+ assert type(optionValue) == str
67
+
68
+ if len(optionValue) < __class__.C_MIN_STR_VALUE_LENGTH:
69
+ pass
70
+ elif len(optionValue) > __class__.C_MAX_STR_VALUE_LENGTH:
71
+ pass
72
+ else:
73
+ optionValue_lower = optionValue.lower()
74
+
75
+ if optionValue_lower in __class__.sm_Str_False:
76
+ return False
77
+
78
+ if optionValue_lower in __class__.sm_Str_True:
79
+ return True
80
+
81
+ RaiseError.CantConvertOptionValue(ctx.OptionName, optionValueType, bool)
82
+
83
+ RaiseError.BadOptionValueType(ctx.OptionName, optionValueType, bool)
84
+
85
+ # Private data -------------------------------------------------------
86
+ C_MIN_STR_VALUE_LENGTH = 1
87
+ C_MAX_STR_VALUE_LENGTH = 5
88
+
89
+ sm_Str_False: typing.List[str] = [
90
+ "of",
91
+ "off",
92
+ "f",
93
+ "fa",
94
+ "fal",
95
+ "fals",
96
+ "false",
97
+ "n",
98
+ "no",
99
+ "0",
100
+ ]
101
+
102
+ sm_Str_True: typing.List[str] = [
103
+ "on",
104
+ "t",
105
+ "tr",
106
+ "tru",
107
+ "true",
108
+ "y",
109
+ "ye",
110
+ "yes",
111
+ "1",
112
+ ]
113
+
114
+
115
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,41 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....bugcheck_error import BugCheckError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValue
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValue
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ # //////////////////////////////////////////////////////////////////////////////
13
+ # OptionHandlerToPrepareSetValue__Std__Generic
14
+
15
+
16
+ class OptionHandlerToPrepareSetValue__Std__Generic(OptionHandlerToPrepareSetValue):
17
+ def __init__(self):
18
+ super().__init__()
19
+
20
+ # interface ----------------------------------------------------------
21
+ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
22
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValue
23
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
24
+ assert type(ctx.OptionName) == str
25
+ assert ctx.OptionValue is not None
26
+
27
+ typeOfOptionValue = type(ctx.OptionValue)
28
+
29
+ if typeOfOptionValue == int:
30
+ pass # OK
31
+ elif typeOfOptionValue == str:
32
+ pass # OK
33
+ elif typeOfOptionValue == bool:
34
+ pass # OK
35
+ else:
36
+ BugCheckError.UnknownOptionValueType(ctx.OptionName, typeOfOptionValue)
37
+
38
+ return ctx.OptionValue
39
+
40
+
41
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,44 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....raise_error import RaiseError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValue
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValue
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ # //////////////////////////////////////////////////////////////////////////////
13
+ # OptionHandlerToPrepareSetValue__Std__Int
14
+
15
+
16
+ class OptionHandlerToPrepareSetValue__Std__Int(OptionHandlerToPrepareSetValue):
17
+ def __init__(self):
18
+ super().__init__()
19
+
20
+ # interface ----------------------------------------------------------
21
+ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
22
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValue
23
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
24
+ assert type(ctx.OptionName) == str
25
+ assert ctx.OptionValue is not None
26
+
27
+ typeOfOptionValue = type(ctx.OptionValue)
28
+
29
+ if typeOfOptionValue == int:
30
+ return ctx.OptionValue
31
+
32
+ optionName = ctx.OptionName
33
+ assert type(optionName) == str
34
+
35
+ if typeOfOptionValue == str:
36
+ if not str(ctx.OptionValue).isnumeric():
37
+ RaiseError.CantConvertOptionValue(optionName, typeOfOptionValue, int)
38
+
39
+ return int(ctx.OptionValue)
40
+
41
+ RaiseError.BadOptionValueType(optionName, typeOfOptionValue, int)
42
+
43
+
44
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,37 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....raise_error import RaiseError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValue
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValue
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ # //////////////////////////////////////////////////////////////////////////////
13
+ # OptionHandlerToPrepareSetValue__Std__Str
14
+
15
+
16
+ class OptionHandlerToPrepareSetValue__Std__Str(OptionHandlerToPrepareSetValue):
17
+ def __init__(self):
18
+ super().__init__()
19
+
20
+ # interface ----------------------------------------------------------
21
+ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
22
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValue
23
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
24
+ assert type(ctx.OptionName) == str
25
+ assert ctx.OptionValue is not None
26
+
27
+ typeOfOptionValue = type(ctx.OptionValue)
28
+
29
+ if typeOfOptionValue != str:
30
+ optionName = ctx.OptionName
31
+ assert type(optionName) == str
32
+ RaiseError.BadOptionValueType(optionName, typeOfOptionValue, str)
33
+
34
+ return ctx.OptionValue
35
+
36
+
37
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,63 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....raise_error import RaiseError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValue
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValue
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ from ....read_utils import ReadUtils
13
+
14
+ import typing
15
+
16
+ # //////////////////////////////////////////////////////////////////////////////
17
+ # OptionHandlerToPrepareSetValue__Std__UniqueStrList
18
+
19
+
20
+ class OptionHandlerToPrepareSetValue__Std__UniqueStrList(
21
+ OptionHandlerToPrepareSetValue
22
+ ):
23
+ def __init__(self):
24
+ super().__init__()
25
+
26
+ # interface ----------------------------------------------------------
27
+ def PrepareSetValue(self, ctx: OptionHandlerCtxToPrepareSetValue) -> any:
28
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValue
29
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
30
+ assert type(ctx.OptionName) == str
31
+ assert ctx.OptionValue is not None
32
+
33
+ typeOfOptionValue = type(ctx.OptionValue)
34
+
35
+ if typeOfOptionValue == str:
36
+ result = ReadUtils.Unpack_StrList2(ctx.OptionValue)
37
+ assert result is not None
38
+ assert type(result) == list
39
+ return result
40
+ elif typeOfOptionValue == list:
41
+ result: typing.List[str] = list()
42
+ index: typing.Set[str] = set()
43
+
44
+ for x in ctx.OptionValue:
45
+ if x is None:
46
+ RaiseError.NoneOptionValueItemIsNotSupported(ctx.OptionName)
47
+
48
+ v = str(x)
49
+
50
+ if v in index:
51
+ continue
52
+
53
+ result.append(v)
54
+ index.add(v)
55
+
56
+ return result
57
+
58
+ optionName = ctx.OptionName
59
+ assert type(optionName) == str
60
+ RaiseError.BadOptionValueType(optionName, typeOfOptionValue, list)
61
+
62
+
63
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,37 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....raise_error import RaiseError
7
+
8
+ from ....handlers import OptionHandlerToPrepareSetValueItem
9
+ from ....handlers import OptionHandlerCtxToPrepareSetValueItem
10
+ from ....handlers import ConfigurationDataHandler
11
+
12
+ # //////////////////////////////////////////////////////////////////////////////
13
+ # OptionHandlerToPrepareSetValueItem__Std__Str
14
+
15
+
16
+ class OptionHandlerToPrepareSetValueItem__Std__Str(OptionHandlerToPrepareSetValueItem):
17
+ def __init__(self):
18
+ super().__init__()
19
+
20
+ # interface ----------------------------------------------------------
21
+ def PrepareSetValueItem(self, ctx: OptionHandlerCtxToPrepareSetValueItem) -> any:
22
+ assert type(ctx) == OptionHandlerCtxToPrepareSetValueItem
23
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
24
+ assert type(ctx.OptionName) == str
25
+ assert ctx.OptionValueItem is not None
26
+
27
+ typeOfOptionValue = type(ctx.OptionValueItem)
28
+
29
+ if typeOfOptionValue != str:
30
+ optionName = ctx.OptionName
31
+ assert type(optionName) == str
32
+ RaiseError.BadOptionValueItemType(optionName, typeOfOptionValue, str)
33
+
34
+ return ctx.OptionValueItem
35
+
36
+
37
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,38 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToSetValue
7
+ from ....handlers import OptionHandlerCtxToSetValue
8
+ from ....handlers import ConfigurationDataHandler
9
+
10
+ from ....model import FileData
11
+ from ....model import OptionData
12
+
13
+ # //////////////////////////////////////////////////////////////////////////////
14
+ # OptionHandlerToSetValue__Std__Simple
15
+
16
+
17
+ class OptionHandlerToSetValue__Std__Simple(OptionHandlerToSetValue):
18
+ def __init__(self):
19
+ super().__init__()
20
+
21
+ # interface ----------------------------------------------------------
22
+ def SetOptionValue(self, ctx: OptionHandlerCtxToSetValue) -> any:
23
+ assert type(ctx) == OptionHandlerCtxToSetValue
24
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
25
+ assert (
26
+ ctx.TargetData is None
27
+ or type(ctx.TargetData) == FileData
28
+ or type(ctx.TargetData) == OptionData
29
+ )
30
+ assert ctx.OptionName is not None
31
+ assert ctx.OptionValue is not None
32
+
33
+ return ctx.DataHandler.DataHandler__SetOptionValue__Simple(
34
+ ctx.TargetData, ctx.OptionName, ctx.OptionValue
35
+ )
36
+
37
+
38
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,38 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToSetValueItem
7
+ from ....handlers import OptionHandlerCtxToSetValueItem
8
+ from ....handlers import ConfigurationDataHandler
9
+
10
+ from ....model import FileData
11
+ from ....model import OptionData
12
+
13
+ # //////////////////////////////////////////////////////////////////////////////
14
+ # OptionHandlerToSetValueItem__Std__Unique
15
+
16
+
17
+ class OptionHandlerToSetValueItem__Std__Unique(OptionHandlerToSetValueItem):
18
+ def __init__(self):
19
+ super().__init__()
20
+
21
+ # interface ----------------------------------------------------------
22
+ def SetOptionValueItem(self, ctx: OptionHandlerCtxToSetValueItem) -> any:
23
+ assert type(ctx) == OptionHandlerCtxToSetValueItem
24
+ assert isinstance(ctx.DataHandler, ConfigurationDataHandler)
25
+ assert (
26
+ ctx.TargetData is None
27
+ or type(ctx.TargetData) == FileData
28
+ or type(ctx.TargetData) == OptionData
29
+ )
30
+ assert type(ctx.OptionName) == str
31
+ assert ctx.OptionValueItem is not None
32
+
33
+ return ctx.DataHandler.DataHandler__SetUniqueOptionValueItem(
34
+ ctx.TargetData, ctx.OptionName, ctx.OptionValueItem
35
+ )
36
+
37
+
38
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,42 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToWrite
7
+ from ....handlers import OptionHandlerCtxToWrite
8
+
9
+ from ....raise_error import RaiseError
10
+
11
+ # //////////////////////////////////////////////////////////////////////////////
12
+ # OptionHandlerToWrite__Std__Bool
13
+
14
+
15
+ class OptionHandlerToWrite__Std__Bool(OptionHandlerToWrite):
16
+ def __init__(self):
17
+ super().__init__()
18
+
19
+ # interface ----------------------------------------------------------
20
+ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str:
21
+ assert type(ctx) == OptionHandlerCtxToWrite
22
+ assert type(ctx.OptionName) == str
23
+ assert ctx.OptionValue is not None
24
+
25
+ typeOfValue = type(ctx.OptionValue)
26
+
27
+ if typeOfValue == bool:
28
+ typedValue = bool(ctx.OptionValue)
29
+ else:
30
+ RaiseError.BadOptionValueItemType(ctx.OptionName, typeOfValue, bool)
31
+
32
+ assert type(typedValue) == bool
33
+
34
+ if typedValue:
35
+ result = "on"
36
+ else:
37
+ result = "off"
38
+
39
+ return result
40
+
41
+
42
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,51 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from .option_handler_to_write__std__int import OptionHandlerToWrite__Std__Int
7
+ from .option_handler_to_write__std__str import OptionHandlerToWrite__Std__Str
8
+ from .option_handler_to_write__std__bool import OptionHandlerToWrite__Std__Bool
9
+
10
+ from ....handlers import OptionHandlerToWrite
11
+ from ....handlers import OptionHandlerCtxToWrite
12
+
13
+ from ....bugcheck_error import BugCheckError
14
+
15
+ # //////////////////////////////////////////////////////////////////////////////
16
+ # OptionHandlerToWrite__Std__Generic
17
+
18
+
19
+ class OptionHandlerToWrite__Std__Generic(OptionHandlerToWrite):
20
+ # fmt off
21
+ sm_Handler_For_Int = OptionHandlerToWrite__Std__Int()
22
+
23
+ sm_Handler_For_Str = OptionHandlerToWrite__Std__Str()
24
+
25
+ sm_Handler_For_Bool = OptionHandlerToWrite__Std__Bool()
26
+ # fmt on
27
+
28
+ # --------------------------------------------------------------------
29
+ def __init__(self):
30
+ super().__init__()
31
+
32
+ # interface ----------------------------------------------------------
33
+ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str:
34
+ assert type(ctx) == OptionHandlerCtxToWrite
35
+ assert ctx.OptionValue is not None
36
+
37
+ typeOfOptionValue = type(ctx.OptionValue)
38
+
39
+ if typeOfOptionValue == int:
40
+ return __class__.sm_Handler_For_Int.OptionValueToString(ctx)
41
+
42
+ if typeOfOptionValue == str:
43
+ return __class__.sm_Handler_For_Str.OptionValueToString(ctx)
44
+
45
+ if typeOfOptionValue == bool:
46
+ return __class__.sm_Handler_For_Bool.OptionValueToString(ctx)
47
+
48
+ BugCheckError.UnknownOptionValueType(ctx.OptionName, typeOfOptionValue)
49
+
50
+
51
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,27 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToWrite
7
+ from ....handlers import OptionHandlerCtxToWrite
8
+
9
+ # //////////////////////////////////////////////////////////////////////////////
10
+ # OptionHandlerToWrite__Std__Int
11
+
12
+
13
+ class OptionHandlerToWrite__Std__Int(OptionHandlerToWrite):
14
+ def __init__(self):
15
+ super().__init__()
16
+
17
+ # interface ----------------------------------------------------------
18
+ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str:
19
+ assert type(ctx) == OptionHandlerCtxToWrite
20
+ assert ctx.OptionValue is not None
21
+
22
+ typedValue = int(ctx.OptionValue)
23
+
24
+ return str(typedValue)
25
+
26
+
27
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,36 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToWrite
7
+ from ....handlers import OptionHandlerCtxToWrite
8
+
9
+ from ....write_utils import WriteUtils
10
+
11
+ # //////////////////////////////////////////////////////////////////////////////
12
+ # OptionHandlerToWrite__Std__Str
13
+
14
+
15
+ class OptionHandlerToWrite__Std__Str(OptionHandlerToWrite):
16
+ def __init__(self):
17
+ super().__init__()
18
+
19
+ # interface ----------------------------------------------------------
20
+ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str:
21
+ assert type(ctx) == OptionHandlerCtxToWrite
22
+ assert ctx.OptionValue is not None
23
+
24
+ typedValue = str(ctx.OptionValue)
25
+
26
+ result = WriteUtils.Pack_Str(typedValue)
27
+
28
+ assert type(result) == str
29
+ assert len(result) >= 2
30
+ assert result[0] == "'"
31
+ assert result[-1] == "'"
32
+
33
+ return result
34
+
35
+
36
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,37 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ....handlers import OptionHandlerToWrite
7
+ from ....handlers import OptionHandlerCtxToWrite
8
+
9
+ from ....write_utils import WriteUtils
10
+
11
+ # //////////////////////////////////////////////////////////////////////////////
12
+ # OptionHandlerToWrite__Std__UniqueStrList
13
+
14
+
15
+ class OptionHandlerToWrite__Std__UniqueStrList(OptionHandlerToWrite):
16
+ def __init__(self):
17
+ super().__init__()
18
+
19
+ # interface ----------------------------------------------------------
20
+ def OptionValueToString(self, ctx: OptionHandlerCtxToWrite) -> str:
21
+ assert type(ctx) == OptionHandlerCtxToWrite
22
+ assert ctx.OptionValue is not None
23
+ assert type(ctx.OptionValue) == list
24
+
25
+ result = WriteUtils.Pack_StrList2(ctx.OptionValue)
26
+ assert type(result) == str
27
+
28
+ result = WriteUtils.Pack_Str(result)
29
+ assert type(result) == str
30
+ assert len(result) >= 2
31
+ assert result[0] == "'"
32
+ assert result[-1] == "'"
33
+
34
+ return result
35
+
36
+
37
+ # //////////////////////////////////////////////////////////////////////////////