Skip to content

Commit d3226e2

Browse files
committed
Enforced PEP-8 guidelines across the codebase
1 parent 34a6980 commit d3226e2

File tree

67 files changed

+799
-479
lines changed

Some content is hidden

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

67 files changed

+799
-479
lines changed

Python/Amazon_Price_Tracker/price_tracker.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ def send_mail(URL, sender_email, password, recievers_email, Price):
2222
subject = 'Price fell down!'
2323
body = 'Check the amazon link ' + URL
2424
msg = f"Subject: {subject}\n\n{body}"
25-
server.sendmail(
26-
sender_email,
27-
recievers_email,
28-
msg
29-
)
25+
server.sendmail(sender_email, recievers_email, msg)
3026

3127
print('email has been sent')
3228
server.quit()
@@ -44,7 +40,7 @@ def information(soup, URL, sender_email, password, recievers_email, Price):
4440
# using regex to convert into float so we can compare with expected price
4541
#
4642
print("Price you expect\t:\t", Price)
47-
if(float(price) < float(Price)):
43+
if (float(price) < float(Price)):
4844
print("YEAH price has fallen!! email will be sent")
4945
send_mail(URL, sender_email, password, recievers_email, Price)
5046
else:
@@ -55,12 +51,14 @@ def entry():
5551
# URL = "https://www.amazon.in/ASUS-i9-10980HK-Graphics-Windows-G532LWS-HF079T/dp/B08HX42DGG/ref=sr_1_1?crid=MM0GWK65DAA4&dchild=1&keywords=asus+rog+32gb+ram+laptop&qid=1609939236&sprefix=rog+32gb+ram+%2Caps%2C494&sr=8-1"
5652

5753
URL = input("[+] paste the url of the amazon product\t>>\t").strip()
58-
Headers = input("\n[+]just type --my user agent -- in your browser and paste the result \nexampe\n'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36\t>>\t").strip()
59-
headers = {
60-
"User-Agent": Headers}
54+
Headers = input(
55+
"\n[+]just type --my user agent -- in your browser and paste the result \nexampe\n'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36\t>>\t"
56+
).strip()
57+
headers = {"User-Agent": Headers}
6158
Price1 = input("[+] price you expect\t>>\t").strip()
6259
sender_email = input(
63-
"\n[+] An email will be sent from this account(enable allow secured apps on your account)\t>>\t").strip()
60+
"\n[+] An email will be sent from this account(enable allow secured apps on your account)\t>>\t"
61+
).strip()
6462
password = input("\n[+] your password\t>>\t").strip()
6563
recievers_email = input(
6664
"\n[+] email will be recievedd on this account\t>>\t").strip()
@@ -69,9 +67,11 @@ def entry():
6967
soup = BeautifulSoup(page.content, 'html.parser')
7068
Price = Price1.replace(',', '').replace(' ', '').strip()
7169

72-
# print(soup.prettify)
70+
# print(soup.prettify)
7371
try:
74-
print("# enable --allow less secured apps-- on your gmail if you want to recieve a email")
72+
print(
73+
"# enable --allow less secured apps-- on your gmail if you want to recieve a email"
74+
)
7575
information(soup, URL, sender_email, password, recievers_email, Price)
7676
except AttributeError:
7777
print("product info not found")

Python/AnimeTracker/Tracker.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def nextdate(name):
1313
next_episode = next_episode.replace('"', "")
1414
next_episode = next_episode.replace("status", "")
1515
next_episode = next_episode.replace("/div><", "")
16-
next_episode = next_episode.replace(
17-
"class=><a href=/sear", "Show not Found")
16+
next_episode = next_episode.replace("class=><a href=/sear",
17+
"Show not Found")
1818
if (next_episode == None):
19-
check = soup.find('div', {'class': 'countdown'}).find(
20-
'div', {"class": "status"})
19+
check = soup.find('div', {
20+
'class': 'countdown'
21+
}).find('div', {"class": "status"})
2122
check_status = check.getText()
2223
return check_status
2324
else:
@@ -28,23 +29,24 @@ def nextdate(name):
2829

