PyGreSQL 6.3.0b1__cp315-cp315-win_amd64.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.
pg/core.py ADDED
@@ -0,0 +1,180 @@
1
+ """Core functionality from extension module."""
2
+
3
+ try:
4
+ from ._pg import version
5
+ except ImportError as e: # noqa: F841 # pragma: no cover
6
+ import os
7
+ libpq = 'libpq.'
8
+ if os.name == 'nt':
9
+ libpq += 'dll'
10
+ paths = [path for path in os.environ["PATH"].split(os.pathsep)
11
+ if os.path.exists(os.path.join(path, libpq))]
12
+ # see https://docs.python.org/3/whatsnew/3.8.html#ctypes
13
+ add_dll_dir = os.add_dll_directory # type: ignore[attr-defined]
14
+ for path in paths:
15
+ with add_dll_dir(os.path.abspath(path)):
16
+ try:
17
+ from ._pg import version
18
+ except ImportError:
19
+ pass
20
+ else:
21
+ del version
22
+ e = None # type: ignore[assignment]
23
+ break
24
+ if paths:
25
+ libpq = 'compatible ' + libpq
26
+ else:
27
+ libpq += 'so'
28
+ if e:
29
+ raise ImportError(
30
+ "Cannot import shared library for PyGreSQL,\n"
31
+ f"probably because no {libpq} is installed.\n{e}") from e
32
+ else:
33
+ del version
34
+
35
+ # import objects from extension module
36
+ from ._pg import (
37
+ INV_READ,
38
+ INV_WRITE,
39
+ POLLING_FAILED,
40
+ POLLING_OK,
41
+ POLLING_READING,
42
+ POLLING_WRITING,
43
+ RESULT_DDL,
44
+ RESULT_DML,
45
+ RESULT_DQL,
46
+ RESULT_EMPTY,
47
+ SEEK_CUR,
48
+ SEEK_END,
49
+ SEEK_SET,
50
+ TRANS_ACTIVE,
51
+ TRANS_IDLE,
52
+ TRANS_INERROR,
53
+ TRANS_INTRANS,
54
+ TRANS_UNKNOWN,
55
+ ConnectError,
56
+ Connection,
57
+ DatabaseError,
58
+ DataError,
59
+ Error,
60
+ IntegrityError,
61
+ InterfaceError,
62
+ InternalError,
63
+ InvalidResultError,
64
+ LargeObject,
65
+ MultipleResultsError,
66
+ NoResultError,
67
+ NotSupportedError,
68
+ OperationalError,
69
+ ProgrammingError,
70
+ Query,
71
+ Warning,
72
+ cast_array,
73
+ cast_hstore,
74
+ cast_record,
75
+ connect,
76
+ escape_bytea,
77
+ escape_string,
78
+ get_array,
79
+ get_bool,
80
+ get_bytea_escaped,
81
+ get_datestyle,
82
+ get_decimal,
83
+ get_decimal_point,
84
+ get_defbase,
85
+ get_defhost,
86
+ get_defopt,
87
+ get_defport,
88
+ get_defuser,
89
+ get_jsondecode,
90
+ get_pqlib_version,
91
+ set_array,
92
+ set_bool,
93
+ set_bytea_escaped,
94
+ set_datestyle,
95
+ set_decimal,
96
+ set_decimal_point,
97
+ set_defbase,
98
+ set_defhost,
99
+ set_defopt,
100
+ set_defpasswd,
101
+ set_defport,
102
+ set_defuser,
103
+ set_jsondecode,
104
+ set_query_helpers,
105
+ unescape_bytea,
106
+ version,
107
+ )
108
+
109
+ __all__ = [
110
+ 'INV_READ',
111
+ 'INV_WRITE',
112
+ 'POLLING_FAILED',
113
+ 'POLLING_OK',
114
+ 'POLLING_READING',
115
+ 'POLLING_WRITING',
116
+ 'RESULT_DDL',
117
+ 'RESULT_DML',
118
+ 'RESULT_DQL',
119
+ 'RESULT_EMPTY',
120
+ 'SEEK_CUR',
121
+ 'SEEK_END',
122
+ 'SEEK_SET',
123
+ 'TRANS_ACTIVE',
124
+ 'TRANS_IDLE',
125
+ 'TRANS_INERROR',
126
+ 'TRANS_INTRANS',
127
+ 'TRANS_UNKNOWN',
128
+ 'ConnectError',
129
+ 'Connection',
130
+ 'DataError',
131
+ 'DatabaseError',
132
+ 'Error',
133
+ 'IntegrityError',
134
+ 'InterfaceError',
135
+ 'InternalError',
136
+ 'InvalidResultError',
137
+ 'LargeObject',
138
+ 'MultipleResultsError',
139
+ 'NoResultError',
140
+ 'NotSupportedError',
141
+ 'OperationalError',
142
+ 'ProgrammingError',
143
+ 'Query',
144
+ 'Warning',
145
+ 'cast_array',
146
+ 'cast_hstore',
147
+ 'cast_record',
148
+ 'connect',
149
+ 'escape_bytea',
150
+ 'escape_string',
151
+ 'get_array',
152
+ 'get_bool',
153
+ 'get_bytea_escaped',
154
+ 'get_datestyle',
155
+ 'get_decimal',
156
+ 'get_decimal_point',
157
+ 'get_defbase',
158
+ 'get_defhost',
159
+ 'get_defopt',
160
+ 'get_defport',
161
+ 'get_defuser',
162
+ 'get_jsondecode',
163
+ 'get_pqlib_version',
164
+ 'set_array',
165
+ 'set_bool',
166
+ 'set_bytea_escaped',
167
+ 'set_datestyle',
168
+ 'set_decimal',
169
+ 'set_decimal_point',
170
+ 'set_defbase',
171
+ 'set_defhost',
172
+ 'set_defopt',
173
+ 'set_defpasswd',
174
+ 'set_defport',
175
+ 'set_defuser',
176
+ 'set_jsondecode',
177
+ 'set_query_helpers',
178
+ 'unescape_bytea',
179
+ 'version',
180
+ ]