diff --git a/AI Calculator/README.md b/AI Calculator/README.md new file mode 100644 index 0000000000..5dbb6b98dc --- /dev/null +++ b/AI Calculator/README.md @@ -0,0 +1,31 @@ +**User Guide: AI Calculator** + +This user guide provides step-by-step instructions on how to use the AI Calculator script in the Amazing-Python-Scripts repository. This script uses the ChatterBot library to create a calculator chatbot that can evaluate mathematical expressions. + +**Step 1: Install Dependencies** +Before you can use the AI Calculator script, you need to make sure that you have all the necessary dependencies installed. This script requires Python 3 and the ChatterBot library. To install these dependencies, open a terminal or command prompt and run the following command: +``` +pip install chatterbot +``` + +**Step 2: Download the Script** +Next, you need to download the AI Calculator script from the Amazing-Python-Scripts repository. You can do this by visiting the repository on GitHub and navigating to the `AI Calculator` directory. From there, you can download the `main.py` file to your computer. + +**Step 3: Run the Script** +Once you have downloaded the script, you can run it by opening a terminal or command prompt, navigating to the directory where you saved the file, and running the following command: +``` +python main.py +``` +This will start the script and open a command-line interface where you can interact with the calculator chatbot. + +**Step 4: Use the Calculator** +To use the AI Calculator, simply type a mathematical expression at the prompt and press enter. The calculator chatbot will evaluate the expression and return the result. For example: +``` +me: 2 + 2 +Calculator: 4 +``` +You can enter any valid mathematical expression, including addition, subtraction, multiplication, division, and exponentiation. The calculator chatbot will evaluate the expression and return the result. + +To exit the calculator, simply type `quit` at the prompt and press enter. + +You can experiment with different expressions to see how they are evaluated by the calculator chatbot. 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/Air pollution prediction/README.md b/Air pollution prediction/README.md index 173d848ed5..263e61f520 100644 --- a/Air pollution prediction/README.md +++ b/Air pollution prediction/README.md @@ -1,26 +1,31 @@ -# Air pollution Prediction -_______________________________________________________________________ -## What is it? -This helps you find the levels of Air pollution plotted graphically with a provided dataset. +**User Guide: Air Pollution Prediction** -## TechStack +This user guide provides step-by-step instructions on how to use the Air Pollution Prediction script in the Amazing-Python-Scripts repository. This script uses data from the World Air Quality Index API to predict air pollution levels in a given city. -1. Module used: +**Step 1: Install Dependencies** +Before you can use the Air Pollution Prediction script, you need to make sure that you have all the necessary dependencies installed. This script requires Python 3 and the requests and matplotlib libraries. To install these dependencies, open a terminal or command prompt and run the following command: +``` +pip install requests matplotlib +``` - - matplotlib +**Step 2: Obtain an API Key** +To use the World Air Quality Index API, you will need to obtain an API key. You can do this by visiting the following website and following the instructions to create an account and obtain an API key: https://aqicn.org/data-platform/token/ -## How to use? +**Step 3: Download the Script** +Next, you need to download the Air Pollution Prediction script from the Amazing-Python-Scripts repository. You can do this by visiting the repository on GitHub and navigating to the `Air pollution prediction` directory. From there, you can download the `CodeAP.py` file to your computer. -You can clone the repository directly from +**Step 4: Run the Script** +Once you have downloaded the script and obtained an API key, you can run it by opening a terminal or command prompt, navigating to the directory where you saved the file, and running the following command: +``` +python CodeAP.py +``` +This will start the script and prompt you to enter your city name and API key. -```https://github.com/Pranjal-2001/Amazing-Python-Scripts.git``` +**Step 5: View the Results** +After entering your city name and API key, the script will retrieve air pollution data from the World Air Quality Index API and display it in a pie chart. The chart shows the relative amounts of different pollutants in the air, such as PM2.5, PM10, NO2, SO2, and O3. -## To get your API - - -[Click here to get your API](https://waqi.info/) +You can use this information to get an idea of air pollution levels in your city and take appropriate precautions. - -[Click here to get your API key](https://aqicn.org/data-platform/token/#/) +You can experiment with different cities to see how their air pollution levels compare. diff --git a/Automated_scraper.py/readme.md b/Automated_scraper.py/readme.md index c6521e2043..cb6c0f6f5a 100644 --- a/Automated_scraper.py/readme.md +++ b/Automated_scraper.py/readme.md @@ -1,6 +1,31 @@ -The users can run the script -Usage: python script.py [URL] "[CSS selector]" [Interval in minutes] +**User Guide: Automated Scraper** -Example : python script.py https://www.timeanddate.com/worldclock/ "body> div.main-content-div> section.bg--grey.pdflexi-t--small> div> div:nth-child(2)> div.my-city__clocks> div> div:nth-child(3)> span> span" 1 +This user guide provides step-by-step instructions on how to use the Automated Scraper script in the Amazing-Python-Scripts repository. This script uses the BeautifulSoup library to scrape data from a website and monitor it for changes. -If there is a change in content it will be displayed in the command line. \ No newline at end of file +**Step 1: Install Dependencies** +Before you can use the Automated Scraper script, you need to make sure that you have all the necessary dependencies installed. This script requires Python 3 and the BeautifulSoup and requests libraries. To install these dependencies, open a terminal or command prompt and run the following command: +``` +pip install beautifulsoup4 requests +``` + +**Step 2: Download the Script** +Next, you need to download the Automated Scraper script from the Amazing-Python-Scripts repository. You can do this by visiting the repository on GitHub and navigating to the `Automated_scraper.py` directory. From there, you can download the `script.py` file to your computer. + +**Step 3: Run the Script** +Once you have downloaded the script, you can run it by opening a terminal or command prompt, navigating to the directory where you saved the file, and running the following command: +``` +python script.py [URL] [CSS selector] [Interval in minutes] +``` +Replace `[URL]` with the URL of the website you want to scrape, `[CSS selector]` with a CSS selector that matches the content you want to monitor, and `[Interval in minutes]` with the number of minutes between each check for changes. + +For example, to scrape data from a website and check for changes every 5 minutes, you would run the following command: +``` +python script.py https://example.com "h1" 5 +``` + +**Step 4: Monitor for Changes** +After running the script, it will scrape data from the specified website and display it in the terminal. The script will then continue to check for changes at the specified interval and display a message if any changes are detected. + +You can stop monitoring for changes at any time by pressing `Ctrl + C` in the terminal. + +You can experiment with different URLs, CSS selectors, and intervals to see how they affect the results. 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 a37ca09f15..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.32 +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,11 +35,11 @@ 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 -tornado==6.3.2 +tornado==6.3.3 typing_extensions==4.7.1 tzdata==2023.3 tzlocal==4.3.1 diff --git a/Movie-Info-Telegram-Bot/requirements.txt b/Movie-Info-Telegram-Bot/requirements.txt index e0aff658af..e552fba9c0 100644 --- a/Movie-Info-Telegram-Bot/requirements.txt +++ b/Movie-Info-Telegram-Bot/requirements.txt @@ -8,5 +8,5 @@ pytz==2020.4 requests==2.31.0 six==1.15.0 soupsieve==2.1 -tornado==6.3.2 +tornado==6.3.3 urllib3==1.26.2 diff --git a/Quiz_Game/Readme.md b/Quiz_Game/Readme.md index fdf8fdd550..dacf8c804f 100644 --- a/Quiz_Game/Readme.md +++ b/Quiz_Game/Readme.md @@ -1,19 +1,17 @@ # Quiz Game -This project is to create an Quiz Game using python in which the user can answer the question and view there score using list data-structure and functions. - -List for storing the data and functions for defining there logic of game playing. +This project is to create a Quiz Game using Python in which the user can answer the questions and view their scores. Quiz_Game make use of a list data structure for data storage and functions for implementing logic. ## Usage * Copy the code to your system. -* Run the code on python terminal and enjoy the game. +* Run the code on the Python terminal and enjoy the game. ## Output -User can view there score in the end and can also play the game again. +Users can view their score at the end and can also replay the game. ScreenShot[https://i.postimg.cc/Kj6gNbM1/Select-C-Windows-py-exe-18-07-2023-23-03-08.png] 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 89ec210c72..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.31 +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 @@ -115,7 +115,7 @@ tldextract==3.4.4 tokenizers==0.13.3 toml==0.10.2 toolz==0.12.0 -tornado==6.3.2 +tornado==6.3.3 tqdm==4.65.0 transformers==4.30.2 trio==0.22.0 diff --git a/Sentiment Analyser/requirements.txt b/Sentiment Analyser/requirements.txt index 1594590b4c..63d29f6d3f 100644 --- a/Sentiment Analyser/requirements.txt +++ b/Sentiment Analyser/requirements.txt @@ -65,7 +65,7 @@ tensorflow-estimator==2.12.0 tensorflow-intel==2.12.0rc1 tensorflow-io-gcs-filesystem==0.31.0 termcolor==2.2.0 -tornado==6.3.2 +tornado==6.3.3 traitlets==5.9.0 typing_extensions==4.5.0 urllib3==1.26.15 diff --git a/Traffic-Sign-Detection/requirements.txt b/Traffic-Sign-Detection/requirements.txt index 7742191189..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 @@ -112,7 +112,7 @@ terminado==0.9.2 testpath==0.4.4 threadpoolctl==2.1.0 tifffile==2021年2月1日 -tornado==6.3.2 +tornado==6.3.3 tqdm==4.56.0 traitlets==5.0.5 typing-extensions==3.7.4.3

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