rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
this_base = 16 + self.slot * 16 r[base+12:base+16] = r[this_base+8:this_base+12] r[this_base+8:this_base+12] = IO.encode_link(slot_number) | this_slot = 16 + self.slot * 16 r[free_slot+12:free_slot+16] = r[this_slot+8:this_slot+12] r[this_slot+8:this_slot+12] = IO.encode_link(free_slot_n) | def index_word(self, word, doc_number, position): if word: prefix, suffix = word[0], word[1:] if prefix in self.children: subtree = self.children[prefix] else: # Get an empty slot slot_number = self.root.tree_handler._get_free_slot() # Update data structure on memoty subtree = self.children[prefix] = Tree(self.root, sl... | 51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py |
fdoc_slot_n = IO.decode_link(tree_rsrc[tree_slot+4:tree_slot+8]) | fdoc_slot_r = tree_rsrc[tree_slot+4:tree_slot+8] fdoc_slot_n = IO.decode_link(fdoc_slot_r) | def index_word(self, word, doc_number, position): if word: prefix, suffix = word[0], word[1:] if prefix in self.children: subtree = self.children[prefix] else: # Get an empty slot slot_number = self.root.tree_handler._get_free_slot() # Update data structure on memoty subtree = self.children[prefix] = Tree(self.root, sl... | 51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py |
docs_rsrc[doc_slot+8:doc_slot+12] = IO.encode_link(fdoc_slot_n) | docs_rsrc[doc_slot+8:doc_slot+12] = fdoc_slot_r | def index_word(self, word, doc_number, position): if word: prefix, suffix = word[0], word[1:] if prefix in self.children: subtree = self.children[prefix] else: # Get an empty slot slot_number = self.root.tree_handler._get_free_slot() # Update data structure on memoty subtree = self.children[prefix] = Tree(self.root, sl... | 51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py |
docs_slot_n = IO.decode_link(tree_rsrc[tree_slot+4:tree_slot+8]) | docs_slot_r = tree_rsrc[tree_slot+4:tree_slot+8] docs_slot_n = IO.decode_link(docs_slot_r) | def unindex_word(self, word, doc_number): if word: prefix, suffix = word[0], word[1:] subtree = self.children[prefix] subtree.unindex_word(suffix, doc_number) else: del self.documents[doc_number] # Update resource tree_rsrc = self.root.tree_handler.resource docs = self.root.docs_handler docs_rsrc = docs.resource # Sear... | 51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py |
docs_rsrc[8:12] = IO.encode_link(docs_slot_n) | docs_rsrc[8:12] = docs_slot_r | def unindex_word(self, word, doc_number): if word: prefix, suffix = word[0], word[1:] subtree = self.children[prefix] subtree.unindex_word(suffix, doc_number) else: del self.documents[doc_number] # Update resource tree_rsrc = self.root.tree_handler.resource docs = self.root.docs_handler docs_rsrc = docs.resource # Sear... | 51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py |
if referrer and referrer.path[-1].param != 'login_form': return referrer | if referrer: if not referrer.path: return referrer elif referrer.path[-1].param != 'login_form': return referrer | def login(self, context, goto=None): username = context.get_form_value('username') password = context.get_form_value('password') | 8f7e20191b16c256052d6803a0e86f7a80da7d40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/8f7e20191b16c256052d6803a0e86f7a80da7d40/WebSite.py |
if isinstance(value, list) or isinstance(value, set): | if isinstance(value, (list, set, frozenset)): | def Keyword(value): if value: if isinstance(value, list) or isinstance(value, set): for x in value: yield unicode(x), 0 else: yield unicode(value), 0 | 3487bc837417a16b53c30467551196e87216df39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3487bc837417a16b53c30467551196e87216df39/Analysers.py |
bytes = resource.get_size() | bytes = vfs.get_size(uri) | def get_human_size(self): uri = self.uri if vfs.is_file(uri): bytes = resource.get_size() kbytes = bytes / 1024.0 if kbytes >= 1024: mbytes = kbytes / 1024.0 size = self.gettext(u'%.01f MB') % mbytes else: size = self.gettext(u'%.01f KB') % kbytes else: size = len([ x for x in vfs.get_names(self.uri) if not x.startswit... | 1f326fedce0594b42b4adf62cc3dc197f847070e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1f326fedce0594b42b4adf62cc3dc197f847070e/Handler.py |
root = self.get_root() | self.set_handler(name, handler) handler = self.get_handler(name) root = self.get_site_root() | def new_resource(self, context): class_id = context.get_form_value('class_id') name = context.get_form_value('name') | a896ac23bcd2e69b2e9a6525d182735565c96ea9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a896ac23bcd2e69b2e9a6525d182735565c96ea9/Folder.py |
default_language = languages[0] kw = {} kw['dc:title'] = {default_language: context.get_form_value('dc:title')} self.set_handler(name, handler, **kw) | title = context.get_form_value('dc:title') handler.set_property('dc:title', title, languages[0]) | def new_resource(self, context): class_id = context.get_form_value('class_id') name = context.get_form_value('name') | a896ac23bcd2e69b2e9a6525d182735565c96ea9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a896ac23bcd2e69b2e9a6525d182735565c96ea9/Folder.py |
self.save() | def set_message(self, msgid, msgstr=[u''], comments=[], references={}): self._set_message(msgid, msgstr, comments, references) self.save() | d684f9a0877327a5cf10d2e4fb82d0eaef1cc90d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d684f9a0877327a5cf10d2e4fb82d0eaef1cc90d/PO.py | |
self.set_changed() | def _set_message(self, msgid, msgstr=[u''], comments=[], references={}): self.set_changed() if isinstance(msgid, (str, unicode)): msgid = [msgid] if isinstance(msgstr, (str, unicode)): msgstr = [msgstr] | d684f9a0877327a5cf10d2e4fb82d0eaef1cc90d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d684f9a0877327a5cf10d2e4fb82d0eaef1cc90d/PO.py | |
resource = get_resource('addressbook.xml') | resource = get_resource('addressbook_view.xml') | def view(self): # Load the STL template resource = get_resource('addressbook.xml') template = XML.Document(resource) | 402d5973b941bdf1541d08f42de86b4f6eda0cf4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/402d5973b941bdf1541d08f42de86b4f6eda0cf4/addressbook.py |
pass | continue | def set_user(self, email, password): user = User() | 842f0b54a3c0a93e20a9d3e58f60cfce1763b49c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/842f0b54a3c0a93e20a9d3e58f60cfce1763b49c/users.py |
char = unichr(codepoint).encode(self.encoding) self.events.append((TEXT, char, self.getpos()[0])) | char = unichr(codepoint) try: char = char.encode(self.encoding) except UnicodeEncodeError: pass else: self.events.append((TEXT, char, self.getpos()[0])) | def handle_entityref(self, name): # XXX Copied from 'itools.xml.parser.Parser.skipped_entity_handler' if name in htmlentitydefs.name2codepoint: codepoint = htmlentitydefs.name2codepoint[name] char = unichr(codepoint).encode(self.encoding) self.events.append((TEXT, char, self.getpos()[0])) else: warnings.warn('Unknown e... | a212ad22ed68fce55fef3d498a93a9fd80967a20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a212ad22ed68fce55fef3d498a93a9fd80967a20/parser.py |
if hasattr(container, 'on_del_handler'): container.on_del_handler(segment) | def del_handler(self, path): if not isinstance(path, uri.Path): path = uri.Path(path) | cb899fa744e3a3f5b101efbae39c756e7f0f7ff5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/cb899fa744e3a3f5b101efbae39c756e7f0f7ff5/Folder.py | |
cache['.metadata'] = self.build_metadata(self, **{'ikaaro:admins': (username,)}) | cache['.metadata'] = self.build_metadata(self) | def new(self, username=None, password=None): # Call the parent WebSite.new(self) | b3122e167f944423a1924cf3fef16ed3adece2be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b3122e167f944423a1924cf3fef16ed3adece2be/root.py |
metadata = self.build_metadata(users, owner=None, **{'dc:title': {'en': u'Users'}}) cache['users.metadata'] = metadata | cache['users.metadata'] = self.build_metadata(users, owner=None, **{'dc:title': {'en': u'Users'}}) | def new(self, username=None, password=None): # Call the parent WebSite.new(self) | b3122e167f944423a1924cf3fef16ed3adece2be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b3122e167f944423a1924cf3fef16ed3adece2be/root.py |
charser = charset.strip() | charset = charset.strip() | def next_entry(self): # Load the next line line_type, value = self.next_line() | 09505fab670af27b92eed82cb315604399573c1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/09505fab670af27b92eed82cb315604399573c1f/PO.py |
charser = charset.strip() | charset = charset.strip() | def _load(self): """ A PO file is made of entries, where entries are separated by one or more blank lines. Each entry consists of a msgid and a msgstr, optionally preceded by comments; if there are comments at the end of the entry they are ignored. So, an entry looks like: | 09505fab670af27b92eed82cb315604399573c1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/09505fab670af27b92eed82cb315604399573c1f/PO.py |
def _load(self, resource): self.documents = [ int(x[1:]) for x in resource.get_resources() if x.startswith('d') ] self.documents.sort() | def _load(self, resource): self.documents = [ int(x[1:]) for x in resource.get_resources() if x.startswith('d') ] self.documents.sort() | a82d2929ebe179900c0bb27f9f84f6e43ac82053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a82d2929ebe179900c0bb27f9f84f6e43ac82053/Catalog.py | |
if self.documents: return self.documents[-1] + 1 return 0 | documents = [ int(x[1:]) for x in self.resource.get_resources() if x.startswith('d') ] documents.sort() return documents[-1] + 1 | def get_new_document_number(self): if self.documents: return self.documents[-1] + 1 return 0 | a82d2929ebe179900c0bb27f9f84f6e43ac82053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a82d2929ebe179900c0bb27f9f84f6e43ac82053/Catalog.py |
self.documents.append(doc_number) | def index_document(self, document): # Get the document number, and name doc_number = self.get_new_document_number() doc_name = 'd%d' % doc_number | a82d2929ebe179900c0bb27f9f84f6e43ac82053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a82d2929ebe179900c0bb27f9f84f6e43ac82053/Catalog.py | |
i = self.documents.index(doc_number) del self.documents[i] | def unindex_document(self, doc_number): document = self.get_handler('d%d' % doc_number) for name in document.get_resources(): if name.startswith('i'): field = document.get_handler(name) ii = self.get_handler('f' + name[1:]) for term in field.terms: ii.unindex_word(term, doc_number) # Remove the document i = self.docume... | a82d2929ebe179900c0bb27f9f84f6e43ac82053 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a82d2929ebe179900c0bb27f9f84f6e43ac82053/Catalog.py | |
version = "0.4.4", | version = "0.4.5", | def build_module(self, module, module_file, package): if isinstance(package, str): package = package.split('.') elif not isinstance(package, (list, tuple)): raise TypeError, \ "'package' must be a string (dot-separated), list, or tuple" | 22c26141ccc2759f7bf810291ddae0eebbf7afdc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/22c26141ccc2759f7bf810291ddae0eebbf7afdc/setup.py |
tree_file.write(''.joint([VERSION, ZERO, NULL, NULL])) | tree_file.write(''.join([VERSION, ZERO, NULL, NULL])) | def init_tree_file(self, tree_file): tree_file.write(''.joint([VERSION, ZERO, NULL, NULL])) | 4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba/index.py |
node.children[c] = Tree({}, {}, slot_number) | node.children[c] = _Node({}, {}, slot_number) | def index_term(self, tree_file, docs_file, word, documents): """ Indexes the given documents for the given words. | 4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba/index.py |
first_doc = encode_link(dosc_n_slots) docs_n_slots = docs_slots_n + 3 + frequency | first_doc = encode_link(docs_n_slots) docs_n_slots = docs_n_slots + 3 + frequency | def index_term(self, tree_file, docs_file, word, documents): """ Indexes the given documents for the given words. | 4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba/index.py |
def save_state(self): base = vfs.open(self.uri) | def _save_state(self, uri): base = vfs.open(uri) | def save_state(self): base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: # Removed terms for term in self.removed_terms: # XXX pass # Added terms for term in self.added_terms: documents = self.added_terms[term] self._index.index_term(tree_file, docs_file, term, documents) # Clean... | 4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4e709a2fc5d2cbb8b456e3dd46a12604ca37f7ba/index.py |
""" """ | def translate(self, catalog, node=None): """ """ def open_tag(node, context): buffer = context.buffer # The open tag buffer.write(u'<%s' % node.qname) # The attributes for attribute in node.attributes: if node.is_translatable(attribute.name): msgid = attribute.value.strip() if msgid: msgstr = catalog.get_msgstr(msgid) ... | d5a34dedf48074bed539d21eb63e1f3753217780 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d5a34dedf48074bed539d21eb63e1f3753217780/XHTML.py | |
msgstr = msgstr.replace('&', '&') | def f(match): x = match.group(0) if x.endswith(';'): return x return "&" + x[1:] msgstr = re.sub("&[\w;]*", f, msgstr) | def process_message(context): # Get the message to process and set a new message in the context message = context.message context.message = i18n.segment.Message() # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] context.bu... | d5a34dedf48074bed539d21eb63e1f3753217780 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d5a34dedf48074bed539d21eb63e1f3753217780/XHTML.py |
yield line, reader.line_no | yield line | def parse(data, n_columns=None): """ This method is a generator that returns one CSV row at a time. To do the job it wraps the standard Python's csv parser. """ # Find out the dialect if data: lines = data.splitlines() dialect = sniffer.sniff('\n'.join(lines[:10])) # Fix the fucking sniffer dialect.doublequote = True i... | d2d9e3695d6751a415793c3a9cfee92367545ed0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d2d9e3695d6751a415793c3a9cfee92367545ed0/itools_csv.py |
create_catalog() load_documents() t0 = time() profile_indexing() t1 = time() print t1 - t0 | if len(sys.argv) == 2: option = sys.argv[1] else: option = None | def profile_search(): for word in ('forget', 'lion', 'hit'): catalog.search(body=word) | 82f01556132c0b3f9daa231cb2ea1938dd92bd1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/82f01556132c0b3f9daa231cb2ea1938dd92bd1f/prof.py |
if option == 'profile': create_catalog() load_documents() profile.run('profile_indexing()') elif option == 'bech': create_catalog() load_documents() t0 = time() profile_indexing() t1 = time() print t1 - t0 else: print "This script expects only one of the two options: 'profile'" \ " or 'bench'." | def profile_search(): for word in ('forget', 'lion', 'hit'): catalog.search(body=word) | 82f01556132c0b3f9daa231cb2ea1938dd92bd1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/82f01556132c0b3f9daa231cb2ea1938dd92bd1f/prof.py | |
""" """ | def set_data(self, data): self.data.seek(0) self.data.truncate() self.data.write(data) self.mtime = datetime.now() | b08e990e0a2a8a91e72c210bc40741ade0cfd5f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b08e990e0a2a8a91e72c210bc40741ade0cfd5f5/memory.py | |
self.resources[name] = File(data) | self.resources[name] = File(data, name=name) | def _set_file_resource(self, name, resource): data = resource.get_data() self.resources[name] = File(data) self.mtime = datetime.now() | b08e990e0a2a8a91e72c210bc40741ade0cfd5f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b08e990e0a2a8a91e72c210bc40741ade0cfd5f5/memory.py |
self.resources[name] = Folder() | self.resources[name] = Folder(name=name) | def _set_folder_resource(self, name, resource): self.resources[name] = Folder() self.mtime = datetime.now() | b08e990e0a2a8a91e72c210bc40741ade0cfd5f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b08e990e0a2a8a91e72c210bc40741ade0cfd5f5/memory.py |
usernames = [ x for x in self.get_handler_names() if not x.startswith('.') ] | usernames = [ x for x in self.get_handler_names() if not x.endswith('.metadata') ] | def get_usernames(self): """ Return all users name. """ usernames = [ x for x in self.get_handler_names() if not x.startswith('.') ] return frozenset(usernames) | 27e8db9a70b56a314aef344b99d08d76995835ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/27e8db9a70b56a314aef344b99d08d76995835ac/users.py |
def to_str(self, encoding='UTF-8'): data = [] if self.document_type is not None: data.append('<!%s>' % self.document_type) data.append(self.get_root_element().to_str(encoding)) return ''.join(data) | def header_to_str(self, encoding='UTF-8'): if self.document_type is None: return '' return '<!%s>' % self.document_type | def to_str(self, encoding='UTF-8'): data = [] # The declaration if self.document_type is not None: data.append('<!%s>' % self.document_type) # The document itself data.append(self.get_root_element().to_str(encoding)) | 5d0f6c7f579cdec6dd3a5f1533fc923d956eb59c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5d0f6c7f579cdec6dd3a5f1533fc923d956eb59c/HTML.py |
yield unicode(value), 0 | if isinstance(value, list) or isinstance(value, Set): for x in value: yield unicode(x), 0 else: yield unicode(value), 0 | def Keyword(value): if value: yield unicode(value), 0 | 30927ee4049089de27e029b8bc5263cf0dc628e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/30927ee4049089de27e029b8bc5263cf0dc628e0/Analysers.py |
stored_field = self.get_handler('d%d/s%d' % (doc_number, field.number)) | if doc_number in self.added_documents: doc_handler = self.added_documents[doc_number] else: doc_handler = self.get_handler('d%d' % doc_number) stored_field = doc_handler.get_handler('s%d' %field.number) | def search(self, query=None, **kw): # Build the query if it is passed through keyword parameters if query is None: for key, value in kw.items(): atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) # Check wether there is a query at all if query is None: raise V... | eb46baf0c37b07b80289f8574a2a33c4dbed571a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/eb46baf0c37b07b80289f8574a2a33c4dbed571a/Catalog.py |
handler = self.get_handler(name) root = self.get_site_root() languages = root.get_property('ikaaro:website_languages') handler.set_property('dc:title', title, languages[0]) | handler.set_property('dc:title', title, language) | def new_resource(self, context): class_id = context.get_form_value('class_id') name = context.get_form_value('name') title = context.get_form_value('dc:title') | b0039a7e4c1d30cdddf250a7efadffd30c3d0801 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b0039a7e4c1d30cdddf250a7efadffd30c3d0801/Folder.py |
def f(x): expr = Expression(x.group(1)) | match = subs_expr_solo.match(data) if match is not None: expr = Expression(match.group(1)) | def f(x): expr = Expression(x.group(1)) value = expr.evaluate(stack, repeat_stack) if isinstance(value, unicode): return value.encode(encoding) return str(value) | e02bd881f3a8816cdcd9e309e3dde960f1613e24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e02bd881f3a8816cdcd9e309e3dde960f1613e24/stl.py |
return subs_expr.sub(f, data) def encode_attribute(namespace, local_name, value, encoding='UTF-8'): datatype = schemas.get_datatype_by_uri(namespace, local_name) if issubclass(datatype, Boolean): if value == 'False': return None if bool(value) is True: return local_name elif value is not None: | def repl(match): expr = Expression(match.group(1)) value = expr.evaluate(stack, repeat_stack) if value is None: return '' | def f(x): expr = Expression(x.group(1)) value = expr.evaluate(stack, repeat_stack) if isinstance(value, unicode): return value.encode(encoding) return str(value) | e02bd881f3a8816cdcd9e309e3dde960f1613e24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e02bd881f3a8816cdcd9e309e3dde960f1613e24/stl.py |
value = value.encode(encoding) else: value = str(value) return XMLAttribute.encode(value) return None | return value.encode(encoding) return str(value) return subs_expr.sub(repl, data) | def encode_attribute(namespace, local_name, value, encoding='UTF-8'): datatype = schemas.get_datatype_by_uri(namespace, local_name) if issubclass(datatype, Boolean): # XXX This representation of boolean attributes is specfic to HTML if value == 'False': return None if bool(value) is True: return local_name elif value i... | e02bd881f3a8816cdcd9e309e3dde960f1613e24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e02bd881f3a8816cdcd9e309e3dde960f1613e24/stl.py |
value = substitute(value, stack, repeat, encoding) value = encode_attribute(namespace, local_name, value, encoding) if value is not None: s.append(' %s="%s"' % (qname, value)) | datatype = schemas.get_datatype_by_uri(namespace, local_name) if issubclass(datatype, Boolean): value = substitute_boolean(value, stack, repeat, encoding) if value is True: s.append(' %s="%s"' % (qname, local_name)) else: value = substitute(value, stack, repeat, encoding) if value is not None: value = XMLAttribute.enc... | def process1(node, stack, repeat, encoding='UTF-8'): """ Process "stl:if" and variable substitution. """ # Remove the element if the given expression evaluates to false if node.has_attribute(stl_uri, 'if'): stl_expression = node.get_attribute(stl_uri, 'if') if not stl_expression.evaluate(stack, repeat): return [] # Pr... | e02bd881f3a8816cdcd9e309e3dde960f1613e24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e02bd881f3a8816cdcd9e309e3dde960f1613e24/stl.py |
Each slot is made of: - position (4 bytes) - next position (4 bytes) | The rest of the file is split into variable size blocks. A block maybe busy or free. A free block starts with a header: - number of slots [uint32] (excluding the header, maybe 0 or more) - next free block [link] A busy block stars with the header: - number of slots [uint32] So, the minimal size for a block, free o... | def _get_document_slot(self, slot_number, document_number): """ Searches and returns the slot number for the given document, starting from the given base slot. If it is not found None is returned. """ r = self.resource while True: base = 12 + slot_number * 16 x = IO.decode_uint32(r[base:base+4]) if x == document_number... | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
def _get_free_slot(self): """ Returns the slot number of a free slot, allocates a new one if needed. """ state = self.state r = self.resource if state.first_empty is None: slot_number = state.number_of_slots state.number_of_slots += 1 r[4:8] = IO.encode_uint32(state.number_of_slots) else: slot_number = state.first_e... | def _load_state(self, resource): state = self.state # The header state.version = IO.decode_version(resource[:4]) state.number_of_slots = IO.decode_uint32(resource[4:8]) state.first_empty = IO.decode_link(resource[8:12]) | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py | |
def load_documents(self): # Initialize data structure self.documents = {} | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py | ||
while pos_slot_n is not None: pos_slot = 12 + pos_slot_n * 8 position = IO.decode_uint32(posi_rsrc[pos_slot:pos_slot+4]) documents.add(position) pos_slot_n = IO.decode_link(posi_rsrc[pos_slot+4:pos_slot+8]) | pos_slot = 12 + pos_slot_n * 4 data = posi_rsrc[pos_slot+4:pos_slot+4+(frequency*4)] i = 0 while i < frequency: documents.add(IO.decode_uint32(data[i:i+4])) i += 1 | def load_documents(self): # Initialize data structure self.documents = {} | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
+ IO.encode_uint32(len(doc_positions)) | + IO.encode_uint32(frq) | def _index_term(self, term, documents): """ Indexes the given term. The parameter 'documents' is a mapping from document number to list of positions: | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
for position in doc_positions: p_r = docs_rsrc[doc_slot+8:doc_slot+12] f_n = posi_handler._get_free_slot() f_b = 12 + f_n * 8 posi_rsrc[f_b:f_b+4] = IO.encode_uint32(position) posi_rsrc[f_b+4:f_b+8] = p_r docs_rsrc[doc_slot+8:doc_slot+12] = IO.encode_link(f_n) | free_block_n = posi_handler.state.first_empty previous_block_n = None while free_block_n is not None: free_block = 12 + free_block_n * 4 n = IO.decode_uint32(posi_rsrc[free_block:free_block+4]) if frq < n: new_free_block_n = free_block_n + frq + 1 new_free_block = 12 + new_free_block_n * 4 next_free_block_r = posi_rs... | def _index_term(self, term, documents): """ Indexes the given term. The parameter 'documents' is a mapping from document number to list of positions: | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
posi_rsrc = self.root.posi_handler.resource | posi_handler = self.root.posi_handler posi_rsrc = posi_handler.resource | def _unindex_term(self, word, documents): """ Un-indexes the given term. The parameter 'documents' is a list with the numbers of the documents that must be un-indexed. """ if word: if self.children is None: self.load_children() | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
f_e = posi_rsrc[8:12] p_r = docs_rsrc[docs_slot+8:docs_slot+12] posi_rsrc[8:12] = p_r p_n = IO.decode_link(p_r) p_b = 12 + p_n * 8 pn_r = posi_rsrc[p_b+4:p_b+8] pn_n = IO.decode_link(pn_r) while pn_n is not None: p_n = pn_n p_b = 12 + p_n * 8 pn_r = posi_rsrc[p_b+4:p_b+8] pn_n = IO.decode_link(pn_r) posi_rsrc[p_b+8:p_... | new_free_block_r = docs_rsrc[docs_slot+8:docs_slot+12] new_free_block_n = IO.decode_link(new_free_block_r) new_free_block = 12 + new_free_block_n * 4 frq = IO.decode_uint32(posi_rsrc[new_free_block:new_free_block+4]) first_free_block_r = posi_rsrc[8:12] posi_rsrc[new_free_block:new_free_block+8] = ( IO.encode_uint32(fr... | def _unindex_term(self, word, documents): """ Un-indexes the given term. The parameter 'documents' is a list with the numbers of the documents that must be un-indexed. """ if word: if self.children is None: self.load_children() | d27c22daf0630253f4ccf2cc0eb47ee78306f168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d27c22daf0630253f4ccf2cc0eb47ee78306f168/IIndex.py |
'if-modified-since': HTTPDate, | 'if-modified-since': If_Modified_Since, | def encode(value): return '; '.join([ '%s="%s"' % (name, value) for name, value in value.items() ]) | 3ac043c79417b187cecd91e15ae9672888ea599b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3ac043c79417b187cecd91e15ae9672888ea599b/headers.py |
def load(self, resource=None): | def _load(self, resource): | def load(self, resource=None): # XXX Clean the cache. # # This has a very negative performance impact; for example, if you # create a new resource into a folder, the folder's modification # time will change, then it will be re-loaded the next time; if the # handler has a lot of content, it will be cleaned, even if it i... | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
Handler.load(self, resource) def _load(self, resource): | for name in self.resource.get_resource_names(): self.cache[name] = None | def load(self, resource=None): # XXX Clean the cache. # # This has a very negative performance impact; for example, if you # create a new resource into a folder, the folder's modification # time will change, then it will be re-loaded the next time; if the # handler has a lot of content, it will be cleaned, even if it i... | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
return self.resource._get_resource_names() | return self.cache.keys() | def _get_handler_names(self): return self.resource._get_resource_names() | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
def _del_handler(self, segment): self.resource.del_resource(segment) | self.cache[name] = None self.timestamp = datetime.datetime.now() def _del_handler(self, name): self.resource.del_resource(name) del self.cache[name] self.timestamp = datetime.datetime.now() | def _set_handler(self, name, handler): self.resource.set_resource(name, handler.resource) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
key = str(segment) resource_names = [ x for x in self.resource.get_resource_names() if x not in self.removed_handlers ] | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py | |
elif name in resource_names: if key in self.cache: handler, atime = self.cache[key] if handler.is_outdated(): handler.load() | else: if name in self.cache and name not in self.removed_handlers: handler = self.cache[name] if handler is None: resource = self.resource.get_resource(name) handler = self._get_handler(segment, resource) handler.parent = self handler.name = segment.name self.cache[name] = handler else: if handler.is_outdated(): ... | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
resource = self.resource.get_resource(name) handler = self._get_handler(segment, resource) | if name in self.cache: del self.cache[name] handler = self._get_virtual_handler(segment) | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py |
atime = datetime.datetime.now() self.cache[key] = (handler, atime) else: if key in self.cache: del self.cache[key] handler = self._get_virtual_handler(segment) handler.parent = self handler.name = segment.name | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py | |
container.timestamp = datetime.datetime.now() | def set_handler(self, path, handler, **kw): if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py | |
container.timestamp = datetime.datetime.now() | def del_handler(self, path): if not isinstance(path, uri.Path): path = uri.Path(path) | 6e4f3924d44a6a8debbfc5b4de8e14594351ffa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6e4f3924d44a6a8debbfc5b4de8e14594351ffa9/Folder.py | |
iindex.save() | iindex._save(iindex.resource) iindex.timestamp = iindex.resource.get_mtime() | def _save(self, resource): # Remove documents for doc_number in self.removed_documents: name = 'd%07d' % doc_number resource.del_resource(name) del self.cache[name] self.removed_documents = [] # Add documents for doc_number, document in self.added_documents.items(): if document.has_changed(): document.save() name = 'd%... | d0f468e406cc0964dc0d3081adc0032bfd454676 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d0f468e406cc0964dc0d3081adc0032bfd454676/Catalog.py |
method = handler.get_method(method_name) if method is None: if user is None: method = root.login_form | try: method = handler.get_method(method_name) except: server.log_error() response.set_status(500) method = root.internal_server_error else: if method is None: if user is None: method = root.login_form else: method = root.forbidden | def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ... | cdf036ffffeb006e25eda78aadfc2bb6faa44d2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/cdf036ffffeb006e25eda78aadfc2bb6faa44d2b/server.py |
method = root.forbidden else: mtime = getattr(handler, '%s__mtime__' % method_name, None) if mtime is not None: mtime = mtime().replace(microsecond=0) response.set_header('last-modified', mtime) if request.method == 'GET': if request.has_header('if-modified-since'): msince = request.get_header('if-modified-since') if ... | mtime = getattr(handler, '%s__mtime__' % method_name, None) if mtime is not None: mtime = mtime().replace(microsecond=0) response.set_header('last-modified', mtime) if request.method == 'GET': if request.has_header('if-modified-since'): msince = request.get_header('if-modified-since') if mtime <= msince: response.set_... | def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ... | cdf036ffffeb006e25eda78aadfc2bb6faa44d2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/cdf036ffffeb006e25eda78aadfc2bb6faa44d2b/server.py |
self._encoding = charset[len('charset='):] | self.encoding = charset[len('charset='):] | def next_entry(self): # Initialize entry information id, comments, msgid, msgstr, fuzzy = None, [], [], [], False # Parse entry state = 0 for m in self.next_line(): line_type, value, line_number = m # Syntactic and semantic analysis if state == 0: # Wait for an entry if line_type == EOF: return elif line_type == BLANK:... | 9615374b75cdc01c7f50960ed022f4ea67d8112c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9615374b75cdc01c7f50960ed022f4ea67d8112c/PO.py |
def _load_state(self, resource): | def _load_state_from_file(self, file): | def _load_state(self, resource): """ A PO file is made of entries, where entries are separated by one or more blank lines. Each entry consists of a msgid and a msgstr, optionally preceded by comments; if there are comments at the end of the entry they are ignored. So, an entry looks like: | 9615374b75cdc01c7f50960ed022f4ea67d8112c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9615374b75cdc01c7f50960ed022f4ea67d8112c/PO.py |
data = resource.read() | data = file.read() | def _load_state(self, resource): """ A PO file is made of entries, where entries are separated by one or more blank lines. Each entry consists of a msgid and a msgstr, optionally preceded by comments; if there are comments at the end of the entry they are ignored. So, an entry looks like: | 9615374b75cdc01c7f50960ed022f4ea67d8112c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9615374b75cdc01c7f50960ed022f4ea67d8112c/PO.py |
name, type, language = FileName.decode(name) | short_name, type, language = FileName.decode(name) | def upload_file(self, context): file = context.get_form_value('file') if file is None: raise UserError, self.gettext(u'The file must be entered') | 386290306876d60b3dc2d3ac2edfdbbb74e6ee7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/386290306876d60b3dc2d3ac2edfdbbb74e6ee7f/Folder.py |
name = FileName.encode((name, type, language)) | name = FileName.encode((short_name, type, language)) | def upload_file(self, context): file = context.get_form_value('file') if file is None: raise UserError, self.gettext(u'The file must be entered') | 386290306876d60b3dc2d3ac2edfdbbb74e6ee7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/386290306876d60b3dc2d3ac2edfdbbb74e6ee7f/Folder.py |
def upload_file(self, context): file = context.get_form_value('file') if file is None: raise UserError, self.gettext(u'The file must be entered') | 386290306876d60b3dc2d3ac2edfdbbb74e6ee7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/386290306876d60b3dc2d3ac2edfdbbb74e6ee7f/Folder.py | ||
if kw.has_key('add_and_return'): | if context.has_form_value('add_and_return'): | def upload_file(self, context): file = context.get_form_value('file') if file is None: raise UserError, self.gettext(u'The file must be entered') | 386290306876d60b3dc2d3ac2edfdbbb74e6ee7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/386290306876d60b3dc2d3ac2edfdbbb74e6ee7f/Folder.py |
documents.setdefault(doc_number, 0) documents[doc_number] += len(positions) | if doc_number in documents: documents[doc_number] |= positions else: documents[doc_number] = positions | def search_word(self, word): state = self.state | 3845d0418b5e6f71ad17841894f7dd8a94af0e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3845d0418b5e6f71ad17841894f7dd8a94af0e7f/IIndex.py |
edit_password_form__access__ = 'is_self_or_superuser' | edit_password_form__access__ = 'is_allowed_to_edit' | def edit_account(self, context): title = context.get_form_value('dc:title') email = context.get_form_value('email') password = context.get_form_value('password') | f7e213adb8bcd745681126d975ebd0d4684f308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/f7e213adb8bcd745681126d975ebd0d4684f308f/users.py |
def edit_password_form(self): context = get_context() | def edit_password_form(self, context): | def edit_password_form(self): context = get_context() user = context.user | f7e213adb8bcd745681126d975ebd0d4684f308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/f7e213adb8bcd745681126d975ebd0d4684f308f/users.py |
edit_password__access__ = 'is_self_or_superuser' def edit_password(self, newpass, newpass2, password='', **kw): context = get_context() | edit_password__access__ = 'is_allowed_to_edit' def edit_password(self, context): newpass = context.get_form_value('newpass') newpass2 = context.get_form_value('newpass2') password = context.get_form_value('password') | def edit_password_form(self): context = get_context() user = context.user | f7e213adb8bcd745681126d975ebd0d4684f308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/f7e213adb8bcd745681126d975ebd0d4684f308f/users.py |
context = get_context() | def edit_password(self, newpass, newpass2, password='', **kw): context = get_context() user = context.user | f7e213adb8bcd745681126d975ebd0d4684f308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/f7e213adb8bcd745681126d975ebd0d4684f308f/users.py | |
return ''.join(message.msgstr) | msgstr = ''.join(message.msgstr) if msgstr: return msgstr | def get_translation(self, msgid): message = self.state.messages.get(msgid) if message and not message.fuzzy: return ''.join(message.msgstr) return msgid | 6f7c4d5e853625d736455878ef8008426766221f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6f7c4d5e853625d736455878ef8008426766221f/PO.py |
root = Zope.app() | root = get_context().request.zope_request['PARENTS'][-1] | def _get_object(self): root = Zope.app() return root.unrestrictedTraverse(self._path) | edd9d0ed27e996a2cf222a924ed2972c10894030 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/edd9d0ed27e996a2cf222a924ed2972c10894030/zope2.py |
def get_resource(reference): # Get path if isinstance(reference, uri.Reference): path = str(reference.path) else: path = reference # Get object | edd9d0ed27e996a2cf222a924ed2972c10894030 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/edd9d0ed27e996a2cf222a924ed2972c10894030/zope2.py | ||
class ComplexType(object): | class ComplexType(XML.Element): | ## def decode(cls, value): | 06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8/Schema.py |
def __init__(self, **kw): schema = self.schema for key, value in kw.items(): if key in schema: self.set_property(key, value) | def __init__(self, **kw): schema = self.schema for key, value in kw.items(): if key in schema: self.set_property(key, value) | 06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8/Schema.py | |
property = cls() | property = cls(None, None) | def decode(cls, node): schema = cls.schema property = cls() for node in node.get_elements(): name = node.name # Decode the value if name in schema: type, default = schema[name] if issubclass(type, ComplexType): value = type.decode(node) else: value = XML.Children.encode(node.children) value = value.encode('utf8') try: ... | 06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/06c24d2847519b6b03d5b3d0e8554f99d4ab5cf8/Schema.py |
self._deep_load() | if self.uri is not None: self._deep_load() | def copy_handler(self): # Deep load self._deep_load() # Create and initialize the instance cls = self.__class__ copy = object.__new__(cls) copy.uri = None copy.timestamp = None # Copy the state for name in cls.__slots__: if name in ('uri', 'timestamp', 'parent', 'name', 'real_handler'): continue value = getattr(self, n... | eb4f17d2d8122fcb1cd177b187b910b8ac48966c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/eb4f17d2d8122fcb1cd177b187b910b8ac48966c/base.py |
def get_skin(self): context = get_context() | 895d2daabc4beb8a71d0d3732be1dc95c1a81521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/895d2daabc4beb8a71d0d3732be1dc95c1a81521/Root.py | ||
if user is None: return self.get_handler('ui/aruni') theme = user.get_property('ikaaro:user_theme') | if user is not None: theme = user.get_property('ikaaro:user_theme') if theme not in themes: theme = themes[0] | def get_skin(self): context = get_context() | 895d2daabc4beb8a71d0d3732be1dc95c1a81521 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/895d2daabc4beb8a71d0d3732be1dc95c1a81521/Root.py |
if '.%s' % data[-1] in mimetypes.types_map: | if '.%s' % data[-1].lower() in mimetypes.types_map: | def decode(cls, data): data = data.split('.') | 89f2430cd50f177b9fcaae8cae074252431a2345 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/89f2430cd50f177b9fcaae8cae074252431a2345/__init__.py |
if '.%s' % data[-1] in mimetypes.types_map: | if '.%s' % data[-1].lower() in mimetypes.types_map: | def decode(cls, data): data = data.split('.') | 89f2430cd50f177b9fcaae8cae074252431a2345 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/89f2430cd50f177b9fcaae8cae074252431a2345/__init__.py |
self.lock = thread.allocate_lock() | self.lock = Lock() | def __init__(self, root): self.lock = thread.allocate_lock() self.pool = [root] | d94aceec53bfe0beb1a94aa13145aeeca68d54f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d94aceec53bfe0beb1a94aa13145aeeca68d54f3/server.py |
print 'Listen port %s' % self.port while True: try: connection, client_address = ear.accept() except socket.error: continue except: ear.close() if self.access_log is not None: self.access_log.close() if self.error_log is not None: self.error_log.close() break else: thread.start_new_thread(handle_request, (connection, ... | try: while True: try: connection, client_address = ear.accept() except socket.error: continue thread = Thread(target=handle_request, args=(connection, self)) thread.start() except: ear.close() if self.access_log is not None: self.access_log.close() if self.error_log is not None: self.error_log.close() | def start(self): if self.pid_file is not None: pid = os.getpid() open(self.pid_file, 'w').write(str(pid)) | d94aceec53bfe0beb1a94aa13145aeeca68d54f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d94aceec53bfe0beb1a94aa13145aeeca68d54f3/server.py |
base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') | if self.uri is None: tree_file = None docs_file = None else: base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') | def search_word(self, word): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_word(tree_file, docs_file, word) finally: tree_file.close() docs_file.close() | c9303bbdbf16a622f33acec9e2565afe0721cb94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9303bbdbf16a622f33acec9e2565afe0721cb94/index.py |
tree_file.close() docs_file.close() | if self.uri is not None: tree_file.close() docs_file.close() | def search_word(self, word): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_word(tree_file, docs_file, word) finally: tree_file.close() docs_file.close() | c9303bbdbf16a622f33acec9e2565afe0721cb94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9303bbdbf16a622f33acec9e2565afe0721cb94/index.py |
base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') | def search_range(self, left, right): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_range(tree_file, docs_file, left, right) finally: tree_file.close() docs_file.close() | c9303bbdbf16a622f33acec9e2565afe0721cb94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9303bbdbf16a622f33acec9e2565afe0721cb94/index.py | |
tree_file.close() docs_file.close() | if self.uri is not None: tree_file.close() docs_file.close() | def search_range(self, left, right): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_range(tree_file, docs_file, left, right) finally: tree_file.close() docs_file.close() | c9303bbdbf16a622f33acec9e2565afe0721cb94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9303bbdbf16a622f33acec9e2565afe0721cb94/index.py |
sniffer = csv.Sniffer() dialect = sniffer.sniff('\n'.join(data)) | if data: sniffer = csv.Sniffer() dialect = sniffer.sniff('\n'.join(data)) | def _load(self): Text._load(self) | a862515f9f5c33e447016733b4a415ead23247ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a862515f9f5c33e447016733b4a415ead23247ba/CSV.py |
self.lines = [] for line in csv.reader(data, dialect): line = [ unicode(x, self._encoding) for x in line ] self.lines.append(line) | self.lines = [] for line in csv.reader(data, dialect): line = [ unicode(x, self._encoding) for x in line ] self.lines.append(line) else: self.lines = [] | def _load(self): Text._load(self) | a862515f9f5c33e447016733b4a415ead23247ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a862515f9f5c33e447016733b4a415ead23247ba/CSV.py |
response = context.response | def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ... | 9f29a6f62843ce781d4b23b7e2562344d204cf0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9f29a6f62843ce781d4b23b7e2562344d204cf0f/server.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.