Skip to content

Commit 8015222

Browse files
I am formatting your Python code with black and adding type hints with pytype.
1 parent b98e531 commit 8015222

File tree

775 files changed

+45671
-9767
lines changed

Some content is hidden

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

775 files changed

+45671
-9767
lines changed
Lines changed: 42 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
import turtle as t
2-
'''Author: Rajarshi Banerjee | GSAUC3'''
2+
3+
"""Author: Rajarshi Banerjee | GSAUC3"""
4+
5+
36
class logo:
47

5-
def __init__(i,t) -> None:
6-
i.t=t
8+
def __init__(i, t) -> None:
9+
i.t = t
710

811
def blue_part(i):
912
i.t.penup()
10-
11-
# d = 200
12-
# x = 10
13-
i.t.pencolor('blue')
14-
i.t.color('blue')
15-
i.t.goto(-110,-100)
13+
14+
# d = 200
15+
# x = 10
16+
i.t.pencolor("blue")
17+
i.t.color("blue")
18+
i.t.goto(-110, -100)
1619
i.t.pendown()
1720
i.t.begin_fill()
1821
i.t.right(180)
19-
i.t.forward(100/3)
22+
i.t.forward(100 / 3)
2023

2124
for _ in range(5):
2225
i.t.right(15)
@@ -30,15 +33,13 @@ def blue_part(i):
3033
for _ in range(5):
3134
i.t.right(15)
3235
i.t.forward(15)
33-
34-
35-
36-
i.t.goto(0,100)
37-
i.t.goto(0,110)
38-
i.t.goto(-100,110)
39-
i.t.goto(-100,110+100/3)
36+
37+
i.t.goto(0, 100)
38+
i.t.goto(0, 110)
39+
i.t.goto(-100, 110)
40+
i.t.goto(-100, 110 + 100 / 3)
4041
i.t.left(90)
41-
42+
4243
for _ in range(5):
4344
i.t.right(15)
4445
i.t.forward(15)
@@ -52,35 +53,33 @@ def blue_part(i):
5253
i.t.right(15)
5354
i.t.forward(15)
5455

55-
i.t.forward(60+10)
56-
56+
i.t.forward(60 + 10)
5757

5858
for _ in range(5):
5959
i.t.right(15)
6060
i.t.forward(15)
6161

6262
i.t.right(5)
63-
i.t.goto(-100+30,10)
63+
i.t.goto(-100 + 30, 10)
6464

65-
6665
for _ in range(5):
6766
i.t.left(15)
6867
i.t.forward(15)
6968
i.t.left(5)
7069

71-
i.t.goto(-110,-100)
70+
i.t.goto(-110, -100)
7271
i.t.end_fill()
7372

7473
def yellow_part(i):
7574
i.t.penup()
76-
i.t.pencolor('yellow')
77-
i.t.color('yellow')
78-
i.t.goto(110,100)
75+
i.t.pencolor("yellow")
76+
i.t.color("yellow")
77+
i.t.goto(110, 100)
7978
i.t.right(90)
8079
i.t.pendown()
8180
i.t.begin_fill()
8281
i.t.right(180)
83-
i.t.forward(100/3)
82+
i.t.forward(100 / 3)
8483

8584
for _ in range(5):
8685
i.t.right(15)
@@ -94,15 +93,13 @@ def yellow_part(i):
9493
for _ in range(5):
9594
i.t.right(15)
9695
i.t.forward(15)
97-
98-
99-
100-
i.t.goto(0,-100)
101-
i.t.goto(0,-110)
102-
i.t.goto(100,-110)
103-
i.t.goto(100,-110-100/3)
96+
97+
i.t.goto(0, -100)
98+
i.t.goto(0, -110)
99+
i.t.goto(100, -110)
100+
i.t.goto(100, -110 - 100 / 3)
104101
i.t.left(90)
105-
102+
106103
for _ in range(5):
107104
i.t.right(15)
108105
i.t.forward(15)
@@ -116,52 +113,47 @@ def yellow_part(i):
116113
i.t.right(15)
117114
i.t.forward(15)
118115

119-
i.t.forward(60+10)
120-
116+
i.t.forward(60 + 10)
121117

122118
for _ in range(5):
123119
i.t.right(15)
124120
i.t.forward(15)
125121

