bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 21,700 |
def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... | 21,701 |
def read(self,size=None): if self.extrasize <= 0 and self.fileobj is None: return '' | def read(self, size=None): if self.extrasize <= 0 and self.fileobj is None: return '' | 21,702 |
def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize | def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize | 21,703 |
def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | 21,704 |
def _mac_ver_lookup(selectors,default=None): from gestalt import gestalt l = [] append = l.append for selector in selectors: try: append(gestalt(selector)) except RuntimeError: append(default) return l | def _mac_ver_lookup(selectors,default=None): from gestalt import gestalt l = [] append = l.append for selector in selectors: try: append(gestalt(selector)) except (RuntimeError, MacOS.Error): append(default) return l | 21,705 |
def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:') except getopt.error, msg: print msg print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \ "[-x regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps ar... | def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:') except getopt.error, msg: print msg print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \ "[-x regexp] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps ar... | 21,706 |
def get_file_list (self): """Figure out the list of files to include in the source distribution, and put it in 'self.files'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all depends on the user's options and the stat... | def get_file_list (self): """Figure out the list of files to include in the source distribution, and put it in 'self.files'. This might involve reading the manifest template (and writing the manifest), or just reading the manifest, or just using the default file set -- it all depends on the user's options and the stat... | 21,707 |
def write(self, data): if DEBUG: | def write(self, data): if DEBUG: | 21,708 |
def resetwarnings(): """Reset the list of warnings filters to its default state.""" filters[:] = [] | def resetwarnings(): """Clear the list of warning filters, so that no filters are active.""" filters[:] = [] | 21,709 |
def test_nonrecursive_deep(self): a = [] for i in range(100): a = [a] b = self.loads(self.dumps(a)) self.assertEqual(a, b) | def test_nonrecursive_deep(self): a = [] for i in range(60): a = [a] b = self.loads(self.dumps(a)) self.assertEqual(a, b) | 21,710 |
def runtest(test, generate, verbose, quiet, testdir = None): """Run a single test. test -- the name of the test generate -- if true, generate output, instead of running the test and comparing it to a previously created output file verbose -- if true, print more messages quiet -- if true, don't print 'skipped' messages ... | def runtest(test, generate, verbose, quiet, testdir = None): """Run a single test. test -- the name of the test generate -- if true, generate output, instead of running the test and comparing it to a previously created output file verbose -- if true, print more messages quiet -- if true, don't print 'skipped' messages ... | 21,711 |
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__pa... | def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__pa... | 21,712 |
def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): self.filename = _normpath(filename) # Name of the file in the archive self.date_time = date_time # year, month, day, hour, min, sec # Standard values: self.compress_type = ZIP_STORED # Type of compression for the file self.comment = "" ... | def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): self.orig_filename = filename null_byte = filename.find(chr(0)) if null_byte >= 0: filename = filename[0:null_byte] print "File name %s contains a suspicious null byte!" % filename if os.sep != "/": filename = filename.replace(os.sep, "/") self.fil... | 21,713 |
def FileHeader(self): """Return the per-file header as a string.""" dt = self.date_time dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2] dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2) if self.flag_bits & 0x08: # Set these to zero because we write them after the file data CRC = compress_size = file_size = 0 else: C... | def FileHeader(self): """Return the per-file header as a string.""" dt = self.date_time dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2] dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2) if self.flag_bits & 0x08: # Set these to zero because we write them after the file data CRC = compress_size = file_size = 0 else: C... | 21,714 |
def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp endrec = _EndRecData(fp) if not endrec: raise BadZipfile, "File is not a zip file" if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central direc... | def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp endrec = _EndRecData(fp) if not endrec: raise BadZipfile, "File is not a zip file" if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central direc... | 21,715 |
def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp endrec = _EndRecData(fp) if not endrec: raise BadZipfile, "File is not a zip file" if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central direc... | def _RealGetContents(self): """Read in the table of contents for the ZIP file.""" fp = self.fp endrec = _EndRecData(fp) if not endrec: raise BadZipfile, "File is not a zip file" if self.debug > 1: print endrec size_cd = endrec[5] # bytes in central directory offset_cd = endrec[6] # offset of central direc... | 21,716 |
def hashopen(file, flag='c', mode=0666, pgsize=None, ffactor=None, nelem=None, cachesize=None, lorder=None, hflags=0): flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) d.set_flags(hflags) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not Non... | def hashopen(file, flag='c', mode=0666, pgsize=None, ffactor=None, nelem=None, cachesize=None, lorder=None, hflags=0): flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) d.set_flags(hflags) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is n... | 21,717 |
def btopen(file, flag='c', mode=0666, btflags=0, cachesize=None, maxkeypage=None, minkeypage=None, pgsize=None, lorder=None): flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d.set_lorder(... | def btopen(file, flag='c', mode=0666, btflags=0, cachesize=None, maxkeypage=None, minkeypage=None, pgsize=None, lorder=None): flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d.set_l... | 21,718 |
def rnopen(file, flag='c', mode=0666, rnflags=0, cachesize=None, pgsize=None, lorder=None, rlen=None, delim=None, source=None, pad=None): flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not None: d... | def rnopen(file, flag='c', mode=0666, rnflags=0, cachesize=None, pgsize=None, lorder=None, rlen=None, delim=None, source=None, pad=None): flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) if cachesize is not None: d.set_cachesize(0, cachesize) if pgsize is not None: d.set_pagesize(pgsize) if lorder is not N... | 21,719 |
def _checkflag(flag): if flag == 'r': flags = db.DB_RDONLY elif flag == 'rw': flags = 0 elif flag == 'w': flags = db.DB_CREATE elif flag == 'c': flags = db.DB_CREATE elif flag == 'n': flags = db.DB_CREATE | db.DB_TRUNCATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" return flags | db.DB_THREAD | def _checkflag(flag, file): if flag == 'r': flags = db.DB_RDONLY elif flag == 'rw': flags = 0 elif flag == 'w': flags = db.DB_CREATE elif flag == 'c': flags = db.DB_CREATE elif flag == 'n': flags = db.DB_CREATE | db.DB_TRUNCATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" return flags | db.DB_THRE... | 21,720 |
def _checkflag(flag): if flag == 'r': flags = db.DB_RDONLY elif flag == 'rw': flags = 0 elif flag == 'w': flags = db.DB_CREATE elif flag == 'c': flags = db.DB_CREATE elif flag == 'n': flags = db.DB_CREATE | db.DB_TRUNCATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" return flags | db.DB_THREAD | def _checkflag(flag): if flag == 'r': flags = db.DB_RDONLY elif flag == 'rw': flags = 0 elif flag == 'w': flags = db.DB_CREATE elif flag == 'c': flags = db.DB_CREATE elif flag == 'n': flags = db.DB_CREATE if os.path.isfile(file): os.unlink(file) else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" retu... | 21,721 |
def tearDown(self): """Restore sys.path""" sys.path = self.sys_path | def tearDown(self): """Restore sys.path""" sys.path = self.sys_path | 21,722 |
def test_init_pathinfo(self): dir_set = site._init_pathinfo() for entry in [site.makepath(path)[1] for path in sys.path if path and os.path.isdir(path)]: self.failUnless(entry in dir_set, "%s from sys.path not found in set returned " "by _init_pathinfo(): %s" % (entry, dir_set)) | def test_init_pathinfo(self): dir_set = site._init_pathinfo() for entry in [site.makepath(path)[1] for path in sys.path if path and os.path.isdir(path)]: self.failUnless(entry in dir_set, "%s from sys.path not found in set returned " "by _init_pathinfo(): %s" % (entry, dir_set)) | 21,723 |
def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # otherwise add a directory combined from sitedir and 'name'. # Must also skip comment lines. dir_path, file_name, new_dir = createpth() try: site.addpackage(dir_path, file_name, set()) self.failUnless(site.makepath(os.path.j... | def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # otherwise add a directory combined from sitedir and 'name'. # Must also skip comment lines. dir_path, file_name, new_dir = createpth() try: site.addpackage(dir_path, file_name, set()) self.failUnless(site.makepath(os.path.j... | 21,724 |
def test_abs__file__(self): # Make sure all imported modules have their __file__ attribute # as an absolute path. # Handled by abs__file__() site.abs__file__() for module in sys.modules.values(): try: self.failUnless(os.path.isabs(module.__file__)) except AttributeError: continue | def test_abs__file__(self): # Make sure all imported modules have their __file__ attribute # as an absolute path. # Handled by abs__file__() site.abs__file__() for module in (sys, os, __builtin__): try: self.failUnless(os.path.isabs(module.__file__)) except AttributeError: continue | 21,725 |
def test_abs__file__(self): # Make sure all imported modules have their __file__ attribute # as an absolute path. # Handled by abs__file__() site.abs__file__() for module in sys.modules.values(): try: self.failUnless(os.path.isabs(module.__file__)) except AttributeError: continue | def test_abs__file__(self): # Make sure all imported modules have their __file__ attribute # as an absolute path. # Handled by abs__file__() site.abs__file__() for module in sys.modules.values(): try: self.failUnless(os.path.isabs(module.__file__), `module`) except AttributeError: continue | 21,726 |
def register_X_browsers(): # The default Gnome browser if _iscommand("gconftool-2"): # get the web browser string from gconftool gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null' out = os.popen(gc) commd = out.read().strip() retncode = out.close() # if successful, register it if retncode is No... | def register_X_browsers(): # The default Gnome browser if _iscommand("gconftool-2"): # get the web browser string from gconftool gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null' out = os.popen(gc) commd = out.read().strip() retncode = out.close() # if successful, register it if retncode is No... | 21,727 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,728 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,729 |
def finalize_options (self): from distutils import sysconfig | def finalize_options (self): from distutils import sysconfig | 21,730 |
def get_ext_libname (self, ext_name): # create a filename for the (unneeded) lib-file. # extensions in debug_mode are named 'module_d.pyd' under windows ext_path = string.split (ext_name, '.') if os.name == 'nt' and self.debug: return apply (os.path.join, ext_path) + '_d.lib' return apply (os.path.join, ext_path) + '.l... | def get_ext_libname (self, ext_name): # create a filename for the (unneeded) lib-file. # extensions in debug_mode are named 'module_d.pyd' under windows ext_path = string.split (ext_name, '.') if os.name == 'nt' and self.debug: return apply (os.path.join, ext_path) + '_d.lib' return apply (os.path.join, ext_path) + '.l... | 21,731 |
def get_libraries (self, ext): """Return the list of libraries to link against when building a shared extension. On most platforms, this is just 'ext.libraries'; on Windows, we add the Python library (eg. python20.dll). """ # The python library is always needed on Windows. For MSVC, this # is redundant, since the lib... | def get_libraries (self, ext): """Return the list of libraries to link against when building a shared extension. On most platforms, this is just 'ext.libraries'; on Windows, we add the Python library (eg. python20.dll). """ # The python library is always needed on Windows. For MSVC, this # is redundant, since the lib... | 21,732 |
def parse_config_files (self, filenames=None): | def parse_config_files (self, filenames=None): | 21,733 |
def parse_command_line (self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternatel... | def parse_command_line (self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternatel... | 21,734 |
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). | def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). | 21,735 |
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). | def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). | 21,736 |
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scrip... | 21,737 |
def setUp (self): fp = open(temp_filename, 'wt') fp.write(TEST_NETRC) fp.close() self.netrc = netrc.netrc(temp_filename) | def setUp (self): mode = 'w' if sys.platform not in ['cygwin']: mode += 't' fp = open(temp_filename, mode) fp.write(TEST_NETRC) fp.close() self.netrc = netrc.netrc(temp_filename) | 21,738 |
def asList(nodes): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l | def asList(nodearg): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l | 21,739 |
def asList(nodes): l = [] for item in nodes: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l | def asList(nodes): l = [] for item in nodearg: if hasattr(item, "asList"): l.append(item.asList()) else: t = type(item) if t is TupleType or t is ListType: l.append(tuple(asList(item))) else: l.append(item) return l | 21,740 |
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.lower is not None: nodes.append(self.lower) if self.upper is not None: nodes.append(self.upper) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.lower is not None: nodes.append(self.lower) if self.upper is not None: nodes.append(self.upper) return tuple(nodes) | 21,741 |
def getChildNodes(self): nodes = [] if self.expr1 is not None: nodes.append(self.expr1) if self.expr2 is not None: nodes.append(self.expr2) if self.expr3 is not None: nodes.append(self.expr3) return tuple(nodes) | def getChildNodes(self): nodes = [] if self.expr1 is not None: nodes.append(self.expr1) if self.expr2 is not None: nodes.append(self.expr2) if self.expr3 is not None: nodes.append(self.expr3) return tuple(nodes) | 21,742 |
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | 21,743 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,744 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,745 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.items)) return tuple(nodes) | 21,746 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) | 21,747 |
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.subs)) return tuple(nodes) | 21,748 |
def getChildNodes(self): nodes = [] nodes.append(self.body) nodes.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.body) nodes.extend(flatten_nodes(self.handlers)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | 21,749 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,750 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) | 21,751 |
def getChildNodes(self): nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.test) if self.fail is not None: nodes.append(self.fail) return tuple(nodes) | 21,752 |
def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.locals is not None: nodes.append(self.locals) if self.globals is not None: nodes.append(self.globals) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.expr) if self.locals is not None: nodes.append(self.locals) if self.globals is not None: nodes.append(self.globals) return tuple(nodes) | 21,753 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,754 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,755 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,756 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.bases)) nodes.append(self.code) return tuple(nodes) | 21,757 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) if self.dest is not None: nodes.append(self.dest) return tuple(nodes) | 21,758 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,759 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,760 |
def getChildNodes(self): nodes = [] nodes.append(self.test) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.test) nodes.append(self.body) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | 21,761 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) nodes.append(self.expr) return tuple(nodes) | 21,762 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.defaults)) nodes.append(self.code) return tuple(nodes) | 21,763 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,764 |
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.ops)) return tuple(nodes) | 21,765 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,766 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.nodes)) return tuple(nodes) | 21,767 |
def getChildNodes(self): nodes = [] nodes.append(self.node) nodes.extend(flatten_nodes(self.args)) if self.star_args is not None: nodes.append(self.star_args) if self.dstar_args is not None: nodes.append(self.dstar_args) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.node) nodes.extend(flatten_nodes(self.args)) if self.star_args is not None: nodes.append(self.star_args) if self.dstar_args is not None: nodes.append(self.dstar_args) return tuple(nodes) | 21,768 |
def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.extend(flatten_nodes(self.tests)) if self.else_ is not None: nodes.append(self.else_) return tuple(nodes) | 21,769 |
def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.expr) nodes.extend(flatten_nodes(self.quals)) return tuple(nodes) | 21,770 |
def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes) | def getChildNodes(self): nodes = [] nodes.append(self.assign) nodes.append(self.list) nodes.extend(flatten_nodes(self.ifs)) return tuple(nodes) | 21,771 |
def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | 21,772 |
def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | 21,773 |
def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir)) | 21,774 |
def addsitedir(sitedir): sitedir = makepath(sitedir) if sitedir not in sys.path: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names = map(os.path.normcase, names) names.sort() for name in names: if name[-4:] == endsep + "pth": addpackage(sitedir, name) | def addsitedir(sitedir): sitedir, sitedircase = makepath(sitedir) if not dirs_in_sys_path.has_key(sitedircase): sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names = map(os.path.normcase, names) names.sort() for name in names: if name[-4:] == endsep + "pth... | 21,775 |
def addsitedir(sitedir): sitedir = makepath(sitedir) if sitedir not in sys.path: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names = map(os.path.normcase, names) names.sort() for name in names: if name[-4:] == endsep + "pth": addpackage(sitedir, name) | def addsitedir(sitedir): sitedir = makepath(sitedir) if sitedir not in sys.path: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == endsep + "pth": addpackage(sitedir, name) | 21,776 |
def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir = makepath(sitedir, dir) if dir not in sys.p... | def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir, dircase = makepath(sitedir, dir) if not dir... | 21,777 |
def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir = makepath(sitedir, dir) if dir not in sys.p... | def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir = makepath(sitedir, dir) if dir not in sys.p... | 21,778 |
def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir = makepath(sitedir, dir) if dir not in sys.p... | def addpackage(sitedir, name): fullname = os.path.join(sitedir, name) try: f = open(fullname) except IOError: return while 1: dir = f.readline() if not dir: break if dir[0] == '#': continue if dir.startswith("import"): exec dir continue if dir[-1] == '\n': dir = dir[:-1] dir = makepath(sitedir, dir) if dir not in sys.p... | 21,779 |
def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | 21,780 |
def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | 21,781 |
def do_proxy(self, p, req): p return self.parent.open(req) | def do_proxy(self, p, req): return self.parent.open(req) | 21,782 |
def __init__(self, passwd=None): if passwd is None: passwd = HTTPPassowrdMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None | def __init__(self, passwd=None): if passwd is None: passwd = HTTPPasswordMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None | 21,783 |
def build_opener(self): opener = OpenerDirectory() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph) | def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph) | 21,784 |
def build_extensions (self): | defmacros=macros, build_extensionsmacros=macros, (self): | 21,785 |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slash = (path[0] == '/') comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slash and not new_comps) or (new_comps and new_comps[-1] == '..'... | def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slashes = path.startswith('/') if (initial_slashes and path.startswith('//') and not path.startswith('///')): initial_slashes = 2 comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'):... | 21,786 |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slash = (path[0] == '/') comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slash and not new_comps) or (new_comps and new_comps[-1] == '..'... | def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slash = (path[0] == '/') comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slashes and not new_comps) or (new_comps and new_comps[-1] == '.... | 21,787 |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slash = (path[0] == '/') comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slash and not new_comps) or (new_comps and new_comps[-1] == '..'... | def normpath(path): """Normalize path, eliminating double slashes, etc.""" if path == '': return '.' initial_slash = (path[0] == '/') comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slash and not new_comps) or (new_comps and new_comps[-1] == '..'... | 21,788 |
def test_charset(self): eq = self.assertEqual msg = MIMEText('hello there', _charset='us-ascii') eq(msg.get_charset().input_charset, 'us-ascii') eq(msg['content-type'], 'text/plain; charset="us-ascii"') | def test_charset(self): eq = self.assertEqual msg = MIMEText('hello there', _charset='us-ascii') eq(msg.get_charset().input_charset, 'us-ascii') eq(msg['content-type'], 'text/plain; charset="us-ascii"') | 21,789 |
def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 21,790 |
def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 21,791 |
def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional... | 21,792 |
def getquotaroot(self, mailbox): """Get the list of quota roots for the named mailbox. | def getquotaroot(self, mailbox): """Get the list of quota roots for the named mailbox. | 21,793 |
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t... | def command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() commit(self, command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() entry): command = interpolate(SH_LOCK, file=file) p = os.popen(command) output = p.read() file command = interpolate(SH_LOCK, file=f... | 21,794 |
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t... | def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t... | 21,795 |
def commit(self, entry): file = entry.file # Normalize line endings in body if '\r' in self.ui.body: self.ui.body = re.sub('\r\n?', '\n', self.ui.body) # Normalize whitespace in title self.ui.title = string.join(string.split(self.ui.title)) # Check that there were any changes if self.ui.body == entry.body and self.ui.t... | deflog("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") commit(self,log("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") entry):log("output: " + output) log("done: " + str(sts)) log("TempFile:\n" + open(tfn).read() + "end") filelog... | 21,796 |
def do_clear(self, arg): """Three possibilities, tried in this order: clear -> clear all breaks, ask for confirmation clear file:lineno -> clear all breaks at file:lineno clear bpno bpno ... -> clear breakpoints by number""" if not arg: try: reply = raw_input('Clear all breaks? ') except EOFError: reply = 'no' reply = ... | def do_clear(self, arg): """Three possibilities, tried in this order: clear -> clear all breaks, ask for confirmation clear file:lineno -> clear all breaks at file:lineno clear bpno bpno ... -> clear breakpoints by number""" if not arg: try: reply = raw_input('Clear all breaks? ') except EOFError: reply = 'no' reply = ... | 21,797 |
def testMultiply(self): self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) | def testMultiply(self): self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) | 21,798 |
def addError(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err))) | def addError(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err))) | 21,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.