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

Commit 8fa3cea

Browse files
authored
Merge pull request #659 from Python-World/feature/cleanup
Feature/cleanup
2 parents 9aef440 + c0297f9 commit 8fa3cea

File tree

131 files changed

+321
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+321
-231
lines changed

.mergify.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,3 @@ pull_request_rules:
1919
actions:
2020
merge:
2121
method: merge
22-
- name: automatic merge for deepsorce-autofix pull requests
23-
conditions:
24-
- author=deepsource-autofix[bot]
25-
actions:
26-
merge:
27-
method: merge

Scripts/API/Football Standings/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
2-
import requests
32
import sys
43

4+
import requests
55
from dotenv import load_dotenv
66

77
load_dotenv()

Scripts/API/GeoCode API/code.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import urllib.request, urllib.parse, urllib.error
1+
import configparser
22
import json
33
import os
4+
import urllib.error
5+
import urllib.parse
6+
import urllib.request
47
import webbrowser
5-
import configparser
68

79
config = configparser.ConfigParser()
810
config.read("config.ini")

Scripts/API/Github Information/github_scraper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
23
import requests
34

45
# Function to call API for details of the User.

Scripts/API/Google Spreadsheet/create_sheet.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import argparse
2+
13
import gspread
2-
from oauth2client.service_account import ServiceAccountCredentials
34
import pandas as pd
4-
import argparse
5+
from oauth2client.service_account import ServiceAccountCredentials
56

67

78
def auth_user():

Scripts/API/Google Spreadsheet/get_sheet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import gspread
2-
from oauth2client.service_account import ServiceAccountCredentials
3-
import pandas as pd
41
import argparse
52
import json
63

4+
import gspread
5+
import pandas as pd
6+
from oauth2client.service_account import ServiceAccountCredentials
7+
78

89
def auth_user():
910
# Define a authorized user with the credentials created.

Scripts/API/Google Translator/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from googletrans import LANGUAGES, Translator
21
from sys import exit
32

3+
from googletrans import LANGUAGES, Translator
4+
45
lang = LANGUAGES
56
translator = Translator()
67

Scripts/API/Random Album API/Random_Album_API/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from flask import Flask, jsonify
2-
from Random_Album_API.views.api_view import RandomAlbumAPI, random_album
32
from Random_Album_API.shared_resources.exceptions import APIException
3+
from Random_Album_API.views.api_view import RandomAlbumAPI, random_album
44

55
app = Flask(__name__)
66
# Register the blueprint

Scripts/API/Random Album API/Random_Album_API/logics/app_logic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import pandas as pd
21
import random
32

3+
import pandas as pd
4+
45

56
class GetRandomAlbum:
67
"""Class to get random album from dataset"""

Scripts/API/Random Album API/Random_Album_API/run_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
23
from Random_Album_API.application import app
34

45
if __name__ == "__main__":

Scripts/API/Random Album API/Random_Album_API/views/api_view.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from flask import Blueprint, jsonify, request
22
from flask.views import MethodView
3-
4-
from Random_Album_API.shared_resources.argument_check import validate_arguments
53
from Random_Album_API.logics.app_logic import GetRandomAlbum
4+
from Random_Album_API.shared_resources.argument_check import validate_arguments
65

76
random_album = Blueprint("random_album", __name__)
87

Scripts/API/Random Joke/joke.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import requests
55
import typer
6-
from colored import fg, attr
6+
from colored import attr, fg
77

88
app = typer.Typer()
99
rst = attr("reset") # reset colors

Scripts/API/Random Quote Notification/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# ---------------------------------
55
# Imports
66
import requests
7-
from plyer import notification
87
from apscheduler.schedulers.blocking import BlockingScheduler
8+
from plyer import notification
99

1010

1111
# Sub-Routines

