bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
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)
|
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)
| 14,600
|
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)
|
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)
| 14,601
|
def __cmp__(self, other): return cmp(self.arg, other)
|
def __cmp__(self, other): return cmp(self.arg, other)
| 14,602
|
def do_infix_binops(): for a in candidates: for b in candidates: for op in infix_binops: print '%s %s %s' % (a, op, b), try: x = eval('a %s b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', x try: z = copy.copy(a) except copy.Error: z = a # assume it has no inplace ops print '%s %s= %s' % (a, op, b), try: exec('z %s= b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=>', z
|
def do_infix_binops(): for a in candidates: for b in candidates: for op in infix_binops: print '%s %s %s' % (a, op, b), try: x = eval('a %s b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', format_result(x) try: z = copy.copy(a) except copy.Error: z = a # assume it has no inplace ops print '%s %s= %s' % (a, op, b), try: exec('z %s= b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=>', z
| 14,603
|
def do_infix_binops(): for a in candidates: for b in candidates: for op in infix_binops: print '%s %s %s' % (a, op, b), try: x = eval('a %s b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', x try: z = copy.copy(a) except copy.Error: z = a # assume it has no inplace ops print '%s %s= %s' % (a, op, b), try: exec('z %s= b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=>', z
|
def do_infix_binops(): for a in candidates: for b in candidates: for op in infix_binops: print '%s %s %s' % (a, op, b), try: x = eval('a %s b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', x try: z = copy.copy(a) except copy.Error: z = a # assume it has no inplace ops print '%s %s= %s' % (a, op, b), try: exec('z %s= b' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=>', format_result(z)
| 14,604
|
def do_prefix_binops(): for a in candidates: for b in candidates: for op in prefix_binops: print '%s(%s, %s)' % (op, a, b), try: x = eval('%s(a, b)' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', x
|
def do_prefix_binops(): for a in candidates: for b in candidates: for op in prefix_binops: print '%s(%s, %s)' % (op, a, b), try: x = eval('%s(a, b)' % op) except: error = sys.exc_info()[:2] print '... %s' % error[0] else: print '=', format_result(x)
| 14,605
|
def _pardir(p): return os.path.split(p)[0]
|
def _pardir(p): return os.path.split(p)[0]
| 14,606
|
def _pardir(p): return os.path.split(p)[0]
|
def _pardir(p): return os.path.split(p)[0]
| 14,607
|
def quote(s, safe = '/'): safe = always_safe + safe res = [] for c in s: if c in safe: res.append(c) else: res.append('%%%02x' % ord(c)) return string.joinfields(res, '')
|
def quote(s, safe = '/'): safe = always_safe + safe res = list(s) for i in range(len(res)): c = res[i] if c not in safe: res[i] = '%%%02x' % ord(c) return string.joinfields(res, '')
| 14,608
|
def quote_plus(s, safe = '/'): if ' ' in s: # replace ' ' with '+' s = string.join(string.split(s, ' '), '+') return quote(s, safe + '+') else: return quote(s, safe)
|
def quote_plus(s, safe = '/'): if ' ' in s: # replace ' ' with '+' l = string.split(s, ' ') for i in range(len(l)): l[i] = quote(l[i], safe) return string.join(l, '+') else: return quote(s, safe)
| 14,609
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
| 14,610
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
| 14,611
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dictpath = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules?path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dictpath = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file])
| 14,612
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
| 14,613
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module dict = {} _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() dict = {} _modules[module] = dict return dict dict = {} _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
|
def readmodule(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' i = string.rfind(module, '.') if i >= 0: # Dotted module name package = string.strip(module[:i]) submodule = string.strip(module[i+1:]) parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict = {'__path__': [file]} _modules[module] = dict # XXX Should we recursively look for submodules? return dict if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict imports = [] classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # and we know the class it belongs to meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = string.strip(inherit[1:-1]) names = [] for n in string.splitfields(inherit, ','): n = string.strip(n) if dict.has_key(n): # we know this super class n = dict[n] else: c = string.splitfields(n, '.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in string.split(m.group("ImportList"), ','): n = string.strip(n) try: # recursively read the imported module d = readmodule(n, path, inpackage) except: print 'module', n, 'not found' elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = string.split(m.group("ImportFromList"), ',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = string.strip(n) if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
| 14,614
|
def test_pickling(self): p = pickle.dumps(self.set) print repr(p) copy = pickle.loads(p) repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
|
def test_pickling(self): p = pickle.dumps(self.set) copy = pickle.loads(p) repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
| 14,615
|
def test_pickling(self): p = pickle.dumps(self.set) print repr(p) copy = pickle.loads(p) repr(copy) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
|
def test_pickling(self): p = pickle.dumps(self.set) print repr(p) copy = pickle.loads(p) self.assertEqual(self.set, copy, "%s != %s" % (self.set, copy))
| 14,616
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
| 14,617
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
| 14,618
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
|
def get_exe_bytes (self): import base64 return base64.decodestring(EXEDATA)
| 14,619
|
def _spawn_posix (cmd, search_path=1, verbose=0, dry_run=0): log.info(string.join(cmd, ' ')) if dry_run: return exec_fn = search_path and os.execvp or os.execv pid = os.fork() if pid == 0: # in the child try: #print "cmd[0] =", cmd[0] #print "cmd =", cmd exec_fn(cmd[0], cmd) except OSError, e: sys.stderr.write("unable to execute %s: %s\n" % (cmd[0], e.strerror)) os._exit(1) sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) os._exit(1) else: # in the parent # Loop until the child either exits or is terminated by a signal # (ie. keep waiting if it's merely stopped) while 1: (pid, status) = os.waitpid(pid, 0) if os.WIFSIGNALED(status): raise DistutilsExecError, \ "command '%s' terminated by signal %d" % \ (cmd[0], os.WTERMSIG(status)) elif os.WIFEXITED(status): exit_status = os.WEXITSTATUS(status) if exit_status == 0: return # hey, it succeeded! else: raise DistutilsExecError, \ "command '%s' failed with exit status %d" % \ (cmd[0], exit_status) elif os.WIFSTOPPED(status): continue else: raise DistutilsExecError, \ "unknown error executing '%s': termination status %d" % \ (cmd[0], status)
|
def _spawn_posix (cmd, search_path=1, verbose=0, dry_run=0): log.info(string.join(cmd, ' ')) if dry_run: return exec_fn = search_path and os.execvp or os.execv pid = os.fork() if pid == 0: # in the child try: #print "cmd[0] =", cmd[0] #print "cmd =", cmd exec_fn(cmd[0], cmd) except OSError, e: sys.stderr.write("unable to execute %s: %s\n" % (cmd[0], e.strerror)) os._exit(1) sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) os._exit(1) else: # in the parent # Loop until the child either exits or is terminated by a signal # (ie. keep waiting if it's merely stopped) while 1: try: (pid, status) = os.waitpid(pid, 0) except OSError, exc: import errno if exc.errno == errno.EINTR: continue raise DistutilsExecError, \ "command '%s' failed: %s" % (cmd[0], exc[-1]) if os.WIFSIGNALED(status): raise DistutilsExecError, \ "command '%s' terminated by signal %d" % \ (cmd[0], os.WTERMSIG(status)) elif os.WIFEXITED(status): exit_status = os.WEXITSTATUS(status) if exit_status == 0: return # hey, it succeeded! else: raise DistutilsExecError, \ "command '%s' failed with exit status %d" % \ (cmd[0], exit_status) elif os.WIFSTOPPED(status): continue else: raise DistutilsExecError, \ "unknown error executing '%s': termination status %d" % \ (cmd[0], status)
| 14,620
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return 0 if not b1: return 1
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while True: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return 0 if not b1: return 1
| 14,621
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return 0 if not b1: return 1
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return False if not b1: return 1
| 14,622
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return 0 if not b1: return 1
|
def _do_cmp(f1, f2): bufsize = BUFSIZE fp1 = open(f1, 'rb') fp2 = open(f2, 'rb') while 1: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) if b1 != b2: return 0 if not b1: return True
| 14,623
|
def phase0(self): # Compare everything except common subdirectories self.left_list = _filter(os.listdir(self.left), self.hide+self.ignore) self.right_list = _filter(os.listdir(self.right), self.hide+self.ignore) self.left_list.sort() self.right_list.sort()
|
def phase0(self): # Compare everything except common subdirectories self.left_list = _filter(os.listdir(self.left), self.hide+self.ignore) self.right_list = _filter(os.listdir(self.right), self.hide+self.ignore) self.left_list.sort() self.right_list.sort()
| 14,624
|
def phase1(self): # Compute common names a_only, b_only = [], [] common = {} b = {} for fnm in self.right_list: b[fnm] = 1 for x in self.left_list: if b.get(x, 0): common[x] = 1 else: a_only.append(x) for x in self.right_list: if common.get(x, 0): pass else: b_only.append(x) self.common = common.keys() self.left_only = a_only self.right_only = b_only
|
def phase1(self): # Compute common names b = dict.fromkeys(self.right_list) common = dict.fromkeys(ifilter(b.has_key, self.left_list)) self.left_only = list(ifilterfalse(common.has_key, self.left_list)) self.right_only = list(ifilterfalse(common.has_key, self.right_list)) self.common = common.keys() self.left_only = a_only self.right_only = b_only
| 14,625
|
def phase1(self): # Compute common names a_only, b_only = [], [] common = {} b = {} for fnm in self.right_list: b[fnm] = 1 for x in self.left_list: if b.get(x, 0): common[x] = 1 else: a_only.append(x) for x in self.right_list: if common.get(x, 0): pass else: b_only.append(x) self.common = common.keys() self.left_only = a_only self.right_only = b_only
|
def phase1(self): # Compute common names a_only, b_only = [], [] common = {} b = {} for fnm in self.right_list: b[fnm] = 1 for x in self.left_list: if b.get(x, 0): common[x] = 1 else: a_only.append(x) for x in self.right_list: if common.get(x, 0): pass else: b_only.append(x) self.common = common.keys() self.left_only = a_only self.right_only = b_only
| 14,626
|
def _cmp(a, b, sh): try: return not abs(cmp(a, b, sh)) except os.error: return 2
|
def _cmp(a, b, sh, abs=abs, cmp=cmp): try: return not abs(cmp(a, b, sh)) except os.error: return 2
| 14,627
|
def _filter(list, skip): result = [] for item in list: if item not in skip: result.append(item) return result
|
def _filter(flist, skip): return list(ifilterfalse(skip.__contains__, flist))
| 14,628
|
def finish(self): self.wfile.flush() self.wfile.close() self.rfile.close()
|
def finish(self): if not self.wfile.closed: self.wfile.flush() self.wfile.close() self.rfile.close()
| 14,629
|
def _f(a): print a return 1
|
def _f(a): print a return 1
| 14,630
|
def _f(a): print a return 1
|
def _f(a): print a return 1
| 14,631
|
def _f(a): print a return 1
|
def _f(a): print a return 1
| 14,632
|
def test_dis(self): s = StringIO.StringIO() save_stdout = sys.stdout sys.stdout = s dis.dis(_f) sys.stdout = save_stdout got = s.getvalue() # Trim trailing blanks (if any). lines = got.split('\n') lines = [line.rstrip() for line in lines] got = '\n'.join(lines) self.assertEqual(dis_f, got)
|
def test_dis(self): s = StringIO.StringIO() save_stdout = sys.stdout sys.stdout = s dis.dis(_f) sys.stdout = save_stdout got = s.getvalue() # Trim trailing blanks (if any). lines = got.split('\n') lines = [line.rstrip() for line in lines] got = '\n'.join(lines) self.assertEqual(dis_f, got)
| 14,633
|
def __init__(self, url, code, msg, hdrs, fp): self.__super_init(fp, hdrs, url) self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp # XXX self.filename = url
|
def __init__(self, url, code, msg, hdrs, fp): self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp # XXX self.filename = url
| 14,634
|
def __init__(self, url, code, msg, hdrs, fp): self.__super_init(fp, hdrs, url) self.code = code self.msg = msg self.hdrs = hdrs self.fp = fp # XXX self.filename = url
|
def__init__(self,url,code,msg,hdrs,fp):self.__super_init(fp,hdrs,url)self.code=codeself.msg=msgself.hdrs=hdrsself.fp=fp#XXXself.filename=url
| 14,635
|
def test_tz_aware_arithmetic(self): import random
|
def test_tz_aware_arithmetic(self): import random
| 14,636
|
def test_tz_aware_arithmetic(self): import random
|
def test_tz_aware_arithmetic(self): import random
| 14,637
|
def append(self, s, charset=None): """Append a string to the MIME header.
|
def append(self, s, charset=None): """Append a string to the MIME header.
| 14,638
|
def _encode_chunks(self): """MIME-encode a header with many different charsets and/or encodings.
|
def _encode_chunks(self): """MIME-encode a header with many different charsets and/or encodings.
| 14,639
|
def _encode_chunks(self): """MIME-encode a header with many different charsets and/or encodings.
|
def _encode_chunks(self): """MIME-encode a header with many different charsets and/or encodings.
| 14,640
|
def encode(self): """Encode a message header into an RFC-compliant format.
|
def encode(self): """Encode a message header into an RFC-compliant format.
| 14,641
|
def unquote(str): """Remove quotes from a string.""" if len(str) > 1: if str[0] == '"' and str[-1:] == '"': return str[1:-1] if str[0] == '<' and str[-1:] == '>': return str[1:-1] return str
|
def unquote(str): """Remove quotes from a string.""" if len(str) > 1: if str.startswith('"') and str.endswith('"'): return str[1:-1].replace('\\\\', '\\').replace('\\"', '"') if str.startswith('<') and str.endswith('>'): return str[1:-1] return str
| 14,642
|
def test_tuple_reuse(self): # Tests an implementation detail where tuple is reused # whenever nothing else holds a reference to it self.assertEqual(len(Set(map(id, list(self.seq)))), len(self.seq)) self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))
|
def test_tuple_reuse(self): # Tests an implementation detail where tuple is reused # whenever nothing else holds a reference to it self.assertEqual(len(Set(map(id, list(enumerate(self.seq))))), len(self.seq)) self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))
| 14,643
|
def reset(): """Return a string that resets the CGI and browser to a known state.""" return '''<!--: spam
|
def reset(): """Return a string that resets the CGI and browser to a known state.""" return '''<!--: spam
| 14,644
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
|
__UNDEF__ = [] def small(text): return '<small>' + text + '</small>' def strong(text): return '<strong>' + text + '</strong>' def grey(text): return '<font color=" def lookup(name, frame, locals): """Find the value for a given name in the given environment.""" if name in locals: return 'local', locals[name] if name in frame.f_globals: return 'global', frame.f_globals[name] return None, __UNDEF__ def scanvars(reader, frame, locals): """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword vars, lasttoken, parent, prefix = [], None, None, '' for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break if ttype == tokenize.NAME and token not in keyword.kwlist: if lasttoken == '.': if parent is not __UNDEF__: value = getattr(parent, token, __UNDEF__) vars.append((prefix + token, prefix, value)) else: where, value = lookup(token, frame, locals) vars.append((token, where, value)) elif token == '.': prefix += lasttoken + '.' parent = value else: parent, prefix = None, '' lasttoken = token return vars def html((etype, evalue, etb), context=5): """Return a nice HTML document describing a given traceback.""" import sys, os, types, time, traceback, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
| 14,645
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
| 14,646
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
| 14,647
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
| 14,648
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
|
def html(etype, evalue, etb, context=5): """Return a nice HTML document describing the traceback.""" import sys, os, types, time, traceback import keyword, tokenize, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0ff">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#aa55cc', pyver + '<br>' + date) + '''
| 14,649
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
| 14,650
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
| 14,651
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
| 14,652
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
|
def linereader(lnum=[lnum]): line = linecache.getline(file, lnum[0]) lnum[0] += 1 return line
| 14,653
|
def __init__(self, display=1, logdir=None): self.display = display # send tracebacks to browser if true self.logdir = logdir # log tracebacks to files if not None
|
"""A hook to replace sys.excepthook that shows tracebacks in HTML.""" def __init__(self, display=1, logdir=None, context=5): self.display = display # send tracebacks to browser if true self.logdir = logdir # log tracebacks to files if not None
| 14,654
|
def __call__(self, etype, evalue, etb): """This hook can replace sys.excepthook (for Python 2.1 or higher).""" self.handle((etype, evalue, etb))
|
def __call__(self, etype, evalue, etb): self.handle((etype, evalue, etb))
| 14,655
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys info = info or sys.exc_info() text = 0 print reset()
| 14,656
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() print reset()
| 14,657
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,658
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,659
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,660
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,661
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,662
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
|
def handle(self, info=None): import sys, os info = info or sys.exc_info() text = 0 print reset()
| 14,663
|
def print_form( form ): skeys = form.keys() skeys.sort() print '<h3> The following name/value pairs ' \ 'were entered in the form: </h3>' print '<dl>' for key in skeys: print '<dt>', escape(key), ':', print '<i>', escape(`type(form[key])`), '</i>', print '<dd>', escape(form[key]) print '</dl>'
|
def print_form( form ): skeys = form.keys() skeys.sort() print '<h3> The following name/value pairs ' \ 'were entered in the form: </h3>' print '<dl>' for key in skeys: print '<dt>', escape(key), ':', print '<i>', escape(`type(form[key])`), '</i>', print '<dd>', escape(`form[key]`) print '</dl>'
| 14,664
|
def escape( s ): s = regsub.gsub('&', '&') # Must be done first s = regsub.gsub('<', '<') s = regsub.gsub('>', '>') return s
|
def escape( s ): s = regsub.gsub('&', '&') # Must be done first s = regsub.gsub('<', '<') s = regsub.gsub('>', '>') return s
| 14,665
|
def __init__(self, code, msg, sender): self.smtp_code = code self.smtp_error = msg self.sender = sender self.args = (code, msg, sender)
|
def __init__(self, code, msg, sender): self.smtp_code = code self.smtp_error = msg self.sender = sender self.args = (code, msg, sender)
| 14,666
|
def data(self,msg): """SMTP 'DATA' command -- sends message data to server.
|
def data(self,msg): """SMTP 'DATA' command -- sends message data to server.
| 14,667
|
def readline(self): if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] i = string.find(self.buf, '\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 r = self.buf[self.pos:newpos] self.pos = newpos return r
|
def readline(self, length=None): if self.buflist: self.buf = self.buf + string.joinfields(self.buflist, '') self.buflist = [] i = string.find(self.buf, '\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 r = self.buf[self.pos:newpos] self.pos = newpos return r
| 14,668
|
def load_dynamic(self, name, filename, file):
|
def load_dynamic(self, name, filename, file):
| 14,669
|
def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" frame.f_locals['__exception__'] = exc_type, exc_value if type(exc_type) == type(''): exc_type_name = exc_type else: exc_type_name = exc_type.__name__ print exc_type_name + ':', repr.repr(exc_value) self.interaction(frame, exc_traceback)
|
def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" frame.f_locals['__exception__'] = exc_type, exc_value if type(exc_type) == type(''): exc_type_name = exc_type else: exc_type_name = exc_type.__name__ print exc_type_name + ':', _saferepr(exc_value) self.interaction(frame, exc_traceback)
| 14,670
|
def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date_time) else: zinfo = ZipInfo(arcname, date_time) zinfo.external_attr = st[0] << 16L # Unix attributes if compress_type is None: zinfo.compress_type = self.compression else: zinfo.compress_type = compress_type self._writecheck(zinfo) fp = open(filename, "rb") zinfo.flag_bits = 0x00 zinfo.header_offset = self.fp.tell() # Start of header bytes # Must overwrite CRC and sizes with correct data later zinfo.CRC = CRC = 0 zinfo.compress_size = compress_size = 0 zinfo.file_size = file_size = 0 self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes if zinfo.compress_type == ZIP_DEFLATED: cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) else: cmpr = None while 1: buf = fp.read(1024 * 8) if not buf: break file_size = file_size + len(buf) CRC = binascii.crc32(buf, CRC) if cmpr: buf = cmpr.compress(buf) compress_size = compress_size + len(buf) self.fp.write(buf) fp.close() if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) self.fp.write(buf) zinfo.compress_size = compress_size else: zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size # Seek backwards and write CRC and file sizes position = self.fp.tell() # Preserve current position in file self.fp.seek(zinfo.header_offset + 14, 0) self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.fp.seek(position, 0) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo
|
def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date_time) else: zinfo = ZipInfo(arcname, date_time) zinfo.external_attr = (st[0] & 0xFFFF) << 16L # Unix attributes if compress_type is None: zinfo.compress_type = self.compression else: zinfo.compress_type = compress_type self._writecheck(zinfo) fp = open(filename, "rb") zinfo.flag_bits = 0x00 zinfo.header_offset = self.fp.tell() # Start of header bytes # Must overwrite CRC and sizes with correct data later zinfo.CRC = CRC = 0 zinfo.compress_size = compress_size = 0 zinfo.file_size = file_size = 0 self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes if zinfo.compress_type == ZIP_DEFLATED: cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) else: cmpr = None while 1: buf = fp.read(1024 * 8) if not buf: break file_size = file_size + len(buf) CRC = binascii.crc32(buf, CRC) if cmpr: buf = cmpr.compress(buf) compress_size = compress_size + len(buf) self.fp.write(buf) fp.close() if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) self.fp.write(buf) zinfo.compress_size = compress_size else: zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size # Seek backwards and write CRC and file sizes position = self.fp.tell() # Preserve current position in file self.fp.seek(zinfo.header_offset + 14, 0) self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.fp.seek(position, 0) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo
| 14,671
|
>>> def f():
|
>>> def f():
| 14,672
|
... def f(i):
|
... def f(i):
| 14,673
|
... def f(i):
|
... def f(i):
| 14,674
|
def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. \s+\d+ # It has a size. [^/]* # Skip the date. /. # and end with the name of the file. '''
|
def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. \s+\d+ # It has a size. [^/]* # Skip the date. /\. # and end with the name of the file. '''
| 14,675
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = hdr.split(" ", 2) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
| 14,676
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: int(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = int(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
| 14,677
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2].rstrip() if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
| 14,678
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
|
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file is None: out_file = hdrfields[2] if mode is None: mode = int(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline() if not str: raise Error, 'Truncated input file'
| 14,679
|
def parse_config_files (self, filenames=None):
|
def parse_config_files (self, filenames=None):
| 14,680
|
def parse_config_files (self, filenames=None):
|
def parse_config_files (self, filenames=None):
| 14,681
|
def parse_command_line (self, args): """Parse the setup script's command line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line were successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is.
|
def parse_command_line (self, args): """Parse the setup script's command line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line were successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is.
| 14,682
|
def _parse_command_opts (self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command
|
def _parse_command_opts (self, parser, args): """Parse the command-line options for a single command. 'parser' must be a FancyGetopt instance; 'args' must be the list of arguments, starting with the current command (whose options we are about to parse). Returns a new version of 'args' with the next command at the front of the list; will be the empty list if there are no more commands on the command line. Returns None if the user asked for help on this command. """ # late import because of mutual dependence between these modules from distutils.cmd import Command
| 14,683
|
def get_command_obj (self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no comand object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: print "Distribution.get_command_obj(): " \ "creating '%s' command object" % command
|
def get_command_obj (self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no comand object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: print "Distribution.get_command_obj(): " \ "creating '%s' command object" % command
| 14,684
|
def f5((compound, first), two): pass
|
def f5((compound, first), two): pass
| 14,685
|
def storbinary(self, cmd, fp, blocksize): '''Store a file in binary mode.''' self.voidcmd('TYPE I') conn = self.transfercmd(cmd) while 1: buf = fp.read(blocksize) if not buf: break conn.send(buf) conn.close() return self.voidresp()
|
def storbinary(self, cmd, fp, blocksize=8192): '''Store a file in binary mode.''' self.voidcmd('TYPE I') conn = self.transfercmd(cmd) while 1: buf = fp.read(blocksize) if not buf: break conn.send(buf) conn.close() return self.voidresp()
| 14,686
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
| 14,687
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
| 14,688
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
|
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
| 14,689
|
def get_type(self): if self.type is None: self.type, self.__r_type = splittype(self.__original) assert self.type is not None, self.__original return self.type
|
def get_type(self): if self.type is None: self.type, self.__r_type = splittype(self.__original) if self.type is None: raise ValueError, "unknown url type: %s" % self.__original return self.type
| 14,690
|
def seek(self, pos, whence = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error. """
|
def seek(self, pos, whence = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error. """
| 14,691
|
def mkcorealias(src, altsrc): import string import macostools version = string.split(sys.version)[0] dst = getextensiondirfile(src+ ' ' + version) if not dst: return 0 if not os.path.exists(os.path.join(sys.exec_prefix, src)): if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): return 0 src = altsrc try: os.unlink(dst) except os.error: pass do_copy = ask_copy() if do_copy: macostools.copy(os.path.join(sys.exec_prefix, src), dst) else: macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) return 1
|
def mkcorealias(src, altsrc): import string import macostools version = string.split(sys.version)[0] dst = getextensiondirfile(src+ ' ' + version) if not dst: return 0 if not os.path.exists(os.path.join(sys.exec_prefix, src)): if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): return 0 src = altsrc try: os.unlink(dst) except os.error: pass do_copy = ask_copy() try: if do_copy: macostools.copy(os.path.join(sys.exec_prefix, src), dst) else: macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) except IOError: return 0 return 1
| 14,692
|
def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self.__testMethodName = methodName testMethod = getattr(self, methodName) self.__testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName)
|
def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self._testMethodName = methodName testMethod = getattr(self, methodName) self.__testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName)
| 14,693
|
def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self.__testMethodName = methodName testMethod = getattr(self, methodName) self.__testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName)
|
def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self.__testMethodName = methodName testMethod = getattr(self, methodName) self._testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName)
| 14,694
|
def shortDescription(self): """Returns a one-line description of the test, or None if no description has been provided.
|
def shortDescription(self): """Returns a one-line description of the test, or None if no description has been provided.
| 14,695
|
def id(self): return "%s.%s" % (_strclass(self.__class__), self.__testMethodName)
|
def id(self): return "%s.%s" % (_strclass(self.__class__), self.__testMethodName)
| 14,696
|
def __str__(self): return "%s (%s)" % (self.__testMethodName, _strclass(self.__class__))
|
def __str__(self): return "%s (%s)" % (self.__testMethodName, _strclass(self.__class__))
| 14,697
|
def __repr__(self): return "<%s testMethod=%s>" % \ (_strclass(self.__class__), self.__testMethodName)
|
def __repr__(self): return "<%s testMethod=%s>" % \ (_strclass(self.__class__), self.__testMethodName)
| 14,698
|
def run(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) return
|
def run(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self._testMethodName) try: try: self.setUp() except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) return
| 14,699
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.