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 559dbf8

Browse files
Merge branch 'avinashkranjan:main' into main
2 parents 5347c2e + 65eaabf commit 559dbf8

File tree

6 files changed

+181
-33
lines changed

6 files changed

+181
-33
lines changed

‎Google-Meet-Scheduler/script.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
from googleapiclient.discovery import build
2-
from uuid import uuid4
32
from google.auth.transport.requests import Request
4-
from pathlib import Path
3+
from google.oauth2.credentials import Credentials
54
from google_auth_oauthlib.flow import InstalledAppFlow
5+
6+
from uuid import uuid4
67
from typing import Dict, List
7-
from pickle import load, dump
8+
import os
9+
10+
SCOPES = ["https://www.googleapis.com/auth/calendar"]
811

912

1013
class CreateMeet:
11-
def __init__(self, attendees: Dict[str, str], event_time: Dict[str, str], topic):
14+
def __init__(self, attendees: Dict[str, str],
15+
event_time: Dict[str, str], Topic):
1216
authe = self._auth()
13-
attendees = [{"email": e} for e in attendees.values()]
17+
attendees_list = [{"email": e} for e in attendees.values()]
1418
self.event_states = self._create_event(
15-
attendees, event_time, authe, topic)
19+
attendees_list, event_time, authe, Topic)
1620

