Changed fix.py to munge __builtins__ rather than requiring a "from fix import *" statement.

This commit is contained in:
Jeremy Fincher 2003-10-05 12:47:19 +00:00
parent 5576661ab5
commit 970c819e79
22 changed files with 55 additions and 30 deletions

View File

@ -34,7 +34,7 @@ These are commands useful for administrating the bot; they all require their
caller to have the 'admin' capability. This plugin is loaded by default. caller to have the 'admin' capability. This plugin is loaded by default.
""" """
from fix import * import fix
import time import time
import pprint import pprint

View File

@ -33,7 +33,7 @@
Miscellaneous commands. Miscellaneous commands.
""" """
from fix import * import fix
import os import os
import sys import sys

View File

@ -34,7 +34,7 @@ Provides commands useful to the owner of the bot; the commands here require
their caller to have the 'owner' capability. This plugin is loaded by default. their caller to have the 'owner' capability. This plugin is loaded by default.
""" """
from fix import * import fix
import gc import gc
import imp import imp

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
import re import re
import sys import sys

View File

@ -1,15 +1,38 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys ###
# Copyright (c) 2002, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the author of this software nor the name of
# contributors to this software may be used to endorse or promote products
# derived from this software without specific prior written consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
###
if 'sys' not in sys.path: import fix
sys.path.insert(0, 'src')
if 'others' not in sys.path:
sys.path.insert(0, 'others')
from fix import *
import os import os
import sys
import sets import sets
import time import time
import urllib2 import urllib2
@ -23,7 +46,7 @@ import utils
import world import world
import ircutils import ircutils
__all__ = fix.__all__ + ['ChannelDBHandler', 'PeriodicFileDownloader'] __all__ = ['ChannelDBHandler', 'PeriodicFileDownloader']
class ChannelDBHandler(object): class ChannelDBHandler(object):
"""A class to handle database stuff for individual channels transparently. """A class to handle database stuff for individual channels transparently.

View File

@ -38,7 +38,7 @@ PrivmsgRegexp class. Read their respective docstrings for more information on
how to use them. how to use them.
""" """
from fix import * import fix
import re import re
import sets import sets

View File

@ -34,7 +34,7 @@ Database module, similar to dbhash. Uses a format similar to (if not entirely
the same as) DJB's CDB <http://cr.yp.to/cdb.html>. the same as) DJB's CDB <http://cr.yp.to/cdb.html>.
""" """
from fix import * import fix
import os import os
import sys import sys

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
import sys import sys

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
import sys import sys

View File

@ -33,7 +33,7 @@
Contains various drivers (network, file, and otherwise) for using IRC objects. Contains various drivers (network, file, and otherwise) for using IRC objects.
""" """
from fix import * import fix
import re import re
import os import os

View File

@ -29,8 +29,6 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
## from __future__ import generators
""" """
Fixes stuff that Python should have but doesn't. Fixes stuff that Python should have but doesn't.
""" """
@ -131,5 +129,9 @@ def rsplit(s, sep=None, maxsplit=-1):
L.reverse() L.reverse()
return [s[::-1] for s in L] return [s[::-1] for s in L]
for name in __all__:
__builtins__[name] = globals()[name]
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
import os import os
import sets import sets

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
from structures import queue, RingBuffer from structures import queue, RingBuffer
import copy import copy

View File

@ -36,7 +36,7 @@ construct such messages in an easier way than the constructor for the IrcMsg
object (which, as you'll read later, is quite...full-featured :)) object (which, as you'll read later, is quite...full-featured :))
""" """
from fix import * import fix
import re import re
import string import string

View File

@ -36,7 +36,7 @@ nick class to handle nicks (so comparisons and hashing and whatnot work in an
IRC-case-insensitive fashion), and numerous other things. IRC-case-insensitive fashion), and numerous other things.
""" """
from fix import * import fix
import re import re
import sets import sets

View File

@ -33,7 +33,7 @@
Includes various accessories for callbacks.Privmsg based callbacks. Includes various accessories for callbacks.Privmsg based callbacks.
""" """
from fix import * import fix
import new import new

View File

@ -34,7 +34,7 @@ Schedule plugin with a subclass of drivers.IrcDriver in order to be run as a
Supybot driver. Supybot driver.
""" """
from fix import * import fix
import time import time
import heapq import heapq

View File

@ -35,7 +35,7 @@ Contains simple socket drivers. Asyncore bugged (haha, pun!) me.
from __future__ import division from __future__ import division
from fix import * import fix
import time import time
import socket import socket

View File

@ -35,7 +35,7 @@ Data structures for Python.
## from __future__ import generators ## from __future__ import generators
from fix import * import fix
import types import types

View File

@ -29,7 +29,7 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
from fix import * import fix
import time import time

View File

@ -35,7 +35,7 @@ Simple utility functions.
## from __future__ import generators ## from __future__ import generators
from fix import * import fix
import os import os
import re import re

View File

@ -33,7 +33,7 @@
Module for general worldly stuff, like global variables and whatnot. Module for general worldly stuff, like global variables and whatnot.
""" """
from fix import * import fix
import os import os
import gc import gc