Skip to content

Commit 461597e

Browse files
Merge branch 'geekcomputers:master' into testing
2 parents d719073 + 08f67c8 commit 461597e

File tree

5 files changed

+164
-11
lines changed

5 files changed

+164
-11
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
numpy==1.26.1
1+
numpy==1.26.2
22
opencv_python==4.8.1.78
3-
mediapipe==0.10.7
3+
mediapipe==0.10.9

News_App/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
solara == 1.22.0
1+
solara == 1.25.0
22
Flask
33
gunicorn ==21.2.0
44
simple-websocket
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
1-
# Program to sort alphabetically the words form a string provided by the user
1+
# Program to sort words alphabetically and put them in a dictionary with corresponding numbered keys
2+
# We are also removing punctuation to ensure the desired output, without importing a library for assistance.
23

3-
my_str = "Hello this Is an Example With cased letters"
4+
# Declare base variables
5+
word_Dict = {}
6+
count = 0
7+
my_str = "Hello this Is an Example With cased letters. Hello, this is a good string"
8+
#Initialize punctuation
9+
punctuations = '''!()-[]{};:'",<>./?@#$%^&*_~'''
410

511
# To take input from the user
612
#my_str = input("Enter a string: ")
713

14+
# remove punctuation from the string and use an empty variable to put the alphabetic characters into
15+
no_punct = ""
16+
for char in my_str:
17+
if char not in punctuations:
18+
no_punct = no_punct + char
19+
20+
# Make all words in string lowercase. my_str now equals the original string without the punctuation
21+
my_str = no_punct.lower()
22+
823
# breakdown the string into a list of words
924
words = my_str.split()
1025

11-
# sort the list
26+
# sort the list and remove duplicate words
1227
words.sort()
1328

14-
# display the sorted words
15-
16-
print("The sorted words are:")
29+
new_Word_List = []
1730
for word in words:
18-
print(word)
31+
if word not in new_Word_List:
32+
new_Word_List.append(word)
33+
else:
34+
continue
35+
36+
# insert sorted words into dictionary with key
37+
38+
for word in new_Word_List:
39+
count+=1
40+
word_Dict[count] = word
41+
42+
print(word_Dict)

async_downloader/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
aiohttp==3.8.6
1+
aiohttp==3.9.0

file_ext_changer.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
'''' Multiple extension changer'''
2+
import time
3+
from pathlib import Path as p
4+
import random as rand
5+
import hashlib
6+
7+
8+
def chxten_(files, xten):
9+
chfile = []
10+
for file in files:
11+
ch_file = file.split('.')
12+
ch_file = ch_file[0]
13+
chfile.append(ch_file)
14+
if len(xten) == len(chfile):
15+
chxten = []
16+
for i in range(len(chfile)):
17+
ch_xten = chfile[i] + xten[i]
18+
chxten.append(ch_xten)
19+
elif len(xten) < len(chfile) and len(xten) != 1:
20+
chxten = []
21+
for i in range(len(xten)):
22+
ch_xten = chfile[i] + xten[i]
23+
chxten.append(ch_xten)
24+
for i in range(1, (len(chfile) + 1) - len(xten)):
25+
ch_xten = chfile[- + i] + xten[-1]
26+
chxten.append(ch_xten)
27+
elif len(xten) == 1:
28+
chxten = []
29+
for i in range(len(chfile)):
30+
ch_xten = chfile[i] + xten[0]
31+
chxten.append(ch_xten)
32+
elif len(xten) > len(chfile):
33+
chxten = []
34+
for i in range(1, (len(xten) + 1) - len(chfile)):
35+
f = p(files[-i])
36+
p.touch(chfile[-i] + xten[-1])
37+
new = f.read_bytes()
38+
p(chfile[-i] + xten[-1]).write_bytes(new)
39+
for i in range(len(chfile)):
40+
ch_xten = chfile[i] + xten[i]
41+
chxten.append(ch_xten)
42+
else:
43+
return 'an error occured'
44+
return chxten
45+
46+
47+
# End of function definitions
48+
# Beggining of execution of code
49+
#password
50+
password = input('Enter password:')
51+
52+
password = password.encode()
53+
54+
password = hashlib.sha512(password).hexdigest()
55+
if password == 'c99d3d8f321ff63c2f4aaec6f96f8df740efa2dc5f98fccdbbb503627fd69a9084073574ee4df2b888f9fe2ed90e29002c318be476bb62dabf8386a607db06c4':
56+
pass
57+
else:
58+
print('wrong password!')
59+
time.sleep(0.3)
60+
exit(404)
61+
files = input('Enter file names and thier extensions (seperated by commas):')
62+
xten = input('Enter Xtensions to change with (seperated by commas):')
63+
64+
if files == '*':
65+
pw = p.cwd()
66+
files = ''
67+
for i in pw.iterdir():
68+
if not p.is_dir(i):
69+
i = str(i)
70+
if not i.endswith('.py'):
71+
# if not i.endswith('exe'):
72+
if not i.endswith('.log'):
73+
files = files + i + ','
74+
if files == 'r':
75+
pw = p.cwd()
76+
files = ''
77+
filer = []
78+
for i in pw.iterdir():
79+
if p.is_file(i):
80+
i = str(i)
81+
if not i.endswith('.py'):
82+
if not i.endswith('.exe'):
83+
if not i.endswith('.log'):
84+
filer.append(i)
85+
for i in range(5):
86+
pos = rand.randint(0,len(filer))
87+
files = files + filer[pos] + ','
88+
89+
print(files)
90+
files = files.split(',')
91+
xten = xten.split(',')
92+
93+
# Validation
94+
for file in files:
95+
check = p(file).exists()
96+
if check == False:
97+
print(f'{file} is not found. Paste this file in the directory of {file}')
98+
files.remove(file)
99+
# Ended validation
100+
101+
count = len(files)
102+
chxten = chxten_(files, xten)
103+
104+
# Error Handlings
105+
if chxten == 'an error occured':
106+
print('Check your inputs correctly')
107+
time.sleep(1)
108+
exit(404)
109+
else:
110+
try:
111+
for i in range(len(files)):
112+
f = p(files[i])
113+
f.rename(chxten[i])
114+
print('All files has been changed')
115+
except PermissionError:
116+
pass
117+
except FileNotFoundError:
118+
# Validation
119+
for file in files:
120+
check = p(file).exists()
121+
if check == False:
122+
print(f'{file} is not found. Paste this file in the directory of {file}')
123+
files.remove(file)
124+
# except Exception:
125+
# print('An Error Has Occured in exception')
126+
# time.sleep(1)
127+
# exit(404)
128+
129+
# last modified 3:25PM 12/12/2023 (DD/MM/YYYY)

0 commit comments

Comments
 (0)