Skip to content

Commit

Permalink
🚨 Fix F811 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidRomanovizc committed Sep 18, 2023
1 parent 99ed042 commit 26a36e9
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 27 deletions.
9 changes: 6 additions & 3 deletions functions/main_app/auxiliary_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from keyboards.inline.guide_inline import create_pagination_keyboard
from keyboards.inline.main_menu_inline import start_keyboard
from keyboards.inline.settings_menu import information_keyboard
from loader import _, bot, scheduler
from loader import _, bot, scheduler, logger
from utils.db_api import db_commands
from utils.db_api.db_commands import check_user_meetings_exists

Expand Down Expand Up @@ -214,7 +214,8 @@ async def saving_normal_photo(
await message.answer(
text=_("Фото принято!"), reply_markup=ReplyKeyboardRemove()
)
except:
except Exception as err:
logger.info(f"Ошибка в saving_normal_photo | err: {err}")
await message.answer(
text=_(
"Произошла ошибка! Попробуйте еще раз либо отправьте другую фотографию. \n"
Expand Down Expand Up @@ -250,6 +251,7 @@ async def saving_censored_photo(
await db_commands.update_user_data(telegram_id=telegram_id, photo_id=file_id)

except Exception as err:
logger.info(f"Ошибка в saving_censored_photo | err: {err}")
await message.answer(
text=_(
"Произошла ошибка!"
Expand Down Expand Up @@ -285,7 +287,8 @@ async def update_normal_photo(
text=_("Выберите, что вы хотите изменить: "), reply_markup=markup
)
await state.reset_state()
except:
except Exception as err:
logger.info(f"Ошибка в update_normal_photo | err: {err}")
await message.answer(
text=_(
"Произошла ошибка! Попробуйте еще раз либо отправьте другую фотографию. \n"
Expand Down
5 changes: 2 additions & 3 deletions handlers/admins/advert/mailing/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,11 @@ async def get_button_name_photo(message: types.Message, state: FSMContext) -> No


@dp.message_handler(IsAdmin(), state="get_button_url_photo")
async def get_button_url(message: types.Message, state: FSMContext) -> None:
async def get_button_url_photo(message: types.Message, state: FSMContext) -> None:
button_url = message.text
await state.update_data(button_url=button_url)
async with state.proxy() as data:
text = data["text"]
photo = data["photo"]
button_name = data["button_name"]

markup = InlineKeyboardMarkup(row_width=1)
Expand Down Expand Up @@ -251,7 +250,7 @@ async def get_button_url(message: types.Message, state: FSMContext) -> None:


@dp.callback_query_handler(state="confirm_with_button_photo")
async def confirm_with_button_no_photo(call: CallbackQuery, state: FSMContext) -> None:
async def confirm_with_button_photo(call: CallbackQuery, state: FSMContext) -> None:
chats = await db_commands.select_all_users()
count = 0

Expand Down
2 changes: 1 addition & 1 deletion handlers/admins/settings/tech_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def set_up_tech_works(call: CallbackQuery) -> None:


@dp.callback_query_handler(text="disable_tech_work")
async def set_up_tech_works(call: CallbackQuery) -> None:
async def turn_off_tech_works(call: CallbackQuery) -> None:
await db_commands.update_setting(
telegram_id=call.from_user.id, technical_works=False
)
Expand Down
10 changes: 5 additions & 5 deletions handlers/users/change_datas.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ async def start_change_data(call: CallbackQuery) -> None:


@dp.callback_query_handler(text="name")
async def change_name(call: CallbackQuery) -> None:
async def change_name_request(call: CallbackQuery) -> None:
await call.message.edit_text(text=_("Введите новое имя"))
await NewData.name.set()


@dp.message_handler(state=NewData.name)
async def change_name(message: types.Message, state: FSMContext) -> None:
async def update_name(message: types.Message, state: FSMContext) -> None:
markup = await change_info_keyboard()
try:
censored = censored_message(message.text)
Expand Down Expand Up @@ -78,7 +78,7 @@ async def change_age(call: CallbackQuery) -> None:


@dp.message_handler(state=NewData.age)
async def change_age(message: types.Message, state: FSMContext) -> None:
async def update_age(message: types.Message, state: FSMContext) -> None:
markup = await change_info_keyboard()
try:
if int(message.text) and 10 < int(message.text) < 90:
Expand Down Expand Up @@ -114,7 +114,7 @@ async def change_city(call: CallbackQuery) -> None:


@dp.message_handler(state=NewData.city)
async def change_city(message: types.Message) -> None:
async def update_city(message: types.Message) -> None:
try:
loc = await Location(message=message, strategy=RegistrationStrategy())
await loc.det_loc()
Expand Down Expand Up @@ -147,7 +147,7 @@ async def change_sex(call: CallbackQuery) -> None:


@dp.callback_query_handler(state=NewData.sex)
async def change_sex(call: CallbackQuery, state: FSMContext) -> None:
async def update_sex(call: CallbackQuery, state: FSMContext) -> None:
markup = await change_info_keyboard()
gender = "Мужской" if call.data == "male" else "Женский"
await db_commands.update_user_data(sex=gender, telegram_id=call.from_user.id)
Expand Down
2 changes: 1 addition & 1 deletion handlers/users/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def registrate_poster_commentary(call: CallbackQuery, state: FSMContext) -


@dp.message_handler(state="register_handler_commentary")
async def registrate_poster_commentary(message: Message, state: FSMContext) -> None:
async def registrate_poster(message: Message, state: FSMContext) -> None:
try:
await db_commands.update_user_meetings_data(
telegram_id=message.from_user.id, commentary=message.text
Expand Down
13 changes: 1 addition & 12 deletions handlers/users/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@ async def user_city_filter(call: CallbackQuery, state: FSMContext) -> None:
await state.set_state("city")


@dp.message_handler(state="city")
async def user_city_filter_state(message: types.Message) -> None:
try:
loc = await Location(message=message, strategy=FiltersStrategy)
await loc.det_loc()

except NothingFound:
await message.answer(_("Произошла ошибка, попробуйте еще раз"))
return


@dp.callback_query_handler(text="yes_all_good", state="set_city_event")
@dp.callback_query_handler(text="yes_all_good", state="city")
async def get_hobbies(call: CallbackQuery, state: FSMContext) -> None:
Expand Down Expand Up @@ -134,7 +123,7 @@ async def set_city_by_filter(call: CallbackQuery, state: FSMContext) -> None:
await state.set_state("set_city_event")


@dp.message_handler(state="set_city_event")
@dp.message_handler(state="city")
async def user_city_filter_state(message: types.Message) -> None:
try:
loc = await Location(message=message, strategy=FiltersStrategy)
Expand Down
2 changes: 1 addition & 1 deletion handlers/users/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def commentary_reg(message: types.Message) -> None:


@dp.callback_query_handler(state=RegData.need_partner_sex)
async def sex_reg(call: CallbackQuery) -> None:
async def handle_gender_choice(call: CallbackQuery) -> None:
await choice_gender(call)
await call.message.edit_text(
text=_(
Expand Down
2 changes: 1 addition & 1 deletion middlewares/LinkCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class LinkCheckMiddleware(BaseMiddleware):
async def on_process_message(self, message: types.Message, data: dict) -> None:
if message.chat.type == types.ChatType.PRIVATE:
if isinstance(message.chat.type, types.ChatType):
await self._check_links_and_handle(message.from_user.id, obj=message)

async def on_process_callback_query(
Expand Down

0 comments on commit 26a36e9

Please sign in to comment.