コード例 #1
0
ファイル: client.py プロジェクト: CasperTeam/cpbot
import asyncio
import importlib
from types import ModuleType
from typing import List, Awaitable, Any, Optional, Union

from pyrogram import idle

from cpbot import logging, Config, logbot
from cpbot.utils import time_formatter
from cpbot.utils.exceptions import cpbotBotNotFound
from cpbot.plugins import get_all_plugins
from .methods import Methods
from .ext import RawClient, pool
from .database import _close_db

_LOG = logging.getLogger(__name__)
_LOG_STR = "<<<!  #####  %s  #####  !>>>"

_IMPORTED: List[ModuleType] = []
_INIT_TASKS: List[asyncio.Task] = []
_START_TIME = time.time()
_SEND_SIGNAL = False


async def _complete_init_tasks() -> None:
    if not _INIT_TASKS:
        return
    await asyncio.gather(*_INIT_TASKS)
    _INIT_TASKS.clear()

コード例 #2
0
ファイル: get_logger.py プロジェクト: CasperTeam/cpbot
 def getLogger(name: str = '') -> logging.Logger:  # pylint: disable=invalid-name
     """ This returns new logger object """
     if not name:
         name = inspect.currentframe().f_back.f_globals['__name__']
     _LOG.debug(_LOG_STR, f"Creating Logger => {name}")
     return logging.getLogger(name)