Tidy Imports

This commit is contained in:
Luke Rogers 2014-02-14 16:36:57 +13:00
parent 4447e6cd1f
commit a76ff29d4b
59 changed files with 145 additions and 54 deletions

View File

@ -1,4 +1,3 @@
from util import hook
import os
import sys
import re
@ -6,6 +5,8 @@ import json
import time
import subprocess
from util import hook
@hook.command(autohelp=False, permissions=["permissions_users"])
def permissions(inp, bot=None, notice=None):

View File

@ -1,6 +1,8 @@
from util import hook
import random
from util import hook
with open("plugins/data/larts.txt") as f:
larts = [line.strip() for line in f.readlines()
if not line.startswith("//")]

View File

@ -1,6 +1,7 @@
from util import hook
import random
from util import hook
@hook.command(autohelp=False)
def coin(inp, action=None):

View File

@ -1,7 +1,9 @@
import time
from util import hook
# CTCP responses
@hook.regex(r'^\x01VERSION\x01$')
def ctcp_version(inp, notice=None):

View File

@ -4,6 +4,7 @@ import re
from util import hook
socket.setdefaulttimeout(10)
nick_re = re.compile(":(.+?)!")

View File

@ -1,7 +1,7 @@
import re
from fnmatch import fnmatch
from util import hook
from fnmatch import fnmatch
@hook.sieve

View File

@ -1,4 +1,5 @@
import base64
from util import hook

View File

@ -1,5 +1,6 @@
# Plugin by GhettoWizard and Scaevolus
import re
from util import hook
from util import http

View File

@ -1,6 +1,8 @@
from util import hook, http, text
import re
from util import hook, http, text
api_url = "http://encyclopediadramatica.se/api.php?action=opensearch"
ed_url = "http://encyclopediadramatica.se/"

View File

