Exemple #1
0
from base64 import urlsafe_b64decode, urlsafe_b64encode
import gzip
import hashlib
import random
import string
import zlib

# absolute import because we are deep
from gd.logging import get_logger
from gd.typing import List, Union

from gd.utils.crypto.xor_cipher import XORCipher as XOR

log = get_logger(__name__)

Z_GZIP_HEADER = 0x10
Z_AUTO_HEADER = 0x20

try:
    from Crypto.Cipher import AES
except ImportError:
    log.warning(
        "Failed to import pycryptodome module. MacOS save coding will not be supported."
    )


class Coder:
    keys = {
        "message": "14251",
        "levelpass": "******",
        "accountpass": "******",
Exemple #2
0
)

__all__ = (
    "run_blocking_io",
    "wait",
    "run",
    "gather",
    "cancel_all_tasks",
    "shutdown_loop",
    "maybe_coroutine",
    "acquire_loop",
    "aiter",
    "anext",
)

log = get_logger("gd.async")


async def run_blocking_io(func: Callable, *args, **kwargs) -> Any:
    """|coro|

    Run some blocking function in an event loop.

    If there is a running loop, ``'func'`` is executed in it.

    Otherwise, a new loop is being created and closed at the end of the execution.

    Example:

    .. code-block:: python3