this should probably make relative imports work

This commit is contained in:
Crystal Melting Dot 2021-02-21 00:43:41 +03:00
parent eda75f552c
commit 723172387b
17 changed files with 33 additions and 33 deletions

View File

@ -8,6 +8,6 @@ RUN apk update \
&& apk add gcc python3-dev musl-dev libffi-dev openssl-dev make cargo && apk add gcc python3-dev musl-dev libffi-dev openssl-dev make cargo
COPY . . COPY . .
WORKDIR tgbot/tgbot WORKDIR tgbot
RUN pip install --upgrade pip; pip install poetry; poetry config virtualenvs.create false; poetry install RUN pip install --upgrade pip; pip install poetry; poetry config virtualenvs.create false; poetry install
CMD poetry shell; python bot.py CMD poetry shell; python bot.py

View File

@ -5,8 +5,8 @@ from tortoise import Tortoise
from tortoise.exceptions import DBConnectionError from tortoise.exceptions import DBConnectionError
from loguru import logger from loguru import logger
from asyncio import sleep from asyncio import sleep
import config import tgbot.config as config
import handlers import tgbot.handlers as handlers
storage = MemoryStorage() storage = MemoryStorage()
telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN) telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN)

View File

@ -0,0 +1 @@

View File

@ -1,7 +1,7 @@
from unittest import TestCase from unittest import TestCase
from ..handlers.default.tcp import TCPCheckerHandler from tgbot.handlers.default.tcp import TCPCheckerHandler
from ..handlers.base import process_args_for_host_port,\ from tgbot.handlers.base import process_args_for_host_port,\
NotEnoughArgs, InvalidPort NotEnoughArgs, InvalidPort

View File

@ -1,7 +1,7 @@
from aiogram.types import Message from aiogram.types import Message
from typing import Tuple, Any, List from typing import Tuple, Any, List
from tgbot.nodes import nodes as all_nodes from ..nodes import nodes as all_nodes
from httpx import Response from httpx import Response
from aiogram.bot import Bot from aiogram.bot import Bot
from datetime import datetime from datetime import datetime
@ -9,7 +9,7 @@ from core.coretypes import APINodeInfo
from .helpers import send_api_requests from .helpers import send_api_requests
from .errors import NotEnoughArgs, InvalidPort, LocalhostForbidden from .errors import NotEnoughArgs, InvalidPort, LocalhostForbidden
from .validators import BaseValidator, LocalhostValidator from .validators import BaseValidator, LocalhostValidator
from tgbot.middlewares.throttling import rate_limit from ..middlewares.throttling import rate_limit
from loguru import logger from loguru import logger
from uuid import uuid4 from uuid import uuid4
from time import time from time import time

View File

@ -3,7 +3,7 @@ from httpx import Response
from core.coretypes import ErrorPayload, ICMPCheckerResponse, ResponseStatus from core.coretypes import ErrorPayload, ICMPCheckerResponse, ResponseStatus
from ..base import CheckerBaseHandler, NotEnoughArgs, LocalhostForbidden from ..base import CheckerBaseHandler, NotEnoughArgs, LocalhostForbidden
from ..metrics import push_status_metric from ..metrics import push_status_metric
from tgbot.middlewares.throttling import rate_limit from ...middlewares.throttling import rate_limit
icmp_help_message = """ icmp_help_message = """
Производит проверку хоста по протоколу ICMP. Производит проверку хоста по протоколу ICMP.

View File

@ -2,8 +2,8 @@ from aiogram.types import Message
from typing import Union from typing import Union
import ipaddress import ipaddress
from tgbot.handlers.base import SimpleCommandHandler, NotEnoughArgs from ..base import SimpleCommandHandler, NotEnoughArgs
from tgbot.middlewares.throttling import rate_limit from ...middlewares.throttling import rate_limit
ipcalc_help_message = """ ipcalc_help_message = """
Калькулятор IP подсетей. Калькулятор IP подсетей.

View File

@ -1,8 +1,8 @@
from core.coretypes import ResponseStatus, ErrorPayload, MinecraftResponse from core.coretypes import ResponseStatus, ErrorPayload, MinecraftResponse
from httpx import Response from httpx import Response
from tgbot.handlers.base import CheckerTargetPortHandler, process_args_for_host_port from ..base import CheckerTargetPortHandler, process_args_for_host_port
from tgbot.handlers.metrics import push_status_metric from ..metrics import push_status_metric
minecraft_help_message = """ minecraft_help_message = """
Получает статистику о Minecraft сервере Получает статистику о Minecraft сервере

View File

