Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #659 from Python-World/feature/cleanup
Browse files Browse the repository at this point in the history
Feature/cleanup
  • Loading branch information
AdityaJ7 authored Oct 3, 2023
2 parents 9aef440 + c0297f9 commit 8fa3cea
Show file tree
Hide file tree
Showing 131 changed files with 321 additions and 231 deletions.
6 changes: 0 additions & 6 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,3 @@ pull_request_rules:
actions:
merge:
method: merge
- name: automatic merge for deepsorce-autofix pull requests
conditions:
- author=deepsource-autofix[bot]
actions:
merge:
method: merge
2 changes: 1 addition & 1 deletion Scripts/API/Football Standings/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import requests
import sys

import requests
from dotenv import load_dotenv

load_dotenv()
Expand Down
6 changes: 4 additions & 2 deletions Scripts/API/GeoCode API/code.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import urllib.request, urllib.parse, urllib.error
import configparser
import json
import os
import urllib.error
import urllib.parse
import urllib.request
import webbrowser
import configparser

config = configparser.ConfigParser()
config.read("config.ini")
Expand Down
1 change: 1 addition & 0 deletions Scripts/API/Github Information/github_scraper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

import requests

# Function to call API for details of the User.
Expand Down
5 changes: 3 additions & 2 deletions Scripts/API/Google Spreadsheet/create_sheet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import argparse

import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
import argparse
from oauth2client.service_account import ServiceAccountCredentials


def auth_user():
Expand Down
7 changes: 4 additions & 3 deletions Scripts/API/Google Spreadsheet/get_sheet.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import pandas as pd
import argparse
import json

import gspread
import pandas as pd
from oauth2client.service_account import ServiceAccountCredentials


def auth_user():
# Define a authorized user with the credentials created.
Expand Down
3 changes: 2 additions & 1 deletion Scripts/API/Google Translator/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from googletrans import LANGUAGES, Translator
from sys import exit

from googletrans import LANGUAGES, Translator

lang = LANGUAGES
translator = Translator()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import Flask, jsonify
from Random_Album_API.views.api_view import RandomAlbumAPI, random_album
from Random_Album_API.shared_resources.exceptions import APIException
from Random_Album_API.views.api_view import RandomAlbumAPI, random_album

app = Flask(__name__)
# Register the blueprint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pandas as pd
import random

import pandas as pd


class GetRandomAlbum:
"""Class to get random album from dataset"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from Random_Album_API.application import app

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from flask import Blueprint, jsonify, request
from flask.views import MethodView

from Random_Album_API.shared_resources.argument_check import validate_arguments
from Random_Album_API.logics.app_logic import GetRandomAlbum
from Random_Album_API.shared_resources.argument_check import validate_arguments

random_album = Blueprint("random_album", __name__)

Expand Down
2 changes: 1 addition & 1 deletion Scripts/API/Random Joke/joke.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests
import typer
from colored import fg, attr
from colored import attr, fg

app = typer.Typer()
rst = attr("reset") # reset colors
Expand Down
2 changes: 1 addition & 1 deletion Scripts/API/Random Quote Notification/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# ---------------------------------
# Imports
import requests
from plyer import notification
from apscheduler.schedulers.blocking import BlockingScheduler
from plyer import notification


# Sub-Routines
Expand Down
8 changes: 4 additions & 4 deletions Scripts/API/Twitter Sentiment Analysis/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from flask import Flask, redirect, url_for, render_template
from flask_dance.contrib.twitter import make_twitter_blueprint, twitter
import requests
import btm_model
import text_cleaning
import requests
import sentiment
import text_cleaning
from flask import Flask, redirect, render_template, url_for
from flask_dance.contrib.twitter import make_twitter_blueprint, twitter

app = Flask(__name__)
app.config["SECRET_KEY"] = "youareawesomethiscanbeanything"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/API/Twitter Sentiment Analysis/btm_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from biterm.biterm.btm import oBTM
from biterm.biterm.utility import topic_summuary, vec_to_biterms
from sklearn.feature_extraction.text import CountVectorizer
from biterm.biterm.utility import vec_to_biterms, topic_summuary


def categorize(tweets_list, number_of_topics=3):
Expand Down
3 changes: 2 additions & 1 deletion Scripts/API/Twitter Sentiment Analysis/text_cleaning.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import nltk
import re

import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize

Expand Down
7 changes: 4 additions & 3 deletions Scripts/Bots/Discord/bot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import discord
import os
from discord.ext import commands, tasks
from itertools import cycle
import random
from itertools import cycle

import discord
from discord.ext import commands, tasks

TOKEN = "token"
client = commands.Bot(command_prefix="/")
Expand Down
5 changes: 3 additions & 2 deletions Scripts/Bots/Instagram/Instagram_bot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from selenium import webdriver
import pathlib
from time import sleep

from cryptography.fernet import Fernet
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait


class InstaBot:
Expand Down
7 changes: 4 additions & 3 deletions Scripts/Bots/RunPython/bot/execute_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
This module is responsible for handling the execution of python code given by the telegram user.
"""
import logging
from subprocess import TimeoutExpired
import subprocess
import multiprocessing
from .config import banned, TIMEOUT, timeout_message, restricted_message
import subprocess
from subprocess import TimeoutExpired

