Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 743ad7b

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 9ba8bac according to the output from Autopep8. Details: https://app.deepsource.com/gh/avinashkranjan/Amazing-Python-Scripts/transform/4d390bc4-407f-470f-8d11-c3519be94a4e/
1 parent 225b071 commit 743ad7b

File tree

357 files changed

+7203
-5941
lines changed

Some content is hidden

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

357 files changed

+7203
-5941
lines changed

‎9_Typesof_Hash_Craker/9_Types_of_Hash_Cracker.py

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@ class Cracker(object):
1515
ALPHA_MIXED = (string.ascii_lowercase, string.ascii_uppercase)
1616
PUNCTUATION = (string.punctuation,)
1717
NUMERIC = (''.join(map(str, range(0, 10))),)
18-
ALPHA_LOWER_NUMERIC = (string.ascii_lowercase, ''.join(map(str, range(0, 10))))
19-
ALPHA_UPPER_NUMERIC = (string.ascii_uppercase, ''.join(map(str, range(0, 10))))
20-
ALPHA_MIXED_NUMERIC = (string.ascii_lowercase, string.ascii_uppercase, ''.join(map(str, range(0, 10))))
18+
ALPHA_LOWER_NUMERIC = (string.ascii_lowercase,
19+
''.join(map(str, range(0, 10))))
20+
ALPHA_UPPER_NUMERIC = (string.ascii_uppercase,
21+
''.join(map(str, range(0, 10))))
22+
ALPHA_MIXED_NUMERIC = (
23+
string.ascii_lowercase, string.ascii_uppercase, ''.join(map(str, range(0, 10))))
2124
ALPHA_LOWER_PUNCTUATION = (string.ascii_lowercase, string.punctuation)
2225
ALPHA_UPPER_PUNCTUATION = (string.ascii_uppercase, string.punctuation)
23-
ALPHA_MIXED_PUNCTUATION = (string.ascii_lowercase, string.ascii_uppercase, string.punctuation)
26+
ALPHA_MIXED_PUNCTUATION = (
27+
string.ascii_lowercase, string.ascii_uppercase, string.punctuation)
2428
NUMERIC_PUNCTUATION = (''.join(map(str, range(0, 10))), string.punctuation)
25-
ALPHA_LOWER_NUMERIC_PUNCTUATION = (string.ascii_lowercase, ''.join(map(str, range(0, 10))), string.punctuation)
26-
ALPHA_UPPER_NUMERIC_PUNCTUATION = (string.ascii_uppercase, ''.join(map(str, range(0, 10))), string.punctuation)
29+
ALPHA_LOWER_NUMERIC_PUNCTUATION = (string.ascii_lowercase, ''.join(
30+
map(str, range(0, 10))), string.punctuation)
31+
ALPHA_UPPER_NUMERIC_PUNCTUATION = (string.ascii_uppercase, ''.join(
32+
map(str, range(0, 10))), string.punctuation)
2733
ALPHA_MIXED_NUMERIC_PUNCTUATION = (
28-
string.ascii_lowercase, string.ascii_uppercase, ''.join(map(str, range(0, 10))), string.punctuation
34+
string.ascii_lowercase, string.ascii_uppercase, ''.join(
35+
map(str, range(0, 10))), string.punctuation
2936
)
3037

3138
def __init__(self, hash_type, hash, charset, progress_interval):
@@ -90,7 +97,8 @@ def __attack(self, q, max_length):
9097
hasher.update(hash_fn(value))
9198
if self.__hash == hasher.hexdigest():
9299
q.put("FOUND")
93-
q.put("{}Match found! Password is {}{}".format(os.linesep, value, os.linesep))
100+
q.put("{}Match found! Password is {}{}".format(
101+
os.linesep, value, os.linesep))
94102
self.stop_reporting_progress()
95103
return
96104

@@ -110,7 +118,8 @@ def work(work_q, done_q, max_length):
110118
obj.__attack(done_q, max_length)
111119

112120
def start_reporting_progress(self):
113-
self.__progress_timer = threading.Timer(self.__progress_interval, self.start_reporting_progress)
121+
self.__progress_timer = threading.Timer(
122+
self.__progress_interval, self.start_reporting_progress)
114123
self.__progress_timer.start()
115124
print(
116125
f"Character set: {self.__charset}, iteration: {self.__curr_iter}, trying: {self.__curr_val}, hashes/sec: {self.__curr_iter - self.__prev_iter}",
@@ -119,7 +128,8 @@ def start_reporting_progress(self):
119128

120129
def stop_reporting_progress(self):
121130
self.__progress_timer.cancel()
122-
print(f"Finished character set {self.__charset} after {self.__curr_iter} iterations", flush=True)
131+
print(
132+
f"Finished character set {self.__charset} after {self.__curr_iter} iterations", flush=True)
123133

124134

125135
if __name__ == "__main__":
@@ -153,7 +163,8 @@ def stop_reporting_progress(self):
153163
"09": "SHA512"
154164
}
155165

156-
prompt = "Specify the character set to use:{}{}".format(os.linesep, os.linesep)
166+
prompt = "Specify the character set to use:{}{}".format(
167+
os.linesep, os.linesep)
157168
for key, value in sorted(character_sets.items()):
158169
prompt += "{}. {}{}".format(key, ''.join(value), os.linesep)
159170

@@ -162,12 +173,14 @@ def stop_reporting_progress(self):
162173
charset = input(prompt).zfill(2)
163174
selected_charset = character_sets[charset]
164175
except KeyError:
165-
print("{}Please select a valid character set{}".format(os.linesep, os.linesep))
176+
print("{}Please select a valid character set{}".format(
177+
os.linesep, os.linesep))
166178
continue
167179
else:
168180
break
169181