@ -1,7 +1,7 @@
from aiogram.types import Message from aiogram.types import Message
from tgbot.models.user import User from ...models.user import User
from tgbot.middlewares.throttling import rate_limit from ...middlewares.throttling import rate_limit
from tgbot.middlewares.userdata import userdata_required from ...middlewares.userdata import userdata_required
start_message = """ start_message = """

View File

@ -3,9 +3,9 @@ from aiogram.types import Message
from core.coretypes import ResponseStatus, ErrorPayload, PortResponse from core.coretypes import ResponseStatus, ErrorPayload, PortResponse
from httpx import Response from httpx import Response
from tgbot.handlers.base import CheckerTargetPortHandler, NotEnoughArgs, InvalidPort, parse_host_port from ..base import CheckerTargetPortHandler, NotEnoughArgs, InvalidPort, parse_host_port
from tgbot.handlers.metrics import push_status_metric from ..metrics import push_status_metric
from tgbot.middlewares.throttling import rate_limit from ...middlewares.throttling import rate_limit
tcp_help_message = """ tcp_help_message = """
Производит проверку TCP порта, открыт ли он или нет Производит проверку TCP порта, открыт ли он или нет

View File

@ -6,10 +6,10 @@ from dataclasses import dataclass
from whois_vu.api import WhoisSource from whois_vu.api import WhoisSource
from whois_vu.errors import IncorrectZone, QueryNotMatchRegexp from whois_vu.errors import IncorrectZone, QueryNotMatchRegexp
from tgbot.handlers.whois_zones import ZONES from ..whois_zones import ZONES
from tgbot.handlers.base import SimpleCommandHandler from ..base import SimpleCommandHandler
from tgbot.handlers.errors import NotEnoughArgs, LocalhostForbidden from ..errors import NotEnoughArgs, LocalhostForbidden
from tgbot.middlewares.throttling import rate_limit from ...middlewares.throttling import rate_limit
whois_help_message = """ whois_help_message = """
Вернёт информацию о домене. Вернёт информацию о домене.

View File

@ -5,8 +5,8 @@ from ipaddress import ip_address
from contextlib import suppress from contextlib import suppress
from loguru import logger from loguru import logger
from aiogram.bot import Bot from aiogram.bot import Bot
from tgbot.handlers.metrics import push_api_request_status from .metrics import push_api_request_status
from tgbot.config import NOTIFICATION_BOT_TOKEN, NOTIFICATION_USERS from ..config import NOTIFICATION_BOT_TOKEN, NOTIFICATION_USERS
from traceback import format_exc from traceback import format_exc
import asyncio import asyncio

View File

@ -1,6 +1,6 @@
from aioinflux import InfluxDBClient from aioinflux import InfluxDBClient
from typing import Dict from typing import Dict
from tgbot.config import INFLUX_DB, INFLUX_HOST, INFLUX_PORT, INFLUX_PASSWORD, INFLUX_USERNAME from ..config import INFLUX_DB, INFLUX_HOST, INFLUX_PORT, INFLUX_PASSWORD, INFLUX_USERNAME
async def push_metric(measurement, tags: Dict, fields: Dict): async def push_metric(measurement, tags: Dict, fields: Dict):

View File

@ -1,4 +1,4 @@
from tgbot.middlewares.write_command_metric import WriteCommandMetric from .write_command_metric import WriteCommandMetric
from tgbot.middlewares.logging import LoggingMiddleware from .logging import LoggingMiddleware
from tgbot.middlewares.throttling import ThrottlingMiddleware from .throttling import ThrottlingMiddleware
from tgbot.middlewares.userdata import UserMiddleware from .userdata import UserMiddleware

View File

@ -2,7 +2,7 @@ from aiogram.dispatcher.handler import current_handler
from aiogram.dispatcher.middlewares import BaseMiddleware from aiogram.dispatcher.middlewares import BaseMiddleware
from aiogram.types import Message, CallbackQuery from aiogram.types import Message, CallbackQuery
from tgbot.models import User from ..models import User
def userdata_required(func): def userdata_required(func):

View File

@ -1,7 +1,7 @@
from aiogram.dispatcher.middlewares import BaseMiddleware from aiogram.dispatcher.middlewares import BaseMiddleware
from aiogram.types import Message from aiogram.types import Message
from tgbot.handlers.metrics import push_metric from ..handlers.metrics import push_metric
from tgbot.models import User, UserCheckRequests from ..models import User, UserCheckRequests
class WriteCommandMetric(BaseMiddleware): class WriteCommandMetric(BaseMiddleware):

View File

@ -1 +0,0 @@
from .test_port_parsers import *