PyChecker updates.

This commit is contained in:
Jeremy Fincher 2004-08-10 22:09:23 +00:00
parent 3f5cac26b8
commit 6bd8d43c28
2 changed files with 3 additions and 11 deletions

View File

@ -41,14 +41,7 @@ __revision__ = "$Id$"
import supybot.fix as fix import supybot.fix as fix
import re import re
import copy
import sets
import time
import random
import socket
import string import string
import fnmatch
import operator
import textwrap import textwrap
from itertools import imap from itertools import imap
from cStringIO import StringIO as sio from cStringIO import StringIO as sio
@ -216,7 +209,6 @@ def separateModes(args):
assert modes[0] in '+-', 'Invalid args: %r' % args assert modes[0] in '+-', 'Invalid args: %r' % args
args = list(args[1:]) args = list(args[1:])
ret = [] ret = []
length = len(modes)
for c in modes: for c in modes:
if c in '+-': if c in '+-':
last = c last = c

View File

@ -403,7 +403,8 @@ def sortBy(f, L):
def sorted(iterable, cmp=None, key=None, reversed=False): def sorted(iterable, cmp=None, key=None, reversed=False):
L = list(iterable) L = list(iterable)
if key is not None: if key is not None:
sortBy(key, L, cmp=cmp) assert cmp is not None, 'Can\'t use both cmp and key.'
sortBy(key, L)
else: else:
L.sort(cmp) L.sort(cmp)
if reversed: if reversed:
@ -568,7 +569,6 @@ def getSocket(host):
else: else:
raise socket.error, 'Something wonky happened.' raise socket.error, 'Something wonky happened.'
_ipchars = string.digits + '.'
def isIP(s): def isIP(s):
"""Returns whether or not a given string is an IPV4 address. """Returns whether or not a given string is an IPV4 address.
@ -726,7 +726,7 @@ def transactionalFile(*args, **kwargs):
return AtomicFile(*args, **kwargs) return AtomicFile(*args, **kwargs)
if __name__ == '__main__': if __name__ == '__main__':
import sys, doctest import doctest
doctest.testmod(sys.modules['__main__']) doctest.testmod(sys.modules['__main__'])