rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
def unpack(self, archive, output=None): | def unpack(self, archive, output=None, package=None): | def unpack(self, archive, output=None): tf = tarfile.open(archive, "r") members = tf.getmembers() skip = [] if self._renames: for member in members: for oldprefix, newprefix in self._renames: if oldprefix[:len(self._dir)] == self._dir: oldprefix2 = oldprefix[len(self._dir):] else: oldprefix2 = None if member.name[:len(oldprefix)] == oldprefix: if newprefix is None: skip.append(member) #print 'SKIP', member.name else: member.name = newprefix + member.name[len(oldprefix):] print ' ', member.name break elif oldprefix2 and member.name[:len(oldprefix2)] == oldprefix2: if newprefix is None: skip.append(member) #print 'SKIP', member.name else: member.name = newprefix + member.name[len(oldprefix2):] #print ' ', member.name break else: skip.append(member) #print '????', member.name for member in members: if member in skip: continue tf.extract(member, self._dir) if skip: names = [member.name for member in skip if member.name[-1] != '/'] if names: return "Not all files were unpacked: %s" % " ".join(names) | b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py |
def unpack(self, archive, output=None): tf = tarfile.open(archive, "r") members = tf.getmembers() skip = [] if self._renames: for member in members: for oldprefix, newprefix in self._renames: if oldprefix[:len(self._dir)] == self._dir: oldprefix2 = oldprefix[len(self._dir):] else: oldprefix2 = None if member.name[:len(oldprefix)] == oldprefix: if newprefix is None: skip.append(member) #print 'SKIP', member.name else: member.name = newprefix + member.name[len(oldprefix):] print ' ', member.name break elif oldprefix2 and member.name[:len(oldprefix2)] == oldprefix2: if newprefix is None: skip.append(member) #print 'SKIP', member.name else: member.name = newprefix + member.name[len(oldprefix2):] #print ' ', member.name break else: skip.append(member) #print '????', member.name for member in members: if member in skip: continue tf.extract(member, self._dir) if skip: names = [member.name for member in skip if member.name[-1] != '/'] if names: return "Not all files were unpacked: %s" % " ".join(names) | b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py |
||
"MD5Sum" | "MD5Sum", "User-install-skips", "Systemwide-only", | def find(self, ident): """Find a package. The package can be specified by name or as a dictionary with name, version and flavor entries. Only name is obligatory. If there are multiple matches the best one (higher version number, flavors ordered according to users' preference) is returned.""" if type(ident) == str: # Remove ( and ) for pseudo-packages if ident[0] == '(' and ident[-1] == ')': ident = ident[1:-1] # Split into name-version-flavor fields = ident.split('-') if len(fields) < 1 or len(fields) > 3: return None name = fields[0] if len(fields) > 1: version = fields[1] else: version = None if len(fields) > 2: flavor = fields[2] else: flavor = None else: name = ident['Name'] version = ident.get('Version') flavor = ident.get('Flavor') found = None for p in self._packages: if name == p.name() and \ (not version or version == p.version()) and \ (not flavor or flavor == p.flavor()): if not found or found < p: found = p return found | b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py |
rv = unpacker.unpack(self.archiveFilename, output=output) | rv = unpacker.unpack(self.archiveFilename, output=output, package=self) | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" if self._dict.has_key('Install-command'): return "%s: Binary package cannot have Install-command" % self.fullname() if self._dict.has_key('Pre-install-command'): if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) self.beforeInstall() | b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py |
def test_it(self): def tr(frame, event, arg): | def trace(self, frame, event, arg): """A trace function that raises an exception in response to a specific trace event.""" if event == self.raiseOnEvent: | def test_it(self): def tr(frame, event, arg): raise ValueError # just something that isn't RuntimeError def f(): return 1 try: for i in xrange(sys.getrecursionlimit() + 1): sys.settrace(tr) try: f() except ValueError: pass else: self.fail("exception not thrown!") except RuntimeError: self.fail("recursion counter not reset") | b40d07afc41f9434816f5c904352a5aa416f9bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b40d07afc41f9434816f5c904352a5aa416f9bf6/test_trace.py |
def f(): | else: return self.trace def f(self): """The function to trace; raises an exception if that's the case we're testing, so that the 'exception' trace event fires.""" if self.raiseOnEvent == 'exception': x = 0 y = 1/x else: | def f(): return 1 | b40d07afc41f9434816f5c904352a5aa416f9bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b40d07afc41f9434816f5c904352a5aa416f9bf6/test_trace.py |
sys.settrace(tr) | sys.settrace(self.trace) | def f(): return 1 | b40d07afc41f9434816f5c904352a5aa416f9bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b40d07afc41f9434816f5c904352a5aa416f9bf6/test_trace.py |
f() | self.f() | def f(): return 1 | b40d07afc41f9434816f5c904352a5aa416f9bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b40d07afc41f9434816f5c904352a5aa416f9bf6/test_trace.py |
def test_call(self): self.run_test_for_event('call') def test_line(self): self.run_test_for_event('line') def test_return(self): self.run_test_for_event('return') def test_exception(self): self.run_test_for_event('exception') | def f(): return 1 | b40d07afc41f9434816f5c904352a5aa416f9bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b40d07afc41f9434816f5c904352a5aa416f9bf6/test_trace.py |
|
'Down Arrow': 'Down', 'Tab':'tab'} | 'Down Arrow': 'Down', 'Tab':'Tab'} | def TranslateKey(self, key, modifiers): "Translate from keycap symbol to the Tkinter keysym" translateDict = {'Space':'space', '~':'asciitilde','!':'exclam','@':'at','#':'numbersign', '%':'percent','^':'asciicircum','&':'ampersand','*':'asterisk', '(':'parenleft',')':'parenright','_':'underscore','-':'minus', '+':'plus','=':'equal','{':'braceleft','}':'braceright', '[':'bracketleft',']':'bracketright','|':'bar',';':'semicolon', ':':'colon',',':'comma','.':'period','<':'less','>':'greater', '/':'slash','?':'question','Page Up':'Prior','Page Down':'Next', 'Left Arrow':'Left','Right Arrow':'Right','Up Arrow':'Up', 'Down Arrow': 'Down', 'Tab':'tab'} if key in translateDict.keys(): key = translateDict[key] if 'Shift' in modifiers and key in string.ascii_lowercase: key = key.upper() key = 'Key-' + key return key | 821bac5ddcf01bf8403c2a591edf8e504e1c33de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/821bac5ddcf01bf8403c2a591edf8e504e1c33de/keybindingDialog.py |
effective = (effective / tabwidth + 1) * tabwidth | effective = (int(effective / tabwidth) + 1) * tabwidth | def classifyws(s, tabwidth): raw = effective = 0 for ch in s: if ch == ' ': raw = raw + 1 effective = effective + 1 elif ch == '\t': raw = raw + 1 effective = (effective / tabwidth + 1) * tabwidth else: break return raw, effective | 56ad405be8e8cd22c8b59f914257b2c442df3a21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/56ad405be8e8cd22c8b59f914257b2c442df3a21/AutoIndent.py |
return '<' + x.__class__.__name__ + ' instance at ' + \ hex(id(x))[2:] + '>' | return '<%s instance at %x>' % (x.__class__.__name__, id(x)) | def repr_instance(self, x, level): try: s = __builtin__.repr(x) # Bugs in x.__repr__() can cause arbitrary # exceptions -- then make up something except: return '<' + x.__class__.__name__ + ' instance at ' + \ hex(id(x))[2:] + '>' if len(s) > self.maxstring: i = max(0, (self.maxstring-3)//2) j = max(0, self.maxstring-3-i) s = s[:i] + '...' + s[len(s)-j:] return s | 0e60940c852c94ae51c08035af5fc508560326ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0e60940c852c94ae51c08035af5fc508560326ff/repr.py |
"""Return true if the pathname refers to a symbolic link. Always false on the Mac, until we understand Aliases.)""" return False | """Return true if the pathname refers to a symbolic link.""" try: import macfs return macfs.ResolveAliasFile(s)[2] except: return False | def islink(s): """Return true if the pathname refers to a symbolic link. Always false on the Mac, until we understand Aliases.)""" return False | ce55bbfaa855681a574b9b949474dc37a2c4dfc7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce55bbfaa855681a574b9b949474dc37a2c4dfc7/macpath.py |
if isdir(name): | if isdir(name) and not islink(name): | def walk(top, func, arg): """Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.""" try: names = os.listdir(top) except os.error: return func(arg, top, names) for name in names: name = join(top, name) if isdir(name): walk(name, func, arg) | ce55bbfaa855681a574b9b949474dc37a2c4dfc7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce55bbfaa855681a574b9b949474dc37a2c4dfc7/macpath.py |
realpath = abspath | def realpath(path): path = abspath(path) try: import macfs except ImportError: return path if not path: return path components = path.split(':') path = components[0] + ':' for c in components[1:]: path = join(path, c) path = macfs.ResolveAliasFile(path)[0].as_pathname() return path | def abspath(path): """Return an absolute path.""" if not isabs(path): path = join(os.getcwd(), path) return normpath(path) | ce55bbfaa855681a574b9b949474dc37a2c4dfc7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce55bbfaa855681a574b9b949474dc37a2c4dfc7/macpath.py |
mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 | mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777 | def run (self): if not self.skip_build: self.run_command('build_scripts') self.outfiles = self.copy_tree(self.build_dir, self.install_dir) if os.name == 'posix': # Set the executable bits (owner, group, and world) on # all the scripts we just installed. for file in self.get_outputs(): if self.dry_run: log.info("changing mode of %s", file) else: mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode) | eb79d9ca42e90a5bb23f1b2f9c77b3fd4345701d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/eb79d9ca42e90a5bb23f1b2f9c77b3fd4345701d/install_scripts.py |
mbox = '/usr/mail/' + mbox | if os.path.isfile('/var/mail/' + mbox): mbox = '/var/mail/' + mbox else: mbox = '/usr/mail/' + mbox | def _test(): import sys args = sys.argv[1:] if not args: for key in 'MAILDIR', 'MAIL', 'LOGNAME', 'USER': if os.environ.has_key(key): mbox = os.environ[key] break else: print "$MAIL, $LOGNAME nor $USER set -- who are you?" return else: mbox = args[0] if mbox[:1] == '+': mbox = os.environ['HOME'] + '/Mail/' + mbox[1:] elif not '/' in mbox: mbox = '/usr/mail/' + mbox if os.path.isdir(mbox): if os.path.isdir(os.path.join(mbox, 'cur')): mb = Maildir(mbox) else: mb = MHMailbox(mbox) else: fp = open(mbox, 'r') mb = PortableUnixMailbox(fp) msgs = [] while 1: msg = mb.next() if msg is None: break msgs.append(msg) if len(args) <= 1: msg.fp = None if len(args) > 1: num = int(args[1]) print 'Message %d body:'%num msg = msgs[num-1] msg.rewindbody() sys.stdout.write(msg.fp.read()) else: print 'Mailbox',mbox,'has',len(msgs),'messages:' for msg in msgs: f = msg.getheader('from') or "" s = msg.getheader('subject') or "" d = msg.getheader('date') or "" print '-%20.20s %20.20s %-30.30s'%(f, d[5:], s) | fdd74b4f2b5369bfec49e3561740b8cb12cdb2b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fdd74b4f2b5369bfec49e3561740b8cb12cdb2b8/mailbox.py |
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared | (ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base | def build_extensions(self): | c1449afc022c6d777691fab21552feca6cd46b8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1449afc022c6d777691fab21552feca6cd46b8f/setup.py |
"'ascii' codec can't encode character '\\xfc' in position 1: ouch" | "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\xfc' in position 0: ouch" | "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\u0100' in position 0: ouch" | "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\uffff' in position 0: ouch" | "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\U00010000' in position 0: ouch" | "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"can't translate character '\\xfc' in position 1: ouch" | "can't translate character u'\\xfc' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"can't translate character '\\u0100' in position 1: ouch" | "can't translate character u'\\u0100' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"can't translate character '\\uffff' in position 1: ouch" | "can't translate character u'\\uffff' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
"can't translate character '\\U00010000' in position 1: ouch" | "can't translate character u'\\U00010000' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | c174bbc23ec4b576d8279cce618b3d4931989635 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c174bbc23ec4b576d8279cce618b3d4931989635/test_codeccallbacks.py |
def visitLambda(self, node, parent): | def visitLambda(self, node, parent, assign=0): assert not assign | def visitLambda(self, node, parent): for n in node.defaults: self.visit(n, parent) scope = LambdaScope(self.module, self.klass) if parent.nested or isinstance(parent, FunctionScope): scope.nested = 1 self.scopes[node] = scope self._do_args(scope, node.argnames) self.visit(node.code, scope) self.handle_free_vars(scope, parent) | 9a4bc1bb8faa1bbe7c46b752fe773aba2968ca30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9a4bc1bb8faa1bbe7c46b752fe773aba2968ca30/symbols.py |
userlist = self.__class__() userlist.data[:] = self.data[i:j] return userlist | return self.__class__(self.data[i:j]) | def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) userlist = self.__class__() userlist.data[:] = self.data[i:j] return userlist | 07a38e71be664e284a314d91ef80bdd974be0b1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/07a38e71be664e284a314d91ef80bdd974be0b1e/UserList.py |
("CompilePyc", 18, "python.exe", r"[TARGETDIR]Lib\compileall.py [TARGETDIR]Lib"), ("CompilePyo", 18, "python.exe", r"-O [TARGETDIR]Lib\compileall.py [TARGETDIR]Lib") | ("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs), | def add_ui(db): x = y = 50 w = 370 h = 300 title = "[ProductName] Setup" # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible track_disk_space = 32 add_data(db, 'ActionText', uisample.ActionText) add_data(db, 'UIText', uisample.UIText) # Bitmaps if not os.path.exists(srcdir+r"\PC\python_icon.exe"): raise "Run icons.mak in PC directory" add_data(db, "Binary", [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), ]) add_data(db, "Icon", [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) # Scripts # CheckDir sets TargetExists if TARGETDIR exists. # UpdateEditIDLE sets the REGISTRY.tcl component into # the installed/uninstalled state according to both the # Extensions and TclTk features. open("inst.vbs","w").write(""" Function CheckDir() Set FSO = CreateObject("Scripting.FileSystemObject") if FSO.FolderExists(Session.Property("TARGETDIR")) then Session.Property("TargetExists") = "1" else Session.Property("TargetExists") = "0" end if End Function Function UpdateEditIDLE() Dim ext_new, tcl_new, regtcl_old ext_new = Session.FeatureRequestState("Extensions") tcl_new = Session.FeatureRequestState("TclTk") if ext_new=-1 then ext_new = Session.FeatureCurrentState("Extensions") end if if tcl_new=-1 then tcl_new = Session.FeatureCurrentState("TclTk") end if regtcl_old = Session.ComponentCurrentState("REGISTRY.tcl") if ext_new=3 and (tcl_new=3 or tcl_new=4) and regtcl_old<>3 then Session.ComponentRequestState("REGISTRY.tcl")=3 end if if (ext_new=2 or tcl_new=2) and regtcl_old<>2 then Session.ComponentRequestState("REGISTRY.tcl")=2 end if End Function """) # To add debug messages into scripts, the following fragment can be used # set objRec = Session.Installer.CreateRecord(1) # objRec.StringData(1) = "Debug message" # Session.message &H04000000, objRec add_data(db, "Binary", [("Script", msilib.Binary("inst.vbs"))]) # See "Custom Action Type 6" add_data(db, "CustomAction", [("CheckDir", 6, "Script", "CheckDir"), ("UpdateEditIDLE", 6, "Script", "UpdateEditIDLE")]) os.unlink("inst.vbs") # UI customization properties add_data(db, "Property", # See "DefaultUIFont Property" [("DefaultUIFont", "DlgFont8"), # See "ErrorDialog Style Bit" ("ErrorDialog", "ErrorDlg"), ("Progress1", "Install"), # modified in maintenance type dlg ("Progress2", "installs"), ("MaintenanceForm_Action", "Repair")]) # Fonts, see "TextStyle Table" add_data(db, "TextStyle", [("DlgFont8", "Tahoma", 9, None, 0), ("DlgFontBold8", "Tahoma", 8, None, 1), #bold ("VerdanaBold10", "Verdana", 10, None, 1), ]) # See "CustomAction Table" add_data(db, "CustomAction", [ # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty # See "Custom Action Type 51", # "Custom Action Execution Scheduling Options" ("InitialTargetDir", 307, "TARGETDIR", "[WindowsVolume]Python%s%s" % (major, minor)), ("SetDLLDirToTarget", 307, "DLLDIR", "[TARGETDIR]"), ("SetDLLDirToSystem32", 307, "DLLDIR", SystemFolderName), # msidbCustomActionTypeExe + msidbCustomActionTypeSourceFile # See "Custom Action Type 18" ("CompilePyc", 18, "python.exe", r"[TARGETDIR]Lib\compileall.py [TARGETDIR]Lib"), ("CompilePyo", 18, "python.exe", r"-O [TARGETDIR]Lib\compileall.py [TARGETDIR]Lib") ]) # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" # Numbers indicate sequence; see sequence.py for how these action integrate add_data(db, "InstallUISequence", [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140), ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141), ("InitialTargetDir", 'TARGETDIR=""', 750), # In the user interface, assume all-users installation if privileged. ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("SelectDirectoryDlg", "Not Installed", 1230), # XXX no support for resume installations yet #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240), ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250), ("ProgressDlg", None, 1280)]) add_data(db, "AdminUISequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ]) # Execute Sequences add_data(db, "InstallExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("UpdateEditIDLE", None, 1050), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) add_data(db, "AdminExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) ##################################################################### # Standard dialogs: FatalError, UserExit, ExitDialog fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish", "Finish", "Finish") fatal.title("[ProductName] Installer ended prematurely") fatal.back("< Back", "Finish", active = 0) fatal.cancel("Cancel", "Back", active = 0) fatal.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.") fatal.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c=fatal.next("Finish", "Cancel", name="Finish") # See "ControlEvent Table". Parameters are the event, the parameter # to the action, and optionally the condition for the event, and the order # of events. c.event("EndDialog", "Exit") user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title, "Finish", "Finish", "Finish") user_exit.title("[ProductName] Installer was interrupted") user_exit.back("< Back", "Finish", active = 0) user_exit.cancel("Cancel", "Back", active = 0) user_exit.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup was interrupted. Your system has not been modified. " "To install this program at a later time, please run the installation again.") user_exit.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = user_exit.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Exit") exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, "Finish", "Finish", "Finish") exit_dialog.title("Completing the [ProductName] Installer") exit_dialog.back("< Back", "Finish", active = 0) exit_dialog.cancel("Cancel", "Back", active = 0) exit_dialog.text("Acknowledgements", 135, 95, 220, 120, 0x30003, "Special Windows thanks to:\n" " LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n" " Mark Hammond, without whose years of freely \n" " shared Windows expertise, Python for Windows \n" " would still be Python for DOS.") exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = exit_dialog.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Return") ##################################################################### # Required dialog: FilesInUse, ErrorDlg inuse = PyDialog(db, "FilesInUse", x, y, w, h, 19, # KeepModeless|Modal|Visible title, "Retry", "Retry", "Retry", bitmap=False) inuse.text("Title", 15, 6, 200, 15, 0x30003, r"{\DlgFontBold8}Files in Use") inuse.text("Description", 20, 23, 280, 20, 0x30003, "Some files that need to be updated are currently in use.") inuse.text("Text", 20, 55, 330, 50, 3, "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.") inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", None, None, None) c=inuse.back("Exit", "Ignore", name="Exit") c.event("EndDialog", "Exit") c=inuse.next("Ignore", "Retry", name="Ignore") c.event("EndDialog", "Ignore") c=inuse.cancel("Retry", "Exit", name="Retry") c.event("EndDialog","Retry") # See "Error Dialog". See "ICE20" for the required names of the controls. error = Dialog(db, "ErrorDlg", 50, 10, 330, 101, 65543, # Error|Minimize|Modal|Visible title, "ErrorText", None, None) error.text("ErrorText", 50,9,280,48,3, "") error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None) error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo") error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes") error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort") error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel") error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore") error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk") error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry") ##################################################################### # Global "Query Cancel" dialog cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No", "No") cancel.text("Text", 48, 15, 194, 30, 3, "Are you sure you want to cancel [ProductName] installation?") cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No") c.event("EndDialog", "Exit") c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Global "Wait for costing" dialog costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, "Return", "Return", "Return") costing.text("Text", 48, 15, 194, 30, 3, "Please wait while the installer finishes determining your disk space requirements.") costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None) c.event("EndDialog", "Exit") ##################################################################### # Preparation dialog: no user input except cancellation prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel") prep.text("Description", 135, 70, 220, 40, 0x30003, "Please wait while the Installer prepares to guide you through the installation.") prep.title("Welcome to the [ProductName] Installer") c=prep.text("ActionText", 135, 110, 220, 20, 0x30003, "Pondering...") c.mapping("ActionText", "Text") c=prep.text("ActionData", 135, 135, 220, 30, 0x30003, None) c.mapping("ActionData", "Text") prep.back("Back", None, active=0) prep.next("Next", None, active=0) c=prep.cancel("Cancel", None) c.event("SpawnDialog", "CancelDlg") ##################################################################### # Target directory selection seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") seldlg.title("Select Destination Directory") seldlg.text("Description", 135, 50, 220, 40, 0x30003, "Please select a directory for the [ProductName] files.") seldlg.back("< Back", None, active=0) c = seldlg.next("Next >", "Cancel") c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1) # If the target exists, but we found that we are going to remove old versions, don't bother # confirming that the target directory exists. Strictly speaking, we should determine that # the target directory is indeed the target of the product that we are going to remove, but # I don't know how to do that. c.event("SpawnDialog", "ExistingDirectoryDlg", 'TargetExists=1 and REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""', 2) c.event("SetTargetPath", "TARGETDIR", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 3) c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4) c.event("NewDialog", "SelectFeaturesDlg", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 5) c = seldlg.cancel("Cancel", "DirectoryCombo") c.event("SpawnDialog", "CancelDlg") seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80, 393219, "TARGETDIR", None, "DirectoryList", None) seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3, "TARGETDIR", None, "PathEdit", None) seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3, "TARGETDIR", None, "Next", None) c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3, "Up", None) c.event("DirectoryListUp", "0") c = seldlg.pushbutton("NewDir", 324, 70, 30, 18, 3, "New", None) c.event("DirectoryListNew", "0") ##################################################################### # SelectFeaturesDlg features = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal|track_disk_space, title, "Tree", "Next", "Cancel") features.title("Customize [ProductName]") features.text("Description", 135, 35, 220, 15, 0x30003, "Select the way you want features to be installed.") features.text("Text", 135,45,220,30, 3, "Click on the icons in the tree below to change the way features will be installed.") c=features.back("< Back", "Next") c.event("NewDialog", "SelectDirectoryDlg") c=features.next("Next >", "Cancel") c.mapping("SelectionNoItems", "Enabled") c.event("SpawnDialog", "DiskCostDlg", "OutOfDiskSpace=1", order=1) c.event("EndDialog", "Return", "OutOfDiskSpace<>1", order=2) c=features.cancel("Cancel", "Tree") c.event("SpawnDialog", "CancelDlg") # The browse property is not used, since we have only a single target path (selected already) features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7, "_BrowseProperty", "Tree of selections", "Back", None) #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost") #c.mapping("SelectionNoItems", "Enabled") #c.event("Reset", "0") features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None, None, None) c=features.xbutton("DiskCost", "Disk &Usage", None, 0.10) c.mapping("SelectionNoItems","Enabled") c.event("SpawnDialog", "DiskCostDlg") c=features.xbutton("Advanced", "Advanced", None, 0.30) c.event("SpawnDialog", "AdvancedDlg") c=features.text("ItemDescription", 140, 180, 210, 30, 3, "Multiline description of the currently selected item.") c.mapping("SelectionDescription","Text") c=features.text("ItemSize", 140, 210, 210, 45, 3, "The size of the currently selected item.") c.mapping("SelectionSize", "Text") ##################################################################### # Disk cost cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, "OK", "OK", "OK", bitmap=False) cost.text("Title", 15, 6, 200, 15, 0x30003, "{\DlgFontBold8}Disk Space Requirements") cost.text("Description", 20, 20, 280, 20, 0x30003, "The disk space required for the installation of the selected features.") cost.text("Text", 20, 53, 330, 60, 3, "The highlighted volumes (if any) do not have enough disk space " "available for the currently selected features. You can either " "remove some files from the highlighted volumes, or choose to " "install less features onto local drive(s), or select different " "destination drive(s).") cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, None, "{120}{70}{70}{70}{70}", None, None) cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return") ##################################################################### # WhichUsers Dialog. Only available on NT, and for privileged users. # This must be run before FindRelatedProducts, because that will # take into account whether the previous installation was per-user # or per-machine. We currently don't support going back to this # dialog after "Next" was selected; to support this, we would need to # find how to reset the ALLUSERS property, and how to re-run # FindRelatedProducts. # On Windows9x, the ALLUSERS property is ignored on the command line # and in the Property table, but installer fails according to the documentation # if a dialog attempts to set ALLUSERS. whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, "AdminInstall", "Next", "Cancel") whichusers.title("Select whether to install [ProductName] for all users of this computer.") # A radio group with two options: allusers, justme g = whichusers.radiogroup("AdminInstall", 135, 60, 160, 50, 3, "WhichUsers", "", "Next") g.add("ALL", 0, 5, 150, 20, "Install for all users") g.add("JUSTME", 0, 25, 150, 20, "Install just for me") whichusers.back("Back", None, active=0) c = whichusers.next("Next >", "Cancel") c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1) c.event("EndDialog", "Return", order = 2) c = whichusers.cancel("Cancel", "AdminInstall") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, "CompilePyc", "Next", "Cancel") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, "COMPILEALL", "Compile .py files to byte code after installation", "Next") c = advanced.next("Finish", "Cancel") c.event("EndDialog", "Return") c = advanced.cancel("Cancel", "CompilePyc") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, "No", "No", "No") dlg.text("Title", 10, 20, 180, 40, 3, "[TARGETDIR] exists. Are you sure you want to overwrite existing files?") c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No") c.event("[TargetExists]", "0", order=1) c.event("[TargetExistsOk]", "1", order=2) c.event("EndDialog", "Return", order=3) c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Installation Progress dialog (modeless) progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel", bitmap=False) progress.text("Title", 20, 15, 200, 15, 0x30003, "{\DlgFontBold8}[Progress1] [ProductName]") progress.text("Text", 35, 65, 300, 30, 3, "Please wait while the Installer [Progress2] [ProductName]. " "This may take several minutes.") progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:") c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...") c.mapping("ActionText", "Text") #c=progress.text("ActionData", 35, 140, 300, 20, 3, None) #c.mapping("ActionData", "Text") c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, None, "Progress done", None, None) c.mapping("SetProgress", "Progress") progress.back("< Back", "Next", active=False) progress.next("Next >", "Cancel", active=False) progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg") # Maintenance type: repair/uninstall maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") maint.title("Welcome to the [ProductName] Setup Wizard") maint.text("BodyText", 135, 63, 230, 42, 3, "Select whether you want to repair or remove [ProductName].") g=maint.radiogroup("RepairRadioGroup", 135, 108, 230, 60, 3, "MaintenanceForm_Action", "", "Next") g.add("Change", 0, 0, 200, 17, "&Change [ProductName]") g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]") g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]") maint.back("< Back", None, active=False) c=maint.next("Finish", "Cancel") # Change installation: Change progress dialog to "Change", then ask # for feature selection c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1) c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2) # Reinstall: Change progress dialog to "Repair", then invoke reinstall # Also set list of reinstalled features to "ALL" c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5) c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6) c.event("[Progress2]", "repaires", 'MaintenanceForm_Action="Repair"', 7) c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8) # Uninstall: Change progress to "Remove", then invoke uninstall # Also set list of removed features to "ALL" c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11) c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12) c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13) c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14) # Close dialog when maintenance action scheduled c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20) c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21) maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg") | 93cad386813fc22cfaa7c8b77f91ff595c3ca3f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/93cad386813fc22cfaa7c8b77f91ff595c3ca3f2/msi.py |
return url2pathname(splithost(url1)[1]), None | return url2pathname(splithost(url1)[1]), hdrs | def retrieve(self, url, filename=None): url = unwrap(url) if self.tempcache and self.tempcache.has_key(url): return self.tempcache[url] type, url1 = splittype(url) if not filename and (not type or type == 'file'): try: fp = self.open_local_file(url1) del fp return url2pathname(splithost(url1)[1]), None except IOError, msg: pass fp = self.open(url) headers = fp.info() if not filename: import tempfile filename = tempfile.mktemp() self.__tempfiles.append(filename) result = filename, headers if self.tempcache is not None: self.tempcache[url] = result tfp = open(filename, 'wb') bs = 1024*8 block = fp.read(bs) while block: tfp.write(block) block = fp.read(bs) fp.close() tfp.close() del fp del tfp return result | e9a8940e275731d0de26af6b1360453333f2a907 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9a8940e275731d0de26af6b1360453333f2a907/urllib.py |
filename = tempfile.mktemp() | garbage, path = splittype(url) print (garbage, path) garbage, path = splithost(path or "") print (garbage, path) path, garbage = splitquery(path or "") print (path, garbage) path, garbage = splitattr(path or "") print (path, garbage) suffix = os.path.splitext(path)[1] filename = tempfile.mktemp(suffix) | def retrieve(self, url, filename=None): url = unwrap(url) if self.tempcache and self.tempcache.has_key(url): return self.tempcache[url] type, url1 = splittype(url) if not filename and (not type or type == 'file'): try: fp = self.open_local_file(url1) del fp return url2pathname(splithost(url1)[1]), None except IOError, msg: pass fp = self.open(url) headers = fp.info() if not filename: import tempfile filename = tempfile.mktemp() self.__tempfiles.append(filename) result = filename, headers if self.tempcache is not None: self.tempcache[url] = result tfp = open(filename, 'wb') bs = 1024*8 block = fp.read(bs) while block: tfp.write(block) block = fp.read(bs) fp.close() tfp.close() del fp del tfp return result | e9a8940e275731d0de26af6b1360453333f2a907 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9a8940e275731d0de26af6b1360453333f2a907/urllib.py |
noheaders(), 'file:'+file) | headers, 'file:'+file) | def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl( open(url2pathname(file), 'rb'), noheaders(), 'file:'+file) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl( open(url2pathname(file), 'rb'), noheaders(), 'file:'+file) raise IOError, ('local file error', 'not on local host') | e9a8940e275731d0de26af6b1360453333f2a907 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9a8940e275731d0de26af6b1360453333f2a907/urllib.py |
noheaders(), 'file:'+file) | headers, 'file:'+file) | def open_local_file(self, url): host, file = splithost(url) if not host: return addinfourl( open(url2pathname(file), 'rb'), noheaders(), 'file:'+file) host, port = splitport(host) if not port and socket.gethostbyname(host) in ( localhost(), thishost()): file = unquote(file) return addinfourl( open(url2pathname(file), 'rb'), noheaders(), 'file:'+file) raise IOError, ('local file error', 'not on local host') | e9a8940e275731d0de26af6b1360453333f2a907 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9a8940e275731d0de26af6b1360453333f2a907/urllib.py |
req.add_header(self.auth_header, auth_val) | req.add_unredirected_header(self.auth_header, auth_val) | def retry_http_digest_auth(self, req, auth): token, challenge = auth.split(' ', 1) chal = parse_keqv_list(parse_http_list(challenge)) auth = self.get_authorization(req, chal) if auth: auth_val = 'Digest %s' % auth if req.headers.get(self.auth_header, None) == auth_val: return None req.add_header(self.auth_header, auth_val) resp = self.parent.open(req) return resp | 80ae095c93b2d2b561f2f98412772c3210ff94c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80ae095c93b2d2b561f2f98412772c3210ff94c9/urllib2.py |
print string.ljust(opname[op], 15), | print string.ljust(opname[op], 20), | def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code labels = findlabels(code) n = len(code) i = 0 while i < n: c = code[i] op = ord(c) if op == SET_LINENO and i > 0: print # Extra blank line if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print string.rjust(`i`, 4), print string.ljust(opname[op], 15), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 print string.rjust(`oparg`, 5), if op in hasconst: print '(' + `co.co_consts[oparg]` + ')', elif op in hasname: print '(' + co.co_names[oparg] + ')', elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: print '(' + co.co_varnames[oparg] + ')', elif op in hascompare: print '(' + cmp_op[oparg] + ')', print | 9ab0acf6eb1ec245eb5500f5f9aa2d551f747675 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9ab0acf6eb1ec245eb5500f5f9aa2d551f747675/dis.py |
if callable(template): filter = template else: template = _compile_repl(template, pattern) if not template[0] and len(template[1]) == 1: filter = template[1][0] else: def filter(match, template=template): return sre_parse.expand_template(template, match) | template = _compile_repl(template, pattern) if not template[0] and len(template[1]) == 1: return template[1][0] def filter(match, template=template): return sre_parse.expand_template(template, match) | def _subx(pattern, template): # internal: pattern.sub/subn implementation helper if callable(template): filter = template else: template = _compile_repl(template, pattern) if not template[0] and len(template[1]) == 1: # literal replacement filter = template[1][0] else: def filter(match, template=template): return sre_parse.expand_template(template, match) return filter | d9896532350be73b0f0a2b6aa9d6ee3cb02ef3c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9896532350be73b0f0a2b6aa9d6ee3cb02ef3c3/sre.py |
def _sub(pattern, template, text, count=0): return _subn(pattern, template, text, count)[0] def _subn(pattern, template, text, count=0): filter = _subx(pattern, template) if not callable(filter): def filter(match, literal=filter): return literal n = i = 0 s = [] append = s.append c = pattern.scanner(text) while not count or n < count: m = c.search() if not m: break b, e = m.span() if i < b: append(text[i:b]) elif i == b == e and n: append(text[i:b]) continue append(filter(m)) i = e n = n + 1 append(text[i:]) return _join(s, text[:0]), n def _split(pattern, text, maxsplit=0): n = i = 0 s = [] append = s.append extend = s.extend c = pattern.scanner(text) g = pattern.groups while not maxsplit or n < maxsplit: m = c.search() if not m: break b, e = m.span() if b == e: if i >= len(text): break continue append(text[i:b]) if g and b != e: extend(list(m.groups())) i = e n = n + 1 append(text[i:]) return s | def filter(match, template=template): return sre_parse.expand_template(template, match) | d9896532350be73b0f0a2b6aa9d6ee3cb02ef3c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9896532350be73b0f0a2b6aa9d6ee3cb02ef3c3/sre.py |
|
cmd = form.getvalue("cmd") or "view" page = form.getvalue("page") or "FrontPage" | cmd = form.getvalue("cmd", "view") page = form.getvalue("page", "FrontPage") | def main(): form = cgi.FieldStorage() print "Content-type: text/html" print cmd = form.getvalue("cmd") or "view" page = form.getvalue("page") or "FrontPage" wiki = WikiPage(page) wiki.load() method = getattr(wiki, 'cmd_' + cmd, None) or wiki.cmd_view method(form) | 1f9e296752f3a5731c4483daa5ec07fd0a874e30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f9e296752f3a5731c4483daa5ec07fd0a874e30/cgi3.py |
homedir = os.path.dirname(sys.argv[0]) | homedir = "/tmp" | def main(): form = cgi.FieldStorage() print "Content-type: text/html" print cmd = form.getvalue("cmd") or "view" page = form.getvalue("page") or "FrontPage" wiki = WikiPage(page) wiki.load() method = getattr(wiki, 'cmd_' + cmd, None) or wiki.cmd_view method(form) | 1f9e296752f3a5731c4483daa5ec07fd0a874e30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f9e296752f3a5731c4483daa5ec07fd0a874e30/cgi3.py |
print "<p>", self.mklink("edit", self.name, "Edit this page") + "," | print "<p>", self.mklink("edit", self.name, "Edit this page") + ";" | def cmd_view(self, form): print "<h1>", escape(self.splitwikiword(self.name)), "</h1>" print "<p>" for line in self.data.splitlines(): line = line.rstrip() if not line: print "<p>" continue words = re.split('(\W+)', line) for i in range(len(words)): word = words[i] if self.iswikiword(word): if os.path.isfile(self.mkfile(word)): word = self.mklink("view", word, word) else: word = self.mklink("new", word, word + "*") else: word = escape(word) words[i] = word print "".join(words) print "<hr>" print "<p>", self.mklink("edit", self.name, "Edit this page") + "," print self.mklink("view", "FrontPage", "go to front page") + "." | 1f9e296752f3a5731c4483daa5ec07fd0a874e30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f9e296752f3a5731c4483daa5ec07fd0a874e30/cgi3.py |
self.store() self.cmd_view(form) | error = self.store() if error: print "<h1>I'm sorry. That didn't work</h1>" print "<p>An error occurred while attempting to write the file:" print "<p>", escape(error) else: self.cmd_view(form) | def cmd_create(self, form): self.data = form.getvalue("text", "").strip() self.store() self.cmd_view(form) | 1f9e296752f3a5731c4483daa5ec07fd0a874e30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f9e296752f3a5731c4483daa5ec07fd0a874e30/cgi3.py |
usage(2, msg) | usage(msg) return 2 | def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h") except getopt.error, msg: usage(2, msg) for o, a in opts: if o == "-h": help() if not args: usage(2, "at least one file argument is required") if args[1:]: sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0]) readwarnings(args[0]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
help() | print __doc__ return | def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h") except getopt.error, msg: usage(2, msg) for o, a in opts: if o == "-h": help() if not args: usage(2, "at least one file argument is required") if args[1:]: sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0]) readwarnings(args[0]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
usage(2, "at least one file argument is required") | usage("at least one file argument is required") return 2 | def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h") except getopt.error, msg: usage(2, msg) for o, a in opts: if o == "-h": help() if not args: usage(2, "at least one file argument is required") if args[1:]: sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0]) readwarnings(args[0]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
readwarnings(args[0]) def usage(exit, msg=None): if msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) | warnings = readwarnings(args[0]) if warnings is None: return 1 files = warnings.keys() if not files: print "No classic division warnings read from", args[0] return files.sort() exit = None for file in files: x = process(file, warnings[file]) exit = exit or x return exit def usage(msg): sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) | def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h") except getopt.error, msg: usage(2, msg) for o, a in opts: if o == "-h": help() if not args: usage(2, "at least one file argument is required") if args[1:]: sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0]) readwarnings(args[0]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
sys.exit(exit) def help(): print __doc__ sys.exit(0) | PATTERN = ("^(.+?):(\d+): DeprecationWarning: " "classic (int|long|float|complex) division$") | def usage(exit, msg=None): if msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Usage: %s warnings\n" % sys.argv[0]) sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0]) sys.exit(exit) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
pat = re.compile( "^(.+?):(\d+): DeprecationWarning: classic ([a-z]+) division$") | prog = re.compile(PATTERN) | def readwarnings(warningsfile): pat = re.compile( "^(.+?):(\d+): DeprecationWarning: classic ([a-z]+) division$") try: f = open(warningsfile) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return warnings = {} while 1: line = f.readline() if not line: break m = pat.match(line) if not m: if line.find("division") >= 0: sys.stderr.write("Warning: ignored input " + line) continue file, lineno, what = m.groups() list = warnings.get(file) if list is None: warnings[file] = list = [] list.append((int(lineno), intern(what))) f.close() files = warnings.keys() files.sort() for file in files: process(file, warnings[file]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
m = pat.match(line) | m = prog.match(line) | def readwarnings(warningsfile): pat = re.compile( "^(.+?):(\d+): DeprecationWarning: classic ([a-z]+) division$") try: f = open(warningsfile) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return warnings = {} while 1: line = f.readline() if not line: break m = pat.match(line) if not m: if line.find("division") >= 0: sys.stderr.write("Warning: ignored input " + line) continue file, lineno, what = m.groups() list = warnings.get(file) if list is None: warnings[file] = list = [] list.append((int(lineno), intern(what))) f.close() files = warnings.keys() files.sort() for file in files: process(file, warnings[file]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
files = warnings.keys() files.sort() for file in files: process(file, warnings[file]) | return warnings | def readwarnings(warningsfile): pat = re.compile( "^(.+?):(\d+): DeprecationWarning: classic ([a-z]+) division$") try: f = open(warningsfile) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return warnings = {} while 1: line = f.readline() if not line: break m = pat.match(line) if not m: if line.find("division") >= 0: sys.stderr.write("Warning: ignored input " + line) continue file, lineno, what = m.groups() list = warnings.get(file) if list is None: warnings[file] = list = [] list.append((int(lineno), intern(what))) f.close() files = warnings.keys() files.sort() for file in files: process(file, warnings[file]) | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
if not list: sys.stderr.write("no division warnings for %s\n" % file) return | assert list | def process(file, list): print "-"*70 if not list: sys.stderr.write("no division warnings for %s\n" % file) return try: fp = open(file) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return print "Processing:", file f = FileContext(fp) list.sort() index = 0 # list[:index] has been processed, list[index:] is still to do orphans = [] # subset of list for which no / operator was found unknown = [] # lines with / operators for which no warnings were seen g = tokenize.generate_tokens(f.readline) while 1: startlineno, endlineno, slashes = lineinfo = scanline(g) if startlineno is None: break assert startlineno <= endlineno is not None while index < len(list) and list[index][0] < startlineno: orphans.append(list[index]) index += 1 warnings = [] while index < len(list) and list[index][0] <= endlineno: warnings.append(list[index]) index += 1 if not slashes and not warnings: pass elif slashes and not warnings: report(slashes, "Unexecuted code") elif warnings and not slashes: reportphantomwarnings(warnings, f) else: if len(slashes) > 1: report(slashes, "More than one / operator") else: (row, col), line = slashes[0] line = chop(line) if line[col:col+1] != "/": print "*** Can't find the / operator in line %d:" % row print "*", line continue intlong = [] floatcomplex = [] bad = [] for lineno, what in warnings: if what in ("int", "long"): intlong.append(what) elif what in ("float", "complex"): floatcomplex.append(what) else: bad.append(what) if bad: print "*** Bad warning for line %d:" % row, bad print "*", line elif intlong and not floatcomplex: print "%dc%d" % (row, row) print "<", line print "---" print ">", line[:col] + "/" + line[col:] elif floatcomplex and not intlong: print "True division / operator at line %d:" % row print "=", line fp.close() | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
return print "Processing:", file | return 1 print "Index:", file | def process(file, list): print "-"*70 if not list: sys.stderr.write("no division warnings for %s\n" % file) return try: fp = open(file) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return print "Processing:", file f = FileContext(fp) list.sort() index = 0 # list[:index] has been processed, list[index:] is still to do orphans = [] # subset of list for which no / operator was found unknown = [] # lines with / operators for which no warnings were seen g = tokenize.generate_tokens(f.readline) while 1: startlineno, endlineno, slashes = lineinfo = scanline(g) if startlineno is None: break assert startlineno <= endlineno is not None while index < len(list) and list[index][0] < startlineno: orphans.append(list[index]) index += 1 warnings = [] while index < len(list) and list[index][0] <= endlineno: warnings.append(list[index]) index += 1 if not slashes and not warnings: pass elif slashes and not warnings: report(slashes, "Unexecuted code") elif warnings and not slashes: reportphantomwarnings(warnings, f) else: if len(slashes) > 1: report(slashes, "More than one / operator") else: (row, col), line = slashes[0] line = chop(line) if line[col:col+1] != "/": print "*** Can't find the / operator in line %d:" % row print "*", line continue intlong = [] floatcomplex = [] bad = [] for lineno, what in warnings: if what in ("int", "long"): intlong.append(what) elif what in ("float", "complex"): floatcomplex.append(what) else: bad.append(what) if bad: print "*** Bad warning for line %d:" % row, bad print "*", line elif intlong and not floatcomplex: print "%dc%d" % (row, row) print "<", line print "---" print ">", line[:col] + "/" + line[col:] elif floatcomplex and not intlong: print "True division / operator at line %d:" % row print "=", line fp.close() | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
orphans = [] unknown = [] | def process(file, list): print "-"*70 if not list: sys.stderr.write("no division warnings for %s\n" % file) return try: fp = open(file) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return print "Processing:", file f = FileContext(fp) list.sort() index = 0 # list[:index] has been processed, list[index:] is still to do orphans = [] # subset of list for which no / operator was found unknown = [] # lines with / operators for which no warnings were seen g = tokenize.generate_tokens(f.readline) while 1: startlineno, endlineno, slashes = lineinfo = scanline(g) if startlineno is None: break assert startlineno <= endlineno is not None while index < len(list) and list[index][0] < startlineno: orphans.append(list[index]) index += 1 warnings = [] while index < len(list) and list[index][0] <= endlineno: warnings.append(list[index]) index += 1 if not slashes and not warnings: pass elif slashes and not warnings: report(slashes, "Unexecuted code") elif warnings and not slashes: reportphantomwarnings(warnings, f) else: if len(slashes) > 1: report(slashes, "More than one / operator") else: (row, col), line = slashes[0] line = chop(line) if line[col:col+1] != "/": print "*** Can't find the / operator in line %d:" % row print "*", line continue intlong = [] floatcomplex = [] bad = [] for lineno, what in warnings: if what in ("int", "long"): intlong.append(what) elif what in ("float", "complex"): floatcomplex.append(what) else: bad.append(what) if bad: print "*** Bad warning for line %d:" % row, bad print "*", line elif intlong and not floatcomplex: print "%dc%d" % (row, row) print "<", line print "---" print ">", line[:col] + "/" + line[col:] elif floatcomplex and not intlong: print "True division / operator at line %d:" % row print "=", line fp.close() | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
|
report(slashes, "Unexecuted code") | report(slashes, "No conclusive evidence") | def process(file, list): print "-"*70 if not list: sys.stderr.write("no division warnings for %s\n" % file) return try: fp = open(file) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return print "Processing:", file f = FileContext(fp) list.sort() index = 0 # list[:index] has been processed, list[index:] is still to do orphans = [] # subset of list for which no / operator was found unknown = [] # lines with / operators for which no warnings were seen g = tokenize.generate_tokens(f.readline) while 1: startlineno, endlineno, slashes = lineinfo = scanline(g) if startlineno is None: break assert startlineno <= endlineno is not None while index < len(list) and list[index][0] < startlineno: orphans.append(list[index]) index += 1 warnings = [] while index < len(list) and list[index][0] <= endlineno: warnings.append(list[index]) index += 1 if not slashes and not warnings: pass elif slashes and not warnings: report(slashes, "Unexecuted code") elif warnings and not slashes: reportphantomwarnings(warnings, f) else: if len(slashes) > 1: report(slashes, "More than one / operator") else: (row, col), line = slashes[0] line = chop(line) if line[col:col+1] != "/": print "*** Can't find the / operator in line %d:" % row print "*", line continue intlong = [] floatcomplex = [] bad = [] for lineno, what in warnings: if what in ("int", "long"): intlong.append(what) elif what in ("float", "complex"): floatcomplex.append(what) else: bad.append(what) if bad: print "*** Bad warning for line %d:" % row, bad print "*", line elif intlong and not floatcomplex: print "%dc%d" % (row, row) print "<", line print "---" print ">", line[:col] + "/" + line[col:] elif floatcomplex and not intlong: print "True division / operator at line %d:" % row print "=", line fp.close() | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
def scanline(g): slashes = [] startlineno = None endlineno = None for type, token, start, end, line in g: endlineno = end[0] if startlineno is None: startlineno = endlineno if token in ("/", "/="): slashes.append((start, line)) ## if type in (tokenize.NEWLINE, tokenize.NL, tokenize.COMMENT): if type == tokenize.NEWLINE: break return startlineno, endlineno, slashes | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
||
main() | sys.exit(main()) | def chop(line): if line.endswith("\n"): return line[:-1] else: return line | 1411e89cd48fda4dab58a672e67677772c9670ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1411e89cd48fda4dab58a672e67677772c9670ec/fixdiv.py |
ret = decompress(data) | ret = bz2.decompress(data) | def decompress(self, data): pop = popen2.Popen3("bunzip2", capturestderr=1) pop.tochild.write(data) pop.tochild.close() ret = pop.fromchild.read() pop.fromchild.close() if pop.wait() != 0: ret = decompress(data) return ret | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
data = compress(self.TEXT) | if self.skip_decompress_tests: return data = bz2.compress(self.TEXT) | def testCompress(self): # "Test compress() function" data = compress(self.TEXT) self.assertEqual(self.decompress(data), self.TEXT) | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
text = decompress(self.DATA) | text = bz2.decompress(self.DATA) | def testDecompress(self): # "Test decompress() function" text = decompress(self.DATA) self.assertEqual(text, self.TEXT) | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
text = decompress("") | text = bz2.decompress("") | def testDecompressEmpty(self): # "Test decompress() function with empty string" text = decompress("") self.assertEqual(text, "") | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
self.assertRaises(ValueError, decompress, self.DATA[:-10]) | self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10]) | def testDecompressIncomplete(self): # "Test decompress() function with incomplete data" self.assertRaises(ValueError, decompress, self.DATA[:-10]) | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
test_support.run_unittest(BZ2FileTest) test_support.run_unittest(BZ2CompressorTest) test_support.run_unittest(BZ2DecompressorTest) test_support.run_unittest(FuncTest) | suite = unittest.TestSuite() for test in (BZ2FileTest, BZ2CompressorTest, BZ2DecompressorTest, FuncTest): suite.addTest(unittest.makeSuite(test)) test_support.run_suite(suite) | def test_main(): test_support.run_unittest(BZ2FileTest) test_support.run_unittest(BZ2CompressorTest) test_support.run_unittest(BZ2DecompressorTest) test_support.run_unittest(FuncTest) | df273a376d6adfdd8eb639f3c53f0e2adedd2363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df273a376d6adfdd8eb639f3c53f0e2adedd2363/test_bz2.py |
for version in ['8.4', '84', '8.3', '83', '8.2', | for version in ['8.5', '85', '8.4', '84', '8.3', '83', '8.2', | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 5c5027a6b27076e9a46666e9d82c34f628c9e242 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5c5027a6b27076e9a46666e9d82c34f628c9e242/setup.py |
text='when tab key inserts spaces,\nspaces per tab') | text='when tab key inserts spaces,\nspaces per indent') | 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.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per tab') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) labeltabColsTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts tabs,\ncolumns per tab') self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
labeltabColsTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts tabs,\ncolumns per tab') self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, orient='horizontal',tickinterval=2,from_=2,to=8) | 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.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per tab') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) labeltabColsTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts tabs,\ncolumns per tab') self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
|
labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) self.scaleTabCols.pack(side=TOP,padx=5,fill=X) | 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.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per tab') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) labeltabColsTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts tabs,\ncolumns per tab') self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
|
def LoadTabCfg(self): ##indent type radibuttons spaceIndent=idleConf.GetOption('main','Indent','use-spaces', default=1,type='bool') self.indentBySpaces.set(spaceIndent) ##indent sizes spaceNum=idleConf.GetOption('main','Indent','num-spaces', default=4,type='int') tabCols=idleConf.GetOption('main','Indent','tab-cols', default=4,type='int') self.spaceNum.set(spaceNum) self.tabCols.set(tabCols) | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
||
tabCols=idleConf.GetOption('main','Indent','tab-cols', default=4,type='int') | def LoadTabCfg(self): ##indent type radibuttons spaceIndent=idleConf.GetOption('main','Indent','use-spaces', default=1,type='bool') self.indentBySpaces.set(spaceIndent) ##indent sizes spaceNum=idleConf.GetOption('main','Indent','num-spaces', default=4,type='int') tabCols=idleConf.GetOption('main','Indent','tab-cols', default=4,type='int') self.spaceNum.set(spaceNum) self.tabCols.set(tabCols) | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
|
self.tabCols.set(tabCols) | def LoadTabCfg(self): ##indent type radibuttons spaceIndent=idleConf.GetOption('main','Indent','use-spaces', default=1,type='bool') self.indentBySpaces.set(spaceIndent) ##indent sizes spaceNum=idleConf.GetOption('main','Indent','num-spaces', default=4,type='int') tabCols=idleConf.GetOption('main','Indent','tab-cols', default=4,type='int') self.spaceNum.set(spaceNum) self.tabCols.set(tabCols) | 22cc40d7b201cf9033ebbca4fe11980daac2a344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/22cc40d7b201cf9033ebbca4fe11980daac2a344/configDialog.py |
|
elif compiler == "gcc" or compiler == "g++": | elif compiler[:3] == "gcc" or compiler[:3] == "g++": | def runtime_library_dir_option(self, dir): # XXX Hackish, at the very least. See Python bug #445902: # http://sourceforge.net/tracker/index.php # ?func=detail&aid=445902&group_id=5470&atid=105470 # Linkers on different platforms need different options to # specify that directories need to be added to the list of # directories searched for dependencies when a dynamic library # is sought. GCC has to be told to pass the -R option through # to the linker, whereas other compilers just know this. # Other compilers may need something slightly different. At # this time, there's no way to determine this information from # the configuration data stored in the Python installation, so # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir elif compiler == "gcc" or compiler == "g++": return "-Wl,-R" + dir else: return "-R" + dir | b2b4a971a32bc5d3080812f59fa731e468696290 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b2b4a971a32bc5d3080812f59fa731e468696290/unixccompiler.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_unicode(self): for s in [u"", u"Andr Previn", u"abc", u" "*10000]: new = marshal.loads(marshal.dumps(s)) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) marshal.dump(s, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_string(self): for s in ["", "Andr Previn", "abc", " "*10000]: new = marshal.loads(marshal.dumps(s)) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) marshal.dump(s, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_buffer(self): for s in ["", "Andr Previn", "abc", " "*10000]: b = buffer(s) new = marshal.loads(marshal.dumps(b)) self.assertEqual(s, new) marshal.dump(b, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(s, new) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_dict(self): new = marshal.loads(marshal.dumps(self.d)) self.assertEqual(self.d, new) marshal.dump(self.d, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(self.d, new) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_list(self): lst = self.d.items() new = marshal.loads(marshal.dumps(lst)) self.assertEqual(lst, new) marshal.dump(lst, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(lst, new) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_tuple(self): t = tuple(self.d.keys()) new = marshal.loads(marshal.dumps(t)) self.assertEqual(t, new) marshal.dump(t, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(t, new) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
marshal.load(file(test_support.TESTFN, "rb")) | new = marshal.load(file(test_support.TESTFN, "rb")) | def test_sets(self): for constructor in (set, frozenset): t = constructor(self.d.keys()) new = marshal.loads(marshal.dumps(t)) self.assertEqual(t, new) self.assert_(isinstance(new, constructor)) self.assertNotEqual(id(t), id(new)) marshal.dump(t, file(test_support.TESTFN, "wb")) marshal.load(file(test_support.TESTFN, "rb")) self.assertEqual(t, new) os.unlink(test_support.TESTFN) | 605586a925121ac8d40dc68dcb21bf374fc9e92b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/605586a925121ac8d40dc68dcb21bf374fc9e92b/test_marshal.py |
cmd_obj = self.get_command_obj (command) for (key, val) in cmd_options.items(): cmd_obj.set_option (key, val) | opt_dict = self.get_option_dict(command) for (opt, val) in cmd_options.items(): opt_dict[opt] = ("setup script", val) | def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then uses 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some null value: 0, None, an empty list or dictionary, etc.) Most importantly, initialize the 'command_obj' attribute to the empty dictionary; this will be filled in with real command objects by 'parse_command_line()'.""" | d04317b4861d42ea9dafafd880f204eaa8e6b485 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d04317b4861d42ea9dafafd880f204eaa8e6b485/dist.py |
if not self.command_options.has_key(section): self.command_options[section] = {} opts = self.command_options[section] | opt_dict = self.get_option_dict(section) | def parse_config_files (self, filenames=None): | d04317b4861d42ea9dafafd880f204eaa8e6b485 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d04317b4861d42ea9dafafd880f204eaa8e6b485/dist.py |
opts[opt] = (filename, parser.get(section,opt)) | opt_dict[opt] = (filename, parser.get(section,opt)) | def parse_config_files (self, filenames=None): | d04317b4861d42ea9dafafd880f204eaa8e6b485 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d04317b4861d42ea9dafafd880f204eaa8e6b485/dist.py |
if not self.command_options.has_key(command): self.command_options[command] = {} cmd_opts = self.command_options[command] | opt_dict = self.get_option_dict(command) | def _parse_command_opts (self, parser, args): | d04317b4861d42ea9dafafd880f204eaa8e6b485 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d04317b4861d42ea9dafafd880f204eaa8e6b485/dist.py |
cmd_opts[name] = ("command line", value) | opt_dict[name] = ("command line", value) | def _parse_command_opts (self, parser, args): | d04317b4861d42ea9dafafd880f204eaa8e6b485 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d04317b4861d42ea9dafafd880f204eaa8e6b485/dist.py |
__all__ = ["Random","seed","random","uniform","randint","choice", | __all__ = ["Random","seed","random","uniform","randint","choice","sample", | def create_generators(num, delta, firstseed=None): ""\"Return list of num distinct generators. Each generator has its own unique segment of delta elements from Random.random()'s full period. Seed the first generator with optional arg firstseed (default is None, to seed from current time). ""\" from random import Random g = Random(firstseed) result = [g] for i in range(num - 1): laststate = g.getstate() g = Random() g.setstate(laststate) g.jumpahead(delta) result.append(g) return result | 698ab7517f13b040ef8433d5a4175c0580f66c78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/698ab7517f13b040ef8433d5a4175c0580f66c78/random.py |
def _test(N=20000): | def _test_sample(n): population = xrange(n) for k in xrange(n+1): s = sample(population, k) assert len(dict([(elem,True) for elem in s])) == len(s) == k def _sample_generator(n, k): return sample(xrange(n), k)[k//2] def _test(N=2000): | def _test(N=20000): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 print 'NV_MAGICCONST =', NV_MAGICCONST print 'SG_MAGICCONST =', SG_MAGICCONST _test_generator(N, 'random()') _test_generator(N, 'normalvariate(0.0, 1.0)') _test_generator(N, 'lognormvariate(0.0, 1.0)') _test_generator(N, 'cunifvariate(0.0, 1.0)') _test_generator(N, 'expovariate(1.0)') _test_generator(N, 'vonmisesvariate(0.0, 1.0)') _test_generator(N, 'gammavariate(0.01, 1.0)') _test_generator(N, 'gammavariate(0.1, 1.0)') _test_generator(N, 'gammavariate(0.1, 2.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') _test_generator(N, 'gammavariate(1.0, 1.0)') _test_generator(N, 'gammavariate(2.0, 1.0)') _test_generator(N, 'gammavariate(20.0, 1.0)') _test_generator(N, 'gammavariate(200.0, 1.0)') _test_generator(N, 'gauss(0.0, 1.0)') _test_generator(N, 'betavariate(3.0, 3.0)') _test_generator(N, 'paretovariate(1.0)') _test_generator(N, 'weibullvariate(1.0, 1.0)') # Test jumpahead. s = getstate() jumpahead(N) r1 = random() # now do it the slow way setstate(s) for i in range(N): random() r2 = random() if r1 != r2: raise ValueError("jumpahead test failed " + `(N, r1, r2)`) | 698ab7517f13b040ef8433d5a4175c0580f66c78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/698ab7517f13b040ef8433d5a4175c0580f66c78/random.py |
def check_processing_instruction_only(self): | def test_processing_instruction_only(self): | def check_processing_instruction_only(self): self._run_check("<?processing instruction>", [ ("pi", "processing instruction"), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_simple_html(self): | def test_simple_html(self): | def check_simple_html(self): self._run_check(""" | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_bad_nesting(self): | def test_bad_nesting(self): | def check_bad_nesting(self): self._run_check("<a><b></a></b>", [ ("starttag", "a", []), ("starttag", "b", []), ("endtag", "a"), ("endtag", "b"), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_attr_syntax(self): | def test_attr_syntax(self): | def check_attr_syntax(self): output = [ ("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)]) ] self._run_check("""<a b='v' c="v" d=v e>""", output) self._run_check("""<a b = 'v' c = "v" d = v e>""", output) self._run_check("""<a\nb\n=\n'v'\nc\n=\n"v"\nd\n=\nv\ne>""", output) self._run_check("""<a\tb\t=\t'v'\tc\t=\t"v"\td\t=\tv\te>""", output) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_attr_values(self): | def test_attr_values(self): | def check_attr_values(self): self._run_check("""<a b='xxx\n\txxx' c="yyy\t\nyyy" d='\txyz\n'>""", [("starttag", "a", [("b", "xxx\n\txxx"), ("c", "yyy\t\nyyy"), ("d", "\txyz\n")]) ]) self._run_check("""<a b='' c="">""", [ ("starttag", "a", [("b", ""), ("c", "")]), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_attr_entity_replacement(self): | def test_attr_entity_replacement(self): | def check_attr_entity_replacement(self): self._run_check("""<a b='&><"''>""", [ ("starttag", "a", [("b", "&><\"'")]), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_attr_funky_names(self): | def test_attr_funky_names(self): | def check_attr_funky_names(self): self._run_check("""<a a.b='v' c:d=v e-f=v>""", [ ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_starttag_end_boundary(self): | def test_starttag_end_boundary(self): | def check_starttag_end_boundary(self): self._run_check("""<a b='<'>""", [("starttag", "a", [("b", "<")])]) self._run_check("""<a b='>'>""", [("starttag", "a", [("b", ">")])]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_buffer_artefacts(self): | def test_buffer_artefacts(self): | def check_buffer_artefacts(self): output = [("starttag", "a", [("b", "<")])] self._run_check(["<a b='<'>"], output) self._run_check(["<a ", "b='<'>"], output) self._run_check(["<a b", "='<'>"], output) self._run_check(["<a b=", "'<'>"], output) self._run_check(["<a b='<", "'>"], output) self._run_check(["<a b='<'", ">"], output) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_starttag_junk_chars(self): | def test_starttag_junk_chars(self): | def check_starttag_junk_chars(self): self._parse_error("<") self._parse_error("<>") self._parse_error("</>") self._parse_error("</$>") self._parse_error("</") self._parse_error("</a") self._parse_error("<a<a>") self._parse_error("</a<a>") self._parse_error("<$") self._parse_error("<$>") self._parse_error("<!") self._parse_error("<a $>") self._parse_error("<a") self._parse_error("<a foo='bar'") self._parse_error("<a foo='bar") self._parse_error("<a foo='>'") self._parse_error("<a foo='>") self._parse_error("<a foo=>") | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_declaration_junk_chars(self): | def test_declaration_junk_chars(self): | def check_declaration_junk_chars(self): self._parse_error("<!DOCTYPE foo $ >") | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_startendtag(self): | def test_startendtag(self): | def check_startendtag(self): self._run_check("<p/>", [ ("startendtag", "p", []), ]) self._run_check("<p></p>", [ ("starttag", "p", []), ("endtag", "p"), ]) self._run_check("<p><img src='foo' /></p>", [ ("starttag", "p", []), ("startendtag", "img", [("src", "foo")]), ("endtag", "p"), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_get_starttag_text(self): | def test_get_starttag_text(self): | def check_get_starttag_text(self): s = """<foo:bar \n one="1"\ttwo=2 >""" self._run_check_extra(s, [ ("starttag", "foo:bar", [("one", "1"), ("two", "2")]), ("starttag_text", s)]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
def check_cdata_content(self): | def test_cdata_content(self): | def check_cdata_content(self): s = """<script> <!-- not a comment --> ¬-an-entity-ref; </script>""" self._run_check(s, [ ("starttag", "script", []), ("data", " <!-- not a comment --> ¬-an-entity-ref; "), ("endtag", "script"), ]) s = """<script> <not a='start tag'> </script>""" self._run_check(s, [ ("starttag", "script", []), ("data", " <not a='start tag'> "), ("endtag", "script"), ]) | 742542a88fb7dc018e41593629baf7f75f78c1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742542a88fb7dc018e41593629baf7f75f78c1e6/test_htmlparser.py |
'lib.' + self.plat) | 'lib-' + plat_specifier) | def finalize_options (self): | 5d0298eae0f31c97258fc2808a0c47e8d2bda9d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d0298eae0f31c97258fc2808a0c47e8d2bda9d0/build.py |
'temp.' + self.plat) | 'temp-' + plat_specifier) | def finalize_options (self): | 5d0298eae0f31c97258fc2808a0c47e8d2bda9d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d0298eae0f31c97258fc2808a0c47e8d2bda9d0/build.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.