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
KL_Py/requests/help.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""Module containing bug report helper(s)."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import platform
|
|
5
|
+
import ssl
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
import idna
|
|
9
|
+
import urllib3
|
|
10
|
+
|
|
11
|
+
from . import __version__ as requests_version
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
import charset_normalizer
|
|
15
|
+
except ImportError:
|
|
16
|
+
charset_normalizer = None
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
import chardet
|
|
20
|
+
except ImportError:
|
|
21
|
+
chardet = None
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
from urllib3.contrib import pyopenssl
|
|
25
|
+
except ImportError:
|
|
26
|
+
pyopenssl = None
|
|
27
|
+
OpenSSL = None
|
|
28
|
+
cryptography = None
|
|
29
|
+
else:
|
|
30
|
+
import cryptography
|
|
31
|
+
import OpenSSL
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _implementation():
|
|
35
|
+
"""Return a dict with the Python implementation and version.
|
|
36
|
+
|
|
37
|
+
Provide both the name and the version of the Python implementation
|
|
38
|
+
currently running. For example, on CPython 3.10.3 it will return
|
|
39
|
+
{'name': 'CPython', 'version': '3.10.3'}.
|
|
40
|
+
|
|
41
|
+
This function works best on CPython and PyPy: in particular, it probably
|
|
42
|
+
doesn't work for Jython or IronPython. Future investigation should be done
|
|
43
|
+
to work out the correct shape of the code for those platforms.
|
|
44
|
+
"""
|
|
45
|
+
implementation = platform.python_implementation()
|
|
46
|
+
|
|
47
|
+
if implementation == "CPython":
|
|
48
|
+
implementation_version = platform.python_version()
|
|
49
|
+
elif implementation == "PyPy":
|
|
50
|
+
implementation_version = "{}.{}.{}".format(
|
|
51
|
+
sys.pypy_version_info.major,
|
|
52
|
+
sys.pypy_version_info.minor,
|
|
53
|
+
sys.pypy_version_info.micro,
|
|
54
|
+
)
|
|
55
|
+
if sys.pypy_version_info.releaselevel != "final":
|
|
56
|
+
implementation_version = "".join(
|
|
57
|
+
[implementation_version, sys.pypy_version_info.releaselevel]
|
|
58
|
+
)
|
|
59
|
+
elif implementation == "Jython":
|
|
60
|
+
implementation_version = platform.python_version() # Complete Guess
|
|
61
|
+
elif implementation == "IronPython":
|
|
62
|
+
implementation_version = platform.python_version() # Complete Guess
|
|
63
|
+
else:
|
|
64
|
+
implementation_version = "Unknown"
|
|
65
|
+
|
|
66
|
+
return {"name": implementation, "version": implementation_version}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def info():
|
|
70
|
+
"""Generate information for a bug report."""
|
|
71
|
+
try:
|
|
72
|
+
platform_info = {
|
|
73
|
+
"system": platform.system(),
|
|
74
|
+
"release": platform.release(),
|
|
75
|
+
}
|
|
76
|
+
except OSError:
|
|
77
|
+
platform_info = {
|
|
78
|
+
"system": "Unknown",
|
|
79
|
+
"release": "Unknown",
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
implementation_info = _implementation()
|
|
83
|
+
urllib3_info = {"version": urllib3.__version__}
|
|
84
|
+
charset_normalizer_info = {"version": None}
|
|
85
|
+
chardet_info = {"version": None}
|
|
86
|
+
if charset_normalizer:
|
|
87
|
+
charset_normalizer_info = {"version": charset_normalizer.__version__}
|
|
88
|
+
if chardet:
|
|
89
|
+
chardet_info = {"version": chardet.__version__}
|
|
90
|
+
|
|
91
|
+
pyopenssl_info = {
|
|
92
|
+
"version": None,
|
|
93
|
+
"openssl_version": "",
|
|
94
|
+
}
|
|
95
|
+
if OpenSSL:
|
|
96
|
+
pyopenssl_info = {
|
|
97
|
+
"version": OpenSSL.__version__,
|
|
98
|
+
"openssl_version": f"{OpenSSL.SSL.OPENSSL_VERSION_NUMBER:x}",
|
|
99
|
+
}
|
|
100
|
+
cryptography_info = {
|
|
101
|
+
"version": getattr(cryptography, "__version__", ""),
|
|
102
|
+
}
|
|
103
|
+
idna_info = {
|
|
104
|
+
"version": getattr(idna, "__version__", ""),
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
system_ssl = ssl.OPENSSL_VERSION_NUMBER
|
|
108
|
+
system_ssl_info = {"version": f"{system_ssl:x}" if system_ssl is not None else ""}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
"platform": platform_info,
|
|
112
|
+
"implementation": implementation_info,
|
|
113
|
+
"system_ssl": system_ssl_info,
|
|
114
|
+
"using_pyopenssl": pyopenssl is not None,
|
|
115
|
+
"using_charset_normalizer": chardet is None,
|
|
116
|
+
"pyOpenSSL": pyopenssl_info,
|
|
117
|
+
"urllib3": urllib3_info,
|
|
118
|
+
"chardet": chardet_info,
|
|
119
|
+
"charset_normalizer": charset_normalizer_info,
|
|
120
|
+
"cryptography": cryptography_info,
|
|
121
|
+
"idna": idna_info,
|
|
122
|
+
"requests": {
|
|
123
|
+
"version": requests_version,
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def main():
|
|
129
|
+
"""Pretty-print the bug information as JSON."""
|
|
130
|
+
print(json.dumps(info(), sort_keys=True, indent=2))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if __name__ == "__main__":
|
|
134
|
+
main()
|
KL_Py/requests/hooks.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
requests.hooks
|
|
3
|
+
~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
This module provides the capabilities for the Requests hooks system.
|
|
6
|
+
|
|
7
|
+
Available hooks:
|
|
8
|
+
|
|
9
|
+
``response``:
|
|
10
|
+
The response generated from a Request.
|
|
11
|
+
"""
|
|
12
|
+
HOOKS = ["response"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def default_hooks():
|
|
16
|
+
return {event: [] for event in HOOKS}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# TODO: response is the only one
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def dispatch_hook(key, hooks, hook_data, **kwargs):
|
|
23
|
+
"""Dispatches a hook dictionary on a given piece of data."""
|
|
24
|
+
hooks = hooks or {}
|
|
25
|
+
hooks = hooks.get(key)
|
|
26
|
+
if hooks:
|
|
27
|
+
if hasattr(hooks, "__call__"):
|
|
28
|
+
hooks = [hooks]
|
|
29
|
+
for hook in hooks:
|
|
30
|
+
_hook_data = hook(hook_data, **kwargs)
|
|
31
|
+
if _hook_data is not None:
|
|
32
|
+
hook_data = _hook_data
|
|
33
|
+
return hook_data
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from .core import (
|
|
2
|
+
IDNABidiError,
|
|
3
|
+
IDNAError,
|
|
4
|
+
InvalidCodepoint,
|
|
5
|
+
InvalidCodepointContext,
|
|
6
|
+
alabel,
|
|
7
|
+
check_bidi,
|
|
8
|
+
check_hyphen_ok,
|
|
9
|
+
check_initial_combiner,
|
|
10
|
+
check_label,
|
|
11
|
+
check_nfc,
|
|
12
|
+
decode,
|
|
13
|
+
encode,
|
|
14
|
+
ulabel,
|
|
15
|
+
uts46_remap,
|
|
16
|
+
valid_contextj,
|
|
17
|
+
valid_contexto,
|
|
18
|
+
valid_label_length,
|
|
19
|
+
valid_string_length,
|
|
20
|
+
)
|
|
21
|
+
from .intranges import intranges_contain
|
|
22
|
+
from .package_data import __version__
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"__version__",
|
|
26
|
+
"IDNABidiError",
|
|
27
|
+
"IDNAError",
|
|
28
|
+
"InvalidCodepoint",
|
|
29
|
+
"InvalidCodepointContext",
|
|
30
|
+
"alabel",
|
|
31
|
+
"check_bidi",
|
|
32
|
+
"check_hyphen_ok",
|
|
33
|
+
"check_initial_combiner",
|
|
34
|
+
"check_label",
|
|
35
|
+
"check_nfc",
|
|
36
|
+
"decode",
|
|
37
|
+
"encode",
|
|
38
|
+
"intranges_contain",
|
|
39
|
+
"ulabel",
|
|
40
|
+
"uts46_remap",
|
|
41
|
+
"valid_contextj",
|
|
42
|
+
"valid_contexto",
|
|
43
|
+
"valid_label_length",
|
|
44
|
+
"valid_string_length",
|
|
45
|
+
]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import codecs
|
|
2
|
+
import re
|
|
3
|
+
from typing import Any, Optional, Tuple
|
|
4
|
+
|
|
5
|
+
from .core import IDNAError, alabel, decode, encode, ulabel
|
|
6
|
+
|
|
7
|
+
_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Codec(codecs.Codec):
|
|
11
|
+
def encode(self, data: str, errors: str = "strict") -> Tuple[bytes, int]:
|
|
12
|
+
if errors != "strict":
|
|
13
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
14
|
+
|
|
15
|
+
if not data:
|
|
16
|
+
return b"", 0
|
|
17
|
+
|
|
18
|
+
return encode(data), len(data)
|
|
19
|
+
|
|
20
|
+
def decode(self, data: bytes, errors: str = "strict") -> Tuple[str, int]:
|
|
21
|
+
if errors != "strict":
|
|
22
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
23
|
+
|
|
24
|
+
if not data:
|
|
25
|
+
return "", 0
|
|
26
|
+
|
|
27
|
+
return decode(data), len(data)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
|
|
31
|
+
def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, int]:
|
|
32
|
+
if errors != "strict":
|
|
33
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
34
|
+
|
|
35
|
+
if not data:
|
|
36
|
+
return b"", 0
|
|
37
|
+
|
|
38
|
+
labels = _unicode_dots_re.split(data)
|
|
39
|
+
trailing_dot = b""
|
|
40
|
+
if labels:
|
|
41
|
+
if not labels[-1]:
|
|
42
|
+
trailing_dot = b"."
|
|
43
|
+
del labels[-1]
|
|
44
|
+
elif not final:
|
|
45
|
+
# Keep potentially unfinished label until the next call
|
|
46
|
+
del labels[-1]
|
|
47
|
+
if labels:
|
|
48
|
+
trailing_dot = b"."
|
|
49
|
+
|
|
50
|
+
result = []
|
|
51
|
+
size = 0
|
|
52
|
+
for label in labels:
|
|
53
|
+
result.append(alabel(label))
|
|
54
|
+
if size:
|
|
55
|
+
size += 1
|
|
56
|
+
size += len(label)
|
|
57
|
+
|
|
58
|
+
# Join with U+002E
|
|
59
|
+
result_bytes = b".".join(result) + trailing_dot
|
|
60
|
+
size += len(trailing_dot)
|
|
61
|
+
return result_bytes, size
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
|
65
|
+
def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]:
|
|
66
|
+
if errors != "strict":
|
|
67
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
68
|
+
|
|
69
|
+
if not data:
|
|
70
|
+
return ("", 0)
|
|
71
|
+
|
|
72
|
+
if not isinstance(data, str):
|
|
73
|
+
data = str(data, "ascii")
|
|
74
|
+
|
|
75
|
+
labels = _unicode_dots_re.split(data)
|
|
76
|
+
trailing_dot = ""
|
|
77
|
+
if labels:
|
|
78
|
+
if not labels[-1]:
|
|
79
|
+
trailing_dot = "."
|
|
80
|
+
del labels[-1]
|
|
81
|
+
elif not final:
|
|
82
|
+
# Keep potentially unfinished label until the next call
|
|
83
|
+
del labels[-1]
|
|
84
|
+
if labels:
|
|
85
|
+
trailing_dot = "."
|
|
86
|
+
|
|
87
|
+
result = []
|
|
88
|
+
size = 0
|
|
89
|
+
for label in labels:
|
|
90
|
+
result.append(ulabel(label))
|
|
91
|
+
if size:
|
|
92
|
+
size += 1
|
|
93
|
+
size += len(label)
|
|
94
|
+
|
|
95
|
+
result_str = ".".join(result) + trailing_dot
|
|
96
|
+
size += len(trailing_dot)
|
|
97
|
+
return (result_str, size)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class StreamWriter(Codec, codecs.StreamWriter):
|
|
101
|
+
pass
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class StreamReader(Codec, codecs.StreamReader):
|
|
105
|
+
pass
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def search_function(name: str) -> Optional[codecs.CodecInfo]:
|
|
109
|
+
if name != "idna2008":
|
|
110
|
+
return None
|
|
111
|
+
return codecs.CodecInfo(
|
|
112
|
+
name=name,
|
|
113
|
+
encode=Codec().encode,
|
|
114
|
+
decode=Codec().decode, # type: ignore
|
|
115
|
+
incrementalencoder=IncrementalEncoder,
|
|
116
|
+
incrementaldecoder=IncrementalDecoder,
|
|
117
|
+
streamwriter=StreamWriter,
|
|
118
|
+
streamreader=StreamReader,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
codecs.register(search_function)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Any, Union
|
|
2
|
+
|
|
3
|
+
from .core import decode, encode
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def ToASCII(label: str) -> bytes:
|
|
7
|
+
return encode(label)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def ToUnicode(label: Union[bytes, bytearray]) -> str:
|
|
11
|
+
return decode(label)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def nameprep(s: Any) -> None:
|
|
15
|
+
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
|