rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
expected = longx // longy got = x // y
expected = longx / longy got = x / y
def checkit(*args): # Heavy use of nested scopes here! verify(got == expected, "for %r expected %r got %r" % (args, expected, got))
3de245bd9e6e977edf0f52dd6adba5e57c0c3cdc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3de245bd9e6e977edf0f52dd6adba5e57c0c3cdc/test_long.py
if importer in (None, True, False):
if importer is None:
def get_importer(path_item): """Retrieve a PEP 302 importer for the given path item The returned importer is cached in sys.path_importer_cache if it was newly created by a path hook. If there is no importer, a wrapper around the basic import machinery is returned. This wrapper is never inserted into the importer cache (None is inserted instead). The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for path_hook in sys.path_hooks: try: importer = path_hook(path_item) break except ImportError: pass else: importer = None sys.path_importer_cache.setdefault(path_item, importer) # The boolean values are used for caching valid and invalid # file paths for the built-in import machinery if importer in (None, True, False): try: importer = ImpImporter(path_item) except ImportError: importer = None return importer
8a611a4b2a6cca42fdd7bf76558cc424bfcdab44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8a611a4b2a6cca42fdd7bf76558cc424bfcdab44/pkgutil.py
tcl_version = self.tk.getvar('tcl_version')
tcl_version = str(self.tk.getvar('tcl_version'))
def __init__(self, screenName=None, baseName=None, className='Tk'): """Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.""" global _default_root self.master = None self.children = {} if baseName is None: import sys, os baseName = os.path.basename(sys.argv[0]) baseName, ext = os.path.splitext(baseName) if ext not in ('.py', '.pyc', '.pyo'): baseName = baseName + ext self.tk = _tkinter.create(screenName, baseName, className) self.tk.wantobjects(wantobjects) if _MacOS and hasattr(_MacOS, 'SchedParams'): # Disable event scanning except for Command-Period _MacOS.SchedParams(1, 0) # Work around nasty MacTk bug # XXX Is this one still needed? self.update() # Version sanity checks tk_version = self.tk.getvar('tk_version') if tk_version != _tkinter.TK_VERSION: raise RuntimeError, \ "tk.h version (%s) doesn't match libtk.a version (%s)" \ % (_tkinter.TK_VERSION, tk_version) tcl_version = self.tk.getvar('tcl_version') if tcl_version != _tkinter.TCL_VERSION: raise RuntimeError, \ "tcl.h version (%s) doesn't match libtcl.a version (%s)" \ % (_tkinter.TCL_VERSION, tcl_version) if TkVersion < 4.0: raise RuntimeError, \ "Tk 4.0 or higher is required; found Tk %s" \ % str(TkVersion) self.tk.createcommand('tkerror', _tkerror) self.tk.createcommand('exit', _exit) self.readprofile(baseName, className) if _support_default_root and not _default_root: _default_root = self self.protocol("WM_DELETE_WINDOW", self.destroy)
69bf992a9cc282c0d3fe42640cbbc6b944807671 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69bf992a9cc282c0d3fe42640cbbc6b944807671/Tkinter.py
except:
except ValueError:
def do_clear(self, arg): """Three possibilities, tried in this order: clear -> clear all breaks, ask for confirmation clear file:lineno -> clear all breaks at file:lineno clear bpno bpno ... -> clear breakpoints by number""" if not arg: try: reply = raw_input('Clear all breaks? ') except EOFError: reply = 'no' reply = reply.strip().lower() if reply in ('y', 'yes'): self.clear_all_breaks() return if ':' in arg: # Make sure it works for "clear C:\foo\bar.py:12" i = arg.rfind(':') filename = arg[:i] arg = arg[i+1:] try: lineno = int(arg) except: err = "Invalid line number (%s)" % arg else: err = self.clear_break(filename, lineno) if err: print '***', err return numberlist = arg.split() for i in numberlist: if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): print 'No breakpoint numbered', i continue err = self.clear_bpbynumber(i) if err: print '***', err else: print 'Deleted breakpoint', i
d7c47443e344fd8563ed4632ded41d604c43f436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d7c47443e344fd8563ed4632ded41d604c43f436/pdb.py
del context[objid]
del context[objid]
def __format(self, object, stream, indent, allowance, context, level): level = level + 1 if context.has_key(id(object)): object = _Recursion(object) self.__recursive = 1 rep = self.__repr(object, context, level - 1) objid = id(object) context[objid] = 1 typ = type(object) sepLines = len(rep) > (self.__width - 1 - indent - allowance)
deaab478cf979ca5099b3fc2f8eb5d1bba4014e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/deaab478cf979ca5099b3fc2f8eb5d1bba4014e2/pprint.py
def test_monotonic(self): data = hamlet_scene * 8 * 16 last = length = len(zlib.compress(data, 0)) self.failUnless(last > len(data), "compress level 0 always expands") for level in range(10): length = len(zlib.compress(data, level)) self.failUnless(length <= last, 'compress level %d more effective than %d!' % ( level-1, level)) last = length
def test_monotonic(self): # higher compression levels should not expand compressed size data = hamlet_scene * 8 * 16 last = length = len(zlib.compress(data, 0)) self.failUnless(last > len(data), "compress level 0 always expands") for level in range(10): length = len(zlib.compress(data, level)) self.failUnless(length <= last, 'compress level %d more effective than %d!' % ( level-1, level)) last = length
a8accbc986b049cf9c4115d93a8afbee1e8b4084 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8accbc986b049cf9c4115d93a8afbee1e8b4084/test_zlib.py
def urlencode(dict): """Encode a dictionary of form entries into a URL query string."""
def urlencode(dict,doseq=0): """Encode a dictionary of form entries into a URL query string. If any values in the dict are sequences and doseq is true, each sequence element is converted to a separate parameter. """
def urlencode(dict): """Encode a dictionary of form entries into a URL query string.""" l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return '&'.join(l)
dc96718325c24bb87c4eb4e181acb45ca3ecc26e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc96718325c24bb87c4eb4e181acb45ca3ecc26e/urllib.py
for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v)
if not doseq: for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) else: for k, v in dict.items(): k = quote_plus(str(k)) if type(v) == types.StringType: v = quote_plus(v) l.append(k + '=' + v) elif type(v) == types.UnicodeType: v = quote_plus(v.encode("ASCII","replace")) l.append(k + '=' + v) else: try: x = len(v) except TypeError: v = quote_plus(str(v)) l.append(k + '=' + v) else: for elt in v: l.append(k + '=' + quote_plus(str(elt)))
def urlencode(dict): """Encode a dictionary of form entries into a URL query string.""" l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return '&'.join(l)
dc96718325c24bb87c4eb4e181acb45ca3ecc26e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dc96718325c24bb87c4eb4e181acb45ca3ecc26e/urllib.py
def _get_tagged_response(self, tag):
381ebd9c81ad673a385463386d53d9af3ce7a1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/381ebd9c81ad673a385463386d53d9af3ce7a1fc/imaplib.py
_mesg('abort exception ignored: %s' % val)
def _get_tagged_response(self, tag):
381ebd9c81ad673a385463386d53d9af3ce7a1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/381ebd9c81ad673a385463386d53d9af3ce7a1fc/imaplib.py
code = compile(line + '\n', '<stdin>', 'single')
def default(self, line): if line[:1] == '!': line = line[1:] locals = self.curframe.f_locals globals = self.curframe.f_globals globals['__privileged__'] = 1 code = compile(line + '\n', '<stdin>', 'single') try: exec code in globals, locals except: if type(sys.exc_type) == type(''): exc_type_name = sys.exc_type else: exc_type_name = sys.exc_type.__name__ print '***', exc_type_name + ':', sys.exc_value
ca512bb388cb3d32f989c6cf7c1aca0ffc0f9ee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca512bb388cb3d32f989c6cf7c1aca0ffc0f9ee7/pdb.py
""" Check whether 'str' contains ANY of the chars in 'set' """
"""Check whether 'str' contains ANY of the chars in 'set'"""
def containsAny(str, set): """ Check whether 'str' contains ANY of the chars in 'set' """ return 1 in [c in str for c in set]
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
""" Helper for getFilesForName(). """
"""Helper for getFilesForName()."""
def _visit_pyfiles(list, dirname, names): """ Helper for getFilesForName(). """ # get extension for python source files if not globals().has_key('_py_ext'): import imp global _py_ext _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories if 'CVS' in names: names.remove('CVS') # add all *.py files to list list.extend( [os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext])
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
import imp
def _visit_pyfiles(list, dirname, names): """ Helper for getFilesForName(). """ # get extension for python source files if not globals().has_key('_py_ext'): import imp global _py_ext _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories if 'CVS' in names: names.remove('CVS') # add all *.py files to list list.extend( [os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext])
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
_py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0]
_py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0]
def _visit_pyfiles(list, dirname, names): """ Helper for getFilesForName(). """ # get extension for python source files if not globals().has_key('_py_ext'): import imp global _py_ext _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories if 'CVS' in names: names.remove('CVS') # add all *.py files to list list.extend( [os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext])
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
[os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext])
[os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext] )
def _visit_pyfiles(list, dirname, names): """ Helper for getFilesForName(). """ # get extension for python source files if not globals().has_key('_py_ext'): import imp global _py_ext _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] # don't recurse into CVS directories if 'CVS' in names: names.remove('CVS') # add all *.py files to list list.extend( [os.path.join(dirname, file) for file in names if os.path.splitext(file)[1] == _py_ext])
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
""" Get the filesystem path for a module or a package. Return the file system path to a file for a module, and to a directory for a package. Return None if the name is not found, or is a builtin or extension module.
"""Get the filesystem path for a module or a package. Return the file system path to a file for a module, and to a directory for a package. Return None if the name is not found, or is a builtin or extension module.
def _get_modpkg_path(dotted_name, pathlist=None): """ Get the filesystem path for a module or a package. Return the file system path to a file for a module, and to a directory for a package. Return None if the name is not found, or is a builtin or extension module. """ import imp # split off top-most name parts = dotted_name.split('.', 1) if len(parts) > 1: # we have a dotted path, import top-level package try: file, pathname, description = imp.find_module(parts[0], pathlist) if file: file.close() except ImportError: return None # check if it's indeed a package if description[2] == imp.PKG_DIRECTORY: # recursively handle the remaining name parts pathname = _get_modpkg_path(parts[1], [pathname]) else: pathname = None else: # plain name try: file, pathname, description = imp.find_module(dotted_name, pathlist) if file: file.close() if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: pathname = None except ImportError: pathname = None return pathname
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
import imp
def _get_modpkg_path(dotted_name, pathlist=None): """ Get the filesystem path for a module or a package. Return the file system path to a file for a module, and to a directory for a package. Return None if the name is not found, or is a builtin or extension module. """ import imp # split off top-most name parts = dotted_name.split('.', 1) if len(parts) > 1: # we have a dotted path, import top-level package try: file, pathname, description = imp.find_module(parts[0], pathlist) if file: file.close() except ImportError: return None # check if it's indeed a package if description[2] == imp.PKG_DIRECTORY: # recursively handle the remaining name parts pathname = _get_modpkg_path(parts[1], [pathname]) else: pathname = None else: # plain name try: file, pathname, description = imp.find_module(dotted_name, pathlist) if file: file.close() if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: pathname = None except ImportError: pathname = None return pathname
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
file, pathname, description = imp.find_module(dotted_name, pathlist) if file: file.close()
file, pathname, description = imp.find_module( dotted_name, pathlist) if file: file.close()
def _get_modpkg_path(dotted_name, pathlist=None): """ Get the filesystem path for a module or a package. Return the file system path to a file for a module, and to a directory for a package. Return None if the name is not found, or is a builtin or extension module. """ import imp # split off top-most name parts = dotted_name.split('.', 1) if len(parts) > 1: # we have a dotted path, import top-level package try: file, pathname, description = imp.find_module(parts[0], pathlist) if file: file.close() except ImportError: return None # check if it's indeed a package if description[2] == imp.PKG_DIRECTORY: # recursively handle the remaining name parts pathname = _get_modpkg_path(parts[1], [pathname]) else: pathname = None else: # plain name try: file, pathname, description = imp.find_module(dotted_name, pathlist) if file: file.close() if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]: pathname = None except ImportError: pathname = None return pathname
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
""" Get a list of module files for a filename, a module or package name, or a directory.
"""Get a list of module files for a filename, a module or package name, or a directory.
def getFilesForName(name): """ Get a list of module files for a filename, a module or package name, or a directory. """ import imp if not os.path.exists(name): # check for glob chars if containsAny(name, "*?[]"): import glob files = glob.glob(name) list = [] for file in files: list.extend(getFilesForName(file)) return list # try to find module or package name = _get_modpkg_path(name) if not name: return [] if os.path.isdir(name): # find all python files in directory list = [] os.path.walk(name, _visit_pyfiles, list) return list elif os.path.exists(name): # a single file return [name] return []
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
import imp
def getFilesForName(name): """ Get a list of module files for a filename, a module or package name, or a directory. """ import imp if not os.path.exists(name): # check for glob chars if containsAny(name, "*?[]"): import glob files = glob.glob(name) list = [] for file in files: list.extend(getFilesForName(file)) return list # try to find module or package name = _get_modpkg_path(name) if not name: return [] if os.path.isdir(name): # find all python files in directory list = [] os.path.walk(name, _visit_pyfiles, list) return list elif os.path.exists(name): # a single file return [name] return []
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
import glob
def getFilesForName(name): """ Get a list of module files for a filename, a module or package name, or a directory. """ import imp if not os.path.exists(name): # check for glob chars if containsAny(name, "*?[]"): import glob files = glob.glob(name) list = [] for file in files: list.extend(getFilesForName(file)) return list # try to find module or package name = _get_modpkg_path(name) if not name: return [] if os.path.isdir(name): # find all python files in directory list = [] os.path.walk(name, _visit_pyfiles, list) return list elif os.path.exists(name): # a single file return [name] return []
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
def __openseen(self, ttype, tstring, lineno): if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data: self.__addentry(EMPTYSTRING.join(self.__data)) self.__state = self.__waiting elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]: # warn if we see anything else than STRING or whitespace print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno} self.__state = self.__waiting
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno}
print >> sys.stderr, _( '*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"' ) % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno }
def __openseen(self, ttype, tstring, lineno): if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data: self.__addentry(EMPTYSTRING.join(self.__data)) self.__state = self.__waiting elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]: # warn if we see anything else than STRING or whitespace print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno} self.__state = self.__waiting
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
_('*** Seen unexpected token "%(token)s"' % {'token': 'test'})
_('*** Seen unexpected token "%(token)s"') % {'token': 'test'}
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:X:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstrings', 'no-docstrings', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' writelocations = 1 locationstyle = GNU verbose = 0 width = 78 excludefilename = '' docstrings = 0 nodocstrings = {} options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-D', '--docstrings'): options.docstrings = 1 elif opt in ('-k', '--keyword'): options.keywords.append(arg) elif opt in ('-K', '--no-default-keywords'): default_keywords = [] elif opt in ('-n', '--add-location'): options.writelocations = 1 elif opt in ('--no-location',): options.writelocations = 0 elif opt in ('-S', '--style'): options.locationstyle = locations.get(arg.lower()) if options.locationstyle is None: usage(1, _('Invalid value for --style: %s') % arg) elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: usage(1, _('--width argument must be an integer: %s') % arg) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg elif opt in ('-X', '--no-docstrings'): fp = open(arg) try: while 1: line = fp.readline() if not line: break options.nodocstrings[line[:-1]] = 1 finally: fp.close() # calculate escapes make_escapes(options.escape) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: print >> sys.stderr, _( "Can't read --exclude-file: %s") % options.excludefilename sys.exit(1) else: options.toexclude = [] # resolve args to module lists expanded = [] for arg in args: if arg == '-': expanded.append(arg) else: expanded.extend(getFilesForName(arg)) args = expanded # slurp through all the files eater = TokenEater(options) for filename in args: if filename == '-': if options.verbose: print _('Reading standard input') fp = sys.stdin closep = 0 else: if options.verbose: print _('Working on %s') % filename fp = open(filename) closep = 1 try: eater.set_filename(filename) try: tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: print >> sys.stderr, '%s: %s, line %d, column %d' % ( e[0], filename, e[1][0], e[1][1]) finally: if closep: fp.close() # write the output if options.outfile == '-': fp = sys.stdout closep = 0 else: if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') closep = 1 try: eater.write(fp) finally: if closep: fp.close()
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:X:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstrings', 'no-docstrings', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' writelocations = 1 locationstyle = GNU verbose = 0 width = 78 excludefilename = '' docstrings = 0 nodocstrings = {} options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-D', '--docstrings'): options.docstrings = 1 elif opt in ('-k', '--keyword'): options.keywords.append(arg) elif opt in ('-K', '--no-default-keywords'): default_keywords = [] elif opt in ('-n', '--add-location'): options.writelocations = 1 elif opt in ('--no-location',): options.writelocations = 0 elif opt in ('-S', '--style'): options.locationstyle = locations.get(arg.lower()) if options.locationstyle is None: usage(1, _('Invalid value for --style: %s') % arg) elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: usage(1, _('--width argument must be an integer: %s') % arg) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg elif opt in ('-X', '--no-docstrings'): fp = open(arg) try: while 1: line = fp.readline() if not line: break options.nodocstrings[line[:-1]] = 1 finally: fp.close() # calculate escapes make_escapes(options.escape) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: print >> sys.stderr, _( "Can't read --exclude-file: %s") % options.excludefilename sys.exit(1) else: options.toexclude = [] # resolve args to module lists expanded = [] for arg in args: if arg == '-': expanded.append(arg) else: expanded.extend(getFilesForName(arg)) args = expanded # slurp through all the files eater = TokenEater(options) for filename in args: if filename == '-': if options.verbose: print _('Reading standard input') fp = sys.stdin closep = 0 else: if options.verbose: print _('Working on %s') % filename fp = open(filename) closep = 1 try: eater.set_filename(filename) try: tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: print >> sys.stderr, '%s: %s, line %d, column %d' % ( e[0], filename, e[1][0], e[1][1]) finally: if closep: fp.close() # write the output if options.outfile == '-': fp = sys.stdout closep = 0 else: if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') closep = 1 try: eater.write(fp) finally: if closep: fp.close()
580440e357ef5697439695d88ac36c3974e15cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/580440e357ef5697439695d88ac36c3974e15cf7/pygettext.py
self.assertEqual(stderr, "pineapple")
self.assert_(stderr.startswith("pineapple"))
def test_communicate_stderr(self): p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("pineapple")'], stderr=subprocess.PIPE) (stdout, stderr) = p.communicate() self.assertEqual(stdout, None) self.assertEqual(stderr, "pineapple")
e3a8f9040be952cae93076c022c8f8e8c961460c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e3a8f9040be952cae93076c022c8f8e8c961460c/test_subprocess.py
import string if len(id) == 0:
global _idprog if not _idprog: _idprog = compile(r"[a-zA-Z_]\w*$") if _idprog.match(id): return 1 else:
def valid_identifier(id): import string if len(id) == 0: return 0 if id[0] not in string.letters+'_': return 0 for char in id[1:]: if not syntax_table[char] & word: return 0 return 1
3ecf7f8d6d93ee941473697dc2f24ded3433bc19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3ecf7f8d6d93ee941473697dc2f24ded3433bc19/re.py
if id[0] not in string.letters+'_': return 0 for char in id[1:]: if not syntax_table[char] & word: return 0 return 1
def valid_identifier(id): import string if len(id) == 0: return 0 if id[0] not in string.letters+'_': return 0 for char in id[1:]: if not syntax_table[char] & word: return 0 return 1
3ecf7f8d6d93ee941473697dc2f24ded3433bc19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3ecf7f8d6d93ee941473697dc2f24ded3433bc19/re.py
without effecting this threads data:
without affecting this thread's data:
... def squared(self):
642ab44f8cfdab09a749bf3537064951b54a76e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/642ab44f8cfdab09a749bf3537064951b54a76e4/_threading_local.py
pass
pass
def __del__(self): key = __getattribute__(self, '_local__key')
642ab44f8cfdab09a749bf3537064951b54a76e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/642ab44f8cfdab09a749bf3537064951b54a76e4/_threading_local.py
if err[0] = errno.EINTR:
if err[0] == errno.EINTR:
def makefile(self, mode, bufsize=None): """Return a readable file-like object with data from socket.
7d46c47eab6c902fba69e0e7d4a9178135ea9d55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7d46c47eab6c902fba69e0e7d4a9178135ea9d55/httplib.py
'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME',
'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMultipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME',
def test__all__(self): module = __import__('email') all = module.__all__ all.sort() self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator', 'Header', 'Iterators', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEText', 'Message', 'Parser', 'Utils', 'base64MIME', 'message_from_file', 'message_from_string', 'quopriMIME'])
2c460f432978ae90ba6149b5ff553a340bde7087 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2c460f432978ae90ba6149b5ff553a340bde7087/test_email.py
test_support.run_unittest(TestSFbugs) test_support.run_doctest(difflib)
Doctests = doctest.DocTestSuite(difflib) test_support.run_unittest(TestSFbugs, Doctests)
def test_ratio_for_null_seqn(self): # Check clearing of SF bug 763023 s = difflib.SequenceMatcher(None, [], []) self.assertEqual(s.ratio(), 1) self.assertEqual(s.quick_ratio(), 1) self.assertEqual(s.real_quick_ratio(), 1)
8f350650e1a8c3adb15418c560c9818eca2663d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8f350650e1a8c3adb15418c560c9818eca2663d5/test_difflib.py
self.badmodules[name] = {m.__name__:None}
if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None
def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) self.badmodules[name] = {m.__name__:None} elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name self.badmodules[fullname] = {m.__name__:None} else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m)
a83f608141cb2ac6f06e8d2fe5d067d901860b34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a83f608141cb2ac6f06e8d2fe5d067d901860b34/modulefinder.py
self.badmodules[fullname] = {m.__name__:None}
if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None
def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) self.badmodules[name] = {m.__name__:None} elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name self.badmodules[fullname] = {m.__name__:None} else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m)
a83f608141cb2ac6f06e8d2fe5d067d901860b34 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a83f608141cb2ac6f06e8d2fe5d067d901860b34/modulefinder.py
def AskPassword(prompt, default='', id=264):
def AskPassword(prompt, default='', id=264, ok=None, cancel=None):
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
h = d.GetDialogItemAsControl(3)
h = d.GetDialogItemAsControl(3)
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
h = d.GetDialogItemAsControl(4)
pwd = d.GetDialogItemAsControl(4)
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999)
SetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag, default) d.SelectDialogItemText(4, 0, 999) Ctl.SetKeyboardFocus(d, pwd, kControlEditTextPart) if ok != None: h = d.GetDialogItemAsControl(1) h.SetControlTitle(ok) if cancel != None: h = d.GetDialogItemAsControl(2) h.SetControlTitle(cancel)
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
string = default oldschedparams = MacOS.SchedParams(0,0)
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
n = ModalDialog(None) if n == 1: h = d.GetDialogItemAsControl(4) return cr2lf(GetControlData(pwd, kControlEditTextPart, kControlEditTextPasswordTag)) if n == 2: return None
def AskPassword(prompt, default='', id=264): """Display a PROMPT string and a text entry field with a DEFAULT string. The string is displayed as bullets only. Return the contents of the text entry field when the user clicks the OK button or presses Return. Return None when the user clicks the Cancel button. If omitted, DEFAULT is empty. The PROMPT and DEFAULT strings, as well as the return value, can be at most 255 characters long. """ d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return h = d.GetDialogItemAsControl(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) h = d.GetDialogItemAsControl(4) # EDIT TEXT ITEM bullets = '\245'*len(default) SetDialogItemText(h, bullets ) d.SelectDialogItemText(4, 999, 999) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = default oldschedparams = MacOS.SchedParams(0,0) while 1: ready,ev = Evt.WaitNextEvent(Events.everyEvent, 6) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what in (Events.keyDown, Events.autoKey): charcode = msg & Events.charCodeMask if ( mod & Events.cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == Events.kReturnCharCode: break elif charcode == Events.kEscapeCharCode: string = None break elif charcode in (Events.kLeftArrowCharCode, Events.kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = 0245 # Octal code for bullet ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : break elif item == Dialogs.cancel : string = None break elif what == Events.mouseDown: part, win = Win.FindWindow(where) if part == Windows.inDrag and win: win.DragWindow(where, screenbounds) elif part == Windows.inMenuBar: MacOS.HandleEvent(ev) else: MacOS.SysBeep() # Cannot handle selections, unfortunately elif what == Events.updateEvt: MacOS.HandleEvent(ev) apply(MacOS.SchedParams, oldschedparams) return string
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
ok = AskYesNoCancel("Do you want to identify?", yes="Indentify", no="Don't identify")
ok = AskYesNoCancel("Do you want to identify?", yes="Identify", no="No")
def test(): import time Message("Testing EasyDialogs.") ok = AskYesNoCancel("Do you want to proceed?") ok = AskYesNoCancel("Do you want to identify?", yes="Indentify", no="Don't identify") if ok > 0: s = AskString("Enter your first name", "Joe") Message("Thank you,\n%s" % `s`) text = ( "Working Hard...", "Hardly Working..." , "So far, so good!", "Keep on truckin'" ) bar = ProgressBar("Progress, progress...", 100) try: appsw = MacOS.SchedParams(1, 0) for i in range(100): bar.set(i) time.sleep(0.1) if i % 10 == 0: bar.label(text[(i/10) % 4]) bar.label("Done.") time.sleep(0.3) # give'em a chance to see the done. finally: del bar apply(MacOS.SchedParams, appsw)
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
Message("Thank you,\n%s" % `s`)
s2 = AskPassword("Okay %s, tell us your nickname"%s, s, cancel="None") if not s2: Message("%s has no secret nickname"%s) else: Message("Hello everybody!!\nThe secret nickname of %s is %s!!!"%(s, s2))
def test(): import time Message("Testing EasyDialogs.") ok = AskYesNoCancel("Do you want to proceed?") ok = AskYesNoCancel("Do you want to identify?", yes="Indentify", no="Don't identify") if ok > 0: s = AskString("Enter your first name", "Joe") Message("Thank you,\n%s" % `s`) text = ( "Working Hard...", "Hardly Working..." , "So far, so good!", "Keep on truckin'" ) bar = ProgressBar("Progress, progress...", 100) try: appsw = MacOS.SchedParams(1, 0) for i in range(100): bar.set(i) time.sleep(0.1) if i % 10 == 0: bar.label(text[(i/10) % 4]) bar.label("Done.") time.sleep(0.3) # give'em a chance to see the done. finally: del bar apply(MacOS.SchedParams, appsw)
90b0ea2d82f49ab29f867e46e030f3c20954eaef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90b0ea2d82f49ab29f867e46e030f3c20954eaef/EasyDialogs.py
if not _urandomfd:
if _urandomfd is None:
def urandom(n): """urandom(n) -> str
734803df98a59a8355624c248a09169de60741f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/734803df98a59a8355624c248a09169de60741f2/os.py
pos = [-42] def negposreturn(exc): pos[0] += 1 return (u"?", pos[0]) codecs.register_error("test.negposreturn", negposreturn) "\xff".decode("ascii", "test.negposreturn") def hugeposreturn(exc): return (u"?", 424242) codecs.register_error("test.hugeposreturn", hugeposreturn) "\xff".decode("ascii", "test.hugeposreturn") "\\uyyyy".decode("raw-unicode-escape", "test.hugeposreturn")
handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) handler.pos = -1 self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"<?>0") handler.pos = -2 self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"<?><?>") handler.pos = -3 self.assertRaises(IndexError, "\xff0".decode, "ascii", "test.posreturn") handler.pos = 1 self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"<?>0") handler.pos = 2 self.assertEquals("\xff0".decode("ascii", "test.posreturn"), u"<?>") handler.pos = 3 self.assertRaises(IndexError, "\xff0".decode, "ascii", "test.posreturn") handler.pos = 6 self.assertEquals("\\uyyyy0".decode("raw-unicode-escape", "test.posreturn"), u"<?>0")
def baddecodereturn2(exc): return (u"?", None)
e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc/test_codeccallbacks.py
pos = [-42] def negposreturn(exc): pos[0] += 1 return (u"?", pos[0]) codecs.register_error("test.negposreturn", negposreturn) u"\xff".encode("ascii", "test.negposreturn") def hugeposreturn(exc): return (u"?", 424242) codecs.register_error("test.hugeposreturn", hugeposreturn) u"\xff".encode("ascii", "test.hugeposreturn")
handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) handler.pos = -1 self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "<?>0") handler.pos = -2 self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "<?><?>") handler.pos = -3 self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") handler.pos = 1 self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "<?>0") handler.pos = 2 self.assertEquals(u"\xff0".encode("ascii", "test.posreturn"), "<?>") handler.pos = 3 self.assertRaises(IndexError, u"\xff0".encode, "ascii", "test.posreturn") handler.pos = 0
def badencodereturn2(exc): return (u"?", None)
e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc/test_codeccallbacks.py
for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.hugeposreturn"):
for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "test.posreturn"):
def __getitem__(self, key): raise ValueError
e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1cd2c8d4bb9ad5181f6f5329f3d25fc05d33afc/test_codeccallbacks.py
def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2)
07683bc0c0ab3dd07c79614ef50514582b1114f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/07683bc0c0ab3dd07c79614ef50514582b1114f2/test_unicode.py
class String: x = '' def __str__(self): return self.x o = String() o.x = 'abc' verify(unicode(o) == u'abc') verify(str(o) == 'abc') o.x = u'abc' verify(unicode(o) == u'abc') verify(str(o) == 'abc') for obj in (123, 123.45, 123L): verify(unicode(obj) == unicode(str(obj)))
def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2)
07683bc0c0ab3dd07c79614ef50514582b1114f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/07683bc0c0ab3dd07c79614ef50514582b1114f2/test_unicode.py
"""Decide whether a particular character needs to be quoted.
"""Decide whether a particular character needs to be quoted.
def needsquoting(c, quotetabs): """Decide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
def needsquoting(c, quotetabs): """Decide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
"""Quote a single character.""" if c == ESCAPE: return ESCAPE * 2 else: i = ord(c) return ESCAPE + HEX[i/16] + HEX[i%16]
"""Quote a single character.""" i = ord(c) return ESCAPE + HEX[i/16] + HEX[i%16]
def quote(c): """Quote a single character.""" if c == ESCAPE: return ESCAPE * 2 else: i = ord(c) return ESCAPE + HEX[i/16] + HEX[i%16]
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
"""Read 'input', apply quoted-printable encoding, and write to 'output'.
"""Read 'input', apply quoted-printable encoding, and write to 'output'.
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted.""" while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted.""" while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted. """ while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted.""" while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
"""Read 'input', apply quoted-printable decoding, and write to 'output'.
"""Read 'input', apply quoted-printable decoding, and write to 'output'.
def decode(input, output): """Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1] == '\n': partial = 0; n = n-1 # Strip trailing whitespace while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: partial = 1 while i < n: c = line[i] if c <> ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break elif i+1 < n and line[i+1] == ESCAPE: new = new + ESCAPE; i = i+2 elif i+2 < n and ishex(line[i+1]) and ishex(line[i+2]): new = new + chr(unhex(line[i+1:i+3])); i = i+3 else: # Bad escape sequence -- leave it in new = new + c; i = i+1 if not partial: output.write(new + '\n') new = '' if new: output.write(new)
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1] == '\n': partial = 0; n = n-1 while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: partial = 1 while i < n: c = line[i] if c <> ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break elif i+1 < n and line[i+1] == ESCAPE: new = new + ESCAPE; i = i+2 elif i+2 < n and ishex(line[i+1]) and ishex(line[i+2]): new = new + chr(unhex(line[i+1:i+3])); i = i+3 else: new = new + c; i = i+1 if not partial: output.write(new + '\n') new = '' if new: output.write(new)
'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1] == '\n': partial = 0; n = n-1 while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: partial = 1 while i < n: c = line[i] if c <> ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break elif i+1 < n and line[i+1] == ESCAPE: new = new + ESCAPE; i = i+2 elif i+2 < n and ishex(line[i+1]) and ishex(line[i+2]): new = new + chr(unhex(line[i+1:i+3])); i = i+3 else: new = new + c; i = i+1 if not partial: output.write(new + '\n') new = '' if new: output.write(new)
def decode(input, output): """Read 'input', apply quoted-printable decoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() if not line: break i, n = 0, len(line) if n > 0 and line[n-1] == '\n': partial = 0; n = n-1 # Strip trailing whitespace while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: partial = 1 while i < n: c = line[i] if c <> ESCAPE: new = new + c; i = i+1 elif i+1 == n and not partial: partial = 1; break elif i+1 < n and line[i+1] == ESCAPE: new = new + ESCAPE; i = i+2 elif i+2 < n and ishex(line[i+1]) and ishex(line[i+2]): new = new + chr(unhex(line[i+1:i+3])); i = i+3 else: # Bad escape sequence -- leave it in new = new + c; i = i+1 if not partial: output.write(new + '\n') new = '' if new: output.write(new)
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
"""Return true if the character 'c' is a hexadecimal digit.""" return '0' <= c <= '9' or 'a' <= c <= 'f' or 'A' <= c <= 'F'
"""Return true if the character 'c' is a hexadecimal digit.""" return '0' <= c <= '9' or 'a' <= c <= 'f' or 'A' <= c <= 'F'
def ishex(c): """Return true if the character 'c' is a hexadecimal digit.""" return '0' <= c <= '9' or 'a' <= c <= 'f' or 'A' <= c <= 'F'
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
"""Get the integer value of a hexadecimal number.""" bits = 0 for c in s: if '0' <= c <= '9': i = ord('0') elif 'a' <= c <= 'f': i = ord('a')-10 elif 'A' <= c <= 'F': i = ord('A')-10 else: break bits = bits*16 + (ord(c) - i) return bits
"""Get the integer value of a hexadecimal number.""" bits = 0 for c in s: if '0' <= c <= '9': i = ord('0') elif 'a' <= c <= 'f': i = ord('a')-10 elif 'A' <= c <= 'F': i = ord('A')-10 else: break bits = bits*16 + (ord(c) - i) return bits
def unhex(s): """Get the integer value of a hexadecimal number.""" bits = 0 for c in s: if '0' <= c <= '9': i = ord('0') elif 'a' <= c <= 'f': i = ord('a')-10 elif 'A' <= c <= 'F': i = ord('A')-10 else: break bits = bits*16 + (ord(c) - i) return bits
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
def test(): import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
test()
test()
def test(): import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
f526971f3bf2401625c1aaa9a44fb6b7af11aee7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f526971f3bf2401625c1aaa9a44fb6b7af11aee7/quopri.py
_LegalCharsPatt = r"[\w\d!
_LegalCharsPatt = r"[\w\d!
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append
7437fc6f856bd54cce45880bf43ca993c607371d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7437fc6f856bd54cce45880bf43ca993c607371d/Cookie.py
""+ _LegalCharsPatt +"+"
""+ _LegalCharsPatt +"+?"
def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append
7437fc6f856bd54cce45880bf43ca993c607371d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7437fc6f856bd54cce45880bf43ca993c607371d/Cookie.py
if sys.platform == 'win32':
if sys.platform == 'win32' or sys.platform.startswith('os2'):
def getpager(): """Decide what method to use for paging through text.""" if type(sys.stdout) is not types.FileType: return plainpager if not sys.stdin.isatty() or not sys.stdout.isatty(): return plainpager if os.environ.get('TERM') in ['dumb', 'emacs']: return plainpager if os.environ.has_key('PAGER'): if sys.platform == 'win32': # pipes completely broken in Windows return lambda text: tempfilepager(plain(text), os.environ['PAGER']) elif os.environ.get('TERM') in ['dumb', 'emacs']: return lambda text: pipepager(plain(text), os.environ['PAGER']) else: return lambda text: pipepager(text, os.environ['PAGER']) if sys.platform == 'win32': return lambda text: tempfilepager(plain(text), 'more <') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: return lambda text: pipepager(text, 'less') import tempfile filename = tempfile.mktemp() open(filename, 'w').close() try: if hasattr(os, 'system') and os.system('more %s' % filename) == 0: return lambda text: pipepager(text, 'more') else: return ttypager finally: os.unlink(filename)
9a3b03036f32150474aead3231141b2bf779ff0e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9a3b03036f32150474aead3231141b2bf779ff0e/pydoc.py
initialcolor = None,
def __init__(self, master = None, initialcolor = None, databasefile = None, initfile = None, ignore = None, wantspec = None): self.__master = master self.__initialcolor = initialcolor self.__databasefile = databasefile self.__initfile = initfile or os.path.expanduser('~/.pynche') self.__ignore = ignore self.__pw = None self.__wantspec = wantspec
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
self.__initialcolor = initialcolor
def __init__(self, master = None, initialcolor = None, databasefile = None, initfile = None, ignore = None, wantspec = None): self.__master = master self.__initialcolor = initialcolor self.__databasefile = databasefile self.__initfile = initfile or os.path.expanduser('~/.pynche') self.__ignore = ignore self.__pw = None self.__wantspec = wantspec
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
def show(self):
def show(self, color=None): if not self.__master: from Tkinter import Tk self.__master = Tk()
def show(self): if not self.__pw: self.__pw, self.__sb = \ Main.build(master = self.__master, initialcolor = self.__initialcolor, initfile = self.__initfile, ignore = self.__ignore) Main.run(self.__pw, self.__sb) rgbtuple = self.__sb.current_rgb() self.__pw.withdraw() # check to see if the cancel button was pushed if self.__sb.canceled_p(): return None, None colordb = self.__sb.colordb() # try to return the color name from the database if there is an exact # match, otherwise use the "#rrggbb" spec. TBD: Forget about color # aliases for now, maybe later we should return these too. name = None if not self.__wantspec: try: name = colordb.find_byrgb(rgbtuple)[0] except ColorDB.BadColor: pass if name is None: name = ColorDB.triplet_to_rrggbb(rgbtuple) return rgbtuple, name
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
initialcolor = self.__initialcolor,
def show(self): if not self.__pw: self.__pw, self.__sb = \ Main.build(master = self.__master, initialcolor = self.__initialcolor, initfile = self.__initfile, ignore = self.__ignore) Main.run(self.__pw, self.__sb) rgbtuple = self.__sb.current_rgb() self.__pw.withdraw() # check to see if the cancel button was pushed if self.__sb.canceled_p(): return None, None colordb = self.__sb.colordb() # try to return the color name from the database if there is an exact # match, otherwise use the "#rrggbb" spec. TBD: Forget about color # aliases for now, maybe later we should return these too. name = None if not self.__wantspec: try: name = colordb.find_byrgb(rgbtuple)[0] except ColorDB.BadColor: pass if name is None: name = ColorDB.triplet_to_rrggbb(rgbtuple) return rgbtuple, name
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
colordb = self.__sb.colordb()
def show(self): if not self.__pw: self.__pw, self.__sb = \ Main.build(master = self.__master, initialcolor = self.__initialcolor, initfile = self.__initfile, ignore = self.__ignore) Main.run(self.__pw, self.__sb) rgbtuple = self.__sb.current_rgb() self.__pw.withdraw() # check to see if the cancel button was pushed if self.__sb.canceled_p(): return None, None colordb = self.__sb.colordb() # try to return the color name from the database if there is an exact # match, otherwise use the "#rrggbb" spec. TBD: Forget about color # aliases for now, maybe later we should return these too. name = None if not self.__wantspec: try: name = colordb.find_byrgb(rgbtuple)[0] except ColorDB.BadColor: pass if name is None: name = ColorDB.triplet_to_rrggbb(rgbtuple) return rgbtuple, name
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
return apply(Chooser, (), options).show()
global _chooser if not _chooser: _chooser = apply(Chooser, (), options) return _chooser.show(color)
def askcolor(color = None, **options): """Ask for a color""" return apply(Chooser, (), options).show()
ee22b4b2157dec6c104cfea17f304073fb74fd5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ee22b4b2157dec6c104cfea17f304073fb74fd5a/pyColorChooser.py
exts.append( Extension('_locale', ['_localemodule.c']) )
if platform in ['cygwin']: locale_libs = ['intl'] else: locale_libs = [] exts.append( Extension('_locale', ['_localemodule.c'], libraries=locale_libs ) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
91ba94dc4a1d8c425f5aa824e1245646b5d904e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/91ba94dc4a1d8c425f5aa824e1245646b5d904e1/setup.py
if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cfg_target != cur_target: my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_target, cfg_target)) raise DistutilsPlatformError(my_msg)
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_msg + " (%s)" % msg.strerror raise DistutilsPlatformError(my_msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if python_build: g['LDSHARED'] = g['BLDSHARED'] elif sys.version < '2.1': # The following two branches are for 1.5.2 compatibility. if sys.platform == 'aix4': # what about AIX 3.x ? # Linker script is in the config directory, not in Modules as the # Makefile says. python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': # Linker script is in the config directory. In the Makefile it is # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) linkerscript_path = string.split(g['LDSHARED'])[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python # library to the link, if needed, should be in the "build_ext" # command. (It's also needed for non-MS compilers on Windows, and # it's taken care of for them by the 'build_ext.get_libraries()' # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) global _config_vars _config_vars = g
1a70973edce6b76755851f4aba2629de8826664f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a70973edce6b76755851f4aba2629de8826664f/sysconfig.py
rounding = context.rounding
def __pow__(self, n, modulo = None, context=None): """Return self ** n (mod modulo)
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
shouldround = context._rounding_decision == ALWAYS_ROUND
def __pow__(self, n, modulo = None, context=None): """Return self ** n (mod modulo)
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
if shouldround:
if context._rounding_decision == ALWAYS_ROUND:
def __pow__(self, n, modulo = None, context=None): """Return self ** n (mod modulo)
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
out = 0
def _rescale(self, exp, rounding=None, context=None, watchexp=1): """Rescales so that the exponent is exp.
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
prevexact = context.flags[Inexact]
def _rescale(self, exp, rounding=None, context=None, watchexp=1): """Rescales so that the exponent is exp.
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
count = 1
def sqrt(self, context=None): """Return the square root of self.
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
context._rounding_decision == ALWAYS_ROUND return ans._fix(context)
if context._rounding_decision == ALWAYS_ROUND: return ans._fix(context) return ans
def max(self, other, context=None): """Returns the larger value.
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
context._rounding_decision == ALWAYS_ROUND return ans._fix(context)
if context._rounding_decision == ALWAYS_ROUND: return ans._fix(context) return ans
def min(self, other, context=None): """Returns the smaller value.
8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8ba896ad541ea1d2fc9fe67ed0a591eccacd10c5/decimal.py
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
56db06ced700d2e4bed6781847d6262f143f1340 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/56db06ced700d2e4bed6781847d6262f143f1340/setup.py
if c not in '123': raise error_proto, resp return resp
raise error_proto, resp
def getresp(self): resp = self.getmultiline() if self.debugging: print '*resp*', self.sanitize(resp) self.lastresp = resp[:3] c = resp[:1] if c == '4': raise error_temp, resp if c == '5': raise error_perm, resp if c not in '123': raise error_proto, resp return resp
0c5eac883ea9d53f54e55ccf224c50b7b2951488 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c5eac883ea9d53f54e55ccf224c50b7b2951488/ftplib.py
if resp[:3] <> '229':
if resp[:3] != '229':
def parse229(resp, peer): '''Parse the '229' response for a EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] <> '229': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(|||port|)' if resp[left + 1] <> resp[right - 1]: raise error_proto, resp parts = resp[left + 1:right].split(resp[left+1]) if len(parts) <> 5: raise error_proto, resp host = peer[0] port = int(parts[3]) return host, port
0c5eac883ea9d53f54e55ccf224c50b7b2951488 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c5eac883ea9d53f54e55ccf224c50b7b2951488/ftplib.py
if resp[left + 1] <> resp[right - 1]:
if resp[left + 1] != resp[right - 1]:
def parse229(resp, peer): '''Parse the '229' response for a EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] <> '229': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(|||port|)' if resp[left + 1] <> resp[right - 1]: raise error_proto, resp parts = resp[left + 1:right].split(resp[left+1]) if len(parts) <> 5: raise error_proto, resp host = peer[0] port = int(parts[3]) return host, port
0c5eac883ea9d53f54e55ccf224c50b7b2951488 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c5eac883ea9d53f54e55ccf224c50b7b2951488/ftplib.py
if len(parts) <> 5:
if len(parts) != 5:
def parse229(resp, peer): '''Parse the '229' response for a EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] <> '229': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(|||port|)' if resp[left + 1] <> resp[right - 1]: raise error_proto, resp parts = resp[left + 1:right].split(resp[left+1]) if len(parts) <> 5: raise error_proto, resp host = peer[0] port = int(parts[3]) return host, port
0c5eac883ea9d53f54e55ccf224c50b7b2951488 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c5eac883ea9d53f54e55ccf224c50b7b2951488/ftplib.py
Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...'''
Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... -d dir -l list -p password ''' if len(sys.argv) < 2: print test.__doc__ sys.exit(0)
def test(): '''Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...''' debugging = 0 rcfile = None while sys.argv[1] == '-d': debugging = debugging+1 del sys.argv[1] if sys.argv[1][:2] == '-r': # get name of alternate ~/.netrc file: rcfile = sys.argv[1][2:] del sys.argv[1] host = sys.argv[1] ftp = FTP(host) ftp.set_debuglevel(debugging) userid = passwd = acct = '' try: netrc = Netrc(rcfile) except IOError: if rcfile is not None: sys.stderr.write("Could not open account file" " -- using anonymous login.") else: try: userid, passwd, acct = netrc.get_account(host) except KeyError: # no account for host sys.stderr.write( "No account -- using anonymous login.") ftp.login(userid, passwd, acct) for file in sys.argv[2:]: if file[:2] == '-l': ftp.dir(file[2:]) elif file[:2] == '-d': cmd = 'CWD' if file[2:]: cmd = cmd + ' ' + file[2:] resp = ftp.sendcmd(cmd) elif file == '-p': ftp.set_pasv(not ftp.passiveserver) else: ftp.retrbinary('RETR ' + file, \ sys.stdout.write, 1024) ftp.quit()
0c5eac883ea9d53f54e55ccf224c50b7b2951488 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c5eac883ea9d53f54e55ccf224c50b7b2951488/ftplib.py
archive_basename = os.path.join(self.bdist_dir, "%s.win32" % fullname)
def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform")
7a5de2ab3001cbaa7d54395274a8580d4e75e621 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7a5de2ab3001cbaa7d54395274a8580d4e75e621/bdist_wininst.py
if audioop.lin2ulaw(data[0], 1) != '\377\347\333' or \ audioop.lin2ulaw(data[1], 2) != '\377\377\377' or \ audioop.lin2ulaw(data[2], 4) != '\377\377\377':
if audioop.lin2ulaw(data[0], 1) != '\xff\xe7\xdb' or \ audioop.lin2ulaw(data[1], 2) != '\xff\xff\xff' or \ audioop.lin2ulaw(data[2], 4) != '\xff\xff\xff':
def testlin2ulaw(data): if verbose: print 'lin2ulaw' if audioop.lin2ulaw(data[0], 1) != '\377\347\333' or \ audioop.lin2ulaw(data[1], 2) != '\377\377\377' or \ audioop.lin2ulaw(data[2], 4) != '\377\377\377': return 0 return 1
54d99dab72aad0665e98e2bf193eed9903f9fa3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54d99dab72aad0665e98e2bf193eed9903f9fa3e/test_audioop.py
testme[:42] testme[:42] = "The Answer" del testme[:42]
import sys if sys.platform[:4] != 'java': testme[:42] testme[:42] = "The Answer" del testme[:42] else: print "__getitem__: (slice(0, 42, None),)" print "__setitem__: (slice(0, 42, None), 'The Answer')" print "__delitem__: (slice(0, 42, None),)"
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef/test_class.py
int(testme) long(testme) float(testme) oct(testme) hex(testme)
if sys.platform[:4] != 'java': int(testme) long(testme) float(testme) oct(testme) hex(testme) else: print "__int__: ()" print "__long__: ()" print "__float__: ()" print "__oct__: ()" print "__hex__: ()"
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef/test_class.py
if sys.platform[:4] == 'java': import java java.lang.System.gc()
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a237ef12b412b9e8f7420da39a06d0a8ccb9c9ef/test_class.py
raise DistutilsFileErorr, \
raise DistutilsFileError, \
def check_package (self, package, package_dir):
ff4623fc34b34c5d75aa9fd1b7f6b6f5a3ed1b5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff4623fc34b34c5d75aa9fd1b7f6b6f5a3ed1b5c/build_py.py
if self._debugging > 1: print '*put*', `line`
def _putline(self, line): #if self._debugging > 1: print '*put*', `line` self.sock.send('%s%s' % (line, CRLF))
bec4f7c0e0ba80fd44523a3b144e35daad26b868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bec4f7c0e0ba80fd44523a3b144e35daad26b868/poplib.py
if self._debugging: print '*cmd*', `line`
def _putcmd(self, line): #if self._debugging: print '*cmd*', `line` self._putline(line)
bec4f7c0e0ba80fd44523a3b144e35daad26b868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bec4f7c0e0ba80fd44523a3b144e35daad26b868/poplib.py
if self._debugging > 1: print '*get*', `line`
def _getline(self): line = self.file.readline() #if self._debugging > 1: print '*get*', `line` if not line: raise error_proto('-ERR EOF') octets = len(line) # server can send any combination of CR & LF # however, 'readline()' returns lines ending in LF # so only possibilities are ...LF, ...CRLF, CR...LF if line[-2:] == CRLF: return line[:-2], octets if line[0] == CR: return line[1:-1], octets return line[:-1], octets
bec4f7c0e0ba80fd44523a3b144e35daad26b868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bec4f7c0e0ba80fd44523a3b144e35daad26b868/poplib.py
if self._debugging > 1: print '*resp*', `resp`
def _getresp(self): resp, o = self._getline() #if self._debugging > 1: print '*resp*', `resp` c = resp[:1] if c != '+': raise error_proto(resp) return resp
bec4f7c0e0ba80fd44523a3b144e35daad26b868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bec4f7c0e0ba80fd44523a3b144e35daad26b868/poplib.py
if self._debugging: print '*stat*', `rets`
def stat(self): """Get mailbox status.
bec4f7c0e0ba80fd44523a3b144e35daad26b868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bec4f7c0e0ba80fd44523a3b144e35daad26b868/poplib.py
self.assertRaises(OverflowError, xrange, 1e100, 1e101, 1e101)
self.assertRaises(TypeError, xrange, 0.0, 2, 1) self.assertRaises(TypeError, xrange, 1, 2.0, 1) self.assertRaises(TypeError, xrange, 1, 2, 1.0) self.assertRaises(TypeError, xrange, 1e100, 1e101, 1e101)
def test_xrange(self): self.assertEqual(list(xrange(3)), [0, 1, 2]) self.assertEqual(list(xrange(1, 5)), [1, 2, 3, 4]) self.assertEqual(list(xrange(0)), []) self.assertEqual(list(xrange(-3)), []) self.assertEqual(list(xrange(1, 10, 3)), [1, 4, 7]) self.assertEqual(list(xrange(5, -5, -3)), [5, 2, -1, -4])
d6a3915e3f51ca5ff906dd049e3959d8cb692c0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6a3915e3f51ca5ff906dd049e3959d8cb692c0a/test_xrange.py
self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' ]
if self.__version >= 7: self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG' ] else: self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' ]
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__paths = self.get_msvc_paths("path")
e268924ca91d33ebbd25bd7931efb957313ee551 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e268924ca91d33ebbd25bd7931efb957313ee551/msvccompiler.py
return codecs.mbs_encode(input,self.errors)[0]
return codecs.mbcs_encode(input,self.errors)[0]
def encode(self, input, final=False): return codecs.mbs_encode(input,self.errors)[0]
73d09e6e47e37bc2c1926f4c829d4acdd37e9e2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/73d09e6e47e37bc2c1926f4c829d4acdd37e9e2a/mbcs.py