Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

chore: black applied across all files #657

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Scripts/API/Football-Standings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


def print_standings(league_id):

league_code = league_id.get("code")
resource = f"competitions/{league_code}/standings"
api_url = API_URL + resource
Expand Down Expand Up @@ -72,7 +71,6 @@ def print_standings(league_id):

if __name__ == "__main__":
try:

# If API key is not stored
if API_KEY is None or API_KEY == "YOUR_KEY_HERE":
print(
Expand Down
2 changes: 0 additions & 2 deletions Scripts/API/GeoCode API/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
adrs = []
parms = {}
for line in fh:

address = line.strip()
parms["address"] = address
parms["key"] = api_key
Expand All @@ -26,7 +25,6 @@
raise ValueError from None

with urllib.request.urlopen(req) as resp:

data = resp.read().decode()

try:
Expand Down
3 changes: 0 additions & 3 deletions Scripts/API/Google-Py Translator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def greeting():


def custom(src, dst):

sent = input("\nEnter your sentence : ")

if src == 0:
Expand All @@ -31,7 +30,6 @@ def custom(src, dst):


def from_file(src, dst):

name = input("\nEnter absolute path for file : ")

try:
Expand Down Expand Up @@ -69,7 +67,6 @@ def from_file(src, dst):


def main():

prompt = """
Available options :
1. Custom text translation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"/v1/random-album/", view_func=RandomAlbumAPI.as_view("random-album")
)


# Exception Handler
@app.errorhandler(APIException)
def handle_invalid_usage(error):
Expand Down
1 change: 1 addition & 0 deletions Scripts/API/Random_Quote_Notification/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from plyer import notification
from apscheduler.schedulers.blocking import BlockingScheduler


# Sub-Routines
def fetch(): # This gets the quote from the API and turns it into the quote to be displayed
quoteSite = requests.get("http://api.quotable.io/random")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


def categorize(tweets_list, number_of_topics=3):

# vectorize texts
vec = CountVectorizer(stop_words="english")
X = vec.fit_transform(tweets_list).toarray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def remove_stop_words(sentence):


def clean_tweets(tweets):

# remove url
no_url_tweets = [re.sub(r"http\S+", "", t) for t in tweets]

Expand Down
2 changes: 2 additions & 0 deletions Scripts/API/simple_api_requests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import json

app = Flask(__name__)


# GET ALL API DATA
# http://127.0.0.1:8000/
@app.route("/")
Expand Down
1 change: 0 additions & 1 deletion Scripts/Bots/DiscordBot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ async def ping(ctx):
@client.event
async def on_message(message):
if message.content in cursewords:

await message.channel.purge(limit=1)
await message.author.create_dm()
await message.author.dm_channel.send(
Expand Down
1 change: 1 addition & 0 deletions Scripts/Bots/Slack-Bot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
os.environ.get("SLACK_EVENTS_TOKEN"), "/slack/events", app
)


# When a 'message' event is detected by the events adapter, forward that payload
# to this function.
@slack_events_adapter.on("message")
Expand Down
3 changes: 0 additions & 3 deletions Scripts/Bots/Telegram-bot/telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def client_authenticate(client, phone):
# ask either to input token or otp sent to
# number or sent or your telegram id
if not client.is_user_authorized():

client.send_code_request(phone)

# signing in the client
Expand All @@ -47,13 +46,11 @@ def client_authenticate(client, phone):

def messasge_send(client, user_id, user_hash):
try:

receiver = InputPeerUser(user_id, user_hash)

# sending message using telegram client
client.send_message(receiver, "Hello", parse_mode="html")
except Exception as e:

# there may be many error coming in while like peer
# error, wwrong access_hash, flood_error, etc
print(e)
Expand Down
2 changes: 0 additions & 2 deletions Scripts/Bots/Torrent-Search-Bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def get_quote(search):

data = pirate(search)
name = data[0]["name"]
if name == "No results returned":
Expand All @@ -33,7 +32,6 @@ def unknown(update, context):
def quote(update, context):
update.message.chat_id
if update.message:

query = update.message.text
context.bot.send_message(
chat_id=update.effective_chat.id,
Expand Down
1 change: 0 additions & 1 deletion Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def __init__(self):
time.sleep(2)

def take_test(self):

# Load textbox element
while True:
try:
Expand Down
1 change: 1 addition & 0 deletions Scripts/Bots/Zoom_Meetings_Bot/automate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# In this program all the text-fields, buttons, check-boxes are located using screenshots
# You can change the sleep-time as per the loading time of your pc


# Method to host a new meeting with video off and audio off
def zoom_automate(meeting_id, meeting_passcode):
# Opens the zoom app
Expand Down
1 change: 1 addition & 0 deletions Scripts/Miscellaneous/Automatic Birthday Wisher/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
GMAIL_ID = "Your-Gmail-Id"
GMAIL_PWD = "Your-Gmail-Password"


# function for sending email
def sendEmail(to, sub, msg):
# conncection to gmail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def mail(df, from_, password):

msg = em.Message()
msg.add_header("Content-Type", "text/html")

Expand All @@ -24,7 +23,6 @@ def mail(df, from_, password):
to_length = len(to)

try:

server = smtplib.SMTP(
"smtp.outlook.com", 587
) # Change it to gamil or yahoo as per requirement
Expand All @@ -33,7 +31,6 @@ def mail(df, from_, password):
print("Login Succesfull \n")

for i, j in zip(to, name):

print("" + str(to_length) + " left \n")
print("Sending to {}".format(j))

Expand Down Expand Up @@ -75,13 +72,11 @@ def mail(df, from_, password):
server.quit()

except:

print("Make sure have an active internet connection")
print("Please check your credentials")


def generate_certificate(df):

font = ImageFont.truetype("Caveat-Bold.ttf", 120)
for j in df["Name"]:
img = Image.open("certificate_template.png")
Expand Down
4 changes: 1 addition & 3 deletions Scripts/Miscellaneous/Connect4Game/connect4game.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

player_names = []


# adding players
def submit():
player_names.append(player_one.get())
Expand Down Expand Up @@ -136,7 +137,6 @@ def draw_board(board):


try:

root = Tk()
root.resizable(0, 0)
player_one = StringVar(master=root)
Expand All @@ -160,7 +160,6 @@ def draw_board(board):
root.mainloop()

if player_names[0] != "" and player_names[1] != "":

board = create_board()

game_over = False
Expand All @@ -184,7 +183,6 @@ def draw_board(board):
myfont = pygame.font.SysFont("monospace", 30)

while not game_over:

for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
Expand Down
3 changes: 0 additions & 3 deletions Scripts/Miscellaneous/Disk_Usage_Stats/disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


def get_size(path):

total = 0
for entry in os.scandir(path):
try:
Expand All @@ -24,7 +23,6 @@ def get_size(path):


if __name__ == "__main__":

# if you're running this in linux, change the default path to "/home"
# also run the code as "sudo python3 Disk_usage.py" or "sudo ./Disk_usage.py"
# i.e, with super user permissions
Expand All @@ -38,7 +36,6 @@ def get_size(path):

for entry in os.scandir(directory):
if entry.is_dir(follow_symlinks=False):

print(entry.path + " is a directory.")
print(get_size(entry.path))
total = get_size(entry.path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def chooseFile():

# function that contacts convertAPI with the file & carries out the conversion
def convertToPDF():

global CHOSEN_FILE_LOC
global CHOSEN_FILE_NAME

Expand Down Expand Up @@ -86,7 +85,6 @@ def convertToPDF():

# first tkinter window of the code
def window1():

# define the labels, input box and buttons
label = Label(
main_frame, text="Step 1: Sign up at ConvertApi to get your secret key"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


def face_extraction(frame):

"""Detect faces in a frame and extract them"""

faces = cascade_model.detectMultiScale(frame, 1.1, 5)
Expand All @@ -24,7 +23,6 @@ def face_extraction(frame):


def image_processing(frame):

"""Preprocessing of the image for predictions"""

frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
Expand All @@ -37,7 +35,6 @@ def image_processing(frame):


def detect_expressions(frame, detection_model):

"""Detect final expressions and return the predictions
done by the detection_model"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


def face_extraction(frame):

"""Detect faces in a frame and extract them"""

faces = cascade_model.detectMultiScale(frame, 1.1, 5)
Expand All @@ -24,7 +23,6 @@ def face_extraction(frame):


def image_processing(frame):

"""Preprocessing of the image for predictions"""

frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
Expand All @@ -37,7 +35,6 @@ def image_processing(frame):


def detect_expressions(frame, detection_model):

"""Detect final expressions and return the predictions
done by the detection_model"""

Expand All @@ -60,17 +57,14 @@ def detect_expressions(frame, detection_model):
cap = cv2.VideoCapture(0)

while cap.isOpened():

_, frame = cap.read()

try:

faces = cascade_model.detectMultiScale(
frame, 1.1, 5
) # Detect faces in a frame

for x, y, w, h in faces:

cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)

prediction = detect_expressions(frame, model)
Expand Down
1 change: 0 additions & 1 deletion Scripts/Miscellaneous/Fake_news_web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def home():

@app.route("/api", methods=["POST"])
def get_delay():

result = request.form
query_title = result["title"]
query_author = result["author"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
root.title("Password Generator - By Rohit")
root.geometry("1000x700")
root.wm_iconbitmap("pass.ico")


# Function to generate a password
def generate():
if passLen.get() == 0:
Expand Down
2 changes: 0 additions & 2 deletions Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def get_folder_links(folder_url):


def download_files(files_to_download):

for file in files_to_download:
print("\nfile - ", file)
filename = file.split("/")[
Expand Down Expand Up @@ -83,7 +82,6 @@ def recursive_folder_download(folder_links_received, file_hrefs_received):


if __name__ == "__main__":

os_platform = str(platform).lower()
if (
"linux" in os_platform
Expand Down
Loading