bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | 14,000 |
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | 14,001 |
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | 14,002 |
def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg p... | 14,003 |
def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | 14,004 |
def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | 14,005 |
def note(self, level, format, *args): if self.verbose > level: if args: format = format%args self.message(format) | def note(self, level, format, *args): if self.verbose > level: if args: format = format%args self.message(format) | 14,006 |
def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addr... | def addroot(self, root, add_to_do = 1): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(t... | 14,007 |
def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addr... | def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addr... | 14,008 |
def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Er... | def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Er... | 14,009 |
def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Er... | def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Er... | 14,010 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,011 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,012 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,013 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,014 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,015 |
def dopage(self, url_pair): | def dopage(self, url_pair): | 14,016 |
def newdonelink(self, url, origin): self.done[url].append(origin) | def newdonelink(self, url, origin): self.done[url].append(origin) | 14,017 |
def newdonelink(self, url, origin): self.done[url].append(origin) | def if self.bad.has_key(url): source, rawlink = origin triple = url, rawlink, self.bad[url] self.seterror(source, triple) newdonelink(self, if self.bad.has_key(url): source, rawlink = origin triple = url, rawlink, self.bad[url] self.seterror(source, triple) url, if self.bad.has_key(url): source, rawlink = ... | 14,018 |
def newtodolink(self, url, origin): | def newtodolink(self, url, origin): | 14,019 |
def newtodolink(self, url, origin): | def newtodolink(self, url, origin): | 14,020 |
def newtodolink(self, url, origin): | def newtodolink(self, url, origin): | 14,021 |
def format_url(self, url): | def format_url(self, url): | 14,022 |
def inroots(self, url): for root in self.roots: if url[:len(root)] == root: return self.isallowed(root, url) return 0 | def inroots(self, url): for root in self.roots: if url[:len(root)] == root: return self.isallowed(root, url) return 0 | 14,023 |
def getpage(self, url_pair): | def getpage(self, url_pair): | 14,024 |
def getpage(self, url_pair): | def getpage(self, url_pair): | 14,025 |
def getpage(self, url_pair): | def getpage(self, url_pair): | 14,026 |
def readhtml(self, url_pair): | def readhtml(self, url_pair): | 14,027 |
def openhtml(self, url_pair): | def openhtml(self, url_pair): | 14,028 |
def openpage(self, url_pair): | def openpage(self, url_pair): | 14,029 |
def setbad(self, url, msg): if self.bad.has_key(url) and self.bad[url] == msg: self.note(0, "(Seen this error before)") return self.bad[url] = msg self.changed = 1 self.markerror(url) | def setbad(self, url, msg): if self.bad.has_key(url) and self.bad[url] == msg: self.note(0, "(Seen this error before)") return self.bad[url] = msg self.changed = 1 self.markerror(url) | 14,030 |
def seterror(self, url, triple): try: # Begin SLB 2/24/99: Because of the way the # URLs are now processed, I need to check to make # sure the URL hasn't been entered in the error list. # The first element of the triple here is a (URL, fragment) # pair, but the URL key is not, since it's from the # list of origins. if... | def seterror(self, url, triple): try: # Begin SLB 2/24/99: Because of the way the # URLs are now processed, I need to check to make # sure the URL hasn't been entered in the error list. # The first element of the triple here is a (URL, fragment) # pair, but the URL key is not, since it's from the # list of origins. if... | 14,031 |
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | 14,032 |
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | 14,033 |
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | 14,034 |
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | 14,035 |
def getnames(self): | def getnames(self): | 14,036 |
def getlinkinfos(self): | def getlinkinfos(self): | 14,037 |
def getlinkinfos(self): | def getlinkinfos(self): | 14,038 |
def getlinkinfos(self): | def getlinkinfos(self): | 14,039 |
def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError,... | def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError, msg, sys.exc_traceback names.sort() s ... | 14,040 |
def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError,... | def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError,... | 14,041 |
def __init__(self, url, verbose=VERBOSE, checker=None): self.myverbose = verbose # now unused self.checker = checker self.base = None self.links = {} | def __init__(self, url, verbose=VERBOSE, checker=None): self.myverbose = verbose # now unused self.checker = checker self.base = None self.links = {} | 14,042 |
def start_a(self, attributes): self.link_attr(attributes, 'href') | def start_a(self, attributes): self.link_attr(attributes, 'href') | 14,043 |
def __init__(self, files=[], dir=os.curdir, allfiles=None, warn=None, debug_print=None): # use standard warning and debug functions, if no other given if warn is None: warn = self.__warn if debug_print is None: debug_print = self.__debug_print self.warn = warn self.debug_print = debug_print self.files = files self.dir ... | def__init__(self,files=[],dir=os.curdir,allfiles=None,warn=None,debug_print=None):#usestandardwarninganddebugfunctions,ifnoothergivenifwarnisNone:warn=self.__warnifdebug_printisNone:debug_print=self.__debug_printself.warn=warnself.debug_print=debug_printself.files=filesself.dir=dirself.allfiles=allfiles#ifNone,itwillbe... | 14,044 |
def __warn (self, msg): sys.stderr.write ("warning: template: %s\n" % msg) | def __warn (self, msg): sys.stderr.write ("warning: %s\n" % msg) | 14,045 |
def process_line(self, line): | def process_line(self, line): | 14,046 |
def process_line(self, line): | def process_line(self, line): | 14,047 |
def process_line(self, line): | def process_line(self, line): | 14,048 |
def process_line(self, line): | def process_line(self, line): | 14,049 |
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 14,050 |
def _handle_text(self, msg): payload = msg.get_payload() if not isinstance(payload, StringType): raise TypeError, 'string payload expected' if self._mangle_from_: payload = fcre.sub('>From ', payload) self._fp.write(payload) | def _handle_text(self, msg): payload = msg.get_payload() if not isinstance(payload, StringType): raise TypeError, 'string payload expected: %s' % type(payload) if self._mangle_from_: payload = fcre.sub('>From ', payload) self._fp.write(payload) | 14,051 |
def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s) g(part, unixfrom=0) msgtexts... | def _handle_multipart(self, msg, isdigest=0): # The trick here is to write out each part separately, merge them all # together, and then make sure that the boundary we've chosen isn't # present in the payload. msgtexts = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__m... | 14,052 |
def _handle_message_rfc822(self, msg): s = StringIO() g = self.__class__(s) # A message/rfc822 should contain a scalar payload which is another # Message object. Extract that object, stringify it, and write that # out. g(msg.get_payload(), unixfrom=0) self._fp.write(s.getvalue()) | def _handle_message_delivery_status(self, msg): blocks = [] for part in msg.get_payload(): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) g(part, unixfrom=0) text = s.getvalue() lines = text.split('\n') if lines and lines[-1] == '': blocks.append(NL.join(lines[:-1])) else: blocks.appe... | 14,053 |
def _handle_message_rfc822(self, msg): s = StringIO() g = self.__class__(s) # A message/rfc822 should contain a scalar payload which is another # Message object. Extract that object, stringify it, and write that # out. g(msg.get_payload(), unixfrom=0) self._fp.write(s.getvalue()) | def _handle_message_rfc822(self, msg): s = StringIO() g = self.__class__(s, self._mangle_from_, self.__maxheaderlen) # A message/rfc822 should contain a scalar payload which is another # Message object. Extract that object, stringify it, and write that # out. g(msg.get_payload(), unixfrom=0) self._fp.write(s.getvalue(... | 14,054 |
def _dispatch(self, msg): for part in msg.walk(): if part.get_main_type('text') == 'text': print >> self, part.get_payload(decode=1) else: print >> self, self._fmt % { 'type' : part.get_type('[no MIME type]'), 'maintype' : part.get_main_type('[no main MIME type]'), 'subtype' : part.get_subtype('[no sub-MIME ... | def _dispatch(self, msg): for part in msg.walk(): maintype = part.get_main_type('text') if maintype == 'text': print >> self, part.get_payload(decode=1) else: print >> self, self._fmt % { 'type' : part.get_type('[no MIME type]'), 'maintype' : part.get_main_type('[no main MIME type]'), 'subtype' : part.get_su... | 14,055 |
def addrobot(self, root): root = urlparse.urljoin(root, "/") if self.robots.has_key(root): return url = urlparse.urljoin(root, "/robots.txt") self.robots[root] = rp = robotparser.RobotFileParser() self.note(2, "Parsing %s", url) rp.debug = self.verbose > 3 rp.set_url(url) try: rp.read() except IOError, msg: self.note(1... | def addrobot(self, root): root = urlparse.urljoin(root, "/") if self.robots.has_key(root): return url = urlparse.urljoin(root, "/robots.txt") self.robots[root] = rp = robotparser.RobotFileParser() self.note(2, "Parsing %s", url) rp.debug = self.verbose > 3 rp.set_url(url) try: rp.read() except (OSError, IOError), msg: ... | 14,056 |
def openpage(self, url_pair): url, fragment = url_pair try: return self.urlopener.open(url) except IOError, msg: msg = self.sanitize(msg) self.note(0, "Error %s", msg) if self.verbose > 0: self.show(" HREF ", url, " from", self.todo[url_pair]) self.setbad(url_pair, msg) return None | def openpage(self, url_pair): url, fragment = url_pair try: return self.urlopener.open(url) except (OSError, IOError), msg: msg = self.sanitize(msg) self.note(0, "Error %s", msg) if self.verbose > 0: self.show(" HREF ", url, " from", self.todo[url_pair]) self.setbad(url_pair, msg) return None | 14,057 |
def make_zipfile (self, base_dir): | def make_zipfile (self, base_dir): | 14,058 |
def __init__(self): server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-Agent', server_version)] # manage the individual handlers self.handlers = [] self.handle_open = {} self.handle_error = {} | def __init__(self): server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] # manage the individual handlers self.handlers = [] self.handle_open = {} self.handle_error = {} | 14,059 |
def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) if ':' in user_pass: user, password = user_pass.split(':', 1) user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))... | def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) if ':' in user_pass: user, password = user_pass.split(':', 1) user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))... | 14,060 |
def http_error_401(self, req, fp, code, msg, headers): host = urlparse.urlparse(req.get_full_url())[1] return self.http_error_auth_reqed('www-authenticate', host, req, headers) | def http_error_401(self, req, fp, code, msg, headers): host = urlparse.urlparse(req.get_full_url())[1] return self.http_error_auth_reqed('www-authenticate', host, req, headers) | 14,061 |
def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | 14,062 |
def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | 14,063 |
def open_local_file(self, req): host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( 'Content-Type: %s\nContent-Length: %d\nL... | def open_local_file(self, req): host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( 'Content-type: %s\nContent-length: %d\nL... | 14,064 |
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita... | def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita... | 14,065 |
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita... | def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splita... | 14,066 |
def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if memo.has_key(d): return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeE... | def deepcopy(x, memo = None): """Deep copy operation on arbitrary Python objects. See the module's __doc__ string for more info. """ if memo is None: memo = {} d = id(x) if memo.has_key(d): return memo[d] try: copierfunction = _deepcopy_dispatch[type(x)] except KeyError: try: copier = x.__deepcopy__ except AttributeE... | 14,067 |
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) ... | def _reconstruct(x, info, deep, memo=None): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.upd... | 14,068 |
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) ... | def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args, memo) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(s... | 14,069 |
def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state) y.__dict__.update(state) ... | def _reconstruct(x, info, deep): if isinstance(info, str): return x assert isinstance(info, tuple) n = len(info) assert n in (2, 3) callable, args = info[:2] if n > 2: state = info[2] else: state = {} if deep: args = deepcopy(args) y = callable(*args) if state: if deep: state = deepcopy(state, memo) y.__dict__.update(s... | 14,070 |
def _stringify(string): return string | def"""Base class for client errors.""" _stringify(string):"""Base class for client errors.""" return"""Base class for client errors.""" string | 14,071 |
def _stringify(string): return string | def"""Indicates an HTTP protocol error.""" _stringify(string):"""Indicates an HTTP protocol error.""" return"""Indicates an HTTP protocol error.""" string | 14,072 |
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) ) | def"""Indicates a broken response package""" __repr__(self):"""Indicates a broken response package""" return"""Indicates a broken response package""" ("""Indicates a broken response package""" "<ProtocolError"""Indicates a broken response package""" for"""Indicates a broken response package""" %s:"""Indicates a broken ... | 14,073 |
def __repr__(self): return ( "<ProtocolError for %s: %s %s>" % (self.url, self.errcode, self.errmsg) ) | def"""indicates a XML-RPC fault package""" __repr__(self):"""indicates a XML-RPC fault package""" return"""indicates a XML-RPC fault package""" ("""indicates a XML-RPC fault package""" "<ProtocolError"""indicates a XML-RPC fault package""" for"""indicates a XML-RPC fault package""" %s:"""indicates a XML-RPC fault packa... | 14,074 |
def __repr__(self): return ( "<Fault %s: %s>" % (self.faultCode, repr(self.faultString)) ) | def __repr__(self): return ( "<Fault %s: %s>" % (self.faultCode, repr(self.faultString)) ) | 14,075 |
def boolean(value, truefalse=(False, True)): # convert any Python value to XML-RPC boolean return truefalse[operator.truth(value)] | def"""Convert any Python value to XML-RPC boolean.""" boolean(value,"""Convert any Python value to XML-RPC boolean.""" truefalse=(False,"""Convert any Python value to XML-RPC boolean.""" True)):"""Convert any Python value to XML-RPC boolean.""" #"""Convert any Python value to XML-RPC boolean.""" convert"""Convert any P... | 14,076 |
def datetime(data): value = DateTime() value.decode(data) return value | def datetime(data): value = DateTime() value.decode(data) return value | 14,077 |
def close(self): self._parser.Parse("", 1) # end of data del self._target, self._parser # get rid of circular references | def close(self): self._parser.Parse("", 1) # end of data del self._target, self._parser # get rid of circular references | 14,078 |
def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self) | def __init__(self, target): self.handle_xml = target.xml self.unknown_starttag = target.start self.handle_data = target.data self.unknown_endtag = target.end xmllib.XMLParser.__init__(self) | 14,079 |
def dump_instance(self, value): # check for special wrappers if value.__class__ in WRAPPERS: value.encode(self) else: # store instance attributes as a struct (really?) self.dump_struct(value.__dict__) | def dump_instance(self, value): # check for special wrappers if value.__class__ in WRAPPERS: value.encode(self) else: # store instance attributes as a struct (really?) self.dump_struct(value.__dict__) | 14,080 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | 14,081 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | 14,082 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | defif max < min: raise error, "bad repeat interval" _parse(source,if max < min: raise error, "bad repeat interval" state):if max < min: raise error, "bad repeat interval" #if max < min: raise error, "bad repeat interval" parseif max < min: raise error, "bad repeat interval" aif max < min: raise error, "bad repeat inter... | 14,083 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | 14,084 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | 14,085 |
def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | def _parse(source, state): # parse a simple pattern subpattern = SubPattern(state) while 1: if source.next in ("|", ")"): break # end of subpattern this = source.get() if this is None: break # end of pattern if state.flags & SRE_FLAG_VERBOSE: # skip whitespace and comments if this in WHITESPACE: continue if this ==... | 14,086 |
def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": # group if this == "\\g": name = "" if s.match("<"): while 1... | def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) p = [] a = p.append while 1: this = s.get() if this is None: break # end of replacement string if this and this[0] == "\\": # group if this == "\\g": name = "" if s.match("<"): while 1... | 14,087 |
def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl. """ global _varnum if not master: master = _default_root self._master = master self._tk = master.tk self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._de... | def __init__(self, master=None, value=None, name=None): """Construct a variable MASTER can be given as master widget. VALUE is an optional value (defaults to "") NAME is an optional Tcl name (defaults to PY_VARnum). If NAME matches an existing variable and VALUE is omitted then the existing value is retained. """ glo... | 14,088 |
def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl. """ global _varnum if not master: master = _default_root self._master = master self._tk = master.tk self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._de... | def __init__(self, master=None): """Construct a variable with an optional MASTER as master widget. The variable is named PY_VAR_number in Tcl. """ global _varnum if not master: master = _default_root self._master = master self._tk = master.tk self._name = 'PY_VAR' + repr(_varnum) _varnum = _varnum + 1 self.set(self._de... | 14,089 |
def __init__(self, master=None): """Construct a string variable. | def __init__(self, master=None, value=None, name=None): """Construct a string variable. | 14,090 |
def __init__(self, master=None): """Construct a string variable. | def __init__(self, master=None): """Construct a string variable. | 14,091 |
def __init__(self, master=None): """Construct an integer variable. | def __init__(self, master=None, value=None, name=None): """Construct an integer variable. | 14,092 |
def __init__(self, master=None): """Construct an integer variable. | def __init__(self, master=None): """Construct an integer variable. | 14,093 |
def __init__(self, master=None): """Construct a float variable. | def __init__(self, master=None, value=None, name=None): """Construct a float variable. | 14,094 |
def __init__(self, master=None): """Construct a float variable. | def __init__(self, master=None): """Construct a float variable. | 14,095 |
def get(self): """Return the value of the variable as a float.""" return getdouble(self._tk.globalgetvar(self._name)) | def get(self): """Return the value of the variable as a float.""" return getdouble(self._tk.globalgetvar(self._name)) | 14,096 |
def __init__(self, master=None): """Construct a boolean variable. | def __init__(self, master=None): """Construct a boolean variable. | 14,097 |
def close(self): if hasattr(self.db, 'close'): self.db.close() self.db = None | def close(self): if hasattr(self.db, 'close'): self.db.close() self.db = None | 14,098 |
def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None): if templatename == None: if hasattr(MacOS, 'runtimemodel'): templatename = 'template-%s'%MacOS.runtimemodel else: templatename = 'template' if os.sep in templatename: templatedir = templatename else: try: packagedir = os.path.split(__file__)[0] exc... | def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None): if templatename == None: if hasattr(MacOS, 'runtimemodel'): templatename = 'template-%s'%MacOS.runtimemodel else: templatename = 'template' if os.sep in templatename: templatedir = templatename else: try: packagedir = os.path.split(__file__)[0] exc... | 14,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.