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

Commit 47fdee5

Browse files
authored
Merge pull request #657 from Python-World/feature/cleanup
chore: black applied across all files
2 parents f1095d8 + 78bc437 commit 47fdee5

File tree

55 files changed

+25
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+25
-85
lines changed

Scripts/API/Football-Standings/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131

3232
def print_standings(league_id):
33-
3433
league_code = league_id.get("code")
3534
resource = f"competitions/{league_code}/standings"
3635
api_url = API_URL + resource
@@ -72,7 +71,6 @@ def print_standings(league_id):
7271

7372
if __name__ == "__main__":
7473
try:
75-
7674
# If API key is not stored
7775
if API_KEY is None or API_KEY == "YOUR_KEY_HERE":
7876
print(

Scripts/API/GeoCode API/code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
adrs = []
1515
parms = {}
1616
for line in fh:
17-
1817
address = line.strip()
1918
parms["address"] = address
2019
parms["key"] = api_key
@@ -26,7 +25,6 @@
2625
raise ValueError from None
2726

2827
with urllib.request.urlopen(req) as resp:
29-
3028
data = resp.read().decode()
3129

3230
try:

Scripts/API/Google-Py Translator/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def greeting():
2121

2222

2323
def custom(src, dst):
24-
2524
sent = input("\nEnter your sentence : ")
2625

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

3231

3332
def from_file(src, dst):
34-
3533
name = input("\nEnter absolute path for file : ")
3634

3735
try:
@@ -69,7 +67,6 @@ def from_file(src, dst):
6967

7068

7169
def main():
72-
7370
prompt = """
7471
Available options :
7572
1. Custom text translation

Scripts/API/Random_Album_API/Random_Album_API/application.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"/v1/random-album/", view_func=RandomAlbumAPI.as_view("random-album")
1111
)
1212

13+
1314
# Exception Handler
1415
@app.errorhandler(APIException)
1516
def handle_invalid_usage(error):

Scripts/API/Random_Quote_Notification/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from plyer import notification
88
from apscheduler.schedulers.blocking import BlockingScheduler
99

10+
1011
# Sub-Routines
1112
def fetch(): # This gets the quote from the API and turns it into the quote to be displayed
1213
quoteSite = requests.get("http://api.quotable.io/random")

Scripts/API/Twitter-topic-modeling-and-sentiment-analysis/btm_model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66

77
def categorize(tweets_list, number_of_topics=3):
8-
98
# vectorize texts
109
vec = CountVectorizer(stop_words="english")
1110
X = vec.fit_transform(tweets_list).toarray()

Scripts/API/Twitter-topic-modeling-and-sentiment-analysis/text_cleaning.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def remove_stop_words(sentence):
1919

2020

2121
def clean_tweets(tweets):
22-
2322
# remove url
2423
no_url_tweets = [re.sub(r"http\S+", "", t) for t in tweets]
2524

Scripts/API/simple_api_requests/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import json
44

55
app = Flask(__name__)
6+
7+
68
# GET ALL API DATA
79
# http://127.0.0.1:8000/
810
@app.route("/")

Scripts/Bots/DiscordBot/bot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ async def ping(ctx):
158158
@client.event
159159
async def on_message(message):
160160
if message.content in cursewords:
161-
162161
await message.channel.purge(limit=1)
163162
await message.author.create_dm()
164163
await message.author.dm_channel.send(

Scripts/Bots/Slack-Bot/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
os.environ.get("SLACK_EVENTS_TOKEN"), "/slack/events", app
1212
)
1313

14+
1415
# When a 'message' event is detected by the events adapter, forward that payload
1516
# to this function.
1617
@slack_events_adapter.on("message")

Scripts/Bots/Telegram-bot/telegram_bot.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def client_authenticate(client, phone):
3838
# ask either to input token or otp sent to
3939
# number or sent or your telegram id
4040
if not client.is_user_authorized():
41-
4241
client.send_code_request(phone)
4342

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

4847
def messasge_send(client, user_id, user_hash):
4948
try:
50-
5149
receiver = InputPeerUser(user_id, user_hash)
5250

5351
# sending message using telegram client
5452
client.send_message(receiver, "Hello", parse_mode="html")
5553
except Exception as e:
56-
5754
# there may be many error coming in while like peer
5855
# error, wwrong access_hash, flood_error, etc
5956
print(e)

Scripts/Bots/Torrent-Search-Bot/bot.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
def get_quote(search):
10-
1110
data = pirate(search)
1211
name = data[0]["name"]
1312
if name == "No results returned":
@@ -33,7 +32,6 @@ def unknown(update, context):
3332
def quote(update, context):
3433
update.message.chat_id
3534
if update.message:
36-
3735
query = update.message.text
3836
context.bot.send_message(
3937
chat_id=update.effective_chat.id,

Scripts/Bots/Typing_Test_Bot/Typing_test_bot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self):
2323
time.sleep(2)
2424

2525
def take_test(self):
26-
2726
# Load textbox element
2827
while True:
2928
try:

Scripts/Bots/Zoom_Meetings_Bot/automate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# In this program all the text-fields, buttons, check-boxes are located using screenshots
55
# You can change the sleep-time as per the loading time of your pc
66

7+
78
# Method to host a new meeting with video off and audio off
89
def zoom_automate(meeting_id, meeting_passcode):
910
# Opens the zoom app

Scripts/Miscellaneous/Automatic Birthday Wisher/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
GMAIL_ID = "Your-Gmail-Id"
88
GMAIL_PWD = "Your-Gmail-Password"
99

10+
1011
# function for sending email
1112
def sendEmail(to, sub, msg):
1213
# conncection to gmail

Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515

1616
def mail(df, from_, password):
17-
1817
msg = em.Message()
1918
msg.add_header("Content-Type", "text/html")
2019

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

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

3533
for i, j in zip(to, name):
36-
3734
print("" + str(to_length) + " left \n")
3835
print("Sending to {}".format(j))
3936

@@ -75,13 +72,11 @@ def mail(df, from_, password):
7572
server.quit()
7673

7774
except:
78-
7975
print("Make sure have an active internet connection")
8076
print("Please check your credentials")
8177

8278

8379
def generate_certificate(df):
84-
8580
font = ImageFont.truetype("Caveat-Bold.ttf", 120)
8681
for j in df["Name"]:
8782
img = Image.open("certificate_template.png")

Scripts/Miscellaneous/Connect4Game/connect4game.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
player_names = []
1616

17+
1718
# adding players
1819
def submit():
1920
player_names.append(player_one.get())
@@ -136,7 +137,6 @@ def draw_board(board):
136137

137138

138139
try:
139-
140140
root = Tk()
141141
root.resizable(0, 0)
142142
player_one = StringVar(master=root)
@@ -160,7 +160,6 @@ def draw_board(board):
160160
root.mainloop()
161161

162162
if player_names[0] != "" and player_names[1] != "":
163-
164163
board = create_board()
165164

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

186185
while not game_over:
187-
188186
for event in pygame.event.get():
189187
if event.type == pygame.QUIT:
190188
sys.exit()

Scripts/Miscellaneous/Disk_Usage_Stats/disk_usage.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def get_size(path):
9-
109
total = 0
1110
for entry in os.scandir(path):
1211
try:
@@ -24,7 +23,6 @@ def get_size(path):
2423

2524

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

3937
for entry in os.scandir(directory):
4038
if entry.is_dir(follow_symlinks=False):
41-
4239
print(entry.path + " is a directory.")
4340
print(get_size(entry.path))
4441
total = get_size(entry.path)

Scripts/Miscellaneous/EPUB_MOBI_to_PDF_converter/ebookConverter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def chooseFile():
4949

5050
# function that contacts convertAPI with the file & carries out the conversion
5151
def convertToPDF():
52-
5352
global CHOSEN_FILE_LOC
5453
global CHOSEN_FILE_NAME
5554

@@ -86,7 +85,6 @@ def convertToPDF():
8685

8786
# first tkinter window of the code
8887
def window1():
89-
9088
# define the labels, input box and buttons
9189
label = Label(
9290
main_frame, text="Step 1: Sign up at ConvertApi to get your secret key"

Scripts/Miscellaneous/Facial Expressions Detection/detection_on_img.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
def face_extraction(frame):
15-
1615
"""Detect faces in a frame and extract them"""
1716

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

2524

2625
def image_processing(frame):
27-
2826
"""Preprocessing of the image for predictions"""
2927

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

3836

3937
def detect_expressions(frame, detection_model):
40-
4138
"""Detect final expressions and return the predictions
4239
done by the detection_model"""
4340

Scripts/Miscellaneous/Facial Expressions Detection/detection_on_vid.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
def face_extraction(frame):
15-
1615
"""Detect faces in a frame and extract them"""
1716

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

2524

2625
def image_processing(frame):
27-
2826
"""Preprocessing of the image for predictions"""
2927

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

3836

3937
def detect_expressions(frame, detection_model):
40-
4138
"""Detect final expressions and return the predictions
4239
done by the detection_model"""
4340

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

6259
while cap.isOpened():
63-
6460
_, frame = cap.read()
6561

6662
try:
67-
6863
faces = cascade_model.detectMultiScale(
6964
frame, 1.1, 5
7065
) # Detect faces in a frame
7166

7267
for x, y, w, h in faces:
73-
7468
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
7569

7670
prediction = detect_expressions(frame, model)

Scripts/Miscellaneous/Fake_news_web/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def home():
1515

1616
@app.route("/api", methods=["POST"])
1717
def get_delay():
18-
1918
result = request.form
2019
query_title = result["title"]
2120
query_author = result["author"]

Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
root.title("Password Generator - By Rohit")
77
root.geometry("1000x700")
88
root.wm_iconbitmap("pass.ico")
9+
10+
911
# Function to generate a password
1012
def generate():
1113
if passLen.get() == 0:

Scripts/Miscellaneous/Github-Folder-Download-Tool/gitfold.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def get_folder_links(folder_url):
2929

3030

3131
def download_files(files_to_download):
32-
3332
for file in files_to_download:
3433
print("\nfile - ", file)
3534
filename = file.split("/")[
@@ -83,7 +82,6 @@ def recursive_folder_download(folder_links_received, file_hrefs_received):
8382

8483

8584
if __name__ == "__main__":
86-
8785
os_platform = str(platform).lower()
8886
if (
8987
"linux" in os_platform

0 commit comments

Comments
 (0)