@ -1,6 +1,8 @@
import random
from util import hook, text
color_codes = {
"<r>": "\x02\x0305",
"<g>": "\x02\x0303",

View File

@ -1,13 +1,15 @@
from util import hook
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import PBKDF2
import os
import base64
import json
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import PBKDF2
from util import hook
# helper functions to pad and unpad a string to a specified block size
# <http://stackoverflow.com/questions/12524994/encrypt-decrypt-using-pycrypto-aes-256>
BS = AES.block_size

View File

@ -1,8 +1,10 @@
# Written by Scaevolus 2010
from util import hook, http, text, pyexec
import string
import re
from util import hook, http, text, pyexec
re_lineends = re.compile(r'[\r\n]*')
# some simple "shortcodes" for formatting purposes

View File

@ -1,6 +1,8 @@
from util import hook, http
from urllib import quote_plus
from util import hook, http
api_url = "http://api.fishbans.com/stats/{}/"

View File

@ -1,6 +1,8 @@
from util import hook
import random
from util import hook
with open("plugins/data/fortunes.txt") as f:
fortunes = [line.strip() for line in f.readlines()
if not line.startswith("//")]

View File

@ -1,10 +1,13 @@
from util import hook, http
import os.path
import pygeoip
import json
import gzip
from StringIO import StringIO
import pygeoip
from util import hook, http
# load region database
with open("./plugins/data/geoip_regions.json", "rb") as f:

View File

@ -1,7 +1,9 @@
from util import hook, http
import json
import urllib2
from util import hook, http
shortcuts = {"cloudbot": "ClouDev/CloudBot"}

View File

@ -1,4 +1,5 @@
import random
from util import hook, http, text

View File

@ -8,6 +8,7 @@ import re
from util import hook, http
max_length = 100

View File

@ -1,4 +1,5 @@
import re
from util import hook

View File

@ -1,7 +1,9 @@
from util import hook, http, timeformat
from urllib import urlencode
import re
from util import hook, http, timeformat
hulu_re = (r'(.*://)(www.hulu.com|hulu.com)(.*)', re.I)

View File

@ -1,7 +1,8 @@
import json
from util import hook
from fnmatch import fnmatch
from util import hook
@hook.sieve
def ignore_sieve(bot, input, func, type, args):

View File

@ -1,8 +1,10 @@
# IMDb lookup plugin by Ghetto Wizard (2011) and blha303 (2013)
from util import hook, http, text
import re
from util import hook, http, text
id_re = re.compile("tt\d+")
imdb_re = (r'(.*:)//(imdb.com|www.imdb.com)(:[0-9]+)?(.*)', re.I)

View File

@ -1,7 +1,8 @@
from util import hook, http, web
import re
import random
from util import hook, http, web
base_url = "http://reddit.com/r/{}/.json"
imgur_re = re.compile(r'http://(?:i\.)?imgur\.com/(a/)?(\w+\b(?!/))\.?\w?')

View File

@ -1,6 +1,7 @@
from util import hook, http
import re
from util import hook, http
@hook.command(autohelp=False)
def kernel(inp, reply=None):

View File

@ -1,6 +1,7 @@
from util import hook, textgen
import json
from util import hook, textgen
def get_generator(_json, variables):
data = json.loads(_json)

View File

@ -1,6 +1,8 @@
from util import hook, http, timesince
from datetime import datetime
from util import hook, http, timesince
api_url = "http://ws.audioscrobbler.com/2.0/?format=json"

View File

@ -1,7 +1,9 @@
from util import hook, http, web, text
import time
import random
from util import hook, http, web, text
## CONSTANTS
base_url = "http://api.bukget.org/3/"

View File

@ -1,9 +1,11 @@
""" plugin by _303 (?)
"""
from util import hook
import re
from util import hook
pattern = re.compile(r'^(?P<count>\d+)x (?P<name>.+?): (?P<ingredients>.*)$')
recipelist = []

View File

@ -1,9 +1,11 @@
# TODO: Rewrite this whole mess
from util import hook
import socket
import struct
import json
from util import hook
try:
import DNS
# Please remember to install the dependancy 'pydns'

View File

@ -1,6 +1,7 @@
from util import hook, http
import json
from util import hook, http
@hook.command(autohelp=False)
def mcstatus(inp):

View File

@ -1,6 +1,8 @@
from util import hook, http, text
import re
from util import hook, http, text
api_url = "http://minecraft.gamepedia.com/api.php?action=opensearch"
mc_url = "http://minecraft.gamepedia.com/"

View File

@ -1,6 +1,7 @@
# Plugin by Infinity - <https://github.com/infinitylabs/UguuBot>
import random
from util import hook, http

View File

@ -1,7 +1,8 @@
from util import hook, text, textgen
import json
import os
from util import hook, text, textgen
GEN_DIR = "./plugins/data/name_files/"

View File

@ -1,7 +1,9 @@
from util import hook, http, text, web
import json
import re
from util import hook, http, text, web
## CONSTANTS
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"

View File

@ -1,6 +1,8 @@
import re
from util import hook, http
newgrounds_re = (r'(.*:)//(www.newgrounds.com|newgrounds.com)(:[0-9]+)?(.*)', re.I)
valid = set('0123456789')

View File

@ -1,6 +1,8 @@
from util import hook
import re
from util import hook
db_inited = False

View File

@ -1,6 +1,8 @@
from util import hook, http, web
from bs4 import BeautifulSoup
from util import hook, http, web
api_url = "http://osrc.dfm.io/{}/stats"
user_url = "http://osrc.dfm.io/{}"

View File

@ -1,9 +1,10 @@
# TODO: Add some kind of pronounceable password generation
# TODO: Improve randomness
from util import hook
import string
import random
from util import hook
@hook.command
def password(inp, notice=None):

View File

@ -1,9 +1,11 @@
# ping plugin by neersighted
from util import hook
import subprocess
import re
import os
from util import hook
ping_regex = re.compile(r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)")

View File

@ -1,8 +1,10 @@
# coding=utf-8
from util import hook
import re
import random
from util import hook
potatoes = ['AC Belmont', 'AC Blue Pride', 'AC Brador', 'AC Chaleur', 'AC Domino', 'AC Dubuc', 'AC Glacier Chip',
'AC Maple Gold', 'AC Novachip', 'AC Peregrine Red', 'AC Ptarmigan', 'AC Red Island', 'AC Saguenor',
'AC Stampede Russet', 'AC Sunbury', 'Abeille', 'Abnaki', 'Acadia', 'Acadia Russet', 'Accent',

View File

@ -1,6 +1,7 @@
from util import hook, http, timesince
import datetime
from util import hook, http, timesince
@hook.command("scene")
@hook.command

View File

@ -1,9 +1,11 @@
import urllib
import json
import re
from util import hook
import oauth2 as oauth
from util import hook
def getdata(inp, types, api_key, api_secret):
consumer = oauth.Consumer(api_key, api_secret)

View File

@ -5,6 +5,7 @@ import re
from util import hook, timesince
db_ready = False

View File

@ -1,6 +1,7 @@
from util import hook, textgen
import json
from util import hook, textgen
def get_generator(_json, variables):
data = json.loads(_json)

View File

@ -1,6 +1,7 @@
from util import hook, text
import random
from util import hook, text
with open("plugins/data/slogans.txt") as f:
slogans = [line.strip() for line in f.readlines()

View File

@ -1,7 +1,9 @@
from util import hook, http, web, text
from urllib import urlencode
import re
from util import hook, http, web, text
sc_re = (r'(.*:)//(www.)?(soundcloud.com)(.*)', re.I)
api_url = "http://api.soundcloud.com"
sndsc_re = (r'(.*:)//(www.)?(snd.sc)(.*)', re.I)

View File

@ -1,8 +1,9 @@
from util import hook
from enchant.checker import SpellChecker
import enchant
from util import hook
locale = "en_US"

View File

@ -1,7 +1,7 @@
import re
from urllib import urlencode
from util import hook, http, web
from urllib import urlencode
gateway = 'http://open.spotify.com/{}/{}' # http spotify gw address
spuri = 'spotify:{}:{}'

View File

@ -1,7 +1,9 @@
import re
from bs4 import BeautifulSoup, NavigableString, Tag
from util import hook, http, web
from util.text import truncate_str
from bs4 import BeautifulSoup, NavigableString, Tag
steam_re = (r'(.*:)//(store.steampowered.com)(:[0-9]+)?(.*)', re.I)

View File

@ -1,7 +1,9 @@
from util import hook, http, text
import csv
import StringIO
from util import hook, http, text
gauge_url = "http://www.mysteamgauge.com/search?username={}"
api_url = "http://mysteamgauge.com/user/{}.csv"

View File

@ -2,9 +2,10 @@ import os
import re
import time
import platform
from util import hook
from datetime import timedelta
from util import hook
def convert_kilobytes(kilobytes):
if kilobytes >= 1024:

View File

@ -1,7 +1,9 @@
from util import hook, http
import time
from util import hook, http
from util.text import capitalize_first
api_url = 'http://api.wolframalpha.com/v2/query?format=plaintext'

View File

@ -1,6 +1,7 @@
from util import hook, http, urlnorm
from bs4 import BeautifulSoup
from util import hook, http, urlnorm
@hook.command
def title(inp):

View File

@ -9,6 +9,7 @@ from zipfile import ZipFile
from cStringIO import StringIO
from lxml import etree
from util import hook, http

View File

@ -1,7 +1,9 @@
import re
from util import hook, http
from HTMLParser import HTMLParser
from util import hook, http
twitch_re = (r'(.*:)//(twitch.tv|www.twitch.tv)(:[0-9]+)?(.*)', re.I)
multitwitch_re = (r'(.*:)//(www.multitwitch.tv|multitwitch.tv)/(.*)', re.I)

View File

@ -1,9 +1,12 @@
from util import hook, timesince
import tweepy
import re
import random
from datetime import datetime
import tweepy
from util import hook, timesince
TWITTER_RE = (r"(?:(?:www.twitter.com|twitter.com)/(?:[-_a-zA-Z0-9]+)/status/)([0-9]+)", re.I)

View File

@ -1,6 +1,8 @@
from util import hook, http, text
import re
from util import hook, http, text
base_url = 'http://www.urbandictionary.com/iphone/search/define'

View File

@ -1,8 +1,10 @@
from util import hook, text
import hashlib
import collections
import re
from util import hook, text
# variables
colors = collections.OrderedDict([

View File

@ -1,7 +1,8 @@
from util import hook, http, web
import json
import urllib2
from util import hook, http, web
def get_sound_info(game, search):
search = search.replace(" ", "+")