rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self._out.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
self._out.write('<?xml version="1.0" encoding="%s"?>\n' % self._encoding)
def startDocument(self): self._out.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
pass
self._ns_contexts.append(self._current_context.copy()) self._current_context[uri] = prefix
def startPrefixMapping(self, prefix, uri): pass
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
pass
del self._current_context[-1]
def endPrefixMapping(self, prefix): pass
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
if type(name) is type(()): uri, localname, prefix = name name = "%s:%s"%(prefix,localname)
def startElement(self, name, attrs): if type(name) is type(()): uri, localname, prefix = name name = "%s:%s"%(prefix,localname) self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s="%s"' % (name, escape(value))) self._out.write('>')
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
def startElement(self, name, attrs): if type(name) is type(()): uri, localname, prefix = name name = "%s:%s"%(prefix,localname) self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s="%s"' % (name, escape(value))) self._out.write('>')
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
def endElement(self, name): # FIXME: not namespace friendly yet self._out.write('</%s>' % name)
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
def endElement(self, name, qname): self._cont_handler.endElement(name, qname)
def endElement(self, name): self._cont_handler.endElement(name) def startElementNS(self, name, qname, attrs): self._cont_handler.startElement(name, attrs) def endElementNS(self, name, qname): self._cont_handler.endElementNS(name, qname)
def endElement(self, name, qname): self._cont_handler.endElement(name, qname)
55629583bcc04a7a80933907be9b667ff659bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/55629583bcc04a7a80933907be9b667ff659bdcf/saxutils.py
last.data = string.rstrip(last.data) + "\n "
last.data = last.data.rstrip() + "\n "
def rewrite_descriptor(doc, descriptor): # # Do these things: # 1. Add an "index='no'" attribute to the element if the tagName # ends in 'ni', removing the 'ni' from the name. # 2. Create a <signature> from the name attribute # 2a.Create an <args> if it appears to be available. # 3. Create additional <signature>s from <*line{,ni}> elements, # if found. # 4. If a <versionadded> is found, move it to an attribute on the # descriptor. # 5. Move remaining child nodes to a <description> element. # 6. Put it back together. # # 1. descname = descriptor.tagName index = descriptor.getAttribute("name") != "no" desctype = descname[:-4] # remove 'desc' linename = desctype + "line" if not index: linename = linename + "ni" # 2. signature = doc.createElement("signature") name = doc.createElement("name") signature.appendChild(doc.createTextNode("\n ")) signature.appendChild(name) name.appendChild(doc.createTextNode(descriptor.getAttribute("name"))) descriptor.removeAttribute("name") # 2a. if descriptor.hasAttribute("var"): if descname != "opcodedesc": raise RuntimeError, \ "got 'var' attribute on descriptor other than opcodedesc" variable = descriptor.getAttribute("var") if variable: args = doc.createElement("args") args.appendChild(doc.createTextNode(variable)) signature.appendChild(doc.createTextNode("\n ")) signature.appendChild(args) descriptor.removeAttribute("var") newchildren = [signature] children = descriptor.childNodes pos = skip_leading_nodes(children) if pos < len(children): child = children[pos] if child.nodeName == "args": # move <args> to <signature>, or remove if empty: child.parentNode.removeChild(child) if len(child.childNodes): signature.appendChild(doc.createTextNode("\n ")) signature.appendChild(child) signature.appendChild(doc.createTextNode("\n ")) # 3, 4. pos = skip_leading_nodes(children, pos) while pos < len(children) \ and children[pos].nodeName in (linename, "versionadded"): if children[pos].tagName == linename: # this is really a supplemental signature, create <signature> oldchild = children[pos].cloneNode(1) try: sig = methodline_to_signature(doc, children[pos]) except KeyError: print oldchild.toxml() raise newchildren.append(sig) else: # <versionadded added=...> descriptor.setAttribute( "added", children[pos].getAttribute("version")) pos = skip_leading_nodes(children, pos + 1) # 5. description = doc.createElement("description") description.appendChild(doc.createTextNode("\n")) newchildren.append(description) move_children(descriptor, description, pos) last = description.childNodes[-1] if last.nodeType == TEXT: last.data = string.rstrip(last.data) + "\n " # 6. # should have nothing but whitespace and signature lines in <descriptor>; # discard them while descriptor.childNodes: descriptor.removeChild(descriptor.childNodes[0]) for node in newchildren: descriptor.appendChild(doc.createTextNode("\n ")) descriptor.appendChild(node) descriptor.appendChild(doc.createTextNode("\n"))
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
and not string.strip(nodes[0].data):
and not nodes[0].data.strip():
def handle_appendix(doc, fragment): # must be called after simplfy() if document is multi-rooted to begin with docelem = get_documentElement(fragment) toplevel = docelem.tagName == "manual" and "chapter" or "section" appendices = 0 nodes = [] for node in docelem.childNodes: if appendices: nodes.append(node) elif node.nodeType == ELEMENT: appnodes = node.getElementsByTagName("appendix") if appnodes: appendices = 1 parent = appnodes[0].parentNode parent.removeChild(appnodes[0]) parent.normalize() if nodes: map(docelem.removeChild, nodes) docelem.appendChild(doc.createTextNode("\n\n\n")) back = doc.createElement("back-matter") docelem.appendChild(back) back.appendChild(doc.createTextNode("\n")) while nodes and nodes[0].nodeType == TEXT \ and not string.strip(nodes[0].data): del nodes[0] map(back.appendChild, nodes) docelem.appendChild(doc.createTextNode("\n"))
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
children[-1].data = string.rstrip(children[-1].data) def fixup_trailing_whitespace(doc, wsmap): queue = [doc]
children[-1].data = children[-1].data.rstrip() def fixup_trailing_whitespace(doc, fragment, wsmap): queue = [fragment] fixups = []
def handle_labels(doc, fragment): for label in find_all_elements(fragment, "label"): id = label.getAttribute("id") if not id: continue parent = label.parentNode parentTagName = parent.tagName if parentTagName == "title": parent.parentNode.setAttribute("id", id) else: parent.setAttribute("id", id) # now, remove <label id="..."/> from parent: parent.removeChild(label) if parentTagName == "title": parent.normalize() children = parent.childNodes if children[-1].nodeType == TEXT: children[-1].data = string.rstrip(children[-1].data)
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
ws = wsmap[node.tagName] children = node.childNodes children.reverse() if children[0].nodeType == TEXT: data = string.rstrip(children[0].data) + ws children[0].data = data children.reverse() if node.tagName == "title" \ and node.parentNode.firstChild.nodeType == ELEMENT: node.parentNode.insertBefore(doc.createText("\n "), node.parentNode.firstChild)
fixups.append(node)
def fixup_trailing_whitespace(doc, wsmap): queue = [doc] while queue: node = queue[0] del queue[0] if wsmap.has_key(node.nodeName): ws = wsmap[node.tagName] children = node.childNodes children.reverse() if children[0].nodeType == TEXT: data = string.rstrip(children[0].data) + ws children[0].data = data children.reverse() # hack to get the title in place: if node.tagName == "title" \ and node.parentNode.firstChild.nodeType == ELEMENT: node.parentNode.insertBefore(doc.createText("\n "), node.parentNode.firstChild) for child in node.childNodes: if child.nodeType == ELEMENT: queue.append(child)
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
first_data.data = string.lstrip(first_data.data[4:])
first_data.data = first_data.data[4:].lstrip()
def create_module_info(doc, section): # Heavy. node = extract_first_element(section, "modulesynopsis") if node is None: return set_tagName(node, "synopsis") lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ and lastchild.data[-1:] == ".": lastchild.data = lastchild.data[:-1] modauthor = extract_first_element(section, "moduleauthor") if modauthor: set_tagName(modauthor, "author") modauthor.appendChild(doc.createTextNode( modauthor.getAttribute("name"))) modauthor.removeAttribute("name") platform = extract_first_element(section, "platform") if section.tagName == "section": modinfo_pos = 2 modinfo = doc.createElement("moduleinfo") moddecl = extract_first_element(section, "declaremodule") name = None if moddecl: modinfo.appendChild(doc.createTextNode("\n ")) name = moddecl.attributes["name"].value namenode = doc.createElement("name") namenode.appendChild(doc.createTextNode(name)) modinfo.appendChild(namenode) type = moddecl.attributes.get("type") if type: type = type.value modinfo.appendChild(doc.createTextNode("\n ")) typenode = doc.createElement("type") typenode.appendChild(doc.createTextNode(type)) modinfo.appendChild(typenode) versionadded = extract_first_element(section, "versionadded") if versionadded: modinfo.setAttribute("added", versionadded.getAttribute("version")) title = get_first_element(section, "title") if title: children = title.childNodes if len(children) >= 2 \ and children[0].nodeName == "module" \ and children[0].childNodes[0].data == name: # this is it; morph the <title> into <short-synopsis> first_data = children[1] if first_data.data[:4] == " ---": first_data.data = string.lstrip(first_data.data[4:]) set_tagName(title, "short-synopsis") if children[-1].nodeType == TEXT \ and children[-1].data[-1:] == ".": children[-1].data = children[-1].data[:-1] section.removeChild(title) section.removeChild(section.childNodes[0]) title.removeChild(children[0]) modinfo_pos = 0 else: ewrite("module name in title doesn't match" " <declaremodule/>; no <short-synopsis/>\n") else: ewrite("Unexpected condition: <section/> without <title/>\n") modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(node) if title and not contents_match(title, node): # The short synopsis is actually different, # and needs to be stored: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(title) if modauthor: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(modauthor) if platform: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(platform) modinfo.appendChild(doc.createTextNode("\n ")) section.insertBefore(modinfo, section.childNodes[modinfo_pos]) section.insertBefore(doc.createTextNode("\n "), modinfo) # # The rest of this removes extra newlines from where we cut out # a lot of elements. A lot of code for minimal value, but keeps # keeps the generated *ML from being too funny looking. # section.normalize() children = section.childNodes for i in range(len(children)): node = children[i] if node.nodeName == "moduleinfo": nextnode = children[i+1] if nextnode.nodeType == TEXT: data = nextnode.data if len(string.lstrip(data)) < (len(data) - 4): nextnode.data = "\n\n\n" + string.lstrip(data)
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
if len(string.lstrip(data)) < (len(data) - 4): nextnode.data = "\n\n\n" + string.lstrip(data)
s = data.lstrip() if len(s) < (len(data) - 4): nextnode.data = "\n\n\n" + s
def create_module_info(doc, section): # Heavy. node = extract_first_element(section, "modulesynopsis") if node is None: return set_tagName(node, "synopsis") lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ and lastchild.data[-1:] == ".": lastchild.data = lastchild.data[:-1] modauthor = extract_first_element(section, "moduleauthor") if modauthor: set_tagName(modauthor, "author") modauthor.appendChild(doc.createTextNode( modauthor.getAttribute("name"))) modauthor.removeAttribute("name") platform = extract_first_element(section, "platform") if section.tagName == "section": modinfo_pos = 2 modinfo = doc.createElement("moduleinfo") moddecl = extract_first_element(section, "declaremodule") name = None if moddecl: modinfo.appendChild(doc.createTextNode("\n ")) name = moddecl.attributes["name"].value namenode = doc.createElement("name") namenode.appendChild(doc.createTextNode(name)) modinfo.appendChild(namenode) type = moddecl.attributes.get("type") if type: type = type.value modinfo.appendChild(doc.createTextNode("\n ")) typenode = doc.createElement("type") typenode.appendChild(doc.createTextNode(type)) modinfo.appendChild(typenode) versionadded = extract_first_element(section, "versionadded") if versionadded: modinfo.setAttribute("added", versionadded.getAttribute("version")) title = get_first_element(section, "title") if title: children = title.childNodes if len(children) >= 2 \ and children[0].nodeName == "module" \ and children[0].childNodes[0].data == name: # this is it; morph the <title> into <short-synopsis> first_data = children[1] if first_data.data[:4] == " ---": first_data.data = string.lstrip(first_data.data[4:]) set_tagName(title, "short-synopsis") if children[-1].nodeType == TEXT \ and children[-1].data[-1:] == ".": children[-1].data = children[-1].data[:-1] section.removeChild(title) section.removeChild(section.childNodes[0]) title.removeChild(children[0]) modinfo_pos = 0 else: ewrite("module name in title doesn't match" " <declaremodule/>; no <short-synopsis/>\n") else: ewrite("Unexpected condition: <section/> without <title/>\n") modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(node) if title and not contents_match(title, node): # The short synopsis is actually different, # and needs to be stored: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(title) if modauthor: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(modauthor) if platform: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(platform) modinfo.appendChild(doc.createTextNode("\n ")) section.insertBefore(modinfo, section.childNodes[modinfo_pos]) section.insertBefore(doc.createTextNode("\n "), modinfo) # # The rest of this removes extra newlines from where we cut out # a lot of elements. A lot of code for minimal value, but keeps # keeps the generated *ML from being too funny looking. # section.normalize() children = section.childNodes for i in range(len(children)): node = children[i] if node.nodeName == "moduleinfo": nextnode = children[i+1] if nextnode.nodeType == TEXT: data = nextnode.data if len(string.lstrip(data)) < (len(data) - 4): nextnode.data = "\n\n\n" + string.lstrip(data)
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
if string.strip(child.data):
if child.data.strip():
def fixup_table(doc, table): # create the table head thead = doc.createElement("thead") row = doc.createElement("row") move_elements_by_name(doc, table, row, "entry") thead.appendChild(doc.createTextNode("\n ")) thead.appendChild(row) thead.appendChild(doc.createTextNode("\n ")) # create the table body tbody = doc.createElement("tbody") prev_row = None last_was_hline = 0 children = table.childNodes for child in children: if child.nodeType == ELEMENT: tagName = child.tagName if tagName == "hline" and prev_row is not None: prev_row.setAttribute("rowsep", "1") elif tagName == "row": prev_row = child # save the rows: tbody.appendChild(doc.createTextNode("\n ")) move_elements_by_name(doc, table, tbody, "row", sep="\n ") # and toss the rest: while children: child = children[0] nodeType = child.nodeType if nodeType == TEXT: if string.strip(child.data): raise ConversionError("unexpected free data in <%s>: %r" % (table.tagName, child.data)) table.removeChild(child) continue if nodeType == ELEMENT: if child.tagName != "hline": raise ConversionError( "unexpected <%s> in table" % child.tagName) table.removeChild(child) continue raise ConversionError( "unexpected %s node in table" % child.__class__.__name__) # nothing left in the <table>; add the <thead> and <tbody> tgroup = doc.createElement("tgroup") tgroup.appendChild(doc.createTextNode("\n ")) tgroup.appendChild(thead) tgroup.appendChild(doc.createTextNode("\n ")) tgroup.appendChild(tbody) tgroup.appendChild(doc.createTextNode("\n ")) table.appendChild(tgroup) # now make the <entry>s look nice: for row in table.getElementsByTagName("row"): fixup_row(doc, row)
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
pos = string.find(child.data, "\n\n")
pos = child.data.find("\n\n")
def build_para(doc, parent, start, i): children = parent.childNodes after = start + 1 have_last = 0 BREAK_ELEMENTS = PARA_LEVEL_ELEMENTS + RECURSE_INTO_PARA_CONTAINERS # Collect all children until \n\n+ is found in a text node or a # member of BREAK_ELEMENTS is found. for j in range(start, i): after = j + 1 child = children[j] nodeType = child.nodeType if nodeType == ELEMENT: if child.tagName in BREAK_ELEMENTS: after = j break elif nodeType == TEXT: pos = string.find(child.data, "\n\n") if pos == 0: after = j break if pos >= 1: child.splitText(pos) break else: have_last = 1 if (start + 1) > after: raise ConversionError( "build_para() could not identify content to turn into a paragraph") if children[after - 1].nodeType == TEXT: # we may need to split off trailing white space: child = children[after - 1] data = child.data if string.rstrip(data) != data: have_last = 0 child.splitText(len(string.rstrip(data))) para = doc.createElement(PARA_ELEMENT) prev = None indexes = range(start, after) indexes.reverse() for j in indexes: node = parent.childNodes[j] parent.removeChild(node) para.insertBefore(node, prev) prev = node if have_last: parent.appendChild(para) parent.appendChild(doc.createTextNode("\n\n")) return len(parent.childNodes) else: nextnode = parent.childNodes[start] if nextnode.nodeType == TEXT: if nextnode.data and nextnode.data[0] != "\n": nextnode.data = "\n" + nextnode.data else: newnode = doc.createTextNode("\n") parent.insertBefore(newnode, nextnode) nextnode = newnode start = start + 1 parent.insertBefore(para, nextnode) return start + 1
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
if string.rstrip(data) != data:
if data.rstrip() != data:
def build_para(doc, parent, start, i): children = parent.childNodes after = start + 1 have_last = 0 BREAK_ELEMENTS = PARA_LEVEL_ELEMENTS + RECURSE_INTO_PARA_CONTAINERS # Collect all children until \n\n+ is found in a text node or a # member of BREAK_ELEMENTS is found. for j in range(start, i): after = j + 1 child = children[j] nodeType = child.nodeType if nodeType == ELEMENT: if child.tagName in BREAK_ELEMENTS: after = j break elif nodeType == TEXT: pos = string.find(child.data, "\n\n") if pos == 0: after = j break if pos >= 1: child.splitText(pos) break else: have_last = 1 if (start + 1) > after: raise ConversionError( "build_para() could not identify content to turn into a paragraph") if children[after - 1].nodeType == TEXT: # we may need to split off trailing white space: child = children[after - 1] data = child.data if string.rstrip(data) != data: have_last = 0 child.splitText(len(string.rstrip(data))) para = doc.createElement(PARA_ELEMENT) prev = None indexes = range(start, after) indexes.reverse() for j in indexes: node = parent.childNodes[j] parent.removeChild(node) para.insertBefore(node, prev) prev = node if have_last: parent.appendChild(para) parent.appendChild(doc.createTextNode("\n\n")) return len(parent.childNodes) else: nextnode = parent.childNodes[start] if nextnode.nodeType == TEXT: if nextnode.data and nextnode.data[0] != "\n": nextnode.data = "\n" + nextnode.data else: newnode = doc.createTextNode("\n") parent.insertBefore(newnode, nextnode) nextnode = newnode start = start + 1 parent.insertBefore(para, nextnode) return start + 1
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
child.splitText(len(string.rstrip(data)))
child.splitText(len(data.rstrip()))
def build_para(doc, parent, start, i): children = parent.childNodes after = start + 1 have_last = 0 BREAK_ELEMENTS = PARA_LEVEL_ELEMENTS + RECURSE_INTO_PARA_CONTAINERS # Collect all children until \n\n+ is found in a text node or a # member of BREAK_ELEMENTS is found. for j in range(start, i): after = j + 1 child = children[j] nodeType = child.nodeType if nodeType == ELEMENT: if child.tagName in BREAK_ELEMENTS: after = j break elif nodeType == TEXT: pos = string.find(child.data, "\n\n") if pos == 0: after = j break if pos >= 1: child.splitText(pos) break else: have_last = 1 if (start + 1) > after: raise ConversionError( "build_para() could not identify content to turn into a paragraph") if children[after - 1].nodeType == TEXT: # we may need to split off trailing white space: child = children[after - 1] data = child.data if string.rstrip(data) != data: have_last = 0 child.splitText(len(string.rstrip(data))) para = doc.createElement(PARA_ELEMENT) prev = None indexes = range(start, after) indexes.reverse() for j in indexes: node = parent.childNodes[j] parent.removeChild(node) para.insertBefore(node, prev) prev = node if have_last: parent.appendChild(para) parent.appendChild(doc.createTextNode("\n\n")) return len(parent.childNodes) else: nextnode = parent.childNodes[start] if nextnode.nodeType == TEXT: if nextnode.data and nextnode.data[0] != "\n": nextnode.data = "\n" + nextnode.data else: newnode = doc.createTextNode("\n") parent.insertBefore(newnode, nextnode) nextnode = newnode start = start + 1 parent.insertBefore(para, nextnode) return start + 1
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
shortened = string.lstrip(data)
shortened = data.lstrip()
def skip_leading_nodes(children, start=0): """Return index into children of a node at which paragraph building should begin or a recursive call to fixup_paras_helper() should be made (for subsections, etc.). When the return value >= len(children), we've built all the paras we can from this list of children. """ i = len(children) while i > start: # skip over leading comments and whitespace: child = children[start] nodeType = child.nodeType if nodeType == TEXT: data = child.data shortened = string.lstrip(data) if shortened: if data != shortened: # break into two nodes: whitespace and non-whitespace child.splitText(len(data) - len(shortened)) return start + 1 return start # all whitespace, just skip elif nodeType == ELEMENT: tagName = child.tagName if tagName in RECURSE_INTO_PARA_CONTAINERS: return start if tagName not in PARA_LEVEL_ELEMENTS + PARA_LEVEL_PRECEEDERS: return start start = start + 1 return start
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
and string.lstrip(child.data)[:3] == ">>>":
and child.data.lstrip().startswith(">>>"):
def fixup_verbatims(doc): for verbatim in find_all_elements(doc, "verbatim"): child = verbatim.childNodes[0] if child.nodeType == TEXT \ and string.lstrip(child.data)[:3] == ">>>": set_tagName(verbatim, "interactive-session")
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
fixup_trailing_whitespace(doc, { "abstract": "\n", "title": "", "chapter": "\n\n", "section": "\n\n", "subsection": "\n\n", "subsubsection": "\n\n", "paragraph": "\n\n", "subparagraph": "\n\n",
fixup_trailing_whitespace(doc, fragment, { "abstract": ("\n", "\n"), "title": ("", "\n"), "chapter": ("\n", "\n\n\n"), "section": ("\n", "\n\n\n"), "subsection": ("\n", "\n\n"), "subsubsection": ("\n", "\n\n"), "paragraph": ("\n", "\n\n"), "subparagraph": ("\n", "\n\n"), "enumeration": ("\n", "\n\n"),
def convert(ifp, ofp): events = esistools.parse(ifp) toktype, doc = events.getEvent() fragment = doc.createDocumentFragment() events.expandNode(fragment) normalize(fragment) simplify(doc, fragment) handle_labels(doc, fragment) handle_appendix(doc, fragment) fixup_trailing_whitespace(doc, { "abstract": "\n", "title": "", "chapter": "\n\n", "section": "\n\n", "subsection": "\n\n", "subsubsection": "\n\n", "paragraph": "\n\n", "subparagraph": "\n\n", }) cleanup_root_text(doc) cleanup_trailing_parens(fragment, ["function", "method", "cfunction"]) cleanup_synopses(doc, fragment) fixup_descriptors(doc, fragment) fixup_verbatims(fragment) normalize(fragment) fixup_paras(doc, fragment) fixup_sectionauthors(doc, fragment) fixup_table_structures(doc, fragment) fixup_rfc_references(doc, fragment) fixup_signatures(doc, fragment) fixup_ulink(doc, fragment) add_node_ids(fragment) fixup_refmodindexes(fragment) fixup_bifuncindexes(fragment) # Take care of ugly hacks in the LaTeX markup to avoid LaTeX and # LaTeX2HTML screwing with GNU-style long options (the '--' problem). join_adjacent_elements(fragment, "option") # d = {} for gi in events.parser.get_empties(): d[gi] = gi if d.has_key("author"): del d["author"] if d.has_key("rfc"): del d["rfc"] knownempty = d.has_key # try: write_esis(fragment, ofp, knownempty) except IOError, (err, msg): # Ignore EPIPE; it just means that whoever we're writing to stopped # reading. The rest of the output would be ignored. All other errors # should still be reported, if err != errno.EPIPE: raise
e1e96851d480a7d1acf8fd96abaeb00c195ae7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e1e96851d480a7d1acf8fd96abaeb00c195ae7b1/docfixer.py
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqdn, repr(all_host_names)))
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
def testHostnameRes(self): # Testing hostname resolution mechanisms hostname = socket.gethostname() try: ip = socket.gethostbyname(hostname) except socket.error: # Probably name lookup wasn't set up right; skip this test return self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") try: hname, aliases, ipaddrs = socket.gethostbyaddr(ip) except socket.error: # Probably a similar problem as above; skip this test return all_host_names = [hostname, hname] + aliases fqhn = socket.getfqdn() if not fqhn in all_host_names: self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqdn, repr(all_host_names)))
25ef499164c7e4e4119f1b5a7517b746b71a01a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25ef499164c7e4e4119f1b5a7517b746b71a01a2/test_socket.py
macostools.mkalias(os.path.join(sys.exec_prefix, src), dst)
do_copy = 0 if macfs.FSSpec(sys.exec_prefix).as_tuple()[0] != -1: try: import Dlg rv = Dlg.CautionAlert(ALERT_NONBOOT, None) if rv == ALERT_NONBOOT_COPY: do_copy = 1 except ImportError: pass if do_copy: macostools.copy(os.path.join(sys.exec_prefix, src), dst) else: macostools.mkalias(os.path.join(sys.exec_prefix, src), dst)
def mkcorealias(src, altsrc): import string import macostools version = string.split(sys.version)[0] dst = getextensiondirfile(src+ ' ' + version) if not os.path.exists(os.path.join(sys.exec_prefix, src)): if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): if verbose: print '*', src, 'not found' return 0 src = altsrc try: os.unlink(dst) except os.error: pass macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) if verbose: print ' ', dst, '->', src return 1
004b26b02e96db8f33797b0b8f09ee4848e33a11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/004b26b02e96db8f33797b0b8f09ee4848e33a11/ConfigurePython.py
print items[i]; i+=1
b = items[i]; i+=1
def tightloop_example(): items = range(0, 3) try: i = 0 while 1: print items[i]; i+=1 except IndexError: pass
a6afedc3ad0dabc629733ae27db699c9428b52d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a6afedc3ad0dabc629733ae27db699c9428b52d6/test_trace.py
'Expected:\n%s\nbut got:\n%s' % ( self.show(result), self.show(expect)))
'expected:\n%s\nbut got:\n%s' % ( self.show(expect), self.show(result)))
def check(self, result, expect): self.assertEquals(result, expect, 'Expected:\n%s\nbut got:\n%s' % ( self.show(result), self.show(expect)))
c8c8493fe62b16aaf2efac2a4fd3fce0e7a390ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8c8493fe62b16aaf2efac2a4fd3fce0e7a390ae/test_textwrap.py
out.write("
out.write("
typedef struct
4345da482e1be84b5663fb351690cc1ba7106857 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4345da482e1be84b5663fb351690cc1ba7106857/GenUCNHash.py
f.write('z') f.seek(0) f.seek(size) f.write('a') f.flush() if test_support.verbose: print 'check file size with os.fstat' expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1) f.close()
try: f.write('z') f.seek(0) f.seek(size) f.write('a') f.flush() if test_support.verbose: print 'check file size with os.fstat' expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1) finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
expect(f.tell(), 0) expect(f.read(1), 'z') expect(f.tell(), 1) f.seek(0) expect(f.tell(), 0) f.seek(0, 0) expect(f.tell(), 0) f.seek(42) expect(f.tell(), 42) f.seek(42, 0) expect(f.tell(), 42) f.seek(42, 1) expect(f.tell(), 84) f.seek(0, 1) expect(f.tell(), 84) f.seek(0, 2) expect(f.tell(), size + 1 + 0) f.seek(-10, 2) expect(f.tell(), size + 1 - 10) f.seek(-size-1, 2) expect(f.tell(), 0) f.seek(size) expect(f.tell(), size) expect(f.read(1), 'a') f.seek(-size-1, 1) expect(f.read(1), 'z') expect(f.tell(), 1) f.close()
try: expect(f.tell(), 0) expect(f.read(1), 'z') expect(f.tell(), 1) f.seek(0) expect(f.tell(), 0) f.seek(0, 0) expect(f.tell(), 0) f.seek(42) expect(f.tell(), 42) f.seek(42, 0) expect(f.tell(), 42) f.seek(42, 1) expect(f.tell(), 84) f.seek(0, 1) expect(f.tell(), 84) f.seek(0, 2) expect(f.tell(), size + 1 + 0) f.seek(-10, 2) expect(f.tell(), size + 1 - 10) f.seek(-size-1, 2) expect(f.tell(), 0) f.seek(size) expect(f.tell(), size) expect(f.read(1), 'a') f.seek(-size-1, 1) expect(f.read(1), 'z') expect(f.tell(), 1) finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
expect(os.lseek(f.fileno(), 0, 0), 0) expect(os.lseek(f.fileno(), 42, 0), 42) expect(os.lseek(f.fileno(), 42, 1), 84) expect(os.lseek(f.fileno(), 0, 1), 84) expect(os.lseek(f.fileno(), 0, 2), size+1+0) expect(os.lseek(f.fileno(), -10, 2), size+1-10) expect(os.lseek(f.fileno(), -size-1, 2), 0) expect(os.lseek(f.fileno(), size, 0), size) expect(f.read(1), 'a') f.close()
try: expect(os.lseek(f.fileno(), 0, 0), 0) expect(os.lseek(f.fileno(), 42, 0), 42) expect(os.lseek(f.fileno(), 42, 1), 84) expect(os.lseek(f.fileno(), 0, 1), 84) expect(os.lseek(f.fileno(), 0, 2), size+1+0) expect(os.lseek(f.fileno(), -10, 2), size+1-10) expect(os.lseek(f.fileno(), -size-1, 2), 0) expect(os.lseek(f.fileno(), size, 0), size) expect(f.read(1), 'a') finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
f.seek(0, 2) expect(f.tell(), size+1) newsize = size - 10 f.seek(newsize) f.truncate() expect(f.tell(), newsize) f.seek(0, 2) expect(f.tell(), newsize) newsize -= 1 f.seek(42) f.truncate(newsize) expect(f.tell(), 42) f.seek(0, 2) expect(f.tell(), newsize)
try: f.seek(0, 2) expect(f.tell(), size+1) newsize = size - 10 f.seek(newsize) f.truncate() expect(f.tell(), newsize) f.seek(0, 2) expect(f.tell(), newsize) newsize -= 1 f.seek(42) f.truncate(newsize) expect(f.tell(), 42) f.seek(0, 2) expect(f.tell(), newsize)
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
f.seek(0) f.truncate(1) expect(f.tell(), 0) expect(len(f.read()), 1)
f.seek(0) f.truncate(1) expect(f.tell(), 0) expect(len(f.read()), 1)
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
f.close()
finally: f.close()
def expect(got_this, expect_this): if test_support.verbose: print '%r =?= %r ...' % (got_this, expect_this), if got_this != expect_this: if test_support.verbose: print 'no' raise test_support.TestFailed, 'got %r, but expected %r' %\ (got_this, expect_this) else: if test_support.verbose: print 'yes'
ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff103ab74a6a7ae0cf2554d09fd494b02b8d8a82/test_largefile.py
self.assertEqual(binascii.a2b_qp("= "), "")
self.assertEqual(binascii.a2b_qp("= "), "= ")
def test_qp(self): # A test for SF bug 534347 (segfaults without the proper fix) try: binascii.a2b_qp("", **{1:1}) except TypeError: pass else: self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") self.assertEqual(binascii.a2b_qp("= "), "") self.assertEqual(binascii.a2b_qp("=="), "=") self.assertEqual(binascii.a2b_qp("=AX"), "=AX") self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") self.assertEqual(binascii.a2b_qp("=00\r\n=00"), "\x00\r\n\x00") self.assertEqual( binascii.b2a_qp("\xff\r\n\xff\n\xff"), "=FF\r\n=FF\r\n=FF" ) self.assertEqual( binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff"), "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" )
78b254d4629d9e4abca56ad8a5a5295b804a9d04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/78b254d4629d9e4abca56ad8a5a5295b804a9d04/test_binascii.py
l.grid(row=self.row, col=0, sticky="nw")
l.grid(row=self.row, column=0, sticky="nw")
def make_entry(self, label, var): l = Label(self.top, text=label) l.grid(row=self.row, col=0, sticky="nw") e = Entry(self.top, textvariable=var, exportselection=0) e.grid(row=self.row, col=1, sticky="nwe") self.row = self.row + 1 return e
2f2e3d01f1ead265363b6a7c9316d64e07abbdfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f2e3d01f1ead265363b6a7c9316d64e07abbdfc/SearchDialogBase.py
e.grid(row=self.row, col=1, sticky="nwe")
e.grid(row=self.row, column=1, sticky="nwe")
def make_entry(self, label, var): l = Label(self.top, text=label) l.grid(row=self.row, col=0, sticky="nw") e = Entry(self.top, textvariable=var, exportselection=0) e.grid(row=self.row, col=1, sticky="nwe") self.row = self.row + 1 return e
2f2e3d01f1ead265363b6a7c9316d64e07abbdfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f2e3d01f1ead265363b6a7c9316d64e07abbdfc/SearchDialogBase.py
l.grid(row=self.row, col=0, sticky="nw")
l.grid(row=self.row, column=0, sticky="nw")
def make_frame(self,labeltext=None): if labeltext: l = Label(self.top, text=labeltext) l.grid(row=self.row, col=0, sticky="nw") f = Frame(self.top) f.grid(row=self.row, col=1, columnspan=1, sticky="nwe") self.row = self.row + 1 return f
2f2e3d01f1ead265363b6a7c9316d64e07abbdfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f2e3d01f1ead265363b6a7c9316d64e07abbdfc/SearchDialogBase.py
f.grid(row=self.row, col=1, columnspan=1, sticky="nwe")
f.grid(row=self.row, column=1, columnspan=1, sticky="nwe")
def make_frame(self,labeltext=None): if labeltext: l = Label(self.top, text=labeltext) l.grid(row=self.row, col=0, sticky="nw") f = Frame(self.top) f.grid(row=self.row, col=1, columnspan=1, sticky="nwe") self.row = self.row + 1 return f
2f2e3d01f1ead265363b6a7c9316d64e07abbdfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f2e3d01f1ead265363b6a7c9316d64e07abbdfc/SearchDialogBase.py
f.grid(row=0,col=2,padx=2,pady=2,ipadx=2,ipady=2)
f.grid(row=0,column=2,padx=2,pady=2,ipadx=2,ipady=2)
def create_command_buttons(self): # # place button frame on the right f = self.buttonframe = Frame(self.top) f.grid(row=0,col=2,padx=2,pady=2,ipadx=2,ipady=2)
2f2e3d01f1ead265363b6a7c9316d64e07abbdfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f2e3d01f1ead265363b6a7c9316d64e07abbdfc/SearchDialogBase.py
thishost = socket.getfqdn() try: if os.environ.has_key('LOGNAME'): realuser = os.environ['LOGNAME'] elif os.environ.has_key('USER'): realuser = os.environ['USER'] else: realuser = 'anonymous' except AttributeError: realuser = 'anonymous' passwd = passwd + realuser + '@' + thishost
passwd = passwd + 'anonymous@'
def login(self, user = '', passwd = '', acct = ''): '''Login, default anonymous.''' if not user: user = 'anonymous' if not passwd: passwd = '' if not acct: acct = '' if user == 'anonymous' and passwd in ('', '-'): # get fully qualified domain name of local host thishost = socket.getfqdn() try: if os.environ.has_key('LOGNAME'): realuser = os.environ['LOGNAME'] elif os.environ.has_key('USER'): realuser = os.environ['USER'] else: realuser = 'anonymous' except AttributeError: # Not all systems have os.environ.... realuser = 'anonymous' passwd = passwd + realuser + '@' + thishost resp = self.sendcmd('USER ' + user) if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd) if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct) if resp[0] != '2': raise error_reply, resp return resp
d9933efa7e1551347e4f479da533d91f1bf4f481 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9933efa7e1551347e4f479da533d91f1bf4f481/ftplib.py
self.announce('Building RPMs') rpm_args = ['rpm',]
self.announce('building RPMs') rpm_cmd = ['rpm']
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
rpm_args.append('-bs')
rpm_cmd.append('-bs')
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
rpm_args.append('-bb')
rpm_cmd.append('-bb')
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
rpm_args.append('-ba')
rpm_cmd.append('-ba')
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
rpm_args.extend(['--define',
rpm_cmd.extend(['--define',
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
rpm_args.append('--clean') rpm_args.append(spec_path) self.spawn(rpm_args)
rpm_cmd.append('--clean') rpm_cmd.append(spec_path) self.spawn(rpm_cmd)
def run (self):
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
def_build = 'env CFLAGS="$RPM_OPT_FLAGS" python setup.py build' else: def_build = 'python setup.py build'
def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ]
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
"python setup.py install " "--root=$RPM_BUILD_ROOT " "--record=INSTALLED_FILES"),
("%s setup.py install " "--root=$RPM_BUILD_ROOT " "--record=INSTALLED_FILES") % self.python),
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ]
742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/742f4c9a5d5b54c907d463255f31d9fcfa1f2ce9/bdist_rpm.py
if (os.path.exists('Modules/_curses_panel.c') and module_enabled(exts, '_curses') and
if (module_enabled(exts, '_curses') and
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
a2da3b29c303d06ff9efc08ef57a42cf0ba658f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a2da3b29c303d06ff9efc08ef57a42cf0ba658f8/setup.py
otherwise return - (the signal that killed it). """
otherwise return -SIG, where SIG is the signal that killed it. """
def spawnv(mode, file, args): """spawnv(mode, file, args) -> integer
f59a3d3a833649dc24e836f5477461f77a3b6f79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f59a3d3a833649dc24e836f5477461f77a3b6f79/os.py
self.assertRaises(TypeError, u'hello'.count, 42)
self.assertRaises(TypeError, u'hello'.title, 42)
def test_title(self): self.checkmethod('title', u' hello ', u' Hello ') self.checkmethod('title', u'Hello ', u'Hello ') self.checkmethod('title', u'hello ', u'Hello ') self.checkmethod('title', u"fOrMaT thIs aS titLe String", u'Format This As Title String') self.checkmethod('title', u"fOrMaT,thIs-aS*titLe;String", u'Format,This-As*Title;String') self.checkmethod('title', u"getInt", u'Getint')
1a96f22da87ede904d7b5dc167ad9dba6e0161cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1a96f22da87ede904d7b5dc167ad9dba6e0161cb/test_unicode.py
def writelines(self, list): self.write(''.join(list))
def writelines(self, iterable): write = self.write for line in iterable: write(line)
def writelines(self, list): self.write(''.join(list))
6e4f346de768868055382c814492cdcd487d75b6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e4f346de768868055382c814492cdcd487d75b6/StringIO.py
if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08/asyncore.py
socket.SOL_SOCKET, reuse_constant,
socket.SOL_SOCKET, socket.SO_REUSEADDR,
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08/asyncore.py
reuse_constant) | 1
socket.SO_REUSEADDR) | 1
def set_reuse_addr(self): # try to re-use a server port if possible try: # Windows SO_REUSEADDR is very broken (from a unixy perspective) if sys.platform == 'win32': reuse_constant = socket.SO_EXCLUSIVEADDRUSE else: reuse_constant = socket.SO_REUSEADDR
df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/df0cad0160fdd119e13bfe8b3ae6c6469e4f4a08/asyncore.py
global DEBUG
def poll (timeout=0.0, map=None): global DEBUG if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): if obj.readable(): r.append (fd) if obj.writable(): w.append (fd) r,w,e = select.select (r,w,e, timeout) if DEBUG: print r,w,e for fd in r: try: obj = map[fd] except KeyError: continue try: obj.handle_read_event() except ExitNow: raise ExitNow except: obj.handle_error() for fd in w: try: obj = map[fd] except KeyError: continue try: obj.handle_write_event() except ExitNow: raise ExitNow except: obj.handle_error()
ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f/asyncore.py
r,w,e = select.select (r,w,e, timeout)
try: r,w,e = select.select (r,w,e, timeout) except select.error, err: if err[0] != EINTR: raise
def poll (timeout=0.0, map=None): global DEBUG if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.items(): if obj.readable(): r.append (fd) if obj.writable(): w.append (fd) r,w,e = select.select (r,w,e, timeout) if DEBUG: print r,w,e for fd in r: try: obj = map[fd] except KeyError: continue try: obj.handle_read_event() except ExitNow: raise ExitNow except: obj.handle_error() for fd in w: try: obj = map[fd] except KeyError: continue try: obj.handle_write_event() except ExitNow: raise ExitNow except: obj.handle_error()
ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f/asyncore.py
r = pollster.poll (timeout)
try: r = pollster.poll (timeout) except select.error, err: if err[0] != EINTR: raise r = []
def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.items(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) r = pollster.poll (timeout) for fd, flags in r: try: obj = map[fd] except KeyError: continue try: if (flags & select.POLLIN): obj.handle_read_event() if (flags & select.POLLOUT): obj.handle_write_event() except ExitNow: raise ExitNow except: obj.handle_error()
ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f/asyncore.py
self.__dict__['socket'] = sock
self.socket = sock
def set_socket (self, sock, map=None): self.__dict__['socket'] = sock self._fileno = sock.fileno() self.add_channel (map)
ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ac0aed1c3f79b76bc0826eed6ac8ae0955a0794f/asyncore.py
if os.environ.has_key('CFLAGS'): extra_args.extend(string.split(os.environ['CFLAGS']))
for undef in ext.undef_macros: macros.append((undef,))
bf41dfc15395212bb4b33d495228cdc6b32d5297 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf41dfc15395212bb4b33d495228cdc6b32d5297/build_ext.py
for undef in ext.undef_macros: macros.append((undef,))
bf41dfc15395212bb4b33d495228cdc6b32d5297 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf41dfc15395212bb4b33d495228cdc6b32d5297/build_ext.py
print testtar
def path(path): return test_support.findfile(path)
2fba3679b0d92fbc130cf51ece85a9db92dbb8c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fba3679b0d92fbc130cf51ece85a9db92dbb8c3/test_tarfile.py
state = [kThemeStateActive, kThemeStateInactive][not onoff] App.DrawThemeListBoxFrame(Qd.InsetRect(self._bounds, 1, 1), state)
def activate(self, onoff): self._activated = onoff if self._visible: self._list.LActivate(onoff) state = [kThemeStateActive, kThemeStateInactive][not onoff] App.DrawThemeListBoxFrame(Qd.InsetRect(self._bounds, 1, 1), state) if self._selected: self.drawselframe(onoff)
43cea304a8f0e7986bc8f1e1feb8cc608e792c7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43cea304a8f0e7986bc8f1e1feb8cc608e792c7a/Wlists.py
if (not check_intermediate) or len(plist) < 2:
if not check_intermediate:
def __init__(self, master, name, destroy_physically=1, check_intermediate=1): if check_intermediate: path = master._subwidget_name(name) try: path = path[len(master._w)+1:] plist = path.split('.') except: plist = []
42dabb86e35d06f7e575f35def42dbf3dbec7167 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42dabb86e35d06f7e575f35def42dbf3dbec7167/Tix.py
self.file = self.make_file('')
self.file = self.__file = StringIO()
def read_lines(self): """Internal: read lines until EOF or outerboundary.""" self.file = self.make_file('') if self.outerboundary: self.read_lines_to_outerboundary() else: self.read_lines_to_eof()
9f92bf9e5f618782db742393dbb8c7738b9d372c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f92bf9e5f618782db742393dbb8c7738b9d372c/cgi.py
self.file.write(line)
self.__write(line)
def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: line = self.fp.readline() if not line: self.done = -1 break self.file.write(line)
9f92bf9e5f618782db742393dbb8c7738b9d372c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f92bf9e5f618782db742393dbb8c7738b9d372c/cgi.py
self.file.write(odelim + line)
self.__write(odelim + line)
def read_lines_to_outerboundary(self): """Internal: read lines until outerboundary.""" next = "--" + self.outerboundary last = next + "--" delim = "" while 1: line = self.fp.readline() if not line: self.done = -1 break if line[:2] == "--": strippedline = line.strip() if strippedline == next: break if strippedline == last: self.done = 1 break odelim = delim if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] elif line[-1] == "\n": delim = "\n" line = line[:-1] else: delim = "" self.file.write(odelim + line)
9f92bf9e5f618782db742393dbb8c7738b9d372c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9f92bf9e5f618782db742393dbb8c7738b9d372c/cgi.py
result = self.__class__([])
result = self.__class__()
def copy(self): """Return a shallow copy of a set.""" result = self.__class__([]) result._data.update(self._data) return result
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
result = self.__class__([])
result = self.__class__()
def __deepcopy__(self, memo): """Return a deep copy of a set; used by copy module.""" # This pre-creates the result and inserts it in the memo # early, in case the deep copy recurses into another reference # to this same set. A set can't be an element of itself, but # it can certainly contain an object that has a reference to # itself. from copy import deepcopy result = self.__class__([]) memo[id(self)] = result data = result._data value = True for elt in self: data[deepcopy(elt, memo)] = value return result
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
result = self.__class__([])
result = self.__class__()
def __and__(self, other): """Return the intersection of two sets as a new set.
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
result = self.__class__([])
result = self.__class__()
def __xor__(self, other): """Return the symmetric difference of two sets as a new set.
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
result = self.__class__([])
result = self.__class__()
def __sub__(self, other): """Return the difference of two sets as a new Set.
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
class _TemporarilyImmutableSet(object):
class _TemporarilyImmutableSet(BaseSet):
def _as_temporarily_immutable(self): # Return self wrapped in a temporarily immutable set return _TemporarilyImmutableSet(self)
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
def __eq__(self, other): return self._set == other def __ne__(self, other): return self._set != other def _test(): red = Set() assert `red` == "Set([])", "Empty set: %s" % `red` green = Set((0,)) assert `green` == "Set([0])", "Unit set: %s" % `green` blue = Set([0, 1, 2]) assert blue._repr(True) == "Set([0, 1, 2])", "3-element set: %s" % `blue` black = Set([0, 5]) assert black._repr(True) == "Set([0, 5])", "2-element set: %s" % `black` white = Set([0, 1, 2, 5]) assert white._repr(True) == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` red.add(9) assert `red` == "Set([9])", "Add to empty set: %s" % `red` red.remove(9) assert `red` == "Set([])", "Remove from unit set: %s" % `red` try: red.remove(0) assert 0, "Remove element from empty set: %s" % `red` except LookupError: pass assert len(red) == 0, "Length of empty set" assert len(green) == 1, "Length of unit set" assert len(blue) == 3, "Length of 3-element set" assert green == Set([0]), "Equality failed" assert green != Set([1]), "Inequality failed" assert blue | red == blue, "Union non-empty with empty" assert red | blue == blue, "Union empty with non-empty" assert green | blue == blue, "Union non-empty with non-empty" assert blue | black == white, "Enclosing union" assert blue & red == red, "Intersect non-empty with empty" assert red & blue == red, "Intersect empty with non-empty" assert green & blue == green, "Intersect non-empty with non-empty" assert blue & black == green, "Enclosing intersection" assert red ^ green == green, "Empty symdiff non-empty" assert green ^ blue == Set([1, 2]), "Non-empty symdiff" assert white ^ white == red, "Self symdiff" assert red - green == red, "Empty - non-empty" assert blue - red == blue, "Non-empty - empty" assert white - black == Set([1, 2]), "Non-empty - non-empty" orange = Set([]) orange |= Set([1]) assert orange == Set([1]), "In-place union" orange = Set([1, 2]) orange &= Set([2]) assert orange == Set([2]), "In-place intersection" orange = Set([1, 2, 3]) orange -= Set([2, 4]) assert orange == Set([1, 3]), "In-place difference" orange = Set([1, 2, 3]) orange ^= Set([3, 4]) assert orange == Set([1, 2, 4]), "In-place symmetric difference" print "All tests passed" if __name__ == "__main__": _test()
def __hash__(self): if self._hashcode is None: self._hashcode = self._set._compute_hash() return self._hashcode
18952fe218a31e2eef50fe38038baad8fa07c355 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18952fe218a31e2eef50fe38038baad8fa07c355/sets.py
if n > self.maxlist: s = s + ', ...'
if n > self.maxdict: s = s + ', ...'
def repr_dictionary(self, x, level): n = len(x) if n == 0: return '{}' if level <= 0: return '{...}' s = '' keys = x.keys() keys.sort() for i in range(min(n, self.maxdict)): if s: s = s + ', ' key = keys[i] s = s + self.repr1(key, level-1) s = s + ': ' + self.repr1(x[key], level-1) if n > self.maxlist: s = s + ', ...' return '{' + s + '}'
bf26a2856c046664bc9edc6be5e16f1759bc776f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bf26a2856c046664bc9edc6be5e16f1759bc776f/repr.py
for option in options: yield (option, d[option])
return [(option, d[option]) for option in options]
def items(self, section, raw=False, vars=None): """Return a list of tuples with (name, value) for each option in the section.
a560b850f17ed7b36e3c373b318e9462badb63a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a560b850f17ed7b36e3c373b318e9462badb63a9/ConfigParser.py
for option in options: yield (option, self._interpolate(section, option, d[option], d))
return [(option, self._interpolate(section, option, d[option], d)) for option in options]
def items(self, section, raw=False, vars=None): """Return a list of tuples with (name, value) for each option in the section.
a560b850f17ed7b36e3c373b318e9462badb63a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a560b850f17ed7b36e3c373b318e9462badb63a9/ConfigParser.py
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0/test_array.py
testtype('u', u'\u263a')
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0/test_array.py
testunicode() testsubclassing()
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e810214ce1e279f9c5e7a87fdaa44ca7b3bec2d0/test_array.py
def seek(self): raise IOError, 'Random access not allowed in gzip files' def tell(self): raise IOError, 'I won\'t tell() you for gzip files'
def flush(self): self.fileobj.flush()
c8facd1dc6aa2ebaaf4aef18d7bc593cec2dd675 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8facd1dc6aa2ebaaf4aef18d7bc593cec2dd675/gzip.py
import string PATH = string.splitfields(envpath, pathsep)
PATH = envpath.split(pathsep)
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath import string PATH = string.splitfields(envpath, pathsep) if not _notfound: import tempfile # Exec a file that is guaranteed not to exist try: execv(tempfile.mktemp(), ()) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
import string
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath import string PATH = string.splitfields(envpath, pathsep) if not _notfound: import tempfile # Exec a file that is guaranteed not to exist try: execv(tempfile.mktemp(), ()) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
upper = string.upper
def __init__(self, environ): UserDict.UserDict.__init__(self) data = self.data upper = string.upper for k, v in environ.items(): data[upper(k)] = v
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
data[upper(k)] = v
data[k.upper()] = v
def __init__(self, environ): UserDict.UserDict.__init__(self) data = self.data upper = string.upper for k, v in environ.items(): data[upper(k)] = v
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
key = string.upper(key) self.data[key] = item
self.data[key.upper()] = item
def __setitem__(self, key, item): putenv(key, item) key = string.upper(key) self.data[key] = item
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
return self.data[string.upper(key)]
return self.data[key.upper()] def __delitem__(self, key): del self.data[key.upper()]
def __getitem__(self, key): return self.data[string.upper(key)]
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
return self.data.has_key(string.upper(key))
return self.data.has_key(key.upper()) def get(self, key, failobj=None): return self.data.get(key.upper(), failobj) def update(self, dict): for k, v in dict.items(): self[k] = v
def has_key(self, key): return self.data.has_key(string.upper(key))
e08226d768a9bdb9d47be1408ab3eab841fc2406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e08226d768a9bdb9d47be1408ab3eab841fc2406/os.py
self.tk.call(self._w, 'select', 'item')
return self.tk.call(self._w, 'select', 'item') or None
def select_item(self): """Return the item which has the selection.""" self.tk.call(self._w, 'select', 'item')
c484d2b18310bdb55094db3fb2c2a950fed7512c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c484d2b18310bdb55094db3fb2c2a950fed7512c/Tkinter.py
def wm_state(self): """Return the state of this widget as one of normal, icon, iconic (see wm_iconwindow) and withdrawn.""" return self.tk.call('wm', 'state', self._w)
def wm_state(self, newstate=None): """Query or set the state of this widget as one of normal, icon, iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).""" return self.tk.call('wm', 'state', self._w, newstate)
def wm_state(self): """Return the state of this widget as one of normal, icon, iconic (see wm_iconwindow) and withdrawn.""" return self.tk.call('wm', 'state', self._w)
c0862ffa1aa078b395cfc792356d13590486ce0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0862ffa1aa078b395cfc792356d13590486ce0c/Tkinter.py
self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae')
self.assertEquals(ef.read(), '\\\xd5\n\x00\x00\xae')
def test_basic(self): f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae')
de05075bef70b68155b48f2a0d36e84a34350a72 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/de05075bef70b68155b48f2a0d36e84a34350a72/test_codecs.py
err('usage: classfix file-or-directory ...\n')
err('usage: ' + argv[0] + ' file-or-directory ...\n')
def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: classfix file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if path.isdir(arg): if recursedown(arg): bad = 1 elif path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad)
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
ispython = regexp.compile('^[a-zA-Z0-9_]+\.py$').match
ispythonprog = regex.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0
def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: classfix file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if path.isdir(arg): if recursedown(arg): bad = 1 elif path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad)
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
if recursedown(fullname): bad = 1
subdirs.append(fullname)
def recursedown(dirname): dbg('recursedown(' + `dirname` + ')\n') bad = 0 try: names = posix.listdir(dirname) except posix.error, msg: err(dirname + ': cannot list directory: ' + `msg` + '\n') return 1 for name in names: if name in ('.', '..'): continue fullname = path.join(dirname, name) if path.islink(fullname): pass elif path.isdir(fullname): if recursedown(fullname): bad = 1 elif ispython(name): if fix(fullname): bad = 1 return bad
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
classexpr = '^([ \t]*class +[a-zA-Z0-9_]+) *\( *\) *((=.*)?):' findclass = regexp.compile(classexpr).match baseexpr = '^ *(.*) *\( *\) *$' findbase = regexp.compile(baseexpr).match
def recursedown(dirname): dbg('recursedown(' + `dirname` + ')\n') bad = 0 try: names = posix.listdir(dirname) except posix.error, msg: err(dirname + ': cannot list directory: ' + `msg` + '\n') return 1 for name in names: if name in ('.', '..'): continue fullname = path.join(dirname, name) if path.islink(fullname): pass elif path.isdir(fullname): if recursedown(fullname): bad = 1 elif ispython(name): if fix(fullname): bad = 1 return bad
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
dbg('fix(' + `filename` + ')\n')
def fix(filename):
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
tf = None
g = None
def fix(filename):
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
res = findclass(line) if not res: if tf: tf.write(line) continue if not tf: try: tf = open(tempname, 'w') except IOError, msg: f.close() err(tempname+': cannot create: '+`msg`+'\n') return 1 rep(filename + ':\n') f.seek(0) continue a0, b0 = res[0] a1, b1 = res[1] a2, b2 = res[2] head = line[:b1] tail = line[b0:] if a2 = b2: newline = head + ':' + tail else: basepart = line[a2+1:b2] bases = string.splitfields(basepart, ',') for i in range(len(bases)): res = findbase(bases[i]) if res: (x0, y0), (x1, y1) = res bases[i] = bases[i][x1:y1] basepart = string.joinfields(bases, ', ') newline = head + '(' + basepart + '):' + tail rep('< ' + line) rep('> ' + newline) tf.write(newline)
lineno = lineno + 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err(tempname+': cannot create: '+\ `msg`+'\n') return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue rep(`lineno` + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline)
def fix(filename):
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
if not tf: return 0
if not g: return 0
def fix(filename):
b84614f43186fc92896afc304f85cdb7961cf46b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b84614f43186fc92896afc304f85cdb7961cf46b/classfix.py
exts.append( Extension('pwd', ['pwdmodule.c']) ) exts.append( Extension('grp', ['grpmodule.c']) )
if platform not in ['mac']: exts.append( Extension('pwd', ['pwdmodule.c']) ) exts.append( Extension('grp', ['grpmodule.c']) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
081563166713aac056a0230633f21a332e43c91d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/081563166713aac056a0230633f21a332e43c91d/setup.py
if platform not in ['atheos']:
if platform not in ['atheos', 'mac']:
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
081563166713aac056a0230633f21a332e43c91d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/081563166713aac056a0230633f21a332e43c91d/setup.py