[wip] in modules, changes import to reflect new directory structure

This commit is contained in:
nemunaire 2015-01-03 20:34:44 +01:00
parent 5a6230d844
commit 7c7b63634b
39 changed files with 87 additions and 86 deletions

View File

@ -7,8 +7,8 @@ import sys
from datetime import datetime, timezone
import shlex
from hooks import hook
from message import TextMessage, Command
from nemubot.hooks import hook
from nemubot.message import TextMessage, Command
nemubotversion = 3.4

View File

@ -6,10 +6,10 @@ import re
import sys
from datetime import date, datetime
from hooks import hook
from tools.countdown import countdown_format
from tools.date import extractDate
from tools.xmlparser.node import ModuleState
from nemubot.hooks import hook
from nemubot.tools.countdown import countdown_format
from nemubot.tools.date import extractDate
from nemubot.tools.xmlparser.node import ModuleState
nemubotversion = 3.4

View File

@ -4,8 +4,8 @@
from datetime import datetime, timezone
from hooks import hook
from tools.countdown import countdown_format
from nemubot.hooks import hook
from nemubot.tools.countdown import countdown_format
nemubotversion = 3.4

View File

@ -4,8 +4,8 @@
import urllib
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a modulable IRC bot, built around XML configuration files.
# Copyright (C) 2012 Mercier Pierre-Olivier
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -19,10 +19,10 @@
import traceback
import sys
from prompt.error import PromptError
from hooks import hook
from message import TextMessage
from networkbot import NetworkBot
from nemubot.prompt.error import PromptError
from nemubot.hooks import hook
from nemubot.message import TextMessage
from nemubot.networkbot import NetworkBot
nemubotversion = 3.4
NODATA = True

View File

@ -2,15 +2,13 @@
"""Find french conjugaison"""
from collections import defaultdict
import re
import traceback
import sys
from urllib.parse import quote
from hooks import hook
from tools import web
from tools.web import striphtml
from collections import defaultdict
from nemubot.hooks import hook
from nemubot.tools import web
from nemubot.tools.web import striphtml
nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
import urllib.request
from bs4 import BeautifulSoup
import pprint
from hooks import hook
from nemubot.hooks import hook
from more import Response
nemubotversion = 3.4
@ -34,4 +34,3 @@ def get_cve_desc(msg):
desc = soup.body.findAll('td')
return Response(desc[DESC_INDEX].text, msg.channel)

View File

@ -2,8 +2,8 @@
from urllib.parse import quote
from tools import web
from tools.xmlparser import parse_string
from nemubot.tools import web
from nemubot.tools.xmlparser import parse_string
class DDGSearch:

View File

@ -2,7 +2,7 @@
from urllib.parse import quote
from tools import web
from nemubot.tools import web
class UrbanDictionnary:

View File

@ -2,7 +2,7 @@
from urllib.parse import quote
from tools import web
from nemubot.tools import web
class WFASearch:

View File

@ -4,7 +4,7 @@
import imp
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -10,10 +10,10 @@ import time
import threading
import traceback
from event import ModuleEvent
from hooks import hook
from tools.date import extractDate
from tools.countdown import countdown_format, countdown
from nemubot.event import ModuleEvent
from nemubot.hooks import hook
from nemubot.tools.date import extractDate
from nemubot.tools.countdown import countdown_format, countdown
nemubotversion = 3.4

View File

@ -5,8 +5,8 @@
import re
from urllib.parse import quote
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -5,8 +5,8 @@
import re
import urllib.parse
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -6,7 +6,7 @@ import subprocess
import re
import os
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -5,7 +5,7 @@
import re
from urllib.parse import quote
from tools import web
from nemubot.tools import web
nemubotversion = 3.4
@ -20,7 +20,7 @@ def load(context):
"http://developer.mapquest.com/")
return None
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_geocode, "geocode"))

View File

@ -6,8 +6,8 @@ import json
import re
import urllib.parse
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Nemubot is a smart and modulable IM bot.
# Copyright (C) 2012-2014 nemunaire
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -20,8 +20,8 @@
import logging
from message import TextMessage, DirectAsk
from hooks import hook
from nemubot.message import TextMessage, DirectAsk
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -2,7 +2,7 @@
"""Various network tools (w3m, w3c validator, curl, traceurl, ...)"""
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -1,6 +1,6 @@
import urllib
from tools.web import getJSON
from nemubot.tools.web import getJSON
def isup(url):
"""Determine if the given URL is up or not

View File

@ -4,8 +4,8 @@ import subprocess
import tempfile
import urllib
from bot import __version__
from tools import web
from nemubot import __version__
from nemubot.tools import web
def load(CONF, add_hook):

View File

@ -1,6 +1,8 @@
import json
import urllib
from nemubot import __version__
def validator(url):
"""Run the w3c validator on the given URL
@ -15,7 +17,7 @@ def validator(url):
raise IRCException("Indiquer une URL valide !")
try:
req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "nemubot v3" })
req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "Nemubot v%s" % __version__})
raw = urllib.request.urlopen(req, timeout=10)
except urllib.error.HTTPError as e:
raise IRCException("HTTP error occurs: %s %s" % (e.code, e.reason))

