KL-Py 0.0.1__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.
- KL_Py/KL_Py.py +4400 -0
- KL_Py/__init__.py +1 -0
- KL_Py/hindGui/__init__.py +16529 -0
- KL_Py/hindGui/_utils.py +140 -0
- KL_Py/hindGui/elements/base.py +1055 -0
- KL_Py/hindGui/elements/button.py +947 -0
- KL_Py/hindGui/elements/calendar.py +222 -0
- KL_Py/hindGui/elements/canvas.py +122 -0
- KL_Py/hindGui/elements/center.py +44 -0
- KL_Py/hindGui/elements/checkbox.py +240 -0
- KL_Py/hindGui/elements/column.py +443 -0
- KL_Py/hindGui/elements/combo.py +329 -0
- KL_Py/hindGui/elements/error.py +47 -0
- KL_Py/hindGui/elements/frame.py +273 -0
- KL_Py/hindGui/elements/graph.py +817 -0
- KL_Py/hindGui/elements/helpers.py +202 -0
- KL_Py/hindGui/elements/image.py +324 -0
- KL_Py/hindGui/elements/input.py +310 -0
- KL_Py/hindGui/elements/list_box.py +392 -0
- KL_Py/hindGui/elements/menu.py +192 -0
- KL_Py/hindGui/elements/multiline.py +685 -0
- KL_Py/hindGui/elements/option_menu.py +168 -0
- KL_Py/hindGui/elements/pane.py +127 -0
- KL_Py/hindGui/elements/progress_bar.py +304 -0
- KL_Py/hindGui/elements/radio.py +252 -0
- KL_Py/hindGui/elements/separator.py +64 -0
- KL_Py/hindGui/elements/sizegrip.py +34 -0
- KL_Py/hindGui/elements/slider.py +199 -0
- KL_Py/hindGui/elements/spin.py +252 -0
- KL_Py/hindGui/elements/status_bar.py +165 -0
- KL_Py/hindGui/elements/stretch.py +26 -0
- KL_Py/hindGui/elements/tab.py +697 -0
- KL_Py/hindGui/elements/table.py +463 -0
- KL_Py/hindGui/elements/text.py +413 -0
- KL_Py/hindGui/elements/tree.py +493 -0
- KL_Py/hindGui/replace.py +45 -0
- KL_Py/hindGui/tray.py +358 -0
- KL_Py/hindGui/window.py +2906 -0
- KL_Py/requests/__init__.py +184 -0
- KL_Py/requests/__version__.py +14 -0
- KL_Py/requests/_internal_utils.py +50 -0
- KL_Py/requests/adapters.py +719 -0
- KL_Py/requests/api.py +157 -0
- KL_Py/requests/auth.py +314 -0
- KL_Py/requests/certifi/__init__.py +4 -0
- KL_Py/requests/certifi/__main__.py +12 -0
- KL_Py/requests/certifi/core.py +83 -0
- KL_Py/requests/certifi/py.typed +0 -0
- KL_Py/requests/certs.py +17 -0
- KL_Py/requests/charset_normalizer/__init__.py +48 -0
- KL_Py/requests/charset_normalizer/__main__.py +6 -0
- KL_Py/requests/charset_normalizer/api.py +671 -0
- KL_Py/requests/charset_normalizer/cd.py +421 -0
- KL_Py/requests/charset_normalizer/cli/__init__.py +8 -0
- KL_Py/requests/charset_normalizer/cli/__main__.py +363 -0
- KL_Py/requests/charset_normalizer/constant.py +2031 -0
- KL_Py/requests/charset_normalizer/legacy.py +80 -0
- KL_Py/requests/charset_normalizer/md.py +744 -0
- KL_Py/requests/charset_normalizer/models.py +359 -0
- KL_Py/requests/charset_normalizer/py.typed +0 -0
- KL_Py/requests/charset_normalizer/utils.py +420 -0
- KL_Py/requests/charset_normalizer/version.py +8 -0
- KL_Py/requests/compat.py +106 -0
- KL_Py/requests/cookies.py +561 -0
- KL_Py/requests/exceptions.py +151 -0
- KL_Py/requests/help.py +134 -0
- KL_Py/requests/hooks.py +33 -0
- KL_Py/requests/idna/__init__.py +45 -0
- KL_Py/requests/idna/codec.py +122 -0
- KL_Py/requests/idna/compat.py +15 -0
- KL_Py/requests/idna/core.py +437 -0
- KL_Py/requests/idna/idnadata.py +4309 -0
- KL_Py/requests/idna/intranges.py +57 -0
- KL_Py/requests/idna/package_data.py +1 -0
- KL_Py/requests/idna/py.typed +0 -0
- KL_Py/requests/idna/uts46data.py +8841 -0
- KL_Py/requests/models.py +1039 -0
- KL_Py/requests/packages.py +23 -0
- KL_Py/requests/sessions.py +831 -0
- KL_Py/requests/status_codes.py +128 -0
- KL_Py/requests/structures.py +99 -0
- KL_Py/requests/urllib3/__init__.py +211 -0
- KL_Py/requests/urllib3/_base_connection.py +165 -0
- KL_Py/requests/urllib3/_collections.py +487 -0
- KL_Py/requests/urllib3/_request_methods.py +278 -0
- KL_Py/requests/urllib3/_version.py +34 -0
- KL_Py/requests/urllib3/connection.py +1099 -0
- KL_Py/requests/urllib3/connectionpool.py +1178 -0
- KL_Py/requests/urllib3/contrib/__init__.py +0 -0
- KL_Py/requests/urllib3/contrib/emscripten/__init__.py +17 -0
- KL_Py/requests/urllib3/contrib/emscripten/connection.py +260 -0
- KL_Py/requests/urllib3/contrib/emscripten/fetch.py +726 -0
- KL_Py/requests/urllib3/contrib/emscripten/request.py +22 -0
- KL_Py/requests/urllib3/contrib/emscripten/response.py +277 -0
- KL_Py/requests/urllib3/contrib/pyopenssl.py +564 -0
- KL_Py/requests/urllib3/contrib/socks.py +228 -0
- KL_Py/requests/urllib3/exceptions.py +335 -0
- KL_Py/requests/urllib3/fields.py +341 -0
- KL_Py/requests/urllib3/filepost.py +89 -0
- KL_Py/requests/urllib3/http2/__init__.py +53 -0
- KL_Py/requests/urllib3/http2/connection.py +356 -0
- KL_Py/requests/urllib3/http2/probe.py +87 -0
- KL_Py/requests/urllib3/poolmanager.py +651 -0
- KL_Py/requests/urllib3/py.typed +2 -0
- KL_Py/requests/urllib3/response.py +1480 -0
- KL_Py/requests/urllib3/util/__init__.py +42 -0
- KL_Py/requests/urllib3/util/connection.py +137 -0
- KL_Py/requests/urllib3/util/proxy.py +43 -0
- KL_Py/requests/urllib3/util/request.py +263 -0
- KL_Py/requests/urllib3/util/response.py +101 -0
- KL_Py/requests/urllib3/util/retry.py +549 -0
- KL_Py/requests/urllib3/util/ssl_.py +527 -0
- KL_Py/requests/urllib3/util/ssl_match_hostname.py +159 -0
- KL_Py/requests/urllib3/util/ssltransport.py +271 -0
- KL_Py/requests/urllib3/util/timeout.py +275 -0
- KL_Py/requests/urllib3/util/url.py +469 -0
- KL_Py/requests/urllib3/util/util.py +42 -0
- KL_Py/requests/urllib3/util/wait.py +124 -0
- KL_Py/requests/utils.py +1086 -0
- KL_Py/when.py +144 -0
- kl_py-0.0.1.dist-info/METADATA +15 -0
- kl_py-0.0.1.dist-info/RECORD +125 -0
- kl_py-0.0.1.dist-info/WHEEL +5 -0
- kl_py-0.0.1.dist-info/licenses/LICENSE +21 -0
- kl_py-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import urllib3.connection
|
|
4
|
+
|
|
5
|
+
from ...connectionpool import HTTPConnectionPool, HTTPSConnectionPool
|
|
6
|
+
from .connection import EmscriptenHTTPConnection, EmscriptenHTTPSConnection
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def inject_into_urllib3() -> None:
|
|
10
|
+
# override connection classes to use emscripten specific classes
|
|
11
|
+
# n.b. mypy complains about the overriding of classes below
|
|
12
|
+
# if it isn't ignored
|
|
13
|
+
HTTPConnectionPool.ConnectionCls = EmscriptenHTTPConnection
|
|
14
|
+
HTTPSConnectionPool.ConnectionCls = EmscriptenHTTPSConnection
|
|
15
|
+
urllib3.connection.HTTPConnection = EmscriptenHTTPConnection # type: ignore[misc,assignment]
|
|
16
|
+
urllib3.connection.HTTPSConnection = EmscriptenHTTPSConnection # type: ignore[misc,assignment]
|
|
17
|
+
urllib3.connection.VerifiedHTTPSConnection = EmscriptenHTTPSConnection # type: ignore[assignment]
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
# use http.client.HTTPException for consistency with non-emscripten
|
|
7
|
+
from http.client import HTTPException as HTTPException # noqa: F401
|
|
8
|
+
from http.client import ResponseNotReady
|
|
9
|
+
|
|
10
|
+
from ..._base_connection import _TYPE_BODY
|
|
11
|
+
from ...connection import HTTPConnection, ProxyConfig, port_by_scheme
|
|
12
|
+
from ...exceptions import TimeoutError
|
|
13
|
+
from ...response import BaseHTTPResponse
|
|
14
|
+
from ...util.connection import _TYPE_SOCKET_OPTIONS
|
|
15
|
+
from ...util.timeout import _DEFAULT_TIMEOUT, _TYPE_TIMEOUT
|
|
16
|
+
from ...util.url import Url
|
|
17
|
+
from .fetch import _RequestError, _TimeoutError, send_request, send_streaming_request
|
|
18
|
+
from .request import EmscriptenRequest
|
|
19
|
+
from .response import EmscriptenHttpResponseWrapper, EmscriptenResponse
|
|
20
|
+
|
|
21
|
+
if typing.TYPE_CHECKING:
|
|
22
|
+
from ..._base_connection import BaseHTTPConnection, BaseHTTPSConnection
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class EmscriptenHTTPConnection:
|
|
26
|
+
default_port: typing.ClassVar[int] = port_by_scheme["http"]
|
|
27
|
+
default_socket_options: typing.ClassVar[_TYPE_SOCKET_OPTIONS]
|
|
28
|
+
|
|
29
|
+
timeout: None | (float)
|
|
30
|
+
|
|
31
|
+
host: str
|
|
32
|
+
port: int
|
|
33
|
+
blocksize: int
|
|
34
|
+
source_address: tuple[str, int] | None
|
|
35
|
+
socket_options: _TYPE_SOCKET_OPTIONS | None
|
|
36
|
+
|
|
37
|
+
proxy: Url | None
|
|
38
|
+
proxy_config: ProxyConfig | None
|
|
39
|
+
|
|
40
|
+
is_verified: bool = False
|
|
41
|
+
proxy_is_verified: bool | None = None
|
|
42
|
+
|
|
43
|
+
response_class: type[BaseHTTPResponse] = EmscriptenHttpResponseWrapper
|
|
44
|
+
_response: EmscriptenResponse | None
|
|
45
|
+
|
|
46
|
+
def __init__(
|
|
47
|
+
self,
|
|
48
|
+
host: str,
|
|
49
|
+
port: int = 0,
|
|
50
|
+
*,
|
|
51
|
+
timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT,
|
|
52
|
+
source_address: tuple[str, int] | None = None,
|
|
53
|
+
blocksize: int = 8192,
|
|
54
|
+
socket_options: _TYPE_SOCKET_OPTIONS | None = None,
|
|
55
|
+
proxy: Url | None = None,
|
|
56
|
+
proxy_config: ProxyConfig | None = None,
|
|
57
|
+
) -> None:
|
|
58
|
+
self.host = host
|
|
59
|
+
self.port = port
|
|
60
|
+
self.timeout = timeout if isinstance(timeout, float) else 0.0
|
|
61
|
+
self.scheme = "http"
|
|
62
|
+
self._closed = True
|
|
63
|
+
self._response = None
|
|
64
|
+
# ignore these things because we don't
|
|
65
|
+
# have control over that stuff
|
|
66
|
+
self.proxy = None
|
|
67
|
+
self.proxy_config = None
|
|
68
|
+
self.blocksize = blocksize
|
|
69
|
+
self.source_address = None
|
|
70
|
+
self.socket_options = None
|
|
71
|
+
self.is_verified = False
|
|
72
|
+
|
|
73
|
+
def set_tunnel(
|
|
74
|
+
self,
|
|
75
|
+
host: str,
|
|
76
|
+
port: int | None = 0,
|
|
77
|
+
headers: typing.Mapping[str, str] | None = None,
|
|
78
|
+
scheme: str = "http",
|
|
79
|
+
) -> None:
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
def connect(self) -> None:
|
|
83
|
+
pass
|
|
84
|
+
|
|
85
|
+
def request(
|
|
86
|
+
self,
|
|
87
|
+
method: str,
|
|
88
|
+
url: str,
|
|
89
|
+
body: _TYPE_BODY | None = None,
|
|
90
|
+
headers: typing.Mapping[str, str] | None = None,
|
|
91
|
+
# We know *at least* botocore is depending on the order of the
|
|
92
|
+
# first 3 parameters so to be safe we only mark the later ones
|
|
93
|
+
# as keyword-only to ensure we have space to extend.
|
|
94
|
+
*,
|
|
95
|
+
chunked: bool = False,
|
|
96
|
+
preload_content: bool = True,
|
|
97
|
+
decode_content: bool = True,
|
|
98
|
+
enforce_content_length: bool = True,
|
|
99
|
+
) -> None:
|
|
100
|
+
self._closed = False
|
|
101
|
+
if url.startswith("/"):
|
|
102
|
+
if self.port is not None:
|
|
103
|
+
port = f":{self.port}"
|
|
104
|
+
else:
|
|
105
|
+
port = ""
|
|
106
|
+
# no scheme / host / port included, make a full url
|
|
107
|
+
url = f"{self.scheme}://{self.host}{port}{url}"
|
|
108
|
+
request = EmscriptenRequest(
|
|
109
|
+
url=url,
|
|
110
|
+
method=method,
|
|
111
|
+
timeout=self.timeout if self.timeout else 0,
|
|
112
|
+
decode_content=decode_content,
|
|
113
|
+
)
|
|
114
|
+
request.set_body(body)
|
|
115
|
+
if headers:
|
|
116
|
+
for k, v in headers.items():
|
|
117
|
+
request.set_header(k, v)
|
|
118
|
+
self._response = None
|
|
119
|
+
try:
|
|
120
|
+
if not preload_content:
|
|
121
|
+
self._response = send_streaming_request(request)
|
|
122
|
+
if self._response is None:
|
|
123
|
+
self._response = send_request(request)
|
|
124
|
+
except _TimeoutError as e:
|
|
125
|
+
raise TimeoutError(e.message) from e
|
|
126
|
+
except _RequestError as e:
|
|
127
|
+
raise HTTPException(e.message) from e
|
|
128
|
+
|
|
129
|
+
def getresponse(self) -> BaseHTTPResponse:
|
|
130
|
+
if self._response is not None:
|
|
131
|
+
return EmscriptenHttpResponseWrapper(
|
|
132
|
+
internal_response=self._response,
|
|
133
|
+
url=self._response.request.url,
|
|
134
|
+
connection=self,
|
|
135
|
+
)
|
|
136
|
+
else:
|
|
137
|
+
raise ResponseNotReady()
|
|
138
|
+
|
|
139
|
+
def close(self) -> None:
|
|
140
|
+
self._closed = True
|
|
141
|
+
self._response = None
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def is_closed(self) -> bool:
|
|
145
|
+
"""Whether the connection either is brand new or has been previously closed.
|
|
146
|
+
If this property is True then both ``is_connected`` and ``has_connected_to_proxy``
|
|
147
|
+
properties must be False.
|
|
148
|
+
"""
|
|
149
|
+
return self._closed
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def is_connected(self) -> bool:
|
|
153
|
+
"""Whether the connection is actively connected to any origin (proxy or target)"""
|
|
154
|
+
return True
|
|
155
|
+
|
|
156
|
+
@property
|
|
157
|
+
def has_connected_to_proxy(self) -> bool:
|
|
158
|
+
"""Whether the connection has successfully connected to its proxy.
|
|
159
|
+
This returns False if no proxy is in use. Used to determine whether
|
|
160
|
+
errors are coming from the proxy layer or from tunnelling to the target origin.
|
|
161
|
+
"""
|
|
162
|
+
return False
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class EmscriptenHTTPSConnection(EmscriptenHTTPConnection):
|
|
166
|
+
default_port = port_by_scheme["https"]
|
|
167
|
+
# all this is basically ignored, as browser handles https
|
|
168
|
+
cert_reqs: int | str | None = None
|
|
169
|
+
ca_certs: str | None = None
|
|
170
|
+
ca_cert_dir: str | None = None
|
|
171
|
+
ca_cert_data: None | str | bytes = None
|
|
172
|
+
cert_file: str | None
|
|
173
|
+
key_file: str | None
|
|
174
|
+
key_password: str | None
|
|
175
|
+
ssl_context: typing.Any | None
|
|
176
|
+
ssl_version: int | str | None = None
|
|
177
|
+
ssl_minimum_version: int | None = None
|
|
178
|
+
ssl_maximum_version: int | None = None
|
|
179
|
+
assert_hostname: None | str | typing.Literal[False]
|
|
180
|
+
assert_fingerprint: str | None = None
|
|
181
|
+
|
|
182
|
+
def __init__(
|
|
183
|
+
self,
|
|
184
|
+
host: str,
|
|
185
|
+
port: int = 0,
|
|
186
|
+
*,
|
|
187
|
+
timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT,
|
|
188
|
+
source_address: tuple[str, int] | None = None,
|
|
189
|
+
blocksize: int = 16384,
|
|
190
|
+
socket_options: (
|
|
191
|
+
None | _TYPE_SOCKET_OPTIONS
|
|
192
|
+
) = HTTPConnection.default_socket_options,
|
|
193
|
+
proxy: Url | None = None,
|
|
194
|
+
proxy_config: ProxyConfig | None = None,
|
|
195
|
+
cert_reqs: int | str | None = None,
|
|
196
|
+
assert_hostname: None | str | typing.Literal[False] = None,
|
|
197
|
+
assert_fingerprint: str | None = None,
|
|
198
|
+
server_hostname: str | None = None,
|
|
199
|
+
ssl_context: typing.Any | None = None,
|
|
200
|
+
ca_certs: str | None = None,
|
|
201
|
+
ca_cert_dir: str | None = None,
|
|
202
|
+
ca_cert_data: None | str | bytes = None,
|
|
203
|
+
ssl_minimum_version: int | None = None,
|
|
204
|
+
ssl_maximum_version: int | None = None,
|
|
205
|
+
ssl_version: int | str | None = None, # Deprecated
|
|
206
|
+
cert_file: str | None = None,
|
|
207
|
+
key_file: str | None = None,
|
|
208
|
+
key_password: str | None = None,
|
|
209
|
+
) -> None:
|
|
210
|
+
super().__init__(
|
|
211
|
+
host,
|
|
212
|
+
port=port,
|
|
213
|
+
timeout=timeout,
|
|
214
|
+
source_address=source_address,
|
|
215
|
+
blocksize=blocksize,
|
|
216
|
+
socket_options=socket_options,
|
|
217
|
+
proxy=proxy,
|
|
218
|
+
proxy_config=proxy_config,
|
|
219
|
+
)
|
|
220
|
+
self.scheme = "https"
|
|
221
|
+
|
|
222
|
+
self.key_file = key_file
|
|
223
|
+
self.cert_file = cert_file
|
|
224
|
+
self.key_password = key_password
|
|
225
|
+
self.ssl_context = ssl_context
|
|
226
|
+
self.server_hostname = server_hostname
|
|
227
|
+
self.assert_hostname = assert_hostname
|
|
228
|
+
self.assert_fingerprint = assert_fingerprint
|
|
229
|
+
self.ssl_version = ssl_version
|
|
230
|
+
self.ssl_minimum_version = ssl_minimum_version
|
|
231
|
+
self.ssl_maximum_version = ssl_maximum_version
|
|
232
|
+
self.ca_certs = ca_certs and os.path.expanduser(ca_certs)
|
|
233
|
+
self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir)
|
|
234
|
+
self.ca_cert_data = ca_cert_data
|
|
235
|
+
|
|
236
|
+
self.cert_reqs = None
|
|
237
|
+
|
|
238
|
+
# The browser will automatically verify all requests.
|
|
239
|
+
# We have no control over that setting.
|
|
240
|
+
self.is_verified = True
|
|
241
|
+
|
|
242
|
+
def set_cert(
|
|
243
|
+
self,
|
|
244
|
+
key_file: str | None = None,
|
|
245
|
+
cert_file: str | None = None,
|
|
246
|
+
cert_reqs: int | str | None = None,
|
|
247
|
+
key_password: str | None = None,
|
|
248
|
+
ca_certs: str | None = None,
|
|
249
|
+
assert_hostname: None | str | typing.Literal[False] = None,
|
|
250
|
+
assert_fingerprint: str | None = None,
|
|
251
|
+
ca_cert_dir: str | None = None,
|
|
252
|
+
ca_cert_data: None | str | bytes = None,
|
|
253
|
+
) -> None:
|
|
254
|
+
pass
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# verify that this class implements BaseHTTP(s) connection correctly
|
|
258
|
+
if typing.TYPE_CHECKING:
|
|
259
|
+
_supports_http_protocol: BaseHTTPConnection = EmscriptenHTTPConnection("", 0)
|
|
260
|
+
_supports_https_protocol: BaseHTTPSConnection = EmscriptenHTTPSConnection("", 0)
|