2930
def function():
3031
value = nextdate(e.get().lower())
31-
mylabel = Label(frame, text=e.get()+" "+value)
32+
mylabel = Label(frame, text=e.get() + " " + value)
3233
mylabel.pack()
33-
messagebox.showinfo("Next airing date: "+e.get(), value)
34+
messagebox.showinfo("Next airing date: " + e.get(), value)
3435

3536

3637
value = ""
3738
root = Tk()
3839
root.title("Next Episodate")
39-
frame = LabelFrame(
40-
root, text="Find your TV Show/anime next Episode Date:", padx=5, pady=5)
40+
frame = LabelFrame(root,
41+
text="Find your TV Show/anime next Episode Date:",
42+
padx=5,
43+
pady=5)
4144
frame.pack(padx=10, pady=10)
4245
e = Entry(frame, width=25)
4346
e.pack()
4447
b = Button(frame, text="search", command=function)
4548
b.pack()
4649
root.mainloop()
4750

48-
4951
#*********************** Made By: Abhijeet ************************ #
5052
#*************** https://github.com/abhijeet007rocks8 ****************#

Python/Bulk-EmailSender/sendMail.py

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

1515
# input...........
1616
SenderAddress = input("your email : ").strip()
17-
print("\nplease allow 'enable less secured apps ' option on this account to send emails\n")
17+
print(
18+
"\nplease allow 'enable less secured apps ' option on this account to send emails\n"
19+
)
1820
password = input("your password : ").strip()
1921
# ...........
2022

@@ -26,23 +28,23 @@
2628
try:
2729
server.login(SenderAddress, password)
2830
except smtplib.SMTPAuthenticationError:
29-
print("\n[+]Username or password not accepted or not enabled less secured apps on the above Mail account \n")
30-
31+
print(
32+
"\n[+]Username or password not accepted or not enabled less secured apps on the above Mail account \n"
33+
)
3134

3235
subject = "Hi there"
3336

3437
# reading subject from msg.txt....
3538

3639
a_file = open("msg.txt")
37-
lines = a_file. readlines()
40+
lines = a_file.readlines()
3841

3942
msg = ""
4043
for line in lines:
41-
msg = msg+line
42-
a_file. close()
44+
msg = msg + line
45+
a_file.close()
4346
# ..........
4447

45-
4648
body = "Subject: {}\n\n{}".format(subject, msg)
4749
# ........send mail.....
4850

Python/Caesar-Cipher/script.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
def encrypt(s): # Function for encrypting the text
1010
print('\n[#] Encrypted text output :', end=' ')
1111
for x in s: # Repeating the loop for each character in the string
12-
if x.isalpha(): # Check if the chracter is an alphabet (irrespective of the case)
12+
if x.isalpha(
13+
): # Check if the chracter is an alphabet (irrespective of the case)
1314
# If True, then process the ASCII value of the shifted character
1415
var = ord(x)
1516
var += n
@@ -29,7 +30,8 @@ def encrypt(s): # Function for encrypting the text
2930
def decrypt(s): # Function for decrypting the text
3031
print('\n[#] Decrypted text output :', end=' ')
3132
for x in s: # Repeating the loop for each character in the string
32-
if x.isalpha(): # Check if the chracter is an alphabet (irrespective of the case)
33+
if x.isalpha(
34+
): # Check if the chracter is an alphabet (irrespective of the case)
3335
# If True, then process the ASCII value of the shifted character
3436
var = ord(x)
3537
var -= n
@@ -67,7 +69,9 @@ def decrypt(s): # Function for decrypting the text
6769
n = int(input('[+] Enter offset : '))
6870
# Shift should be in the range of [-26,26]
6971
if n >= 26 or n <= -26:
70-
print('[!] Invalid Input. Enter a number between -25 to 25\n')
72+
print(
73+
'[!] Invalid Input. Enter a number between -25 to 25\n'
74+
)
7175
else:
7276
encrypt(text) # Calling the encryption function
7377