170-
prompt = "{}Specify the maximum possible length of the password: ".format(os.linesep)
182+
prompt = "{}Specify the maximum possible length of the password: ".format(
183+
os.linesep)
171184

172185
while True:
173186
try:
@@ -197,7 +210,8 @@ def stop_reporting_progress(self):
197210
try:
198211
user_hash = input(prompt)
199212
except ValueError:
200-
print("{}Something is wrong with the format of the hash. Please enter a valid hash".format(os.linesep))
213+
print("{}Something is wrong with the format of the hash. Please enter a valid hash".format(
214+
os.linesep))
201215
continue
202216
else:
203217
break
@@ -207,7 +221,8 @@ def stop_reporting_progress(self):
207221
work_queue = multiprocessing.Queue()
208222
done_queue = multiprocessing.Queue()
209223
progress_interval = 3
210-
cracker = Cracker(hash_type.lower(), user_hash.lower(), ''.join(selected_charset), progress_interval)
224+
cracker = Cracker(hash_type.lower(), user_hash.lower(),
225+
''.join(selected_charset), progress_interval)
211226
start_time = time.time()
212227
p = multiprocessing.Process(target=Cracker.work,
213228
args=(work_queue, done_queue, password_length))
@@ -218,7 +233,8 @@ def stop_reporting_progress(self):
218233
if len(selected_charset) > 1:
219234
for i in range(len(selected_charset)):
220235
progress_interval += .2
221-
cracker = Cracker(hash_type.lower(), user_hash.lower(), selected_charset[i], progress_interval)
236+
cracker = Cracker(hash_type.lower(), user_hash.lower(),
237+
selected_charset[i], progress_interval)
222238
p = multiprocessing.Process(target=Cracker.work,
223239
args=(work_queue, done_queue, password_length))
224240
processes.append(p)
@@ -241,4 +257,4 @@ def stop_reporting_progress(self):
241257
print("{}No matches found{}".format(os.linesep, os.linesep))
242258
break
243259

244-
print("Took {} seconds".format(time.time() - start_time))
260+
print("Took {} seconds".format(time.time() - start_time))

‎AI Calculator/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
# naming the ChatBot calculator
44
# using mathematical evaluation logic
55
# the calculator AI will not learn with the user input
6-
Bot = ChatBot(name='Calculator',
7-
read_only=True,
8-
logic_adapters=["chatterbot.logic.MathematicalEvaluation"],
9-
storage_adapter="chatterbot.storage.SQLStorageAdapter")
10-
6+
Bot = ChatBot(name='Calculator',
7+
read_only=True,
8+
logic_adapters=["chatterbot.logic.MathematicalEvaluation"],
9+
storage_adapter="chatterbot.storage.SQLStorageAdapter")
10+
1111

1212
# clear the screen and start the calculator
1313
print('033円c')
1414
print("Hello, I am a calculator. How may I help you?")
1515
while (True):
1616
# take the input from the user
1717
user_input = input("me: ")
18-
19-
# check if the user has typed quit to exit the prgram
18+
19+
# check if the user has typed quit to exit the prgram
2020
if user_input.lower() == 'quit':
2121
print("Exiting")
2222
break

‎AI Chat Bot/main.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,49 @@
99

1010

1111
headers = {
12-
"content-type": "application/json",
13-
"X-RapidAPI-Key": "OUR API KEY",
14-
"X-RapidAPI-Host": "simple-chatgpt-api.p.rapidapi.com"
12+
"content-type": "application/json",
13+
"X-RapidAPI-Key": "OUR API KEY",
14+
"X-RapidAPI-Host": "simple-chatgpt-api.p.rapidapi.com"
1515
}
1616

17+
1718
def animate():
1819
for c in itertools.cycle(['|', '/', '-', '\\']):
1920
if done:
2021
break
2122
sys.stdout.write('\r' + c)
2223
sys.stdout.flush()
2324
time.sleep(0.1)
24-
25+
2526
# Clear the console output
2627
sys.stdout.write('\r')
2728
sys.stdout.flush()
2829

30+
2931
def ask(question):
30-
payload = {"question": question}
32+
payload = {"question": question}
3133
response = requests.post(url, json=payload, headers=headers)
3234
return response.json().get("answer")
3335

36+
3437
if __name__ == "__main__":
3538
print(pyfiglet.figlet_format("AI Chat BOT"))
3639
print("Enter the question to ask:")
3740
print()
3841
while True:
3942
# print("/>> ", end="")
4043
question = str(input(">> "))
41-
if(question == 'q'):
44+
if(question == 'q'):
4245
print(">> Bye! Thanks for Using...")
4346
break
4447
# loading
4548
done = False
46-
#here is the animation
49+
#here is the animation
4750
t = threading.Thread(target=animate)
4851
t.start()
4952
answer = ask(question)
5053
time.sleep(5)
5154
done = True
5255
t.join()
53-
print(">> ",answer)
56+
print(">> ",answer)
5457
print()
55-

‎AI TicTacToe/src/TicTacToe.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22

3+
34
def display_board(board):
45
print('-------------')
56
print('| ' + board[7] + ' | ' + board[8] + ' | ' + board[9] + ' |')
@@ -110,5 +111,6 @@ def play_tic_tac_toe():
110111
print('Thank you for playing.')
111112
break
112113

114+
113115
# Start the game
114116
play_tic_tac_toe()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /