Skip to content

Commit

Permalink
Pass pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: alfred richardsn <rchrdsn@protonmail.ch>
  • Loading branch information
r4rdsn committed Nov 19, 2020
1 parent b4b046a commit 039af08
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/escrow/blockchain/cyber_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ async def _resolve_address(self, address) -> str:
return addresses[address]

async def _check_queue_in_history(
self, queue: typing.List[typing.Dict[str, typing.Any]],
self,
queue: typing.List[typing.Dict[str, typing.Any]],
) -> bool:
addresses = [queue_member["from_address"].lower() for queue_member in queue]
resolved = await self._resolve_addresses(addresses)
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ async def errors_handler(update: types.Update, exception: Exception):
parse_mode=types.ParseMode.MARKDOWN,
)
await tg.send_message(
chat_id, i18n("unexpected_error"), reply_markup=start_keyboard(),
chat_id,
i18n("unexpected_error"),
reply_markup=start_keyboard(),
)

return True
11 changes: 8 additions & 3 deletions src/handlers/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ async def cancel_order_creation(user_id: int, chat_id: int):
order = await database.creation.delete_one({"user_id": user_id})
if not order.deleted_count:
await tg.send_message(
chat_id, i18n("no_creation"), reply_markup=start_keyboard(),
chat_id,
i18n("no_creation"),
reply_markup=start_keyboard(),
)
return True

Expand Down Expand Up @@ -249,7 +251,9 @@ async def whitelisting_request(call: types.CallbackQuery):
)
else:
await tg.edit_message_text(
support_text, config.SUPPORT_CHAT_ID, request["message_id"],
support_text,
config.SUPPORT_CHAT_ID,
request["message_id"],
)

await call.answer()
Expand Down Expand Up @@ -427,7 +431,8 @@ async def price_ask(
buttons = await inline_control_buttons()
callback_data = f"price {callback_command}"
buttons.insert(
0, [InlineKeyboardButton(i18n("invert"), callback_data=callback_data)],
0,
[InlineKeyboardButton(i18n("invert"), callback_data=callback_data)],
)
await tg.edit_message_text(
answer,
Expand Down
24 changes: 17 additions & 7 deletions src/handlers/escrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ async def full_card_number_request(chat_id: int, offer: EscrowOffer):


async def ask_credentials(
call: types.CallbackQuery, offer: EscrowOffer,
call: types.CallbackQuery,
offer: EscrowOffer,
):
"""Update offer with ``update_dict`` and start asking transfer information.
Expand Down Expand Up @@ -307,7 +308,9 @@ async def ask_credentials(
)
)
await tg.send_message(
answer_user["id"], answer, parse_mode=ParseMode.MARKDOWN,
answer_user["id"],
answer,
parse_mode=ParseMode.MARKDOWN,
)
return

Expand Down Expand Up @@ -444,7 +447,8 @@ async def set_receive_card_number(message: types.Message, offer: EscrowOffer):
{"$set": {f"{user_field}.receive_address": ("*" * 8).join(card_number)}}
)
await tg.send_message(
message.chat.id, i18n("ask_address {currency}").format(currency=offer.escrow),
message.chat.id,
i18n("ask_address {currency}").format(currency=offer.escrow),
)
await states.Escrow.send_address.set()

Expand Down Expand Up @@ -480,7 +484,8 @@ async def set_receive_address(message: types.Message, offer: EscrowOffer):
)
if ask_name:
await tg.send_message(
message.chat.id, i18n("send_name_patronymic_surname"),
message.chat.id,
i18n("send_name_patronymic_surname"),
)
await states.Escrow.name.set()
else:
Expand Down Expand Up @@ -515,7 +520,8 @@ async def set_name(message: types.Message, offer: EscrowOffer):
name = message.text.split()
if len(name) != 3:
await tg.send_message(
message.chat.id, i18n("wrong_word_count {word_count}").format(word_count=3),
message.chat.id,
i18n("wrong_word_count {word_count}").format(word_count=3),
)
return
name[2] = name[2][0] + "." # Leaving the first letter of surname with dot
Expand Down Expand Up @@ -633,7 +639,8 @@ async def decline_offer(call: types.CallbackQuery, offer: EscrowOffer):
offer.react_time = time()
await offer.delete_document()
await tg.send_message(
offer.init["id"], i18n("escrow_offer_declined", locale=offer.init["locale"]),
offer.init["id"],
i18n("escrow_offer_declined", locale=offer.init["locale"]),
)
await call.answer()
await tg.send_message(call.message.chat.id, i18n("offer_declined"))
Expand Down Expand Up @@ -879,7 +886,10 @@ async def final_offer_confirmation(call: types.CallbackQuery, offer: EscrowOffer
await call.answer()
await tg.send_message(
other_user["id"],
i18n("complete_escrow_promise", locale=other_user["locale"],),
i18n(
"complete_escrow_promise",
locale=other_user["locale"],
),
reply_markup=start_keyboard(),
)

Expand Down
6 changes: 5 additions & 1 deletion src/handlers/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,11 @@ async def edit_button(call: types.CallbackQuery):
user = database_user.get()
if "edit" in user:
await tg.delete_message(call.message.chat.id, user["edit"]["message_id"])
result = await tg.send_message(call.message.chat.id, answer, reply_markup=keyboard,)
result = await tg.send_message(
call.message.chat.id,
answer,
reply_markup=keyboard,
)
await database.users.update_one(
{"_id": user["_id"]},
{
Expand Down
7 changes: 5 additions & 2 deletions src/handlers/start_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ async def search_by_creator(message: types.Message, state: FSMContext):
return
except IndexError:
await tg.send_message(
message.chat.id, i18n("no_user_argument"),
message.chat.id,
i18n("no_user_argument"),
)
return

Expand All @@ -370,7 +371,9 @@ async def search_by_creator(message: types.Message, state: FSMContext):
@private_handler(commands=["subscribe", "s"], state=any_state)
@private_handler(commands=["unsubscribe", "u"], state=any_state)
async def subcribe_to_pair(
message: types.Message, state: FSMContext, command: Command.CommandObj,
message: types.Message,
state: FSMContext,
command: Command.CommandObj,
):
r"""Manage subscription to pairs.
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ async def unhelp_button(call: types.CallbackQuery, state: FSMContext):
await state.finish()
await call.answer()
await tg.send_message(
call.message.chat.id, i18n("request_cancelled"), reply_markup=start_keyboard(),
call.message.chat.id,
i18n("request_cancelled"),
reply_markup=start_keyboard(),
)


Expand Down

0 comments on commit 039af08

Please sign in to comment.