core: Remove useless imports.

This commit is contained in:
Valentin Lorentz 2015-03-03 09:02:29 +01:00
parent 72e71edb89
commit 4470805b5f
12 changed files with 6 additions and 21 deletions

View File

@ -28,8 +28,6 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
### ###
import sys
import os.path
import dynamicScope import dynamicScope
from . import utils from . import utils

View File

@ -41,7 +41,6 @@ import shlex
import codecs import codecs
import getopt import getopt
import inspect import inspect
import operator
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
# cStringIO is buggy with Python 2.6 ( # cStringIO is buggy with Python 2.6 (

View File

@ -184,7 +184,6 @@ class Reader(utils.IterableMap):
"""Class for reading from a CDB database.""" """Class for reading from a CDB database."""
def __init__(self, filename): def __init__(self, filename):
self.filename = filename self.filename = filename
import os
self.fd = open(filename, 'rb') self.fd = open(filename, 'rb')
self.loop = 0 self.loop = 0
self.khash = 0 self.khash = 0

View File

@ -34,12 +34,10 @@ Includes wrappers for commands.
import time import time
import Queue import Queue
import types
import getopt import getopt
import inspect import inspect
import threading import threading
import multiprocessing #python2.6 or later! import multiprocessing #python2.6 or later!
import Queue
try: try:
import resource import resource

View File

@ -35,12 +35,8 @@ import os
import sys import sys
import cgi import cgi
import socket import socket
from threading import Event, Thread from threading import Thread
from cStringIO import StringIO
from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
# For testing purposes
from SocketServer import StreamRequestHandler
import supybot.log as log import supybot.log as log
import supybot.conf as conf import supybot.conf as conf

View File

@ -34,11 +34,8 @@ Supybot internationalisation and localisation managment.
__all__ = ['PluginInternationalization', 'internationalizeDocstring'] __all__ = ['PluginInternationalization', 'internationalizeDocstring']
import os import os
import re
import sys import sys
import time
import weakref import weakref
import threading
conf = None conf = None
# Don't import conf here ; because conf needs this module # Don't import conf here ; because conf needs this module

View File

@ -34,7 +34,6 @@ import time
import operator import operator
from . import conf, ircutils, log, registry, unpreserve, utils, world from . import conf, ircutils, log, registry, unpreserve, utils, world
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

View File

@ -41,7 +41,7 @@ except ImportError:
from . import conf, ircdb, ircmsgs, ircutils, log, utils, world from . import conf, ircdb, ircmsgs, ircutils, log, utils, world
from .utils.str import rsplit from .utils.str import rsplit
from .utils.iter import imap, chain, cycle from .utils.iter import chain
from .utils.structures import queue, smallqueue, RingBuffer from .utils.structures import queue, smallqueue, RingBuffer
### ###
@ -481,7 +481,7 @@ class IrcState(IrcCommandDispatcher):
converter = self._005converters.get(name, lambda x: x) converter = self._005converters.get(name, lambda x: x)
try: try:
self.supported[name] = converter(value) self.supported[name] = converter(value)
except Exception as e: except Exception:
log.exception('Uncaught exception in 005 converter:') log.exception('Uncaught exception in 005 converter:')
log.error('Name: %s, Converter: %s', name, converter) log.error('Name: %s, Converter: %s', name, converter)
else: else:

View File

@ -741,6 +741,6 @@ def standardSubstitute(irc, msg, text, env=None):
return t.safe_substitute(vars) return t.safe_substitute(vars)
if __name__ == '__main__': if __name__ == '__main__':
import sys, doctest import doctest
doctest.testmod(sys.modules['__main__']) doctest.testmod(sys.modules['__main__'])
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -144,7 +144,7 @@ def close(registry, filename, private=True):
else: else:
s = 'CENSORED' s = 'CENSORED'
fd.write('%s: %s\n' % (name, s)) fd.write('%s: %s\n' % (name, s))
except Exception as e: except Exception:
exception('Exception printing value:') exception('Exception printing value:')
fd.close() fd.close()

View File

@ -508,7 +508,6 @@ httpserver.http_servers = [httpserver.TestSupyHTTPServer()]
# Partially stolen from the standard Python library :) # Partially stolen from the standard Python library :)
def open_http(url, data=None): def open_http(url, data=None):
"""Use HTTP protocol.""" """Use HTTP protocol."""
import httplib
user_passwd = None user_passwd = None
proxy_passwd= None proxy_passwd= None
if isinstance(url, str): if isinstance(url, str):

View File

@ -118,7 +118,7 @@ def flush():
for (i, f) in enumerate(flushers): for (i, f) in enumerate(flushers):
try: try:
f() f()
except Exception as e: except Exception:
log.exception('Uncaught exception in flusher #%s (%s):', i, f) log.exception('Uncaught exception in flusher #%s (%s):', i, f)
def debugFlush(s=''): def debugFlush(s=''):