126122
i.t.right(5)
127-
i.t.goto(70,-10)
123+
i.t.goto(70, -10)
128124

129-
130125
for _ in range(5):
131126
i.t.left(15)
132127
i.t.forward(15)
133128
i.t.left(5)
134129

135-
i.t.goto(110,100)
130+
i.t.goto(110, 100)
136131
i.t.end_fill()
137-
138-
132+
139133
def eyes(i):
140134
i.t.penup()
141-
i.t.color('white')
142-
i.t.goto(-70,130)
135+
i.t.color("white")
136+
i.t.goto(-70, 130)
143137
i.t.pendown()
144138
i.t.begin_fill()
145139
i.t.circle(10)
146140
i.t.end_fill()
147141

148142
i.t.penup()
149-
i.t.color('white')
150-
i.t.goto(70+20,-130)
143+
i.t.color("white")
144+
i.t.goto(70 + 20, -130)
151145
i.t.pendown()
152146
i.t.begin_fill()
153147
i.t.circle(10)
154148
i.t.end_fill()
155149

156150
i.t.hideturtle()
157-
158151

159152

160-
if __name__ =="__main__":
153+
if __name__ == "__main__":
161154
t.Turtle()
162-
obj=logo(t)
155+
obj = logo(t)
163156
obj.blue_part()
164157
obj.yellow_part()
165158
obj.eyes()
166159
t.done()
167-

ART SCRIPTS/Images to PDF/images-to-pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#a script that converts images to pdf
1+
# a script that converts images to pdf
22

33
from reportlab.platypus import Image, SimpleDocTemplate
44

ART SCRIPTS/image-ascii/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import pywhatkit
2-
pywhatkit.image_to_ascii_art(
3-
'flo.jpg', 'flo.text')
2+
3+
pywhatkit.image_to_ascii_art("flo.jpg", "flo.text")

ART SCRIPTS/pencilSketch/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import cv2
22

3-
#reading image
3+
# reading image
44
image = cv2.imread("res/girl3.jpg")
55

6-
#converting BGR image to grayscale
7-
#cvtColor -> https://docs.opencv.org/3.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab
6+
# converting BGR image to grayscale
7+
# cvtColor -> https://docs.opencv.org/3.4/d8/d01/group__imgproc__color__conversions.html#ga397ae87e1288a81d2363b61574eb8cab
88
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
99

10-
#image invert
10+
# image invert
1111
inverted_image = 255 - gray_image
1212

13-
#blurring image
14-
#GaussianBlur -> https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1
13+
# blurring image
14+
# GaussianBlur -> https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#gaabe8c836e97159a9193fb0b11ac52cf1
1515
blurred_image = cv2.GaussianBlur(gray_image, (43, 43), 0)
1616
pencil_sketch = cv2.divide(gray_image, blurred_image, scale=250.0)
1717

1818
cv2.imshow("Original Image", image)
1919
cv2.imshow("Pencil Sketch", pencil_sketch)
20-
cv2.waitKey(0)
20+
cv2.waitKey(0)
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from captcha.audio import AudioCaptcha
22
from random import randint
3+
34
audio = AudioCaptcha()
4-
num = randint(100000,999999)
5+
num = randint(100000, 999999)
56
data = audio.generate(str(num))
6-
audio.write(str(num), str(num)+'.mp3')
7-
print(num)
7+
audio.write(str(num), str(num) + ".mp3")
8+
print(num)

AUDIO RELATED SCRIPTS/AudioBuk/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
text = page.extractText()
1313
speak = pyttsx3.init()
1414
speak.say(text)
15-
speak.runAndWait()
15+
speak.runAndWait()
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,58 @@
11
from bs4 import BeautifulSoup
22
import requests
33

4-
5-
import webbrowser
6-
74

5+
import webbrowser
86

97

108
booklinks = []
119
booktitles = []
1210

11+
1312
def findfromgoldenaudiobooks(bookname):
1413
URL = "https://goldenaudiobooks.com/?s="
1514
r = requests.get(URL + bookname)
16-
soup = BeautifulSoup(r.content, 'html5lib')
17-
booklist = soup.findAll('h2', attrs = {'class':'entry-title'})
15+
soup = BeautifulSoup(r.content, "html5lib")
16+
booklist = soup.findAll("h2", attrs={"class": "entry-title"})
1817

