rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
String = group("'" + group('[\].', "[^\n'\]") + "*'", '"' + group('[\].', '[^\n"\]') + '*"')
String = group("'" + group("[^\n'\]", "[\].") + "*'", '"' + group('[^\n"\]', '[\].') + '*"')
def group(*choices): return '\(' + string.join(choices, '\|') + '\)'
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
contstr = ''
contstr, needcont = '', 0
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
if not line: raise TokenError, "EOF within multi-line string" if endprog.search(line) >= 0:
if not line: raise TokenError, ("EOF in multi-line string", strstart) if endprog.match(line) >= 0:
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
if pos == max: break
if pos == max: break
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
tokeneater(DEDENT, line[:pos], (lnum, 0), (lnum, pos), line)
tokeneater(DEDENT, '', (lnum, pos), (lnum, pos), line)
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
if not line: raise TokenError, "EOF within multi-line statement"
if not line: raise TokenError, ("EOF in multi-line statement", (lnum, 0))
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
spos, epos = (lnum, start), (lnum, end)
spos, epos, pos = (lnum, start), (lnum, end), end
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
pos = end
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
elif initial in numchars:
elif initial in numchars \ or (initial == '.' and token != '.'):
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
if endprog.search(line, pos) >= 0:
if endprog.match(line, pos) >= 0:
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
endprog, contstr = endprogs[initial], line[start:]
endprog = endprogs[initial] contstr, needcont = line[start:], 1
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
tokeneater(ERRORTOKEN, line[pos], spos, (lnum, pos+1), line)
tokeneater(ERRORTOKEN, line[pos], (lnum, pos), (lnum, pos+1), line)
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
tokenize(open(sys.argv[-1]).readline)
if len(sys.argv) > 1: tokenize(open(sys.argv[1]).readline) else: tokenize(syss.tdin.readline)
def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr = '' indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: ...
de65527e4b0925692f0d75f388116b7958a390bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de65527e4b0925692f0d75f388116b7958a390bb/tokenize.py
value = unicode(value[2], value[0]).encode("ascii")
param += '*' value = Utils.encode_rfc2231(value[2], value[0], value[1])
def _formatparam(param, value=None, quote=1): """Convenience function to format and return a key=value pair. This will quote the value if needed or if quote is true. """ if value is not None and len(value) > 0: # TupleType is used for RFC 2231 encoded parameter values where items # are (charset, language, value). cha...
3c25535dc81492b8f703056dbd3b9685db4ca936 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c25535dc81492b8f703056dbd3b9685db4ca936/Message.py
def set_param(self, param, value, header='Content-Type', requote=1):
def set_param(self, param, value, header='Content-Type', requote=1, charset=None, language=''):
def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header.
3c25535dc81492b8f703056dbd3b9685db4ca936 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c25535dc81492b8f703056dbd3b9685db4ca936/Message.py
"""
If charset is specified the parameter will be encoded according to RFC 2231. In this case language is optional. """ if not isinstance(value, TupleType) and charset: value = (charset, language, value)
def set_param(self, param, value, header='Content-Type', requote=1): """Set a parameter in the Content-Type: header.
3c25535dc81492b8f703056dbd3b9685db4ca936 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c25535dc81492b8f703056dbd3b9685db4ca936/Message.py
w.ide_radio = W.RadioButton((8, 22, 160, 18), "This application", radiobuttons, self.ide_hit) w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython Interpreter", radiobuttons, self.interp_hit) w.interpx_radio = W.RadioButton((8, 62, 160, 18), "OSX PythonW Interpreter", radiobuttons, self.interpx_hit)
w.ide_radio = W.RadioButton((8, 22, 160, 18), "PythonIDE", radiobuttons, self.ide_hit) w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython-OS9 Interpreter", radiobuttons, self.interp_hit) w.interpx_radio = W.RadioButton((8, 62, 160, 18), "PythonLauncher", radiobuttons, self.interpx_hit)
def __init__(self, creator, eoln): self.rv = None self.eoln = eoln self.w = w = W.ModalDialog((260, 160), 'Save options') radiobuttons = [] w.label = W.TextBox((8, 8, 80, 18), "File creator:") w.ide_radio = W.RadioButton((8, 22, 160, 18), "This application", radiobuttons, self.ide_hit) w.interp_radio = W.RadioButton((8...
0701bd64aaf5eacafa7b18f0e67273ed75943a8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0701bd64aaf5eacafa7b18f0e67273ed75943a8b/PyEdit.py
self._charset = 'iso-8859-1'
self._charset = None
def __init__(self, fp=None): self._info = {} self._charset = 'iso-8859-1' self._fallback = None if fp is not None: self._parse(fp)
6008cbd4c2b5b4f5e9941f312804e12c88aa6efe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6008cbd4c2b5b4f5e9941f312804e12c88aa6efe/gettext.py
if msg.find('\x00') >= 0: msgid1, msgid2 = msg.split('\x00') tmsg = tmsg.split('\x00') if self._coerce: msgid1 = unicode(msgid1, self._charset) tmsg = [unicode(x, self._charset) for x in tmsg] for i in range(len(tmsg)): catalog[(msgid1, i)] = tmsg[i] else: if self._coerce: msg = unicode(msg, self._charset) tmsg = unic...
def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} self.plural = lambda n: int(n != 1) # germanic plural by default buf ...
6008cbd4c2b5b4f5e9941f312804e12c88aa6efe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6008cbd4c2b5b4f5e9941f312804e12c88aa6efe/gettext.py
if mlen == 0 and tmsg.lower().startswith('project-id-version:'):
if mlen == 0:
def _parse(self, fp): """Override this method to support alternative .mo formats.""" unpack = struct.unpack filename = getattr(fp, 'name', '') # Parse the .mo file header, which consists of 5 little endian 32 # bit words. self._catalog = catalog = {} self.plural = lambda n: int(n != 1) # germanic plural by default buf ...
6008cbd4c2b5b4f5e9941f312804e12c88aa6efe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6008cbd4c2b5b4f5e9941f312804e12c88aa6efe/gettext.py
print set
def __init__(self, set):
65c28b7efb290f5eadf538f14514c9a48bb0f1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65c28b7efb290f5eadf538f14514c9a48bb0f1d7/re.py
if pattern[index] == 'iI':
if pattern[index] in 'iI':
def compile(pattern, flags=0): stack = [] index = 0 label = 0 register = 1 groupindex = {} callouts = [] while (index < len(pattern)): char = pattern[index] index = index + 1 if char == '\\': if index < len(pattern): next = pattern[index] index = index + 1 if next == 't': stack.append([Exact(chr(9))]) elif next == 'n'...
65c28b7efb290f5eadf538f14514c9a48bb0f1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65c28b7efb290f5eadf538f14514c9a48bb0f1d7/re.py
elif pattern[index] == 'mM':
elif pattern[index] in 'mM':
def compile(pattern, flags=0): stack = [] index = 0 label = 0 register = 1 groupindex = {} callouts = [] while (index < len(pattern)): char = pattern[index] index = index + 1 if char == '\\': if index < len(pattern): next = pattern[index] index = index + 1 if next == 't': stack.append([Exact(chr(9))]) elif next == 'n'...
65c28b7efb290f5eadf538f14514c9a48bb0f1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65c28b7efb290f5eadf538f14514c9a48bb0f1d7/re.py
elif pattern[index] == 'sS':
elif pattern[index] in 'sS':
def compile(pattern, flags=0): stack = [] index = 0 label = 0 register = 1 groupindex = {} callouts = [] while (index < len(pattern)): char = pattern[index] index = index + 1 if char == '\\': if index < len(pattern): next = pattern[index] index = index + 1 if next == 't': stack.append([Exact(chr(9))]) elif next == 'n'...
65c28b7efb290f5eadf538f14514c9a48bb0f1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65c28b7efb290f5eadf538f14514c9a48bb0f1d7/re.py
def bind(self, sequence=None, command=None):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def bind(self, sequence=None, command=None):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
class Bottom: """A "card-like" object to serve as the bottom for some stacks. Specifically, this is used by the deck and the suit stacks. """ def __init__(self, stack): """Constructor, taking the stack as an argument. We displays ourselves as a gray rectangle the size of a playing card, positioned at the stack...
def bind(self, sequence=None, command=None):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
turnover() -- turn the card (face up or down) & raise it onclick(handler), ondouble(handler), onmove(handler), onrelease(handler) -- set various mount event handlers reset() -- move the card out of sight, face down, and reset all event handlers Public instance variables: color, suit, value -- the card's color, suit a...
Public read-only instance variables: suit, value, color -- the card's suit, value and color
def __init__(self, stack):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
Semi-public instance variables (XXX should be made private):
Semi-public read-only instance variables (XXX should be made private):
def __init__(self, stack):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
is reversed.)
is reversed. The card is created face down.)
def __init__(self, stack):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def __init__(self, game, suit, value):
def __init__(self, suit, value, canvas): """Card constructor. Arguments are the card's suit and value, and the canvas widget. The card is created at position (0, 0), with its face down (adding it to a stack will position it according to that stack's rules). """
def __init__(self, game, suit, value):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.value = value canvas = game.canvas
self.face_shown = 0
def __init__(self, game, suit, value):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.__rect = Rectangle(canvas, 0, 0, CARDWIDTH, CARDHEIGHT, outline='black', fill='white') text = "%s %s" % (VALNAMES[value], suit) self.__text = CanvasText(canvas, CARDWIDTH/2, 0, anchor=N, fill=self.color, text=text) self.group = Group(canvas)
def __init__(self, game, suit, value):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.group.addtag_withtag(self.__rect) self.group.addtag_withtag(self.__text) self.reset()
def __init__(self, game, suit, value):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
return "Card(game, %s, %s)" % (`self.suit`, `self.value`)
"""Return a string for debug print statements.""" return "Card(%s, %s)" % (`self.suit`, `self.value`)
def __repr__(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
dx = x - self.x dy = y - self.y
"""Move the card to absolute position (x, y).""" self.moveby(x - self.x, y - self.y) def moveby(self, dx, dy): """Move the card by (dx, dy).""" self.x = self.x + dx self.y = self.y + dy
def moveto(self, x, y):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.x = x self.y = y def moveby(self, dx, dy): self.moveto(self.x + dx, self.y + dy)
def moveto(self, x, y):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def turnover(self): if self.face_shown: self.showback()
class Stack: """A generic stack of cards. This is used as a base class for all other stacks (e.g. the deck, the suit stacks, and the row stacks). Public methods: add(card) -- add a card to the stack delete(card) -- delete a card from the stack showtop() -- show the top card (if any) face up deal() -- delete and re...
def turnover(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.showface() def onclick(self, handler): self.group.bind('<1>', handler) def ondouble(self, handler): self.group.bind('<Double-1>', handler) def onmove(self, handler): self.group.bind('<B1-Motion>', handler) def onrelease(self, handler): self.group.bind('<ButtonRelease-1>', handler) def reset(self): self.moveto...
return if not card.face_shown: return self.moving = self.cards[i:] self.lastx = event.x self.lasty = event.y for card in self.moving: card.tkraise() def keepmoving(self, event): if not self.moving: return dx = event.x - self.lastx dy = event.y - self.lasty self.lastx = event.x self.lasty = event.y if dx or dy: for car...
def turnover(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.allcards.append(Card(self.game, suit, value)) self.reset()
self.add(Card(suit, value, self.game.canvas))
def __init__(self, game):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def deal(self): card = self.cards[-1] del self.cards[-1] return card def accept(self, card): if card not in self.cards: self.cards.append(card) def reset(self): self.cards = self.allcards[:] for card in self.cards: card.reset()
def userclickhandler(self): opendeck = self.game.opendeck card = self.deal() if not card: while 1: card = opendeck.deal() if not card: break self.add(card) card.showback() else: self.game.opendeck.add(card) card.showface()
def deal(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
class Stack: x = MARGIN y = MARGIN def __init__(self, game): self.game = game self.cards = [] def __repr__(self): return "<Stack at (%d, %d)>" % (self.x, self.y) def reset(self): self.cards = [] def acceptable(self, cards): return 1 def accept(self, card): self.cards.append(card) card.onclick(self.clickhandler) c...
class OpenStack(Stack): def usermovehandler(self, cards): card = cards[0] stack = self.game.closeststack(card) if not stack or stack is self or not stack.acceptable(cards): Stack.usermovehandler(self, cards) else: for card in cards: self.delete(card) stack.add(card) self.game.wincheck() def userdoubleclickhandler(se...
def randperm(n): r = range(n) x = [] while r: i = random.choice(r) x.append(i) r.remove(i) return x
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.game.turned.accept(card) del self.cards[-1] card.showface() def bottomhandler(self, event): cards = self.game.turned.cards cards.reverse() for card in cards: card.showback() self.accept(card) self.game.turned.reset() class MovingStack(Stack): thecards = None theindex = None def clickhandler(self, event): self....
if not card.face_shown: self.userclickhandler()
def releasehandler(self, event):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
tag = tags[0] for i in range(len(self.cards)): card = self.cards[i] if tag == str(card.group):
for s in self.game.suits: if s.acceptable([card]): self.delete(card) s.add(card) self.game.wincheck()
def clickhandler(self, event):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
else: return self.theindex = i self.thecards = Group(self.game.canvas) for card in self.cards[i:]: self.thecards.addtag_withtag(card.group) self.thecards.tkraise() self.lastx = self.firstx = event.x self.lasty = self.firsty = event.y def movehandler(self, event): if not self.thecards: return card = self.cards[self.the...
class SuitStack(OpenStack): def makebottom(self): bottom = Rectangle(self.game.canvas, self.x, self.y, self.x+CARDWIDTH, self.y+CARDHEIGHT, outline='black', fill='') def userclickhandler(self): pass def userdoubleclickhandler(self): pass
def clickhandler(self, event):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
if not card.face_shown: return 0
def acceptable(self, cards):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
if not topcard.face_shown: return 0
def acceptable(self, cards):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def doublehandler(self, event): pass def accept(self, card): MovingStack.accept(self, card) if card.value == KING: for s in self.game.suits: card = s.cards[-1] if card.value != KING: return self.game.win() self.game.deal() class RowStack(MovingStack): def __init__(self, game, i): self.index = i self.x = MARGIN + XS...
class RowStack(OpenStack):
def doublehandler(self, event):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
if not card.face_shown: return 0
def acceptable(self, cards):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
if card.value != topcard.value - 1: return 0 if card.color == topcard.color: return 0 return 1
return card.color != topcard.color and card.value == topcard.value - 1 def position(self, card): y = self.y for c in self.cards: if c == card: break if c.face_shown: y = y + 2*MARGIN else: y = y + OFFSET card.moveto(self.x, y)
def acceptable(self, cards):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.buttonframe = Frame(self.master, background=BACKGROUND) self.buttonframe.pack(fill=X) self.dealbutton = Button(self.buttonframe,
self.canvas = Canvas(self.master, background=BACKGROUND, highlightthickness=0, width=NROWS*XSPACING, height=3*YSPACING + 20 + MARGIN) self.canvas.pack(fill=BOTH, expand=TRUE) self.dealbutton = Button(self.canvas,
def __init__(self, master):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.dealbutton.pack(side=LEFT) self.canvas = Canvas(self.master, background=BACKGROUND, highlightthickness=0, width=NROWS*XSPACING, height=3*YSPACING) self.canvas.pack(fill=BOTH, expand=TRUE) self.deck = Deck(self)
Window(self.canvas, MARGIN, 3*YSPACING + 20, window=self.dealbutton, anchor=SW) x = MARGIN y = MARGIN self.deck = Deck(x, y, self) x = x + XSPACING self.opendeck = OpenStack(x, y, self)
def __init__(self, master):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.pool = PoolStack(self) self.turned = TurnedStack(self)
x = x + XSPACING
def __init__(self, master):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.suits.append(SuitStack(self, i))
x = x + XSPACING self.suits.append(SuitStack(x, y, self)) x = MARGIN y = y + YSPACING
def __init__(self, master):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.rows.append(RowStack(self, i))
self.rows.append(RowStack(x, y, self)) x = x + XSPACING
def __init__(self, master):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
cards = self.deck.allcards
cards = [] for s in self.suits: cards = cards + s.cards if not cards: return
def win(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
def reset(self): self.pool.reset() self.turned.reset() for stack in self.rows + self.suits: stack.reset() self.deck.reset()
def reset(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
r.accept(card)
r.add(card)
def deal(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
try:
def reset(self): for stack in [self.opendeck] + self.suits + self.rows:
def deal(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
self.pool.accept(self.deck.deal()) except IndexError: pass
card = stack.deal() if not card: break self.deck.add(card) card.showback()
def deal(self):
1b2b53a25d27d96f60926802226dd375767cb3b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1b2b53a25d27d96f60926802226dd375767cb3b2/solitaire.py
port = int(host[i+1:])
try: port = int(host[i+1:]) except ValueError, msg: raise socket.error, str(msg)
def _set_hostport(self, host, port): if port is None: i = host.find(':') if i >= 0: port = int(host[i+1:]) host = host[:i] else: port = self.default_port self.host = host self.port = port
b2825205a28e743a10574d4b8df84241d98650ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2825205a28e743a10574d4b8df84241d98650ae/httplib.py
self.editFont=tkFont.Font(self,('courier',12,'normal'))
self.editFont=tkFont.Font(self,('courier',10,'normal'))
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) #self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabP...
053916959af8868715c9ce4b960c6607f6b12f12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/053916959af8868715c9ce4b960c6607f6b12f12/configDialog.py
self.fontName.set(self.listFontName.get(ANCHOR))
font = self.listFontName.get(ANCHOR) self.fontName.set(font.lower())
def OnListFontButtonRelease(self,event): self.fontName.set(self.listFontName.get(ANCHOR)) self.SetFontSample()
053916959af8868715c9ce4b960c6607f6b12f12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/053916959af8868715c9ce4b960c6607f6b12f12/configDialog.py
self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=fonts.index(configuredFont)
lc_configuredFont = configuredFont.lower() self.fontName.set(lc_configuredFont) lc_fonts = [s.lower() for s in fonts] if lc_configuredFont in lc_fonts: currentFontIndex = lc_fonts.index(lc_configuredFont)
def LoadFontCfg(self): ##base editor font selection list fonts=list(tkFont.families(self)) fonts.sort() for font in fonts: self.listFontName.insert(END,font) configuredFont=idleConf.GetOption('main','EditorWindow','font', default='courier') self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=...
053916959af8868715c9ce4b960c6607f6b12f12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/053916959af8868715c9ce4b960c6607f6b12f12/configDialog.py
default='12')
default='10')
def LoadFontCfg(self): ##base editor font selection list fonts=list(tkFont.families(self)) fonts.sort() for font in fonts: self.listFontName.insert(END,font) configuredFont=idleConf.GetOption('main','EditorWindow','font', default='courier') self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=...
053916959af8868715c9ce4b960c6607f6b12f12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/053916959af8868715c9ce4b960c6607f6b12f12/configDialog.py
typ, dat = self._simple_command('GETQUOTA', mailbox)
typ, dat = self._simple_command('GETQUOTAROOT', mailbox)
def getquotaroot(self, mailbox): """Get the list of quota roots for the named mailbox.
6a4e635beba3cad5f3d421cb92f9052151c927d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6a4e635beba3cad5f3d421cb92f9052151c927d8/imaplib.py
"""
Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other responses should be obtained via <instance>.response('FLAGS') etc. """
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
6a4e635beba3cad5f3d421cb92f9052151c927d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6a4e635beba3cad5f3d421cb92f9052151c927d8/imaplib.py
def wm_iconbitmap(self, bitmap=None):
def wm_iconbitmap(self, bitmap=None, default=None):
def wm_iconbitmap(self, bitmap=None): """Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
5ecad9ca13405d0cc4c2653435887a62e54bb673 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ecad9ca13405d0cc4c2653435887a62e54bb673/Tkinter.py
the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
the bitmap if None is given. Under Windows, the DEFAULT parameter can be used to set the icon for the widget and any descendents that don't have an icon set explicitely. DEFAULT can be the relative path to a .ico file (example: root.iconbitmap(default='myicon.ico') ). See Tk documentation for more information.""" if...
def wm_iconbitmap(self, bitmap=None): """Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.""" return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
5ecad9ca13405d0cc4c2653435887a62e54bb673 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ecad9ca13405d0cc4c2653435887a62e54bb673/Tkinter.py
"""bsdTableDB.open(filename, dbhome, create=0, truncate=0, mode=0600)
"""bsdTableDB(filename, dbhome, create=0, truncate=0, mode=0600)
def __init__(self, filename, dbhome, create=0, truncate=0, mode=0600, recover=0, dbflags=0): """bsdTableDB.open(filename, dbhome, create=0, truncate=0, mode=0600) Open database name in the dbhome BerkeleyDB directory. Use keyword arguments when calling this constructor. """ self.db = None myflags = DB_THREAD if create:...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
"""CreateTable(table, columns) - Create a new table in the database
"""CreateTable(table, columns) - Create a new table in the database.
def CreateTable(self, table, columns): """CreateTable(table, columns) - Create a new table in the database raises TableDBError if it already exists or for other DB errors. """ assert isinstance(columns, ListType) txn = None try: # checking sanity of the table and column names here on # table creation will prevent probl...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
- Create a new table in the database.
Create a new table in the database.
def CreateOrExtendTable(self, table, columns): """CreateOrExtendTable(table, columns)
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
"""Modify(table, conditions) - Modify in rows matching 'conditions' using mapping functions in 'mappings' * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. * mappings is a dictionary keyed on column names containint condit...
"""Modify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings' * table - the table name * conditions - a dictionary keyed on column names containing a condition callable expecting the data string as an argument and returning a boolean. * mappings - a dic...
def Modify(self, table, conditions={}, mappings={}): """Modify(table, conditions) - Modify in rows matching 'conditions' using mapping functions in 'mappings' * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. * mappings is...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
except DBError, dberror:
except:
def Modify(self, table, conditions={}, mappings={}): """Modify(table, conditions) - Modify in rows matching 'conditions' using mapping functions in 'mappings' * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. * mappings is...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
* conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean.
* conditions - a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean.
def Delete(self, table, conditions={}): """Delete(table, conditions) - Delete items matching the given conditions from the table. * conditions is a dictionary keyed on column names containing condition functions expecting the data string as an argument and returning a boolean. """ try: matching_rowids = self.__Select(t...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
"""Select(table, conditions) - retrieve specific row data
"""Select(table, columns, conditions) - retrieve specific row data
def Select(self, table, columns, conditions={}): """Select(table, conditions) - retrieve specific row data Returns a list of row column->value mapping dictionaries. * columns is a list of which column data to return. If columns is None, all columns will be returned. * conditions is a dictionary keyed on column names c...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
* columns is a list of which column data to return. If
* columns - a list of which column data to return. If
def Select(self, table, columns, conditions={}): """Select(table, conditions) - retrieve specific row data Returns a list of row column->value mapping dictionaries. * columns is a list of which column data to return. If columns is None, all columns will be returned. * conditions is a dictionary keyed on column names c...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
* conditions is a dictionary keyed on column names
* conditions - a dictionary keyed on column names
def Select(self, table, columns, conditions={}): """Select(table, conditions) - retrieve specific row data Returns a list of row column->value mapping dictionaries. * columns is a list of which column data to return. If columns is None, all columns will be returned. * conditions is a dictionary keyed on column names c...
ff7d991a07f21a0a368f422efcf17b27c363e1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff7d991a07f21a0a368f422efcf17b27c363e1d2/dbtables.py
def basic_test_inplace_repeat(self, size): l = [''] l *= size self.assertEquals(len(l), size) self.failUnless(l[0] is l[-1]) del l l = [''] * size l *= 2 self.assertEquals(len(l), size * 2) self.failUnless(l[size - 1] is l[-1]) @bigmemtest(minsize=_2G // 2 + 2, memuse=16) def test_inplace_repeat_small(self, size): re...
def test_repeat_large(self, size): return self.basic_test_repeat(size)
cda404bf367d0958c27f1649caa108f11bc696a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cda404bf367d0958c27f1649caa108f11bc696a1/test_bigmem.py
@bigmemtest(minsize=_2G // 2 + 2, memuse=8)
@bigmemtest(minsize=_2G // 2 + 2, memuse=16)
def basic_test_extend(self, size): l = [file] * size l.extend(l) self.assertEquals(len(l), size * 2) self.failUnless(l[0] is l[-1]) self.failUnless(l[size - 1] is l[size + 1])
cda404bf367d0958c27f1649caa108f11bc696a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cda404bf367d0958c27f1649caa108f11bc696a1/test_bigmem.py
@bigmemtest(minsize=_2G + 2, memuse=8)
@bigmemtest(minsize=_2G + 2, memuse=16)
def test_extend_small(self, size): return self.basic_test_extend(size)
cda404bf367d0958c27f1649caa108f11bc696a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cda404bf367d0958c27f1649caa108f11bc696a1/test_bigmem.py
'Expected:\n%s\nbut got:\n%s' % ( self.show(result), self.show(expect)))
'expected:\n%s\nbut got:\n%s' % ( self.show(expect), self.show(result)))
def check(self, result, expect): self.assertEquals(result, expect, 'Expected:\n%s\nbut got:\n%s' % ( self.show(result), self.show(expect)))
9ad15a3dff45359d5d6184764c9edae6f5298b29 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ad15a3dff45359d5d6184764c9edae6f5298b29/test_textwrap.py
On Unix, there are three possible config files: pydistutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), .pydistutils.cfg in the user's home directory, and setup.cfg in the current directory. On Windows and Mac OS, there are two possible config files: pydistut...
There are three possible config files: distutils.cfg in the Distutils installation directory (ie. where the top-level Distutils __inst__.py file lives), a file in the user's home directory named .pydistutils.cfg on Unix and pydistutils.cfg on Windows/Mac, and setup.cfg in the current directory.
def find_config_files (self): """Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions).
d303b61eb4f8e893ea558bd3b829561ffc28514e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d303b61eb4f8e893ea558bd3b829561ffc28514e/dist.py
def test_weak_keys(self): # # This exercises d.copy(), d.items(), d[] = v, d[], del d[], # len(d). # dict, objects = self.make_weak_keyed_dict() for o in objects: self.assert_(weakref.getweakrefcount(o) == 1, "wrong number of weak references to %r!" % o) self.assert_(o.arg is dict[o], "wrong object returned by weak d...
752eda459ae8f61b08c898c5a857b2151856881b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/752eda459ae8f61b08c898c5a857b2151856881b/test_weakref.py
test_exc('%d', '1', TypeError, "int argument required") test_exc('%g', '1', TypeError, "float argument required")
test_exc('%d', '1', TypeError, "int argument required, not str") test_exc('%g', '1', TypeError, "float argument required, not str")
def test_exc(formatstr, args, exception, excmsg): try: testformat(formatstr, args) except exception, exc: if str(exc) == excmsg: if verbose: print "yes" else: if verbose: print 'no' print 'Unexpected ', exception, ':', repr(str(exc)) except: if verbose: print 'no' print 'Unexpected exception' raise else: raise TestFail...
283a1353a0834d53b230b22e8db9e7b4fcd220d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/283a1353a0834d53b230b22e8db9e7b4fcd220d0/test_format.py
/.
/\.
def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. \s+\d+ # It has a size. [^/]* ...
cdbc131f0370f6e3712d4167ba987d5e6b7f2802 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cdbc131f0370f6e3712d4167ba987d5e6b7f2802/test_commands.py
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
def test_RFC1808(self): self.checkJoin(RFC1808_BASE, 'g:h', 'g:h') self.checkJoin(RFC1808_BASE, 'g', 'http://a/b/c/g') self.checkJoin(RFC1808_BASE, './g', 'http://a/b/c/g') self.checkJoin(RFC1808_BASE, 'g/', 'http://a/b/c/g/') self.checkJoin(RFC1808_BASE, '/g', 'http://a/g') self.checkJoin(RFC1808_BASE, '//g', 'http:/...
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
print "urlparse.urljoin() tests" print
self.checkJoin(RFC1808_BASE, '', 'http://a/b/c/d;p?q self.checkJoin(RFC1808_BASE, '../../../g', 'http://a/../g') self.checkJoin(RFC1808_BASE, '../../../../g', 'http://a/../../g') self.checkJoin(RFC1808_BASE, '/./g', 'http://a/./g') self.checkJoin(RFC1808_BASE, '/../g', 'http://a/../g') self.checkJoin(RFC1808_BASE, 'g....
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
checkJoin('g:h', 'g:h') checkJoin('g', 'http://a/b/c/g') checkJoin('./g', 'http://a/b/c/g') checkJoin('g/', 'http://a/b/c/g/') checkJoin('/g', 'http://a/g') checkJoin('//g', 'http://g') checkJoin('?y', 'http://a/b/c/d;p?y') checkJoin('g?y', 'http://a/b/c/g?y') checkJoin('g?y/./x', 'http://a/b/c/g?y/./x') checkJoin(' c...
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
checkJoin('', 'http://a/b/c/d;p?q checkJoin('../../../g', 'http://a/../g') checkJoin('../../../../g', 'http://a/../../g') checkJoin('/./g', 'http://a/./g') checkJoin('/../g', 'http://a/../g') checkJoin('g.', 'http://a/b/c/g.') checkJoin('.g', 'http://a/b/c/.g') checkJoin('g..', 'http://a/b/c/g..') checkJoin('..g', 'ht...
def test_RFC2396(self):
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
print errors, "errors"
self.checkJoin(RFC2396_BASE, 'g:h', 'g:h') self.checkJoin(RFC2396_BASE, 'g', 'http://a/b/c/g') self.checkJoin(RFC2396_BASE, './g', 'http://a/b/c/g') self.checkJoin(RFC2396_BASE, 'g/', 'http://a/b/c/g/') self.checkJoin(RFC2396_BASE, '/g', 'http://a/g') self.checkJoin(RFC2396_BASE, '//g', 'http://g') self.checkJoin(RFC23...
def checkJoin(relurl, expected): global errors result = urlparse.urljoin(RFC1808_BASE, relurl) print "%-13s = %r" % (relurl, result) if result != expected: errors += 1 print "urljoin(%r, %r)" % (RFC1808_BASE, relurl) print ("expected %r,\n" " got %r") % (expected, result)
6ec967d066a9de43244a965fa4c5421f279b77f4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ec967d066a9de43244a965fa4c5421f279b77f4/test_urlparse.py
if line == '' or line == '\n' and self.skip_blanks:
if (line == '' or line == '\n') and self.skip_blanks:
def readline (self): """Read and return a single logical line from the current file (or from an internal buffer if lines have previously been "unread" with 'unreadline()'). If the 'join_lines' option is true, this may involve reading multiple physical lines concatenated into a single string. Updates the current line ...
3d05c1600336ad3f09b28cbedc7b31c17dcf51f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3d05c1600336ad3f09b28cbedc7b31c17dcf51f0/text_file.py
"math.floor(huge)", "math.floor(mhuge)", "float(shuge) == int(shuge)"]:
"math.floor(huge)", "math.floor(mhuge)"]:
def test_float_overflow(): import math if verbose: print "long->float overflow" for x in -2.0, -1.0, 0.0, 1.0, 2.0: verify(float(long(x)) == x) shuge = '12345' * 120 huge = 1L << 30000 mhuge = -huge namespace = {'huge': huge, 'mhuge': mhuge, 'shuge': shuge, 'math': math} for test in ["float(huge)", "float(mhuge)", "...
307fa78107c39ffda1eb4ad18201d25650354c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/307fa78107c39ffda1eb4ad18201d25650354c4e/test_long.py
size = (size // 2)
size //= 2
def test_format(self, size): s = '-' * size sf = '%s' % (s,) self.failUnless(s == sf) del sf sf = '..%s..' % (s,) self.assertEquals(len(sf), len(s) + 4) self.failUnless(sf.startswith('..-')) self.failUnless(sf.endswith('-..')) del s, sf
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G // 5 + 10, memuse=8*5)
@bigmemtest(minsize=_2G // 5 + 10, memuse=8 * 5)
def test_concat_large(self, size): return self.basic_concat_test(size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G // 3 + 2, memuse=8+3)
@bigmemtest(minsize=_2G // 3 + 2, memuse=8 + 3)
def basic_test_repr(self, size): t = (0,) * size s = repr(t) # The repr of a tuple of 0's is exactly three times the tuple length. self.assertEquals(len(s), size * 3) self.assertEquals(s[:5], '(0, 0') self.assertEquals(s[-5:], '0, 0)') self.assertEquals(s.count('0'), size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G + 2, memuse=8+3)
@bigmemtest(minsize=_2G + 2, memuse=8 + 3)
def test_repr_small(self, size): return self.basic_test_repr(size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G // 5 + 10, memuse=8*5)
@bigmemtest(minsize=_2G // 5 + 10, memuse=8 * 5)
def test_inplace_concat_large(self, size): return self.basic_test_inplace_concat(size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G + 10, memuse=8)
@bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5)
def test_extend_large(self, size): return self.basic_test_extend(size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py