@@ -82,7 +86,9 @@ def decrypt(s): # Function for decrypting the text
8286
n = int(input('[+] Enter offset : '))
8387
# Shift should be in the range of [-26,26]
8488
if n >= 26 or n <= -26:
85-
print('[!] Invalid Input. Enter a number between -25 to 25\n')
89+
print(
90+
'[!] Invalid Input. Enter a number between -25 to 25\n'
91+
)
8692
else:
8793
decrypt(text) # Calling the decryption function
8894

@@ -92,7 +98,8 @@ def decrypt(s): # Function for decrypting the text
9298
else:
9399
print('[!] Invalid choice.\n')
94100

95-
except (EOFError, KeyboardInterrupt): # If the user presses Ctrl+C (keyboard interruption)
101+
except (EOFError, KeyboardInterrupt
102+
): # If the user presses Ctrl+C (keyboard interruption)
96103
print('\n[!] Exiting...') # Exit the loop
97104
break
98105

Python/Calculate-distance/distance_proj/settings.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1717
BASE_DIR = Path(__file__).resolve().parent.parent
1818

19-
2019
# Quick-start development settings - unsuitable for production
2120
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
2221

@@ -28,7 +27,6 @@
2827

2928
ALLOWED_HOSTS = []
3029

31-
3230
# Application definition
3331

3432
INSTALLED_APPS = [
@@ -72,7 +70,6 @@
7270

7371
WSGI_APPLICATION = 'distance_proj.wsgi.application'
7472

75-
7673
# Database
7774
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
7875

@@ -83,27 +80,30 @@
8380
}
8481
}
8582

86-
8783
# Password validation
8884
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
8985

9086
AUTH_PASSWORD_VALIDATORS = [
9187
{
92-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
88+
'NAME':
89+
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
9390
},
9491
{
95-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
92+
'NAME':
93+
'django.contrib.auth.password_validation.MinimumLengthValidator',
9694
},
9795
{
98-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
96+
'NAME':
97+
'django.contrib.auth.password_validation.CommonPasswordValidator',
9998
},
10099
{
101-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100+
'NAME':
101+
'django.contrib.auth.password_validation.NumericPasswordValidator',
102102
},
103103
]
104104

105-
CRISPY_ALLOWED_TEMPLATE_PACKS = (
106-
'bootstrap', 'uni_form', 'bootstrap3', 'foundation-5')
105+
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3',
106+
'foundation-5')
107107
# CRISPY_TEMPLATE_PACK='bootstap4'
108108

109109
# Internationalization

Python/Calculate-distance/manage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ def main():
1212
raise ImportError(
1313
"Couldn't import Django. Are you sure it's installed and "
1414
"available on your PYTHONPATH environment variable? Did you "
15-
"forget to activate a virtual environment?"
16-
) from exc
15+
"forget to activate a virtual environment?") from exc
1716
execute_from_command_line(sys.argv)
1817

1918

Python/Calculate-distance/measurements/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
class MeasurementModelForm(forms.ModelForm):
66
class Meta:
77
model = Measurement
8-
fields = ('destination',)
8+
fields = ('destination', )

Python/Calculate-distance/measurements/migrations/0001_initial.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ class Migration(migrations.Migration):
77

88
initial = True
99

10-
dependencies = [
11-
]
10+
dependencies = []
1211

