diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/1 File handle/File handle text/question 5.py b/1 File handle/File handle text/question 5.py index 864520df4cd..e8df3730b18 100644 --- a/1 File handle/File handle text/question 5.py +++ b/1 File handle/File handle text/question 5.py @@ -1,7 +1,8 @@ """Write a function in python to count the number of lowercase alphabets present in a text file “happy.txt""" -import time, os +import time +import os from counter import Counter print("You will see the count of lowercase, uppercase and total count of alphabets in provided file..") diff --git a/AI Game/Tic-Tac-Toe-AI/tic tac b/AI Game/Tic-Tac-Toe-AI/tic tac deleted file mode 100644 index 47a950ff8bf..00000000000 --- a/AI Game/Tic-Tac-Toe-AI/tic tac +++ /dev/null @@ -1 +0,0 @@ -hii diff --git a/AutoComplete_App/frontend.py b/AutoComplete_App/frontend.py index 90e576e849e..b7b78220747 100644 --- a/AutoComplete_App/frontend.py +++ b/AutoComplete_App/frontend.py @@ -1,5 +1,4 @@ from tkinter import * -from tkinter import messagebox import backend diff --git a/Automated Scheduled Call Reminders/caller.py b/Automated Scheduled Call Reminders/caller.py index 3082dbb7193..0526ea7c31a 100644 --- a/Automated Scheduled Call Reminders/caller.py +++ b/Automated Scheduled Call Reminders/caller.py @@ -1,12 +1,9 @@ # The project automates calls for people from the firebase cloud database and the schedular keeps it running and checks for entries # every 1 hour using aps scedular # The project can be used to set 5 min before reminder calls to a set of people for doing a particular job -import os from firebase_admin import credentials, firestore, initialize_app from datetime import datetime, timedelta -import time from time import gmtime, strftime -import twilio from twilio.rest import Client # twilio credentials diff --git a/Automated Scheduled Call Reminders/requirements.txt b/Automated Scheduled Call Reminders/requirements.txt index ccfbb3924fa..f5635170c24 100644 --- a/Automated Scheduled Call Reminders/requirements.txt +++ b/Automated Scheduled Call Reminders/requirements.txt @@ -1,4 +1,4 @@ -BlockingScheduler +APScheduler search os time @@ -11,3 +11,4 @@ timedelta credentials firestore initialize_app +Twilio \ No newline at end of file diff --git a/Bank Application .ipynb b/Bank Application .ipynb index f92a6040923..8bad0d2a213 100644 --- a/Bank Application .ipynb +++ b/Bank Application .ipynb @@ -451,7 +451,6 @@ ], "source": [ "def main():\n", - " import getpass\n", " print(\"-------------------\".center(100))\n", " print(\"| Bank Application |\".center(100))\n", " print(\"-\"*100)\n", diff --git a/Chrome Dino Automater.py b/Chrome Dino Automater.py index eca256a1202..c5668832556 100644 --- a/Chrome Dino Automater.py +++ b/Chrome Dino Automater.py @@ -1,5 +1,5 @@ import pyautogui # pip install pyautogui -from PIL import Image, ImageGrab # pip install pillow +from PIL import ImageGrab # pip install pillow # from numpy import asarray import time diff --git a/CliYoutubeDownloader/CliYoutubeDownloader.py b/CliYoutubeDownloader/CliYoutubeDownloader.py index 2af607ad5ae..7b201a920e2 100644 --- a/CliYoutubeDownloader/CliYoutubeDownloader.py +++ b/CliYoutubeDownloader/CliYoutubeDownloader.py @@ -1,7 +1,7 @@ # libraraies -import pytubefix import sys +import pytube class YouTubeDownloder: diff --git a/CliYoutubeDownloader/requirements.txt b/CliYoutubeDownloader/requirements.txt index 9a9d50658dc..30257302458 100644 --- a/CliYoutubeDownloader/requirements.txt +++ b/CliYoutubeDownloader/requirements.txt @@ -1 +1 @@ -pytubefix +pytube \ No newline at end of file diff --git a/Downloaded Files Organizer/obs.py b/Downloaded Files Organizer/obs.py index c084dfa15ec..1489f257041 100644 --- a/Downloaded Files Organizer/obs.py +++ b/Downloaded Files Organizer/obs.py @@ -1,6 +1,5 @@ def watcher(path): # python script to observe changes in a folder - import sys import time import os from watchdog.observers import Observer diff --git a/Emoji Dictionary/emoji_dictionary.py b/Emoji Dictionary/emoji_dictionary.py index 04949946c9c..db13725f1fe 100644 --- a/Emoji Dictionary/emoji_dictionary.py +++ b/Emoji Dictionary/emoji_dictionary.py @@ -1,7 +1,6 @@ # Emoji Dictionary # ----------------------------------------------------------------------------------------------------- -import io # used for dealing with input and output from tkinter import * # importing the necessary libraries import tkinter.messagebox as mbox import tkinter as tk # imported tkinter as tk diff --git a/Face_Mask_detection (haarcascade)/mask_detection.py b/Face_Mask_detection (haarcascade)/mask_detection.py index 9ba4c34734b..a36382841c2 100644 --- a/Face_Mask_detection (haarcascade)/mask_detection.py +++ b/Face_Mask_detection (haarcascade)/mask_detection.py @@ -1,5 +1,4 @@ import tensorflow.keras -from PIL import Image, ImageOps import numpy as np import cv2 diff --git a/Find current weather of any city using openweathermap API.py b/Find current weather of any city using openweathermap API.py index cb2659c122f..18ee1555d1b 100644 --- a/Find current weather of any city using openweathermap API.py +++ b/Find current weather of any city using openweathermap API.py @@ -3,7 +3,7 @@ # using openweathermap api # import required modules -import requests, json +import requests # Enter your API key here api_key = "Your_API_Key" diff --git a/Flappy Bird - created with tkinter/Tubes.py b/Flappy Bird - created with tkinter/Tubes.py index a6021f69ef5..3948a49e502 100644 --- a/Flappy Bird - created with tkinter/Tubes.py +++ b/Flappy Bird - created with tkinter/Tubes.py @@ -271,7 +271,7 @@ def move(self): if x2 <= (self.__width / 2) - (self.__bird_w / 2): # Verifica se o tubo está na lista de tubos passados - if not tube[0] in self.__pastTubes: + if tube[0] not in self.__pastTubes: # Chama o método para pontuar e adiciona o tubo pontuado à lista de tubos passados self.__score_method() self.__pastTubes.append(tube[0]) diff --git a/HangMan Game b/HangMan Game.py similarity index 100% rename from HangMan Game rename to HangMan Game.py diff --git a/Hotel-Management.py b/Hotel-Management.py index edfdec0934a..ca6e0216cc3 100644 --- a/Hotel-Management.py +++ b/Hotel-Management.py @@ -345,7 +345,7 @@ def exit_menu(): try: menu() -except KeyboardInterrupt as exit: +except KeyboardInterrupt: print("\nexiting...!") # menu() diff --git a/Image-watermarker/watermark.py b/Image-watermarker/watermark.py index 6968cc04c45..e820eeccaad 100644 --- a/Image-watermarker/watermark.py +++ b/Image-watermarker/watermark.py @@ -1,7 +1,6 @@ -from PIL import Image, ImageDraw, ImageFont +from PIL import ImageDraw, ImageFont from customtkinter import filedialog from CTkMessagebox import CTkMessagebox -import customtkinter as ctk class Watermark: @@ -43,5 +42,5 @@ def save_image(self, image): if save_path: try: image.save(save_path) - except Exception as e: + except Exception: print("Failed to save image: {e}") diff --git a/ImageDownloader/img_downloader.py b/ImageDownloader/img_downloader.py index 9844635cdaf..4ed7c65d8ff 100644 --- a/ImageDownloader/img_downloader.py +++ b/ImageDownloader/img_downloader.py @@ -2,7 +2,9 @@ def ImageDownloader(url): - import os, re, requests + import os + import re + import requests response = requests.get(url) text = response.text diff --git a/JARVIS/JARVIS_2.0.py b/JARVIS/JARVIS_2.0.py index 6a4b738e8fa..65600a1bc75 100644 --- a/JARVIS/JARVIS_2.0.py +++ b/JARVIS/JARVIS_2.0.py @@ -16,13 +16,13 @@ import pyjokes # for generating random jokes import requests import json -from PIL import Image, ImageGrab +from PIL import ImageGrab from gtts import gTTS # for 30 seconds clip "Jarvis, clip that!" and discord ctrl+k quick-move (might not come to fruition) from pynput import keyboard -from pynput.keyboard import Key, Listener -from pynput.mouse import Button, Controller +from pynput.keyboard import Key +from pynput.mouse import Controller # ======= from playsound import * # for sound output @@ -127,7 +127,7 @@ def takecommand(): print("Recognizing...") query = r.recognize_google(audio, language="en-in") print(f"User said {query}\n") - except Exception as e: + except Exception: print("Say that again please...") return "None" return query diff --git a/LETTER GUESSER b/LETTER GUESSER.py similarity index 100% rename from LETTER GUESSER rename to LETTER GUESSER.py diff --git a/ML House Prediction.ipynb b/ML House Prediction.ipynb index b838d064550..7babd729710 100644 --- a/ML House Prediction.ipynb +++ b/ML House Prediction.ipynb @@ -457,9 +457,7 @@ "execution_count": 7, "metadata": {}, "outputs": [], - "source": [ - "import matplotlib.pyplot as plt" - ] + "source": [] }, { "cell_type": "code", @@ -1424,8 +1422,6 @@ } ], "source": [ - "from sklearn.linear_model import LinearRegression\n", - "from sklearn.tree import DecisionTreeRegressor\n", "from sklearn.ensemble import RandomForestRegressor\n", "#model = LinearRegression()\n", "#model = DecisionTreeRegressor()\n", @@ -1639,7 +1635,7 @@ } ], "source": [ - "from joblib import dump, load\n", + "from joblib import dump\n", "dump(model, 'HousingPricePredicter.joblib')" ] }, diff --git a/Model Usage.ipynb b/Model Usage.ipynb index 9a630b2068a..a5ea4ba5fb2 100644 --- a/Model Usage.ipynb +++ b/Model Usage.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "outputs": [], "source": [ - "from joblib import dump, load\n", + "from joblib import load\n", "import numpy as np\n", "model = load('HousingPricePredicter.joblib')" ] diff --git a/News_App/Newsapp.py b/News_App/Newsapp.py index 0f3f976e9fa..7fdd3df2b28 100644 --- a/News_App/Newsapp.py +++ b/News_App/Newsapp.py @@ -1,4 +1,3 @@ -import os import solara as sr import yfinance as yf diff --git a/Password Generator/pass_gen.py b/Password Generator/pass_gen.py index f92b9badad2..1aa2e991e66 100644 --- a/Password Generator/pass_gen.py +++ b/Password Generator/pass_gen.py @@ -1,6 +1,5 @@ import string as str import secrets -import random # this is the module used to generate random numbers on your given range class PasswordGenerator: diff --git a/Python Program for factorial of a number b/Python Program for factorial of a number.py similarity index 100% rename from Python Program for factorial of a number rename to Python Program for factorial of a number.py diff --git a/QR_code_generator/qrcode.py b/QR_code_generator/qrcode.py index 63a4b26684f..124cb080f2c 100755 --- a/QR_code_generator/qrcode.py +++ b/QR_code_generator/qrcode.py @@ -1,4 +1,4 @@ -import pyqrcode, png +import pyqrcode # from pyqrcode import QRCode # no need to import same library again and again diff --git a/QuestionAnswerVirtualAssistant/backend.py b/QuestionAnswerVirtualAssistant/backend.py index 3d21899a4fc..6813d2a1008 100644 --- a/QuestionAnswerVirtualAssistant/backend.py +++ b/QuestionAnswerVirtualAssistant/backend.py @@ -1,7 +1,6 @@ import sqlite3 import json import pandas as pd -import sklearn from sklearn.feature_extraction.text import TfidfVectorizer class QuestionAnswerVirtualAssistant: diff --git a/QuestionAnswerVirtualAssistant/frontend.py b/QuestionAnswerVirtualAssistant/frontend.py index bc99cfebd36..becc7dc8307 100644 --- a/QuestionAnswerVirtualAssistant/frontend.py +++ b/QuestionAnswerVirtualAssistant/frontend.py @@ -1,5 +1,4 @@ from tkinter import * -from tkinter import messagebox import backend diff --git a/Search_Engine/backend.py b/Search_Engine/backend.py index f716f5fa16d..fab720c3a50 100644 --- a/Search_Engine/backend.py +++ b/Search_Engine/backend.py @@ -1,6 +1,4 @@ import sqlite3 -import test_data -import ast import json class SearchEngine: diff --git a/Search_Engine/frontend.py b/Search_Engine/frontend.py index 93dd7636f19..c78bf525169 100644 --- a/Search_Engine/frontend.py +++ b/Search_Engine/frontend.py @@ -1,5 +1,4 @@ from tkinter import * -from tkinter import messagebox import backend diff --git a/Street_Fighter/src/main.py b/Street_Fighter/src/main.py index 188b11e7ddb..1301e2e3f95 100644 --- a/Street_Fighter/src/main.py +++ b/Street_Fighter/src/main.py @@ -1,7 +1,6 @@ import math import pygame from pygame import mixer -from pygame import font import cv2 import numpy as np import os diff --git a/TaskManager.py b/TaskManager.py index 250eb05323b..b40a7f6beec 100644 --- a/TaskManager.py +++ b/TaskManager.py @@ -1,4 +1,3 @@ -import datetime import csv def load_tasks(filename='tasks.csv'): diff --git a/TaskPlanner.py b/TaskPlanner.py index 250eb05323b..b40a7f6beec 100644 --- a/TaskPlanner.py +++ b/TaskPlanner.py @@ -1,4 +1,3 @@ -import datetime import csv def load_tasks(filename='tasks.csv'): diff --git a/Trending youtube videos.py b/Trending youtube videos.py new file mode 100644 index 00000000000..a14535e4ddc --- /dev/null +++ b/Trending youtube videos.py @@ -0,0 +1,43 @@ +''' + Python program that uses the YouTube Data API to fetch the top 10 trending YouTube videos. +You’ll need to have an API key from Google Cloud Platform to use the YouTube Data API. + +First, install the google-api-python-client library if you haven’t already: +pip install google-api-python-client + +Replace 'YOUR_API_KEY' with your actual API key. This script will fetch and print the titles, +channels, and view counts of the top 10 trending YouTube videos in India. +You can change the regionCode to any other country code if needed. + +Then, you can use the following code: + +''' + +from googleapiclient.discovery import build + +# Replace with your own API key +API_KEY = 'YOUR_API_KEY' +YOUTUBE_API_SERVICE_NAME = 'youtube' +YOUTUBE_API_VERSION = 'v3' + +def get_trending_videos(): + youtube = build(YOUTUBE_API_SERVICE_NAME, YOUTUBE_API_VERSION, developerKey=API_KEY) + + # Call the API to get the top 10 trending videos + request = youtube.videos().list( + part='snippet,statistics', + chart='mostPopular', + regionCode='IN', # Change this to your region code + maxResults=10 + ) + response = request.execute() + + # Print the video details + for item in response['items']: + title = item['snippet']['title'] + channel = item['snippet']['channelTitle'] + views = item['statistics']['viewCount'] + print(f'Title: {title}\nChannel: {channel}\nViews: {views}\n') + +if __name__ == '__main__': + get_trending_videos() diff --git a/Tweet Pre-Processing.py b/Tweet Pre-Processing.py index 43d3e6c13b3..458e04c4e41 100644 --- a/Tweet Pre-Processing.py +++ b/Tweet Pre-Processing.py @@ -4,9 +4,7 @@ # In[10]: -import numpy as np from nltk.corpus import twitter_samples -import matplotlib.pyplot as plt import random diff --git a/VoiceAssistant/Project_Basic_struct/TextTospeech.py b/VoiceAssistant/Project_Basic_struct/TextTospeech.py index 5c23af072e6..a6ef7645628 100644 --- a/VoiceAssistant/Project_Basic_struct/TextTospeech.py +++ b/VoiceAssistant/Project_Basic_struct/TextTospeech.py @@ -1,8 +1,4 @@ -from gtts import gTTS -from playsound import playsound import win32com -from win32com import client -import os def tts(): audio = 'speech.mp3' diff --git a/VoiceAssistant/Project_Basic_struct/dictator.py b/VoiceAssistant/Project_Basic_struct/dictator.py index f5cb71fb014..3ceb4f1ce76 100644 --- a/VoiceAssistant/Project_Basic_struct/dictator.py +++ b/VoiceAssistant/Project_Basic_struct/dictator.py @@ -2,7 +2,7 @@ # from speakListen import long_hear from speakListen import * -from colorama import Fore, Back, Style +from colorama import Fore def big_text(): print("By default, I will record your voice for 60 seconds.\nDo you want to change this default timing?") diff --git a/VoiceAssistant/Project_Basic_struct/speakListen.py b/VoiceAssistant/Project_Basic_struct/speakListen.py index e16db721abb..5f4ca0edadf 100644 --- a/VoiceAssistant/Project_Basic_struct/speakListen.py +++ b/VoiceAssistant/Project_Basic_struct/speakListen.py @@ -1,7 +1,6 @@ import time -from colorama import Fore, Back, Style +from colorama import Fore import speech_recognition as sr -import os import pyttsx3 import datetime from rich.progress import Progress diff --git a/VoiceAssistant/Project_Basic_struct/websiteWork.py b/VoiceAssistant/Project_Basic_struct/websiteWork.py index c20a2792791..501d691eaba 100644 --- a/VoiceAssistant/Project_Basic_struct/websiteWork.py +++ b/VoiceAssistant/Project_Basic_struct/websiteWork.py @@ -1,4 +1,4 @@ -from speakListen import greet, hear +from speakListen import hear from speakListen import speak @@ -55,7 +55,7 @@ def wiki_search(): print("I could'nt understand what you just said!") speak("I could'nt understand what you just said!") - except Exception as e: + except Exception: print("Couldn't find") #wiki_search() diff --git a/Web_Scraper.py b/Web_Scraper.py index 46692794431..b489b54096d 100644 --- a/Web_Scraper.py +++ b/Web_Scraper.py @@ -4,10 +4,8 @@ Requirements: selenium, BeautifulSoup """ -import requests from bs4 import BeautifulSoup from selenium import webdriver -from selenium.webdriver.common.keys import Keys import time # url of the page we want to scrape diff --git a/Wordle/wordle.py b/Wordle/wordle.py index ffed27a1838..c4206704223 100644 --- a/Wordle/wordle.py +++ b/Wordle/wordle.py @@ -63,7 +63,7 @@ continue # Check if the word given by the user is in the dictionary - if not user_inp in dictionary: + if user_inp not in dictionary: print("Your word is not in the dictionary") continue diff --git a/advanced_calculator.py b/advanced_calculator.py index 82ff80d8970..c7021f6a608 100644 --- a/advanced_calculator.py +++ b/advanced_calculator.py @@ -10,16 +10,10 @@ # How can I market gtts? Like showing used google's api? This is how can I market it? # Project description? What will be the project description? -from numbers import Number -from sys import exit -import colorama as color -import inquirer from gtts import gTTS from pygame import mixer, time from io import BytesIO from pprint import pprint -import art -import date # Find the best of best extensions for the auto generation of the documentation parts. diff --git a/automail.py b/automail.py index 84b67424408..a1407736ac9 100644 --- a/automail.py +++ b/automail.py @@ -2,7 +2,9 @@ #simple simon says module that interacts with google API to read the subject line of an email and respond to "Simon says:" #DO NOT FORGET TO ADD CREDENTIALS.JSON AND TOKEN.JSON TO .GITIGNORE!!! -import ezgmail, re, time +import ezgmail +import re +import time check = True while check: diff --git a/binary_search_trees/main.py b/binary_search_trees/main.py index 96ebb6ae8eb..0e819375716 100644 --- a/binary_search_trees/main.py +++ b/binary_search_trees/main.py @@ -1,8 +1,6 @@ -from tree_node import Node from insert_in_bst import insert from delete_a_node_in_bst import delete_node from search_in_bst import search -from inorder_successor import inorder_successor from mirror_a_bst import create_mirror_bst from print_in_range import print_in_range from root_to_leaf_paths import print_root_to_leaf_paths diff --git a/binary_search_trees/mirror_a_bst.py b/binary_search_trees/mirror_a_bst.py index 73f080f85c2..e7b3bb7fcb9 100644 --- a/binary_search_trees/mirror_a_bst.py +++ b/binary_search_trees/mirror_a_bst.py @@ -1,4 +1,3 @@ -from tree_node import Node def create_mirror_bst(root): """ Function to create a mirror of a binary search tree""" diff --git a/cartesian_product.py b/cartesian_product.py index 7ed49aae295..ba11eb7d54f 100644 --- a/cartesian_product.py +++ b/cartesian_product.py @@ -1,7 +1,6 @@ """Cartesian Product of Two Lists.""" # Import -from itertools import product # Cartesian Product of Two Lists diff --git a/chaos.py b/chaos.py index 520f3d44512..1bd1c120ee4 100644 --- a/chaos.py +++ b/chaos.py @@ -11,7 +11,7 @@ def main(): break else: print("Please enter correct number") - except Exception as e: + except Exception: print("Please enter correct number") for i in range(10): diff --git a/check whether the string is Symmetrical or Palindrome.py b/check whether the string is Symmetrical or Palindrome.py index d29772e721a..0b12df47a9e 100644 --- a/check whether the string is Symmetrical or Palindrome.py +++ b/check whether the string is Symmetrical or Palindrome.py @@ -14,7 +14,7 @@ def palindrome(a): else: flag = 1 - break; + break if flag == 0: print("The entered string is palindrome") diff --git a/cli_master/cli_master.py b/cli_master/cli_master.py index f57a3b192bb..24a7457428c 100644 --- a/cli_master/cli_master.py +++ b/cli_master/cli_master.py @@ -2,10 +2,9 @@ import sys from pprint import pprint -import sys sys.path.append(os.path.realpath(".")) -import inquirer # noqa +import inquirer # Take authentication input from the user questions = [ @@ -20,40 +19,80 @@ # Just making pipelines class Validation: - def phone_validation(): + @staticmethod + def phone_validation(answer, current): # Think over how to make a validation for phone number? - pass + return True - def email_validation(): - pass + @staticmethod + def email_validation(answer, current): + return True - def password_validation(): - pass + @staticmethod + def password_validation(answer, current): + return True + @staticmethod def username_validation(): pass - def country_validation(): + @staticmethod + def fname_validation(answer, current): + # Add your first name validation logic here + return True + + @staticmethod + def lname_validation(answer, current): + # Add your last name validation logic here + return True + + @staticmethod + def country_validation(answer, current): # All the countries in the world??? # JSON can be used. # Download the file + return True - def state_validation(): + @staticmethod + def state_validation(answer, current): # All the states in the world?? # The state of the selected country only. - pass + return True - def city_validation(): + @staticmethod + def city_validation(answer, current): # All the cities in the world?? # JSON can be used. - pass + return True + + @staticmethod + def password_confirmation(answer, current): + return True + + @staticmethod + def address_validation(answer, current): + return True + + @staticmethod + def login_username(answer, current): + # Add your username validation logic here + return True + @staticmethod + def login_password(answer, current): + # Add your password validation logic here + return True # Have an option to go back. # How can I do it? -if answers["authentication"] == "Login": - print("Login") +if answers is not None and answers.get("authentication") == "Login": questions = [ + inquirer. + Text( + "surname", + message="What's your last name (surname)?", + validate=Validation.lname_validation, + ), inquirer.Text( "username", message="What's your username?", @@ -65,11 +104,10 @@ def city_validation(): validate=Validation.login_password, ), ] + answers = inquirer.prompt(questions) - -elif answers["authentication"] == "Sign up": +elif answers is not None and answers.get("authentication") == "Sign up": print("Sign up") - questions = [ inquirer.Text( "name", @@ -78,7 +116,8 @@ def city_validation(): ), inquirer.Text( "surname", - message="What's your last name(surname)?, validate=Validation.lname), {name}?", + message="What's your last name (surname)?", + validate=Validation.lname_validation, ), inquirer.Text( "phone", @@ -96,7 +135,7 @@ def city_validation(): validate=Validation.password_validation, ), inquirer.Text( - "password", + "password_confirm", message="Confirm your password", validate=Validation.password_confirmation, ), @@ -110,27 +149,16 @@ def city_validation(): message="What's your country", validate=Validation.country_validation, ), - inquirer.Text( - "state", - message="What's your state", - validate=Validation.state_validation, - ), - inquirer.Text( - "city", - message="What's your city", - validate=Validation.city_validation, - ), inquirer.Text( "address", message="What's your address", validate=Validation.address_validation, ), ] -# Also add optional in the above thing. -# Have string manipulation for the above thing. -# How to add authentication of google to command line? -elif answers["authentication"] == "Exit": + answers = inquirer.prompt(questions) + +elif answers is not None and answers.get("authentication") == "Exit": print("Exit") sys.exit() -pprint(answers) +pprint(answers) \ No newline at end of file diff --git a/colorma_as_color.py b/colorma_as_color.py index 9bf2338ebbb..4a9e49d1f14 100644 --- a/colorma_as_color.py +++ b/colorma_as_color.py @@ -1,4 +1,3 @@ -import colorama as color from colorama import Fore, Back, Style diff --git a/currency converter/main.py b/currency converter/main.py index a75a047c724..b656e7bdf3b 100644 --- a/currency converter/main.py +++ b/currency converter/main.py @@ -4,16 +4,15 @@ from PyQt5.QtWidgets import * from PyQt5 import QtWidgets, uic from PyQt5.QtCore import * -import requests +import httpx from bs4 import BeautifulSoup -from requests.models import ContentDecodingError def getVal(cont1, cont2): cont1val = cont1.split("-")[1] cont2val = cont2.split("-")[1] url = f"https://free.currconv.com/api/v7/convert?q={cont1val}_{cont2val}&compact=ultra&apiKey=b43a653672c4a94c4c26" - r = requests.get(url) + r = httpx.get(url) htmlContent = r.content soup = BeautifulSoup(htmlContent, "html.parser") try: diff --git a/diction.py b/diction.py index 8fc071cb6b8..e4757e3db0e 100644 --- a/diction.py +++ b/diction.py @@ -28,7 +28,7 @@ def takeCommand(): query = r.recognize_google(audio, language="en-in") print(f"User said: {query}\n") - except Exception as e: + except Exception: # print(e) print("Say that again please...") diff --git a/facebook id hack.py b/facebook id hack.py index a7faa2bb225..d386662f312 100644 --- a/facebook id hack.py +++ b/facebook id hack.py @@ -2,9 +2,6 @@ # Email-kingslayer8509@gmail.com # you need to create a file password.txt which contains all possible passwords import requests -import threading -import urllib.request -import os from bs4 import BeautifulSoup import sys diff --git a/googlemaps.py b/googlemaps.py index afc55094c75..8b049bcbaf1 100644 --- a/googlemaps.py +++ b/googlemaps.py @@ -1,5 +1,4 @@ import requests -import json import geocoder g = geocoder.ip("me") diff --git a/googleweb.py b/googleweb.py index 92fa989bad3..41198a44e59 100644 --- a/googleweb.py +++ b/googleweb.py @@ -1,8 +1,8 @@ from fuzzywuzzy import fuzz -import bs4, requests +import bs4 +import requests import numpy as np import pandas as pd -import os requests.packages.urllib3.disable_warnings() FinalResult=[] def SearchResults(): diff --git a/greattwono b/greattwono.py similarity index 100% rename from greattwono rename to greattwono.py diff --git a/hamming-numbers b/hamming-numbers.py similarity index 100% rename from hamming-numbers rename to hamming-numbers.py diff --git a/happy_num.py b/happy_num.py index a9740d0703b..1ea217f6059 100644 --- a/happy_num.py +++ b/happy_num.py @@ -2,27 +2,27 @@ #isHappyNumber() will determine whether a number is happy or not def isHappyNumber(num): - rem = sum = 0; + rem = sum = 0 #Calculates the sum of squares of digits while(num > 0): - rem = num%10; - sum = sum + (rem*rem); - num = num//10; - return sum; + rem = num%10 + sum = sum + (rem*rem) + num = num//10 + return sum -num = 82; -result = num; +num = 82 +result = num while(result != 1 and result != 4): - result = isHappyNumber(result); + result = isHappyNumber(result) #Happy number always ends with 1 if(result == 1): - print(str(num) + " is a happy number after apply way 1"); + print(str(num) + " is a happy number after apply way 1") #Unhappy number ends in a cycle of repeating numbers which contain 4 elif(result == 4): - print(str(num) + " is not a happy number after apply way 1"); + print(str(num) + " is not a happy number after apply way 1") diff --git a/image2pdf/image2pdf.py b/image2pdf/image2pdf.py index 2c6d4bda27b..0e1aa049aab 100644 --- a/image2pdf/image2pdf.py +++ b/image2pdf/image2pdf.py @@ -36,7 +36,7 @@ def getPictures(self): print(f" [Error] there are no pictures in the directory: {self.directory} ") return False - print(f"Found picture(s) :") + print("Found picture(s) :") return pictures def selectPictures(self, pictures): diff --git a/inheritance_YahV1729.python b/inheritance_YahV1729.py similarity index 100% rename from inheritance_YahV1729.python rename to inheritance_YahV1729.py diff --git a/insta_image_saving/instagram_image_scrapping.ipynb b/insta_image_saving/instagram_image_scrapping.ipynb index fdb8efbf160..0d5d2e5ad35 100644 --- a/insta_image_saving/instagram_image_scrapping.ipynb +++ b/insta_image_saving/instagram_image_scrapping.ipynb @@ -7,14 +7,11 @@ "outputs": [], "source": [ "from time import sleep\n", - "import scrapy\n", "import pandas as pd\n", - "from scrapy import Spider\n", "from selenium import webdriver\n", "from scrapy.selector import Selector\n", "from io import BytesIO\n", "from PIL import Image\n", - "import os\n", "import requests" ] }, diff --git a/mapit.py b/mapit.py index 53d0cd61014..73d8666d7b7 100644 --- a/mapit.py +++ b/mapit.py @@ -1,4 +1,6 @@ -import sys, webbrowser, pyperclip +import sys +import webbrowser +import pyperclip if len(sys.argv) > 1: address = " ".join(sys.argv[1:]) diff --git a/mathfunctions b/mathfunctions.py similarity index 100% rename from mathfunctions rename to mathfunctions.py diff --git a/mobilePhoneSpecsScrapper.py b/mobilePhoneSpecsScrapper.py index 1578942f8dc..fc36b1c85b3 100644 --- a/mobilePhoneSpecsScrapper.py +++ b/mobilePhoneSpecsScrapper.py @@ -31,7 +31,7 @@ def crawl_html_page(self, sub_url): soup = BeautifulSoup(page.text, "html.parser") return soup - except ConnectionError as err: + except ConnectionError: print("Please check your network connection and re-run the script.") exit() diff --git a/news_articles__scraper.py b/news_articles__scraper.py index 6c6360460cf..c16c4db0290 100644 --- a/news_articles__scraper.py +++ b/news_articles__scraper.py @@ -11,10 +11,7 @@ # ! pip install newspaper3k -import pickle -import re import sys -import urllib import pandas as pd import requests @@ -41,7 +38,7 @@ fakearticle_links.append(link.get("href")) # this describes what to do if an exception is thrown - except Exception as e: + except Exception: # get the exception information error_type, error_obj, error_info = sys.exc_info() # print the link that cause the problem @@ -56,10 +53,7 @@ fakearticle_links[1888:] -import matplotlib.pyplot as plt -import pandas as pd -import numpy as np """We have to modify the links so that the links actually work as we can see that the string extracted is the last part of the url! @@ -168,7 +162,7 @@ TOIarticle_links.append(link.get("href")) # this describes what to do if an exception is thrown - except Exception as e: + except Exception: # get the exception information error_type, error_obj, error_info = sys.exc_info() # print the link that cause the problem diff --git a/nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py b/nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py index be17651b5c4..8fae670cdca 100644 --- a/nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py +++ b/nitkarshchourasia/to_sort/JARVIS_python_bot/JARVIS_2.0.py @@ -16,13 +16,13 @@ import pyjokes # for generating random jokes import requests import json -from PIL import Image, ImageGrab +from PIL import ImageGrab from gtts import gTTS # for 30 seconds clip "Jarvis, clip that!" and discord ctrl+k quick-move (might not come to fruition) from pynput import keyboard -from pynput.keyboard import Key, Listener -from pynput.mouse import Button, Controller +from pynput.keyboard import Key +from pynput.mouse import Controller from playsound import * # for sound output @@ -135,7 +135,7 @@ def takecommand(): print("Recognizing...") query = r.recognize_google(audio, language="en-in") print(f"User said {query}\n") - except Exception as e: + except Exception: print("Say that again please...") return "None" return query diff --git a/nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py b/nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py index 78a259d07a7..129fba0bbd2 100644 --- a/nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py +++ b/nitkarshchourasia/to_sort/JARVIS_python_bot/features_to_add.py @@ -1,5 +1,4 @@ # imports modules -import sys import time from getpass import getuser diff --git a/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py b/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py index 96e4db39faa..6e2bc6831de 100644 --- a/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py +++ b/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/models.py @@ -1,4 +1,3 @@ -from typing import Any from django.db import models from django.utils import timezone diff --git a/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py b/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py index 7ce503c2dd9..49290204899 100644 --- a/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py +++ b/nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/tests.py @@ -1,3 +1,2 @@ -from django.test import TestCase # Create your tests here. diff --git a/notepad/notepad_support.py b/notepad/notepad_support.py index 7851ca9991a..39a27d63b0e 100644 --- a/notepad/notepad_support.py +++ b/notepad/notepad_support.py @@ -17,7 +17,6 @@ py3 = 0 except ImportError: - import tkinter.ttk as ttk py3 = 1 diff --git a/password_programs_multiple/animal_name_scraiper.py b/password_programs_multiple/animal_name_scraiper.py index 8204e90d794..ea0e0f15d00 100644 --- a/password_programs_multiple/animal_name_scraiper.py +++ b/password_programs_multiple/animal_name_scraiper.py @@ -1,9 +1,5 @@ import requests -from requests import get from bs4 import BeautifulSoup -import pandas as pd -import numpy as np -import html5lib # * Using html5lib as the parser is good # * It is the most lenient parser and works as diff --git a/psunotify.py b/psunotify.py index 5e95769a916..3d5ea4b99de 100644 --- a/psunotify.py +++ b/psunotify.py @@ -45,7 +45,7 @@ file.close() print("Done") - except urllib2.URLError as e: + except urllib2.URLError: print( "Sorry there exists a problem with this URL Please Download this Manually " + str(url) diff --git a/random_file_move.py b/random_file_move.py index f8a2af7704e..38ccdc8649b 100644 --- a/random_file_move.py +++ b/random_file_move.py @@ -6,7 +6,8 @@ # Description : This will move specified number of files(given in ratio) from the src directory to dest directory. -import os, random +import os +import random import argparse diff --git a/requirements_with_versions.txt b/requirements_with_versions.txt index bf067073505..8adddfa74b3 100644 --- a/requirements_with_versions.txt +++ b/requirements_with_versions.txt @@ -81,7 +81,7 @@ Unidecode==1.4.0 Ball==0.2.9 pynput==1.8.1 gTTS==2.5.4 -ccxt==4.4.91 +ccxt==4.4.94 fitz==0.0.1.dev2 fastapi==0.116.1 Django==5.1.7 diff --git a/snake_case_renamer_depth_one.py b/snake_case_renamer_depth_one.py index fdedcb54a7f..eb4ac051a6f 100644 --- a/snake_case_renamer_depth_one.py +++ b/snake_case_renamer_depth_one.py @@ -1,6 +1,5 @@ import os import argparse -from typing import Union def generate_unique_name(directory: str, name: str) -> str: """ diff --git a/stone_paper_scissor/main.py b/stone_paper_scissor/main.py index 2a2166f4f47..eebfdd424e3 100644 --- a/stone_paper_scissor/main.py +++ b/stone_paper_scissor/main.py @@ -15,7 +15,7 @@ raise ValueError else: break - except ValueError as e: + except ValueError: print("Please input a correct number") if utils.validate(player_hand): diff --git a/text_to_audio/main.py b/text_to_audio/main.py index ff7a3e56e64..fea9aef846c 100644 --- a/text_to_audio/main.py +++ b/text_to_audio/main.py @@ -3,7 +3,6 @@ from io import BytesIO # only use when needed to avoid memory usage in program -from pprint import pprint """_summary_ def some_function(): diff --git a/tic-tac-toe.py b/tic-tac-toe.py index 8956be21237..a3dd41e4062 100644 --- a/tic-tac-toe.py +++ b/tic-tac-toe.py @@ -90,7 +90,10 @@ def CheckWin(): board[choice] = Mark player += 1 CheckWin() - + if choice < 1 or choice > 9: + print("Invalid Position! Please choose a position between 1 and 9.") + time.sleep(2) + continue os.system("cls") DrawBoard() if Game == Draw: diff --git a/time_delta.py b/time_delta.py index 9b153fd9707..ac367ba2f84 100644 --- a/time_delta.py +++ b/time_delta.py @@ -29,11 +29,6 @@ #------------------------------------------------------------------------------ # Imports -import math -import os -import random -import re -import sys import datetime # Complete the time_delta function below. diff --git a/whatsapp-monitor.py b/whatsapp-monitor.py index 842dd1a866d..d8bfbd3b8c7 100644 --- a/whatsapp-monitor.py +++ b/whatsapp-monitor.py @@ -12,7 +12,6 @@ """ from selenium import webdriver -import os import time driver = webdriver.Firefox() diff --git a/wiki/wiki.py b/wiki/wiki.py index 564c7e1bfd0..30d876eb89b 100644 --- a/wiki/wiki.py +++ b/wiki/wiki.py @@ -5,7 +5,6 @@ import tkinter as tk from tkinter import Label, Button, Entry, Text, messagebox, SOLID, GROOVE, StringVar, WORD, END #import PIL as ImageTK -from tkinter import messagebox class main(): diff --git a/youtubedownloader.py b/youtubedownloader.py index 55b5bc85990..df448b93890 100644 --- a/youtubedownloader.py +++ b/youtubedownloader.py @@ -1,5 +1,5 @@ -from tkinter import * -from tkinter import filedialog, messagebox + +from tkinter import Button, Entry, Label, Tk, filedialog, messagebox from threading import Thread from pytube import YouTube @@ -19,7 +19,7 @@ def download(): messagebox.showinfo('', 'Download completed!') else: messagebox.showwarning('', 'Download cancelled!') - except Exception as e: + except Exception: messagebox.showerror("Error", "An error occurred while downloading the video.")