$62 GRAYBYTE WORDPRESS FILE MANAGER $40

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 147.79.69.255 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python311/lib/python3.11/site-packages/markdown_it/

HOME
Current File : /opt/alt/python311/lib/python3.11/site-packages/markdown_it//_punycode.py
# Copyright 2014 Mathias Bynens <https://mathiasbynens.be/>
# Copyright 2021 Taneli Hukkinen
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import codecs
import re
from typing import Callable

REGEX_SEPARATORS = re.compile(r"[\x2E\u3002\uFF0E\uFF61]")
REGEX_NON_ASCII = re.compile(r"[^\0-\x7E]")


def encode(uni: str) -> str:
    return codecs.encode(uni, encoding="punycode").decode()


def decode(ascii: str) -> str:
    return codecs.decode(ascii, encoding="punycode")  # type: ignore


def map_domain(string: str, fn: Callable[[str], str]) -> str:
    parts = string.split("@")
    result = ""
    if len(parts) > 1:
        # In email addresses, only the domain name should be punycoded. Leave
        # the local part (i.e. everything up to `@`) intact.
        result = parts[0] + "@"
        string = parts[1]
    labels = REGEX_SEPARATORS.split(string)
    encoded = ".".join(fn(label) for label in labels)
    return result + encoded


def to_unicode(obj: str) -> str:
    def mapping(obj: str) -> str:
        if obj.startswith("xn--"):
            return decode(obj[4:].lower())
        return obj

    return map_domain(obj, mapping)


def to_ascii(obj: str) -> str:
    def mapping(obj: str) -> str:
        if REGEX_NON_ASCII.search(obj):
            return "xn--" + encode(obj)
        return obj

    return map_domain(obj, mapping)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
5 Sep 2025 9.32 AM
root / 996
0755
__pycache__
--
8 May 2024 6.33 PM
root / root
0755
cli
--
8 May 2024 6.33 PM
root / root
0755
common
--
8 May 2024 6.33 PM
root / root
0755
helpers
--
8 May 2024 6.33 PM
root / root
0755
presets
--
8 May 2024 6.33 PM
root / root
0755
rules_block
--
8 May 2024 6.33 PM
root / root
0755
rules_core
--
8 May 2024 6.33 PM
root / root
0755
rules_inline
--
8 May 2024 6.33 PM
root / root
0755
__init__.py
0.11 KB
8 May 2024 6.33 PM
root / root
0644
_compat.py
0.24 KB
8 May 2024 6.33 PM
root / root
0644
_punycode.py
2.309 KB
8 May 2024 6.33 PM
root / root
0644
main.py
12.473 KB
8 May 2024 6.33 PM
root / root
0644
parser_block.py
3.819 KB
8 May 2024 6.33 PM
root / root
0644
parser_core.py
0.986 KB
8 May 2024 6.33 PM
root / root
0644
parser_inline.py
4.88 KB
8 May 2024 6.33 PM
root / root
0644
port.yaml
2.389 KB
8 May 2024 6.33 PM
root / root
0644
py.typed
0.025 KB
8 May 2024 6.33 PM
root / root
0644
renderer.py
9.736 KB
8 May 2024 6.33 PM
root / root
0644
ruler.py
8.983 KB
8 May 2024 6.33 PM
root / root
0644
token.py
6.288 KB
8 May 2024 6.33 PM
root / root
0644
tree.py
11.153 KB
8 May 2024 6.33 PM
root / root
0644
utils.py
5.239 KB
8 May 2024 6.33 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF