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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
from warnings import warn
|
|
5
|
+
|
|
6
|
+
from .api import from_bytes
|
|
7
|
+
from .constant import CHARDET_CORRESPONDENCE, TOO_SMALL_SEQUENCE
|
|
8
|
+
|
|
9
|
+
# TODO: remove this check when dropping Python 3.7 support
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from typing_extensions import TypedDict
|
|
12
|
+
|
|
13
|
+
class ResultDict(TypedDict):
|
|
14
|
+
encoding: str | None
|
|
15
|
+
language: str
|
|
16
|
+
confidence: float | None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def detect(
|
|
20
|
+
byte_str: bytes, should_rename_legacy: bool = False, **kwargs: Any
|
|
21
|
+
) -> ResultDict:
|
|
22
|
+
"""
|
|
23
|
+
chardet legacy method
|
|
24
|
+
Detect the encoding of the given byte string. It should be mostly backward-compatible.
|
|
25
|
+
Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it)
|
|
26
|
+
This function is deprecated and should be used to migrate your project easily, consult the documentation for
|
|
27
|
+
further information. Not planned for removal.
|
|
28
|
+
|
|
29
|
+
:param byte_str: The byte sequence to examine.
|
|
30
|
+
:param should_rename_legacy: Should we rename legacy encodings
|
|
31
|
+
to their more modern equivalents?
|
|
32
|
+
"""
|
|
33
|
+
if len(kwargs):
|
|
34
|
+
warn(
|
|
35
|
+
f"charset-normalizer disregard arguments '{','.join(list(kwargs.keys()))}' in legacy function detect()"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
if not isinstance(byte_str, (bytearray, bytes)):
|
|
39
|
+
raise TypeError( # pragma: nocover
|
|
40
|
+
f"Expected object of type bytes or bytearray, got: {type(byte_str)}"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
if isinstance(byte_str, bytearray):
|
|
44
|
+
byte_str = bytes(byte_str)
|
|
45
|
+
|
|
46
|
+
r = from_bytes(byte_str).best()
|
|
47
|
+
|
|
48
|
+
encoding = r.encoding if r is not None else None
|
|
49
|
+
language = r.language if r is not None and r.language != "Unknown" else ""
|
|
50
|
+
confidence = 1.0 - r.chaos if r is not None else None
|
|
51
|
+
|
|
52
|
+
# automatically lower confidence
|
|
53
|
+
# on small bytes samples.
|
|
54
|
+
# https://github.com/jawah/charset_normalizer/issues/391
|
|
55
|
+
if (
|
|
56
|
+
confidence is not None
|
|
57
|
+
and confidence >= 0.9
|
|
58
|
+
and encoding
|
|
59
|
+
not in {
|
|
60
|
+
"utf_8",
|
|
61
|
+
"ascii",
|
|
62
|
+
}
|
|
63
|
+
and r.bom is False # type: ignore[union-attr]
|
|
64
|
+
and len(byte_str) < TOO_SMALL_SEQUENCE
|
|
65
|
+
):
|
|
66
|
+
confidence -= 0.2
|
|
67
|
+
|
|
68
|
+
# Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process
|
|
69
|
+
# but chardet does return 'utf-8-sig' and it is a valid codec name.
|
|
70
|
+
if r is not None and encoding == "utf_8" and r.bom:
|
|
71
|
+
encoding += "_sig"
|
|
72
|
+
|
|
73
|
+
if should_rename_legacy is False and encoding in CHARDET_CORRESPONDENCE:
|
|
74
|
+
encoding = CHARDET_CORRESPONDENCE[encoding]
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
"encoding": encoding,
|
|
78
|
+
"language": language,
|
|
79
|
+
"confidence": confidence,
|
|
80
|
+
}
|