1721
@staticmethod
18-
def _create_event(attendees: List[Dict[str, str]], event_time, authe: build, topic):
22+
def _create_event(
23+
attendees: List[Dict[str, str]], event_time, authe: build, TopiC):
1924
event = {"conferenceData": {"createRequest": {"requestId": f"{uuid4().hex}", "conferenceSolutionKey": {"type": "hangoutsMeet"}}},
2025
"attendees": attendees,
2126
"start": {"dateTime": event_time["start"], 'timeZone': 'Asia/Kolkata'},
2227
"end": {"dateTime": event_time["end"], 'timeZone': 'Asia/Kolkata'},
23-
"summary": topic,
28+
"summary": TopiC,
2429
"reminders": {"useDefault": True}
2530
}
2631
event = authe.events().insert(calendarId="primary", sendNotifications=True,
@@ -29,23 +34,24 @@ def _create_event(attendees: List[Dict[str, str]], event_time, authe: build, top
2934

3035
@staticmethod
3136
def _auth():
32-
token_file, scopes = Path(
33-
"./token.pickle"), ["https://www.googleapis.com/auth/calendar"]
34-
credentials = None
35-
if token_file.exists():
36-
with open(token_file, "rb") as token:
37-
credentials = load(token)
38-
if not credentials or not credentials.valid:
39-
if credentials and credentials.expired and credentials.refresh_token:
40-
credentials.refresh(Request())
37+
creds = None
38+
if os.path.exists("token.json"):
39+
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
40+
# If there are no (valid) credentials available, let the user log in.
41+
if not creds or not creds.valid:
42+
if creds and creds.expired and creds.refresh_token:
43+
creds.refresh(Request())
4144
else:
4245
flow = InstalledAppFlow.from_client_secrets_file(
43-
'credentials.json', scopes)
44-
credentials = flow.run_local_server(port=0)
45-
with open(token_file, "wb") as token:
46-
dump(credentials, token)
47-
calendar_service = build("calendar", "v3", credentials=credentials)
48-
return calendar_service
46+
"credentials.json", SCOPES
47+
)
48+
creds = flow.run_local_server(port=0)
49+
# Save the credentials for the next run
50+
with open("token.json", "w") as token:
51+
token.write(creds.to_json())
52+
53+
service = build("calendar", "v3", credentials=creds)
54+
return service
4955

5056

5157
print('------------------------------')
@@ -60,9 +66,10 @@ def _auth():
6066
emails = list(
6167
input('Enter the emails of guests separated by 1 space each : ').strip().split())
6268
topic = input('Enter the topic of the meeting : ')
69+
6370
time = {
64-
'start': date+'T'+start+':00.000000',
65-
'end': date+'T'+end+':00.000000'
71+
'start': date+'T'+start+':00.000000',
72+
'end': date+'T'+end+':00.000000'
6673
}
6774
guests = {email: email for email in emails}
6875
meet = CreateMeet(guests, time, topic)
@@ -72,4 +79,4 @@ def _auth():
7279
print('-- Meeting Details --')
7380
print('---------------------')
7481
for key in keys:
75-
print(key+' : ', details[key])
82+
print(key+' : ', details[key])

‎Movie recommendation system/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ click==8.1.5
88
colorama==0.4.6
99
decorator==5.1.1
1010
gitdb==4.0.10
11-
GitPython==3.1.35
11+
GitPython==3.1.41
1212
idna==3.4
1313
importlib-metadata==6.8.0
14-
Jinja2==3.1.2
14+
Jinja2==3.1.3
1515
jsonschema==4.18.3
1616
jsonschema-specifications==2023年6月1日
1717
markdown-it-py==3.0.0
@@ -35,7 +35,7 @@ rich==13.4.2
3535
rpds-py==0.8.10
3636
six==1.16.0
3737
smmap==5.0.0
38-
streamlit==1.24.1
38+
streamlit==1.30.0
3939
tenacity==8.2.2
4040
toml==0.10.2
4141
toolz==0.12.0

‎Rename-Multiple-Files/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
### [English](#EN)
2+
3+
### [Russian](#RU)
4+
5+
# EN
6+
7+
### Script for rename multiple files
8+
9+
Tested in Python version 3.11.2, but it must working in version 3.5 and above.
10+
11+
### Run
12+
13+
GNU\Linux: `$(which python3) main.py`
14+
15+
Windows: `C:\\Path\\to\\Python3\\Python3.exe main.py`
16+
17+
Folders structure:
18+
19+
```
20+
main.py
21+
root/
22+
|
23+
|--- folder1
24+
| |
25+
| |- file1.txt
26+
| |- file2.txt
27+
| |- file2.txt
28+
|
29+
|--- folder2
30+
| |
31+
| |- file1.txt
32+
| |- file2.txt
33+
| |- file2.txt
34+
|
35+
|--- folder3
36+
| |
37+
| |- file1.txt
38+
| |- file2.txt
39+
| |- file2.txt
40+
```
41+
42+
Output files structure:
43+
44+
```
45+
folder1/folder1-1.txt
46+
folder1/folder1-2.txt
47+
folder1/folder1-3.txt
48+
49+
folder2/folder2-1.txt
50+
folder2/folder2-2.txt
51+
folder2/folder2-3.txt
52+
53+
folder3/folder3-1.txt
54+
folder3/folder3-2.txt
55+
folder3/folder3-3.txt
56+
```
57+
58+
Maybe set outher symbol for `DESTINATION_FILE_DELIMITER` param or just leave blank `DESTINATION_FILE_DELIMITER = ''`
59+
60+
# RU
61+
62+
### Скрипт для переименования большого количества файлов
63+
64+
Тестировался на Python версии 3.11.2, но должен работать на версиях выше 3.5.
65+
66+
### Запуск
67+
68+
GNU\Linux: `$(which python3) main.py`
69+
70+
Windows: `C:\\Path\\to\\Python3\\Python3.exe main.py`
71+
72+
Структура папок:
73+
74+
```
75+
main.py
76+
root/
77+
|
78+
|--- папка1
79+
| |
80+
| |- файл1.txt
81+
| |- файл2.txt
82+
| |- файл2.txt
83+
|
84+
|--- папка2
85+
| |
86+
| |- файл1.txt
87+
| |- файл2.txt
88+
| |- файл2.txt
89+
|
90+
|--- папка3
91+
| |
92+
| |- файл1.txt
93+
| |- файл2.txt
94+
| |- файл2.txt
95+
```
96+
97+
Скрипт переименует файлы в папках так:
98+
99+
```
100+
папка1/папка1-1.txt
101+
папка1/папка1-2.txt
102+
папка1/папка1-3.txt
103+
104+
папка2/папка2-1.txt
105+
папка2/папка2-2.txt
106+
папка2/папка2-3.txt
107+
108+
папка3/папка3-1.txt
109+
папка3/папка3-2.txt
110+
папка3/папка3-3.txt
111+
```
112+
113+
В случае необходимости можно поменять `DESTINATION_FILE_DELIMITER` на нужный символ или вообще оставить пустым `DESTINATION_FILE_DELIMITER = ''`

‎Rename-Multiple-Files/main.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
import platform
3+
4+
5+
ROOT_DIR = os.getcwd() + '/root'
6+
PATH_DELIMITER = ''
7+
DESTINATION_FILE_DELIMITER = '-'
8+
COUNTER = 0
9+
10+
11+
if (platform.system() == 'Linux') or (platform.system() == 'Darwin'):
12+
PATH_DELIMITER = '/'
13+
elif (platform.system() == 'Windows'):
14+
PATH_DELIMITER = '\\'
15+
16+
for current_dir in os.listdir(ROOT_DIR):
17+
subdir = ROOT_DIR + PATH_DELIMITER + current_dir
18+
if os.path.isdir(subdir):
19+
print('Now working with: "' + subdir + '" directory')
20+
COUNTER = 0
21+
for current_file in os.listdir(subdir):
22+
COUNTER += 1
23+
current_file_full_path = subdir + PATH_DELIMITER + current_file
24+
renamed_file_full_path = subdir + PATH_DELIMITER + current_dir + DESTINATION_FILE_DELIMITER + str(COUNTER) + '.' + current_file.split('.')[-1]
25+
try:
26+
os.rename(current_file_full_path, renamed_file_full_path)
27+
except Exception as e:
28+
print('Error occurred because: ' + e)

‎Resume_parser/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ fsspec==202360
3333
future==0.18.3
3434
gensim==4.3.1
3535
gitdb==4.0.10
36-
GitPython==3.1.34
36+
GitPython==3.1.41
3737
greenlet==2.0.2
3838
h11==0.14.0
3939
huggingface-hub==0.15.1
4040
idna==3.4
4141
importlib-metadata==6.7.0
4242
jieba3k==0.35.1
43-
Jinja2==3.1.2
43+
Jinja2==3.1.3
4444
joblib==1.2.0
4545
jsonschema==4.17.3
4646
langcodes==3.3.0
@@ -104,7 +104,7 @@ spacy-legacy==3.0.12
104104
spacy-loggers==1.0.4
105105
sqlparse==0.4.4
106106
srsly==2.4.6
107-
streamlit==1.23.1
107+
streamlit==1.30.0
108108
sumy==0.11.0
109109
tenacity==8.2.2
110110
thinc==8.1.9

‎Traffic-Sign-Detection/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ipython==7.31.1
3131
ipython-genutils==0.2.0
3232
ipywidgets==7.6.3
3333
jedi==0.18.0
34-
Jinja2==2.11.2
34+
Jinja2==3.1.3
3535
joblib==1.2.0
3636
jsonschema==3.2.0
3737
jupyter==1.0.0

0 commit comments

Comments
(0)

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