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,154 @@
1
+ # //////////////////////////////////////////////////////////////////////////////
2
+ # Postgres Pro. PostgreSQL Configuration Python Library.
3
+
4
+ from __future__ import annotations
5
+
6
+ from ..abstract import configuration_os_ops as abstract
7
+
8
+ import os
9
+ import io
10
+ import datetime
11
+ import typing
12
+
13
+ # //////////////////////////////////////////////////////////////////////////////
14
+ # class ConfigurationOsFile
15
+
16
+
17
+ class ConfigurationOsFile(abstract.ConfigurationOsFile):
18
+ m_file: io.TextIOWrapper
19
+
20
+ # --------------------------------------------------------------------
21
+ def __init__(self, file: io.TextIOWrapper):
22
+ assert isinstance(file, io.TextIOWrapper)
23
+
24
+ super().__init__()
25
+
26
+ self.m_file = file
27
+
28
+ # --------------------------------------------------------------------
29
+ def __enter__(self) -> ConfigurationOsFile:
30
+ assert isinstance(self.m_file, io.TextIOWrapper)
31
+ return self
32
+
33
+ # --------------------------------------------------------------------
34
+ def __exit__(self, exc_type, exc_val, exc_tb):
35
+ if self.m_file is not None:
36
+ self.Close()
37
+
38
+ assert self.m_file is None
39
+ return
40
+
41
+ # --------------------------------------------------------------------
42
+ @property
43
+ def Name(self) -> str:
44
+ assert isinstance(self.m_file, io.TextIOWrapper)
45
+ return self.m_file.name
46
+
47
+ # --------------------------------------------------------------------
48
+ @property
49
+ def IsClosed(self) -> bool:
50
+ return self.m_file is None
51
+
52
+ # --------------------------------------------------------------------
53
+ def ReadLine(self) -> typing.Optional[str]:
54
+ assert isinstance(self.m_file, io.TextIOWrapper)
55
+ r = self.m_file.readline()
56
+ assert type(r) == str # noqa: E721
57
+ if not r:
58
+ assert r == ""
59
+ return None
60
+
61
+ assert r != ""
62
+ return r
63
+
64
+ # --------------------------------------------------------------------
65
+ def Overwrite(self, text: str) -> None:
66
+ assert type(text) == str # noqa: E721
67
+ assert isinstance(self.m_file, io.TextIOWrapper)
68
+ self.m_file.seek(0)
69
+ self.m_file.write(text)
70
+ self.m_file.truncate()
71
+ self.m_file.flush()
72
+
73
+ # --------------------------------------------------------------------
74
+ def Close(self):
75
+ assert isinstance(self.m_file, io.TextIOWrapper)
76
+ f = self.m_file
77
+ self.m_file = None
78
+ f.close()
79
+ # Returning False (or None) re-raises the exception
80
+ return False
81
+
82
+ # --------------------------------------------------------------------
83
+ def GetModificationTS(self) -> datetime.datetime:
84
+ assert isinstance(self.m_file, io.TextIOWrapper)
85
+
86
+ fd = self.m_file.fileno()
87
+ assert type(fd) == int # noqa: E721
88
+
89
+ lastMDate = datetime.datetime.fromtimestamp(os.path.getmtime(fd))
90
+ assert type(lastMDate) == datetime.datetime # noqa: E721
91
+ return lastMDate
92
+
93
+
94
+ # //////////////////////////////////////////////////////////////////////////////
95
+ # class ConfigurationOsOps
96
+
97
+
98
+ class ConfigurationOsOps(abstract.ConfigurationOsOps):
99
+ def Path_IsAbs(self, a: str) -> bool:
100
+ assert type(a) == str # noqa: E721
101
+ return os.path.isabs(a)
102
+
103
+ def Path_Join(self, a: str, *p: tuple) -> str:
104
+ assert type(a) == str # noqa: E721
105
+ assert type(p) == tuple # noqa: E721
106
+ return os.path.join(a, *p)
107
+
108
+ def Path_NormPath(self, a: str) -> str:
109
+ assert type(a) == str # noqa: E721
110
+ return os.path.normpath(a)
111
+
112
+ def Path_AbsPath(self, a: str) -> str:
113
+ assert type(a) == str # noqa: E721
114
+ return os.path.abspath(a)
115
+
116
+ def Path_NormCase(self, a: str) -> str:
117
+ assert type(a) == str # noqa: E721
118
+ return os.path.normcase(a)
119
+
120
+ def Path_DirName(self, a: str) -> str:
121
+ assert type(a) == str # noqa: E721
122
+ return os.path.dirname(a)
123
+
124
+ def Path_BaseName(self, a: str) -> str:
125
+ assert type(a) == str # noqa: E721
126
+ return os.path.basename(a)
127
+
128
+ def Remove(self, a: str) -> str:
129
+ assert type(a) == str # noqa: E721
130
+ os.remove(a)
131
+
132
+ def OpenFileToRead(self, filePath: str) -> ConfigurationOsFile:
133
+ assert type(filePath) == str # noqa: E721
134
+ f = open(filePath)
135
+ return ConfigurationOsFile(f)
136
+
137
+ def OpenFileToWrite(self, filePath: str) -> ConfigurationOsFile:
138
+ assert type(filePath) == str # noqa: E721
139
+ f = open(filePath, mode="r+")
140
+ return ConfigurationOsFile(f)
141
+
142
+ def CreateFile(self, filePath: str) -> ConfigurationOsFile:
143
+ assert type(filePath) == str # noqa: E721
144
+ f = open(filePath, mode="x")
145
+ return ConfigurationOsFile(f)
146
+
147
+
148
+ # //////////////////////////////////////////////////////////////////////////////
149
+
150
+
151
+ SingleInstance = ConfigurationOsOps()
152
+
153
+
154
+ # //////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: testgres.postgres_configuration
3
+ Version: 0.1.0
4
+ Summary: PostgreSQL Configuration Python Library
5
+ Home-page: https://github.com/postgrespro/testgres.pg_conf
6
+ Author: Postgres Professional
7
+ Author-email: testgres@postgrespro.ru
8
+ License: PostgreSQL
9
+ Keywords: postgresql,postgres,test
10
+ Description-Content-Type: text/markdown
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: home-page
16
+ Dynamic: keywords
17
+ Dynamic: license
18
+ Dynamic: summary
19
+
20
+ [![Build Status](https://app.travis-ci.com/postgrespro/testgres.pg_conf.svg?token=HgEMhyw9n7RCQkHCis4T&branch=master)](https://travis-ci.com/github/postgrespro/testgres.pg_conf)
21
+
22
+ # PostgreSQL Configuration Python Library
23
+
24
+ Class library to work with PostgreSQL configuration files.
25
+
@@ -0,0 +1,40 @@
1
+ testgres/postgres_configuration/__init__.py,sha256=6BRlJwk2ONsbqht4YyKv__AidKmDdB0cQrW3ouCZ7vQ,769
2
+ testgres/postgres_configuration/abstract/v00/configuration.py,sha256=oOIl6RX0vB3HbPlZK_6xMJQHYViC7rl_eTB7sVxQtcY,15832
3
+ testgres/postgres_configuration/core/bugcheck_error.py,sha256=20QK8GNZ_gq8sk4U6mIoHnBSN8OfJEg6U-rIw4OCGA8,7788
4
+ testgres/postgres_configuration/core/controller_utils.py,sha256=peqkBi0PoJ0iNvXkRejp7ctYMID7UU-GPGBkkpa0wX4,35152
5
+ testgres/postgres_configuration/core/data_verificator.py,sha256=G-cogZAEKg-fV3UVcomSVX7OkjyAZ7SeJlPY_u3h7V8,1830
6
+ testgres/postgres_configuration/core/handlers.py,sha256=al7WkaOIw6MLpsCtRqB1Pg87AMXGAyWz_dAuLaNYV5Q,15517
7
+ testgres/postgres_configuration/core/helpers.py,sha256=hXk6QCb482SzNk4Y2L3LyjzLc3uAQtaPrxwuiu2ukY4,2978
8
+ testgres/postgres_configuration/core/model.py,sha256=kJ54bq8Gy5TPKwy8gSN_iMqpip6HAiaLHlm5KxVemqQ,8722
9
+ testgres/postgres_configuration/core/raise_error.py,sha256=KGFib4rrtTAHKQGWjJmhQdDH9wyNL02fSrSU6p1ObDQ,13795
10
+ testgres/postgres_configuration/core/read_utils.py,sha256=60Wz1W1ztd6edXNDoTlGe_MxQ6IUiOJaUq3KDIsDNO4,8743
11
+ testgres/postgres_configuration/core/write_utils.py,sha256=5NnrYmcR2ZkdbbZNimHAWDA4fDTDsSGAZlieaOlOt7c,2864
12
+ testgres/postgres_configuration/core/option/handlers/add/option_handler_to_add__std.py,sha256=PTAAv4sDJHuxFYyidr9UB9U2wk2Pw_gx1uZEDlZ5lgg,1434
13
+ testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__simple.py,sha256=pfmbi-W4QJcjYlU-OvTJFmOZ1V8YG7jkujT6YBxn2BU,1317
14
+ testgres/postgres_configuration/core/option/handlers/get_value/option_handler_to_get_value__std__union_list.py,sha256=qWHgcaS-F2CFDXYoIxF3JT-u-NzwAQTg2cgHVsqeteE,1326
15
+ testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__bool.py,sha256=3C9l3QsACmnj9EV5ZldSXHu8QW_Ub-HjIz_eIffS1dw,1170
16
+ testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__generic.py,sha256=5DUFk9XaE38tFZzMeRUoU2N9A3Pl2PHGZ3ywekdccHU,1473
17
+ testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__int.py,sha256=Tfho8MlQW7o0gAfWbTLKguh9GoRpNAhKmQX1tiDO9Fc,1166
18
+ testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__str.py,sha256=EU_fH4bLlHl4gt7Y2XK4hwDEM4Xz4Ly3j7dsNYZ_t7w,1166
19
+ testgres/postgres_configuration/core/option/handlers/prepare_get_value/option_handler_to_prepare_get_value__std__unique_str_list.py,sha256=guQLqosGCC8zY7xWixwLrnHF9HFmGaxjhVx9__wZjt8,1435
20
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__bool.py,sha256=5a22ImOj2-HXUKCQswrhZid0hgtZCa3ujbabMHEMKtU,3305
21
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__generic.py,sha256=DfjWlwaMxIwKAyekDOXrt-eQyPD8JXLQsvyJP2TR7iQ,1473
22
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__int.py,sha256=jzenPhiEY-woC9UYnA_PRlTxUq517jQHCkOroVv4UvI,1585
23
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__str.py,sha256=xBI8S-lEWzzWzI7Z3F2OZqqlT-GKUI1M-iiHbl5Yu1w,1374
24
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value/option_handler_to_prepare_set_value__std__unique_str_list.py,sha256=_bsIrjiq-75ku-2H1KiVDHnoP9oPlydZgQmTwGWEMkI,2037
25
+ testgres/postgres_configuration/core/option/handlers/prepare_set_value_item/option_handler_to_prepare_set_value_item__std__str.py,sha256=HbJd1kfzl7Gt7lf1N-V-byaw5waRx2VPwDYQU4dPVvo,1422
26
+ testgres/postgres_configuration/core/option/handlers/set_value/option_handler_to_set_value__std__simple.py,sha256=7yawA-A7gF5rpbTKAH01jkC3PKql-36Q_7AdDcfZGYQ,1371
27
+ testgres/postgres_configuration/core/option/handlers/set_value_item/option_handler_to_set_value_item__std__unique.py,sha256=Bouiz7Sf1mKC1biIB_Otw3p4WUQgCfdu_pEG3Ilazk0,1414
28
+ testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__bool.py,sha256=YAO1Bg0nreWSr3EKTuS_LWx7xeGwa3-lnFVkMiY2zN0,1284
29
+ testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__generic.py,sha256=YCGqxFAOmlDoPulkNDbQZ50duIurvy2bRb5XHVricX8,1863
30
+ testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__int.py,sha256=iqs319saa-Bm27jrdZjsWfLv5V75shCHT07VcCraGrA,899
31
+ testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__str.py,sha256=zbAqvSE4fX0AOrM1tso8bbeI9_9vgs7wo8xb1n1b5U4,1113
32
+ testgres/postgres_configuration/core/option/handlers/write/option_handler_to_write__std__unique_str_list.py,sha256=cZ-8mESJg8NLSlJRSZF3s1A3sFqWNoV5JXNlyARW8Ls,1225
33
+ testgres/postgres_configuration/implementation/v00/configuration_base.py,sha256=aW4GlmWaRw7Vf-DmId90sf5PP7wuR1ou2N0AnRJp0s4,165555
34
+ testgres/postgres_configuration/implementation/v00/configuration_std.py,sha256=ohuY-ojSBjHbnKvuy5_gymLVtqsf1vPH5CqCfUIE96M,21886
35
+ testgres/postgres_configuration/os/abstract/configuration_os_ops.py,sha256=7t8fhlkxKQxJz5MVVYQRd6ERltMfil4JPycBRwS6HVw,3386
36
+ testgres/postgres_configuration/os/local/configuration_os_ops.py,sha256=Rse7WaPVfeqD7FMxO2mSgL1nhl3OYQbZqCcOBV3aIQg,4923
37
+ testgres_postgres_configuration-0.1.0.dist-info/METADATA,sha256=3eoIHOGclJCeYpKuSZnkyCJ2h_4Eni9DAivqdYPYFe8,793
38
+ testgres_postgres_configuration-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
+ testgres_postgres_configuration-0.1.0.dist-info/top_level.txt,sha256=h3p7lbyKyHqMCDMOX8sDPwbGh0aJDyJMce5SRkBmKQo,9
40
+ testgres_postgres_configuration-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+