Queer European MD passionate about IT
Browse Source

Avoid relative import statements

Davte 3 years ago
parent
commit
4bf00f0cc5

+ 4 - 3
davtelepot/__init__.py

@@ -11,12 +11,13 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.7.3"
+__version__ = "2.7.4"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 
-from . import (administration_tools, api, authorization, bot, helper,
-               languages, messages, suggestions, useful_tools, utilities)
+from davtelepot import (administration_tools, api, authorization,
+                        bot, helper, languages, messages, suggestions,
+                        useful_tools, utilities)
 
 __all__ = ['administration_tools', 'api', 'authorization', 'bot', 'helper',
            'languages', 'messages', 'suggestions', 'useful_tools', 'utilities']

+ 3 - 3
davtelepot/administration_tools.py

@@ -23,9 +23,9 @@ from typing import Union, List, Tuple
 from sqlalchemy.exc import ResourceClosedError
 
 # Project modules
-from .messages import default_admin_messages, default_talk_messages
-from .bot import Bot
-from .utilities import (
+from davtelepot.messages import default_admin_messages, default_talk_messages
+from davtelepot.bot import Bot
+from davtelepot.utilities import (
     async_wrapper, CachedPage, Confirmator, extract, get_cleaned_text,
     get_user, escape_html_chars, line_drawing_unordered_list, make_button,
     make_inline_keyboard, remove_html_tags, send_part_of_text_file,

+ 1 - 1
davtelepot/api_helper.py

@@ -14,7 +14,7 @@ import aiohttp
 from bs4 import BeautifulSoup
 
 # Project modules
-from .api import TelegramBot
+from davtelepot.api import TelegramBot
 
 api_url = "https://core.telegram.org/bots/api"
 

+ 3 - 3
davtelepot/authorization.py

@@ -5,9 +5,9 @@ from collections import OrderedDict
 from typing import Callable, List, Union
 
 # Project modules
-from .bot import Bot
-from .messages import default_authorization_messages
-from .utilities import (
+from davtelepot.bot import Bot
+from davtelepot.messages import default_authorization_messages
+from davtelepot.utilities import (
     Confirmator, get_cleaned_text, get_user, make_button, make_inline_keyboard
 )
 

+ 9 - 9
davtelepot/bot.py

@@ -46,14 +46,14 @@ from collections import OrderedDict
 from typing import Callable, List, Union, Dict
 
 # Third party modules
-from aiohttp import web
+import aiohttp.web
 
 # Project modules
-from .api import TelegramBot, TelegramError
-from .database import ObjectWithDatabase
-from .languages import MultiLanguageObject
-from .messages import davtelepot_messages
-from .utilities import (
+from davtelepot.api import TelegramBot, TelegramError
+from davtelepot.database import ObjectWithDatabase
+from davtelepot.languages import MultiLanguageObject
+from davtelepot.messages import davtelepot_messages
+from davtelepot.utilities import (
     async_get, escape_html_chars, extract, get_secure_key,
     make_inline_query_answer, make_lines_of_buttons, remove_html_tags
 )
@@ -3055,7 +3055,7 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
         asyncio.ensure_future(
             self.route_update(update)
         )
-        return web.Response(
+        return aiohttp.web.Response(
             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.port is not None, "Invalid port"
-        cls.runner = web.AppRunner(cls.app)
+        cls.runner = aiohttp.web.AppRunner(cls.app)
         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:
             await cls.server.start()
         except OSError as e:

+ 3 - 3
davtelepot/helper.py

@@ -3,9 +3,9 @@
 # Project modules
 from collections import OrderedDict
 
-from .bot import Bot
-from .messages import default_help_messages
-from .utilities import (
+from davtelepot.bot import Bot
+from davtelepot.messages import default_help_messages
+from davtelepot.utilities import (
     get_cleaned_text, make_inline_keyboard,
     make_lines_of_buttons, make_button,
     recursive_dictionary_update

+ 2 - 2
davtelepot/languages.py

@@ -6,8 +6,8 @@ from collections import OrderedDict
 import logging
 
 # Project modules
-from .messages import default_language_messages
-from .utilities import extract, make_button, make_inline_keyboard
+from davtelepot.messages import default_language_messages
+from davtelepot.utilities import extract, make_button, make_inline_keyboard
 
 
 class MultiLanguageObject(object):

+ 3 - 5
davtelepot/suggestions.py

@@ -4,12 +4,10 @@
 import asyncio
 import datetime
 
-# Third party modules
-import davtelepot
-
 # Project modules
-from .messages import default_suggestion_messages
-from .utilities import (
+import davtelepot
+from davtelepot.messages import default_suggestion_messages
+from davtelepot.utilities import (
     async_wrapper, get_cleaned_text, make_button,
     make_inline_keyboard, send_csv_file
 )

+ 6 - 5
davtelepot/useful_tools.py

@@ -13,11 +13,12 @@ from collections import OrderedDict
 from typing import List, Union
 
 # Project modules
-from .api import TelegramError
-from .bot import Bot
-from .messages import default_useful_tools_messages
-from .utilities import (get_cleaned_text, get_user, make_button,
-                        make_inline_keyboard, recursive_dictionary_update, )
+from davtelepot.api import TelegramError
+from davtelepot.bot import Bot
+from davtelepot.messages import default_useful_tools_messages
+from davtelepot.utilities import (get_cleaned_text, get_user, make_button,
+                                  make_inline_keyboard,
+                                  recursive_dictionary_update, )
 
 
 def get_calc_buttons() -> OrderedDict: