rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
"""Try to apply the pattern at the start of the string, returning a MatchObject instance, or None if no match was found."""
"""match(string[, pos][, endpos]) -> MatchObject or None If zero or more characters at the beginning of string match this regular expression, return a corresponding MatchObject instance. Return None if the string does not match the pattern; note that this is different from a zero-length match. Note: If you want to lo...
def match(self, string, pos=0, endpos=None): """Try to apply the pattern at the start of the string, returning a MatchObject instance, or None if no match was found."""
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"""Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl"""
"""sub(repl, string[, count=0]) -> string Return the string obtained by replacing the leftmost non-overlapping occurrences of the compiled pattern in string by the replacement repl. If the pattern isn't found, string is returned unchanged. Identical to the sub() function, using the compiled pattern. """
def sub(self, repl, string, count=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl"""
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"""Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made."""
"""subn(repl, string[, count=0]) -> tuple Perform the same operation as sub(), but return a tuple (new_string, number_of_subs_made). """
def subn(self, repl, source, count=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made.""" if count < 0: raise ...
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"""Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings."""
"""split(source[, maxsplit=0]) -> list of strings Split string by the occurrences of the compiled pattern. If capturing parentheses are used in the pattern, then the text of all groups in the pattern are also returned as part of the resulting list. If maxsplit is nonzero, at most maxsplit splits occur, and the remaind...
def split(self, source, maxsplit=0): """Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings."""
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"""Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.
"""findall(source) -> list Return a list of all non-overlapping matches of the compiled pattern in string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.
def findall(self, source): """Return a list of all non-overlapping matches in the string.
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"Return the start of the substring matched by group g"
"""start([group=0]) -> int or None Return the index of the start of the substring matched by group; group defaults to zero (meaning the whole matched substring). Return None if group exists but did not contribute to the match. """
def start(self, g = 0): "Return the start of the substring matched by group g" if type(g) == type(''): try: g = self.re.groupindex[g] except (KeyError, TypeError): raise IndexError, 'group %s is undefined' % `g` return self.regs[g][0]
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"Return the end of the substring matched by group g"
"""end([group=0]) -> int or None Return the indices of the end of the substring matched by group; group defaults to zero (meaning the whole matched substring). Return None if group exists but did not contribute to the match. """
def end(self, g = 0): "Return the end of the substring matched by group g" if type(g) == type(''): try: g = self.re.groupindex[g] except (KeyError, TypeError): raise IndexError, 'group %s is undefined' % `g` return self.regs[g][1]
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"Return (start, end) of the substring matched by group g"
"""span([group=0]) -> tuple Return the 2-tuple (m.start(group), m.end(group)). Note that if group did not contribute to the match, this is (None, None). Group defaults to zero (meaning the whole matched substring). """
def span(self, g = 0): "Return (start, end) of the substring matched by group g" if type(g) == type(''): try: g = self.re.groupindex[g] except (KeyError, TypeError): raise IndexError, 'group %s is undefined' % `g` return self.regs[g]
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"Return a tuple containing all subgroups of the match object"
"""groups([default=None]) -> tuple Return a tuple containing all the subgroups of the match, from 1 up to however many groups are in the pattern. The default argument is used for groups that did not participate in the match. """
def groups(self, default=None): "Return a tuple containing all subgroups of the match object" result = [] for g in range(1, self.re._num_regs): a, b = self.regs[g] if a == -1 or b == -1: result.append(default) else: result.append(self.string[a:b]) return tuple(result)
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
"Return one or more groups of the match"
"""group([group1, group2, ...]) -> string or tuple Return one or more subgroups of the match. If there is a single argument, the result is a single string; if there are multiple arguments, the result is a tuple with one item per argument. Without arguments, group1 defaults to zero (i.e. the whole match is returned). I...
def group(self, *groups): "Return one or more groups of the match" if len(groups) == 0: groups = (0,) result = [] for g in groups: if type(g) == type(''): try: g = self.re.groupindex[g] except (KeyError, TypeError): raise IndexError, 'group %s is undefined' % `g` if g >= len(self.regs): raise IndexError, 'group %s is u...
27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/27efdb65ccdb88d4f7ed7c10c99789ee4bdeba48/re.py
and where to install packages"""
and where to install packages."""
def http_error_default(self, url, fp, errcode, errmsg, headers): urllib.URLopener.http_error_default(self, url, fp, errcode, errmsg, headers)
2e4f38c4e47f37da0cfc2fae88001ca6999e16e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2e4f38c4e47f37da0cfc2fae88001ca6999e16e0/pimp.py
"responsible" for the contents"""
"responsible" for the contents."""
def compareFlavors(self, left, right): """Compare two flavor strings. This is part of your preferences because whether the user prefers installing from source or binary is.""" if left in self.flavorOrder: if right in self.flavorOrder: return cmp(self.flavorOrder.index(left), self.flavorOrder.index(right)) return -1 if ...
2e4f38c4e47f37da0cfc2fae88001ca6999e16e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2e4f38c4e47f37da0cfc2fae88001ca6999e16e0/pimp.py
lastmod = apply(imp.load_module, info)
lastmod = _imp.load_module(*info)
def _rec_find_module(module): "Improvement over imp.find_module which finds submodules." path="" for mod in string.split(module,"."): if path == "": info = (mod,) + _imp.find_module(mod) else: info = (mod,) + _imp.find_module(mod, [path]) lastmod = apply(imp.load_module, info) try: path = lastmod.__path__[0] except A...
05f3d904f9d1948347c4bd9f92a07daa5cd1ecf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05f3d904f9d1948347c4bd9f92a07daa5cd1ecf9/__init__.py
drv_module = apply(imp.load_module, info)
drv_module = _imp.load_module(*info)
def _create_parser(parser_name): info = _rec_find_module(parser_name) drv_module = apply(imp.load_module, info) return drv_module.create_parser()
05f3d904f9d1948347c4bd9f92a07daa5cd1ecf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05f3d904f9d1948347c4bd9f92a07daa5cd1ecf9/__init__.py
def generate_header(self, structName): header = """
78f78964df86abed29b27f2837d244eb46c9f44d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78f78964df86abed29b27f2837d244eb46c9f44d/perfect_hash.py
""" static PyObject *codec_tuple(PyObject *unicode, int len) { PyObject *v,*w; if (unicode == NULL) return NULL; v = PyTuple_New(2); if (v == NULL) { Py_DECREF(unicode); return NULL; } PyTuple_SET_ITEM(v,0,unicode); w = PyInt_FromLong(len); if (w == NULL) { Py_DECREF(v); return NULL; } PyTuple_SET_ITEM(v,1,w); return...
def generate_hash(keys, caseInsensitive=0, minC=None, initC=None, f1Seed=None, f2Seed=None, cIncrement=None, cTries=None): """Print out code for a perfect minimal hash. Input is a list of (key, desired hash value) tuples. """ # K is the number of keys. K = len(keys) # We will be generating graphs of size N, where N...
78f78964df86abed29b27f2837d244eb46c9f44d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78f78964df86abed29b27f2837d244eb46c9f44d/perfect_hash.py
pth_file.cleanup()
pth_file.cleanup(prep=True)
def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # adds directories to sys.path for any line in the file that is not a # comment or import that is a valid directory name for where the .pth # file resides; invalid directories are not added pth_file = PthFile() pth_file.cleanu...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
unittest.FunctionTestCase(pth_file.test)
self.pth_file_tests(pth_file)
def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # adds directories to sys.path for any line in the file that is not a # comment or import that is a valid directory name for where the .pth # file resides; invalid directories are not added pth_file = PthFile() pth_file.cleanu...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
pth_file.cleanup()
pth_file.cleanup(prep=True)
def test_addsitedir(self): # Same tests for test_addpackage since addsitedir() essentially just # calls addpackage() for every .pth file in the directory pth_file = PthFile() pth_file.cleanup() # Make sure that nothing is pre-existing that is # tested for try: site.addsitedir(pth_file.base_dir, set()) unittest.Function...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
unittest.FunctionTestCase(pth_file.test)
self.pth_file_tests(pth_file)
def test_addsitedir(self): # Same tests for test_addpackage since addsitedir() essentially just # calls addpackage() for every .pth file in the directory pth_file = PthFile() pth_file.cleanup() # Make sure that nothing is pre-existing that is # tested for try: site.addsitedir(pth_file.base_dir, set()) unittest.Function...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
self.imported = "time"
self.imported = imported
def __init__(self, filename_base=TESTFN, imported="time", good_dirname="__testdir__", bad_dirname="__bad"): """Initialize instance variables""" self.filename = filename_base + ".pth" self.base_dir = os.path.abspath('') self.file_path = os.path.join(self.base_dir, self.filename) self.imported = "time" self.good_dirname ...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
def cleanup(self):
def cleanup(self, prep=False):
def cleanup(self): """Make sure that the .pth file is deleted, self.imported is not in sys.modules, and that both self.good_dirname and self.bad_dirname are not existing directories.""" try: os.remove(self.file_path) except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try: os.rmdir(self.good_...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
try:
if os.path.exists(self.file_path):
def cleanup(self): """Make sure that the .pth file is deleted, self.imported is not in sys.modules, and that both self.good_dirname and self.bad_dirname are not existing directories.""" try: os.remove(self.file_path) except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try: os.rmdir(self.good_...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try:
if prep: self.imported_module = sys.modules.get(self.imported) if self.imported_module: del sys.modules[self.imported] else: if self.imported_module: sys.modules[self.imported] = self.imported_module if os.path.exists(self.good_dir_path):
def cleanup(self): """Make sure that the .pth file is deleted, self.imported is not in sys.modules, and that both self.good_dirname and self.bad_dirname are not existing directories.""" try: os.remove(self.file_path) except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try: os.rmdir(self.good_...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
except OSError: pass try:
if os.path.exists(self.bad_dir_path):
def cleanup(self): """Make sure that the .pth file is deleted, self.imported is not in sys.modules, and that both self.good_dirname and self.bad_dirname are not existing directories.""" try: os.remove(self.file_path) except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try: os.rmdir(self.good_...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
except OSError: pass def test(self): """Test to make sure that was and was not supposed to be created by using the .pth file occurred""" assert site.makepath(self.good_dir_path)[0] in sys.path assert self.imported in sys.modules assert not os.path.exists(self.bad_dir_path)
def cleanup(self): """Make sure that the .pth file is deleted, self.imported is not in sys.modules, and that both self.good_dirname and self.bad_dirname are not existing directories.""" try: os.remove(self.file_path) except OSError: pass try: del sys.modules[self.imported] except KeyError: pass try: os.rmdir(self.good_...
3620fe8a2fa3efdf994d0306c037b2abdc71ecd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3620fe8a2fa3efdf994d0306c037b2abdc71ecd3/test_site.py
if verbose: print 'Connecting to %s...' % host
if verbose: print 'Connecting to %s...' % `host`
def main(): global verbose, interactive, mac, rmok, nologin try: opts, args = getopt.getopt(sys.argv[1:], 'a:bil:mnp:qrs:v') except getopt.error, msg: usage(msg) login = '' passwd = '' account = '' for o, a in opts: if o == '-l': login = a if o == '-p': passwd = a if o == '-a': account = a if o == '-v': verbose = verbo...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Logging in as %s...' % (login or 'anonymous')
print 'Logging in as %s...' % `login or 'anonymous'`
def main(): global verbose, interactive, mac, rmok, nologin try: opts, args = getopt.getopt(sys.argv[1:], 'a:bil:mnp:qrs:v') except getopt.error, msg: usage(msg) login = '' passwd = '' account = '' for o, a in opts: if o == '-l': login = a if o == '-p': passwd = a if o == '-a': account = a if o == '-v': verbose = verbo...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose: print 'Creating local directory', localdir
if verbose: print 'Creating local directory', `localdir`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print "Failed to establish local directory", localdir
print "Failed to establish local directory", `localdir`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Bad mirror info in %s' % infofilename
print 'Bad mirror info in %s' % `infofilename`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose: print 'Listing remote directory %s...' % pwd
if verbose: print 'Listing remote directory %s...' % `pwd`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
filename = words[-1] if string.find(filename, " -> ") >= 0:
filename = string.lstrip(words[-1]) i = string.find(filename, " -> ") if i >= 0:
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Skipping symbolic link %s' % \ filename continue
print 'Found symbolic link %s' % `filename` linkto = filename[i+4:] filename = filename[:i]
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Skip pattern', pat, print 'matches', filename
print 'Skip pattern', `pat`, print 'matches', `filename`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Remembering subdirectory', filename
print 'Remembering subdirectory', `filename`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Already have this version of', filename
print 'Already have this version of',`filename`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
try: fp = open(tempname, 'wb') except IOError, msg: print "Can't create %s: %s" % (tempname, str(msg)) continue if verbose: print 'Retrieving %s from %s as %s...' % \ (filename, pwd, fullname) if verbose: fp1 = LoggingFile(fp, 1024, sys.stdout)
if mode[0] == 'l': if verbose: print "Creating symlink %s -> %s" % ( `filename`, `linkto`) try: os.symlink(linkto, tempname) except IOError, msg: print "Can't create %s: %s" % ( `tempname`, str(msg)) continue
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
fp1 = fp t0 = time.time() try: f.retrbinary('RETR ' + filename, fp1.write, 8*1024) except ftplib.error_perm, msg: print msg t1 = time.time() bytes = fp.tell() fp.close() if fp1 != fp: fp1.close()
try: fp = open(tempname, 'wb') except IOError, msg: print "Can't create %s: %s" % ( `tempname`, str(msg)) continue if verbose: print 'Retrieving %s from %s as %s...' % \ (`filename`, `pwd`, `fullname`) if verbose: fp1 = LoggingFile(fp, 1024, sys.stdout) else: fp1 = fp t0 = time.time() try: f.retrbinary('RETR ' + filena...
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print "Can't rename %s to %s: %s" % (tempname, fullname,
print "Can't rename %s to %s: %s" % (`tempname`, `fullname`,
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose:
if verbose and mode[0] != 'l':
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print filename, "in", localdir or "."
print `filename`, "in", `localdir or "."`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Skip pattern', pat, print 'matches', name
print 'Skip pattern', `pat`, print 'matches', `name`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Local file', fullname,
print 'Local file', `fullname`,
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose: print 'Removing local file/dir', fullname
if verbose: print 'Removing local file/dir', `fullname`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose: print 'Processing subdirectory', subdir
if verbose: print 'Processing subdirectory', `subdir`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print 'Remote directory now:', pwd print 'Remote cwd', subdir
print 'Remote directory now:', `pwd` print 'Remote cwd', `subdir`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
print "Can't chdir to", subdir, ":", msg
print "Can't chdir to", `subdir`, ":", `msg`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
if verbose: print 'Mirroring as', localsubdir
if verbose: print 'Mirroring as', `localsubdir`
def mirrorsubdir(f, localdir): pwd = f.pwd() if localdir and not os.path.isdir(localdir): if verbose: print 'Creating local directory', localdir try: makedir(localdir) except os.error, msg: print "Failed to establish local directory", localdir return infofilename = os.path.join(localdir, '.mirrorinfo') try: text = open...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
(fullname, str(msg))
(`fullname`, str(msg))
def remove(fullname): if os.path.isdir(fullname) and not os.path.islink(fullname): try: names = os.listdir(fullname) except os.error: names = [] ok = 1 for name in names: if not remove(os.path.join(fullname, name)): ok = 0 if not ok: return 0 try: os.rmdir(fullname) except os.error, msg: print "Can't remove local direc...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
(fullname, str(msg))
(`fullname`, str(msg))
def remove(fullname): if os.path.isdir(fullname) and not os.path.islink(fullname): try: names = os.listdir(fullname) except os.error: names = [] ok = 1 for name in names: if not remove(os.path.join(fullname, name)): ok = 0 if not ok: return 0 try: os.rmdir(fullname) except os.error, msg: print "Can't remove local direc...
ace1e022e9566ad27920d0be67da64be4caffff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ace1e022e9566ad27920d0be67da64be4caffff3/ftpmirror.py
for key in ('LDFLAGS', 'BASECFLAGS'):
for key in ('LDFLAGS', 'BASECFLAGS', 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile;...
46d3ef965949944cde1126a8aee3c264256ae3d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46d3ef965949944cde1126a8aee3c264256ae3d2/sysconfig.py
explicitely. DEFAULT can be the relative path to a .ico file
explicitly. DEFAULT can be the relative path to a .ico file
def wm_iconbitmap(self, bitmap=None, default=None): """Set bitmap for the iconified widget to BITMAP. Return the bitmap if None is given.
05ced41d9041d43b40f0d189f57d9020c4788ec5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05ced41d9041d43b40f0d189f57d9020c4788ec5/Tkinter.py
a method of the same name to preform each SMTP comand, and there is a method called 'sendmail' that will do an entiere mail
a method of the same name to perform each SMTP command, and there is a method called 'sendmail' that will do an entire mail
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data))
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use.
If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use.
def connect(self, host='localhost', port = 0): """Connect to a host on a given port.
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'help' command. Returns help text from server """
"""SMTP 'help' command. Returns help text from server."""
def help(self, args=''): """ SMTP 'help' command. Returns help text from server """ self.putcmd("help", args) (code,msg)=self.getreply() return msg
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'rset' command. Resets session. """
"""SMTP 'rset' command. Resets session."""
def rset(self): """ SMTP 'rset' command. Resets session. """ code=self.docmd("rset") return code
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'noop' command. Doesn't do anything :> """
"""SMTP 'noop' command. Doesn't do anything :>"""
def noop(self): """ SMTP 'noop' command. Doesn't do anything :> """ code=self.docmd("noop") return code
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'mail' command. Begins mail xfer session. """
"""SMTP 'mail' command. Begins mail xfer session."""
def mail(self,sender,options=[]): """ SMTP 'mail' command. Begins mail xfer session. """ optionlist = '' if options and self.does_esmtp: optionlist = string.join(options, ' ') self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist)) return self.getreply()
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'rcpt' command. Indicates 1 recipient for this mail. """
"""SMTP 'rcpt' command. Indicates 1 recipient for this mail."""
def rcpt(self,recip,options=[]): """ SMTP 'rcpt' command. Indicates 1 recipient for this mail. """ optionlist = '' if options and self.does_esmtp: optionlist = string.join(options, ' ') self.putcmd("rcpt","TO:%s %s" % (quoteaddr(recip),optionlist)) return self.getreply()
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'DATA' command. Sends message data to server. Automatically quotes lines beginning with a period per rfc821. """
"""SMTP 'DATA' command. Sends message data to server. Automatically quotes lines beginning with a period per rfc821. """
def data(self,msg): """ SMTP 'DATA' command. Sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % (...
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
def vrfy(self, address): return self.verify(address)
def vrfy(self, address): return self.verify(address)
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'verify' command. Checks for address validity. """
"""SMTP 'verify' command. Checks for address validity."""
def verify(self, address): """ SMTP 'verify' command. Checks for address validity. """ self.putcmd("vrfy", quoteaddr(address)) return self.getreply()
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" SMTP 'verify' command. Checks for address validity. """
"""SMTP 'verify' command. Checks for address validity."""
def expn(self, address): """ SMTP 'verify' command. Checks for address validity. """ self.putcmd("expn", quoteaddr(address)) return self.getreply()
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
def expn(self, address): """ SMTP 'verify' command. Checks for address validity. """ self.putcmd("expn", quoteaddr(address)) return self.getreply()
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
""" This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to (a string will be treated as a list with 1 address) - msg : the message to send. - mail_options : list of ESMTP options (such as 8bitmime) for the ...
"""This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : A list of addresses to send this mail to. A bare string will be treated as a list with 1 address. - msg : The message to send. - mail_options : List of ESMTP options (such ...
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to (a string will be treated as a list with 1 address) - msg : the mes...
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
In the above example, the message was accepted for delivery to three of the four addresses, and one was rejected, with the error code 550. If all addresses are accepted, then the method will return an empty dictionary. """
In the above example, the message was accepted for delivery to three of the four addresses, and one was rejected, with the error code 550. If all addresses are accepted, then the method will return an empty dictionary. """
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to (a string will be treated as a list with 1 address) - msg : the mes...
dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dfd1c12c67bea1eda4e609be530e5ca4b71d8eb4/smtplib.py
self.get_installer_filename()))
self.get_installer_filename(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")
136031bd00afe68baa5a87d8a11919558055478e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/136031bd00afe68baa5a87d8a11919558055478e/bdist_wininst.py
assert u"%c" % (u"abc",) == u'a' assert u"%c" % ("abc",) == u'a'
assert u"%c" % (u"a",) == u'a' assert u"%c" % ("a",) == u'a'
test('capwords', u'abc\t def \nghi', u'Abc Def Ghi')
ecd98d4a849a60b1c3dcc9e3fbe554870d46d1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecd98d4a849a60b1c3dcc9e3fbe554870d46d1d7/test_unicode.py
(objects, output_dir) = \ self._fix_link_args (objects, output_dir, takes_libs=0)
(objects, output_dir) = self._fix_object_args (objects, output_dir)
def create_static_lib (self, objects, output_libname, output_dir=None, debug=0, extra_preargs=None, extra_postargs=None):
1912b3760c697daf74ee1ded5ac81ab07a6f2725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1912b3760c697daf74ee1ded5ac81ab07a6f2725/msvccompiler.py
(objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs)
(objects, output_dir) = self._fix_object_args (objects, output_dir) (libraries, library_dirs, runtime_library_dirs) = \ self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) if self.runtime_library_dirs: self.warn ("I don't know what to do with 'runtime_library_dirs': " + str (runtime_library_dirs))
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
1912b3760c697daf74ee1ded5ac81ab07a6f2725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1912b3760c697daf74ee1ded5ac81ab07a6f2725/msvccompiler.py
library_dirs, self.runtime_library_dirs,
library_dirs, runtime_library_dirs,
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
1912b3760c697daf74ee1ded5ac81ab07a6f2725 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1912b3760c697daf74ee1ded5ac81ab07a6f2725/msvccompiler.py
self.num_regs=len(regs)/2
self.num_regs=len(regs)
def match(self, string, pos=0):
120d73c21fc29f889119222886b291b0070c7edf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/120d73c21fc29f889119222886b291b0070c7edf/re.py
h = self.outer.copy() h.update(self.inner.digest())
h = self._current()
def digest(self): """Return the hash value of this hashing object.
e0e9c7f385b8de60d55349aca944534b3b6fb425 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e0e9c7f385b8de60d55349aca944534b3b6fb425/hmac.py
return "".join([hex(ord(x))[2:].zfill(2) for x in tuple(self.digest())])
h = self._current() return h.hexdigest()
def hexdigest(self): """Like digest(), but returns a string of hexadecimal digits instead. """ return "".join([hex(ord(x))[2:].zfill(2) for x in tuple(self.digest())])
e0e9c7f385b8de60d55349aca944534b3b6fb425 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e0e9c7f385b8de60d55349aca944534b3b6fb425/hmac.py
index.append(keys[j], offset + len(buf))
index.append( (keys[j], offset + len(buf)) )
def addname(self, name): # Domain name packing (section 4.1.4) # Add a domain name to the buffer, possibly using pointers. # The case of the first occurrence of a name is preserved. # Redundant dots are ignored. list = [] for label in string.splitfields(name, '.'): if label: if len(label) > 63: raise PackError, 'label ...
caf8c1d7fcb42b69536300bb2fe3246cbe016848 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/caf8c1d7fcb42b69536300bb2fe3246cbe016848/dnslib.py
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg if verbose: print 'Magic: 0x%8.8x'%magic pr...
class AppleSingle(object): datafork = None resourcefork = None def __init__(self, fileobj, verbose=False): header = fileobj.read(AS_HEADER_LENGTH)
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
id, offset, length = struct.unpack(AS_ENTRY_FORMAT, hdr)
magic, version, ig, nentry = struct.unpack(AS_HEADER_FORMAT, header)
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
raise Error, "Unpack entry error: %s"%arg
raise Error, "Unpack header error: %s" % (arg,)
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
print 'Fork %d, offset %d, length %d'%(id, offset, length) input.seek(offset) if length == 0: data = ''
print 'Magic: 0x%8.8x' % (magic,) print 'Version: 0x%8.8x' % (version,) print 'Entries: %d' % (nentry,) if magic != AS_MAGIC: raise Error, "Unknown AppleSingle magic number 0x%8.8x" % (magic,) if version != AS_VERSION: raise Error, "Unknown AppleSingle version number 0x%8.8x" % (version,) if nentry <= 0: raise Error,...
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
data = input.read(length) if len(data) != length: raise Error, 'Short read: expected %d bytes got %d'%(length, len(data)) if id == AS_DATAFORK: if verbose: print ' (data fork)' if not resonly: didwork = 1 fp = open(output, 'wb') fp.write(data)
if self.datafork is not None: fp = open(path, 'wb') fp.write(self.datafork)
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
elif id == AS_RESOURCEFORK: didwork = 1 if verbose: print ' (resource fork)' if resonly: fp = open(output, 'wb') else: fp = MacOS.openrf(output, 'wb') fp.write(data) fp.close() elif id in AS_IGNORE: if verbose: print ' (ignored)' else: raise Error, 'Unknown fork type %d'%id if not didwork: raise Error, 'No useful for...
if self.resourcefork is not None: fp = MacOS.openrf(path, '*wb') fp.write(self.resourcefork) fp.close() def decode(infile, outpath, resonly=False, verbose=False): """decode(infile, outpath [, resonly=False, verbose=False])
def decode(input, output, resonly=0): if type(input) == type(''): input = open(input, 'rb') # Should we also test for FSSpecs or FSRefs? header = input.read(AS_HEADER_LENGTH) try: magic, version, dummy, nentry = struct.unpack(AS_HEADER_FORMAT, header) except ValueError, arg: raise Error, "Unpack header error: %s"%arg i...
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
resonly = 1
resonly = True
def _test(): if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: print 'Usage: applesingle.py [-r] applesinglefile decodedfile' sys.exit(1) if sys.argv[1] == '-r': resonly = 1 del sys.argv[1] else: resonly = 0 decode(sys.argv[1], sys.argv[2], resonly=resonly)
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
resonly = 0
resonly = False
def _test(): if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: print 'Usage: applesingle.py [-r] applesinglefile decodedfile' sys.exit(1) if sys.argv[1] == '-r': resonly = 1 del sys.argv[1] else: resonly = 0 decode(sys.argv[1], sys.argv[2], resonly=resonly)
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
def _test(): if len(sys.argv) < 3 or sys.argv[1] == '-r' and len(sys.argv) != 4: print 'Usage: applesingle.py [-r] applesinglefile decodedfile' sys.exit(1) if sys.argv[1] == '-r': resonly = 1 del sys.argv[1] else: resonly = 0 decode(sys.argv[1], sys.argv[2], resonly=resonly)
80fef465942425c5b1acc91e30a57cf234e7262d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/80fef465942425c5b1acc91e30a57cf234e7262d/applesingle.py
def test_lc_numeric_basic(self): # Test nl_langinfo against localeconv for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) except Error: continue for li, lc in ((RADIXCHAR, "decimal_point"), (THOUSEP, "thousands_sep")): nl_radixchar = nl_langinfo(li) li_radixchar = localeconv()[lc] try: set_locale = setlocale...
1a82e742aa3a57a1dd38e86a52de752b899b2b52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a82e742aa3a57a1dd38e86a52de752b899b2b52/test__locale.py
def test_float_parsing(self): # Bug #1391872: Test whether float parsing is okay on European # locales. for loc in candidate_locales: try: setlocale(LC_NUMERIC, loc) except Error: continue self.assertEquals(int(eval('3.14') * 100), 314, "using eval('3.14') failed for %s" % loc) self.assertEquals(int(float('3.14') * 100...
1a82e742aa3a57a1dd38e86a52de752b899b2b52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a82e742aa3a57a1dd38e86a52de752b899b2b52/test__locale.py
addinfourl.__init__(self, fp, hdrs, url)
self.__super_init(fp, hdrs, url)
def __init__(self, url, code, msg, hdrs, fp): addinfourl.__init__(self, fp, hdrs, url) self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp # XXX self.filename = url
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
self.fp.close()
if self.fp: self.fp.close()
def __del__(self): # XXX is this safe? what if user catches exception, then # extracts fp and discards exception? self.fp.close()
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
result = apply(func, args)
result = func(*args)
def _call_chain(self, chain, kind, meth_name, *args): # XXX raise an exception if no one else should try to handle # this url. return None if you can't but someone else could. handlers = chain.get(kind, ()) for handler in handlers: func = getattr(handler, meth_name) result = apply(func, args) if result is not None: re...
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
'_open', req)
'_open', req)
def open(self, fullurl, data=None): # accept a URL or a Request object if type(fullurl) == types.StringType: req = Request(fullurl, data) else: req = fullurl if data is not None: req.add_data(data) assert isinstance(req, Request) # really only care about interface result = self._call_chain(self.handle_open, 'default',...
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
result = apply(self._call_chain, args)
result = self._call_chain(*args)
def error(self, proto, *args): if proto == 'http': # XXX http protocol is special cased dict = self.handle_error[proto] proto = args[2] # YUCK! meth_name = 'http_error_%d' % proto http_err = 1 orig_args = args else: dict = self.handle_error meth_name = proto + '_error' http_err = 0 args = (dict, proto, meth_name) + ar...
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
return apply(self._call_chain, args)
return self._call_chain(*args)
def error(self, proto, *args): if proto == 'http': # XXX http protocol is special cased dict = self.handle_error[proto] proto = args[2] # YUCK! meth_name = 'http_error_%d' % proto http_err = 1 orig_args = args else: dict = self.handle_error meth_name = proto + '_error' http_err = 0 args = (dict, proto, meth_name) + ar...
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
h = httplib.HTTP(host) if req.has_data(): data = req.get_data() h.putrequest('POST', req.get_selector()) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', req.get_selector())
try: h = httplib.HTTP(host) if req.has_data(): data = req.get_data() h.putrequest('POST', req.get_selector()) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', req.get_selector()) except socket.error, err: raise URLError(err)
def http_open(self, req): # XXX devise a new mechanism to specify user/password host = req.get_host() if not host: raise URLError('no host given')
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
apply(h.putheader, args)
h.putheader(*args)
def http_open(self, req): # XXX devise a new mechanism to specify user/password host = req.get_host() if not host: raise URLError('no host given')
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
if h.sock: h.sock.close() h.sock = None
def http_open(self, req): # XXX devise a new mechanism to specify user/password host = req.get_host() if not host: raise URLError('no host given')
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
host = socket.gethostbyname(host)
try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg)
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password host = socket.gethostbyname(host) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splitattr(req.get_selector()) path = unquote(path) dirs =...
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
elif socket.gethostname() == 'walden':
elif socket.gethostname() == 'bitdiddle.concentric.net':
def build_opener(self): opener = OpenerDirectory() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph)
46e3908154fef96c5a26c2c24c8cc19bf366584f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46e3908154fef96c5a26c2c24c8cc19bf366584f/urllib2.py
if getattr(self.fp, 'unread'):
if hasattr(self.fp, 'unread'):
def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it ...
99fbbe1f2e4bc678eb7965a8250f844a498a1555 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/99fbbe1f2e4bc678eb7965a8250f844a498a1555/rfc822.py
def __init__(self, out=None):
def __init__(self, out=None, encoding="iso-8859-1"):
def __init__(self, out=None): if out is None: import sys out = sys.stdout handler.ContentHandler.__init__(self) self._out = out
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py