Use relative imports for all packages under the supybot namespace

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2012-09-17 22:12:11 -04:00
parent b1552ced11
commit cef93a6cfd
27 changed files with 47 additions and 144 deletions

View File

@ -41,15 +41,8 @@ import os.path
import UserDict
import threading
import supybot.log as log
import supybot.dbi as dbi
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
from .. import callbacks, conf, dbi, ircdb, ircutils, log, utils, world
from ..commands import *
try:
# We need to sweep away all that mx.* crap because our code doesn't account

View File

@ -32,7 +32,7 @@ import sys
import os.path
import dynamicScope
import supybot.utils as utils
from . import utils
__builtins__['format'] = utils.str.format

View File

@ -32,8 +32,6 @@
This module contains the basic callbacks for handling PRIVMSGs.
"""
import supybot
import re
import copy
import time
@ -43,16 +41,9 @@ import inspect
import operator
from cStringIO import StringIO
import supybot.log as log
import supybot.conf as conf
import supybot.utils as utils
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
from . import (conf, ircdb, irclib, ircmsgs, ircutils, log, registry, utils,
world)
from .utils.iter import any, all
def _addressed(nick, msg, prefixChars=None, nicks=None,
prefixStrings=None, whenAddressedByNick=None,

View File

@ -38,7 +38,7 @@ import struct
import os.path
import cPickle as pickle
import supybot.utils as utils
from . import utils
def hash(s):
"""DJB's hash function for CDB."""

View File

@ -38,15 +38,7 @@ import getopt
import inspect
import threading
import supybot.log as log
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
from . import callbacks, conf, ircdb, ircmsgs, ircutils, log, utils, world
###
# Non-arg wrappers -- these just change the behavior of a command without

View File

