Avoid relative import statements
This commit is contained in:
parent
ed7e335d4e
commit
4bf00f0cc5
@ -11,12 +11,13 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.7.3"
|
__version__ = "2.7.4"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
from . import (administration_tools, api, authorization, bot, helper,
|
from davtelepot import (administration_tools, api, authorization,
|
||||||
languages, messages, suggestions, useful_tools, utilities)
|
bot, helper, languages, messages, suggestions,
|
||||||
|
useful_tools, utilities)
|
||||||
|
|
||||||
__all__ = ['administration_tools', 'api', 'authorization', 'bot', 'helper',
|
__all__ = ['administration_tools', 'api', 'authorization', 'bot', 'helper',
|
||||||
'languages', 'messages', 'suggestions', 'useful_tools', 'utilities']
|
'languages', 'messages', 'suggestions', 'useful_tools', 'utilities']
|
||||||
|
@ -23,9 +23,9 @@ from typing import Union, List, Tuple
|
|||||||
from sqlalchemy.exc import ResourceClosedError
|
from sqlalchemy.exc import ResourceClosedError
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .messages import default_admin_messages, default_talk_messages
|
from davtelepot.messages import default_admin_messages, default_talk_messages
|
||||||
from .bot import Bot
|
from davtelepot.bot import Bot
|
||||||
from .utilities import (
|
from davtelepot.utilities import (
|
||||||
async_wrapper, CachedPage, Confirmator, extract, get_cleaned_text,
|
async_wrapper, CachedPage, Confirmator, extract, get_cleaned_text,
|
||||||
get_user, escape_html_chars, line_drawing_unordered_list, make_button,
|
get_user, escape_html_chars, line_drawing_unordered_list, make_button,
|
||||||
make_inline_keyboard, remove_html_tags, send_part_of_text_file,
|
make_inline_keyboard, remove_html_tags, send_part_of_text_file,
|
||||||
|
@ -14,7 +14,7 @@ import aiohttp
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .api import TelegramBot
|
from davtelepot.api import TelegramBot
|
||||||
|
|
||||||
api_url = "https://core.telegram.org/bots/api"
|
api_url = "https://core.telegram.org/bots/api"
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ from collections import OrderedDict
|
|||||||
from typing import Callable, List, Union
|
from typing import Callable, List, Union
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .bot import Bot
|
from davtelepot.bot import Bot
|
||||||
from .messages import default_authorization_messages
|
from davtelepot.messages import default_authorization_messages
|
||||||
from .utilities import (
|
from davtelepot.utilities import (
|
||||||
Confirmator, get_cleaned_text, get_user, make_button, make_inline_keyboard
|
Confirmator, get_cleaned_text, get_user, make_button, make_inline_keyboard
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,14 +46,14 @@ from collections import OrderedDict
|
|||||||
from typing import Callable, List, Union, Dict
|
from typing import Callable, List, Union, Dict
|
||||||
|
|
||||||
# Third party modules
|
# Third party modules
|
||||||
from aiohttp import web
|
import aiohttp.web
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .api import TelegramBot, TelegramError
|
from davtelepot.api import TelegramBot, TelegramError
|
||||||
from .database import ObjectWithDatabase
|
from davtelepot.database import ObjectWithDatabase
|
||||||
from .languages import MultiLanguageObject
|
from davtelepot.languages import MultiLanguageObject
|
||||||
from .messages import davtelepot_messages
|
from davtelepot.messages import davtelepot_messages
|
||||||
from .utilities import (
|
from davtelepot.utilities import (
|
||||||
async_get, escape_html_chars, extract, get_secure_key,
|
async_get, escape_html_chars, extract, get_secure_key,
|
||||||
make_inline_query_answer, make_lines_of_buttons, remove_html_tags
|
make_inline_query_answer, make_lines_of_buttons, remove_html_tags
|
||||||
)
|
)
|
||||||
@ -3055,7 +3055,7 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
|
|||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
self.route_update(update)
|
self.route_update(update)
|
||||||
)
|
)
|
||||||
return web.Response(
|
return aiohttp.web.Response(
|
||||||
body='OK'.encode('utf-8')
|
body='OK'.encode('utf-8')
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -3396,9 +3396,9 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
|
|||||||
"""
|
"""
|
||||||
assert cls.local_host is not None, "Invalid local host"
|
assert cls.local_host is not None, "Invalid local host"
|
||||||
assert cls.port is not None, "Invalid port"
|
assert cls.port is not None, "Invalid port"
|
||||||
cls.runner = web.AppRunner(cls.app)
|
cls.runner = aiohttp.web.AppRunner(cls.app)
|
||||||
await cls.runner.setup()
|
await cls.runner.setup()
|
||||||
cls.server = web.TCPSite(cls.runner, cls.local_host, cls.port)
|
cls.server = aiohttp.web.TCPSite(cls.runner, cls.local_host, cls.port)
|
||||||
try:
|
try:
|
||||||
await cls.server.start()
|
await cls.server.start()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
# Project modules
|
# Project modules
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from .bot import Bot
|
from davtelepot.bot import Bot
|
||||||
from .messages import default_help_messages
|
from davtelepot.messages import default_help_messages
|
||||||
from .utilities import (
|
from davtelepot.utilities import (
|
||||||
get_cleaned_text, make_inline_keyboard,
|
get_cleaned_text, make_inline_keyboard,
|
||||||
make_lines_of_buttons, make_button,
|
make_lines_of_buttons, make_button,
|
||||||
recursive_dictionary_update
|
recursive_dictionary_update
|
||||||
|
@ -6,8 +6,8 @@ from collections import OrderedDict
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .messages import default_language_messages
|
from davtelepot.messages import default_language_messages
|
||||||
from .utilities import extract, make_button, make_inline_keyboard
|
from davtelepot.utilities import extract, make_button, make_inline_keyboard
|
||||||
|
|
||||||
|
|
||||||
class MultiLanguageObject(object):
|
class MultiLanguageObject(object):
|
||||||
|
@ -4,12 +4,10 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
# Third party modules
|
|
||||||
import davtelepot
|
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .messages import default_suggestion_messages
|
import davtelepot
|
||||||
from .utilities import (
|
from davtelepot.messages import default_suggestion_messages
|
||||||
|
from davtelepot.utilities import (
|
||||||
async_wrapper, get_cleaned_text, make_button,
|
async_wrapper, get_cleaned_text, make_button,
|
||||||
make_inline_keyboard, send_csv_file
|
make_inline_keyboard, send_csv_file
|
||||||
)
|
)
|
||||||
|
@ -13,11 +13,12 @@ from collections import OrderedDict
|
|||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
from .api import TelegramError
|
from davtelepot.api import TelegramError
|
||||||
from .bot import Bot
|
from davtelepot.bot import Bot
|
||||||
from .messages import default_useful_tools_messages
|
from davtelepot.messages import default_useful_tools_messages
|
||||||
from .utilities import (get_cleaned_text, get_user, make_button,
|
from davtelepot.utilities import (get_cleaned_text, get_user, make_button,
|
||||||
make_inline_keyboard, recursive_dictionary_update, )
|
make_inline_keyboard,
|
||||||
|
recursive_dictionary_update, )
|
||||||
|
|
||||||
|
|
||||||
def get_calc_buttons() -> OrderedDict:
|
def get_calc_buttons() -> OrderedDict:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user