mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Use relative imports for all packages under the supybot namespace
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
b1552ced11
commit
cef93a6cfd
@ -41,15 +41,8 @@ import os.path
|
|||||||
import UserDict
|
import UserDict
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import supybot.log as log
|
from .. import callbacks, conf, dbi, ircdb, ircutils, log, utils, world
|
||||||
import supybot.dbi as dbi
|
from ..commands import *
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.ircdb as ircdb
|
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.world as world
|
|
||||||
from supybot.commands import *
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.callbacks as callbacks
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# We need to sweep away all that mx.* crap because our code doesn't account
|
# We need to sweep away all that mx.* crap because our code doesn't account
|
||||||
|
@ -32,7 +32,7 @@ import sys
|
|||||||
import os.path
|
import os.path
|
||||||
import dynamicScope
|
import dynamicScope
|
||||||
|
|
||||||
import supybot.utils as utils
|
from . import utils
|
||||||
|
|
||||||
__builtins__['format'] = utils.str.format
|
__builtins__['format'] = utils.str.format
|
||||||
|
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
This module contains the basic callbacks for handling PRIVMSGs.
|
This module contains the basic callbacks for handling PRIVMSGs.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import supybot
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
import time
|
import time
|
||||||
@ -43,16 +41,9 @@ import inspect
|
|||||||
import operator
|
import operator
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
import supybot.log as log
|
from . import (conf, ircdb, irclib, ircmsgs, ircutils, log, registry, utils,
|
||||||
import supybot.conf as conf
|
world)
|
||||||
import supybot.utils as utils
|
from .utils.iter import any, all
|
||||||
import supybot.world as world
|
|
||||||
import supybot.ircdb as ircdb
|
|
||||||
import supybot.irclib as irclib
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.registry as registry
|
|
||||||
from supybot.utils.iter import any, all
|
|
||||||
|
|
||||||
def _addressed(nick, msg, prefixChars=None, nicks=None,
|
def _addressed(nick, msg, prefixChars=None, nicks=None,
|
||||||
prefixStrings=None, whenAddressedByNick=None,
|
prefixStrings=None, whenAddressedByNick=None,
|
||||||
|
@ -38,7 +38,7 @@ import struct
|
|||||||
import os.path
|
import os.path
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
|
|
||||||
import supybot.utils as utils
|
from . import utils
|
||||||
|
|
||||||
def hash(s):
|
def hash(s):
|
||||||
"""DJB's hash function for CDB."""
|
"""DJB's hash function for CDB."""
|
||||||
|
@ -38,15 +38,7 @@ import getopt
|
|||||||
import inspect
|
import inspect
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import supybot.log as log
|
from . import callbacks, conf, ircdb, ircmsgs, ircutils, log, utils, world
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.world as world
|
|
||||||
import supybot.ircdb as ircdb
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.callbacks as callbacks
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Non-arg wrappers -- these just change the behavior of a command without
|
# Non-arg wrappers -- these just change the behavior of a command without
|
||||||
|
14
src/conf.py
14
src/conf.py
@ -33,14 +33,8 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import supybot.utils as utils
|
from . import ircutils, registry, utils
|
||||||
import supybot.registry as registry
|
from .version import version
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
|
|
||||||
###
|
|
||||||
# version: This should be pretty obvious.
|
|
||||||
###
|
|
||||||
from supybot.version import version
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# *** The following variables are affected by command-line options. They are
|
# *** The following variables are affected by command-line options. They are
|
||||||
@ -249,7 +243,7 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf):
|
|||||||
List = ircutils.IrcSet
|
List = ircutils.IrcSet
|
||||||
Value = ValidChannel
|
Value = ValidChannel
|
||||||
def join(self, channel):
|
def join(self, channel):
|
||||||
import ircmsgs # Don't put this globally! It's recursive.
|
from . import ircmsgs # Don't put this globally! It's recursive.
|
||||||
key = self.key.get(channel)()
|
key = self.key.get(channel)()
|
||||||
if key:
|
if key:
|
||||||
return ircmsgs.join(channel, key)
|
return ircmsgs.join(channel, key)
|
||||||
@ -856,7 +850,7 @@ registerChannelValue(supybot.databases.plugins.channelSpecific.link, 'allow',
|
|||||||
|
|
||||||
class CDB(registry.Boolean):
|
class CDB(registry.Boolean):
|
||||||
def connect(self, filename):
|
def connect(self, filename):
|
||||||
import supybot.cdb as cdb
|
from . import cdb
|
||||||
basename = os.path.basename(filename)
|
basename = os.path.basename(filename)
|
||||||
journalName = supybot.directories.data.tmp.dirize(basename+'.journal')
|
journalName = supybot.directories.data.tmp.dirize(basename+'.journal')
|
||||||
return cdb.open(filename, 'c',
|
return cdb.open(filename, 'c',
|
||||||
|
@ -35,9 +35,8 @@ import os
|
|||||||
import csv
|
import csv
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import supybot.cdb as cdb
|
from . import cdb, utils
|
||||||
import supybot.utils as utils
|
from .utils.iter import ilen
|
||||||
from supybot.utils.iter import ilen
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
"""General error for this module."""
|
"""General error for this module."""
|
||||||
|
@ -38,13 +38,8 @@ import time
|
|||||||
import select
|
import select
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import supybot.log as log
|
from .. import (conf, drivers, log, schedule, utils, world)
|
||||||
import supybot.conf as conf
|
from ..utils.iter import imap
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.world as world
|
|
||||||
import supybot.drivers as drivers
|
|
||||||
import supybot.schedule as schedule
|
|
||||||
from supybot.utils.iter import imap
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
|
@ -28,10 +28,7 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
###
|
###
|
||||||
|
|
||||||
import supybot.log as log
|
from .. import conf, drivers, ircmsgs, log
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.drivers as drivers
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
|
|
||||||
from twisted.names import client
|
from twisted.names import client
|
||||||
from twisted.internet import reactor, error
|
from twisted.internet import reactor, error
|
||||||
|
@ -36,10 +36,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import supybot.conf as conf
|
from .. import conf, ircmsgs, log as supylog, utils
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.log as supylog
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
|
|
||||||
_drivers = {}
|
_drivers = {}
|
||||||
_deadDrivers = []
|
_deadDrivers = []
|
||||||
|
12
src/ircdb.py
12
src/ircdb.py
@ -28,20 +28,12 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
###
|
###
|
||||||
|
|
||||||
from __future__ import division
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
import supybot.log as log
|
from . import conf, ircutils, log, registry, unpreserve, utils, world
|
||||||
import supybot.conf as conf
|
from .utils.iter import imap, ilen, ifilter
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.world as world
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.registry as registry
|
|
||||||
import supybot.unpreserve as unpreserve
|
|
||||||
from utils.iter import imap, ilen, ifilter
|
|
||||||
|
|
||||||
def isCapability(capability):
|
def isCapability(capability):
|
||||||
return len(capability.split(None, 1)) == 1
|
return len(capability.split(None, 1)) == 1
|
||||||
|
@ -32,17 +32,10 @@ import copy
|
|||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import supybot.log as log
|
from . import conf, ircdb, ircmsgs, ircutils, log, utils, world
|
||||||
import supybot.conf as conf
|
from .utils.str import rsplit
|
||||||
import supybot.utils as utils
|
from .utils.iter import imap, chain, cycle
|
||||||
import supybot.world as world
|
from .utils.structures import queue, smallqueue, RingBuffer
|
||||||
import supybot.ircdb as ircdb
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
|
|
||||||
from utils.str import rsplit
|
|
||||||
from utils.iter import imap, chain, cycle
|
|
||||||
from utils.structures import queue, smallqueue, RingBuffer
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# The base class for a callback to be registered with an Irc object. Shows
|
# The base class for a callback to be registered with an Irc object. Shows
|
||||||
|
@ -38,10 +38,8 @@ object (which, as you'll read later, is quite...full-featured :))
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import supybot.conf as conf
|
from . import conf, ircutils, utils
|
||||||
import supybot.utils as utils
|
from .utils.iter import all
|
||||||
from supybot.utils.iter import all
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# IrcMsg class -- used for representing IRC messages acquired from a network.
|
# IrcMsg class -- used for representing IRC messages acquired from a network.
|
||||||
|
@ -42,7 +42,7 @@ import string
|
|||||||
import textwrap
|
import textwrap
|
||||||
from cStringIO import StringIO as sio
|
from cStringIO import StringIO as sio
|
||||||
|
|
||||||
import supybot.utils as utils
|
from . import utils
|
||||||
|
|
||||||
def debug(s, *args):
|
def debug(s, *args):
|
||||||
"""Prints a debug string. Most likely replaced by our logging debug."""
|
"""Prints a debug string. Most likely replaced by our logging debug."""
|
||||||
|
@ -37,12 +37,7 @@ import operator
|
|||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import supybot.ansi as ansi
|
from . import ansi, conf, ircutils, registry, utils
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.registry as registry
|
|
||||||
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
|
|
||||||
deadlyExceptions = [KeyboardInterrupt, SystemExit]
|
deadlyExceptions = [KeyboardInterrupt, SystemExit]
|
||||||
|
|
||||||
|
@ -33,10 +33,7 @@ import imp
|
|||||||
import os.path
|
import os.path
|
||||||
import linecache
|
import linecache
|
||||||
|
|
||||||
import supybot.log as log
|
from . import callbacks, conf, log, registry
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.registry as registry
|
|
||||||
import supybot.callbacks as callbacks
|
|
||||||
|
|
||||||
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
installDir = os.path.dirname(sys.modules[__name__].__file__)
|
||||||
_pluginsDir = os.path.join(installDir, 'plugins')
|
_pluginsDir = os.path.join(installDir, 'plugins')
|
||||||
|
@ -35,8 +35,7 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
from getpass import getpass as getPass
|
from getpass import getpass as getPass
|
||||||
|
|
||||||
import supybot.ansi as ansi
|
from . import ansi, utils
|
||||||
import supybot.utils as utils
|
|
||||||
|
|
||||||
useBold = False
|
useBold = False
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import time
|
|||||||
import string
|
import string
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import supybot.utils as utils
|
from . import utils
|
||||||
|
|
||||||
def error(s):
|
def error(s):
|
||||||
"""Replace me with something better from another module!"""
|
"""Replace me with something better from another module!"""
|
||||||
|
@ -36,9 +36,7 @@ import time
|
|||||||
import heapq
|
import heapq
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
import supybot.log as log
|
from . import drivers, log, world
|
||||||
import supybot.world as world
|
|
||||||
import supybot.drivers as drivers
|
|
||||||
|
|
||||||
class mytuple(tuple):
|
class mytuple(tuple):
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
|
14
src/test.py
14
src/test.py
@ -37,18 +37,8 @@ import shutil
|
|||||||
import unittest
|
import unittest
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import supybot.log as log
|
from . import (callbacks, conf, drivers, ircdb, irclib, ircmsgs, ircutils, log,
|
||||||
import supybot.conf as conf
|
plugin, registry, utils, world)
|
||||||
import supybot.utils as utils
|
|
||||||
import supybot.ircdb as ircdb
|
|
||||||
import supybot.world as world
|
|
||||||
import supybot.irclib as irclib
|
|
||||||
import supybot.plugin as plugin
|
|
||||||
import supybot.drivers as drivers
|
|
||||||
import supybot.ircmsgs as ircmsgs
|
|
||||||
import supybot.registry as registry
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.callbacks as callbacks
|
|
||||||
|
|
||||||
network = True
|
network = True
|
||||||
|
|
||||||
|
@ -96,16 +96,7 @@ if sys.version_info < (2, 4, 0):
|
|||||||
|
|
||||||
# These imports need to happen below the block above, so things get put into
|
# These imports need to happen below the block above, so things get put into
|
||||||
# __builtins__ appropriately.
|
# __builtins__ appropriately.
|
||||||
from gen import *
|
from .gen import *
|
||||||
import net
|
from . import crypt, error, file, iter, net, python, seq, str, transaction, web
|
||||||
import seq
|
|
||||||
import str
|
|
||||||
import web
|
|
||||||
import file
|
|
||||||
import iter
|
|
||||||
import crypt
|
|
||||||
import error
|
|
||||||
import python
|
|
||||||
import transaction
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
@ -34,9 +34,8 @@ import random
|
|||||||
import shutil
|
import shutil
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from iter import ifilter
|
from . import crypt
|
||||||
|
from .iter import ifilter
|
||||||
import crypt
|
|
||||||
|
|
||||||
def contents(filename):
|
def contents(filename):
|
||||||
return file(filename).read()
|
return file(filename).read()
|
||||||
|
@ -38,11 +38,10 @@ import textwrap
|
|||||||
import UserDict
|
import UserDict
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from str import format
|
from . import crypt
|
||||||
from file import mktemp
|
from .str import format
|
||||||
from iter import imap, all
|
from .file import mktemp
|
||||||
|
from .iter import imap, all
|
||||||
import crypt
|
|
||||||
|
|
||||||
def abbrev(strings, d=None):
|
def abbrev(strings, d=None):
|
||||||
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""
|
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""
|
||||||
|
@ -38,8 +38,8 @@ import sys
|
|||||||
import string
|
import string
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from iter import all, any
|
from .iter import all, any
|
||||||
from structures import TwoWayDictionary
|
from .structures import TwoWayDictionary
|
||||||
|
|
||||||
curry = new.instancemethod
|
curry = new.instancemethod
|
||||||
chars = string.maketrans('', '')
|
chars = string.maketrans('', '')
|
||||||
|
@ -35,9 +35,7 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import error
|
from . import error, file as File, python
|
||||||
import python
|
|
||||||
import file as File
|
|
||||||
|
|
||||||
# 'txn' is used as an abbreviation for 'transaction' in the following source.
|
# 'txn' is used as an abbreviation for 'transaction' in the following source.
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ try:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from str import normalizeWhitespace
|
from .str import normalizeWhitespace
|
||||||
|
|
||||||
Request = urllib2.Request
|
Request = urllib2.Request
|
||||||
urlquote = urllib.quote
|
urlquote = urllib.quote
|
||||||
|
@ -43,11 +43,7 @@ if sys.version_info >= (2, 5, 0):
|
|||||||
else:
|
else:
|
||||||
import sre
|
import sre
|
||||||
|
|
||||||
import supybot.log as log
|
from . import conf, drivers, ircutils, log, registry
|
||||||
import supybot.conf as conf
|
|
||||||
import supybot.drivers as drivers
|
|
||||||
import supybot.ircutils as ircutils
|
|
||||||
import supybot.registry as registry
|
|
||||||
|
|
||||||
startedAt = time.time() # Just in case it doesn't get set later.
|
startedAt = time.time() # Just in case it doesn't get set later.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user