from .config import TIMEOUT, banned, restricted_message, timeout_message


def contains_restricted(input_text):
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Bots/RunPython/bot/run_python_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
This module makes the bot actually run
"""

from telegram.ext import CommandHandler, MessageHandler, Filters, Updater
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater

from .execute_code import eval_py, run

# python-telegram-bot is a Pythonic Wrapper to the core Telegram API
# it helps us to be DRY by giving us convinient wrapper functions to deal with Telegram API
# you can install it by pip install python-telegram-bot --upgrade
# learn more about it here https://github.com/python-telegram-bot/python-telegram-bot


from .execute_code import eval_py, run

# read the token for authenticating our bot
with open("token.txt") as f:
tok = f.readline().strip()
Expand Down
5 changes: 3 additions & 2 deletions Scripts/Bots/RunPython/start.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from bot import run_python_bot
import logging
from pytz import timezone
from datetime import datetime

from bot import run_python_bot
from pytz import timezone

TIMEZONE = "Asia/Kolkata"

logging.Formatter.converter = lambda *args: datetime.now(
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Slack/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import logging
import os

from flask import Flask
from slack import WebClient
from slackeventsapi import SlackEventAdapter
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Slack/sendmessage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from slack import WebClient
import os

from slack import WebClient

# Create a slack client
slack_web_client = WebClient(token=os.environ.get("SLACK_TOKEN"))

Expand Down
5 changes: 3 additions & 2 deletions Scripts/Bots/Telegram Weather/bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import json
import configparser as cfg
import json

import requests


class telegram_chatbot:
Expand Down
5 changes: 3 additions & 2 deletions Scripts/Bots/Telegram Weather/weather.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import json
import configparser as cfg
import json

import requests


class weather_info:
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Bots/Telegram/telegram_bot.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from configparser import ConfigParser

from telethon.sync import TelegramClient
from telethon.tl.types import InputPeerUser


configur = ConfigParser()
configur.read("config.ini")

Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Torrent Search/bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging

from telegram.ext import CommandHandler, Filters, MessageHandler, Updater

logging.basicConfig(level=logging.WARNING)
import telegram
from piratebay import pirate
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Torrent Search/piratebay.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import requests
import json

import requests
from scrapmagnet import scrapmag


Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Torrent Search/scrapmagnet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib.request, urllib.parse
import urllib.parse
import urllib.request

trackers = [
"udp://tracker.coppersurfer.tk:6969/announce",
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Bots/Twitter Unfollow/Twitter_Unfollow.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /usr/bin/env python

import sys
import time

import tweepy
import sys

# Replace the foo bar with your twitter API keys from dev.twitter.com
auth = tweepy.auth.OAuthHandler(consumer_key="foo", consumer_secret="bar")
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Bots/Twitter/Twitter_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from twython import Twython
from twython import TwythonStreamer
import configparser

from twython import Twython, TwythonStreamer


class MyStreamer(TwythonStreamer):
@staticmethod
Expand Down
5 changes: 3 additions & 2 deletions Scripts/Bots/Typing Test/Typing_test_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import time

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
from selenium.webdriver.common.keys import Keys


class Typing_Test_Typer:
Expand Down
7 changes: 5 additions & 2 deletions Scripts/Bots/Zoom Meetings/automate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import time, subprocess, pyautogui
from pynput.keyboard import Key, Controller
import subprocess
import time

import pyautogui
from pynput.keyboard import Controller, Key

# In this program all the text-fields, buttons, check-boxes are located using screenshots
# You can change the sleep-time as per the loading time of your pc
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Miscellaneous/15Puzzle/15puzzle.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from tkinter import Frame, Label, PhotoImage, StringVar, CENTER
import random
import time
from tkinter import CENTER, Frame, Label, PhotoImage, StringVar

from logic import is_solvable, is_solved, convert_time
import constants as c
from logic import convert_time, is_solvable, is_solved


class Puzzle(Frame):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt # loading dependencies
import numpy as np
import tensorflow as tf


def load_data(): # method for loading mnist dataset
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Miscellaneous/Automatic Birthday Wisher/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# import required packages
import pandas as pd
import datetime
import smtplib

import pandas as pd

# your gmail credentials here
GMAIL_ID = "Your-Gmail-Id"
GMAIL_PWD = "Your-Gmail-Password"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import pandas as pd

from PIL import Image, ImageDraw, ImageFont

import email.message as em
import getpass
import re
import smtplib
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import email.message as em

import getpass
import re
import pandas as pd
from PIL import Image, ImageDraw, ImageFont


def mail(df, from_, password):
Expand Down
Loading

0 comments on commit 8fa3cea

Please sign in to comment.