mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +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 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
|
||||
|
@ -32,7 +32,7 @@ import sys
|
||||
import os.path
|
||||
import dynamicScope
|
||||
|
||||
import supybot.utils as utils
|
||||
from . import utils
|
||||
|
||||
__builtins__['format'] = utils.str.format
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
|
14
src/conf.py
14
src/conf.py
@ -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',
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 = []
|
||||
|
12
src/ircdb.py
12
src/ircdb.py
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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."""
|
||||
|
@ -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]
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
||||
|
@ -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!"""
|
||||
|
@ -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):
|
||||
|
14
src/test.py
14
src/test.py
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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()
|
||||
|
@ -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."""
|
||||
|
@ -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('', '')
|
||||
|
@ -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.
|
||||
|
||||
|
@ -43,7 +43,7 @@ try:
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
from str import normalizeWhitespace
|
||||
from .str import normalizeWhitespace
|
||||
|
||||
Request = urllib2.Request
|
||||
urlquote = urllib.quote
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user