Scripts/API/Twitter Sentiment Analysis/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from flask import Flask, redirect, url_for, render_template
2-
from flask_dance.contrib.twitter import make_twitter_blueprint, twitter
3-
import requests
41
import btm_model
5-
import text_cleaning
2+
import requests
63
import sentiment
4+
import text_cleaning
5+
from flask import Flask, redirect, render_template, url_for
6+
from flask_dance.contrib.twitter import make_twitter_blueprint, twitter
77

88
app = Flask(__name__)
99
app.config["SECRET_KEY"] = "youareawesomethiscanbeanything"

Scripts/API/Twitter Sentiment Analysis/btm_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
from biterm.biterm.btm import oBTM
3+
from biterm.biterm.utility import topic_summuary, vec_to_biterms
34
from sklearn.feature_extraction.text import CountVectorizer
4-
from biterm.biterm.utility import vec_to_biterms, topic_summuary
55

66

77
def categorize(tweets_list, number_of_topics=3):

Scripts/API/Twitter Sentiment Analysis/text_cleaning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import nltk
21
import re
2+
3+
import nltk
34
from nltk.corpus import stopwords
45
from nltk.tokenize import word_tokenize
56

Scripts/Bots/Discord/bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import discord
21
import os
3-
from discord.ext import commands, tasks
4-
from itertools import cycle
52
import random
3+
from itertools import cycle
4+
5+
import discord
6+
from discord.ext import commands, tasks
67

78
TOKEN = "token"
89
client = commands.Bot(command_prefix="/")

Scripts/Bots/Instagram/Instagram_bot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from selenium import webdriver
21
import pathlib
32
from time import sleep
3+
44
from cryptography.fernet import Fernet
5+
from selenium import webdriver
56
from selenium.webdriver.common.by import By
6-
from selenium.webdriver.support.ui import WebDriverWait
77
from selenium.webdriver.support import expected_conditions as EC
8+
from selenium.webdriver.support.ui import WebDriverWait
89

910

1011
class InstaBot:

Scripts/Bots/RunPython/bot/execute_code.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
This module is responsible for handling the execution of python code given by the telegram user.
33
"""
44
import logging
5-
from subprocess import TimeoutExpired
6-
import subprocess
75
import multiprocessing
8-
from .config import banned, TIMEOUT, timeout_message, restricted_message
6+
import subprocess
7+
from subprocess import TimeoutExpired
8+
9+
from .config import TIMEOUT, banned, restricted_message, timeout_message
910

1011

1112
def contains_restricted(input_text):

Scripts/Bots/RunPython/bot/run_python_bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
This module makes the bot actually run
33
"""
44

5-
from telegram.ext import CommandHandler, MessageHandler, Filters, Updater
5+
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater
6+
7+
from .execute_code import eval_py, run
68

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

1214

13-
from .execute_code import eval_py, run
14-
1515
# read the token for authenticating our bot
1616
with open("token.txt") as f:
1717
tok = f.readline().strip()

Scripts/Bots/RunPython/start.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from bot import run_python_bot
21
import logging
3-
from pytz import timezone
42
from datetime import datetime
53

4+
from bot import run_python_bot
5+
from pytz import timezone
6+
67
TIMEZONE = "Asia/Kolkata"
78