@ -33,14 +33,8 @@ import sys
import time
import socket
import supybot.utils as utils
import supybot.registry as registry
import supybot.ircutils as ircutils
###
# version: This should be pretty obvious.
###
from supybot.version import version
from . import ircutils, registry, utils
from .version import version
###
# *** The following variables are affected by command-line options. They are
@ -249,7 +243,7 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf):
List = ircutils.IrcSet
Value = ValidChannel
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)()
if key:
return ircmsgs.join(channel, key)
@ -856,7 +850,7 @@ registerChannelValue(supybot.databases.plugins.channelSpecific.link, 'allow',
class CDB(registry.Boolean):
def connect(self, filename):
import supybot.cdb as cdb
from . import cdb
basename = os.path.basename(filename)
journalName = supybot.directories.data.tmp.dirize(basename+'.journal')
return cdb.open(filename, 'c',

View File

@ -35,9 +35,8 @@ import os
import csv
import math
import supybot.cdb as cdb
import supybot.utils as utils
from supybot.utils.iter import ilen
from . import cdb, utils
from .utils.iter import ilen
class Error(Exception):
"""General error for this module."""

View File

@ -38,13 +38,8 @@ import time
import select
import socket
import supybot.log as log
import supybot.conf as conf
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
from .. import (conf, drivers, log, schedule, utils, world)
from ..utils.iter import imap
try:
import ssl

View File

@ -28,10 +28,7 @@
# POSSIBILITY OF SUCH DAMAGE.
###
import supybot.log as log
import supybot.conf as conf
import supybot.drivers as drivers
import supybot.ircmsgs as ircmsgs
from .. import conf, drivers, ircmsgs, log
from twisted.names import client
from twisted.internet import reactor, error

View File

@ -36,10 +36,7 @@ import sys
import time
import socket
import supybot.conf as conf
import supybot.utils as utils
import supybot.log as supylog
import supybot.ircmsgs as ircmsgs
from .. import conf, ircmsgs, log as supylog, utils
_drivers = {}
_deadDrivers = []

View File

@ -28,20 +28,12 @@
# POSSIBILITY OF SUCH DAMAGE.
###
from __future__ import division
import os
import time
import operator
import supybot.log as log
import supybot.conf as conf
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
from . import conf, ircutils, log, registry, unpreserve, utils, world
from .utils.iter import imap, ilen, ifilter
def isCapability(capability):
return len(capability.split(None, 1)) == 1

View File

@ -32,17 +32,10 @@ import copy
import time
import random
import supybot.log as log
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
from utils.str import rsplit
from utils.iter import imap, chain, cycle
from utils.structures import queue, smallqueue, RingBuffer
from . import conf, ircdb, ircmsgs, ircutils, log, utils, world
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

View File

@ -38,10 +38,8 @@ object (which, as you'll read later, is quite...full-featured :))
import re
import time
import supybot.conf as conf
import supybot.utils as utils
from supybot.utils.iter import all
import supybot.ircutils as ircutils
from . import conf, ircutils, utils
from .utils.iter import all
###
# IrcMsg class -- used for representing IRC messages acquired from a network.

View File

@ -42,7 +42,7 @@ import string
import textwrap
from cStringIO import StringIO as sio
import supybot.utils as utils
from . import utils
def debug(s, *args):
"""Prints a debug string. Most likely replaced by our logging debug."""

View File

@ -37,12 +37,7 @@ import operator
import textwrap
import traceback
import supybot.ansi as ansi
import supybot.conf as conf
import supybot.utils as utils
import supybot.registry as registry
import supybot.ircutils as ircutils
from . import ansi, conf, ircutils, registry, utils
deadlyExceptions = [KeyboardInterrupt, SystemExit]

View File

@ -33,10 +33,7 @@ import imp
import os.path
import linecache
import supybot.log as log
import supybot.conf as conf
import supybot.registry as registry
import supybot.callbacks as callbacks
from . import callbacks, conf, log, registry
installDir = os.path.dirname(sys.modules[__name__].__file__)
_pluginsDir = os.path.join(installDir, 'plugins')

View File

@ -35,8 +35,7 @@ import sys
import textwrap
from getpass import getpass as getPass
import supybot.ansi as ansi
import supybot.utils as utils
from . import ansi, utils
useBold = False

View File

@ -34,7 +34,7 @@ import time
import string
import textwrap
import supybot.utils as utils
from . import utils
def error(s):
"""Replace me with something better from another module!"""

View File

@ -36,9 +36,7 @@ import time
import heapq
from threading import Lock
import supybot.log as log
import supybot.world as world
import supybot.drivers as drivers
from . import drivers, log, world
class mytuple(tuple):
def __cmp__(self, other):

View File

@ -37,18 +37,8 @@ import shutil
import unittest
import threading
import supybot.log as log
import supybot.conf as conf
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
from . import (callbacks, conf, drivers, ircdb, irclib, ircmsgs, ircutils, log,
plugin, registry, utils, world)
network = True

View File

@ -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
# __builtins__ appropriately.
from gen import *
import net
import seq
import str
import web
import file
import iter
import crypt
import error
import python
import transaction
from .gen import *
from . import crypt, error, file, iter, net, python, seq, str, transaction, web
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -34,9 +34,8 @@ import random
import shutil
import os.path
from iter import ifilter
import crypt
from . import crypt
from .iter import ifilter
def contents(filename):
return file(filename).read()

View File

@ -38,11 +38,10 @@ import textwrap
import UserDict
import traceback
from str import format
from file import mktemp
from iter import imap, all
import crypt
from . import crypt
from .str import format
from .file import mktemp
from .iter import imap, all
def abbrev(strings, d=None):
"""Returns a dictionary mapping unambiguous abbreviations to full forms."""

View File

@ -38,8 +38,8 @@ import sys
import string
import textwrap
from iter import all, any
from structures import TwoWayDictionary
from .iter import all, any
from .structures import TwoWayDictionary
curry = new.instancemethod
chars = string.maketrans('', '')

View File

@ -35,9 +35,7 @@ import os
import shutil
import os.path
import error
import python
import file as File
from . import error, file as File, python
# 'txn' is used as an abbreviation for 'transaction' in the following source.

View File

@ -43,7 +43,7 @@ try:
except AttributeError:
pass
from str import normalizeWhitespace
from .str import normalizeWhitespace
Request = urllib2.Request
urlquote = urllib.quote

View File

@ -43,11 +43,7 @@ if sys.version_info >= (2, 5, 0):
else:
import sre
import supybot.log as log
import supybot.conf as conf
import supybot.drivers as drivers
import supybot.ircutils as ircutils
import supybot.registry as registry
from . import conf, drivers, ircutils, log, registry
startedAt = time.time() # Just in case it doesn't get set later.