1918
for book in booklist:
20-
booklinks.append(book.a['href'])
19+
booklinks.append(book.a["href"])
2120
booktitles.append(book.a.text)
2221

22+
2323
def findfromfindaudiobooks(bookname):
2424
URL = "https://findaudiobook.com/?s="
2525
r = requests.get(URL + bookname)
26-
soup = BeautifulSoup(r.content, 'html5lib')
27-
booklist = soup.findAll('h2', attrs = {'class':'entry-title post-title'})
26+
soup = BeautifulSoup(r.content, "html5lib")
27+
booklist = soup.findAll("h2", attrs={"class": "entry-title post-title"})
2828

2929
for book in booklist:
30-
booklinks.append(book.a['href'])
30+
booklinks.append(book.a["href"])
3131
booktitles.append(book.a.text)
32-
32+
33+
3334
def findfromfullengthaudiobooks(bookname):
3435
URL = "https://fulllengthaudiobooks.com/?s="
3536
r = requests.get(URL + bookname)
36-
soup = BeautifulSoup(r.content, 'html5lib')
37-
booklist = soup.findAll('h2', attrs = {'class':'entry-title post-title'})
37+
soup = BeautifulSoup(r.content, "html5lib")
38+
booklist = soup.findAll("h2", attrs={"class": "entry-title post-title"})
3839

3940
for book in booklist:
40-
booklinks.append(book.a['href'])
41+
booklinks.append(book.a["href"])
4142
booktitles.append(book.a.text)
4243

4344

4445
def findfrom101audiobooks(bookname):
4546
URL = "https://101audiobooks.net/?s="
4647
r = requests.get(URL + bookname)
47-
soup = BeautifulSoup(r.content, 'html5lib')
48-
booklist = soup.findAll('h2', attrs = {'class':'entry-title'})
48+
soup = BeautifulSoup(r.content, "html5lib")
49+
booklist = soup.findAll("h2", attrs={"class": "entry-title"})
4950

5051
for book in booklist:
51-
booklinks.append(book.a['href'])
52+
booklinks.append(book.a["href"])
5253
booktitles.append(book.a.text)
5354

55+
5456
search = input("search for a book ")
5557

5658
findfromgoldenaudiobooks(search)
@@ -59,10 +61,8 @@ def findfrom101audiobooks(bookname):
5961
findfrom101audiobooks(search)
6062

6163
for x in range(1, len(booktitles) + 1):
62-
print(str(x) + ": " + booktitles[x-1])
64+
print(str(x) + ": " + booktitles[x - 1])
6365

6466
booknum = int(input("select a book number "))
6567
print("opening " + str(booklinks[booknum - 1]))
6668
webbrowser.open(str(booklinks[booknum - 1]), new=2)
67-
68-
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from gtts import gTTS
22
from playsound import playsound
33

4-
audio='speech.mp3'
4+
audio = "speech.mp3"
55
playsound(audio)
6-
lang='en'
7-
text="hELLO, OPEN SOURCE!"
8-
sp=gTTS(text=text,lang=lang,slow=False)
6+
lang = "en"
7+
text = "hELLO, OPEN SOURCE!"
8+
sp = gTTS(text=text, lang=lang, slow=False)
99
sp.save(audio)

AUTOMATION/AutoMoveFiles/AutoMoveFiles.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
import os
88
import json
99

10+
1011
class Handler(FileSystemEventHandler):
11-
def on_modified(self, event):
12+
def on_modified(self, event) -> None:
1213
for file in os.listdir(watched_folder):
1314
src = f"{watched_folder}/{file}"
1415
dst = f"{destination_folder}/{file}"
1516
os.rename(src=src, dst=dst)
1617

17-
if __name__=="__main__":
18+
19+
if __name__ == "__main__":
1820
watched_folder = input("Paste the path to the folder to be tracked: ")
1921
destination_folder = input("Paste the path to the destination folder: ")
2022
handler = Handler()
@@ -27,4 +29,3 @@ def on_modified(self, event):
2729
except KeyboardInterrupt:
2830
observer.stop()
2931
observer.join()
30-

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy