diff --git a/AI Calculator/main.py b/AI Calculator/main.py index 206ccbac54..caa1779510 100644 --- a/AI Calculator/main.py +++ b/AI Calculator/main.py @@ -1,5 +1,5 @@ from chatterbot import ChatBot - +import os # naming the ChatBot calculator # using mathematical evaluation logic # the calculator AI will not learn with the user input @@ -10,7 +10,7 @@ # clear the screen and start the calculator -print('033円c') +os.system('cls' if os.name == 'nt' else 'clear') print("Hello, I am a calculator. How may I help you?") while (True): # take the input from the user diff --git a/Google-Meet-Scheduler/script.py b/Google-Meet-Scheduler/script.py index 8f0c137bf3..ef29557f0a 100644 --- a/Google-Meet-Scheduler/script.py +++ b/Google-Meet-Scheduler/script.py @@ -1,26 +1,31 @@ from googleapiclient.discovery import build -from uuid import uuid4 from google.auth.transport.requests import Request -from pathlib import Path +from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow + +from uuid import uuid4 from typing import Dict, List -from pickle import load, dump +import os + +SCOPES = ["https://www.googleapis.com/auth/calendar"] class CreateMeet: - def __init__(self, attendees: Dict[str, str], event_time: Dict[str, str], topic): + def __init__(self, attendees: Dict[str, str], + event_time: Dict[str, str], Topic): authe = self._auth() - attendees = [{"email": e} for e in attendees.values()] + attendees_list = [{"email": e} for e in attendees.values()] self.event_states = self._create_event( - attendees, event_time, authe, topic) + attendees_list, event_time, authe, Topic) @staticmethod - def _create_event(attendees: List[Dict[str, str]], event_time, authe: build, topic): + def _create_event( + attendees: List[Dict[str, str]], event_time, authe: build, TopiC): event = {"conferenceData": {"createRequest": {"requestId": f"{uuid4().hex}", "conferenceSolutionKey": {"type": "hangoutsMeet"}}}, "attendees": attendees, "start": {"dateTime": event_time["start"], 'timeZone': 'Asia/Kolkata'}, "end": {"dateTime": event_time["end"], 'timeZone': 'Asia/Kolkata'}, - "summary": topic, + "summary": TopiC, "reminders": {"useDefault": True} } 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 @staticmethod def _auth(): - token_file, scopes = Path( - "./token.pickle"), ["https://www.googleapis.com/auth/calendar"] - credentials = None - if token_file.exists(): - with open(token_file, "rb") as token: - credentials = load(token) - if not credentials or not credentials.valid: - if credentials and credentials.expired and credentials.refresh_token: - credentials.refresh(Request()) + creds = None + if os.path.exists("token.json"): + creds = Credentials.from_authorized_user_file("token.json", SCOPES) + # If there are no (valid) credentials available, let the user log in. + if not creds or not creds.valid: + if creds and creds.expired and creds.refresh_token: + creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( - 'credentials.json', scopes) - credentials = flow.run_local_server(port=0) - with open(token_file, "wb") as token: - dump(credentials, token) - calendar_service = build("calendar", "v3", credentials=credentials) - return calendar_service + "credentials.json", SCOPES + ) + creds = flow.run_local_server(port=0) + # Save the credentials for the next run + with open("token.json", "w") as token: + token.write(creds.to_json()) + + service = build("calendar", "v3", credentials=creds) + return service print('------------------------------') @@ -60,9 +66,10 @@ def _auth(): emails = list( input('Enter the emails of guests separated by 1 space each : ').strip().split()) topic = input('Enter the topic of the meeting : ') + time = { - 'start': date+'T'+start+':00.000000', - 'end': date+'T'+end+':00.000000' + 'start': date + 'T' + start + ':00.000000', + 'end': date + 'T' + end + ':00.000000' } guests = {email: email for email in emails} meet = CreateMeet(guests, time, topic) @@ -72,4 +79,4 @@ def _auth(): print('-- Meeting Details --') print('---------------------') for key in keys: - print(key+' : ', details[key]) + print(key + ' : ', details[key]) diff --git a/Lyrics Finder /script.py b/Lyrics_Finder/script.py similarity index 100% rename from Lyrics Finder /script.py rename to Lyrics_Finder/script.py diff --git a/Movie recommendation system/requirements.txt b/Movie recommendation system/requirements.txt index 7c84c7a567..95a8c083df 100644 --- a/Movie recommendation system/requirements.txt +++ b/Movie recommendation system/requirements.txt @@ -8,10 +8,10 @@ click==8.1.5 colorama==0.4.6 decorator==5.1.1 gitdb==4.0.10 -GitPython==3.1.35 +GitPython==3.1.41 idna==3.4 importlib-metadata==6.8.0 -Jinja2==3.1.2 +Jinja2==3.1.3 jsonschema==4.18.3 jsonschema-specifications==2023年6月1日 markdown-it-py==3.0.0 @@ -35,7 +35,7 @@ rich==13.4.2 rpds-py==0.8.10 six==1.16.0 smmap==5.0.0 -streamlit==1.24.1 +streamlit==1.30.0 tenacity==8.2.2 toml==0.10.2 toolz==0.12.0 diff --git a/Rename-Multiple-Files/README.md b/Rename-Multiple-Files/README.md new file mode 100644 index 0000000000..26981ebb4e --- /dev/null +++ b/Rename-Multiple-Files/README.md @@ -0,0 +1,113 @@ +### [English](#EN) + +### [Russian](#RU) + +# EN + +### Script for rename multiple files + +Tested in Python version 3.11.2, but it must working in version 3.5 and above. + +### Run + +GNU\Linux: `$(which python3) main.py` + +Windows: `C:\\Path\\to\\Python3\\Python3.exe main.py` + +Folders structure: + +``` +main.py +root/ + | + |--- folder1 + | | + | |- file1.txt + | |- file2.txt + | |- file2.txt + | + |--- folder2 + | | + | |- file1.txt + | |- file2.txt + | |- file2.txt + | + |--- folder3 + | | + | |- file1.txt + | |- file2.txt + | |- file2.txt +``` + +Output files structure: + +``` +folder1/folder1-1.txt +folder1/folder1-2.txt +folder1/folder1-3.txt + +folder2/folder2-1.txt +folder2/folder2-2.txt +folder2/folder2-3.txt + +folder3/folder3-1.txt +folder3/folder3-2.txt +folder3/folder3-3.txt +``` + +Maybe set outher symbol for `DESTINATION_FILE_DELIMITER` param or just leave blank `DESTINATION_FILE_DELIMITER = ''` + +# RU + +### Скрипт для переименования большого количества файлов + +Тестировался на Python версии 3.11.2, но должен работать на версиях выше 3.5. + +### Запуск + +GNU\Linux: `$(which python3) main.py` + +Windows: `C:\\Path\\to\\Python3\\Python3.exe main.py` + +Структура папок: + +``` +main.py +root/ + | + |--- папка1 + | | + | |- файл1.txt + | |- файл2.txt + | |- файл2.txt + | + |--- папка2 + | | + | |- файл1.txt + | |- файл2.txt + | |- файл2.txt + | + |--- папка3 + | | + | |- файл1.txt + | |- файл2.txt + | |- файл2.txt +``` + +Скрипт переименует файлы в папках так: + +``` +папка1/папка1-1.txt +папка1/папка1-2.txt +папка1/папка1-3.txt + +папка2/папка2-1.txt +папка2/папка2-2.txt +папка2/папка2-3.txt + +папка3/папка3-1.txt +папка3/папка3-2.txt +папка3/папка3-3.txt +``` + +В случае необходимости можно поменять `DESTINATION_FILE_DELIMITER` на нужный символ или вообще оставить пустым `DESTINATION_FILE_DELIMITER = ''` diff --git a/Rename-Multiple-Files/main.py b/Rename-Multiple-Files/main.py new file mode 100644 index 0000000000..7ee20cd690 --- /dev/null +++ b/Rename-Multiple-Files/main.py @@ -0,0 +1,28 @@ +import os +import platform + + +ROOT_DIR = os.getcwd() + '/root' +PATH_DELIMITER = '' +DESTINATION_FILE_DELIMITER = '-' +COUNTER = 0 + + +if (platform.system() == 'Linux') or (platform.system() == 'Darwin'): + PATH_DELIMITER = '/' +elif (platform.system() == 'Windows'): + PATH_DELIMITER = '\\' + +for current_dir in os.listdir(ROOT_DIR): + subdir = ROOT_DIR + PATH_DELIMITER + current_dir + if os.path.isdir(subdir): + print('Now working with: "' + subdir + '" directory') + COUNTER = 0 + for current_file in os.listdir(subdir): + COUNTER += 1 + current_file_full_path = subdir + PATH_DELIMITER + current_file + renamed_file_full_path = subdir + PATH_DELIMITER + current_dir + DESTINATION_FILE_DELIMITER + str(COUNTER) + '.' + current_file.split('.')[-1] + try: + os.rename(current_file_full_path, renamed_file_full_path) + except Exception as e: + print('Error occurred because: ' + e) diff --git a/Resume_parser/requirements.txt b/Resume_parser/requirements.txt index 51ba4c63a6..23139dbc95 100644 --- a/Resume_parser/requirements.txt +++ b/Resume_parser/requirements.txt @@ -33,14 +33,14 @@ fsspec==202360 future==0.18.3 gensim==4.3.1 gitdb==4.0.10 -GitPython==3.1.34 +GitPython==3.1.41 greenlet==2.0.2 h11==0.14.0 huggingface-hub==0.15.1 idna==3.4 importlib-metadata==6.7.0 jieba3k==0.35.1 -Jinja2==3.1.2 +Jinja2==3.1.3 joblib==1.2.0 jsonschema==4.17.3 langcodes==3.3.0 @@ -104,7 +104,7 @@ spacy-legacy==3.0.12 spacy-loggers==1.0.4 sqlparse==0.4.4 srsly==2.4.6 -streamlit==1.23.1 +streamlit==1.30.0 sumy==0.11.0 tenacity==8.2.2 thinc==8.1.9 diff --git a/Traffic-Sign-Detection/requirements.txt b/Traffic-Sign-Detection/requirements.txt index 01e29f2379..464e78b6bf 100644 --- a/Traffic-Sign-Detection/requirements.txt +++ b/Traffic-Sign-Detection/requirements.txt @@ -31,7 +31,7 @@ ipython==7.31.1 ipython-genutils==0.2.0 ipywidgets==7.6.3 jedi==0.18.0 -Jinja2==2.11.2 +Jinja2==3.1.3 joblib==1.2.0 jsonschema==3.2.0 jupyter==1.0.0

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