bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def run(self): print "Compiling data for project %s, from version %s to %s" % (self.project.name, self.startRevision, self.endRevision) print "Directories to be ignored: ", for i in self.project.tagXfile["VendorCode"]: print i, print "" | def run(self): print "Compiling data for project %s, from version %s to %s" % (self.project.name, self.startRevision, self.endRevision) print "Directories to be ignored: ", for i in self.project.tagXfile["VendorCode"]: print i, print "" | 30,700 |
def setRepository(self, repository): self.repository(repository) | def setRepository(self, repository): self.repository(repository) | 30,701 |
def collectMetrics(self): metrics = MetricsCollector(self) metrics.run() print "\n\nData is available at %" % (metrics.workDir) | def collectMetrics(self): metrics = MetricsCollector(self) metrics.run() print "\n\nData is available at %" % (metrics.workDir) | 30,702 |
def setup(self): # setup new config parser and parse config self.config = SafeConfigParser() self.config.read(self.config_filename) # accuracy is really the timeout before it gives up and waits for the next time period self.accuracy = 3 # get details from config file self.cameraname = self.config.get("camera","name") s... | def setup(self): # setup new config parser and parse config self.config = SafeConfigParser() self.config.read(self.config_filename) # accuracy is really the timeout before it gives up and waits for the next time period self.accuracy = 3 # get details from config file self.cameraname = self.config.get("camera","name") s... | 30,703 |
def run(self): # set the next capture time to now just because self.next_capture = datetime.datetime.now() # this is to test and see if the config has been modified self.last_config_modify_time = None while (True): # testing for the config modification if os.stat(self.config_filename).st_mtime!=self.last_config_modify_... | def run(self): # set the next capture time to now just because self.next_capture = datetime.datetime.now() # this is to test and see if the config has been modified self.last_config_modify_time = None while (True): # testing for the config modification if os.stat(self.config_filename).st_mtime!=self.last_config_modify_... | 30,704 |
def detect_cameras(type): try: a = subprocess.check_output("gphoto2 --auto-detect", shell=True) cams = {} for port in re.finditer("usb:", a): cmdret = subprocess.check_output('gphoto2 --port "'+a[port.start():port.end()+7]+'" --get-config serialnumber', shell=True) cams[a[port.start():port.end()+7]] = cmdret[cmdret.fin... | def detect_cameras(type): try: a = subprocess.check_output("gphoto2 --auto-detect", shell=True) cams = {} for port in re.finditer("usb:", a): cmdret = subprocess.check_output('gphoto2 --port "'+a[port.start():port.end()+7]+'" --get-config serialnumber', shell=True) cams[a[port.start():port.end()+7]] = cmdret[cmdret.fin... | 30,705 |
def getBilds(self): self.mainViewModel.clear() self.bilds=[] for k, item in self.Backend.listBilder({}).iteritems(): self.bilds.append(item) tmp = gtk.gdk.PixbufLoader() bildbin = item.getBildBin() if bildbin != None: tmp.write(bildbin) pbuf = tmp.get_pixbuf().scale_simple(100, 100 ,gtk.gdk.INTERP_NEAREST) self.mainVie... | def getBilds(self): try: self.mainViewModel.clear() self.bilds=[] for k, item in self.Backend.listBilder({}).iteritems(): self.bilds.append(item) tmp = gtk.gdk.PixbufLoader() bildbin = item.getBildBin() if bildbin != None: tmp.write(bildbin) pbuf = tmp.get_pixbuf().scale_simple(100, 100 ,gtk.gdk.INTERP_NEAREST) self.ma... | 30,706 |
def getBilds(self): self.mainViewModel.clear() self.bilds=[] for k, item in self.Backend.listBilder({}).iteritems(): self.bilds.append(item) tmp = gtk.gdk.PixbufLoader() bildbin = item.getBildBin() if bildbin != None: tmp.write(bildbin) pbuf = tmp.get_pixbuf().scale_simple(100, 100 ,gtk.gdk.INTERP_NEAREST) self.mainVie... | def getBilds(self): self.mainViewModel.clear() self.bilds=[] for k, item in self.Backend.listBilder({}).iteritems(): self.bilds.append(item) tmp = gtk.gdk.PixbufLoader() bildbin = item.getBildBin() if bildbin != None: tmp.write(bildbin) pbuf = tmp.get_pixbuf().scale_simple(100, 100 ,gtk.gdk.INTERP_NEAREST) self.mainVie... | 30,707 |
def __init__(self, pPath): self.pPath = pPath self.Data = pickle.load(self.pPath) | def __init__(self, pPath): self.pPath = pPath self.Data = pickle.load(self.pPath) | 30,708 |
def replace_link(match): flags = sets.Set(["loose", "check-neighboring-spaces"]) path = match.group(1)[1:-1].split('][') url = lookup(path, namespace_url, flags) if type(url) != type("string"): return '<font color="red">%s</a>' % url img = False for extension in image_extensions: if url.endswith(extension): img = True ... | def replace_link(match): flags = sets.Set(["loose", "check-neighboring-spaces"]) path = match.group(1)[1:-1].split('][') url = lookup(path, namespace_url, flags) if type(url) not in [type("string"), type(u'unicode')]: return '<font color="red">%s</a>' % url img = False for extension in image_extensions: if url.endswith... | 30,709 |
def f_uliAlias(m, origin, (cmd, channel), text, p=p): if debug: p.msg(origin.sender, 'alias accepted') command_word, name, target = text.split(None) junk, form_name = command_word.split("-", 1) aliaslist[name] = (uli.forms_by_name[form_name], target) save() | def f_uliAlias(m, origin, (cmd, channel), text, p=p): if debug: p.msg(origin.sender, 'alias accepted') name, form_name, target = m.group(1), m.group(2), m.group(3) form_func = uli.forms_by_name[form_name] aliaslist[name] = (form_func, target) save() | 30,710 |
def f_uliAlias(m, origin, (cmd, channel), text, p=p): if debug: p.msg(origin.sender, 'alias accepted') command_word, name, target = text.split(None) junk, form_name = command_word.split("-", 1) aliaslist[name] = (uli.forms_by_name[form_name], target) save() | def f_uliAlias(m, origin, (cmd, channel), text, p=p): if debug: p.msg(origin.sender, 'alias accepted') command_word, name, target = text.split(None) junk, form_name = command_word.split("-", 1) aliaslist[name] = (uli.forms_by_name[form_name], target) save() | 30,711 |
def f_uliListAliases(m,origin, (cmd, channel), text, p=p): p.msg(origin.sender, "the current list of bindings:") for binding in aliaslist: p.msg(origin.sender, "Alias: %s Function: %s Url: %s" % (binding,uli.form_names[aliaslist[binding][0]], aliaslist[binding][1]) ) | def f_uliListAliases(m,origin, (cmd, channel), text, p=p): p.msg(origin.sender, "the current list of bindings:") for binding in aliaslist: p.msg(origin.sender, "Alias: %s Function: %s Url: %s" % (binding,uli.form_names[aliaslist[binding][0]], aliaslist[binding][1]) ) | 30,712 |
def f_uliAliasCommand(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(None,1) alias = allsplitup[0] if aliaslist.has_key(alias): if debug: p.msg(origin.sender, "interpreting %s as an alias." "sending %s as command..." % (alias, allsplitup[1])) f_uliCommand(alias, allsplitup[1], origin) | def f_uliAliasCommand(m, origin, (cmd, channel), text, p=p): alias = m.group(1) if aliaslist.has_key(alias): if debug: p.msg(origin.sender, "interpreting %s as an alias." "sending %s as command..." % (alias, allsplitup[1])) f_uliCommand(alias, allsplitup[1], origin) | 30,713 |
def f_uliAliasCommand(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(None,1) alias = allsplitup[0] if aliaslist.has_key(alias): if debug: p.msg(origin.sender, "interpreting %s as an alias." "sending %s as command..." % (alias, allsplitup[1])) f_uliCommand(alias, allsplitup[1], origin) | def f_uliAliasCommand(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(None,1) alias = allsplitup[0] if aliaslist.has_key(alias): if debug: p.msg(origin.sender, "interpreting %s as an alias." "sending %s as command..." % (alias, allsplitup[1])) f_uliCommand(alias, allsplitup[1], origin) | 30,714 |
def f_uliCommand(alias, command, origin): response = aliaslist[alias][0]( aliaslist[alias][1] , command ) for line in response.splitlines(): listoflines = f_chop_by_length( line , 80 ) for littleline in listoflines: p.msg(origin.sender, littleline ) | def f_uliCommand(alias, command, origin): response = aliaslist[alias][0]( aliaslist[alias][1] , command ) for line in response.splitlines(): listoflines = f_chop_by_length( line , 400 ) for littleline in listoflines: p.msg(origin.sender, littleline ) | 30,715 |
def f_uliBotHelp(m, origin, (cmd, channel), text, p=p): p.msg(origin.sender, "Commands I understand:") p.msg(origin.sender, "uli-list-aliases, uli-<form> <alias> <url>, " "<existing-alias> <command-string>, help %s, " "debug toggle %s, remove alias <alias>" % (p.nick,p.nick)) | def f_uliBotHelp(m, origin, (cmd, channel), text, p=p): p.msg(origin.sender, "Commands I understand:") p.msg(origin.sender, "uli-list-aliases, uli-<form> <alias> <url>, " "<existing-alias> <command-string>, help %s, " "debug toggle %s, remove alias <alias>" % (p.nick,p.nick)) | 30,716 |
def f_uliBotDebugMode(m, origin, (cmd, channel), text, p=p): global debug debug = not debug | def f_uliBotDebugMode(m, origin, (cmd, channel), text, p=p): global debug debug = not debug | 30,717 |
def f_uliRemoveAlias(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(" ") alias = allsplitup[2] if aliaslist.has_key(alias): del aliaslist[alias] | def f_uliRemoveAlias(m, origin, (cmd, channel), text, p=p): alias = m.group(1) if aliaslist.has_key(alias): del aliaslist[alias] | 30,718 |
def f_uliRemoveAlias(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(" ") alias = allsplitup[2] if aliaslist.has_key(alias): del aliaslist[alias] | def f_uliRemoveAlias(m, origin, (cmd, channel), text, p=p): allsplitup = text.split(" ") alias = allsplitup[2] if aliaslist.has_key(alias): del aliaslist[alias] | 30,719 |
def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | 30,720 |
def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | 30,721 |
def _match(s, load, pattern): op = pattern[0].upper() if op == "ALL": return True elif op == "NOT": return not s._match(load, pattern[1]) elif op == "AND": return _custom_reduce(lambda x, y: x and y, pattern[1:], False, load) elif op == "OR": return _custom_reduce(lambda x, y: x or y, pattern[1:], True, load) elif op =... | def _match(s, load, pattern): op = pattern[0].upper() if op == "ALL": return True elif op == "NOT": return not s._match(load, pattern[1]) elif op == "AND": return _custom_reduce(lambda x, y: x and y, pattern[1:], False, load) elif op == "OR": return _custom_reduce(lambda x, y: x or y, pattern[1:], True, load) elif op =... | 30,722 |
def _match(s, load, pattern): op = pattern[0].upper() if op == "ALL": return True elif op == "NOT": return not s._match(load, pattern[1]) elif op == "AND": return _custom_reduce(lambda x, y: x and y, pattern[1:], False, load) elif op == "OR": return _custom_reduce(lambda x, y: x or y, pattern[1:], True, load) elif op =... | def _match(s, load, pattern): op = pattern[0].upper() if op == "ALL": return True elif op == "NOT": return not s._match(load, pattern[1]) elif op == "AND": return _custom_reduce(lambda x, y: x and y, pattern[1:], False, load) elif op == "OR": return _custom_reduce(lambda x, y: x or y, pattern[1:], True, load) elif op =... | 30,723 |
def _ding(s, client_info, Cpw, load): xmlrpc_url = client_info.get( "CLIENT-XMLRPC", None ) if xmlrpc_url: try: server=xmlrpclib.ServerProxy( xmlrpc_url ) print time.asctime(),"-- notify %s" % xmlrpc_url server.notify( load, Cpw ) return True # success except httplib.socket.error: pass except xmlrpclib.Fault, f: pass p... | def _ding(s, client_info, Cpw, load): xmlrpc_url = client_info.get( "CLIENT-XMLRPC", None ) if xmlrpc_url: try: server=xmlrpclib.ServerProxy( xmlrpc_url ) print time.asctime(),"-- notify %s" % xmlrpc_url server.notify( s._stripped_copy(load), Cpw ) return True # success except httplib.socket.error: pass except xmlrpcli... | 30,724 |
def _stampload(s,load): """ Timestamp a load, with whatever value we like. (Reserved for server use.) """ load["RECEIVED-TIME"] = time.time() | def _stampload(s,load): """ Timestamp a load, with whatever value we like. (Reserved for server use.) """ load["RECEIVED-TIME"] = time.time() | 30,725 |
def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | def get_logs( s, ptrn ): """ The server is not obligated to keep logs for any set period of time. | 30,726 |
def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | 30,727 |
def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | 30,728 |
def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | def get_logs( s, pattern ): """ The server is not obligated to keep logs for any set period of time. | 30,729 |
def link_names_in_fragment(xhtml_fragment, collected_names): """Link Local Names found in XHTML fragment. collected_names can be a dictionary or a CollectedNames instance. The fragment must contain no errors. This is a convenience function. It's also something of a hack. If anyone knows the proper solution, I'd lov... | def link_names_in_fragment(xhtml_fragment, collected_names): """Link Local Names found in XHTML fragment. collected_names can be a dictionary or a CollectedNames instance. The fragment must contain no errors. This is a convenience function. It's also something of a hack. If anyone knows the proper solution, I'd lov... | 30,730 |
def edit_key( space_name ): import code_info return "index.cgi?%s=%s&%s=%s" % ( code_info.PAGE_KEY, code_info.PAGE_EDITNAMES, code_info.SPACE_KEY, space_name ) | def edit_key( space_name ): import code_info return "index.cgi?%s=%s&%s=%s" % ( code_info.PAGE_KEY, code_info.PAGE_EDITNAMES, code_info.SPACE_KEY, space_name.upper() ) | 30,731 |
def description_key( space_name ): import code_info return "index.cgi?%s=%s&%s=%s" % ( code_info.PAGE_KEY, code_info.PAGE_DESCRIPTION, code_info.SPACE_KEY, space_name ) | def description_key( space_name ): import code_info return "index.cgi?%s=%s&%s=%s" % ( code_info.PAGE_KEY, code_info.PAGE_DESCRIPTION, code_info.SPACE_KEY, space_name.upper() ) | 30,732 |
def tell_dump(s, space_name): import conf uli_xmlrpc( XMLRPC_LN_SERVER, "dump-cache %s" % (conf.URL_DOMAIN_NAME+conf.URL_DIRECTORY_BASE+description_key( space_name )) ) | def tell_dump(s, space_name): import conf uli_xmlrpc( XMLRPC_LN_SERVER, "dump-cache %s" % (conf.URL_DOMAIN_NAME+conf.URL_DIRECTORY_BASE+description_key( space_name )) ) | 30,733 |
def xmlrpc_filterData(self, data, contentType, params): data = data.decode("utf-8", "replace") url = params["namespace"] return (localnames.replace_text(data, url), contentType) | def xmlrpc_filterData(self, data, contentType, params): data = data.decode("utf-8", "replace") url = params["namespace"] return (localnames.replace_text(data, url), contentType) | 30,734 |
def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | 30,735 |
def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | def lookup_tuple( s, tup ): """ (1) Follows connections chain. (2) Looks for name, and checks 1 level into defaults, too. (3) Returns against last connection's pattern, if nothing found. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is t... | 30,736 |
def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | 30,737 |
def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | 30,738 |
def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | def lookup_tuple( s, tup ): """ Goes 1 level deep into defaults, match's against 0 depths pattern if nothing found, returns None if there is no 0 depth pattern. Doesn't check defaults on Connections. returns URL or None tup: tuple where first items are connection names, and last item is the name of an item """ space... | 30,739 |
def xmlrpc_filterData(self, data, contentType, params): data = data.decode("utf-8", "replace") url = params["namespace"] return ({"data": xmlrpclib.Binary(localnames.replace_text(data.encode("utf-8"), url)), "contentType": contentType}) | def xmlrpc_filterData(self, data, contentType, params): data = data.decode("utf-8", "replace") url = params["namespace"] return ({"data": xmlrpclib.Binary(localnames.replace_text(data, url).encode("utf-8")), "contentType": contentType}) | 30,740 |
def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | 30,741 |
def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | 30,742 |
def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | def do_GET(self): if self.path.startswith("/?"): args = cgi.parse_qs( self.path[2:] ) else: args = {} | 30,743 |
def get_namespaces(s, username, pw): """Return list of namespaces.""" if not s.userlist.has_key(username): return UserDoesntExistError elif s.userlist[username]['_password'] != pw: return IncorrectPasswordError else: namespace_list = "" for user in s.userlist: for namespace in user: namespace_list = namespace_list + na... | def get_namespaces(s, username, pw): """Return list of namespaces.""" if not s.userlist.has_key(username): return UserDoesntExistError elif s.userlist[username]['_password'] != pw: return IncorrectPasswordError else: namespace_list = "" for user in s.userlist.keys(): for namespace in s.userlist[user].keys(): if not nam... | 30,744 |
def save_namespace(s, email, namespace_name): """ Create a LocalNames description and pop it into a file """ f = open(WEB_DIR + email + "-" + namespace_name, 'w') f.write("X VERSION 1.1\n") for entry in s.userlist[email][namespace_name]: f.write(entry[0] + " " + entry[1] + " " + entry[2] + "\n") f.close() | def save_namespace(s, email, namespace_name): """ Create a LocalNames description and pop it into a file """ f = open(WEB_DIR + email + "-" + namespace_name, 'w') f.write("X VERSION 1.1\n") for entry in s.userlist[email][namespace_name]: f.write(entry[0] + " \"" + entry[1] + "\" \"" + entry[2] + "\"\n") f.close() | 30,745 |
def unset(s, email, pw, namespace_name, entry_type, key, value): """ Unsets key, value, entry_type in namespace_name email: email address of user (string) pw: password of user (string) namespace_name: name of namespace to unset the entry in entry_type: type of entry (NS, X, LN, PATTERN) """ if not s.userlist.has_key... | def unset(s, email, pw, namespace_name, entry_type, key, value): """ Unsets key, value, entry_type in namespace_name email: email address of user (string) pw: password of user (string) namespace_name: name of namespace to unset the entry in entry_type: type of entry (NS, X, LN, PATTERN) """ if not s.userlist.has_key... | 30,746 |
def notify(s, load) xmlrpclib.ServerProxy(s.URL).notify(load, s.pw) | def notify(s, load): xmlrpclib.ServerProxy(s.URL).notify(load, s.pw) | 30,747 |
def tell_dump(s, space_name): uli_xmlrpc( XMLRPC_NAMESERVER, "dump-cache %s" % description_key( space_name ) ) | def tell_dump(s, space_name): uli_xmlrpc( XMLRPC_NAMESERVER, "dump-cache %s" % description_key( space_name ) ) | 30,748 |
def has_password( s, space_name ): try: return s.spaces[ space_name ][ "password" ] != None except KeyError: return False | def has_password( s, space_name ): if not s.spaces.has_key( space_name ): return False if s.spaces[ space_name ].has_key( "password" ): return s.spaces[ space_name ][ "password" ] != None except KeyError: return False | 30,749 |
def has_password( s, space_name ): try: return s.spaces[ space_name ][ "password" ] != None except KeyError: return False | def has_password( s, space_name ): try: return s.spaces[ space_name ][ "password" ] != None else: return False | 30,750 |
def seal_texts(): if len(texts) == 0: return [] contents = "".join([x[1][0] for x in texts]) first_pos = texts[0][2] last_pos = texts[-1][3] result.append(("PARAGRAPH", contents, first_pos, last_pos)) return [] | def seal_texts(): if len(texts) == 0: return [] contents = " ".join([x[1][0] for x in texts]) first_pos = texts[0][2] last_pos = texts[-1][3] result.append(("PARAGRAPH", contents, first_pos, last_pos)) return [] | 30,751 |
def main(): usage = "usage: %prog [options] url" parser = optparse.OptionParser(usage) parser.add_option("-n", "--namespace", dest="namespace", help="function namespace to use") parser.add_option("-e", "--encoding", dest="encoding", default=default_encoding, help='encoding to report [default: "%s"]' % default_encoding)... | def main(): usage = "usage: %prog [options] url" parser = optparse.OptionParser(usage) parser.add_option("-n", "--namespace", dest="namespace", help="function namespace to use") parser.add_option("-e", "--encoding", dest="encoding", default=default_encoding, help='encoding to report [default: "%s"]' % default_encoding)... | 30,752 |
def main(): usage = "usage: %prog [options] url" parser = optparse.OptionParser(usage) parser.add_option("-n", "--namespace", dest="namespace", help="function namespace to use") parser.add_option("-e", "--encoding", dest="encoding", default=default_encoding, help='encoding to report [default: "%s"]' % default_encoding)... | def main(): usage = "usage: %prog [options] url" parser = optparse.OptionParser(usage) parser.add_option("-n", "--namespace", dest="namespace", help="function namespace to use") parser.add_option("-e", "--encoding", dest="encoding", default=default_encoding, help='encoding to report [default: "%s"]' % default_encoding)... | 30,753 |
def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | def"suppress-final": don't use "X FINAL" lookup(path,"suppress-final": don't use "X FINAL" url,"suppress-final": don't use "X FINAL" flags):"suppress-final": don't use "X FINAL" """"suppress-final": don't use "X FINAL" Resolve"suppress-final": don't use "X FINAL" a"suppress-final": don't use "X FINAL" path"suppr... | 30,754 |
def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | 30,755 |
def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | def lookup(path, url, flags): """ Resolve a path to a URL. Returns the resolved URL. path: ["space", "space", ..., "name"] url: "http://url.to.first.namespace.description/" flags: Python 2.3 Set of flags The following flags are understood: "no-case": ignore capitalization "no-punctuation": ignore punctuation "no-... | 30,756 |
def collect_names_in_fragment(xhtml_fragment): """Build a list of names to lookup, given an XHTML fragment. This is a convenience function. The fragment must contain no errors. """ return collect_names('<html>' + xhtml_fragment + '</xhtml>') | def collect_names_in_fragment(xhtml_fragment): """Build a list of names to lookup, given an XHTML fragment. This is a convenience function. The fragment must contain no errors. """ return collect_names('<html>' + xhtml_fragment + '</html>') | 30,757 |
def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | 30,758 |
def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | def xmlrpc_render(self, format, url): if type(url) == type([]): ns = localnames.aggregate(url) else: ns = localnames.get_namespace(url) if format in ["XML-RPC", "XML-RPC-text"]: ns2 = {} for k in ["LN", "X", "NS", "PATTERN"]: ns2[k] = un_unicode_dict(ns[k]) if format == "XML-RPC": return ns2 else: return xmlrpclib.dump... | 30,759 |
def xmlrpc_cached(self): results = [] for url, ns in localnames.store.items(): preferred_name = ns["X"].get("PREFERRED-NAME", [None])[0] ttl = int(ns["TIME"] + localnames.time_to_live - time.time()) results.append((url, preferred_name, ttl)) return results | def xmlrpc_cached(self): results = [] for url, ns in localnames.store.items(): preferred_name = ns["X"].get("PREFERRED-NAME", ["(none)"])[0] ttl = int(ns["TIME"] + localnames.time_to_live - time.time()) results.append((url, preferred_name, ttl)) return results | 30,760 |
def parse_column(cursor, line, parsed, col_num): mo=column_re.match(line[cursor:]) if mo == None: raise LocalNamesSyntaxError("poorly formatted column #%d" % col_num) text=mo.group(1) if text[0] == u'"': text = text[1:-1] parsed.append(text) return cursor+mo.end() | def parse_column(cursor, line, parsed, col_num): mo=column_re.match(line[cursor:]) if mo == None: raise LocalNamesSyntaxError("poorly formatted column #%d" % col_num) text=mo.group(1) if text[0] == u'"': text = text[1:-1] parsed.append(text) return cursor+mo.end() | 30,761 |
def replace_text(text, namespace_url, softlink_base=""): """ Replace links denoted by [[foo]] with A HREFs. text: text to make replacements in namespace_url: URL of namespace to start from softlink_base: URL base to softlink from Examples: [[some name]] [[NS link][NS link][LN name]] [[some name]some other text cov... | def replace_text(text, namespace_url, softlink_base=""): """ Replace links denoted by [[foo]] with A HREFs. text: text to make replacements in namespace_url: URL of namespace to start from softlink_base: URL base to softlink from Examples: [[some name]] [[NS link][NS link][LN name]] [[some name]some other text cov... | 30,762 |
def replace_softlink(match): flags = sets.Set(["loose", "check-neighboring-spaces"]) path = match.group(1)[1:-1].split(')(') map = {'action': 'redir', 'url': namespace_url, 'lookup': path} url = softlink_base + "?" + urllib.urlencode(map, True) title = match.group(2) if title == None: title = path[-1] return '<a href="... | def replace_softlink(match): flags = sets.Set(["loose", "check-neighboring-spaces"]) path = match.group(1)[1:-1].split(')(') map = {'action': 'redirect', 'url': namespace_url, 'lookup': path} url = softlink_base + "?" + urllib.urlencode(map, True) title = match.group(2) if title == None: title = path[-1] return '<a hre... | 30,763 |
def default_for_name(s, name): """ returns a name, made to fit the default page pattern """ if s.pattern == None: return None return s.pattern.replace( "$PAGE", name ) | def default_for_name(s, name): """ returns a name, made to fit the default page pattern """ if s.pattern == None: return None return s.pattern.replace( "$PAGE", name ) | 30,764 |
def meta(self, key, value): pass | def meta(self, key, value): pass | 30,765 |
def dump_cache(self, url): """DOC | def dump_cache(self, url): """DOC | 30,766 |
def _connect (self): self._set_state (CONNECTING) waitfor = self._waitfor connection = pexpect.spawn ('nxssh -nx -p %d -i %s nx@%s -2 -S' % \ (self.port, self.sshkey, self.host)) self.connection = connection connection.setlog (self.log) | def _connect (self): self._set_state (CONNECTING) waitfor = self._waitfor connection = pexpect.spawn ('nxssh -nx -p %d -i %s nx@%s -2 -S' % \ (self.port, self.sshkey, self.host)) self.connection = connection connection.setlog (self.log) | 30,767 |
def _connect (self): self._set_state (CONNECTING) waitfor = self._waitfor connection = pexpect.spawn ('nxssh -nx -p %d -i %s nx@%s -2 -S' % \ (self.port, self.sshkey, self.host)) self.connection = connection connection.setlog (self.log) | def _connect (self): self._set_state (CONNECTING) waitfor = self._waitfor connection = pexpect.spawn ('nxssh -nx -p %d -i %s nx@%s -2 -S' % \ (self.port, self.sshkey, self.host)) self.connection = connection connection.setlog (self.log) | 30,768 |
def vertex_reference(n, nv): if (n < 0): return n + nv return n - 1 | def vertex_reference(n, nv): if (n < 0): return n + nv return n - 1 | 30,769 |
def vertex_reference(n, nv): if (n < 0): return n + nv return n - 1 | def vertex_reference(n, nv): if (n < 0): return n + nv return n - 1 | 30,770 |
def __init__(self, codecMap): self.__codecMap = codecMap | def __init__(self, codecMap): self.__codecMap = codecMap | 30,771 |
def _encodeValue(self, encodeFun, client, defMode, maxChunkSize): if hasattr(client, 'setDefaultComponents'): client.setDefaultComponents() client.verifySizeSpec() # Guess client type basing on number of component types. # This is certainly a hack but how do I distinguish one from # another if they have the same tags&c... | def _encodeValue(self, encodeFun, client, defMode, maxChunkSize): if hasattr(client, 'setDefaultComponents'): client.setDefaultComponents() client.verifySizeSpec() # Guess client type basing on number of component types. # This is certainly a hack but how do I distinguish one from # another if they have the same tags&c... | 30,772 |
def _encodeValue(self, encodeFun, client, defMode, maxChunkSize): if hasattr(client, 'setDefaultComponents'): client.setDefaultComponents() client.verifySizeSpec() # Guess client type basing on number of component types. # This is certainly a hack but how do I distinguish one from # another if they have the same tags&c... | def _encodeValue(self, encodeFun, client, defMode, maxChunkSize): if hasattr(client, 'setDefaultComponents'): client.setDefaultComponents() client.verifySizeSpec() # Guess client type basing on number of component types. # This is certainly a hack but how do I distinguish one from # another if they have the same tags&c... | 30,773 |
# def __cmp__(self, other): | # def __cmp__(self, other): return cmp(self.__hashedValues, other) def __cmp__(self, other): return cmp(self.__hashedValues, other) def __cmp__(self, other): | 30,774 |
def clone(self, value=None, tagSet=None, subtypeSpec=None, namedValues=None): if value is None: value = self._value if tagSet is None: tagSet = self._tagSet if subtypeSpec is None: subtypeSpec = self._subtypeSpec if namedValues is None: namedValues = self.__namedValues return self.__class__(value, tagSet, subtypeSpec, ... | def clone(self, value=None, tagSet=None, subtypeSpec=None, namedValues=None): if value is None and tagSet is None and subtypeSpec is None \ and namedValues is None: return self if value is None: value = self._value if tagSet is None: tagSet = self._tagSet if subtypeSpec is None: subtypeSpec = self._subtypeSpec if named... | 30,775 |
def get_entry(self, iter): "Fetches data for an entry" | def get_entry(self, iter): "Fetches data for an entry" | 30,776 |
def run(self): "Displays the dialog" | def run(self): "Displays the dialog" | 30,777 |
def run(self): "Displays the dialog" | def run(self): "Displays the dialog" | 30,778 |
def run(self): "Displays the dialog" | defrun(self):"Displaysthedialog" | 30,779 |
def run(self): "Displays the dialog" | def run(self): "Displays the dialog" | 30,780 |
def __init__(self, text = None): Alignment.__init__(self) | def __init__(self, text = None): Alignment.__init__(self) | 30,781 |
def __init__(self, text = None): Alignment.__init__(self) | def __init__(self, text = None): Alignment.__init__(self) | 30,782 |
def __cb_expose(self, widget, data): "Draws the widget borders on expose" | def __cb_expose(self, widget, data): "Draws the widget borders on expose" | 30,783 |
def __cb_size_request(self, widget, requisition): "Modifies the widget size request" | def __cb_size_request(self, widget, requisition): "Modifies the widget size request" | 30,784 |
def __cb_size_request(self, widget, requisition): "Modifies the widget size request" | def __cb_size_request(self, widget, requisition): "Modifies the widget size request" | 30,785 |
def set_icon(self, stock, tooltip = ""): "Sets the icon for the entry" | def set_icon(self, stock, tooltip = ""): "Sets the icon for the entry" | 30,786 |
def set_icon(self, stock, tooltip = ""): "Sets the icon for the entry" | def set_icon(self, stock, tooltip = ""): "Sets the icon for the entry" | 30,787 |
def __init_entryicons(self): "Loads entry icons" | def __init_entryicons(self): "Loads entry icons" | 30,788 |
def __init__(self, text = None): Alignment.__init__(self) | def __init__(self, text = None): Alignment.__init__(self) | 30,789 |
def __cb_expose(self, widget, data): "Draws the widget borders on expose" | def __cb_expose(self, widget, data): "Draws the widget borders on expose" | 30,790 |
def __cb_expose(self, widget, data): "Draws the widget borders on expose" | def __cb_expose(self, widget, data): "Draws the widget borders on expose" | 30,791 |
def __cb_size_allocate(self, widget, allocation): "Modifies the widget size allocation" | def __cb_size_allocate(self, widget, allocation): "Modifies the widget size allocation" | 30,792 |
def __init_mainarea(self): self.tree = Tree(self.data) self.tree.connect("button_press_event", self.__cb_popup_tree) self.tree.selection.connect("changed", self.__cb_entry_display) self.tree.selection.connect("changed", self.__cb_state_entry) | def __init_mainarea(self): self.tree = Tree(self.data) self.tree.connect("button_press_event", self.__cb_popup_tree) self.tree.selection.connect("changed", self.__cb_entry_display) self.tree.selection.connect("changed", self.__cb_state_entry) | 30,793 |
def create_field(value, type = FIELDTYPE_NAME): "Creates a field" field = "" field += "".join([ chr(len(value) >> i * 8) for i in range(4) ]) field += "".join([ chr(type >> i * 8) for i in range(4) ]) field += value if len(value) == 0 or len(value) % 8 != 0: field += "\x00" * (8 - len(value) % 8) return field | def create_field(value, type = FIELDTYPE_NAME): "Creates a field" field = struct.pack("ii", len(value), type) + value if len(value) == 0 or len(value) % 8 != 0: field += "\x00" * (8 - len(value) % 8) return field | 30,794 |
def parse_field_header(header): "Parses field data, returns the length and type" if len(header) < 8: raise base.FormatError # get length length = ord(header[0]) << 0 | ord(header[1]) << 8 | ord(header[2]) << 16 | ord(header[3]) << 24 if length == 0 or length % 8 != 0: length += 8 - length % 8 # get type type = ord(... | def parse_field_header(header): "Parses field data, returns the length and type" if len(header) < 8: raise base.FormatError # get lengthlength, type = struct.unpack("ii", header[:8]) if length == 0 or length % 8 != 0: length += 8 - length % 8 # get type type = ord(header[4]) << 0 | ord(header[5]) << 8 | ord(header[... | 30,795 |
def parse_field_header(header): "Parses field data, returns the length and type" if len(header) < 8: raise base.FormatError # get length length = ord(header[0]) << 0 | ord(header[1]) << 8 | ord(header[2]) << 16 | ord(header[3]) << 24 if length == 0 or length % 8 != 0: length += 8 - length % 8 # get type type = ord(... | def parse_field_header(header): "Parses field data, returns the length and type" if len(header) < 8: raise base.FormatError # get length length = ord(header[0]) << 0 | ord(header[1]) << 8 | ord(header[2]) << 16 | ord(header[3]) << 24 if length == 0 or length % 8 != 0: length += 8 - length % 8 # get type type = ord(... | 30,796 |
def execute(self, action, method = UNDO): "Executes and undo or redo action" | def execute(self, action, method = UNDO): "Executes and undo or redo action" | 30,797 |
def execute(self, action, method = UNDO): "Executes and undo or redo action" | def execute(self, action, method = UNDO): "Executes and undo or redo action" | 30,798 |
def set_menus(self, menubar): "Sets the menus" | def set_menus(self, menubar): "Sets the menus" | 30,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.