View File

@ -4,12 +4,13 @@ from random import randint
import urllib.parse
from urllib.parse import urlparse
from hooks import hook
from more import Response
from tools.xmlparser.node import ModuleState
from nemubot.hooks import hook
from nemubot.tools.xmlparser.node import ModuleState
nemubotversion = 3.4
from more import Response
from .atom import Atom
from . import page

View File

@ -1,8 +1,9 @@
import datetime
import urllib
from nemubot.tools.web import getJSON
from more import Response
from tools.web import getJSON
URL_WHOIS = "http://www.whoisxmlapi.com/whoisserver/WhoisService?rid=1&domainName=%%s&outputFormat=json&userName=%s&password=%s"
@ -17,7 +18,7 @@ def load(CONF, add_hook):
else:
URL_WHOIS = URL_WHOIS % (urllib.parse.quote(CONF.getNode("whoisxmlapi")["username"]), urllib.parse.quote(CONF.getNode("whoisxmlapi")["password"]))
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_whois, "netwhois"))

View File

@ -2,7 +2,7 @@
"""Informe les usagers des prochains passages des transports en communs de la RATP"""
from hooks import hook
from nemubot.hooks import hook
from more import Response
nemubotversion = 3.4

View File

@ -4,11 +4,11 @@
import re
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4
from hooks import hook
from more import Response

View File

@ -4,7 +4,7 @@
import random
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -5,9 +5,9 @@
import re
import urllib.parse
from hooks import hook
from tools import web
from tools.web import striphtml
from nemubot.hooks import hook
from nemubot.tools import web
from nemubot.tools.web import striphtml
nemubotversion = 3.4

View File

@ -6,7 +6,7 @@ import re
import imp
from datetime import datetime, timedelta, timezone
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -9,7 +9,7 @@ import urllib.error
import urllib.request
import urllib.parse
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View File

@ -6,9 +6,9 @@ import re
import subprocess
from threading import Thread
from hooks import hook
from message import TextMessage
from message.visitor import AbstractVisitor
from nemubot.hooks import hook
from nemubot.message import TextMessage
from nemubot.message.visitor import AbstractVisitor
nemubotversion = 3.4

View File

@ -5,7 +5,7 @@
import re
from urllib.parse import quote
from hooks import hook
from nemubot.hooks import hook
from .pyaspell import Aspell
from .pyaspell import AspellError

View File

@ -5,8 +5,8 @@
import re
from urllib.parse import quote
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -1,12 +1,12 @@
from datetime import datetime
import urllib
from tools import human
from tools.web import getJSON
from nemubot.hooks import hook
from nemubot.tools import human
from nemubot.tools.web import getJSON
nemubotversion = 3.4
from hooks import hook
from more import Response
URL_TPBAPI = None
@ -22,7 +22,7 @@ def load(context):
else:
URL_TPBAPI = CONF.getNode("tpbapi")["url"]
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_tpb, "tpb"))

View File

@ -5,7 +5,7 @@
import re
from urllib.parse import quote
from tools import web
from nemubot.tools import web
nemubotversion = 3.4
@ -27,7 +27,7 @@ def load(context):
else:
URL = URL % CONF.getNode("wrapi")["key"]
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_translate, "translate"))

View File

@ -4,8 +4,8 @@
import re
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
nemubotversion = 3.4

View File

@ -6,8 +6,8 @@ import datetime
import re
from urllib.parse import quote
from hooks import hook
from tools import web
from nemubot.hooks import hook
from nemubot.tools import web
import mapquest
@ -27,7 +27,7 @@ def load(context):
"http://developer.forecast.io/")
return None
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_weather, "météo"))
add_hook("cmd_hook", MessageHook(cmd_alert, "alert"))
add_hook("cmd_hook", MessageHook(cmd_coordinates, "coordinates"))

View File

@ -8,12 +8,12 @@ import re
from urllib.parse import quote
from urllib.request import urlopen
from nemubot.hooks import hook
nemubotversion = 3.4
from more import Response
from hooks import hook
API_URL="http://worldcup.sfg.io/%s"
def load(context):

View File

@ -6,9 +6,9 @@ import re
from urllib.parse import urlparse
from urllib.parse import quote
from hooks import hook
from message import TextMessage
from tools import web
from nemubot.hooks import hook
from nemubot.message import TextMessage
from nemubot.tools import web
nemubotversion = 3.4