1312
operations = [
1413
migrations.CreateModel(
1514
name='Measurement',
1615
fields=[
17-
('id', models.AutoField(auto_created=True,
18-
primary_key=True, serialize=False, verbose_name='ID')),
16+
('id',
17+
models.AutoField(auto_created=True,
18+
primary_key=True,
19+
serialize=False,
20+
verbose_name='ID')),
1921
('location', models.CharField(max_length=200)),
2022
('destination', models.CharField(max_length=200)),
21-
('distance', models.DecimalField(decimal_places=2, max_digits=10)),
23+
('distance',
24+
models.DecimalField(decimal_places=2, max_digits=10)),
2225
('created', models.DateTimeField(auto_now_add=True)),
2326
],
2427
),

Python/Calculate-distance/measurements/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_geo(ip):
2323
def get_center_coordinates(latA, longA, latB=None, longB=None):
2424
cord = (latA, longA)
2525
if latB:
26-
cord = [(latA+latB)/2, (longA+longB)/2]
26+
cord = [(latA + latB) / 2, (longA + longB) / 2]
2727
return cord
2828

2929

Python/Calculate-distance/measurements/views.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ def calculate_distance_view(request):
2727
pointA = (l_lat, l_lon)
2828

2929
# initial folium map
30-
m = folium.Map(width=800, height=500,
31-
location=get_center_coordinates(l_lat, l_lon), zoom_start=8)
30+
m = folium.Map(width=800,
31+
height=500,
32+
location=get_center_coordinates(l_lat, l_lon),
33+
zoom_start=8)
3234
# location marker
33-
folium.Marker([l_lat, l_lon], tooltip='click here for more', popup=city['city'],
35+
folium.Marker([l_lat, l_lon],
36+
tooltip='click here for more',
37+
popup=city['city'],
3438
icon=folium.Icon(color='purple', icon='home')).add_to(m)
3539
# destination marker)).add_to(m)
3640

@@ -47,18 +51,26 @@ def calculate_distance_view(request):
4751
distance = round(geodesic(pointA, pointB).km, 2)
4852

4953
# folium map modification
50-
m = folium.Map(width=800, height=500, location=get_center_coordinates(
51-
l_lat, l_lon, d_lat, d_lon), zoom_start=get_zoom(distance))
54+
m = folium.Map(width=800,
55+
height=500,
56+
location=get_center_coordinates(l_lat, l_lon, d_lat,
57+
d_lon),
58+
zoom_start=get_zoom(distance))
5259
# location marker
53-
folium.Marker([l_lat, l_lon], tooltip='click here for more', popup=city['city'],
60+
folium.Marker([l_lat, l_lon],
61+
tooltip='click here for more',
62+
popup=city['city'],
5463
icon=folium.Icon(color='purple', icon='home')).add_to(m)
5564
# destination marker
56-
folium.Marker([d_lat, d_lon], tooltip='click here for more', popup=destination,
65+
folium.Marker([d_lat, d_lon],
66+
tooltip='click here for more',
67+
popup=destination,
5768
icon=folium.Icon(color='red', icon='cloud')).add_to(m)
5869

5970
# draw the line between location and destination
60-
line = folium.PolyLine(
61-
locations=[pointA, pointB], weight=5, color='blue')
71+
line = folium.PolyLine(locations=[pointA, pointB],
72+
weight=5,
73+
color='blue')
6274
m.add_child(line)
6375

6476
instance.location = location

Python/Certificate_Generator/certificate.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import cv2
32
import os
43

@@ -80,7 +79,5 @@
8079

8180
cv2.destroyAllWindows()
8281

83-
print(
84-
'''Ceritificate Generation Completed.
85-
Find your generated certificates in ''' + output_directory_path[2::]
86-
)
82+
print('''Ceritificate Generation Completed.
83+
Find your generated certificates in ''' + output_directory_path[2::])

Python/Chrome Dinosaur Automation/ChromeDinoGame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import pyautogui
32
from PIL import Image, ImageGrab
43
import time

Python/Colortoblack/color.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
originalImage = cv2.imread(path)
44
grayImage = cv2.cvtColor(originalImage, cv2.COLOR_BGR2GRAY)
55

6-
(thresh, blackAndWhiteImage) = cv2.threshold(
7-
grayImage, 127, 255, cv2.THRESH_BINARY)
6+
(thresh, blackAndWhiteImage) = cv2.threshold(grayImage, 127, 255,
7+
cv2.THRESH_BINARY)
88

99
cv2.imshow('Black white image', blackAndWhiteImage)
1010
cv2.imshow('Original image', originalImage)

0 commit comments

Comments
 (0)