aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-02-21 23:39:21 -0800
committerclarkzjw <[email protected]>2023-02-21 23:39:21 -0800
commit8e83ba6c232172956f4d399e7bfdbe4e832e0536 (patch)
treea4b45633455692257149ed498f9b5cc5ec548ad7
parent3a76618d0f46c7e28641b74a869544661c504e21 (diff)
downloadswarm2fediverse-8e83ba6c232172956f4d399e7bfdbe4e832e0536.tar.gz
optimize imports
-rw-r--r--bot.py8
-rw-r--r--callback.py7
-rw-r--r--command.py13
-rw-r--r--config.py14
4 files changed, 12 insertions, 30 deletions
diff --git a/bot.py b/bot.py
index f2be049..ebb27c9 100644
--- a/bot.py
+++ b/bot.py
@@ -1,8 +1,12 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3import logging
4from callback import *
5from telegram.ext import Application, CallbackQueryHandler, CommandHandler, MessageHandler, filters, ConversationHandler 3from telegram.ext import Application, CallbackQueryHandler, CommandHandler, MessageHandler, filters, ConversationHandler
4import logging
5from callback import callback_skip_media, callback_location_sharing, callback_manual_location, \
6 callback_location_confirmation, callback_location_keyword_search, callback_skip_location_keyword, \
7 callback_add_comment, callback_skip_comment, callback_add_media
8from config import WAIT_LOCATION, LOCATION_SEARCH_KEYWORD, LOCATION_CONFIRMATION, ADD_MEDIA, ADD_COMMENT, BOT_TOKEN
9from command import start_command, cancel_command, help_command
6 10
7logging.basicConfig( 11logging.basicConfig(
8 format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO 12 format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
diff --git a/callback.py b/callback.py
index 8c80028..687508a 100644
--- a/callback.py
+++ b/callback.py
@@ -4,14 +4,11 @@ from foursquare.poi import query_poi
4from dbstore.dbm_store import get_loc 4from dbstore.dbm_store import get_loc
5from toot import mastodon_client 5from toot import mastodon_client
6from command import * 6from command import *
7from telegram import __version__ as TG_VER
8from typing import cast, List 7from typing import cast, List
9from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, ReplyKeyboardMarkup, KeyboardButton 8from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove
10from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, MessageHandler, filters, \ 9from telegram.ext import ContextTypes, ConversationHandler, CallbackContext
11 ConversationHandler, CallbackContext
12from telegram.constants import ParseMode, ChatAction 10from telegram.constants import ParseMode, ChatAction
13from telegram.error import BadRequest 11from telegram.error import BadRequest
14from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove
15 12
16 13
17async def callback_skip_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 14async def callback_skip_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
diff --git a/command.py b/command.py
index 753b0a2..09340fc 100644
--- a/command.py
+++ b/command.py
@@ -1,13 +1,8 @@
1from config import * 1from telegram import Update
2from telegram.constants import ParseMode
3from telegram.ext import ContextTypes, ConversationHandler
2 4
3from telegram import __version__ as TG_VER 5from config import *
4from typing import cast, List
5from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, ReplyKeyboardMarkup, KeyboardButton
6from telegram.ext import Application, CallbackQueryHandler, CommandHandler, ContextTypes, MessageHandler, filters, \
7 ConversationHandler, CallbackContext
8from telegram.constants import ParseMode, ChatAction
9from telegram.error import BadRequest
10from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardRemove
11 6
12 7
13async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int: 8async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
diff --git a/config.py b/config.py
index b690401..ea50a77 100644
--- a/config.py
+++ b/config.py
@@ -1,19 +1,5 @@
1# https://docs.python.org/3/library/configparser.html 1# https://docs.python.org/3/library/configparser.html
2 2
3from telegram import __version__ as TG_VER
4
5try:
6 from telegram import __version_info__
7except ImportError:
8 __version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment]
9
10if __version_info__ < (20, 0, 0, "alpha", 1):
11 raise RuntimeError(
12 f"This example is not compatible with your current PTB version {TG_VER}. To view the "
13 f"{TG_VER} version of this example, "
14 f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html"
15 )
16
17from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton 3from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, KeyboardButton
18from prompt.string import * 4from prompt.string import *
19from typing import TypedDict 5from typing import TypedDict
Powered by cgit v1.2.3 (git 2.41.0)