bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def default_path(self): return self.rexec.modules['sys'].path | def default_path(self): return self.rexec.modules['sys'].path | 12,500 |
def stat(path): """Stat a file, possibly out of the cache.""" if cache.has_key(path): return cache[path] cache[path] = ret = os.stat(path) return ret | def stat(path): """Stat a file, possibly out of the cache.""" ret = cache.get(path, None) if ret is None: cache[path] = ret = _os.stat(path) return ret | 12,501 |
def reset(): """Reset the cache completely.""" global cache cache = {} | def reset(): """Reset the cache completely.""" global cache cache = {} | 12,502 |
def forget(path): """Remove a given item from the cache, if it exists.""" if cache.has_key(path): del cache[path] | def forget(path): """Remove a given item from the cache, if it exists.""" try: del cache[path] | 12,503 |
def forget(path): """Remove a given item from the cache, if it exists.""" if cache.has_key(path): del cache[path] | defexcept KeyError: pass forget(path):except KeyError: pass """Removeexcept KeyError: pass aexcept KeyError: pass givenexcept KeyError: pass itemexcept KeyError: pass fromexcept KeyError: pass theexcept KeyError: pass cache,except KeyError: pass ifexcept KeyError: pass itexcept KeyError: pass exists."""except KeyError:... | 12,504 |
def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" n = len(prefix) for path in cache.keys(): if path[:n] == prefix: del cache[path] | def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" for path in cache.keys(): if path[:n] == prefix: del cache[path] | 12,505 |
def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" n = len(prefix) for path in cache.keys(): if path[:n] == prefix: del cache[path] | def forget_prefix(prefix): """Remove all pathnames with a given prefix.""" n = len(prefix) for path in cache.keys(): if path.startswith(prefix): forget(path) | 12,506 |
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:... | def forget_dir(prefix): """Forget a directory and all entries except for entries in subdirs.""" from os.path import split, join prefix = split(join(prefix, "xxx"))[0] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:] if res... | 12,507 |
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:... | def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:] if rest[-1:] == '/': rest = rest[:-1] if '/' not in rest: d... | 12,508 |
def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path[:n] == prefix: rest = path[n:... | def forget_dir(prefix): """Forget about a directory and all entries in it, but not about entries in subdirectories.""" if prefix[-1:] == '/' and prefix != '/': prefix = prefix[:-1] forget(prefix) if prefix[-1:] != '/': prefix = prefix + '/' n = len(prefix) for path in cache.keys(): if path.startswith(prefix) and spli... | 12,509 |
def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir().""" n = len(prefix) for path in cache.keys(): if path[:n] != prefix: del cache[path] | def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir(). """ for path in cache.keys(): if path[:n] != prefix: del cache[path] | 12,510 |
def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir().""" n = len(prefix) for path in cache.keys(): if path[:n] != prefix: del cache[path] | def forget_except_prefix(prefix): """Remove all pathnames except with a given prefix. Normally used with prefix = '/' after a chdir().""" n = len(prefix) for path in cache.keys(): if not path.startswith(prefix): forget(path) | 12,511 |
def getSubject(self, record): """ Determine the subject for the email. | def getSubject(self, record): """ Determine the subject for the email. | 12,512 |
def emit(self, record): """ Emit a record. | def emit(self, record): """ Emit a record. | 12,513 |
def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _functio... | def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _functio... | 12,514 |
def adaptgetter(name, klass, getter): kind, des = getter if kind == 1: # AV happens when stepping from this line to next if des == "": des = "_%s__%s" % (klass.__name__, name) return lambda obj: getattr(obj, des) | def adaptgetter(name, klass, getter): kind, des = getter if kind == 1: # AV happens when stepping from this line to next if des == "": des = "1" return lambda obj: getattr(obj, des) | 12,515 |
def adaptgetter(name, klass, getter): kind, des = getter if kind == 1: # AV happens when stepping from this line to next if des == "": des = "_%s__%s" % (klass.__name__, name) return lambda obj: getattr(obj, des) | def adaptgetter(name, klass, getter): kind, des = getter if kind == 1: # AV happens when stepping from this line to next if des == "": des = "_%s__%s" % (klass.__name__, name) return lambda obj: getattr(obj, des) | 12,516 |
def _dispatch(self, method, params): if method == 'pow': return apply(pow, params) elif method == 'add': return params[0] + params[1] else: raise 'bad method' | def _dispatch(self, method, params): if method == 'pow': return pow(*params) elif method == 'add': return params[0] + params[1] else: raise 'bad method' | 12,517 |
def _dispatch(self, method, params): if method == 'pow': return apply(pow, params) elif method == 'add': return params[0] + params[1] else: raise 'bad method' | def _dispatch(self, method, params): if method == 'pow': return apply(pow, params) elif method == 'add': return params[0] + params[1] else: raise 'bad method' | 12,518 |
def _dispatch(self, method, params): try: # We are forcing the 'export_' prefix on methods that are # callable through XML-RPC to prevent potential security # problems func = getattr(self, 'export_' + method) except AttributeError: raise Exception('method "%s" is not supported' % method) else: return apply(func, params... | def _dispatch(self, method, params): try: # We are forcing the 'export_' prefix on methods that are # callable through XML-RPC to prevent potential security # problems func = getattr(self, 'export_' + method) except AttributeError: raise Exception('method "%s" is not supported' % method) else: return apply(func, params... | 12,519 |
def export_add(self, x, y): return x + y | def export_add(self, x, y): return x + y | 12,520 |
def export_add(self, x, y): return x + y | defimport types import os def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. """ for i in attr.split('.'): if i.startswith('_'): raise AttributeError( 'at... | 12,521 |
def export_add(self, x, y): return x + y | def export_add(self, x, y): return x + y | 12,522 |
def do_POST(self): """Handles the HTTP POST request. | def do_POST(self): """Handles the HTTP POST request. | 12,523 |
def do_POST(self): """Handles the HTTP POST request. | def do_POST(self): """Handles the HTTP POST request. | 12,524 |
def do_POST(self): """Handles the HTTP POST request. | def do_POST(self): """Handles the HTTP POST request. | 12,525 |
def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" | def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" | 12,526 |
def _resolve_dotted_attribute(obj, attr): """Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. """ for i in attr.split('.'): if i.startswith('_'): raise AttributeError( 'attempt to access private attribute "%s"' % i ) else: obj = getattr(obj,i) ret... | def _resolve_dotted_attribute(obj, attr): """Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. """ for i in attr.split('.'): if i.startswith('_'): raise AttributeError( 'attempt to access private attribute "%s"' % i ) else: obj = getattr(obj,i) ret... | 12,527 |
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.funcs = {} self.logRequests = logRequests self.instance = None SocketServer.TCPServer.__init__(self, addr, requestHandler) | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests self.instance = None SocketServer.TCPServer.__init__(self, addr, requestHandler) | 12,528 |
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.funcs = {} self.logRequests = logRequests self.instance = None SocketServer.TCPServer.__init__(self, addr, requestHandler) | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.funcs = {} self.logRequests = logRequests SimpleXMLRPCDispatcher.__init__(self) SocketServer.TCPServer.__init__(self, addr, requestHandler) | 12,529 |
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.funcs = {} self.logRequests = logRequests self.instance = None SocketServer.TCPServer.__init__(self, addr, requestHandler) | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.funcs = {} self.logRequests = logRequests self.instance = None SocketServer.TCPServer.__init__(self, addr, requestHandler) | 12,530 |
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 ... | 12,531 |
def askopenfilename(**options): "Ask for a filename to open" return apply(Open, (), options).show() | def askopenfilename(**options): "Ask for a filename to open" return Open(**options).show() | 12,532 |
def asksaveasfilename(**options): "Ask for a filename to save as" return apply(SaveAs, (), options).show() | def asksaveasfilename(**options): "Ask for a filename to save as" return SaveAs(**options).show() | 12,533 |
def askopenfile(mode = "r", **options): "Ask for a filename to open, and returned the opened file" filename = apply(Open, (), options).show() if filename: return open(filename, mode) return None | def askopenfile(mode = "r", **options): "Ask for a filename to open, and returned the opened file" filename = Open(**options).show() if filename: return open(filename, mode) return None | 12,534 |
def asksaveasfile(mode = "w", **options): "Ask for a filename to save as, and returned the opened file" filename = apply(SaveAs, (), options).show() if filename: return open(filename, mode) return None | def asksaveasfile(mode = "w", **options): "Ask for a filename to save as, and returned the opened file" filename = SaveAs(**options).show() if filename: return open(filename, mode) return None | 12,535 |
def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden. | def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden. | 12,536 |
def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Technically, only a <mailbox> is allowed. In addition, email addresses without a domain are permitted. Addresses will not be modified if they are already quoted (actually if they begin with '<' and end with '>'.""" if re.match('(?s)\A<... | def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Should be able to handle anything rfc822.parseaddr can handle.""" m=None try: m=rfc822.parseaddr(addr)[1] except AttributeError: pass if not m: return addr localpart = None domain = '' try: at = string.rindex(addr, '@') localpart = ad... | 12,537 |
def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Technically, only a <mailbox> is allowed. In addition, email addresses without a domain are permitted. Addresses will not be modified if they are already quoted (actually if they begin with '<' and end with '>'.""" if re.match('(?s)\A<... | def quoteaddr(addr): """Quote a subset of the email addresses defined by RFC 821. Technically, only a <mailbox> is allowed. In addition, email addresses without a domain are permitted. Addresses will not be modified if they are already quoted (actually if they begin with '<' and end with '>'.""" if re.match('(?s)\A<... | 12,538 |
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n', or Mac '\r' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | 12,539 |
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'(?:\r\n|\n|\r(?!\n))', CRLF, data)) | 12,540 |
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | 12,541 |
def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | def quotedata(data): """Quote data for email. Double leading '.', and change Unix newline '\n' into Internet CRLF end-of-line.""" return re.sub(r'(?m)^\.', '..', re.sub(r'\r?\n', CRLF, data)) | 12,542 |
def verify(self, address): """ SMTP 'verify' command. Checks for address validity. """ self.putcmd("vrfy", address) return self.getreply() | def verify(self, address): """ SMTP 'verify' command. Checks for address validity. """ self.putcmd("vrfy", address) return self.getreply() | 12,543 |
def connect(self, host='localhost', port = 0): """Connect to a host on a given port. | def connect(self, host='localhost', port = 0): """Connect to a host on a given port. | 12,544 |
def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` if self.sock: self.sock.send(str) else: raise SMTPServerDisconnected | def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` if self.sock: try: self.sock.send(str) except socket.error: raise SMTPServerDisconnected else: raise SMTPServerDisconnected | 12,545 |
def getreply(self, linehook=None): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (note : multiline responses converted to a single, mu... | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (note : multiline responses converted to a single, multiline string)... | 12,546 |
def getreply(self, linehook=None): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (note : multiline responses converted to a single, mu... | def getreply(self, linehook=None): """Get a reply from the server. Returns a tuple consisting of: - server response code (e.g. '250', or such, if all goes well) Note: returns -1 if it can't read response code. - server response string corresponding to response code (note : multiline responses converted to a single, mu... | 12,547 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply(self.ehlo_hook) self.ehlo_resp=msg return code | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply(self.ehlo_hook) self.ehlo_resp=msg return code | 12,548 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply(self.ehlo_hook) self.ehlo_resp=msg return code | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() if code == -1 and len(msg) == 0: raise SMTPSer... | 12,549 |
def ehlo_hook(self, line): # Interpret EHLO response lines if line[4] in string.uppercase+string.digits: self.esmtp_features.append(string.lower(string.strip(line)[4:])) | def ehlo_hook(self, line): # Interpret EHLO response lines if line[4] in string.uppercase+string.digits: self.esmtp_features.append(string.lower(string.strip(line)[4:])) | 12,550 |
def mail(self,sender,options=[]): """ SMTP 'mail' command. Begins mail xfer session. """ if options: options = " " + string.joinfields(options, ' ') else: options = '' self.putcmd("mail", "from:" + quoteaddr(sender) + options) return self.getreply() | def mail(self,sender,options=[]): """ SMTP 'mail' command. Begins mail xfer session. """ optionlist = '' if options and self.does_esmtp: optionlist = string.join(options, ' ') self.putcmd("mail", "FROM:%s %s" % (quoteaddr(sender) ,optionlist)) return self.getreply() | 12,551 |
def rcpt(self,recip): """ SMTP 'rcpt' command. Indicates 1 recipient for this mail. """ self.putcmd("rcpt","to:%s" % quoteaddr(recip)) return self.getreply() | def rcpt(self,recip,options=[]): """ SMTP 'rcpt' command. Indicates 1 recipient for this mail. """ self.putcmd("rcpt","to:%s" % quoteaddr(recip)) return self.getreply() | 12,552 |
def rcpt(self,recip): """ SMTP 'rcpt' command. Indicates 1 recipient for this mail. """ self.putcmd("rcpt","to:%s" % quoteaddr(recip)) return self.getreply() | def rcpt(self,recip): """ SMTP 'rcpt' command. Indicates 1 recipient for this mail. """ optionlist = '' if options and self.does_esmtp: optionlist = string.join(options, ' ') self.putcmd("rcpt","TO:%s %s" % (quoteaddr(recip),optionlist)) return self.getreply() | 12,553 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,mail_options=[],rcpt_options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as... | 12,554 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | 12,555 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | 12,556 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | 12,557 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | 12,558 |
def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | def sendmail(self,from_addr,to_addrs,msg,options=[]): """ This command performs an entire mail transaction. The arguments are: - from_addr : The address sending this mail. - to_addrs : a list of addresses to send this mail to - msg : the message to send. - encoding : list of ESMTP options (such as 8bitmime) | 12,559 |
def makedirs(name, mode=0777): """makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. This is recursive. """ head, tail = path.split(name) if not tail: h... | def makedirs(name, mode=0777): """makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. This is recursive. """ head, tail = path.split(name) if not tail: h... | 12,560 |
def _execvpe(file, args, env=None): from errno import ENOENT, ENOTDIR if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: func(file, *argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath PATH = env... | def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: func(file, *argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath PATH = envpath.split(pathsep) saved_exc = Non... | 12,561 |
def rm(fn): try: os.unlink(fn) except os.error: pass | def rm(fn): try: os.unlink(fn) except os.error: pass | 12,562 |
def StartElementHandler(self, name, attrs): | def StartElementHandler(self, name, attrs): | 12,563 |
def EndElementHandler(self, name): | def EndElementHandler(self, name): | 12,564 |
def ProcessingInstructionHandler(self, target, data): | def ProcessingInstructionHandler(self, target, data): | 12,565 |
def StartNamespaceDeclHandler(self, prefix, uri): | def StartNamespaceDeclHandler(self, prefix, uri): | 12,566 |
def EndNamespaceDeclHandler(self, prefix): | def EndNamespaceDeclHandler(self, prefix): | 12,567 |
def StartCdataSectionHandler(self): | def StartCdataSectionHandler(self): | 12,568 |
def EndCdataSectionHandler(self): | def EndCdataSectionHandler(self): | 12,569 |
def CommentHandler(self, text): | def CommentHandler(self, text): | 12,570 |
def NotationDeclHandler(self, *args): name, base, sysid, pubid = args | def NotationDeclHandler(self, *args): name, base, sysid, pubid = args | 12,571 |
def DefaultHandlerExpand(self, userData): pass | def DefaultHandlerExpand(self, userData): pass | 12,572 |
def DefaultHandlerExpand(self, userData): pass | def DefaultHandlerExpand(self, userData): pass | 12,573 |
def AskYesNoCancel(question, default = 0, yes=None, no=None, cancel=None, id=262): """Display a QUESTION string which can be answered with Yes or No. Return 1 when the user clicks the Yes button. Return 0 when the user clicks the No button. Return -1 when the user clicks the Cancel button. When the user presses Retur... | defkControlProgressBarIndeterminateTag = 'inde' AskYesNoCancel(question,kControlProgressBarIndeterminateTag = 'inde' defaultkControlProgressBarIndeterminateTag = 'inde' =kControlProgressBarIndeterminateTag = 'inde' 0,kControlProgressBarIndeterminateTag = 'inde' yes=None,kControlProgressBarIndeterminateTag = '... | 12,574 |
def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | def __init__(self, title="Working...", maxval=0, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | 12,575 |
def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | 12,576 |
def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self.title(title) self.set(0, maxval) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() se... | 12,577 |
def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.title(title) self.w.ShowWindow() self.d.DrawDialog() | def __init__(self, title="Working...", maxval=100, label="", id=263): self.w = None self.d = None self.maxval = maxval self.curval = -1 self.d = GetNewDialog(id, -1) self.w = self.d.GetDialogWindow() self.label(label) self._update(0) self.d.AutoSizeDialog() self.w.ShowWindow() self.d.DrawDialog() | 12,578 |
def label( self, *newstr ): """label(text) - Set text in progress box""" self.w.BringToFront() if newstr: self._label = lf2cr(newstr[0]) text_h = self.d.GetDialogItemAsControl(2) SetDialogItemText(text_h, self._label) | def label( self, *newstr ): """label(text) - Set text in progress box""" self.w.BringToFront() if newstr: self._label = lf2cr(newstr[0]) text_h = self.d.GetDialogItemAsControl(2) SetDialogItemText(text_h, self._label) | 12,579 |
def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(val... | def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(val... | 12,580 |
def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(val... | def_update(self,value):maxval=self.maxvalifmaxval==0:#XXXXQuickfix.Shouldprobablydisplayanunknowndurationvalue=0maxval=1ifmaxval>32767:value=int(value/(maxval/32767.0))maxval=32767progbar=self.d.GetDialogItemAsControl(3)progbar.SetControlMaximum(maxval)progbar.SetControlValue(value)#Testforcancelbuttonready,ev=Evt.Wait... | 12,581 |
def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(val... | def _update(self, value): maxval = self.maxval if maxval == 0: # XXXX Quick fix. Should probably display an unknown duration value = 0 maxval = 1 if maxval > 32767: value = int(value/(maxval/32767.0)) maxval = 32767 progbar = self.d.GetDialogItemAsControl(3) progbar.SetControlMaximum(maxval) progbar.SetControlValue(val... | 12,582 |
def set(self, value, max=None): """set(value) - Set progress bar position""" if max != None: self.maxval = max if value < 0: value = 0 if value > self.maxval: value = self.maxval self.curval = value self._update(value) | def set(self, value, max=None): """set(value) - Set progress bar position""" if max != None: self.maxval = max bar = self.d.GetDialogItemAsControl(3) if max <= 0: bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x01') else: bar.SetControlData(0,kControlProgressBarIndeterminateTag,'\x00') if value < 0: value =... | 12,583 |
def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | 12,584 |
def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | 12,585 |
def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | 12,586 |
def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | 12,587 |
def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | def test(): import time, sys Message("Testing EasyDialogs.") optionlist = (('v', 'Verbose'), ('verbose', 'Verbose as long option'), ('flags=', 'Valued option'), ('f:', 'Short valued option')) commandlist = (('start', 'Start something'), ('stop', 'Stop something')) argv = GetArgv(optionlist=optionlist, commandlist=comm... | 12,588 |
def finalize_unix (self): | def finalize_unix (self): | 12,589 |
def handle_extra_path (self): | def handle_extra_path (self): | 12,590 |
def run (self): | def run (self): | 12,591 |
def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) # Add the contents of cmd.get_outputs(), ensuring # that outputs doesn't contain duplicate entri... | def get_outputs (self): # This command doesn't have any outputs of its own, so just # get the outputs of all its sub-commands. outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) # Add the contents of cmd.get_outputs(), ensuring # that outputs doesn't contain duplicate entri... | 12,592 |
def jpeggrey2grey(img, width, height): import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 1: raise RuntimeError, 'not grayscale jpeg' return data | def jpeggrey2grey(img, width, height): import jpeg data, width, height, bytesperpixel = jpeg.decompress(img) if bytesperpixel <> 1: raise RuntimeError, 'not grayscale jpeg' return data | 12,593 |
def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(img) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | 12,594 |
def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | 12,595 |
def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | def jpeg2rgb(img, width, height): import cl, CL import jpeg data, width, height, bytesperpixel = jpeg.decompress(data) if bytesperpixel <> 4: raise RuntimeError, 'not rgb jpeg' return data | 12,596 |
def constant_red_generator(numchips, rgbtuple): red = rgbtuple[0] seq = constant(numchips) return map(None, [red] * numchips, seq, seq) | def constant_cyan_generator(numchips, rgbtuple): red, green, blue = rgbtuple seq = constant(numchips) return map(None, [red] * numchips, seq, seq) | 12,597 |
def constant_red_generator(numchips, rgbtuple): red = rgbtuple[0] seq = constant(numchips) return map(None, [red] * numchips, seq, seq) | def constant_red_generator(numchips, rgbtuple): red = rgbtuple[0] seq = constant(numchips) return map(None, seq, [green] * numchips, [blue] * numchips) | 12,598 |
def constant_green_generator(numchips, rgbtuple): green = rgbtuple[1] seq = constant(numchips) return map(None, seq, [green] * numchips, seq) | def constant_magenta_generator(numchips, rgbtuple): red, green, blue = rgbtuple seq = constant(numchips) return map(None, seq, [green] * numchips, seq) | 12,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.