89
logging.Formatter.converter = lambda *args: datetime.now(

Scripts/Bots/Slack/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import os
21
import logging
2+
import os
3+
34
from flask import Flask
45
from slack import WebClient
56
from slackeventsapi import SlackEventAdapter

Scripts/Bots/Slack/sendmessage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from slack import WebClient
21
import os
32

3+
from slack import WebClient
4+
45
# Create a slack client
56
slack_web_client = WebClient(token=os.environ.get("SLACK_TOKEN"))
67

Scripts/Bots/Telegram Weather/bot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import requests
2-
import json
31
import configparser as cfg
2+
import json
3+
4+
import requests
45

56

67
class telegram_chatbot:

Scripts/Bots/Telegram Weather/weather.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import requests
2-
import json
31
import configparser as cfg
2+
import json
3+
4+
import requests
45

56

67
class weather_info:

Scripts/Bots/Telegram/telegram_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from configparser import ConfigParser
2+
23
from telethon.sync import TelegramClient
34
from telethon.tl.types import InputPeerUser
45

5-
66
configur = ConfigParser()
77
configur.read("config.ini")
88

Scripts/Bots/Torrent Search/bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
21
import logging
32

3+
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater
4+
45
logging.basicConfig(level=logging.WARNING)
56
import telegram
67
from piratebay import pirate

Scripts/Bots/Torrent Search/piratebay.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import requests
21
import json
2+
3+
import requests
34
from scrapmagnet import scrapmag
45

56

Scripts/Bots/Torrent Search/scrapmagnet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import urllib.request, urllib.parse
1+
import urllib.parse
2+
import urllib.request
23

34
trackers = [
45
"udp://tracker.coppersurfer.tk:6969/announce",

Scripts/Bots/Twitter Unfollow/Twitter_Unfollow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#! /usr/bin/env python
22

3+
import sys
34
import time
5+
46
import tweepy
5-
import sys
67

78
# Replace the foo bar with your twitter API keys from dev.twitter.com
89
auth = tweepy.auth.OAuthHandler(consumer_key="foo", consumer_secret="bar")

Scripts/Bots/Twitter/Twitter_bot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from twython import Twython
2-
from twython import TwythonStreamer
31
import configparser
42

3+
from twython import Twython, TwythonStreamer
4+
55

66
class MyStreamer(TwythonStreamer):
77
@staticmethod

Scripts/Bots/Typing Test/Typing_test_bot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import time
2+
13
from selenium import webdriver
2-
from selenium.webdriver.common.keys import Keys
34
from selenium.webdriver.chrome.options import Options
4-
import time
5+
from selenium.webdriver.common.keys import Keys
56

67

78
class Typing_Test_Typer:

Scripts/Bots/Zoom Meetings/automate.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import time, subprocess, pyautogui
2-
from pynput.keyboard import Key, Controller
1+
import subprocess
2+
import time
3+
4+
import pyautogui
5+
from pynput.keyboard import Controller, Key
36

47
# In this program all the text-fields, buttons, check-boxes are located using screenshots
58
# You can change the sleep-time as per the loading time of your pc

Scripts/Miscellaneous/15Puzzle/15puzzle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from tkinter import Frame, Label, PhotoImage, StringVar, CENTER
21
import random
32
import time
3+
from tkinter import CENTER, Frame, Label, PhotoImage, StringVar
44

5-
from logic import is_solvable, is_solved, convert_time
65
import constants as c
6+
from logic import convert_time, is_solvable, is_solved
77

88

99
class Puzzle(Frame):

Scripts/Miscellaneous/Activation_Functions_from_scratch_in_Keras/src/utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import tensorflow as tf
2-
import numpy as np
31
import matplotlib.pyplot as plt # loading dependencies
2+
import numpy as np
3+
import tensorflow as tf
44

55

66
def load_data(): # method for loading mnist dataset

Scripts/Miscellaneous/Automatic Birthday Wisher/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# import required packages
2-
import pandas as pd
32
import datetime
43
import smtplib
54

5+
import pandas as pd
6+
67
# your gmail credentials here
78
GMAIL_ID = "Your-Gmail-Id"
89
GMAIL_PWD = "Your-Gmail-Password"

Scripts/Miscellaneous/Bulk Certificate Generator and emailer/main.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import pandas as pd
2-
3-
from PIL import Image, ImageDraw, ImageFont
4-
1+
import email.message as em
2+
import getpass
3+
import re
54
import smtplib
5+
from email import encoders
6+
from email.mime.base import MIMEBase
67
from email.mime.multipart import MIMEMultipart
78
from email.mime.text import MIMEText
8-
from email.mime.base import MIMEBase
9-
from email import encoders
10-
import email.message as em
119

12-
import getpass
13-
import re
10+
import pandas as pd
11+
from PIL import Image, ImageDraw, ImageFont
1412

1513

1614
def mail(df, from_, password):

0 commit comments

Comments
 (0)