From c70e5f36101af78de984d97ea4547c8f6d953e99 Mon Sep 17 00:00:00 2001 From: Aditya Jetely Date: Tue, 4 Oct 2022 21:16:52 +0530 Subject: [PATCH] black formatting --- .../API/Cryptocurrency Converter/cryptozor.py | 3 +- Scripts/API/Football-Standings/main.py | 46 ++--- Scripts/API/GeoCode API/code.py | 10 +- .../create_sheet.py | 6 +- .../get_sheet.py | 6 +- .../Random_Album_API/application.py | 4 +- .../Random_Album_API/logics/app_logic.py | 4 +- Scripts/API/Random_Joke/joke.py | 12 +- Scripts/API/twilio_sms/twilio_sms.py | 4 +- Scripts/Bots/DiscordBot/bot.py | 4 +- Scripts/Bots/Instagram_Bot/Instagram_bot.py | 73 +++++-- Scripts/Bots/Telegram_Weather_Bot/server.py | 4 +- Scripts/Bots/Telegram_Weather_Bot/weather.py | 4 +- Scripts/Bots/Torrent-Search-Bot/bot.py | 4 +- Scripts/Bots/Torrent-Search-Bot/piratebay.py | 7 +- Scripts/Bots/Twitter_bot/Twitter_bot.py | 4 +- .../Bots/Typing_Test_Bot/Typing_test_bot.py | 4 +- Scripts/Bots/runPython_bot/bot/config.py | 4 +- .../Bots/runPython_bot/bot/execute_code.py | 4 +- .../Bots/runPython_bot/bot/run_python_bot.py | 18 +- Scripts/Miscellaneous/15Puzzle/15puzzle.py | 19 +- .../Arrow_Angle_detector/Arrow.py | 32 ++- .../main.py | 8 +- .../CHMOD_simplifier/chmod_simplifier.py | 4 +- .../Connect4Game/connect4game.py | 31 ++- .../Covidin Dashboard/covid19.py | 7 +- .../ebookConverter.py | 11 +- .../Excel_translator/excelTranslate.py | 4 +- .../detection_on_vid.py | 8 +- .../Miscellaneous/FileOrganizer/organize.py | 19 +- .../passwordGenerator.py | 18 +- .../Github-Folder-Download-Tool/gitfold.py | 36 +++- .../gmail_automation.py | 12 +- .../Miscellaneous/Image_Steganography/main.py | 4 +- .../Miscellaneous/Mass_Mail_Spammer/main.py | 7 +- .../Motion Detection and Tracking/tracking.py | 4 +- .../Movie_Recommeder/movie_recommendation.py | 9 +- .../neural_net.py | 4 +- .../Miscellaneous/Notepad_clone/notepad.py | 23 ++- .../PGM_Images_Simple_Processing/PGM.py | 10 +- .../Passwords_List_Generator/main.py | 6 +- .../Miscellaneous/PomodoroTimer/pomodoro.py | 6 +- Scripts/Miscellaneous/Pong Game/game.py | 36 +++- .../Prograamming Quiz GUI/Quiz.py | 190 +++++++++++------- .../Prograamming Quiz GUI/questions.py | 180 ++++++++++++----- .../get_details.py | 18 +- .../Miscellaneous/RollaDice-Game/rolladice.py | 4 +- .../Scientific_Calculator.py | 16 +- .../Screenshot-and-Share/main.py | 4 +- .../Search_In_SRTs/search_in_srt.py | 8 +- Scripts/Miscellaneous/Snake_Game/snake.py | 17 +- .../spotify_playlist_generator.py | 14 +- .../Streamlit_webapp/Compound_interest.py | 10 +- Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py | 4 +- .../Windows_Wallpaper_Changer/background.py | 4 +- .../Youtube_Downloader/youtube_downloader.py | 12 +- Scripts/Miscellaneous/netcat/netcat.py | 32 ++- .../Miscellaneous/portscanner/portscanner.py | 8 +- .../sudokuSolver/sudokuSolver.py | 4 +- .../Algo_Trading_Articles_Scrapper/scraper.py | 4 +- .../COVID-19_Scraper/COVIDWebScraper.py | 4 +- .../COVID-19_Stats/COVID-19_scraper.py | 43 +++- .../CodeChef_Scraper/codechef_ps.py | 9 +- .../CodeForces_Scraper/codeforces_scraper.py | 5 +- .../CodeforcesProfileScrapper/main.py | 42 +++- .../Codeforces_ratings_scraper/cf_ratings.py | 4 +- .../live_scores.py | 24 ++- .../devfest_schedule.py | 15 +- .../Discord_News_Hook/inshorts.py | 10 +- .../economictimes_scraper.py | 14 +- Scripts/Web_Scrappers/GSoC-Scraper/script.py | 22 +- .../IMDB-Mass-Scraper/settings.py | 4 +- .../Instagram_Metadata_Scrapper/scrapper.py | 10 +- .../LeetCode_Scraper/leet_code_scraper.py | 8 +- Scripts/Web_Scrappers/Lyrics_Scraper/app.py | 6 +- .../micheline_scraper.py | 8 +- .../Movies_by_Genre_scrapper/top100_scrapy.py | 10 +- .../Project_euler_scraper.py | 4 +- .../Pycon_Proposals/pycon_proposals.py | 30 ++- .../rotten_tomatoes_scrapper.py | 4 +- .../Web_Scrappers/ThisXDoesNotExist/functs.py | 11 +- .../Top_Torrents_ThePirateBay/toptorrents.py | 30 ++- .../twitter_sentiment_analysis.py | 8 +- .../cricbuzz_latest_cricket_news/main.py | 7 +- .../cricket_scrapper/crick_info.py | 8 +- .../cricketmonthly_articles/main.py | 8 +- .../google_news_(ui_based)/main.py | 48 +++-- .../linkedin_posts_scrapping/main.py | 12 +- Scripts/Web_Scrappers/xmlrpc_tool/xml_tool.py | 9 +- 89 files changed, 1095 insertions(+), 394 deletions(-) diff --git a/Scripts/API/Cryptocurrency Converter/cryptozor.py b/Scripts/API/Cryptocurrency Converter/cryptozor.py index 56e5bd332..4e0501706 100644 --- a/Scripts/API/Cryptocurrency Converter/cryptozor.py +++ b/Scripts/API/Cryptocurrency Converter/cryptozor.py @@ -8,7 +8,8 @@ def __init__(self, currency, cryptocurrency): def convert(self, amount): api = requests.get( - "https://api.coinbase.com/v2/exchange-rates?currency=" + self.cryptocurrency + "https://api.coinbase.com/v2/exchange-rates?currency=" + + self.cryptocurrency ) try: currentPrice = api.json()["data"]["rates"][self.currency] diff --git a/Scripts/API/Football-Standings/main.py b/Scripts/API/Football-Standings/main.py index d69806ee5..6d9eaa3a7 100644 --- a/Scripts/API/Football-Standings/main.py +++ b/Scripts/API/Football-Standings/main.py @@ -9,7 +9,10 @@ LEAGUE_CODE = { "BSA": {"code": 2013, "name": "Brazilian First Division"}, "BL": {"code": 2002, "name": "Bundesliga"}, # Bundesliga - "ECL": {"code": 2016, "name": "English Championship"}, # English Championship + "ECL": { + "code": 2016, + "name": "English Championship", + }, # English Championship "ERD": {"code": 2003, "name": "Eredivisie"}, # Eredivisie [Dutch] "L1": {"code": 2015, "name": "Ligue 1"}, # Ligue 1 "SPA": {"code": 2014, "name": "La Liga"}, # La Liga @@ -42,32 +45,27 @@ def print_standings(league_id): + str(obj["season"]["currentMatchday"]) + "\n" ) - str_re += ( - "╔════╤════════════════════════════════════╤════╤════╤════╤════╤═════╤═════╗\n" - ) - str_re += ( - "║ SN │ TEAM │ M │ W │ D │ L │ PTS │ GD ║\n" - ) - str_re += ( - "╠════╪════════════════════════════════════╪════╪════╪════╪════╪═════╪═════╣\n" - ) + str_re += "╔════╤════════════════════════════════════╤════╤════╤════╤════╤═════╤═════╗\n" + str_re += "║ SN │ TEAM │ M │ W │ D │ L │ PTS │ GD ║\n" + str_re += "╠════╪════════════════════════════════════╪════╪════╪════╪════╪═════╪═════╣\n" for team in obj["standings"][0]["table"]: - text = "║ %-2d │ %-34s │ %-2d │ %-2d │ %-2d │ %-2d │ %-3d │ %+-3d ║\n" % ( - team["position"], - team["team"]["name"][:34], - team["playedGames"], - team["won"], - team["draw"], - team["lost"], - team["points"], - team["goalDifference"], + text = ( + "║ %-2d │ %-34s │ %-2d │ %-2d │ %-2d │ %-2d │ %-3d │ %+-3d ║\n" + % ( + team["position"], + team["team"]["name"][:34], + team["playedGames"], + team["won"], + team["draw"], + team["lost"], + team["points"], + team["goalDifference"], + ) ) str_re += text - str_re += ( - "╚════╧════════════════════════════════════╧════╧════╧════╧════╧═════╧═════╝" - ) + str_re += "╚════╧════════════════════════════════════╧════╧════╧════╧════╧═════╧═════╝" print(str_re) @@ -88,7 +86,9 @@ def print_standings(league_id): if arg in ["--help", "-h"]: print("List of leagues and the codes: ") for sno, key in enumerate(LEAGUE_CODE.keys()): - print("%2d. %-30s %s" % (sno + 1, LEAGUE_CODE[key]["name"], key)) + print( + "%2d. %-30s %s" % (sno + 1, LEAGUE_CODE[key]["name"], key) + ) sys.exit(0) league_id = LEAGUE_CODE.get(arg) diff --git a/Scripts/API/GeoCode API/code.py b/Scripts/API/GeoCode API/code.py index ca7b6eda9..628e90990 100644 --- a/Scripts/API/GeoCode API/code.py +++ b/Scripts/API/GeoCode API/code.py @@ -51,7 +51,15 @@ where.write("myData = [\n") for item in adrs: - st = "[" + str(item[0]) + ", " + str(item[1]) + ", '" + str(item[2]) + "' ], \n" + st = ( + "[" + + str(item[0]) + + ", " + + str(item[1]) + + ", '" + + str(item[2]) + + "' ], \n" + ) where.write(st) where.write(",\n") where.write("];\n") diff --git a/Scripts/API/Google-spreadsheet-share-and-retrieve/create_sheet.py b/Scripts/API/Google-spreadsheet-share-and-retrieve/create_sheet.py index 593bf0989..303bf9bdf 100644 --- a/Scripts/API/Google-spreadsheet-share-and-retrieve/create_sheet.py +++ b/Scripts/API/Google-spreadsheet-share-and-retrieve/create_sheet.py @@ -71,7 +71,11 @@ def create_and_share_sheet(user_mail, spreadsheet_name, csv_file): required=True, ) parser.add_argument( - "-csv", help="Enter path of csv file", dest="csv", type=str, required=True + "-csv", + help="Enter path of csv file", + dest="csv", + type=str, + required=True, ) parser.add_argument( "-spreadsheet_name", diff --git a/Scripts/API/Google-spreadsheet-share-and-retrieve/get_sheet.py b/Scripts/API/Google-spreadsheet-share-and-retrieve/get_sheet.py index 6cbddd46e..c7ee83a75 100644 --- a/Scripts/API/Google-spreadsheet-share-and-retrieve/get_sheet.py +++ b/Scripts/API/Google-spreadsheet-share-and-retrieve/get_sheet.py @@ -36,7 +36,11 @@ def get_sheet_json(spreadsheet_name, json_file): description="get data from spreadsheet in json format" ) parser.add_argument( - "-json", help="Enter path of json file", dest="json", type=str, required=True + "-json", + help="Enter path of json file", + dest="json", + type=str, + required=True, ) parser.add_argument( "-spreadsheet_name", diff --git a/Scripts/API/Random_Album_API/Random_Album_API/application.py b/Scripts/API/Random_Album_API/Random_Album_API/application.py index 680eb4f78..90020c9d2 100644 --- a/Scripts/API/Random_Album_API/Random_Album_API/application.py +++ b/Scripts/API/Random_Album_API/Random_Album_API/application.py @@ -6,7 +6,9 @@ # Register the blueprint app.register_blueprint(random_album) # Add the route to the view class -app.add_url_rule("/v1/random-album/", view_func=RandomAlbumAPI.as_view("random-album")) +app.add_url_rule( + "/v1/random-album/", view_func=RandomAlbumAPI.as_view("random-album") +) # Exception Handler @app.errorhandler(APIException) diff --git a/Scripts/API/Random_Album_API/Random_Album_API/logics/app_logic.py b/Scripts/API/Random_Album_API/Random_Album_API/logics/app_logic.py index ab78d285f..650bd45c9 100644 --- a/Scripts/API/Random_Album_API/Random_Album_API/logics/app_logic.py +++ b/Scripts/API/Random_Album_API/Random_Album_API/logics/app_logic.py @@ -19,7 +19,9 @@ def load_dataset(self): def get_random_album(self): """Get a random album from dataset""" - self.__out = self.dataset.iloc[[random.randint(0, 499)]].to_dict("record") + self.__out = self.dataset.iloc[[random.randint(0, 499)]].to_dict( + "record" + ) def get_all_album(self): """In case if you want all the records""" diff --git a/Scripts/API/Random_Joke/joke.py b/Scripts/API/Random_Joke/joke.py index 6d110f586..225218175 100644 --- a/Scripts/API/Random_Joke/joke.py +++ b/Scripts/API/Random_Joke/joke.py @@ -11,7 +11,9 @@ JOKE_TWO_PARTS = f"""{fg(40) + attr("bold") + attr("dim")}Setup: {rst + fg(202)}{{setup}} {fg(40) + attr("bold") + attr("dim")}Delivery: {rst + fg(202)}{{delivery}}""" -JOKE_SINGLE = f"""{fg(40) + attr("bold") + attr("dim")}Joke: {rst + fg(202)}{{joke}}""" +JOKE_SINGLE = ( + f"""{fg(40) + attr("bold") + attr("dim")}Joke: {rst + fg(202)}{{joke}}""" +) DEFAULT_FORMAT = f"""{fg(46) + attr("bold") + attr("dim")}Category: {rst + fg(214)}{{category}} {fg(46) + attr("bold") + attr("dim")}Type: {rst + fg(214)}{{type}} @@ -56,7 +58,9 @@ def main(category: str = "Any", exclude: str = ""): if res["error"]: print( - ERROR_MSG.format(error_message=rst + fg(9) + res["additionalInfo"]), + ERROR_MSG.format( + error_message=rst + fg(9) + res["additionalInfo"] + ), file=sys.stderr, ) sys.exit(1) @@ -66,7 +70,9 @@ def main(category: str = "Any", exclude: str = ""): DEFAULT_FORMAT.format( category=res["category"], type=res["type"], - joke=JOKE_TWO_PARTS.format(setup=res["setup"], delivery=res["delivery"]) + joke=JOKE_TWO_PARTS.format( + setup=res["setup"], delivery=res["delivery"] + ) if res["type"] == "twopart" else JOKE_SINGLE.format(joke=res["joke"]), ) diff --git a/Scripts/API/twilio_sms/twilio_sms.py b/Scripts/API/twilio_sms/twilio_sms.py index 0a1e7aeb4..1e9409b7c 100644 --- a/Scripts/API/twilio_sms/twilio_sms.py +++ b/Scripts/API/twilio_sms/twilio_sms.py @@ -6,7 +6,9 @@ def send_message_phone(phone, body): account_sid = "" # Replace this with your account sid - auth_token = "" # Replace this with your account Auth Token + auth_token = ( + "" # Replace this with your account Auth Token + ) # Create a client object from Twilio Rest client = Client(account_sid, auth_token) retry_count = 0 diff --git a/Scripts/Bots/DiscordBot/bot.py b/Scripts/Bots/DiscordBot/bot.py index 54a350bbf..62d4a7000 100644 --- a/Scripts/Bots/DiscordBot/bot.py +++ b/Scripts/Bots/DiscordBot/bot.py @@ -92,7 +92,9 @@ async def clear(ctx, amount=5): async def clear_error(ctx, error): - await ctx.send("Please specify the amount of messages to clear with tentacles") + await ctx.send( + "Please specify the amount of messages to clear with tentacles" + ) @client.command() diff --git a/Scripts/Bots/Instagram_Bot/Instagram_bot.py b/Scripts/Bots/Instagram_Bot/Instagram_bot.py index 23f95687e..e5c6701d9 100644 --- a/Scripts/Bots/Instagram_Bot/Instagram_bot.py +++ b/Scripts/Bots/Instagram_Bot/Instagram_bot.py @@ -11,7 +11,9 @@ class InstaBot: def __init__(self, username, pw): path = pathlib.Path().absolute() try: - self.driver = webdriver.Chrome(r"{}\{}".format(path, "chromedriver.exe")) + self.driver = webdriver.Chrome( + r"{}\{}".format(path, "chromedriver.exe") + ) except: try: self.driver = webdriver.Firefox( @@ -32,12 +34,18 @@ def __init__(self, username, pw): self.wait = WebDriverWait(self.driver, 10).until self.wait( - EC.presence_of_element_located((By.XPATH, "//input[@name='username']")) + EC.presence_of_element_located( + (By.XPATH, "//input[@name='username']") + ) ).send_keys(username) - self.driver.find_element_by_xpath("//input[@name='password']").send_keys(pw) + self.driver.find_element_by_xpath( + "//input[@name='password']" + ).send_keys(pw) self.driver.find_element_by_xpath('//button[@type="submit"]').click() try: - self.driver.find_element_by_xpath("//input[@aria-label='Security Code']") + self.driver.find_element_by_xpath( + "//input[@aria-label='Security Code']" + ) print("\nEnter the otp and login to continue\n") for _ in range(2): WebDriverWait(self.driver, 50).until( @@ -65,15 +73,23 @@ def get_unfollowers(self): ).click() self.driver.find_element_by_xpath("//div[text()='Profile']").click() self.wait( - EC.element_to_be_clickable((By.XPATH, "//a[contains(@href,'/following')]")) + EC.element_to_be_clickable( + (By.XPATH, "//a[contains(@href,'/following')]") + ) ).click() following = self._get_names() self.wait( - EC.element_to_be_clickable((By.XPATH, "//a[contains(@href,'/followers')]")) + EC.element_to_be_clickable( + (By.XPATH, "//a[contains(@href,'/followers')]") + ) ).click() followers = self._get_names() - not_following_back = [user for user in following if user not in followers] - you_not_following_back = [user for user in followers if user not in following] + not_following_back = [ + user for user in following if user not in followers + ] + you_not_following_back = [ + user for user in followers if user not in following + ] self.driver.find_element_by_xpath("//img[@alt='Instagram']").click() with open("Not Following Back", "w") as f1: @@ -84,7 +100,9 @@ def get_unfollowers(self): self.driver.minimize_window() print( - "People who aren't following back ({}) :\n".format(len(not_following_back)) + "People who aren't following back ({}) :\n".format( + len(not_following_back) + ) ) print("\n".join(not_following_back)) print("\n\nDo you want to UNFOLLOW them all??") @@ -142,14 +160,21 @@ def unfollow(self, not_following_back): ) ).click() self.wait( - EC.element_to_be_clickable((By.XPATH, "//input[@placeholder='Search']")) + EC.element_to_be_clickable( + (By.XPATH, "//input[@placeholder='Search']") + ) ).click() self.wait( - EC.element_to_be_clickable((By.XPATH, "//a[@href='/{}/']".format(i))) + EC.element_to_be_clickable( + (By.XPATH, "//a[@href='/{}/']".format(i)) + ) ).click() self.wait( EC.element_to_be_clickable( - (By.XPATH, "//span[@class='glyphsSpriteFriend_Follow u-__7']") + ( + By.XPATH, + "//span[@class='glyphsSpriteFriend_Follow u-__7']", + ) ) ).click() sleep(1) @@ -175,7 +200,9 @@ def follow_back(self, you_not_following_back): "//input[@placeholder='Search']" ).send_keys(i) self.wait( - EC.element_to_be_clickable((By.XPATH, "//a[@href='/{}/']".format(i))) + EC.element_to_be_clickable( + (By.XPATH, "//a[@href='/{}/']".format(i)) + ) ).click() self.wait( EC.element_to_be_clickable( @@ -205,7 +232,9 @@ def spamming(self): "//input[@placeholder='Search']" ).send_keys(i) self.wait( - EC.presence_of_element_located((By.XPATH, "//a[@class='yCE8d ']")) + EC.presence_of_element_located( + (By.XPATH, "//a[@class='yCE8d ']") + ) ).click() self.wait( EC.element_to_be_clickable( @@ -232,7 +261,9 @@ def spamming(self): def log_out(self): self.driver.find_element_by_xpath("//img[@alt='Instagram']").click() self.wait( - EC.element_to_be_clickable((By.XPATH, "//span[@class='_2dbep qNELH']")) + EC.element_to_be_clickable( + (By.XPATH, "//span[@class='_2dbep qNELH']") + ) ).click() log_out = "/html/body/div[1]/section/nav/div[2]/div/div/div[3]/div/div[5]/div[2]/div/div[2]/div[2]/div/div/div/div/div/div/div" self.wait(EC.element_to_be_clickable((By.XPATH, log_out))).click() @@ -290,7 +321,9 @@ def check_user(self): decrypted = Fernet(key).decrypt( (str(data[i + 1])[0:-1].strip()).encode() ) - self.users[str(data[i])[0:-1].strip()] = str(decrypted.decode()) + self.users[str(data[i])[0:-1].strip()] = str( + decrypted.decode() + ) else: return 0 @@ -316,7 +349,9 @@ def start_cmd(self): a = int(input(" :- ").strip()) try: if a == 1: - print("\n----Please wait, this command will take several seconds----\n") + print( + "\n----Please wait, this command will take several seconds----\n" + ) self.bot.get_unfollowers() elif a == 2: self.bot.spamming() @@ -339,7 +374,9 @@ def add_user(): for i in range(a): username = input("Enter username {}: ".format(i + 1)) f.write(username + "\n") - password = input("Enter password of username( {} ): ".format(username)) + password = input( + "Enter password of username( {} ): ".format(username) + ) encrypted = Fernet(key).encrypt(password.encode()) f.write(encrypted.decode() + "\n") Users().check_user() diff --git a/Scripts/Bots/Telegram_Weather_Bot/server.py b/Scripts/Bots/Telegram_Weather_Bot/server.py index 919b73090..bc492ef74 100644 --- a/Scripts/Bots/Telegram_Weather_Bot/server.py +++ b/Scripts/Bots/Telegram_Weather_Bot/server.py @@ -17,7 +17,9 @@ def make_reply(message): reply = [] reply.append(stats["name"]) reply.append(f"Description: {stats['weather'][0]['description']}") - reply.append(f"Temperature(celcius): {round(stats['main']['temp'] - 273.15, 2)}") + reply.append( + f"Temperature(celcius): {round(stats['main']['temp'] - 273.15, 2)}" + ) reply.append( f"Max Temperature(celcius): {round(stats['main']['temp_max'] - 273.15, 2)}" ) diff --git a/Scripts/Bots/Telegram_Weather_Bot/weather.py b/Scripts/Bots/Telegram_Weather_Bot/weather.py index 29ac4427e..65535bd3e 100644 --- a/Scripts/Bots/Telegram_Weather_Bot/weather.py +++ b/Scripts/Bots/Telegram_Weather_Bot/weather.py @@ -6,9 +6,7 @@ class weather_info: def __init__(self, config): self.token = self.read_config(config) - self.base = ( - f"https://api.openweathermap.org/data/2.5/weather?appid={self.token}" - ) + self.base = f"https://api.openweathermap.org/data/2.5/weather?appid={self.token}" def get_info(self, city): url = self.base + f"&q={city}" diff --git a/Scripts/Bots/Torrent-Search-Bot/bot.py b/Scripts/Bots/Torrent-Search-Bot/bot.py index dc7ff632f..c47959188 100644 --- a/Scripts/Bots/Torrent-Search-Bot/bot.py +++ b/Scripts/Bots/Torrent-Search-Bot/bot.py @@ -85,7 +85,9 @@ def help(update, context): If Any Issues Contact : @Apex-code """ - context.bot.send_message(chat_id=update.effective_chat.id, text=helpmessage) + context.bot.send_message( + chat_id=update.effective_chat.id, text=helpmessage + ) def donate(update, context): diff --git a/Scripts/Bots/Torrent-Search-Bot/piratebay.py b/Scripts/Bots/Torrent-Search-Bot/piratebay.py index 78c2be447..b668ac320 100644 --- a/Scripts/Bots/Torrent-Search-Bot/piratebay.py +++ b/Scripts/Bots/Torrent-Search-Bot/piratebay.py @@ -29,7 +29,9 @@ def pirate(search): "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-US,en;q=0.9", } - result = json.loads(requests.get(url, headers=headers, cookies=cookies).text) + result = json.loads( + requests.get(url, headers=headers, cookies=cookies).text + ) for index, value in enumerate(result): if index > 25: break @@ -42,7 +44,8 @@ def pirate(search): data["uploaded-by"] = value["username"] data["magnetlink"] = scrapmag(data["hash"], data["name"]) data["size"] = ( - str(float("{:.2f}".format(float(value["size"]) / 1000000000))) + " GB" + str(float("{:.2f}".format(float(value["size"]) / 1000000000))) + + " GB" ) array.append(data) return array diff --git a/Scripts/Bots/Twitter_bot/Twitter_bot.py b/Scripts/Bots/Twitter_bot/Twitter_bot.py index 1aafc328d..5ffb1e450 100644 --- a/Scripts/Bots/Twitter_bot/Twitter_bot.py +++ b/Scripts/Bots/Twitter_bot/Twitter_bot.py @@ -12,7 +12,9 @@ def on_success(data): id = data["id"] st.create_favorite(id=id) # change 'nice tweet' too your desired retweet reply - st.update_status(status="Nice Tweet @" + username, in_reply_to_status_id=id) + st.update_status( + status="Nice Tweet @" + username, in_reply_to_status_id=id + ) print("https://twitter.com/" + username + "/status/" + str(id)) diff --git a/Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py b/Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py index 388087e6c..2b3eec9eb 100644 --- a/Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py +++ b/Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py @@ -14,7 +14,9 @@ def __init__(self): # Click 'Start Typing Test' while True: try: - play_button = self.chrome.find_element_by_class_name("start-btn") + play_button = self.chrome.find_element_by_class_name( + "start-btn" + ) play_button.click() break except Exception: diff --git a/Scripts/Bots/runPython_bot/bot/config.py b/Scripts/Bots/runPython_bot/bot/config.py index 6e66a4db9..9128b0890 100644 --- a/Scripts/Bots/runPython_bot/bot/config.py +++ b/Scripts/Bots/runPython_bot/bot/config.py @@ -12,4 +12,6 @@ I have limited resources. You may increase the timeout and run this bot on your own server if required.""" -restricted_message = f"☹️ SECURITY ISSUE:\nYou have used a restricted word \n{banned}" +restricted_message = ( + f"☹️ SECURITY ISSUE:\nYou have used a restricted word \n{banned}" +) diff --git a/Scripts/Bots/runPython_bot/bot/execute_code.py b/Scripts/Bots/runPython_bot/bot/execute_code.py index 687d28517..acac2d58b 100644 --- a/Scripts/Bots/runPython_bot/bot/execute_code.py +++ b/Scripts/Bots/runPython_bot/bot/execute_code.py @@ -102,7 +102,9 @@ def evaluate(input_text, return_val): manger = multiprocessing.Manager() return_val = manger.dict() # enable target function to return a value - process = multiprocessing.Process(target=evaluate, args=(input_text, return_val)) + process = multiprocessing.Process( + target=evaluate, args=(input_text, return_val) + ) process.start() process.join(6) # allow the process to run for 6 seconds if process.is_alive(): diff --git a/Scripts/Bots/runPython_bot/bot/run_python_bot.py b/Scripts/Bots/runPython_bot/bot/run_python_bot.py index 91739788f..e1def2693 100644 --- a/Scripts/Bots/runPython_bot/bot/run_python_bot.py +++ b/Scripts/Bots/runPython_bot/bot/run_python_bot.py @@ -34,7 +34,8 @@ def handle_long_message(msg): if msg: if len(msg) > 2000: return ( - msg[:2000] + "\n\n 😟 Output was too long, truncated to 2000 characters" + msg[:2000] + + "\n\n 😟 Output was too long, truncated to 2000 characters" ) return msg return "handle_long_message recieved an empty message" @@ -55,7 +56,9 @@ def start(update, context): """This fuction replies to the start command""" context.bot.send_message( - chat_id=update.effective_chat.id, text=start_text, parse_mode="Markdown" + chat_id=update.effective_chat.id, + text=start_text, + parse_mode="Markdown", ) # for more info on parse modes # see https://python-telegram-bot.readthedocs.io/en/stable/telegram.parsemode.html @@ -63,13 +66,17 @@ def start(update, context): def bot_help(update, context): """This function replies to the help command""" context.bot.send_message( - chat_id=update.effective_chat.id, text=help_text, parse_mode="Markdown" + chat_id=update.effective_chat.id, + text=help_text, + parse_mode="Markdown", ) def code_info(update, context): """This function replies to the code command.""" context.bot.send_message( - chat_id=update.effective_chat.id, text=code_text, parse_mode="Markdown" + chat_id=update.effective_chat.id, + text=code_text, + parse_mode="Markdown", ) def reply_execute(update, context): @@ -82,7 +89,8 @@ def reply_execute(update, context): if input_text == "hi": user = update.message.from_user context.bot.send_message( - chat_id=update.effective_chat.id, text=f'Hi! {user["username"]} 🥰' + chat_id=update.effective_chat.id, + text=f'Hi! {user["username"]} 🥰', ) if input_text.endswith("/e"): diff --git a/Scripts/Miscellaneous/15Puzzle/15puzzle.py b/Scripts/Miscellaneous/15Puzzle/15puzzle.py index eca20ee15..ef387aec3 100644 --- a/Scripts/Miscellaneous/15Puzzle/15puzzle.py +++ b/Scripts/Miscellaneous/15Puzzle/15puzzle.py @@ -33,7 +33,7 @@ def new_game(self, *args): # reset the game state self.moves = 25 self.start_time = time.time() - 54 - self.game_grid = list(range(1, c.GRID_LEN ** 2)) + [0] + self.game_grid = list(range(1, c.GRID_LEN**2)) + [0] self.game_grid = list(range(0, c.GRID_LEN * c.GRID_LEN)) random.shuffle(self.game_grid) while not is_solvable(self.game_grid): @@ -92,11 +92,15 @@ def init_grid(self): l.image = image l.grid(columnspan=2, padx=10, pady=5) # tell the performance - Label(f, text="It took you", bg="white", fg="#534648", font="Arial 16").grid( - row=1, column=0, pady=10 - ) Label( - f, textvariable=self.score, bg="white", fg="#534648", font="Arial 16 bold" + f, text="It took you", bg="white", fg="#534648", font="Arial 16" + ).grid(row=1, column=0, pady=10) + Label( + f, + textvariable=self.score, + bg="white", + fg="#534648", + font="Arial 16 bold", ).grid(row=1, column=1, pady=10) # play again button btn = Label( @@ -132,7 +136,10 @@ def update_grid(self): def swap_cells(self, x, y): self.moves += 1 - self.game_grid[x], self.game_grid[y] = self.game_grid[y], self.game_grid[x] + self.game_grid[x], self.game_grid[y] = ( + self.game_grid[y], + self.game_grid[x], + ) self.update_grid() # check if grid is solved if is_solved(self.game_grid): diff --git a/Scripts/Miscellaneous/Arrow_Angle_detector/Arrow.py b/Scripts/Miscellaneous/Arrow_Angle_detector/Arrow.py index beb163e40..4ac9b1081 100644 --- a/Scripts/Miscellaneous/Arrow_Angle_detector/Arrow.py +++ b/Scripts/Miscellaneous/Arrow_Angle_detector/Arrow.py @@ -21,17 +21,23 @@ def terminate(): text = "Left" while True: ret, frame = cap.read() # Reading each frame. - frame = cv2.resize(frame, (640, 480), interpolation=cv2.INTER_AREA) # Resizing + frame = cv2.resize( + frame, (640, 480), interpolation=cv2.INTER_AREA + ) # Resizing cropped = frame[100:400, 100:500] # Cropping the frame cropped = cv2.flip(cropped, 1) # Flipping the frame vertically temp = cropped # Temp is our original image cropped = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY) - mi = cv2.getTrackbarPos("min", "Adjust") # Getting the values from the trackbar + mi = cv2.getTrackbarPos( + "min", "Adjust" + ) # Getting the values from the trackbar _, threshold = cv2.threshold( cropped, mi, 255, cv2.THRESH_BINARY ) # Converting image to binary (1's and 0's only) - kernal = np.zeros([10, 10], np.uint8) # creating a square of 10X10 of zeroes + kernal = np.zeros( + [10, 10], np.uint8 + ) # creating a square of 10X10 of zeroes threshold = cv2.erode( threshold, kernal ) # using this square to remove noise from the threshold @@ -50,7 +56,9 @@ def terminate(): len(approx) == 7 ): # As an arrow has seven edges, hence we are selecting the polygon with 7 edges n = approx.ravel() # Converts 2d array into 1d array - x1 = n[0] # First Co-ordinate always point to the topmost vertex + x1 = n[ + 0 + ] # First Co-ordinate always point to the topmost vertex y1 = n[1] x2 = n[2] y2 = n[3] @@ -61,7 +69,9 @@ def terminate(): ratio = ( distance1 / distance2 ) # Ratio will help us to determine the orientation or angle of the arrow - if 2500 < approx_area < 25000 and (0.2 < ratio < 0.3 or ratio < 0.1): + if 2500 < approx_area < 25000 and ( + 0.2 < ratio < 0.3 or ratio < 0.1 + ): cv2.drawContours( temp, [approx], 0, (0, 0, 255), 5 ) # Outlining the detected arrow with red color @@ -76,7 +86,9 @@ def terminate(): if ( 0.2 < distance1 / distance2 < 0.3 ): # Finding the tip of the arrow with the help of the ratios of the distances - cv2.putText(temp, "Arrow tip", (x, y), font, 0.5, (0, 0, 255)) + cv2.putText( + temp, "Arrow tip", (x, y), font, 0.5, (0, 0, 255) + ) topx = x1 topy = y1 endx = (n[6] + n[8]) / 2 @@ -92,7 +104,9 @@ def terminate(): ) # Basic cirle property to print the angles ( between 90 and -90) else: - cv2.putText(temp, "Arrow end", (x, y), font, 0.5, (0, 0, 255)) + cv2.putText( + temp, "Arrow end", (x, y), font, 0.5, (0, 0, 255) + ) if distance1 / distance2 < 0.1: topx = n[8] topy = n[9] @@ -120,6 +134,8 @@ def terminate(): cv2.imshow("temp", temp) # Displaying original image cv2.imshow("threshold", threshold) # Displaying threshold image - if cv2.waitKey(1) & 0xFF == ord("q"): # Program will quite when q is pressed + if cv2.waitKey(1) & 0xFF == ord( + "q" + ): # Program will quite when q is pressed break terminate() diff --git a/Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py b/Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py index 38eb3c193..2c6ecf603 100644 --- a/Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py +++ b/Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py @@ -60,7 +60,9 @@ def mail(df, from_, password): encoders.encode_base64(p) name = re.split("/", filename)[-1] - p.add_header("Content-Disposition", "attachment; filename= %s" % name) + p.add_header( + "Content-Disposition", "attachment; filename= %s" % name + ) data.attach(p) @@ -84,7 +86,9 @@ def generate_certificate(df): for j in df["Name"]: img = Image.open("certificate_template.png") draw = ImageDraw.Draw(img) - draw.text(xy=(151, 560), text="{}".format(j), fill=(0, 217, 225), font=font) + draw.text( + xy=(151, 560), text="{}".format(j), fill=(0, 217, 225), font=font + ) img.save("pictures/{}.png".format(j)) diff --git a/Scripts/Miscellaneous/CHMOD_simplifier/chmod_simplifier.py b/Scripts/Miscellaneous/CHMOD_simplifier/chmod_simplifier.py index f97edfd23..6b0ed477d 100644 --- a/Scripts/Miscellaneous/CHMOD_simplifier/chmod_simplifier.py +++ b/Scripts/Miscellaneous/CHMOD_simplifier/chmod_simplifier.py @@ -20,7 +20,9 @@ def symb_to_num(symbolic): if len(symbolic) == 9: group = (symbolic[:-6], symbolic[3:-3], symbolic[6:]) try: - numeric = notation[group[0]] + notation[group[1]] + notation[group[2]] + numeric = ( + notation[group[0]] + notation[group[1]] + notation[group[2]] + ) except: numeric = "Invalid Symbolic Representation!" else: diff --git a/Scripts/Miscellaneous/Connect4Game/connect4game.py b/Scripts/Miscellaneous/Connect4Game/connect4game.py index 4de472386..6103d3d59 100644 --- a/Scripts/Miscellaneous/Connect4Game/connect4game.py +++ b/Scripts/Miscellaneous/Connect4Game/connect4game.py @@ -93,7 +93,12 @@ def draw_board(board): pygame.draw.rect( screen, BLACK, - (c * SQUARESIZE, r * SQUARESIZE + SQUARESIZE, SQUARESIZE, SQUARESIZE), + ( + c * SQUARESIZE, + r * SQUARESIZE + SQUARESIZE, + SQUARESIZE, + SQUARESIZE, + ), ) pygame.draw.circle( screen, @@ -138,18 +143,20 @@ def draw_board(board): player_two = StringVar(master=root) root.geometry("500x300") root.title("Connect 4 Game") - Label(master=root, text="Connect 4 Game", font=("Poppins", 30, "normal")).place( - x=80, y=20 - ) + Label( + master=root, text="Connect 4 Game", font=("Poppins", 30, "normal") + ).place(x=80, y=20) Label(master=root, text="Enter player 1 name: ").place(x=120, y=100) - Entry(master=root, textvariable=player_one, font=("calibre", 10, "normal")).place( - x=250, y=100 - ) + Entry( + master=root, textvariable=player_one, font=("calibre", 10, "normal") + ).place(x=250, y=100) Label(master=root, text="Enter player 2 name: ").place(x=120, y=140) - Entry(master=root, textvariable=player_two, font=("calibre", 10, "normal")).place( - x=250, y=140 + Entry( + master=root, textvariable=player_two, font=("calibre", 10, "normal") + ).place(x=250, y=140) + Button(master=root, text="ADD", width=10, command=submit).place( + x=210, y=190 ) - Button(master=root, text="ADD", width=10, command=submit).place(x=210, y=190) root.mainloop() if player_names[0] != "" and player_names[1] != "": @@ -229,7 +236,9 @@ def draw_board(board): if winning_move(board, 2): label = myfont.render( - player_names[1] + " wins the game", 1, YELLOW + player_names[1] + " wins the game", + 1, + YELLOW, ) screen.blit(label, (40, 10)) game_over = True diff --git a/Scripts/Miscellaneous/Covidin Dashboard/covid19.py b/Scripts/Miscellaneous/Covidin Dashboard/covid19.py index 09871b6ec..83bce4d48 100644 --- a/Scripts/Miscellaneous/Covidin Dashboard/covid19.py +++ b/Scripts/Miscellaneous/Covidin Dashboard/covid19.py @@ -45,7 +45,12 @@ if country != "": table_data = [] table_data = [ - [i["Country"], i["TotalConfirmed"], i["TotalRecovered"], i["TotalDeaths"]] + [ + i["Country"], + i["TotalConfirmed"], + i["TotalRecovered"], + i["TotalDeaths"], + ] for i in data["Countries"] if i["Country"].lower() == country.lower() ] diff --git a/Scripts/Miscellaneous/EPUB_MOBI_to_PDF_converter/ebookConverter.py b/Scripts/Miscellaneous/EPUB_MOBI_to_PDF_converter/ebookConverter.py index 5b59b3966..7736a89de 100644 --- a/Scripts/Miscellaneous/EPUB_MOBI_to_PDF_converter/ebookConverter.py +++ b/Scripts/Miscellaneous/EPUB_MOBI_to_PDF_converter/ebookConverter.py @@ -30,7 +30,9 @@ def chooseFile(): clearFrame() - label4 = Label(main_frame, text="Chosen file: " + CHOSEN_FILE_LOC.split("/")[-1]) + label4 = Label( + main_frame, text="Chosen file: " + CHOSEN_FILE_LOC.split("/")[-1] + ) button_next = Button( main_frame, text="CONVERT>> (takes 2-3 minutes)", @@ -60,7 +62,9 @@ def convertToPDF(): print("format is: " + file_ext) print("trimmed name is: " + file_name_trimmed) - result = convertapi.convert("pdf", {"File": CHOSEN_FILE_LOC}, from_format=file_ext) + result = convertapi.convert( + "pdf", {"File": CHOSEN_FILE_LOC}, from_format=file_ext + ) result.file.save(target_folder + "\\" + file_name_trimmed + ".pdf") @@ -122,7 +126,8 @@ def window2(): clearFrame() label3 = Label( - main_frame, text="Step 3: Choose the file to be converted(epub or mobi):" + main_frame, + text="Step 3: Choose the file to be converted(epub or mobi):", ) button_file_choose = Button( main_frame, diff --git a/Scripts/Miscellaneous/Excel_translator/excelTranslate.py b/Scripts/Miscellaneous/Excel_translator/excelTranslate.py index 738b724b8..a06a7df8a 100644 --- a/Scripts/Miscellaneous/Excel_translator/excelTranslate.py +++ b/Scripts/Miscellaneous/Excel_translator/excelTranslate.py @@ -54,7 +54,9 @@ translator = Translator() for index in data.index: for col in coltochange: - lineres = translator.translate(data[col][index], src=fromLang, des=toLang) + lineres = translator.translate( + data[col][index], src=fromLang, des=toLang + ) data[col][index] = lineres.text diff --git a/Scripts/Miscellaneous/Facial Expressions Detection/detection_on_vid.py b/Scripts/Miscellaneous/Facial Expressions Detection/detection_on_vid.py index 3f5d29f6d..4e672becf 100644 --- a/Scripts/Miscellaneous/Facial Expressions Detection/detection_on_vid.py +++ b/Scripts/Miscellaneous/Facial Expressions Detection/detection_on_vid.py @@ -65,7 +65,9 @@ def detect_expressions(frame, detection_model): try: - faces = cascade_model.detectMultiScale(frame, 1.1, 5) # Detect faces in a frame + faces = cascade_model.detectMultiScale( + frame, 1.1, 5 + ) # Detect faces in a frame for x, y, w, h in faces: @@ -85,7 +87,9 @@ def detect_expressions(frame, detection_model): cv2.putText(frame, "Sad", (x, y), font, 1, (0, 0, 255), 2) else: - cv2.putText(frame, "Surprised", (x, y), font, 1, (0, 0, 255), 2) + cv2.putText( + frame, "Surprised", (x, y), font, 1, (0, 0, 255), 2 + ) cv2.imshow("frame", frame) diff --git a/Scripts/Miscellaneous/FileOrganizer/organize.py b/Scripts/Miscellaneous/FileOrganizer/organize.py index 3265f298b..d31f3207f 100644 --- a/Scripts/Miscellaneous/FileOrganizer/organize.py +++ b/Scripts/Miscellaneous/FileOrganizer/organize.py @@ -21,7 +21,16 @@ def organizeThis(dir_path): # Check if files are music if filename.lower().endswith( - (".wav", ".mp3", ".flac", ".3gp", ".aa", ".aax", ".aiff", ".raw") + ( + ".wav", + ".mp3", + ".flac", + ".3gp", + ".aa", + ".aax", + ".aiff", + ".raw", + ) ): # If music folder doesnt exist then create if not os.path.exists(dir_path + "music"): @@ -42,7 +51,9 @@ def organizeThis(dir_path): # If executables folder doesnt exist then create if not os.path.exists(dir_path + "/executables"): os.makedirs(dir_path + "/executables") - shutil.copy2(dir_path + "/" + filename, dir_path + "/executables") + shutil.copy2( + dir_path + "/" + filename, dir_path + "/executables" + ) os.remove(dir_path + "/" + filename) # Check if files are documents @@ -52,7 +63,9 @@ def organizeThis(dir_path): # If documents folder doesnt exist then create if not os.path.exists(dir_path + "/documents"): os.makedirs(dir_path + "/documents") - shutil.copy2(dir_path + "/" + filename, dir_path + "/documents") + shutil.copy2( + dir_path + "/" + filename, dir_path + "/documents" + ) os.remove(dir_path + "/" + filename) except OSError: diff --git a/Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py b/Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py index e5d6fa7d3..e393882f7 100644 --- a/Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py +++ b/Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py @@ -51,7 +51,9 @@ def generate(): passLen.set(0) passType = IntVar() -Label(root, text="Welcome to Password Generator", font="lucida 20 bold").pack(pady=10) +Label(root, text="Welcome to Password Generator", font="lucida 20 bold").pack( + pady=10 +) f1 = Frame(root) # Label for Enter Password length l1 = Label(f1, text="Enter password length", font="lucida 10 bold") @@ -69,10 +71,20 @@ def generate(): column=4, ) r2 = Radiobutton( - f1, text="AlphaNumeric", value=2, variable=passType, padx=10, font="lucida 12" + f1, + text="AlphaNumeric", + value=2, + variable=passType, + padx=10, + font="lucida 12", ).grid(row=3, column=4) r3 = Radiobutton( - f1, text="Extreme Secure", value=3, variable=passType, padx=10, font="lucida 12" + f1, + text="Extreme Secure", + value=3, + variable=passType, + padx=10, + font="lucida 12", ).grid(row=4, column=4) # Submit Button diff --git a/Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py b/Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py index ba24863ab..d0ab3b2f5 100644 --- a/Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py +++ b/Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py @@ -66,10 +66,14 @@ def recursive_folder_download(folder_links_received, file_hrefs_received): mkdir( folder_name ) # creates a local copy|mirror of the currently walked|selected github folder. ... helps preserve folder structure - chdir(folder_name) # changes working directory to the just created folder + chdir( + folder_name + ) # changes working directory to the just created folder print("current dir ==> ", getcwd()) # exit() - folder_list, file_list = get_folder_links("https://github.com" + folder) + folder_list, file_list = get_folder_links( + "https://github.com" + folder + ) recursive_folder_download(folder_list, file_list) chdir( ".." @@ -88,9 +92,17 @@ def recursive_folder_download(folder_links_received, file_hrefs_received): or "posix" in os_platform ): try: - mkdir(path.join(path.expanduser("~"), "Desktop", "Git-Folder_Download")) + mkdir( + path.join( + path.expanduser("~"), "Desktop", "Git-Folder_Download" + ) + ) except FileExistsError: - chdir(path.join(path.expanduser("~"), "Desktop", "Git-Folder_Download")) + chdir( + path.join( + path.expanduser("~"), "Desktop", "Git-Folder_Download" + ) + ) elif ( "win32" in os_platform @@ -99,16 +111,26 @@ def recursive_folder_download(folder_links_received, file_hrefs_received): or "win64" in os_platform ): try: - mkdir(path.join(path.expanduser("~"), "Desktop", "Git-Folder_Download")) + mkdir( + path.join( + path.expanduser("~"), "Desktop", "Git-Folder_Download" + ) + ) except FileExistsError: - chdir(path.join(path.expanduser("~"), "Desktop", "Git-Folder_Download")) + chdir( + path.join( + path.expanduser("~"), "Desktop", "Git-Folder_Download" + ) + ) # This lines above are probably redundant ... and self explanatory ... i hope i dont have to explain what it does # could replace them with a single "chdir(path.join(os.path.expanduser('~'), 'Desktop','Git-Folder_Download'))"" while True: try: - url = str(argv[1]) # retrieves argument from user and sets it as the URL + url = str( + argv[1] + ) # retrieves argument from user and sets it as the URL except: print("[x] No link supplied! ... \n") url = str(input("[-] Paste Github link here \n [Ctr-v] ")) diff --git a/Scripts/Miscellaneous/Gmail_Automation_using_selenium/gmail_automation.py b/Scripts/Miscellaneous/Gmail_Automation_using_selenium/gmail_automation.py index 069df2150..33cd0916e 100644 --- a/Scripts/Miscellaneous/Gmail_Automation_using_selenium/gmail_automation.py +++ b/Scripts/Miscellaneous/Gmail_Automation_using_selenium/gmail_automation.py @@ -72,7 +72,9 @@ def main(): mark3 = 1 except AttributeError as exception: if mark3 == 0: - driver.find_element_by_name("password").send_keys(password_for_email) + driver.find_element_by_name("password").send_keys( + password_for_email + ) print("exception has been thown--> " + str(exception)) # driver.refresh() @@ -154,7 +156,9 @@ def main(): for i in filed: # pasting sender's email id - driver.find_element_by_class_name("vO").send_keys(sending_email_add) + driver.find_element_by_class_name("vO").send_keys( + sending_email_add + ) flag = 1 succ = driver.find_element_by_class_name("btA") @@ -165,7 +169,9 @@ def main(): if flag == 0: driver.refresh() time.sleep(4) - driver.find_element_by_class_name("vO").send_keys(sending_email_add) + driver.find_element_by_class_name("vO").send_keys( + sending_email_add + ) driver.find_element_by_class_name("btA").click() else: diff --git a/Scripts/Miscellaneous/Image_Steganography/main.py b/Scripts/Miscellaneous/Image_Steganography/main.py index 4c27191c5..3b6f7695b 100755 --- a/Scripts/Miscellaneous/Image_Steganography/main.py +++ b/Scripts/Miscellaneous/Image_Steganography/main.py @@ -64,7 +64,9 @@ def main(): mode = input("Encode/Decode (e/d) : ") if mode.lower() == "e": img_path = input("Enter path to Image that you want to Encode : ") - name = input("Enter the Name of the Output File (without extension) : ") + name = input( + "Enter the Name of the Output File (without extension) : " + ) text = input("Enter the Text to be Hidden : ") encode(img_path, text, name) if mode.lower() == "d": diff --git a/Scripts/Miscellaneous/Mass_Mail_Spammer/main.py b/Scripts/Miscellaneous/Mass_Mail_Spammer/main.py index 7027cfd84..f865fbfb1 100644 --- a/Scripts/Miscellaneous/Mass_Mail_Spammer/main.py +++ b/Scripts/Miscellaneous/Mass_Mail_Spammer/main.py @@ -44,7 +44,8 @@ def rand_msg(spam): print("Message number #{}/{}".format(i + 1, spam)) msg.append( "".join( - random.choice(string.ascii_letters + string.digits) for _ in range(N) + random.choice(string.ascii_letters + string.digits) + for _ in range(N) ) ) sub.append(input("Enter subject : ")) @@ -93,7 +94,9 @@ def main(): greeting() email = input("Enter your email : ") - passwd = getpass.getpass("Enter your passwd : ") # take passwd into as hidden + passwd = getpass.getpass( + "Enter your passwd : " + ) # take passwd into as hidden target = input("Recipient's email : ") spam = input("Number of spam messages : ") diff --git a/Scripts/Miscellaneous/Motion Detection and Tracking/tracking.py b/Scripts/Miscellaneous/Motion Detection and Tracking/tracking.py index 107f37656..3897b809e 100644 --- a/Scripts/Miscellaneous/Motion Detection and Tracking/tracking.py +++ b/Scripts/Miscellaneous/Motion Detection and Tracking/tracking.py @@ -34,7 +34,9 @@ diff, cv2.COLOR_BGR2GRAY ) # Convert the difference frame to gray scale g_blur = cv2.GaussianBlur(gray_frame, (5, 5), 0) # Apply blurring - _, th = cv2.threshold(g_blur, 20, 255, cv2.THRESH_BINARY) # Apply THRESHOLD + _, th = cv2.threshold( + g_blur, 20, 255, cv2.THRESH_BINARY + ) # Apply THRESHOLD dilated_frame = cv2.dilate( th, kernel=kernel, iterations=3 ) # Dilation (morphology) diff --git a/Scripts/Miscellaneous/Movie_Recommeder/movie_recommendation.py b/Scripts/Miscellaneous/Movie_Recommeder/movie_recommendation.py index 7738184e5..29ffa8e63 100644 --- a/Scripts/Miscellaneous/Movie_Recommeder/movie_recommendation.py +++ b/Scripts/Miscellaneous/Movie_Recommeder/movie_recommendation.py @@ -63,7 +63,10 @@ def get_sorted_recommendations(listMovieTitle, recom_limit): listMovie = get_related_titles(listMovieTitle, recom_limit) listMovie = sorted( listMovie, - key=lambda movieName: (get_movie_rating(get_movie_data(movieName)), movieName), + key=lambda movieName: ( + get_movie_rating(get_movie_data(movieName)), + movieName, + ), reverse=True, ) return listMovie @@ -72,6 +75,8 @@ def get_sorted_recommendations(listMovieTitle, recom_limit): if __name__ == "__main__": movielist = input("Enter movies seprated by comma(,) - ").split(",") recommendation_limit = input("Enter the limit of of recommended movies - ") - recommended_Movies = get_sorted_recommendations(movielist, recommendation_limit) + recommended_Movies = get_sorted_recommendations( + movielist, recommendation_limit + ) for movies in recommended_Movies: print(f"{recommended_Movies.index(movies)+1}. {movies}") diff --git a/Scripts/Miscellaneous/Neural Networks From Scratch/neural_net.py b/Scripts/Miscellaneous/Neural Networks From Scratch/neural_net.py index 8de306826..e6bf4227e 100644 --- a/Scripts/Miscellaneous/Neural Networks From Scratch/neural_net.py +++ b/Scripts/Miscellaneous/Neural Networks From Scratch/neural_net.py @@ -91,7 +91,9 @@ def fit(self, X, y, epochs=50, lr=1e-3): # Heres a simple example with the XOR gate. -X_train = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) # Generate the training X data +X_train = np.array( + [[0, 0], [0, 1], [1, 0], [1, 1]] +) # Generate the training X data y_train = np.array([[0], [1], [1], [0]]) # Generate the training y data diff --git a/Scripts/Miscellaneous/Notepad_clone/notepad.py b/Scripts/Miscellaneous/Notepad_clone/notepad.py index d934932df..3ff7625ef 100644 --- a/Scripts/Miscellaneous/Notepad_clone/notepad.py +++ b/Scripts/Miscellaneous/Notepad_clone/notepad.py @@ -58,7 +58,9 @@ def __init__(self, *args, **kwargs): file_toolbar.addAction(save_file_action) saveas_file_action = QAction( - QIcon(os.path.join("images", "disk--pencil.png")), "Save As...", self + QIcon(os.path.join("images", "disk--pencil.png")), + "Save As...", + self, ) saveas_file_action.setStatusTip("Save current page to specified file") saveas_file_action.triggered.connect(self.file_saveas) @@ -79,7 +81,9 @@ def __init__(self, *args, **kwargs): edit_menu = self.menuBar().addMenu("&Edit") undo_action = QAction( - QIcon(os.path.join("images", "arrow-curve-180-left.png")), "Undo", self + QIcon(os.path.join("images", "arrow-curve-180-left.png")), + "Undo", + self, ) undo_action.setStatusTip("Undo last change") undo_action.triggered.connect(self.editor.undo) @@ -95,7 +99,9 @@ def __init__(self, *args, **kwargs): edit_menu.addSeparator() - cut_action = QAction(QIcon(os.path.join("images", "scissors.png")), "Cut", self) + cut_action = QAction( + QIcon(os.path.join("images", "scissors.png")), "Cut", self + ) cut_action.setStatusTip("Cut selected text") cut_action.triggered.connect(self.editor.cut) edit_toolbar.addAction(cut_action) @@ -120,7 +126,9 @@ def __init__(self, *args, **kwargs): edit_menu.addAction(paste_action) select_action = QAction( - QIcon(os.path.join("images", "selection-input.png")), "Select all", self + QIcon(os.path.join("images", "selection-input.png")), + "Select all", + self, ) select_action.setStatusTip("Select all text") select_action.triggered.connect(self.editor.selectAll) @@ -204,11 +212,14 @@ def file_print(self): def update_title(self): self.setWindowTitle( - "%s - No2Pads" % (os.path.basename(self.path) if self.path else "Untitled") + "%s - No2Pads" + % (os.path.basename(self.path) if self.path else "Untitled") ) def edit_toggle_wrap(self): - self.editor.setLineWrapMode(1 if self.editor.lineWrapMode() == 0 else 0) + self.editor.setLineWrapMode( + 1 if self.editor.lineWrapMode() == 0 else 0 + ) if __name__ == "__main__": diff --git a/Scripts/Miscellaneous/PGM_Images_Simple_Processing/PGM.py b/Scripts/Miscellaneous/PGM_Images_Simple_Processing/PGM.py index 1b4c937ba..55e21216e 100644 --- a/Scripts/Miscellaneous/PGM_Images_Simple_Processing/PGM.py +++ b/Scripts/Miscellaneous/PGM_Images_Simple_Processing/PGM.py @@ -92,9 +92,9 @@ def rotate(self, degrees): for _ in range(times): # para cada vez no numero total de vezes for i in range(self.height): for j in range(self.width): - rotated_image_matrix[j][self.height - 1 - i] = self.image_matrix[i][ - j - ] + rotated_image_matrix[j][ + self.height - 1 - i + ] = self.image_matrix[i][j] rotated_width = self.height rotated_height = self.width @@ -122,4 +122,6 @@ def rotate(self, degrees): # rotating image by 90 degrees rotated_image, rotated_width, rotated_height = processor.rotate(90) # saving rotated image - processor.save("rotated-image.pgm", rotated_image, rotated_width, rotated_height) + processor.save( + "rotated-image.pgm", rotated_image, rotated_width, rotated_height + ) diff --git a/Scripts/Miscellaneous/Passwords_List_Generator/main.py b/Scripts/Miscellaneous/Passwords_List_Generator/main.py index 70b44e13f..0b1d108c6 100644 --- a/Scripts/Miscellaneous/Passwords_List_Generator/main.py +++ b/Scripts/Miscellaneous/Passwords_List_Generator/main.py @@ -13,9 +13,9 @@ def get_information(): more = input("Would you like to add more information? [y/N]: ") if more.lower() == "y": - more_info = input("Enter related keywords separated by commas: ").replace( - " ", "" - ) + more_info = input( + "Enter related keywords separated by commas: " + ).replace(" ", "") info_list = more_info.split(",") for element in info_list: information.append(element) diff --git a/Scripts/Miscellaneous/PomodoroTimer/pomodoro.py b/Scripts/Miscellaneous/PomodoroTimer/pomodoro.py index da93f6e5c..d2259f423 100644 --- a/Scripts/Miscellaneous/PomodoroTimer/pomodoro.py +++ b/Scripts/Miscellaneous/PomodoroTimer/pomodoro.py @@ -13,7 +13,11 @@ class Pomodoro: TIMER_LONG_BREAK = 3 def __init__( - self, task_goal, long_break_length, short_break_length, task_length_minutes + self, + task_goal, + long_break_length, + short_break_length, + task_length_minutes, ): """ Initialize a pomodoro timer diff --git a/Scripts/Miscellaneous/Pong Game/game.py b/Scripts/Miscellaneous/Pong Game/game.py index d58e97be7..206e66b79 100644 --- a/Scripts/Miscellaneous/Pong Game/game.py +++ b/Scripts/Miscellaneous/Pong Game/game.py @@ -98,7 +98,9 @@ def __init__(self, color): # Show the Ball def show(self): - pygame.draw.ellipse(display, self.color, (self.x, self.y, self.r, self.r)) + pygame.draw.ellipse( + display, self.color, (self.x, self.y, self.r, self.r) + ) # Move the Ball def move(self): @@ -169,37 +171,51 @@ def checkForPaddle(self): self.angle = -135 if ( rightPaddle.y + 10 < self.y < rightPaddle.y + 20 - or rightPaddle.y + 10 < self.y + self.r < rightPaddle.y + 20 + or rightPaddle.y + 10 + < self.y + self.r + < rightPaddle.y + 20 ): self.angle = -150 if ( rightPaddle.y + 20 < self.y < rightPaddle.y + 30 - or rightPaddle.y + 20 < self.y + self.r < rightPaddle.y + 30 + or rightPaddle.y + 20 + < self.y + self.r + < rightPaddle.y + 30 ): self.angle = -165 if ( rightPaddle.y + 30 < self.y < rightPaddle.y + 40 - or rightPaddle.y + 30 < self.y + self.r < rightPaddle.y + 40 + or rightPaddle.y + 30 + < self.y + self.r + < rightPaddle.y + 40 ): self.angle = 170 if ( rightPaddle.y + 40 < self.y < rightPaddle.y + 50 - or rightPaddle.y + 40 < self.y + self.r < rightPaddle.y + 50 + or rightPaddle.y + 40 + < self.y + self.r + < rightPaddle.y + 50 ): self.angle = 190 if ( rightPaddle.y + 50 < self.y < rightPaddle.y + 60 - or rightPaddle.y + 50 < self.y + self.r < rightPaddle.y + 60 + or rightPaddle.y + 50 + < self.y + self.r + < rightPaddle.y + 60 ): self.angle = 165 if ( rightPaddle.y + 60 < self.y < rightPaddle.y + 70 - or rightPaddle.y + 60 < self.y + self.r < rightPaddle.y + 70 + or rightPaddle.y + 60 + < self.y + self.r + < rightPaddle.y + 70 ): self.angle = 150 if ( rightPaddle.y + 70 < self.y < rightPaddle.y + 80 - or rightPaddle.y + 70 < self.y + self.r < rightPaddle.y + 80 + or rightPaddle.y + 70 + < self.y + self.r + < rightPaddle.y + 80 ): self.angle = 135 @@ -226,7 +242,9 @@ def gameOver(): if event.key == pygame.K_r: reset() if scoreLeft == maxScore: - playerWins = largeFont.render("Red wins!Press R to reset!", True, red) + playerWins = largeFont.render( + "Red wins!Press R to reset!", True, red + ) display.blit(playerWins, (40, height / 2)) elif scoreRight == maxScore: playerWins = largeFont.render( diff --git a/Scripts/Miscellaneous/Prograamming Quiz GUI/Quiz.py b/Scripts/Miscellaneous/Prograamming Quiz GUI/Quiz.py index 996b70ef9..ad52f7ad3 100644 --- a/Scripts/Miscellaneous/Prograamming Quiz GUI/Quiz.py +++ b/Scripts/Miscellaneous/Prograamming Quiz GUI/Quiz.py @@ -2,100 +2,154 @@ from tkinter import messagebox from questions import * + class Project: def __init__(self): - self.que="" - self.ans="" - self.correct=0 - self.count=-1 - self.__correct_answer=None - self.__answer=None - self.__question=None + self.que = "" + self.ans = "" + self.correct = 0 + self.count = -1 + self.__correct_answer = None + self.__answer = None + self.__question = None def course(self): - self.correct=0 - self.count=-1 + self.correct = 0 + self.count = -1 B.config(text="Start") - if s.get()=="Python": - self.que=python_que - self.ans=python_ans - elif s.get()=="C": - self.que=c_que - self.ans=c_ans - + if s.get() == "Python": + self.que = python_que + self.ans = python_ans + elif s.get() == "C": + self.que = c_que + self.ans = c_ans def set_(self): - if self.que=="": - messagebox.showinfo("Error","Please select course first...") + if self.que == "": + messagebox.showinfo("Error", "Please select course first...") return - self.count+=1 - - if self.count==len(self.que): - messagebox.showinfo("Result","You have answered {0} out of {1} questions correctly".format(self.correct,self.count)) + self.count += 1 + + if self.count == len(self.que): + messagebox.showinfo( + "Result", + "You have answered {0} out of {1} questions correctly".format( + self.correct, self.count + ), + ) sys.exit() - if(self.count==len(self.que)-1): + if self.count == len(self.que) - 1: B.config(text="Finish") else: B.config(text="Next") - self.__question=self.que[self.count] - self.__answer=self.ans[self.__question] + self.__question = self.que[self.count] + self.__answer = self.ans[self.__question] l.config(text=self.__question) - for i in range(0,4): + for i in range(0, 4): v[i].set(self.__answer[i]) - self.__correct_answer=self.__answer[4] - - def fun(self,y,n): - if y==self.__correct_answer: - self.correct+=1 + self.__correct_answer = self.__answer[4] + + def fun(self, y, n): + if y == self.__correct_answer: + self.correct += 1 n.config(activebackground="green") else: n.config(activebackground="red") self.set_() - - -obj=Project() -scr=Tk(className="quiz") -s=StringVar() -main_menu=Menu(scr) -file_menu=Menu(main_menu,tearoff=0) - -course_menu=Menu(file_menu,tearoff=0) -course_menu.add_radiobutton(label="Python",value="Python",variable=s,command=obj.course) -course_menu.add_radiobutton(label="C",value="C",variable=s,command=obj.course) - -file_menu.add_cascade(label="Course",menu=course_menu) -file_menu.add_command(label="Exit",command=exit) -main_menu.add_cascade(label="file",menu=file_menu) -scr.config(menu=main_menu) -l=Label(scr,font=("consolas",20),relief="groove",width=40,height=2,wraplength=600,bg="steel blue") -l.grid(row=0,column=0,columnspan=20,sticky="news") +obj = Project() +scr = Tk(className="quiz") +s = StringVar() +main_menu = Menu(scr) +file_menu = Menu(main_menu, tearoff=0) -b=[] -for i in range(0,4): - b.append(Button()) -v=[] -for i in range(0,4): - v.append(StringVar()) - - -b[0]=Button(scr,textvariable=v[0],font=("consolas",20),anchor="w",width=20,activebackground="light blue",command=lambda :obj.fun(v[0].get(),b[0])) -b[0].grid(row=2,column=0,sticky=W) +course_menu = Menu(file_menu, tearoff=0) +course_menu.add_radiobutton( + label="Python", value="Python", variable=s, command=obj.course +) +course_menu.add_radiobutton( + label="C", value="C", variable=s, command=obj.course +) -b[1]=Button(scr,textvariable=v[1],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[1].get(),b[1])) -b[1].grid(row=2,column=1,sticky=S) +file_menu.add_cascade(label="Course", menu=course_menu) +file_menu.add_command(label="Exit", command=exit) +main_menu.add_cascade(label="file", menu=file_menu) +scr.config(menu=main_menu) -b[2]=Button(scr,textvariable=v[2],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[2].get(),b[2])) -b[2].grid(row=3,column=0,sticky=W) +l = Label( + scr, + font=("consolas", 20), + relief="groove", + width=40, + height=2, + wraplength=600, + bg="steel blue", +) +l.grid(row=0, column=0, columnspan=20, sticky="news") + +b = [] +for i in range(0, 4): + b.append(Button()) +v = [] +for i in range(0, 4): + v.append(StringVar()) -b[3]=Button(scr,textvariable=v[3],font=("consolas",20),anchor="w",width=20,command=lambda :obj.fun(v[3].get(),b[3])) -b[3].grid(row=3,column=1,sticky=S) -B=Button(scr,text="Start",font=("consolas",20),width=40,height=1,bg="black",fg="white",command=obj.set_) -B.grid(row=10,column=0,columnspan=2,sticky="news") -#B.geometry('{0}x{1}+0+0'.format(scr.winfo_screenwidth(),200)) +b[0] = Button( + scr, + textvariable=v[0], + font=("consolas", 20), + anchor="w", + width=20, + activebackground="light blue", + command=lambda: obj.fun(v[0].get(), b[0]), +) +b[0].grid(row=2, column=0, sticky=W) + +b[1] = Button( + scr, + textvariable=v[1], + font=("consolas", 20), + anchor="w", + width=20, + command=lambda: obj.fun(v[1].get(), b[1]), +) +b[1].grid(row=2, column=1, sticky=S) + +b[2] = Button( + scr, + textvariable=v[2], + font=("consolas", 20), + anchor="w", + width=20, + command=lambda: obj.fun(v[2].get(), b[2]), +) +b[2].grid(row=3, column=0, sticky=W) + +b[3] = Button( + scr, + textvariable=v[3], + font=("consolas", 20), + anchor="w", + width=20, + command=lambda: obj.fun(v[3].get(), b[3]), +) +b[3].grid(row=3, column=1, sticky=S) + +B = Button( + scr, + text="Start", + font=("consolas", 20), + width=40, + height=1, + bg="black", + fg="white", + command=obj.set_, +) +B.grid(row=10, column=0, columnspan=2, sticky="news") +# B.geometry('{0}x{1}+0+0'.format(scr.winfo_screenwidth(),200)) scr.mainloop() diff --git a/Scripts/Miscellaneous/Prograamming Quiz GUI/questions.py b/Scripts/Miscellaneous/Prograamming Quiz GUI/questions.py index 7766ebde1..209dd2453 100644 --- a/Scripts/Miscellaneous/Prograamming Quiz GUI/questions.py +++ b/Scripts/Miscellaneous/Prograamming Quiz GUI/questions.py @@ -1,49 +1,133 @@ -python_que={ - 0:"What is python", - 1:"Who is founder of Python", - 2:"What is variable", - 3:"What is symbol of List", - 4:"What is symbol of tuple", - 5:"What is symbol of Set", - 6:"What is symbol of dictionary", - 7:"Python was launched in..", - 8:"Latest Version of python is..", - 9:"Python is suitable for.." - } -python_ans={ - "What is variable":["Container","Object","Class","Structure","Object"], - "What is symbol of List":["( )","{ }","[ ]","None of the above","[ ]"], - "What is symbol of tuple":["( )","{ }","[ ]","None of the above","( )"], - "What is symbol of Set":["( )","{ }","[ ]","None of the above","{ }"], - "What is symbol of dictionary":["( )","{ }","[ ]","None of the above","{ }"], - "Who is founder of Python":["Steve Jobs","James Gosling","Guido von Rossum","Dennis Richie","Guido von Rossum"], - "Python was launched in..":["1990","2003","1980","1996","1990"], - "What is python":["Scripting language","Programming language","Markup Language","Snake","Programming language"], - "Latest Version of python is..":["3.8.4","3.9.5","3.8.9","3.9.0","3.9.0"], - "Python is suitable for..":["GUI Application","Web application","Android","All of these","All of these"]} +python_que = { + 0: "What is python", + 1: "Who is founder of Python", + 2: "What is variable", + 3: "What is symbol of List", + 4: "What is symbol of tuple", + 5: "What is symbol of Set", + 6: "What is symbol of dictionary", + 7: "Python was launched in..", + 8: "Latest Version of python is..", + 9: "Python is suitable for..", +} +python_ans = { + "What is variable": [ + "Container", + "Object", + "Class", + "Structure", + "Object", + ], + "What is symbol of List": [ + "( )", + "{ }", + "[ ]", + "None of the above", + "[ ]", + ], + "What is symbol of tuple": [ + "( )", + "{ }", + "[ ]", + "None of the above", + "( )", + ], + "What is symbol of Set": ["( )", "{ }", "[ ]", "None of the above", "{ }"], + "What is symbol of dictionary": [ + "( )", + "{ }", + "[ ]", + "None of the above", + "{ }", + ], + "Who is founder of Python": [ + "Steve Jobs", + "James Gosling", + "Guido von Rossum", + "Dennis Richie", + "Guido von Rossum", + ], + "Python was launched in..": ["1990", "2003", "1980", "1996", "1990"], + "What is python": [ + "Scripting language", + "Programming language", + "Markup Language", + "Snake", + "Programming language", + ], + "Latest Version of python is..": [ + "3.8.4", + "3.9.5", + "3.8.9", + "3.9.0", + "3.9.0", + ], + "Python is suitable for..": [ + "GUI Application", + "Web application", + "Android", + "All of these", + "All of these", + ], +} -c_que={ - 0:"What is c", - 1:"Who is father of c", - 2:"What is strength of C language", - 3:"C was launched in", - 4:"What is format specifier of char", - 5:"what is size of int in 64 bit os", - 6:"what is format specifier of double", - 7:"what is size of double", - 8:"output of for(;;)", - 9:"what is symbol of function" - } -c_ans={ - "What is c":["Scripting language","Programming language","Markup Language","Snake","Programming language"], - "Who is father of c":["Steve Jobs","James Gosling","Guido von Rossum","Dennis Richie","Dennis Richie"], - "What is strength of C language":["data structure","Pointer","Speed","B and C both","B and C both"], - "C was launched in":["1970","1972","1980","1982","1972"], - "What is format specifier of char":["%ch","%c","%char","%chr","%c"], - "what is size of int in 64 bit os":["1 byte","8 bit","4 bit","32 bit","4 bit"], - "what is format specifier of double":["%d","%l","%lf","%Lf","%d"], - "what is size of double":["1 byte","8 bit","8 byte","32 bit","8 byte"], - "output of for(;;)":["syntax error","0 iteration","infinite iteration","runtime error","infinite iteration"], - "what is symbol of function":["( )","{ }","[ ]","< >","( )"] - } - +c_que = { + 0: "What is c", + 1: "Who is father of c", + 2: "What is strength of C language", + 3: "C was launched in", + 4: "What is format specifier of char", + 5: "what is size of int in 64 bit os", + 6: "what is format specifier of double", + 7: "what is size of double", + 8: "output of for(;;)", + 9: "what is symbol of function", +} +c_ans = { + "What is c": [ + "Scripting language", + "Programming language", + "Markup Language", + "Snake", + "Programming language", + ], + "Who is father of c": [ + "Steve Jobs", + "James Gosling", + "Guido von Rossum", + "Dennis Richie", + "Dennis Richie", + ], + "What is strength of C language": [ + "data structure", + "Pointer", + "Speed", + "B and C both", + "B and C both", + ], + "C was launched in": ["1970", "1972", "1980", "1982", "1972"], + "What is format specifier of char": ["%ch", "%c", "%char", "%chr", "%c"], + "what is size of int in 64 bit os": [ + "1 byte", + "8 bit", + "4 bit", + "32 bit", + "4 bit", + ], + "what is format specifier of double": ["%d", "%l", "%lf", "%Lf", "%d"], + "what is size of double": [ + "1 byte", + "8 bit", + "8 byte", + "32 bit", + "8 byte", + ], + "output of for(;;)": [ + "syntax error", + "0 iteration", + "infinite iteration", + "runtime error", + "infinite iteration", + ], + "what is symbol of function": ["( )", "{ }", "[ ]", "< >", "( )"], +} diff --git a/Scripts/Miscellaneous/Research_paper_latex_parser/get_details.py b/Scripts/Miscellaneous/Research_paper_latex_parser/get_details.py index 4a147a191..bd51fefd5 100644 --- a/Scripts/Miscellaneous/Research_paper_latex_parser/get_details.py +++ b/Scripts/Miscellaneous/Research_paper_latex_parser/get_details.py @@ -95,7 +95,9 @@ def purge_images(self): """ Purges images from the tex data using tag the '\begin{figure}' """ - imgs = re.findall(r"begin{figure}(.*?)end{figure}", self.tex_data, re.S) + imgs = re.findall( + r"begin{figure}(.*?)end{figure}", self.tex_data, re.S + ) start = "\\begin{figure}" end = "end{figure}" imgs = [start + img + end for img in imgs] @@ -106,7 +108,9 @@ def purge_tables(self): """ Purges tables from the tex data using tag the '\begin{table}' """ - tables = re.findall(r"begin{table}(.*?)end{table}", self.tex_data, re.S) + tables = re.findall( + r"begin{table}(.*?)end{table}", self.tex_data, re.S + ) start = "\\begin{table}" end = "end{table}" tables = [start + table + end for table in tables] @@ -145,7 +149,11 @@ def purge_equations(self): required=True, ) parser.add_argument( - "-output", help="enter path of output file", dest="op", type=str, required=True + "-output", + help="enter path of output file", + dest="op", + type=str, + required=True, ) # Parse the arguments received from the command. @@ -156,7 +164,9 @@ def purge_equations(self): all_data = [] # Store all files from the mentioned directory. - all_files = [f for f in listdir(directory_path) if isfile(join(directory_path, f))] + all_files = [ + f for f in listdir(directory_path) if isfile(join(directory_path, f)) + ] # Read all the files and extract information form each file. for tex_file in tqdm(all_files): diff --git a/Scripts/Miscellaneous/RollaDice-Game/rolladice.py b/Scripts/Miscellaneous/RollaDice-Game/rolladice.py index 85c3e6520..16e683897 100644 --- a/Scripts/Miscellaneous/RollaDice-Game/rolladice.py +++ b/Scripts/Miscellaneous/RollaDice-Game/rolladice.py @@ -96,7 +96,9 @@ def main(): print("\nIt's a draw.") sleep(0.3) - q = input("\n\nPress enter to continue to next round. (Q to stop rounds)") + q = input( + "\n\nPress enter to continue to next round. (Q to stop rounds)" + ) if q.upper() == "Q": break diff --git a/Scripts/Miscellaneous/Scientific_Calculator_GUI/Scientific_Calculator.py b/Scripts/Miscellaneous/Scientific_Calculator_GUI/Scientific_Calculator.py index d35ebd0dc..b8f50c57f 100644 --- a/Scripts/Miscellaneous/Scientific_Calculator_GUI/Scientific_Calculator.py +++ b/Scripts/Miscellaneous/Scientific_Calculator_GUI/Scientific_Calculator.py @@ -140,7 +140,21 @@ def pressbtn(num): global ans expression = expression + str(num) equation.set(expression) - if num in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "(", ")", "00"]: + if num in [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "0", + "(", + ")", + "00", + ]: value += num try: ans = str(eval(value)) diff --git a/Scripts/Miscellaneous/Screenshot-and-Share/main.py b/Scripts/Miscellaneous/Screenshot-and-Share/main.py index aa2931bd8..ab4301f32 100644 --- a/Scripts/Miscellaneous/Screenshot-and-Share/main.py +++ b/Scripts/Miscellaneous/Screenshot-and-Share/main.py @@ -25,7 +25,9 @@ def execute(): - fname = time.strftime(os.path.join(path, "captures", "%Y%m%d%H%M%S") + ".png") + fname = time.strftime( + os.path.join(path, "captures", "%Y%m%d%H%M%S") + ".png" + ) myScreenshot = pyautogui.screenshot() myScreenshot.save(fname) print("Uploading..") diff --git a/Scripts/Miscellaneous/Search_In_SRTs/search_in_srt.py b/Scripts/Miscellaneous/Search_In_SRTs/search_in_srt.py index d85cc91a8..0ee40c6b7 100644 --- a/Scripts/Miscellaneous/Search_In_SRTs/search_in_srt.py +++ b/Scripts/Miscellaneous/Search_In_SRTs/search_in_srt.py @@ -114,7 +114,13 @@ def expand_subtitle(full_subtitles_list, threshold=5): for i in range(start, end): sub = full_subtitles_list[i] if i == id: - result += " " + bcolors.WARNING + sub.content.strip() + bcolors.ENDC + " " + result += ( + " " + + bcolors.WARNING + + sub.content.strip() + + bcolors.ENDC + + " " + ) else: result += " " + sub.content.strip() + " " diff --git a/Scripts/Miscellaneous/Snake_Game/snake.py b/Scripts/Miscellaneous/Snake_Game/snake.py index df32ee4d0..bfe56d5f9 100644 --- a/Scripts/Miscellaneous/Snake_Game/snake.py +++ b/Scripts/Miscellaneous/Snake_Game/snake.py @@ -17,7 +17,10 @@ def get_head_position(self): return self.positions[0] def turn(self, point): - if self.length > 1 and (point[0] * -1, point[1] * -1) == self.direction: + if ( + self.length > 1 + and (point[0] * -1, point[1] * -1) == self.direction + ): return self.direction = point @@ -82,7 +85,9 @@ def randomize_position(self): ) def draw(self, surface): - r = pygame.Rect((self.position[0], self.position[1]), (gridsize, gridsize)) + r = pygame.Rect( + (self.position[0], self.position[1]), (gridsize, gridsize) + ) pygame.draw.rect(surface, self.color, r) pygame.draw.rect(surface, (93, 216, 228), r, 1) @@ -91,10 +96,14 @@ def drawGrid(surface): for y in range(0, int(grid_height)): for x in range(0, int(grid_width)): if (x + y) % 2 == 0: - r = pygame.Rect((x * gridsize, y * gridsize), (gridsize, gridsize)) + r = pygame.Rect( + (x * gridsize, y * gridsize), (gridsize, gridsize) + ) pygame.draw.rect(surface, (93, 216, 228), r) else: - rr = pygame.Rect((x * gridsize, y * gridsize), (gridsize, gridsize)) + rr = pygame.Rect( + (x * gridsize, y * gridsize), (gridsize, gridsize) + ) pygame.draw.rect(surface, (84, 194, 205), rr) diff --git a/Scripts/Miscellaneous/Spotify_Playlist_Generator/spotify_playlist_generator.py b/Scripts/Miscellaneous/Spotify_Playlist_Generator/spotify_playlist_generator.py index 447135912..b616df06f 100644 --- a/Scripts/Miscellaneous/Spotify_Playlist_Generator/spotify_playlist_generator.py +++ b/Scripts/Miscellaneous/Spotify_Playlist_Generator/spotify_playlist_generator.py @@ -23,9 +23,15 @@ def get_args(): description="Split a playlist into multiple playlists" ) # Required arguments for the program - parser.add_argument("-p", "--playlist_id", required=True, help="Playlist ID") parser.add_argument( - "-l", "--limit", required=True, default=20, help="Size of each small playlist" + "-p", "--playlist_id", required=True, help="Playlist ID" + ) + parser.add_argument( + "-l", + "--limit", + required=True, + default=20, + help="Size of each small playlist", ) return parser.parse_args() @@ -58,7 +64,9 @@ def generate_playlists(playlist_size, playlist_songs, user_id): ) # Add songs to the playlist and publish them spotipy_instance.playlist_add_items(created_playlist["id"], track_ids) - print("Generated Playlist", str(index + 1), " of size", (playlist_size)) + print( + "Generated Playlist", str(index + 1), " of size", (playlist_size) + ) def main(): diff --git a/Scripts/Miscellaneous/Streamlit_webapp/Compound_interest.py b/Scripts/Miscellaneous/Streamlit_webapp/Compound_interest.py index 002682002..f0e434c60 100644 --- a/Scripts/Miscellaneous/Streamlit_webapp/Compound_interest.py +++ b/Scripts/Miscellaneous/Streamlit_webapp/Compound_interest.py @@ -19,13 +19,19 @@ def user_input_features(): Principal = st.sidebar.text_input("Please input Principal Amount", 10000) ##st.sidebar.add_rows No_Of_Years = st.sidebar.selectbox("Select No Of Years", Year_List, 2) - data = {"Int_Rate": Int_Rate, "Principal": Principal, "No_Of_Years": No_Of_Years} + data = { + "Int_Rate": Int_Rate, + "Principal": Principal, + "No_Of_Years": No_Of_Years, + } features = pd.DataFrame(data, index=[0]) return features df = user_input_features() -st.subheader("User Entered parameters for Rate, Principal amount and No of years is") +st.subheader( + "User Entered parameters for Rate, Principal amount and No of years is" +) st.write(df) diff --git a/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py b/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py index c4509b118..13101a8bc 100644 --- a/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py +++ b/Scripts/Miscellaneous/Wifi_Speed/wifiSpeed.py @@ -8,7 +8,9 @@ try: s = speedtest.Speedtest() except speedtest.ConfigRetrievalError: - print('Sorry, looks like you are not connected to any network!\nPlease make sure you are connected to the internet.') + print( + "Sorry, looks like you are not connected to any network!\nPlease make sure you are connected to the internet." + ) exit() # Menu diff --git a/Scripts/Miscellaneous/Windows_Wallpaper_Changer/background.py b/Scripts/Miscellaneous/Windows_Wallpaper_Changer/background.py index 3a35ffa1f..8d6a4e7ae 100644 --- a/Scripts/Miscellaneous/Windows_Wallpaper_Changer/background.py +++ b/Scripts/Miscellaneous/Windows_Wallpaper_Changer/background.py @@ -11,7 +11,9 @@ # Check for extension if filename.split(".")[-1] in allowed_extensions: - ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, filename, 0) + ctypes.windll.user32.SystemParametersInfoW( + SPI_SETDESKWALLPAPER, 0, filename, 0 + ) print("Wallpaper Set Successfully!") else: print("Please select a JPEG/PNG file") diff --git a/Scripts/Miscellaneous/Youtube_Downloader/youtube_downloader.py b/Scripts/Miscellaneous/Youtube_Downloader/youtube_downloader.py index 1c1ff2395..54ce1ad0b 100644 --- a/Scripts/Miscellaneous/Youtube_Downloader/youtube_downloader.py +++ b/Scripts/Miscellaneous/Youtube_Downloader/youtube_downloader.py @@ -7,9 +7,15 @@ def banner(): - print('\t"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""') - print("\t Youtube Downloader ") - print('\t"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""') + print( + '\t"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""' + ) + print( + "\t Youtube Downloader " + ) + print( + '\t"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""' + ) def ytdl(x): diff --git a/Scripts/Miscellaneous/netcat/netcat.py b/Scripts/Miscellaneous/netcat/netcat.py index 9ed52002b..25873ed35 100644 --- a/Scripts/Miscellaneous/netcat/netcat.py +++ b/Scripts/Miscellaneous/netcat/netcat.py @@ -96,17 +96,35 @@ def main(): "-l", "--listen", type=bool, default=False, help="start a server" ) parser.add_argument( - "-H", "--host", type=str, default="127.0.0.1", help="specify the host ip" + "-H", + "--host", + type=str, + default="127.0.0.1", + help="specify the host ip", ) - parser.add_argument("-p", "--port", type=int, default=1234, help="specify the port") parser.add_argument( - "-s", "--shell", type=bool, default=False, help="get an interactive shell" + "-p", "--port", type=int, default=1234, help="specify the port" ) parser.add_argument( - "-e", "--execute", type=str, default=None, help="execute a single command" + "-s", + "--shell", + type=bool, + default=False, + help="get an interactive shell", ) parser.add_argument( - "-u", "--upload", type=bool, default=False, help="upload file to remote server" + "-e", + "--execute", + type=str, + default=None, + help="execute a single command", + ) + parser.add_argument( + "-u", + "--upload", + type=bool, + default=False, + help="upload file to remote server", ) options = parser.parse_args() host = options.host @@ -123,7 +141,9 @@ def main(): elif execute: getShell(host, port, False, execute) elif upload: - path = input("Enter absolute path of file to be uploaded on remote server: ") + path = input( + "Enter absolute path of file to be uploaded on remote server: " + ) filename = input( "Enter new file name if you want to rename uploaded file on server: " ) diff --git a/Scripts/Miscellaneous/portscanner/portscanner.py b/Scripts/Miscellaneous/portscanner/portscanner.py index bae0193b8..aa11501fe 100644 --- a/Scripts/Miscellaneous/portscanner/portscanner.py +++ b/Scripts/Miscellaneous/portscanner/portscanner.py @@ -42,8 +42,12 @@ def portScan(host, ports): def Main(): parser = argparse.ArgumentParser() - parser.add_argument("-H", "--host", type=str, help="host name", default="127.0.0.1") - parser.add_argument("-p", "--port", type=str, help="port number[s]", default="80") + parser.add_argument( + "-H", "--host", type=str, help="host name", default="127.0.0.1" + ) + parser.add_argument( + "-p", "--port", type=str, help="port number[s]", default="80" + ) args = parser.parse_args() host = args.host ports = args.port.split(",") diff --git a/Scripts/Miscellaneous/sudokuSolver/sudokuSolver.py b/Scripts/Miscellaneous/sudokuSolver/sudokuSolver.py index 251663d7a..3c359fd3b 100644 --- a/Scripts/Miscellaneous/sudokuSolver/sudokuSolver.py +++ b/Scripts/Miscellaneous/sudokuSolver/sudokuSolver.py @@ -59,7 +59,9 @@ def solve(board): if __name__ == "__main__": board = [] print( - "=" * 5, "Enter Values separated by space and use 0 for empty values", "=" * 5 + "=" * 5, + "Enter Values separated by space and use 0 for empty values", + "=" * 5, ) for i in range(9): row = input(f"Enter row {i+1} values: ") diff --git a/Scripts/Web_Scrappers/Algo_Trading_Articles_Scrapper/scraper.py b/Scripts/Web_Scrappers/Algo_Trading_Articles_Scrapper/scraper.py index 44ac56400..08635fd06 100644 --- a/Scripts/Web_Scrappers/Algo_Trading_Articles_Scrapper/scraper.py +++ b/Scripts/Web_Scrappers/Algo_Trading_Articles_Scrapper/scraper.py @@ -55,7 +55,9 @@ def get_quantocracy_articles(): # function to get top 10 articles from quantstart systematic trading def get_quantstart_articles(): - res = requests.get("https://www.quantstart.com/articles/topic/systematic-trading/") + res = requests.get( + "https://www.quantstart.com/articles/topic/systematic-trading/" + ) soup = BeautifulSoup(res.text, "html.parser") posts = soup.select("body > div > section.mb-2 > div")[0] diff --git a/Scripts/Web_Scrappers/COVID-19_Scraper/COVIDWebScraper.py b/Scripts/Web_Scrappers/COVID-19_Scraper/COVIDWebScraper.py index fc03d0c0d..5b99be37f 100644 --- a/Scripts/Web_Scrappers/COVID-19_Scraper/COVIDWebScraper.py +++ b/Scripts/Web_Scrappers/COVID-19_Scraper/COVIDWebScraper.py @@ -38,7 +38,9 @@ def scrapeCovidStats(): ) # Using get() method to Open a URL (WHO) - driver.get("https://www.who.int/emergencies/diseases/novel-coronavirus-2019") + driver.get( + "https://www.who.int/emergencies/diseases/novel-coronavirus-2019" + ) driver.implicitly_wait(wait_imp) w_total = driver.find_element_by_id("confirmedCases") w_death = driver.find_element_by_id("confirmedDeaths") diff --git a/Scripts/Web_Scrappers/COVID-19_Stats/COVID-19_scraper.py b/Scripts/Web_Scrappers/COVID-19_Stats/COVID-19_scraper.py index 6ad46eceb..4b1289fc6 100644 --- a/Scripts/Web_Scrappers/COVID-19_Stats/COVID-19_scraper.py +++ b/Scripts/Web_Scrappers/COVID-19_Stats/COVID-19_scraper.py @@ -14,7 +14,9 @@ def statsFind(): else: try: print("\nwait a sec....\n") - url = "https://www.bing.com/search?q=covid+stats+" + name.replace(" ", "+") + url = "https://www.bing.com/search?q=covid+stats+" + name.replace( + " ", "+" + ) header = {"User-Agent": "Chrome/6.0.472.63 Safari/534.3"} source = requests.get(url, headers=header) soup = BeautifulSoup(source.content, "lxml") @@ -27,7 +29,9 @@ def statsFind(): if nameFound == "Global cases": break update = soup.select_one( - "div:nth-child({}) > div.cov_modHead > div:nth-child(2)".format(i) + "div:nth-child({}) > div.cov_modHead > div:nth-child(2)".format( + i + ) ).text name = nameFound.replace(" cases", "") ttlCase = soup.select_one( @@ -46,7 +50,12 @@ def statsFind(): ) ).text table = [ - ["Country/State", " : ", name.upper(), " ({})".format(update)], + [ + "Country/State", + " : ", + name.upper(), + " ({})".format(update), + ], ["Total Cases", " : ", ttlCase], ["Total Deaths", " : ", ttlDeaths], ["Recovered", " : ", ttlRecovered], @@ -87,12 +96,26 @@ def statsFind(): print(" Top 10 countries suffering form COVID-19") top10 = [] -header = ["Rank", "Country\nName", "Total\nCases", "Total\nDeaths", "Total\nRecovered"] +header = [ + "Rank", + "Country\nName", + "Total\nCases", + "Total\nDeaths", + "Total\nRecovered", +] for i in range(3, 13, 1): - country = soup.select_one(" tr:nth-child({}) > th:nth-child(2) > a".format(i)).text - ttlCase = soup.select_one("tr:nth-child({}) > td:nth-child(3)".format(i)).text - ttlDeaths = soup.select_one("tr:nth-child({}) > td:nth-child(4)".format(i)).text - ttlRecovered = soup.select_one(" tr:nth-child({}) > td:nth-child(5)".format(i)).text + country = soup.select_one( + " tr:nth-child({}) > th:nth-child(2) > a".format(i) + ).text + ttlCase = soup.select_one( + "tr:nth-child({}) > td:nth-child(3)".format(i) + ).text + ttlDeaths = soup.select_one( + "tr:nth-child({}) > td:nth-child(4)".format(i) + ).text + ttlRecovered = soup.select_one( + " tr:nth-child({}) > td:nth-child(5)".format(i) + ).text top10.append([i - 2, country, ttlCase, ttlDeaths, ttlRecovered]) print(makeTable(top10, header, "grid")) @@ -100,5 +123,7 @@ def statsFind(): statsFind() print( "\n\n" - + makeTable("Thanks . for . using . my . COVID-19 . scraper".split(), [], "plain") + + makeTable( + "Thanks . for . using . my . COVID-19 . scraper".split(), [], "plain" + ) ) diff --git a/Scripts/Web_Scrappers/CodeChef_Scraper/codechef_ps.py b/Scripts/Web_Scrappers/CodeChef_Scraper/codechef_ps.py index 2def36650..9a6e5ca76 100644 --- a/Scripts/Web_Scrappers/CodeChef_Scraper/codechef_ps.py +++ b/Scripts/Web_Scrappers/CodeChef_Scraper/codechef_ps.py @@ -30,7 +30,9 @@ def scrapeCodeChef(code): browser.page_source, features="html.parser" ) # parse page source head = soup.find_all(["h1"]) # find all h1 tags - body = soup.find_all(["p", "h3", "ul", "pre"]) # find all p, h3, ul, pre tags + body = soup.find_all( + ["p", "h3", "ul", "pre"] + ) # find all p, h3, ul, pre tags with open("problems/" + url[34:] + ".txt", "a") as f: # open .txt file f.write(head[1].text[:-7] + "\n") # write title for i in range(8, len(body) - 18): @@ -45,6 +47,9 @@ def scrapeCodeChef(code): try: code = sys.argv[1] except Exception: - print("Please Enter A CodeChef Problem Code as a", "Command-Line Argument!") + print( + "Please Enter A CodeChef Problem Code as a", + "Command-Line Argument!", + ) sys.exit(0) scrapeCodeChef(code) diff --git a/Scripts/Web_Scrappers/CodeForces_Scraper/codeforces_scraper.py b/Scripts/Web_Scrappers/CodeForces_Scraper/codeforces_scraper.py index 6a661151b..8fa523cba 100644 --- a/Scripts/Web_Scrappers/CodeForces_Scraper/codeforces_scraper.py +++ b/Scripts/Web_Scrappers/CodeForces_Scraper/codeforces_scraper.py @@ -45,7 +45,10 @@ def to_txt(problem_code, problem): try: problem_code = sys.argv[1] except Exception: - print("Please Enter A CodeForces Problem Code as a", "Command-Line Argument!") + print( + "Please Enter A CodeForces Problem Code as a", + "Command-Line Argument!", + ) sys.exit(0) problem = get_problem_statement(problem_code) to_txt(problem_code, problem) diff --git a/Scripts/Web_Scrappers/CodeforcesProfileScrapper/main.py b/Scripts/Web_Scrappers/CodeforcesProfileScrapper/main.py index b2f50d33f..6cbce32ba 100644 --- a/Scripts/Web_Scrappers/CodeforcesProfileScrapper/main.py +++ b/Scripts/Web_Scrappers/CodeforcesProfileScrapper/main.py @@ -22,7 +22,9 @@ def __init__(self, master, handle): self.master.title(f"Codeforces Profiler - {handle}") try: - self.user = Bunch(user_info(handle)[0]) # bcz Namespace syntax is easy + self.user = Bunch( + user_info(handle)[0] + ) # bcz Namespace syntax is easy self.init() except UserNotFoundError: w = ttk.Label(self.master, text=f"User {handle} does not exists!") @@ -36,7 +38,9 @@ def init(self): ) RATING_COLOR = c.rating.get(self.user.rank) MAX_RATING_COLOR = c.rating.get(self.user.maxRank) - CONTRIBUTION = "+" * (self.user.contribution > 0) + str(self.user.contribution) + CONTRIBUTION = "+" * (self.user.contribution > 0) + str( + self.user.contribution + ) CONTRIBUTION_COLOR = c.GREEN if self.user.contribution > 0 else c.GRAY # image img1 = Label(self.master, image=PROFILE_PIC) @@ -69,14 +73,21 @@ def init(self): label3.grid(row=2, column=0, sticky="w", columnspan=2) # From label4 = Label( - self.master, fg="#777777", text=f"From {self.user.get('organization', '')}" + self.master, + fg="#777777", + text=f"From {self.user.get('organization', '')}", ) label4.grid(row=3, column=0, sticky="w", columnspan=2) # Contest Rating: - label5 = Label(self.master, font="Arial 14", text="Contest Rating: ") + label5 = Label( + self.master, font="Arial 14", text="Contest Rating: " + ) label5.grid(row=4, column=0, sticky="w") label6 = Label( - self.master, fg=RATING_COLOR, font="Arial 14", text=self.user.rating + self.master, + fg=RATING_COLOR, + font="Arial 14", + text=self.user.rating, ) label6.grid(row=4, column=1, sticky="w") # Max Rating: @@ -93,14 +104,19 @@ def init(self): label9 = Label(self.master, font="Arial 14", text="Contribution:") label9.grid(row=6, column=0, sticky="w") label10 = Label( - self.master, fg=CONTRIBUTION_COLOR, font="Arial 14", text=CONTRIBUTION + self.master, + fg=CONTRIBUTION_COLOR, + font="Arial 14", + text=CONTRIBUTION, ) label10.grid(row=6, column=1, sticky="w") # Friend of: label11 = Label(self.master, font="Arial 14", text="Friend of:") label11.grid(row=7, column=0, sticky="w") label12 = Label( - self.master, font="Arial 14", text=f"{self.user.friendOfCount} users" + self.master, + font="Arial 14", + text=f"{self.user.friendOfCount} users", ) label12.grid(row=7, column=1, sticky="w") # Last visit: @@ -109,7 +125,9 @@ def init(self): label14 = Label( self.master, font="Arial 14", - text=datetime.utcfromtimestamp(int(self.user.lastOnlineTimeSeconds)), + text=datetime.utcfromtimestamp( + int(self.user.lastOnlineTimeSeconds) + ), ) label14.grid(row=8, column=1, sticky="w") # Registered @@ -118,7 +136,9 @@ def init(self): label16 = Label( self.master, font="Arial 14", - text=datetime.utcfromtimestamp(int(self.user.registrationTimeSeconds)), + text=datetime.utcfromtimestamp( + int(self.user.registrationTimeSeconds) + ), ) label16.grid(row=9, column=1, sticky="w") @@ -134,7 +154,9 @@ def __init__(self, master): self.entry1 = ttk.Entry(master) self.entry1.grid(row=0, column=1, padx=5, pady=5) self.entry1.focus_set() - button1 = ttk.Button(master, text="Fetch Data", command=self.display_profile) + button1 = ttk.Button( + master, text="Fetch Data", command=self.display_profile + ) button1.grid(row=1, column=0, columnspan=2, padx=5, pady=5) def display_profile(self, event=None): diff --git a/Scripts/Web_Scrappers/Codeforces_ratings_scraper/cf_ratings.py b/Scripts/Web_Scrappers/Codeforces_ratings_scraper/cf_ratings.py index 3d9430cc4..263f3332d 100644 --- a/Scripts/Web_Scrappers/Codeforces_ratings_scraper/cf_ratings.py +++ b/Scripts/Web_Scrappers/Codeforces_ratings_scraper/cf_ratings.py @@ -23,7 +23,9 @@ def call_api(handle): sys.exit(1) # Create parser -parser = argparse.ArgumentParser(description="Scrape user ratings from codeforce.") +parser = argparse.ArgumentParser( + description="Scrape user ratings from codeforce." +) # Add argument for users parser.add_argument( "-u", diff --git a/Scripts/Web_Scrappers/Cricbuzz _Live_Cricket_Score/live_scores.py b/Scripts/Web_Scrappers/Cricbuzz _Live_Cricket_Score/live_scores.py index 93ee1dfa3..18049faae 100644 --- a/Scripts/Web_Scrappers/Cricbuzz _Live_Cricket_Score/live_scores.py +++ b/Scripts/Web_Scrappers/Cricbuzz _Live_Cricket_Score/live_scores.py @@ -15,7 +15,9 @@ def live_score(): # Finding all the contents of matches as per the ongoing tournaments tournaments = soup.find_all( - attrs={"class": "cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main"} + attrs={ + "class": "cb-col cb-col-100 cb-plyr-tbody cb-rank-hdr cb-lv-main" + } ) # If no live matches are going on @@ -33,18 +35,24 @@ def live_score(): for match in matches: # Finding live score of a match and displaying it - schedule = match.find_all(attrs={"class": "cb-col-100 cb-col cb-schdl"}) + schedule = match.find_all( + attrs={"class": "cb-col-100 cb-col cb-schdl"} + ) fixtures = ( schedule[0].h3.text - + schedule[0].find("span", attrs={"class": "text-gray"}).text + + schedule[0] + .find("span", attrs={"class": "text-gray"}) + .text ) print("\n\t", fixtures) details = schedule[1].find( attrs={"class": "cb-scr-wll-chvrn cb-lv-scrs-col"} ) - team1 = details.find("div", attrs={"class": "cb-hmscg-bat-txt"}) + team1 = details.find( + "div", attrs={"class": "cb-hmscg-bat-txt"} + ) if team1 is not None: team1_name = team1.find( "div", attrs={"class": "cb-ovr-flo cb-hmscg-tm-nm"} @@ -57,7 +65,9 @@ def live_score(): }, ).text print("\t\t", team1_name, team1_score) - team2 = details.find("div", attrs={"class": "cb-hmscg-bwl-txt"}) + team2 = details.find( + "div", attrs={"class": "cb-hmscg-bwl-txt"} + ) if team2 is not None: team2_name = team2.find( "div", attrs={"class": "cb-ovr-flo cb-hmscg-tm-nm"} @@ -71,7 +81,9 @@ def live_score(): ).text print("\t\t", team2_name, team2_score) - match_status = details.find("div", attrs={"class": "cb-text-live"}) + match_status = details.find( + "div", attrs={"class": "cb-text-live"} + ) if match_status is None: match_status = details.find( "div", attrs={"class": "cb-text-complete"} diff --git a/Scripts/Web_Scrappers/DevFest_India_2020_Schedule/devfest_schedule.py b/Scripts/Web_Scrappers/DevFest_India_2020_Schedule/devfest_schedule.py index 19d522b39..b069de431 100644 --- a/Scripts/Web_Scrappers/DevFest_India_2020_Schedule/devfest_schedule.py +++ b/Scripts/Web_Scrappers/DevFest_India_2020_Schedule/devfest_schedule.py @@ -48,7 +48,8 @@ def devfest_schedule(): "div", attrs={"class": "py-3 ma-1 fill-height"} ) event_timings = event.find( - "div", attrs={"class": "text-right my-0 py-0 col-md-2 col-3"} + "div", + attrs={"class": "text-right my-0 py-0 col-md-2 col-3"}, ).find_all("p") event_name = event_details.find("p").text @@ -74,11 +75,19 @@ def devfest_schedule(): ) event_authors = "" for author in authors: - event_authors = event_authors + author.text.replace(" ", "") + " " + event_authors = ( + event_authors + author.text.replace(" ", "") + " " + ) # Adding each event to csv file writer.writerow( - [event_name, event_date, event_time, event_tag, event_authors] + [ + event_name, + event_date, + event_time, + event_tag, + event_authors, + ] ) starting_date = starting_date + 1 diff --git a/Scripts/Web_Scrappers/Discord_News_Hook/inshorts.py b/Scripts/Web_Scrappers/Discord_News_Hook/inshorts.py index bbdba4ed0..0f2cc8d95 100644 --- a/Scripts/Web_Scrappers/Discord_News_Hook/inshorts.py +++ b/Scripts/Web_Scrappers/Discord_News_Hook/inshorts.py @@ -31,14 +31,16 @@ def getNews(category): title = None try: - imageUrl = card.find(class_="news-card-image")["style"].split("'")[1] + imageUrl = card.find(class_="news-card-image")["style"].split("'")[ + 1 + ] except AttributeError: imageUrl = None try: - url = "https://www.inshorts.com" + card.find(class_="news-card-title").find( - "a" - ).get("href") + url = "https://www.inshorts.com" + card.find( + class_="news-card-title" + ).find("a").get("href") except AttributeError: url = None diff --git a/Scripts/Web_Scrappers/Economictimes_Scraper/economictimes_scraper.py b/Scripts/Web_Scrappers/Economictimes_Scraper/economictimes_scraper.py index 4ea84e4fe..cb00d4676 100644 --- a/Scripts/Web_Scrappers/Economictimes_Scraper/economictimes_scraper.py +++ b/Scripts/Web_Scrappers/Economictimes_Scraper/economictimes_scraper.py @@ -50,15 +50,23 @@ def fetchNewsArticle(url): fetched_data = {} for dateid in range(start_dateid, end_dateid + 1): - date = str(reference_date + datetime.timedelta(days=dateid - reference_date_id)) - html = requests.get("{}{}{}".format(et_date_url, dateid, et_date_extension)).content + date = str( + reference_date + datetime.timedelta(days=dateid - reference_date_id) + ) + html = requests.get( + "{}{}{}".format(et_date_url, dateid, et_date_extension) + ).content soup = BeautifulSoup(html, "html.parser") fetched_data[date] = [] for x in soup.select("#pageContent table li a"): print(x.text) article_metadata = fetchNewsArticle(et_host + x["href"]) fetched_data[date].append( - {"metadata": article_metadata, "title": x.text, "url": et_host + x["href"]} + { + "metadata": article_metadata, + "title": x.text, + "url": et_host + x["href"], + } ) out_filename = "ET_NewsData_{}_{}.json".format(start_date, end_date) diff --git a/Scripts/Web_Scrappers/GSoC-Scraper/script.py b/Scripts/Web_Scrappers/GSoC-Scraper/script.py index 7bee3ed78..59dcfc5ec 100644 --- a/Scripts/Web_Scrappers/GSoC-Scraper/script.py +++ b/Scripts/Web_Scrappers/GSoC-Scraper/script.py @@ -81,7 +81,11 @@ def print_list(): x = 1 while x != -1: - x = int(input("Enter the index no. for getting complete links(-1 to quit): ")) + x = int( + input( + "Enter the index no. for getting complete links(-1 to quit): " + ) + ) if x == -1: continue org_x = sorted(organization_list, reverse=True)[x - 1] @@ -93,7 +97,9 @@ def print_list(): print("Count: " + str(org_x.count)) print("===========================================\n") except: - print("Organisation is missing some value. Kindly check on GSoc Website") + print( + "Organisation is missing some value. Kindly check on GSoc Website" + ) headers = { @@ -131,21 +137,27 @@ def print_list(): json_data = response.json() for index in range(len(json_data["results"])): - if language_filter(json_data["results"][index]["technology_tags"]): + if language_filter( + json_data["results"][index]["technology_tags"] + ): name = json_data["results"][index]["name"] tech_stack = json_data["results"][index]["technology_tags"] irc = json_data["results"][index]["irc_channel"] org_page = URL + str(json_data["results"][index]["id"]) count = 1 - current_org = Organization(name, irc, org_page, tech_stack, count) + current_org = Organization( + name, irc, org_page, tech_stack, count + ) organization_list.append(current_org) if json_data["results"] == []: break spinner.ok("✅ ") - with yaspin(text="Counting previous year selection", color="yellow") as spinner: + with yaspin( + text="Counting previous year selection", color="yellow" + ) as spinner: check_previous() spinner.ok("✅ ") print_list() diff --git a/Scripts/Web_Scrappers/IMDB-Mass-Scraper/settings.py b/Scripts/Web_Scrappers/IMDB-Mass-Scraper/settings.py index 3249249f4..4d93590e5 100644 --- a/Scripts/Web_Scrappers/IMDB-Mass-Scraper/settings.py +++ b/Scripts/Web_Scrappers/IMDB-Mass-Scraper/settings.py @@ -14,7 +14,9 @@ # Crawl responsibly by identifying yourself (and your website) on the user-agent -USER_AGENT = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" +USER_AGENT = ( + "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" +) # Obey robots.txt rules ROBOTSTXT_OBEY = True diff --git a/Scripts/Web_Scrappers/Instagram_Metadata_Scrapper/scrapper.py b/Scripts/Web_Scrappers/Instagram_Metadata_Scrapper/scrapper.py index 698dc1eea..7de111629 100644 --- a/Scripts/Web_Scrappers/Instagram_Metadata_Scrapper/scrapper.py +++ b/Scripts/Web_Scrappers/Instagram_Metadata_Scrapper/scrapper.py @@ -24,7 +24,11 @@ def get_metadata(username): soup = BeautifulSoup(res.text, "html.parser") # Locating the string having metadata then parsing it ret_data = json.loads( - [sc.text for sc in soup.find_all("script") if "csrf_token" in str(sc)][0] + [ + sc.text + for sc in soup.find_all("script") + if "csrf_token" in str(sc) + ][0] .replace("window._sharedData = ", "") .replace(";", "") )["entry_data"]["ProfilePage"][0]["graphql"] @@ -32,7 +36,9 @@ def get_metadata(username): if "user" in ret_data.keys(): return { "username": ret_data["user"].get("username", None), - "profile_picture_url": ret_data["user"].get("profile_pic_url_hd", None), + "profile_picture_url": ret_data["user"].get( + "profile_pic_url_hd", None + ), "follower_count": ret_data["user"] .get("edge_followed_by", {}) .get("count", None), diff --git a/Scripts/Web_Scrappers/LeetCode_Scraper/leet_code_scraper.py b/Scripts/Web_Scrappers/LeetCode_Scraper/leet_code_scraper.py index 0a9490db0..c9649848f 100644 --- a/Scripts/Web_Scrappers/LeetCode_Scraper/leet_code_scraper.py +++ b/Scripts/Web_Scrappers/LeetCode_Scraper/leet_code_scraper.py @@ -49,7 +49,9 @@ def parse_problem_statement(problem_code: str): raise InvalidCodeException # Problem statement div - problem_div = soup.find("div", class_=re.compile(r"content\w+ question-content\w+")) + problem_div = soup.find( + "div", class_=re.compile(r"content\w+ question-content\w+") + ) return problem_div.text @@ -76,7 +78,9 @@ def parse_problem_statement(problem_code: str): for l in wrapped_lines: print(l, file=fout) - print(f"Successfully scraped {problem_code} and saved as {problem_code}.py!") + print( + f"Successfully scraped {problem_code} and saved as {problem_code}.py!" + ) except InvalidCodeException: print("Invalid Problem Code! Please check the problem code provided!") diff --git a/Scripts/Web_Scrappers/Lyrics_Scraper/app.py b/Scripts/Web_Scrappers/Lyrics_Scraper/app.py index f5b820f94..586643fb5 100644 --- a/Scripts/Web_Scrappers/Lyrics_Scraper/app.py +++ b/Scripts/Web_Scrappers/Lyrics_Scraper/app.py @@ -55,8 +55,10 @@ def __init__(self, song_name): def search_song(self): """framing url and parsing list""" - form_url = "https://search.azlyrics.com/search.php?q={song_name}".format( - song_name="+".join(self.song_name.split()) + form_url = ( + "https://search.azlyrics.com/search.php?q={song_name}".format( + song_name="+".join(self.song_name.split()) + ) ) super().__init__(url=form_url, parse_type="song_list") self.driver() diff --git a/Scripts/Web_Scrappers/Michelin_Restaurants_Scraper/micheline_scraper.py b/Scripts/Web_Scrappers/Michelin_Restaurants_Scraper/micheline_scraper.py index 5cdcdef91..7ed733b7a 100644 --- a/Scripts/Web_Scrappers/Michelin_Restaurants_Scraper/micheline_scraper.py +++ b/Scripts/Web_Scrappers/Michelin_Restaurants_Scraper/micheline_scraper.py @@ -9,7 +9,9 @@ def normalize_input(resturant_name): # converting to lower case and replacing white spaces resturant_name = resturant_name.lower().strip() # removing punctuations - resturant_name = resturant_name.translate(str.maketrans("", "", string.punctuation)) + resturant_name = resturant_name.translate( + str.maketrans("", "", string.punctuation) + ) # converting all charecters to unicode (ie:- é->e) and replacing spaces with - return unidecode(resturant_name.replace(" ", "-")) @@ -26,7 +28,9 @@ def get_resturent_details(resturant_name): # getting the name, address and description data["name"] = soup.h2.text - data["address"] = soup.find(class_="restaurant-details__heading--list").li.text + data["address"] = soup.find( + class_="restaurant-details__heading--list" + ).li.text data["description"] = soup.find("p").text diff --git a/Scripts/Web_Scrappers/Movies_by_Genre_scrapper/top100_scrapy.py b/Scripts/Web_Scrappers/Movies_by_Genre_scrapper/top100_scrapy.py index 64eb947cb..c40c88d73 100644 --- a/Scripts/Web_Scrappers/Movies_by_Genre_scrapper/top100_scrapy.py +++ b/Scripts/Web_Scrappers/Movies_by_Genre_scrapper/top100_scrapy.py @@ -14,7 +14,11 @@ def search_with_genre(genre): genre = genre.replace("&", "") genre = (genre.lower()).replace(" ", "_") - url = "https://www.rottentomatoes.com/top/bestofrt/top_100_" + genre + "_movies" + url = ( + "https://www.rottentomatoes.com/top/bestofrt/top_100_" + + genre + + "_movies" + ) # Requesting and storing the contents of desired webpage in "soup" variable result = requests.get(url) @@ -69,7 +73,9 @@ def search_with_genre(genre): for row in range(1, 101): dataset = rows[row].find_all("td") rank = dataset[0].text.replace(".", "") - rating = dataset[1].find(attrs={"class": "tMeterScore"}).text[1:] + rating = ( + dataset[1].find(attrs={"class": "tMeterScore"}).text[1:] + ) title = ( dataset[2] .find("a", attrs={"class": "unstyled articleLink"}) diff --git a/Scripts/Web_Scrappers/Project_Euler_Scraper/Project_euler_scraper.py b/Scripts/Web_Scrappers/Project_Euler_Scraper/Project_euler_scraper.py index bd21f91d8..aa7f03ccc 100644 --- a/Scripts/Web_Scrappers/Project_Euler_Scraper/Project_euler_scraper.py +++ b/Scripts/Web_Scrappers/Project_Euler_Scraper/Project_euler_scraper.py @@ -16,7 +16,9 @@ src = bs4.BeautifulSoup(page, "html.parser") # get outermost container - main_div = src.find("div", id="content").find("div", id="problems_table_page") + main_div = src.find("div", id="content").find( + "div", id="problems_table_page" + ) # get table including problems table = main_div.find("table", id="problems_table") diff --git a/Scripts/Web_Scrappers/Pycon_Proposals/pycon_proposals.py b/Scripts/Web_Scrappers/Pycon_Proposals/pycon_proposals.py index 81534ad2c..ff2e29be5 100644 --- a/Scripts/Web_Scrappers/Pycon_Proposals/pycon_proposals.py +++ b/Scripts/Web_Scrappers/Pycon_Proposals/pycon_proposals.py @@ -33,7 +33,15 @@ def selected_proposals(mydivs, df_columns): tag2 = test_list[7] author = test_list[11].strip() date = test_list[14].strip() - final[i] = [no_of_votes, no_of_messages, title, tag1, tag2, author, date] + final[i] = [ + no_of_votes, + no_of_messages, + title, + tag1, + tag2, + author, + date, + ] df1 = pd.DataFrame.from_dict(final, orient="index") df1.columns = df_columns @@ -60,14 +68,30 @@ def total_proposals(mydivs, df_columns): tag2 = test_list[8] author = test_list[12].strip() date = test_list[15].strip() - final_two[i] = [no_of_votes, no_of_messages, title, tag1, tag2, author, date] + final_two[i] = [ + no_of_votes, + no_of_messages, + title, + tag1, + tag2, + author, + date, + ] df2 = pd.DataFrame.from_dict(final_two, orient="index") df2.columns = df_columns df2.to_csv("total_proposals.csv") if __name__ == "__main__": - df_columns = ["Votes", "Messages", "Title", "Tag1", "Tag2", "Author", "Date"] + df_columns = [ + "Votes", + "Messages", + "Title", + "Tag1", + "Tag2", + "Author", + "Date", + ] mydivs = scrape_divs() selected_proposals(mydivs, df_columns) total_proposals(mydivs, df_columns) diff --git a/Scripts/Web_Scrappers/Rotten_Tomatoes_Scrapper/rotten_tomatoes_scrapper.py b/Scripts/Web_Scrappers/Rotten_Tomatoes_Scrapper/rotten_tomatoes_scrapper.py index 3f812a11f..d997030bd 100644 --- a/Scripts/Web_Scrappers/Rotten_Tomatoes_Scrapper/rotten_tomatoes_scrapper.py +++ b/Scripts/Web_Scrappers/Rotten_Tomatoes_Scrapper/rotten_tomatoes_scrapper.py @@ -37,6 +37,8 @@ def get_movie_ratings(movie): try: movie = sys.argv[1] except Exception: - print("Please Enter a Movie Name In Single Quotes In The Command Line!") + print( + "Please Enter a Movie Name In Single Quotes In The Command Line!" + ) sys.exit(0) movie = get_movie_ratings(movie) diff --git a/Scripts/Web_Scrappers/ThisXDoesNotExist/functs.py b/Scripts/Web_Scrappers/ThisXDoesNotExist/functs.py index e4b0c7863..3b8580d99 100644 --- a/Scripts/Web_Scrappers/ThisXDoesNotExist/functs.py +++ b/Scripts/Web_Scrappers/ThisXDoesNotExist/functs.py @@ -49,9 +49,9 @@ def get_snack() -> ty.Tuple[str, bytes]: soup = BeautifulSoup(page_html, "html.parser") # the tag looks like: # - img_url = soup.find("meta", attrs=dict(property="og:image")).get_attribute_list( - "content" - )[0] + img_url = soup.find( + "meta", attrs=dict(property="og:image") + ).get_attribute_list("content")[0] return "jpeg", requests.get(img_url).content @@ -68,4 +68,7 @@ def get_waifu() -> ty.Tuple[str, bytes]: def get_dog() -> ty.Tuple[str, bytes]: img_url = requests.get("https://random.dog/woof").text - return img_url.split(".")[-1], requests.get("https://random.dog/" + img_url).content + return ( + img_url.split(".")[-1], + requests.get("https://random.dog/" + img_url).content, + ) diff --git a/Scripts/Web_Scrappers/Top_Torrents_ThePirateBay/toptorrents.py b/Scripts/Web_Scrappers/Top_Torrents_ThePirateBay/toptorrents.py index 3df576874..a88bb2b59 100644 --- a/Scripts/Web_Scrappers/Top_Torrents_ThePirateBay/toptorrents.py +++ b/Scripts/Web_Scrappers/Top_Torrents_ThePirateBay/toptorrents.py @@ -18,7 +18,9 @@ def top_torrents(cat, subcat): print("Type the file_name for the csv file:") file_name = str(input()) - url = "https://thepiratebay.org/search.php?q=top100:" + str(cat * 100 + subcat) + url = "https://thepiratebay.org/search.php?q=top100:" + str( + cat * 100 + subcat + ) # Running the driver in headless mode options = webdriver.ChromeOptions() @@ -45,23 +47,35 @@ def top_torrents(cat, subcat): with open(file_name + ".csv", "w") as csv_file: writer = csv.writer(csv_file) writer.writerow( - ["Name/Title of the file", "Category", "Link", "Date Uploaded", "File Size"] + [ + "Name/Title of the file", + "Category", + "Link", + "Date Uploaded", + "File Size", + ] ) for i in list: title = filter_output( - i.find("span", attrs={"class": "list-item item-name item-title"}).text + i.find( + "span", attrs={"class": "list-item item-name item-title"} + ).text ) - category = i.find("span", attrs={"class": "list-item item-type"}).text + category = i.find( + "span", attrs={"class": "list-item item-type"} + ).text link = ( "https://thepiratebay.org" - + i.find("span", attrs={"class": "list-item item-name item-title"}).a[ - "href" - ] + + i.find( + "span", attrs={"class": "list-item item-name item-title"} + ).a["href"] ) date_uploaded = i.find( "span", attrs={"class": "list-item item-uploaded"} ).text - file_size = i.find("span", attrs={"class": "list-item item-size"}).text + file_size = i.find( + "span", attrs={"class": "list-item item-size"} + ).text writer.writerow([title, category, link, date_uploaded, file_size]) print("\n\nDesired CSV File is generated :)") diff --git a/Scripts/Web_Scrappers/Twitter_Sentiment_Analysis/twitter_sentiment_analysis.py b/Scripts/Web_Scrappers/Twitter_Sentiment_Analysis/twitter_sentiment_analysis.py index 717fe5a9b..0ac847a32 100644 --- a/Scripts/Web_Scrappers/Twitter_Sentiment_Analysis/twitter_sentiment_analysis.py +++ b/Scripts/Web_Scrappers/Twitter_Sentiment_Analysis/twitter_sentiment_analysis.py @@ -35,7 +35,9 @@ def clean_tweet(tweet): """ return " ".join( re.sub( - "(@[A-Za-z0-9]+)|([^0-9A-Za-z \t]) | (\w+:\ / \ / \S+) ", " ", tweet + "(@[A-Za-z0-9]+)|([^0-9A-Za-z \t]) | (\w+:\ / \ / \S+) ", + " ", + tweet, ).split() ) @@ -89,7 +91,9 @@ def main(): for i in range(0, len(all_tweets)): sheet.write((i + 1), 0, all_tweets[i], style_rows) - sheet.write((i + 1), 1, api.get_tweet_sentiment(all_tweets[i]), style_rows) + sheet.write( + (i + 1), 1, api.get_tweet_sentiment(all_tweets[i]), style_rows + ) wb.save("Sentiment_Analysis.xls") diff --git a/Scripts/Web_Scrappers/cricbuzz_latest_cricket_news/main.py b/Scripts/Web_Scrappers/cricbuzz_latest_cricket_news/main.py index dc61c99e1..15bf173d8 100644 --- a/Scripts/Web_Scrappers/cricbuzz_latest_cricket_news/main.py +++ b/Scripts/Web_Scrappers/cricbuzz_latest_cricket_news/main.py @@ -12,7 +12,8 @@ print("Parsing the page") soup = BeautifulSoup(r.content, "html.parser") main_div = soup.find_all( - "div", attrs={"class": re.compile("cb-col cb-col-100 cb-lst-itm cb-lst-itm-lg")} + "div", + attrs={"class": re.compile("cb-col cb-col-100 cb-lst-itm cb-lst-itm-lg")}, ) links = [] intro = [] @@ -28,7 +29,9 @@ typ.append(s2.text) s3 = s.find("span", attrs={"class": re.compile("cb-nws-time")}) time.append(s3.text) - s4 = s.find("h2", attrs={"class": re.compile("cb-nws-hdln cb-font-18 line-ht24")}) + s4 = s.find( + "h2", attrs={"class": re.compile("cb-nws-hdln cb-font-18 line-ht24")} + ) heading.append(s4.text) l = len(heading) with open("out.txt", "w") as file: diff --git a/Scripts/Web_Scrappers/cricket_scrapper/crick_info.py b/Scripts/Web_Scrappers/cricket_scrapper/crick_info.py index ca7d4e439..92375c98b 100644 --- a/Scripts/Web_Scrappers/cricket_scrapper/crick_info.py +++ b/Scripts/Web_Scrappers/cricket_scrapper/crick_info.py @@ -48,7 +48,9 @@ def get_table(soup): # writes data to file def write_to_file(content_table, name): - with io.open("./scraped_texts/{}.txt".format(name), "w", encoding="UTF-8") as dobj: + with io.open( + "./scraped_texts/{}.txt".format(name), "w", encoding="UTF-8" + ) as dobj: for line in content_table: if len(line) >= 1 and line[0] is not None: for value in line: @@ -61,7 +63,9 @@ def write_to_file(content_table, name): def show_to_teeminal(name): not_needed = ["5 wickets in innings\n", "10 wickets in match\n"] final_list = [] - with io.open("./scraped_texts/{}.txt".format(name), "r", encoding="UTF-8") as dobj: + with io.open( + "./scraped_texts/{}.txt".format(name), "r", encoding="UTF-8" + ) as dobj: print("----------------------------{}-------------------".format(name)) for line in dobj: if len(line.split()) > 2 and line not in not_needed: diff --git a/Scripts/Web_Scrappers/cricketmonthly_articles/main.py b/Scripts/Web_Scrappers/cricketmonthly_articles/main.py index 16628abaa..4dd53faa6 100644 --- a/Scripts/Web_Scrappers/cricketmonthly_articles/main.py +++ b/Scripts/Web_Scrappers/cricketmonthly_articles/main.py @@ -8,8 +8,12 @@ } r = rq.get("https://www.thecricketmonthly.com/", headers=header) soup = BeautifulSoup(r.content, "html.parser") -main_sec = soup.find("section", attrs={"class": re.compile("col-lhs lhs_content")}) -article = main_sec.find_all("article", attrs={"class": re.compile("col-1-1 module")}) +main_sec = soup.find( + "section", attrs={"class": re.compile("col-lhs lhs_content")} +) +article = main_sec.find_all( + "article", attrs={"class": re.compile("col-1-1 module")} +) about = [] link = [] summary = [] diff --git a/Scripts/Web_Scrappers/google_news_(ui_based)/main.py b/Scripts/Web_Scrappers/google_news_(ui_based)/main.py index 3731891bd..965789867 100644 --- a/Scripts/Web_Scrappers/google_news_(ui_based)/main.py +++ b/Scripts/Web_Scrappers/google_news_(ui_based)/main.py @@ -9,15 +9,23 @@ def fetch_news(link, file_name="custom_news.txt"): } r = rq.get(link, headers=header) soup = BeautifulSoup(r.content, "html.parser") - main_div = soup.find("div", attrs={"class": re.compile("lBwEZb BL5WZb GndZbb")}) - news_set = main_div.find_all("div", attrs={"jscontroller": re.compile("d0DtYd")}) + main_div = soup.find( + "div", attrs={"class": re.compile("lBwEZb BL5WZb GndZbb")} + ) + news_set = main_div.find_all( + "div", attrs={"jscontroller": re.compile("d0DtYd")} + ) news_set2 = main_div.find_all("div", attrs={"class": re.compile("xrnccd")}) sources = [] links = [] headings = [] for s in news_set: - source = s.find("a", attrs={"class": re.compile("wEwyrc AVN2gc uQIVzc Sksgp")}) - time = s.find("time", attrs={"class": re.compile("WW6dff uQIVzc Sksgp")}) + source = s.find( + "a", attrs={"class": re.compile("wEwyrc AVN2gc uQIVzc Sksgp")} + ) + time = s.find( + "time", attrs={"class": re.compile("WW6dff uQIVzc Sksgp")} + ) try: stri = source.text + ", Uploaded - " + time.text except AttributeError: @@ -30,8 +38,12 @@ def fetch_news(link, file_name="custom_news.txt"): for s in news_set2: headings.append(s.h3.text) links.append("https://news.google.com" + s.a["href"][1:]) - time = s.find("time", attrs={"class": re.compile("WW6dff uQIVzc Sksgp")}) - source = s.find("a", attrs={"class": re.compile("wEwyrc AVN2gc uQIVzc Sksgp")}) + time = s.find( + "time", attrs={"class": re.compile("WW6dff uQIVzc Sksgp")} + ) + source = s.find( + "a", attrs={"class": re.compile("wEwyrc AVN2gc uQIVzc Sksgp")} + ) try: stri = source.text + ", Uploaded - " + time.text except AttributeError: @@ -72,7 +84,9 @@ def fetch_news(link, file_name="custom_news.txt"): fetch = "" if ch == 1: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Economy") print("\t c. Markets") @@ -96,7 +110,9 @@ def fetch_news(link, file_name="custom_news.txt"): print("Invalid Choice!") c2 = False elif ch == 2: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Mobile") print("\t c. Gadgets") @@ -123,7 +139,9 @@ def fetch_news(link, file_name="custom_news.txt"): print("Invalid Choice!") c2 = False elif ch == 3: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Movies") print("\t c. Music") @@ -150,7 +168,9 @@ def fetch_news(link, file_name="custom_news.txt"): print("Invalid Choice!") c2 = False elif ch == 4: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Cricket") print("\t c. Hockey") @@ -186,7 +206,9 @@ def fetch_news(link, file_name="custom_news.txt"): print("Invalid Choice!") c2 = False elif ch == 5: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Environment") print("\t c. Outer space") @@ -210,7 +232,9 @@ def fetch_news(link, file_name="custom_news.txt"): print("Invalid Choice!") c2 = False elif ch == 6: - print("Enter the sub-topic of the category you selected. You can choose from :") + print( + "Enter the sub-topic of the category you selected. You can choose from :" + ) print("\t a. Latest") print("\t b. Medicine") print("\t c. Healthcare") diff --git a/Scripts/Web_Scrappers/linkedin_posts_scrapping/main.py b/Scripts/Web_Scrappers/linkedin_posts_scrapping/main.py index 114949044..99a1efc02 100644 --- a/Scripts/Web_Scrappers/linkedin_posts_scrapping/main.py +++ b/Scripts/Web_Scrappers/linkedin_posts_scrapping/main.py @@ -60,7 +60,8 @@ print("Fetching the latest posts for you...") for d in divs: author = d.find( - "div", attrs={"class": re.compile("feed-shared-actor__meta relative")} + "div", + attrs={"class": re.compile("feed-shared-actor__meta relative")}, ) content = d.find( "div", @@ -99,7 +100,14 @@ print("Done") print("Choose the post you want to see :") for i in range(len(authors)): - print("\t" + str(i + 1) + ". " + authors[i] + ". Added: " + timestamp[i]) + print( + "\t" + + str(i + 1) + + ". " + + authors[i] + + ". Added: " + + timestamp[i] + ) ans = "y" while ans == "y": ch = int(input("Enter your choice: ")) diff --git a/Scripts/Web_Scrappers/xmlrpc_tool/xml_tool.py b/Scripts/Web_Scrappers/xmlrpc_tool/xml_tool.py index 6e1185b09..7d6eb49b4 100644 --- a/Scripts/Web_Scrappers/xmlrpc_tool/xml_tool.py +++ b/Scripts/Web_Scrappers/xmlrpc_tool/xml_tool.py @@ -6,12 +6,17 @@ HEADERS = {"Content-type": "application/xml"} LOCATION_XMLRPC = "xmlrpc.php" -METHODS = {"validate": "system.listMethods", "list_methods": "system.listMethods"} +METHODS = { + "validate": "system.listMethods", + "list_methods": "system.listMethods", +} def get_template_call_simple() -> str: data = None - with open("method_call_simple_rpc.xml", encoding="utf-8") as template_simple_xml: + with open( + "method_call_simple_rpc.xml", encoding="utf-8" + ) as template_simple_xml: data = template_simple_xml.read() return data