Explorar el Código

Fixed flake8s warnings

TheHamkerCat hace 5 años
padre
commit
cd2f6b073a

+ 4 - 4
wbb/__init__.py

@@ -1,7 +1,8 @@
-from pyrogram import Client
-from configparser import ConfigParser
 import logging
 import time
+from configparser import ConfigParser
+from pyrogram import Client
+
 
 
 f = open("error.log", "w")
@@ -10,8 +11,7 @@ f.write("PEAK OF LOG FILE")
 LOG_FORMAT = (
     '''
     [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
-    %(levelname)s: %(message)s'''
-    )
+    %(levelname)s: %(message)s''')
 
 logging.basicConfig(
     level=logging.INFO,

+ 1 - 3
wbb/__main__.py

@@ -20,7 +20,6 @@ HELPABLE = {}
 async def start_bot():
     await app.start()
     await get_info(app)
-    from wbb.utils import botinfo
 
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)
@@ -90,8 +89,7 @@ async def help_command(_, message):
     await message.reply(
         text,
         reply_markup=keyboard,
-        disable_web_page_preview=True
-        )
+        disable_web_page_preview=True)
 
 
 async def help_parser(message, keyboard=None):

+ 14 - 16
wbb/modules/admin.py

@@ -4,9 +4,9 @@ from wbb.utils import cust_filter
 
 __MODULE__ = "Admin"
 __HELP__ = "/purge - Purge Messages\n" \
-            "/kick - Kick A User\n" \
-            "/ban - Ban A User\n" \
-            "/unban - Unban A User"
+           "/kick - Kick A User\n" \
+           "/ban - Ban A User\n" \
+           "/unban - Unban A User"
 
 SUDO = [OWNER_ID, SUDO_USER_ID]
 
@@ -43,13 +43,11 @@ async def purge(client, message):
     if message.from_user.id in admins \
             or message.from_user.id in SUDO:
 
-        if (await app.get_chat_member(
-                message.chat.id, message.from_user.id
-                )).can_delete_messages is True \
+        if (await app.get_chat_member(message.chat.id, message.from_user.id
+            )).can_delete_messages is True \
                 or (await app.get_chat_member(            # Flake8 Hoe
                     message.chat.id, message.from_user.id
-                    )).status == 'creator' \
-                or message.from_user.id in SUDO:
+                        )).status == 'creator' or message.from_user.id in SUDO:
 
             if message.reply_to_message:
                 for a_s_message_id in range(
@@ -97,7 +95,7 @@ async def kick(client, message):
                 await message.reply_text("You Wanna Kick The Elevated One?")
             else:
                 if (await app.get_users(username)).id in \
-                 await list_members(message.chat.id):
+                        await list_members(message.chat.id):
                     await message.chat.kick_member(username)
                     await message.chat.unban_member(username)
                     await message.reply_text(f"Kicked {username}")
@@ -107,11 +105,11 @@ async def kick(client, message):
 
         else:
             if username in SUDO or message.reply_to_message.from_user.id \
-             in SUDO:
+                    in SUDO:
                 await message.reply_text("You Wanna Kick The Elevated One?")
             else:
                 if message.reply_to_message.from_user.id in \
-                 await list_members(message.chat.id):
+                        await list_members(message.chat.id):
                     id = message.reply_to_message.from_user.id
                     await message.reply_to_message.chat.kick_member(id)
                     await message.reply_to_message.chat.unban_member(id)
@@ -140,7 +138,7 @@ async def ban(client, message):
                 await message.reply_text("You Wanna Ban The Elevated One?")
             else:
                 if (await app.get_users(username)).id in \
-                 await list_members(message.chat.id):
+                        await list_members(message.chat.id):
                     await message.chat.kick_member(username)
                     await message.reply_text(f"Banned {username}")
                 else:
@@ -148,11 +146,11 @@ async def ban(client, message):
                                              " don't bully me!")
         else:
             if username in SUDO or message.reply_to_message.from_user.id \
-             in SUDO:
+                    in SUDO:
                 await message.reply_text("You Wanna Ban The Elevated One?")
             else:
                 if (await app.get_users(username)).id in \
-                 await list_members(message.chat.id):
+                        await list_members(message.chat.id):
                     id = message.reply_to_message.from_user.id
                     await message.reply_to_message.chat.kick_member(id)
                     await message.reply_text(f"Banned {username}")
@@ -177,7 +175,7 @@ async def unban(client, message):
 
         if username != "":
             if (await app.get_users(username)).id not in \
-             await list_members(message.chat.id):
+                    await list_members(message.chat.id):
                 await message.chat.kick_member(username)
                 await message.reply_text(f"Unbanned {username}")
             else:
@@ -185,7 +183,7 @@ async def unban(client, message):
                                          " don't bully me!")
         else:
             if (await app.get_users(username)).id not in \
-             await list_members(message.chat.id):
+                    await list_members(message.chat.id):
                 id = message.reply_to_message.from_user.id
                 await message.reply_to_message.chat.kick_member(id)
                 await message.reply_text(f"Unbanned {username}")

+ 2 - 2
wbb/modules/images.py

@@ -42,8 +42,8 @@ async def wall(client, message):
 
     json_rep = r.get(api).json()
     if not json_rep.get("success"):
-        await m.edit("FTS! something unusual happened, " +
-                     "report to support @Thepirategang")
+        await m.edit("FTS! something unusual happened, "
+                     + "report to support @Thepirategang")
     else:
         wallpapers = json_rep.get("wallpapers")
         if not wallpapers:

+ 3 - 3
wbb/modules/misc.py

@@ -3,9 +3,9 @@ from wbb.utils import cust_filter, random_line
 
 __MODULE__ = "Misc"
 __HELP__ = "/commit - Generate Funny Commit Messages\n" \
-            "/runs - Idk Test Yourself\n" \
-            "/quote - Get Random Linux Quotes\n" \
-            "/id - Get Chat_ID or User_ID"
+           "/runs - Idk Test Yourself\n" \
+           "/quote - Get Random Linux Quotes\n" \
+           "/id - Get Chat_ID or User_ID"
 
 
 @app.on_message(cust_filter.command(commands=("commit")))

+ 1 - 2
wbb/modules/music.py

@@ -22,8 +22,7 @@ async def music(client, message):
         link = (message.text.split(None, 1)[1])
     except IndexError:
         await message.reply_text(
-            "<code>\"/music\" needs a keyword argument</code>"
-            )
+            "<code>\"/music\" needs a keyword argument</code>")
 
     with youtube_dl.YoutubeDL(ydl_opts) as ydl:
         info_dict = ydl.extract_info(link, download=False)

+ 3 - 4
wbb/modules/paste.py

@@ -29,7 +29,6 @@ async def paste(client, message):
             await m.edit(final_link, disable_web_page_preview=True)
     elif bool(message.reply_to_message) is False:
         await message.reply_text(
-            "```Reply To A Message With /paste, Just Hitting /paste " +
-            "Won't Do Anything Other Than Proving Everyone That " +
-            "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia'```"
-            )
+            "Reply To A Message With /paste, Just Hitting /paste "
+            + "Won't Do Anything Other Than Proving Everyone That "
+            + "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia")

+ 2 - 3
wbb/modules/repo.py

@@ -11,6 +11,5 @@ __HELP__ = "/repo - To Get My Github Repository Link" + \
 async def repo(client, message):
     app.set_parse_mode("markdown")
     await message.reply_text(
-        "[Github](https://github.com/thehamkercat/WilliamButcherBot)" +
-        " | [Group](t.me/Thepirategang)", disable_web_page_preview=True
-        )
+        "[Github](https://github.com/thehamkercat/WilliamButcherBot)"
+        + " | [Group](t.me/Thepirategang)", disable_web_page_preview=True)

+ 5 - 7
wbb/modules/rice.py

@@ -5,7 +5,7 @@ from pyrogram import filters
 
 __MODULE__ = "Rice"
 __HELP__ = "/rice - To Forward Your Linux Rice To DE_WM's" \
-            "Rice Gallery only works in [DE_WM](t.me/de_wm)"
+           "Rice Gallery only works in [DE_WM](t.me/de_wm)"
 
 
 @app.on_message(filters.chat('DE_WM') & cust_filter.command(commands=("rice")))
@@ -18,12 +18,10 @@ async def rice(client, message):
         await m.edit(
             f"[Your](tg://user?id={id}) Rice Forwared"
             " To [Rice Gallery](https://t.me/RiceGallery)",
-            disable_web_page_preview=True
-        )
+            disable_web_page_preview=True)
 
     elif bool(message.reply_to_message) is False:
         await message.reply_text(
-            "```Reply To A Message With /rice, Just Hitting /rice " +
-            "Won't Do Anything Other Than Proving Everyone That " +
-            "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia'```"
-            )
+            "Reply To A Message With /rice, Just Hitting /rice "
+            + "Won't Do Anything Other Than Proving Everyone That "
+            + "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia")

+ 2 - 4
wbb/modules/sudoers.py

@@ -52,10 +52,8 @@ async def paste_log_neko(client, query):
         keyb = types.InlineKeyboardMarkup(
             [[types.InlineKeyboardButton("Pasted!", url=f"{data}")]]
         )
-        await query.message.edit_caption(
-                                            "Successfully Nekofied",
-                                            reply_markup=keyb
-                                        )
+        await query.message.edit_caption("Successfully Nekofied",
+                                         reply_markup=keyb)
     else:
         await client.answer_callback_query(
             query.id, "'Blue Button Must Press', huh?", show_alert=True

+ 1 - 2
wbb/utils/misc.py

@@ -21,8 +21,7 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
                 EqInlineKeyboardButton(
                     x.__MODULE__,
                     callback_data="{}_module({})".format(
-                        prefix, x.__MODULE__.lower()
-                        ),
+                        prefix, x.__MODULE__.lower()),
                 )
                 for x in module_dict.values()
             ]