rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
menubar.Append(menu2, "&Debug")
def __init__ (self,parent,ID,title,pos=wx.DefaultPosition,size=wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE | wx.VSCROLL | wx.HSCROLL, name = "frame"): wx.MDIParentFrame.__init__(self,parent,ID,title,pos,size,style) self.winCount = 0
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
self.Bind(wx.EVT_MENU, self.OnAccelF2, id=ID_AccelF2) self.Bind(wx.EVT_MENU, self.OnAccelF3, id=ID_AccelF3) self.Bind(wx.EVT_MENU, self.OnAccelF4, id=ID_AccelF4) self.Bind(wx.EVT_MENU, self.OnAccelF5, id=ID_AccelF5) self.Bind(wx.EVT_MENU, self.OnAccelF6, id=ID_AccelF6) self.Bind(wx.EVT_MENU, self.OnAccelF7, id=ID_AccelF7) self.Bind(wx.EVT_MENU, self.OnAccelF8, id=ID_AccelF8) self.Bind(wx.EVT_MENU, self.OnAccelF9, id=ID_AccelF9) self.Bind(wx.EVT_MENU, self.OnAccelF10, id=ID_AccelF10) self.Bind(wx.EVT_MENU, self.OnAccelF11, id=ID_AccelF11) self.Bind(wx.EVT_MENU, self.OnAccelF12, id=ID_AccelF12)
def __init__ (self,parent,ID,title,pos=wx.DefaultPosition,size=wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE | wx.VSCROLL | wx.HSCROLL, name = "frame"): wx.MDIParentFrame.__init__(self,parent,ID,title,pos,size,style) self.winCount = 0
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F2,ID_AccelF2)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F3,ID_AccelF3)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F4,ID_AccelF4)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F5,ID_AccelF5)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F6,ID_AccelF6)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F7,ID_AccelF7)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F8,ID_AccelF8)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F9,ID_AccelF9)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F10,ID_AccelF10)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F11,ID_AccelF11)) accelTableEntries.append(wx.AcceleratorEntry(wx.ACCEL_NORMAL,wx.WXK_F12,ID_AccelF12))
def __init__ (self,parent,ID,title,pos=wx.DefaultPosition,size=wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE | wx.VSCROLL | wx.HSCROLL, name = "frame"): wx.MDIParentFrame.__init__(self,parent,ID,title,pos,size,style) self.winCount = 0
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
self.OpenFile("C:\\Documents and Settings\\golinvauxb\\Bureau\\____FOR SCWIN USERS____\\STUFF TO TRY\\test808.sc") self.OpenFile("C:\\Documents and Settings\\golinvauxb\\Bureau\\____FOR SCWIN USERS____\\STUFF TO TRY\\test1.sc") self.OpenFile("C:\\Documents and Settings\\golinvauxb\\Bureau\\____FOR SCWIN USERS____\\STUFF TO TRY\\midi in test.sc")
self.OpenFile("C:\\SOMEWHERE\\test.sc")
def __init__ (self,parent,ID,title,pos=wx.DefaultPosition,size=wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE | wx.VSCROLL | wx.HSCROLL, name = "frame"): wx.MDIParentFrame.__init__(self,parent,ID,title,pos,size,style) self.winCount = 0
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
else :
else:
def OpenFile(self,path): child = self.GetActiveChild() if child == None: maximizeNewWindow = False else: maximizeNewWindow = child.IsMaximized() file = open(path ,"r") textContent = file.read() file.close() if textContent[0:5] == '{\\rtf': win = self.OnNewRTFWindow(None) win.rtfSubWin.LoadFile(path) courierFont = wx.Font(10,wx.MODERN,wx.NORMAL,wx.NORMAL,False,"Courier New") textAttr = wx.TextAttr(wx.NullColour, wx.NullColour, courierFont) textAttr.SetFlags(wx.TEXT_ATTR_FONT_SIZE) #win.rtfSubWin.SetStyle(0,win.rtfSubWin.GetLastPosition(), textAttr) # we first need to convert rtf to something better... #win = self.OnNewCodeWindow(None) #newTextContent = PySCLang.Rtf2Ascii(textContent) <--- this looks very bad #win.codeSubWin.AddText(newTextContent) else : win = self.OnNewCodeWindow(None) win.codeSubWin.AddText(textContent) win.originalFilePath = path win.SetTitle(path) if maximizeNewWindow : win.Maximize(True) win.isModified = 0 win.SetSubWinFocus() return win
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
self.OnSaveFileInWin(evt,activeWin)
self.OnSaveFileInWin(evt,activeWin)
def OnSaveFile(self,evt): activeWin = self.GetActiveChild( ); self.OnSaveFileInWin(evt,activeWin) # yssr
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
if activeWin == self.logWin: return None
if activeWin == self.logWin: return None
def OnSaveFileInWin(self,evt,activeWin): if activeWin == self.logWin: return None # yssr if activeWin == None: # TODO : disable menu items dynamically instead wx.MessageBox("ERROR : No document is active") else: # fileDlg = wx.FileDialog(self,style=wx.SAVE) path = activeWin.originalFilePath # path = fileDlg.GetPath() if path == "": self.OnSaveFileAsInWin(evt,activeWin) else: file = open(path ,"w" ) content = activeWin.codeSubWin.GetText() file.write(content) file.close() activeWin.SetTitle(path) # yssr activeWin.isModified = 0 # yssr
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
def OnAccelF2(self,evt): self.OnArrangeWindows(evt) def OnAccelF3(self,evt): wx.MessageBox("OnAccelF3") def OnAccelF4(self,evt): wx.MessageBox("OnAccelF4") def OnAccelF5(self,evt): wx.MessageBox("OnAccelF5") def OnAccelF6(self,evt): wx.MessageBox("OnAccelF6") def OnAccelF7(self,evt): wx.MessageBox("OnAccelF7") def OnAccelF8(self,evt): wx.MessageBox("OnAccelF8") def OnAccelF9(self,evt): wx.MessageBox("OnAccelF9") def OnAccelF10(self,evt): wx.MessageBox("OnAccelF10") def OnAccelF11(self,evt): wx.MessageBox("OnAccelF11") def OnAccelF12(self,evt): wx.MessageBox("OnAccelF12")
def OnAccelF2(self,evt): #wx.MessageBox("OnAccelF2") self.OnArrangeWindows(evt)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
def OnCloseWindow(self, event): # TODO : make sure users are asked to save docs !!! deal with rtf file saving shouldVeto = 0 for win in self.GetChildren(): if type(win) == PsycolliderCodeWin: if not self.IsAllowedToCloseWindow(win): shouldVeto = 1 break if shouldVeto: event.Veto() else: self.Destroy()
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
if sel == "-" : sel = "subtraction" elif sel == "/" : sel = "division" elif sel == "*" : sel = "(W32) multiplication" elif sel == "**": sel = "(W32) exponentiation" elif sel == "<" : sel = "(W32) less than" elif sel == "<=": sel = "(W32) less than or equal" elif sel == ">" : sel = "(W32) greater than" elif sel == ">=": sel = "(W32) greater than or equal"
if sel == "-" : sel = "subtraction" elif sel == "/" : sel = "division" elif sel == "*" : sel = "multiplication" elif sel == "**": sel = "exponentiation" elif sel == "<" : sel = "lessthan" elif sel == "<=": sel = "lessthanorequal" elif sel == ">" : sel = "greaterthan" elif sel == ">=": sel = "greaterthanorequal"
def GoToHelpFile(self): # TODO : test this : most help files don't open. remove trailing and leading spaces from sel, too, since wxTextCtrl is behaving strangely activeChild = self.GetActiveChild() if not activeChild == self.logWin: # yssr sel = string.strip(str(activeChild.GetSelectedText())) else : sel = "" # yssr foundFilePath = "" filePath = "" if sel == "-" : sel = "subtraction" # "subtraction.rtf" elif sel == "/" : sel = "division" # "division.rtf" elif sel == "*" : sel = "(W32) multiplication" # from "*.rtf" elif sel == "**": sel = "(W32) exponentiation" # from "**.rtf" elif sel == "<" : sel = "(W32) less than" # from "<.rtf" elif sel == "<=": sel = "(W32) less than or equal" # from "<=.rtf" elif sel == ">" : sel = "(W32) greater than" # from ">.rtf" elif sel == ">=": sel = "(W32) greater than or equal" # from ">=.rtf" if sel != "": for helpFolder in [gHelpFolder, os.path.expanduser(gUserExtensionFolder)]: for folderPath, foldersInPath, fileNamesInFolder in os.walk(helpFolder): # don't visit CVS directories if 'CVS' in foldersInPath: foldersInPath.remove('CVS') for fileName in fileNamesInFolder: filePath = os.path.join(folderPath, fileName) if fileName == sel + ".help.rtf": foundFilePath = filePath break if fileName == sel + ".rtf": foundFilePath = filePath break # for fileName # if file is found, let's break if foundFilePath != "": break # for folderPath, .... # if file is found, let's break if foundFilePath != "": break if foundFilePath == "": foundFilePath = os.path.join(gHelpFolder,"Help.help.rtf") self.OpenFile(foundFilePath)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
def GoToHelpFile(self): # TODO : test this : most help files don't open. remove trailing and leading spaces from sel, too, since wxTextCtrl is behaving strangely activeChild = self.GetActiveChild() if not activeChild == self.logWin: # yssr sel = string.strip(str(activeChild.GetSelectedText())) else : sel = "" # yssr foundFilePath = "" filePath = "" if sel == "-" : sel = "subtraction" # "subtraction.rtf" elif sel == "/" : sel = "division" # "division.rtf" elif sel == "*" : sel = "(W32) multiplication" # from "*.rtf" elif sel == "**": sel = "(W32) exponentiation" # from "**.rtf" elif sel == "<" : sel = "(W32) less than" # from "<.rtf" elif sel == "<=": sel = "(W32) less than or equal" # from "<=.rtf" elif sel == ">" : sel = "(W32) greater than" # from ">.rtf" elif sel == ">=": sel = "(W32) greater than or equal" # from ">=.rtf" if sel != "": for helpFolder in [gHelpFolder, os.path.expanduser(gUserExtensionFolder)]: for folderPath, foldersInPath, fileNamesInFolder in os.walk(helpFolder): # don't visit CVS directories if 'CVS' in foldersInPath: foldersInPath.remove('CVS') for fileName in fileNamesInFolder: filePath = os.path.join(folderPath, fileName) if fileName == sel + ".help.rtf": foundFilePath = filePath break if fileName == sel + ".rtf": foundFilePath = filePath break # for fileName # if file is found, let's break if foundFilePath != "": break # for folderPath, .... # if file is found, let's break if foundFilePath != "": break if foundFilePath == "": foundFilePath = os.path.join(gHelpFolder,"Help.help.rtf") self.OpenFile(foundFilePath)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
def GoToHelpFile(self): # TODO : test this : most help files don't open. remove trailing and leading spaces from sel, too, since wxTextCtrl is behaving strangely activeChild = self.GetActiveChild() if not activeChild == self.logWin: # yssr sel = string.strip(str(activeChild.GetSelectedText())) else : sel = "" # yssr foundFilePath = "" filePath = "" if sel == "-" : sel = "subtraction" # "subtraction.rtf" elif sel == "/" : sel = "division" # "division.rtf" elif sel == "*" : sel = "(W32) multiplication" # from "*.rtf" elif sel == "**": sel = "(W32) exponentiation" # from "**.rtf" elif sel == "<" : sel = "(W32) less than" # from "<.rtf" elif sel == "<=": sel = "(W32) less than or equal" # from "<=.rtf" elif sel == ">" : sel = "(W32) greater than" # from ">.rtf" elif sel == ">=": sel = "(W32) greater than or equal" # from ">=.rtf" if sel != "": for helpFolder in [gHelpFolder, os.path.expanduser(gUserExtensionFolder)]: for folderPath, foldersInPath, fileNamesInFolder in os.walk(helpFolder): # don't visit CVS directories if 'CVS' in foldersInPath: foldersInPath.remove('CVS') for fileName in fileNamesInFolder: filePath = os.path.join(folderPath, fileName) if fileName == sel + ".help.rtf": foundFilePath = filePath break if fileName == sel + ".rtf": foundFilePath = filePath break # for fileName # if file is found, let's break if foundFilePath != "": break # for folderPath, .... # if file is found, let's break if foundFilePath != "": break if foundFilePath == "": foundFilePath = os.path.join(gHelpFolder,"Help.help.rtf") self.OpenFile(foundFilePath)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
def WriteInLogWindow(text): if wx.GetApp().theMainFrame == None: sys.stdout.write(text) else: wx.GetApp().theMainFrame.logWin.logSubWin.AppendText(text)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
app.MainLoop()
app.MainLoop()
def WriteInLogWindow(text): if wx.GetApp().theMainFrame == None: sys.stdout.write(text) else: wx.GetApp().theMainFrame.logWin.logSubWin.AppendText(text)
a80838c2381f3fc8cfc375d205893d1fbbe163d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11200/a80838c2381f3fc8cfc375d205893d1fbbe163d0/Psycollider.py
elif node_check is map:
elif node_check is dict:
def add_path_resolver(cls, tag, path, kind=None): if not 'yaml_path_resolvers' in cls.__dict__: cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() new_path = [] for element in path: if isinstance(element, (list, tuple)): if len(element) == 2: node_check, index_check = element elif len(element) == 1: node_check = element[0] index_check = True else: raise ResolverError("Invalid path element: %s" % element) else: node_check = None index_check = element if node_check is str: node_check = ScalarNode elif node_check is list: node_check = SequenceNode elif node_check is map: node_check = MappingNode elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ and not isinstance(node_check, basestring) \ and node_check is not None: raise ResolverError("Invalid node checker: %s" % node_check) if not isinstance(index_check, (basestring, int)) \ and index_check is not None: raise ResolverError("Invalid index checker: %s" % index_check) new_path.append((node_check, index_check)) if kind is str: kind = ScalarNode elif kind is list: kind = SequenceNode elif kind is map: kind = MappingNode elif kind not in [ScalarNode, SequenceNode, MappingNode] \ and kind is not None: raise ResolverError("Invalid node kind: %s" % kind) cls.yaml_path_resolvers[tuple(new_path), kind] = tag
f4148283212597a594e56c22e5a869ee32e70a18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/f4148283212597a594e56c22e5a869ee32e70a18/resolver.py
elif kind is map:
elif kind is dict:
def add_path_resolver(cls, tag, path, kind=None): if not 'yaml_path_resolvers' in cls.__dict__: cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() new_path = [] for element in path: if isinstance(element, (list, tuple)): if len(element) == 2: node_check, index_check = element elif len(element) == 1: node_check = element[0] index_check = True else: raise ResolverError("Invalid path element: %s" % element) else: node_check = None index_check = element if node_check is str: node_check = ScalarNode elif node_check is list: node_check = SequenceNode elif node_check is map: node_check = MappingNode elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ and not isinstance(node_check, basestring) \ and node_check is not None: raise ResolverError("Invalid node checker: %s" % node_check) if not isinstance(index_check, (basestring, int)) \ and index_check is not None: raise ResolverError("Invalid index checker: %s" % index_check) new_path.append((node_check, index_check)) if kind is str: kind = ScalarNode elif kind is list: kind = SequenceNode elif kind is map: kind = MappingNode elif kind not in [ScalarNode, SequenceNode, MappingNode] \ and kind is not None: raise ResolverError("Invalid node kind: %s" % kind) cls.yaml_path_resolvers[tuple(new_path), kind] = tag
f4148283212597a594e56c22e5a869ee32e70a18 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/f4148283212597a594e56c22e5a869ee32e70a18/resolver.py
collection_events = None
def parse_node(self, block=False, indentless_sequence=False): if self.check_token(AliasToken): token = self.get_token() event = AliasEvent(token.value, token.start_mark, token.end_mark) self.state = self.states.pop() else: anchor = None tag = None start_mark = end_mark = tag_mark = None if self.check_token(AnchorToken): token = self.get_token() start_mark = token.start_mark end_mark = token.end_mark anchor = token.value if self.check_token(TagToken): token = self.get_token() tag_mark = token.start_mark end_mark = token.end_mark tag = token.value elif self.check_token(TagToken): token = self.get_token() start_mark = tag_mark = token.start_mark end_mark = token.end_mark tag = token.value if self.check_token(AnchorToken): token = self.get_token() end_mark = token.end_mark anchor = token.value if tag is not None and tag != u'!': handle, suffix = tag if handle is not None: if handle not in self.tag_handles: raise ParserError("while parsing a node", start_mark, "found undefined tag handle %r" % handle.encode('utf-8'), tag_mark) tag = self.tag_handles[handle]+suffix else: tag = suffix #if tag == u'!': # raise ParserError("while parsing a node", start_mark, # "found non-specific tag '!'", tag_mark, # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") if start_mark is None: start_mark = end_mark = self.peek_token().start_mark event = None collection_events = None implicit = (tag is None or tag == u'!') if indentless_sequence and self.check_token(BlockEntryToken): end_mark = self.peek_token().end_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark) self.state = self.parse_indentless_sequence_entry else: if self.check_token(ScalarToken): token = self.get_token() end_mark = token.end_mark if (token.plain and tag is None) or tag == u'!': implicit = (True, False) elif tag is None: implicit = (False, True) else: implicit = (False, False) event = ScalarEvent(anchor, tag, implicit, token.value, start_mark, end_mark, style=token.style) self.state = self.states.pop() elif self.check_token(FlowSequenceStartToken): end_mark = self.peek_token().end_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=True) self.state = self.parse_flow_sequence_first_entry elif self.check_token(FlowMappingStartToken): end_mark = self.peek_token().end_mark event = MappingStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=True) self.state = self.parse_flow_mapping_first_key elif block and self.check_token(BlockSequenceStartToken): end_mark = self.peek_token().start_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=False) self.state = self.parse_block_sequence_first_entry elif block and self.check_token(BlockMappingStartToken): end_mark = self.peek_token().start_mark event = MappingStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=False) self.state = self.parse_block_mapping_first_key elif anchor is not None or tag is not None: # Empty scalars are allowed even if a tag or an anchor is # specified. event = ScalarEvent(anchor, tag, (implicit, False), u'', start_mark, end_mark) self.state = self.states.pop() else: if block: node = 'block' else: node = 'flow' token = self.peek_token() raise ParserError("while scanning a %s node" % node, start_mark, "expected the node content, but found %r" % token.id, token.start_mark) return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
raise ParserError("while scanning a %s node" % node, start_mark,
raise ParserError("while parsing a %s node" % node, start_mark,
def parse_node(self, block=False, indentless_sequence=False): if self.check_token(AliasToken): token = self.get_token() event = AliasEvent(token.value, token.start_mark, token.end_mark) self.state = self.states.pop() else: anchor = None tag = None start_mark = end_mark = tag_mark = None if self.check_token(AnchorToken): token = self.get_token() start_mark = token.start_mark end_mark = token.end_mark anchor = token.value if self.check_token(TagToken): token = self.get_token() tag_mark = token.start_mark end_mark = token.end_mark tag = token.value elif self.check_token(TagToken): token = self.get_token() start_mark = tag_mark = token.start_mark end_mark = token.end_mark tag = token.value if self.check_token(AnchorToken): token = self.get_token() end_mark = token.end_mark anchor = token.value if tag is not None and tag != u'!': handle, suffix = tag if handle is not None: if handle not in self.tag_handles: raise ParserError("while parsing a node", start_mark, "found undefined tag handle %r" % handle.encode('utf-8'), tag_mark) tag = self.tag_handles[handle]+suffix else: tag = suffix #if tag == u'!': # raise ParserError("while parsing a node", start_mark, # "found non-specific tag '!'", tag_mark, # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") if start_mark is None: start_mark = end_mark = self.peek_token().start_mark event = None collection_events = None implicit = (tag is None or tag == u'!') if indentless_sequence and self.check_token(BlockEntryToken): end_mark = self.peek_token().end_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark) self.state = self.parse_indentless_sequence_entry else: if self.check_token(ScalarToken): token = self.get_token() end_mark = token.end_mark if (token.plain and tag is None) or tag == u'!': implicit = (True, False) elif tag is None: implicit = (False, True) else: implicit = (False, False) event = ScalarEvent(anchor, tag, implicit, token.value, start_mark, end_mark, style=token.style) self.state = self.states.pop() elif self.check_token(FlowSequenceStartToken): end_mark = self.peek_token().end_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=True) self.state = self.parse_flow_sequence_first_entry elif self.check_token(FlowMappingStartToken): end_mark = self.peek_token().end_mark event = MappingStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=True) self.state = self.parse_flow_mapping_first_key elif block and self.check_token(BlockSequenceStartToken): end_mark = self.peek_token().start_mark event = SequenceStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=False) self.state = self.parse_block_sequence_first_entry elif block and self.check_token(BlockMappingStartToken): end_mark = self.peek_token().start_mark event = MappingStartEvent(anchor, tag, implicit, start_mark, end_mark, flow_style=False) self.state = self.parse_block_mapping_first_key elif anchor is not None or tag is not None: # Empty scalars are allowed even if a tag or an anchor is # specified. event = ScalarEvent(anchor, tag, (implicit, False), u'', start_mark, end_mark) self.state = self.states.pop() else: if block: node = 'block' else: node = 'flow' token = self.peek_token() raise ParserError("while scanning a %s node" % node, start_mark, "expected the node content, but found %r" % token.id, token.start_mark) return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
raise ParserError("while scanning a block collection", self.marks[-1],
raise ParserError("while parsing a block collection", self.marks[-1],
def parse_block_sequence_entry(self): if self.check_token(BlockEntryToken): token = self.get_token() if not self.check_token(BlockEntryToken, BlockEndToken): self.states.append(self.parse_block_sequence_entry) return self.parse_block_node() else: self.state = self.parse_block_sequence_entry return self.process_empty_scalar(token.end_mark) if not self.check_token(BlockEndToken): token = self.peek_token() raise ParserError("while scanning a block collection", self.marks[-1], "expected <block end>, but found %r" % token.id, token.start_mark) token = self.get_token() event = SequenceEndEvent(token.start_mark, token.end_mark) self.state = self.states.pop() self.marks.pop() return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
raise ParserError("while scanning a block mapping", self.marks[-1],
raise ParserError("while parsing a block mapping", self.marks[-1],
def parse_block_mapping_key(self): if self.check_token(KeyToken): token = self.get_token() if not self.check_token(KeyToken, ValueToken, BlockEndToken): self.states.append(self.parse_block_mapping_value) return self.parse_block_node_or_indentless_sequence() else: self.state = self.parse_block_mapping_value return self.process_empty_scalar(token.end_mark) if not self.check_token(BlockEndToken): token = self.peek_token() raise ParserError("while scanning a block mapping", self.marks[-1], "expected <block end>, but found %r" % token.id, token.start_mark) token = self.get_token() event = MappingEndEvent(token.start_mark, token.end_mark) self.state = self.states.pop() self.marks.pop() return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
raise ParserError("while scanning a flow sequence", self.marks[-1],
raise ParserError("while parsing a flow sequence", self.marks[-1],
def parse_flow_sequence_entry(self, first=False): if not self.check_token(FlowSequenceEndToken): if not first: if self.check_token(FlowEntryToken): self.get_token() else: token = self.peek_token() raise ParserError("while scanning a flow sequence", self.marks[-1], "expected ',' or ']', but got %r" % token.id, token.start_mark) if self.check_token(KeyToken): token = self.get_token() event = MappingStartEvent(None, None, True, token.start_mark, token.end_mark, flow_style=True) self.state = self.parse_flow_sequence_entry_mapping_key return event elif not self.check_token(FlowSequenceEndToken): self.states.append(self.parse_flow_sequence_entry) return self.parse_flow_node() token = self.get_token() event = SequenceEndEvent(token.start_mark, token.end_mark) self.state = self.states.pop() self.marks.pop() return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
token = self.get_token()
token = self.peek_token()
def parse_flow_sequence_entry(self, first=False): if not self.check_token(FlowSequenceEndToken): if not first: if self.check_token(FlowEntryToken): self.get_token() else: token = self.peek_token() raise ParserError("while scanning a flow sequence", self.marks[-1], "expected ',' or ']', but got %r" % token.id, token.start_mark) if self.check_token(KeyToken): token = self.get_token() event = MappingStartEvent(None, None, True, token.start_mark, token.end_mark, flow_style=True) self.state = self.parse_flow_sequence_entry_mapping_key return event elif not self.check_token(FlowSequenceEndToken): self.states.append(self.parse_flow_sequence_entry) return self.parse_flow_node() token = self.get_token() event = SequenceEndEvent(token.start_mark, token.end_mark) self.state = self.states.pop() self.marks.pop() return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
raise ParserError("while scanning a flow mapping", self.marks[-1],
raise ParserError("while parsing a flow mapping", self.marks[-1],
def parse_flow_mapping_key(self, first=False): if not self.check_token(FlowMappingEndToken): if not first: if self.check_token(FlowEntryToken): self.get_token() else: token = self.peek_token() raise ParserError("while scanning a flow mapping", self.marks[-1], "expected ',' or '}', but got %r" % token.id, token.start_mark) if self.check_token(KeyToken): token = self.get_token() if not self.check_token(ValueToken, FlowEntryToken, FlowMappingEndToken): self.states.append(self.parse_flow_mapping_value) return self.parse_flow_node() else: self.state = self.parse_flow_mapping_value return self.process_empty_scalar(token.end_mark) elif not self.check_token(FlowMappingEndToken): self.states.append(self.parse_flow_mapping_empty_value) return self.parse_flow_node() token = self.get_token() event = MappingEndEvent(token.start_mark, token.end_mark) self.state = self.states.pop() self.marks.pop() return event
e5b6026db33af1b666f1fe2bb32017ca0d2f2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/e5b6026db33af1b666f1fe2bb32017ca0d2f2841/parser.py
parameters = yaml.load_document(config)
parameters = yaml.load(config)
def __init__(self, config): parameters = yaml.load_document(config) self.replaces = parameters['replaces'] self.substitutions = {} for domain, items in [('Token', parameters['tokens']), ('Event', parameters['events'])]: for code in items: name = ''.join([part.capitalize() for part in code.split('-')]+[domain]) cls = getattr(yaml, name) value = items[code] if value: if 'start' in value: self.substitutions[cls, -1] = value['start'] if 'end' in value: self.substitutions[cls, +1] = value['end']
0564d617154c1ed0bd81029c8b1927669199097f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/0564d617154c1ed0bd81029c8b1927669199097f/yaml_hl.py
tokens = yaml.parse(input, Parser=iter)
tokens = yaml.scan(input)
def highlight(self, input): if isinstance(input, str): if input.startswith(codecs.BOM_UTF16_LE): input = unicode(input, 'utf-16-le') elif input.startswith(codecs.BOM_UTF16_BE): input = unicode(input, 'utf-16-be') else: input = unicode(input, 'utf-8') tokens = yaml.parse(input, Parser=iter) events = yaml.parse(input) markers = [] number = 0 for token in tokens: number += 1 if token.start_mark.index != token.end_mark.index: cls = token.__class__ if (cls, -1) in self.substitutions: markers.append([token.start_mark.index, +2, number, self.substitutions[cls, -1]]) if (cls, +1) in self.substitutions: markers.append([token.end_mark.index, -2, number, self.substitutions[cls, +1]]) number = 0 for event in events: number += 1 cls = event.__class__ if (cls, -1) in self.substitutions: markers.append([event.start_mark.index, +1, number, self.substitutions[cls, -1]]) if (cls, +1) in self.substitutions: markers.append([event.end_mark.index, -1, number, self.substitutions[cls, +1]]) markers.sort() markers.reverse() chunks = [] position = len(input) for index, weight1, weight2, substitution in markers: if index < position: chunk = input[index:position] for substring, replacement in self.replaces: chunk = chunk.replace(substring, replacement) chunks.append(chunk) position = index chunks.append(substitution) chunks.reverse() result = u''.join(chunks) return result.encode('utf-8')
0564d617154c1ed0bd81029c8b1927669199097f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/0564d617154c1ed0bd81029c8b1927669199097f/yaml_hl.py
return float(value)
return sign*float(value)
def construct_yaml_float(self, node): value = str(self.construct_scalar(node)) value = value.replace('_', '') sign = +1 if value[0] == '-': sign = -1 if value[0] in '+-': value = value[1:] if value.lower() == '.inf': return sign*self.inf_value elif value.lower() == '.nan': return self.nan_value elif ':' in value: digits = [float(part) for part in value.split(':')] digits.reverse() base = 1 value = 0.0 for digit in digits: value += digit*base base *= 60 return sign*value else: return float(value)
95de9a4ca86e61aa422d6cfb5d1e8ee5c2fbd237 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/95de9a4ca86e61aa422d6cfb5d1e8ee5c2fbd237/constructor.py
self.peek(length+1) in u'\0 \t\r\n\x28\u2028\u2029') \
self.peek(length+1) in u'\0 \t\r\n\x85\u2028\u2029') \
def scan_plain(self): # See the specification for details. # We add an additional restriction for the flow context: # plain scalars in the flow context cannot contain ',', ':' and '?'. # We also keep track of the `allow_simple_key` flag here. # Indentation rules are loosed for the flow context. chunks = [] start_mark = self.get_mark() end_mark = start_mark indent = self.indent+1 # We allow zero indentation for scalars, but then we need to check for # document separators at the beginning of the line. #if indent == 0: # indent = 1 spaces = [] while True: length = 0 if self.peek() == u'#': break while True: ch = self.peek(length) if ch in u'\0 \t\r\n\x85\u2028\u2029' \ or (not self.flow_level and ch == u':' and self.peek(length+1) in u'\0 \t\r\n\x28\u2028\u2029') \ or (self.flow_level and ch in u',:?[]{}'): break length += 1 # It's not clear what we should do with ':' in the flow context. if (self.flow_level and ch == u':' and self.peek(length+1) not in u'\0 \t\r\n\x28\u2028\u2029,[]{}'): self.forward(length) raise ScannerError("while scanning a plain scalar", start_mark, "found unexpected ':'", self.get_mark(), "Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.") if length == 0: break self.allow_simple_key = False chunks.extend(spaces) chunks.append(self.prefix(length)) self.forward(length) end_mark = self.get_mark() spaces = self.scan_plain_spaces(indent, start_mark) if not spaces or self.peek() == u'#' \ or (not self.flow_level and self.column < indent): break return ScalarToken(u''.join(chunks), True, start_mark, end_mark)
c176ec00d6b00b8c2aac9d83b7d7979282d43b94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/c176ec00d6b00b8c2aac9d83b7d7979282d43b94/scanner.py
and self.peek(length+1) not in u'\0 \t\r\n\x28\u2028\u2029,[]{}'):
and self.peek(length+1) not in u'\0 \t\r\n\x85\u2028\u2029,[]{}'):
def scan_plain(self): # See the specification for details. # We add an additional restriction for the flow context: # plain scalars in the flow context cannot contain ',', ':' and '?'. # We also keep track of the `allow_simple_key` flag here. # Indentation rules are loosed for the flow context. chunks = [] start_mark = self.get_mark() end_mark = start_mark indent = self.indent+1 # We allow zero indentation for scalars, but then we need to check for # document separators at the beginning of the line. #if indent == 0: # indent = 1 spaces = [] while True: length = 0 if self.peek() == u'#': break while True: ch = self.peek(length) if ch in u'\0 \t\r\n\x85\u2028\u2029' \ or (not self.flow_level and ch == u':' and self.peek(length+1) in u'\0 \t\r\n\x28\u2028\u2029') \ or (self.flow_level and ch in u',:?[]{}'): break length += 1 # It's not clear what we should do with ':' in the flow context. if (self.flow_level and ch == u':' and self.peek(length+1) not in u'\0 \t\r\n\x28\u2028\u2029,[]{}'): self.forward(length) raise ScannerError("while scanning a plain scalar", start_mark, "found unexpected ':'", self.get_mark(), "Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.") if length == 0: break self.allow_simple_key = False chunks.extend(spaces) chunks.append(self.prefix(length)) self.forward(length) end_mark = self.get_mark() spaces = self.scan_plain_spaces(indent, start_mark) if not spaces or self.peek() == u'#' \ or (not self.flow_level and self.column < indent): break return ScalarToken(u''.join(chunks), True, start_mark, end_mark)
c176ec00d6b00b8c2aac9d83b7d7979282d43b94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/c176ec00d6b00b8c2aac9d83b7d7979282d43b94/scanner.py
prefix = self.peek(4)
def check_document_end(self):
50af0175fdc604bb682050a799b403652a308df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/50af0175fdc604bb682050a799b403652a308df2/scanner.py
reduce = copy_reg.dispatch_table[cls]
reduce = copy_reg.dispatch_table[cls](data)
def represent_object(self, data): # We use __reduce__ API to save the data. data.__reduce__ returns # a tuple of length 2-5: # (function, args, state, listitems, dictitems)
2efb6e17df27254c96ad9232d92e881a02d5b878 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/2efb6e17df27254c96ad9232d92e881a02d5b878/representer.py
if ch == u'\'': data = u'\'\'' self.column += 2 if self.encoding: data = data.encode(self.encoding) self.stream.write(data) start = end + 1
if ch == u'\'': data = u'\'\'' self.column += 2 if self.encoding: data = data.encode(self.encoding) self.stream.write(data) start = end + 1
def write_single_quoted(self, text, split=True): self.write_indicator(u'\'', True) spaces = False breaks = False start = end = 0 while end <= len(text): ch = None if end < len(text): ch = text[end] if spaces: if ch is None or ch != u' ': if start+1 == end and self.column > self.best_width and split \ and start != 0 and end != len(text): self.write_indent() else: data = text[start:end] self.column += len(data) if self.encoding: data = data.encode(self.encoding) self.stream.write(data) start = end elif breaks: if ch is None or ch not in u'\n\x85\u2028\u2029': if text[start] == u'\n': self.write_line_break() for br in text[start:end]: if br == u'\n': self.write_line_break() else: self.write_line_break(br) self.write_indent() start = end else: if ch is None or ch in u' \n\x85\u2028\u2029' or ch == u'\'': if start < end: data = text[start:end] self.column += len(data) if self.encoding: data = data.encode(self.encoding) self.stream.write(data) start = end if ch == u'\'': data = u'\'\'' self.column += 2 if self.encoding: data = data.encode(self.encoding) self.stream.write(data) start = end + 1 if ch is not None: spaces = (ch == u' ') breaks = (ch in u'\n\x85\u2028\u2029') end += 1 self.write_indicator(u'\'', False)
85cf6b2978e17da2f80fcf1569c903efe7763572 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/85cf6b2978e17da2f80fcf1569c903efe7763572/emitter.py
if not self.flow_level and self.analysis.allow_block:
if (not self.flow_level and not self.simple_key_context and self.analysis.allow_block):
def choose_scalar_style(self): if self.analysis is None: self.analysis = self.analyze_scalar(self.event.value) if self.event.style == '"' or self.canonical: return '"' if not self.event.style and self.event.implicit[0]: if (not (self.simple_key_context and (self.analysis.empty or self.analysis.multiline)) and (self.flow_level and self.analysis.allow_flow_plain or (not self.flow_level and self.analysis.allow_block_plain))): return '' if self.event.style and self.event.style in '|>': if not self.flow_level and self.analysis.allow_block: return self.event.style if not self.event.style or self.event.style == '\'': if (self.analysis.allow_single_quoted and not (self.simple_key_context and self.analysis.multiline)): return '\'' return '"'
81cba56bfa328c153714d21752e1c782a66d0a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/81cba56bfa328c153714d21752e1c782a66d0a82/emitter.py
if ch in u'
if ch in u'
def analyze_scalar(self, scalar):
81cba56bfa328c153714d21752e1c782a66d0a82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/81cba56bfa328c153714d21752e1c782a66d0a82/emitter.py
mark = Mark(test_name, line, column, unicode(input), index)
mark = Mark(test_name, index, line, column, unicode(input), index)
def _testMarks(self, test_name, marks_filename): inputs = file(marks_filename, 'rb').read().split('---\n')[1:] for input in inputs: index = 0 line = 0 column = 0 while input[index] != '*': if input[index] == '\n': line += 1 column = 0 else: column += 1 index += 1 mark = Mark(test_name, line, column, unicode(input), index) snippet = mark.get_snippet(indent=2, max_length=79) #print "INPUT:" #print input #print "SNIPPET:" #print snippet self.failUnless(isinstance(snippet, str)) self.failUnlessEqual(snippet.count('\n'), 1) data, pointer = snippet.split('\n') self.failUnless(len(data) < 82) self.failUnlessEqual(data[len(pointer)-1], '*')
1ee40ff22d7dee8cc6bbbb06f0b6a100666a5c09 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/1ee40ff22d7dee8cc6bbbb06f0b6a100666a5c09/test_mark.py
if self.check_event(StreamStartEvent): self.get_event()
def compose_document(self):
84476624a94e9aa76d308fa2962d4a03c5a88ff3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/84476624a94e9aa76d308fa2962d4a03c5a88ff3/composer.py
re.compile(ur'''^(?:yes|Yes|YES|n|N|no|No|NO
re.compile(ur'''^(?:yes|Yes|YES|no|No|NO
def resolve(self, kind, value, implicit): if kind is ScalarNode and implicit[0]: if value == u'': resolvers = self.yaml_implicit_resolvers.get(u'', []) else: resolvers = self.yaml_implicit_resolvers.get(value[0], []) resolvers += self.yaml_implicit_resolvers.get(None, []) for tag, regexp in resolvers: if regexp.match(value): return tag implicit = implicit[1] if self.yaml_path_resolvers: exact_paths = self.resolver_exact_paths[-1] if kind in exact_paths: return exact_paths[kind] if None in exact_paths: return exact_paths[None] if kind is ScalarNode: return self.DEFAULT_SCALAR_TAG elif kind is SequenceNode: return self.DEFAULT_SEQUENCE_TAG elif kind is MappingNode: return self.DEFAULT_MAPPING_TAG
8353f3362f9ca20d6d33b0bfe9c2c96a18453d79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/94/8353f3362f9ca20d6d33b0bfe9c2c96a18453d79/resolver.py
if overwrite and not(os.path.exists(localPath)):
if overwrite or not(os.path.exists(localPath)):
def download_url(url, overwrite=False): """Download a url to the local cache @overwrite: if True overwrite an existing local copy otherwise don't """ localPath = get_local_path(url) if overwrite and not(os.path.exists(localPath)): urllib.urlretrieve(url, localPath)
ac251c4c5a3733e0c864a8629708d85033458dff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9817/ac251c4c5a3733e0c864a8629708d85033458dff/utils.py
s = math.sqrt(abs(m[0][0] + m[1][1] + m[2][2] + m[3][3])) if s == 0.0: x = abs(m[2][1] - m[1][2]) y = abs(m[0][2] - m[2][0]) z = abs(m[1][0] - m[0][1]) if (x >= y) and (x >= z): return 1.0, 0.0, 0.0, 0.0 elif (y >= x) and (y >= z): return 0.0, 1.0, 0.0, 0.0 else: return 0.0, 0.0, 1.0, 0.0 return quaternion_normalize([ -(m[2][1] - m[1][2]) / (2.0 * s), -(m[0][2] - m[2][0]) / (2.0 * s), -(m[1][0] - m[0][1]) / (2.0 * s), 0.5 * s, ])
tr = 1.0 + m[0][0] + m[1][1] + m[2][2] if tr > .00001: s = math.sqrt(tr) w = s / 2.0 s = 0.5 / s x = (m[1][2] - m[2][1]) * s y = (m[2][0] - m[0][2]) * s z = (m[0][1] - m[1][0]) * s elif m[0][0] > m[1][1] and m[0][0] > m[2][2]: s = math.sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]) x = s / 2.0 s = 0.5 / s y = (m[0][1] + m[1][0]) * s z = (m[2][0] + m[0][2]) * s w = (m[1][2] - m[2][1]) * s elif m[1][1] > m[2][2]: s = math.sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]) y = s / 2.0 s = 0.5 / s x = (m[0][1] + m[1][0]) * s z = (m[1][2] + m[2][1]) * s w = (m[2][0] - m[0][2]) * s else: s = math.sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]) z = s / 2.0 s = 0.5 / s x = (m[2][0] + m[0][2]) * s y = (m[1][2] + m[2][1]) * s w = (m[0][1] - m[1][0]) * s return w, x, y, z
def matrix2quaternion(m): s = math.sqrt(abs(m[0][0] + m[1][1] + m[2][2] + m[3][3])) if s == 0.0: x = abs(m[2][1] - m[1][2]) y = abs(m[0][2] - m[2][0]) z = abs(m[1][0] - m[0][1]) if (x >= y) and (x >= z): return 1.0, 0.0, 0.0, 0.0 elif (y >= x) and (y >= z): return 0.0, 1.0, 0.0, 0.0 else: return 0.0, 0.0, 1.0, 0.0 return quaternion_normalize([ -(m[2][1] - m[1][2]) / (2.0 * s), -(m[0][2] - m[2][0]) / (2.0 * s), -(m[1][0] - m[0][1]) / (2.0 * s), 0.5 * s, ])
6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5/windstille_export.py
self.file.write(struct.pack("=fff", t[1], -t[2], t[0]))
self.file.write(struct.pack("=fff", t[1], -t[2], -t[0]))
def save_frame(): for obj in self.meshes: data = Blender.NMesh.GetRawFromObject(obj.getName()) m = obj.getMatrix() # action/frame/mesh/vertices for nv in self.objvertmaps[obj.getName()]: v = data.verts[nv] t = [0, 0, 0] t[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2] + m[3][0] t[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2] + m[3][1] t[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2] + m[3][2] t[0] *= ZOOM t[1] *= ZOOM t[2] *= ZOOM self.file.write(struct.pack("=fff", t[1], -t[2], t[0]))
6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5/windstille_export.py
self.file.write(struct.pack("=fff", loc[0], loc[1], loc[2]))
self.file.write(struct.pack("=fff", loc[1], -loc[2], -loc[0]))
def save_frame(): for obj in self.meshes: data = Blender.NMesh.GetRawFromObject(obj.getName()) m = obj.getMatrix() # action/frame/mesh/vertices for nv in self.objvertmaps[obj.getName()]: v = data.verts[nv] t = [0, 0, 0] t[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2] + m[3][0] t[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2] + m[3][1] t[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2] + m[3][2] t[0] *= ZOOM t[1] *= ZOOM t[2] *= ZOOM self.file.write(struct.pack("=fff", t[1], -t[2], t[0]))
6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5/windstille_export.py
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], face.normal[0])
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], -face.normal[0])
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5/windstille_export.py
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], face.normal[0])
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], -face.normal[0])
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/6bb5b38fe37f3944e19d87f90e8fb45f626fc3e5/windstille_export.py
bodydata += struct.pack("=fff", face.normal[0], face.normal[1], face.normal[2])
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], face.normal[0])
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
518be49390d480a73bb0056bcc330075dd3e0794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/518be49390d480a73bb0056bcc330075dd3e0794/windstille_export.py
bodydata += struct.pack("=fff", face.normal[0], face.normal[1], face.normal[2])
bodydata += struct.pack("=fff", face.normal[1], -face.normal[2], face.normal[0])
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
518be49390d480a73bb0056bcc330075dd3e0794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/518be49390d480a73bb0056bcc330075dd3e0794/windstille_export.py
for frame in xrange(1, numframes+1, SAMPLEFRAMES):
for frame in range(1, numframes+1, SAMPLEFRAMES):
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
518be49390d480a73bb0056bcc330075dd3e0794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/518be49390d480a73bb0056bcc330075dd3e0794/windstille_export.py
Blender.Set("curframe", frame.__int__())
Blender.Set("curframe", float(frame))
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
518be49390d480a73bb0056bcc330075dd3e0794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/518be49390d480a73bb0056bcc330075dd3e0794/windstille_export.py
file.write(struct.pack("=fff", t[0], t[1], t[2])) print frs
file.write(struct.pack("=fff", t[1], -t[2], t[0]))
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
518be49390d480a73bb0056bcc330075dd3e0794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/518be49390d480a73bb0056bcc330075dd3e0794/windstille_export.py
file.write(struct.pack("=64sH", marker[0], marker[1]))
file.write(struct.pack("=64sH", marker[0], \ blenderframe_to_wspriteframe(marker[1])))
def mapvertex(index, u, v): for mv in xrange(0, len(vertexmap)): if vertexmap[mv] == index and uvs[mv] == (u, v): return mv vertexmap.append(index) uvs.append( (u, v) ) return len(vertexmap)-1
f0a359398f642ebc58567dd18b8aa64ca5711647 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2372/f0a359398f642ebc58567dd18b8aa64ca5711647/windstille_export.py
if file[-4:] == ".tex": file = file[:-4] aux = basename(file) + ".aux"
aux = dict["arg"] + ".aux"
def h_include (self, dict): """ Called when an \\include macro is found. This includes files into the source in a way very similar to \\input, except that LaTeX also creates .aux files for them, so we have to notice this. """ if not dict["arg"]: return if self.include_only and not self.include_only.has_key(dict["arg"]): return file, _ = self.input_file(dict["arg"], dict) if file: if file[-4:] == ".tex": file = file[:-4] aux = basename(file) + ".aux" self.removed_files.append(aux) self.aux_old[aux] = None if exists(aux): self.aux_md5[aux] = md5_file(aux) else: self.aux_md5[aux] = None
ee8385044ad5d0727467919c1b05a02638a9dcfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/ee8385044ad5d0727467919c1b05a02638a9dcfc/__init__.py
if self.opts.has_key("ext"):
opts = rubber.util.parse_keyval(dict["opt"]) if opts.has_key("ext"):
def includegraphics (self, dict): """ This method is triggered by th \\includegraphics macro, it looks for the graphics file specified as argument and adds it either to the dependencies or to the list of graphics not found. """ name = dict["arg"] suffixes = self.suffixes
689ca3c37e24f284deef1fdb7ef69113f8820ec8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/689ca3c37e24f284deef1fdb7ef69113f8820ec8/graphics.py
if self.opts["ext"]: name = name + self.opts["ext"]
if opts["ext"]: name = name + opts["ext"]
def includegraphics (self, dict): """ This method is triggered by th \\includegraphics macro, it looks for the graphics file specified as argument and adds it either to the dependencies or to the list of graphics not found. """ name = dict["arg"] suffixes = self.suffixes
689ca3c37e24f284deef1fdb7ef69113f8820ec8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/689ca3c37e24f284deef1fdb7ef69113f8820ec8/graphics.py
deps = []
deps = {}
def main (self, cmdline): self.env = Environment(self.msg) self.modules = []
955b23602163f674532c56d824634fed6f335c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/955b23602163f674532c56d824634fed6f335c08/cmd_info.py
deps.extend(dep.leaves()) print string.join(deps)
for file in dep.leaves(): deps[file] = None print string.join(deps.keys())
def main (self, cmdline): self.env = Environment(self.msg) self.modules = []
955b23602163f674532c56d824634fed6f335c08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/955b23602163f674532c56d824634fed6f335c08/cmd_info.py
({(?P<arg>[^\\\\{}]*)}|[^A-Za-z{])?"
({(?P<arg>[^\\\\{}]*)}|(?=[^A-Za-z]))"
def update_seq (self): """ Update the regular expression used to match macro calls using the keys in the `hook' dictionary. We don't match all control sequences for obvious efficiency reasons. """ self.seq = re.compile("\
e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa/__init__.py
def execute (self, prog, env={}, pwd=None, out=None): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). The error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation). """ self.msg(1, _("executing: %s") % string.join(prog)) if pwd: self.msg(2, _(" in directory %s") % pwd) if env != {}: self.msg(2, _(" with environment: %r") % env)
e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa/__init__.py
def execute (self, prog, env={}, pwd=None, out=None): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). The error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation). """ self.msg(1, _("executing: %s") % string.join(prog)) if pwd: self.msg(2, _(" in directory %s") % pwd) if env != {}: self.msg(2, _(" with environment: %r") % env)
e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/e83ea5005b8fcbd3aaf28807ce8cc85c2d525daa/__init__.py
skipping = 0
skipping = 0
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 # 1 if we are showing an error's text skipping = 0 # 1 if we are skipping text until a new line something = 0 # 1 if some error was displayed for line in self.lines: line = line.rstrip() if line == "": skipping = 0 elif skipping: pass elif showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 skipping = 1 else: self.update_file(line, pos) elif line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else:
a68ab95e33b0de179210f64eea90e0dfd53390d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/a68ab95e33b0de179210f64eea90e0dfd53390d2/__init__.py
else: self.update_file(line, pos)
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 # 1 if we are showing an error's text skipping = 0 # 1 if we are skipping text until a new line something = 0 # 1 if some error was displayed for line in self.lines: line = line.rstrip() if line == "": skipping = 0 elif skipping: pass elif showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 skipping = 1 else: self.update_file(line, pos) elif line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else:
a68ab95e33b0de179210f64eea90e0dfd53390d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/a68ab95e33b0de179210f64eea90e0dfd53390d2/__init__.py
self.pbase = doc.src_base
def __init__ (self, doc, source, target, transcript): """ Initialize the index, by specifying the source file (generated by LaTeX), the target file (the output of makeindex) and the transcript (e.g. .ilg) file. Transcript is used by glosstex.py. """ self.doc = doc self.pbase = doc.src_base self.source = doc.src_base + "." + source self.target = doc.src_base + "." + target self.transcript = doc.src_base + "." + transcript if os.path.exists(self.source): self.md5 = md5_file(self.source) else: self.md5 = None
194857f9cf6aa4f20456ae95bc08b0e0a0f47b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/194857f9cf6aa4f20456ae95bc08b0e0a0f47b59/index.py
cmd = ["makeindex", "-o", self.target] + self.opts
cmd = ["makeindex", "-q", "-o", self.target] + self.opts
def post_compile (self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return 0 if not self.run_needed(): return 0
194857f9cf6aa4f20456ae95bc08b0e0a0f47b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/194857f9cf6aa4f20456ae95bc08b0e0a0f47b59/index.py
cmd.append(self.pbase)
cmd.append(self.source)
def post_compile (self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return 0 if not self.run_needed(): return 0
194857f9cf6aa4f20456ae95bc08b0e0a0f47b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/194857f9cf6aa4f20456ae95bc08b0e0a0f47b59/index.py
skipping = 0
skipping = 0
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 # 1 if we are showing an error's text skipping = 0 # 1 if we are skipping text until a new line something = 0 # 1 if some error was displayed for line in self.lines: line = line.rstrip() if line == "": skipping = 0 elif skipping: pass elif showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 skipping = 1 else: self.update_file(line, pos) elif line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else:
2872f453dea409202fb2e3c9bcfed5e753e22dd2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2872f453dea409202fb2e3c9bcfed5e753e22dd2/__init__.py
else: self.update_file(line, pos)
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 # 1 if we are showing an error's text skipping = 0 # 1 if we are skipping text until a new line something = 0 # 1 if some error was displayed for line in self.lines: line = line.rstrip() if line == "": skipping = 0 elif skipping: pass elif showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 skipping = 1 else: self.update_file(line, pos) elif line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else:
2872f453dea409202fb2e3c9bcfed5e753e22dd2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2872f453dea409202fb2e3c9bcfed5e753e22dd2/__init__.py
if self.opts.has_key("ext"):
opts = rubber.util.parse_keyval(dict["opt"]) if opts.has_key("ext"):
def includegraphics (self, dict): """ This method is triggered by th \\includegraphics macro, it looks for the graphics file specified as argument and adds it either to the dependencies or to the list of graphics not found. """ name = dict["arg"] suffixes = self.suffixes
f70ba7cba046ef8566798d3243133e9ccb0597ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/f70ba7cba046ef8566798d3243133e9ccb0597ad/graphics.py
if self.opts["ext"]: name = name + self.opts["ext"]
if opts["ext"]: name = name + opts["ext"]
def includegraphics (self, dict): """ This method is triggered by th \\includegraphics macro, it looks for the graphics file specified as argument and adds it either to the dependencies or to the list of graphics not found. """ name = dict["arg"] suffixes = self.suffixes
f70ba7cba046ef8566798d3243133e9ccb0597ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/f70ba7cba046ef8566798d3243133e9ccb0597ad/graphics.py
env.msg(2, "%s is made from %r" % (target, sources))
env.msg(2, _("%s is made from %r") % (target, sources))
def __init__ (self, target, source, env): sources = [] self.include(source, sources) env.msg(2, "%s is made from %r" % (target, sources)) self.leaf = DependLeaf(sources) Depend.__init__(self, [target], {source: self.leaf}) self.env = env self.base = source[:-3] self.cmd = ["mpost", "--interaction=batchmode", self.base] if env.src_path != "": cmd = [ "env", "MPINPUTS=:%s:%s" % (self.env.src_path, os.getenv("MPINPUTS", ""))] + cmd
b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6/mpost.py
self.env.msg(0, "running Metapost on %s.mp..." % self.base)
self.env.msg(0, _("running Metapost on %s.mp...") % self.base)
def run (self): self.env.msg(0, "running Metapost on %s.mp..." % self.base) self.env.execute(self.cmd)
b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6/mpost.py
self.msg(0, line.rstrip())
self.env.msg(0, line.rstrip())
def run (self): self.env.msg(0, "running Metapost on %s.mp..." % self.base) self.env.execute(self.cmd)
b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6/mpost.py
self.msg(0, _("There were errors in Metapost code:")) self.msg(0, line.rstrip())
self.env.msg(0, _("There were errors in Metapost code:")) self.env.msg(0, line.rstrip())
def run (self): self.env.msg(0, "running Metapost on %s.mp..." % self.base) self.env.execute(self.cmd)
b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b1146dbe7d4fcb9a4eaafa6b77c4ef8172c622e6/mpost.py
if errors: d = { "kind": "error", "text": error,
pdfTeX = string.find(line, "pdfTeX warning") == -1 if (pdfTeX and warnings) or (errors and not pdfTeX): if pdfTeX: d = { "kind": "warning", "pkg": "pdfTeX", "text": error[error.find(":")+2:] } else: d = { "kind": "error", "text": error
def parse (self, errors=0, boxes=0, refs=0, warnings=0): """ Parse the log file for relevant information. The named arguments are booleans that indicate which information should be extracted: - errors: all errors - boxes: bad boxes - refs: warnings about references - warnings: all other warnings The function returns a generator. Each generated item is a dictionary that contains (some of) the following entries: - kind: the kind of information ("error", "box", "ref", "warning") - text: the text of the error or warning - code: the piece of code that caused an error - file, line, last, pkg: as used by Message.format_pos. """ if not self.lines: return last_file = None pos = [last_file] page = 1 parsing = 0 # 1 if we are parsing an error's text skipping = 0 # 1 if we are skipping text until an empty line something = 0 # 1 if some error was found prefix = None # the prefix for warning messages from packages accu = "" # accumulated text from the previous line for line in self.lines: line = line[:-1] # remove the line feed
150289d72bd1dc2664a6d2a4e0894fd29933917e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/150289d72bd1dc2664a6d2a4e0894fd29933917e/__init__.py
self.path = [""] if doc.src_path != "" and doc.src_path != ".": self.path.append(doc.src_path) self.style = None
self.tool = "makeindex" self.lang = None self.modules = []
def __init__ (self, doc, source, target, transcript): """ Initialize the index, by specifying the source file (generated by LaTeX), the target file (the output of makeindex) and the transcript (e.g. .ilg) file. Transcript is used by glosstex.py. """ self.doc = doc self.pbase = doc.src_base self.source = doc.src_base + "." + source self.target = doc.src_base + "." + target self.transcript = doc.src_base + "." + transcript if os.path.exists(self.source): self.md5 = md5_file(self.source) else: self.md5 = None
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
cmd = ["makeindex", "-o", self.target] + self.opts cmd.extend(["-t", self.transcript]) if self.style: cmd.extend(["-s", self.style]) cmd.append(self.pbase) if self.path != [""]: env = { 'INDEXSTYLE': string.join(self.path + [os.getenv("INDEXSTYLE", "")], ":") }
if self.tool == "makeindex": cmd = ["makeindex", "-o", self.target] + self.opts cmd.extend(["-t", self.transcript]) if self.style: cmd.extend(["-s", self.style]) cmd.append(self.pbase) path_var = "INDEXSTYLE" elif self.tool == "xindy": cmd = ["texindy", "--quiet"] for opt in self.opts: if opt == "-g": if self.lang != "": msg.warn(_("'language' overrides 'order german'"), pkg="index") else: self.lang = "german-din" elif opt == "-l": self.modules.append("letter-ordering") msg.warn(_("use 'module letter-ordering' instead of 'order letter'"), pkg="index") else: msg.error("unknown option to xindy: %s" % opt, pkg="index") for mod in self.modules: cmd.extend(["--module", mod]) if self.lang: cmd.extend(["--language", self.lang]) cmd.append(self.source) path_var = "XINDY_SEARCHPATH" if self.path != []: env = { path_var: string.join(self.path + [os.getenv(path_var, "")], ":") }
def post_compile (self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return 0 if not self.run_needed(): return 0
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
msg.error(_("makeindex failed on %s") % self.source)
msg.error(_("could not make index %s") % self.target)
def post_compile (self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return 0 if not self.run_needed(): return 0
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
self.indices["default"] = Index(self.doc, "idx", "ind", "ilg")
self.register("default", "idx", "ind", "ilg")
def makeindex (self, dict): """ Register the standard index. """ self.indices["default"] = Index(self.doc, "idx", "ind", "ilg")
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
self.indices[index] = Index(self.doc, d["idx"], d["ind"], "ilg")
self.register(index, d["idx"], d["ind"], "ilg")
def newindex (self, dict): """ Register a new index. """ m = re_newindex.match(dict["line"]) if not m: return index = dict["arg"] d = m.groupdict() self.indices[index] = Index(self.doc, d["idx"], d["ind"], "ilg") msg.log(_("index %s registered") % index, pkg="index")
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
for index in m.group("list").split(","): if indices.has_key(index): indices[index].command(cmd, args[1:]) else: for index in indices.values(): index.command(cmd, args)
names = m.group("list").split(",") args = args[1:] if names is None: self.defaults.append([cmd, args]) names = indices.keys() for index in names: if indices.has_key(index): indices[index].command(cmd, args[1:]) elif self.commands.has_key(index): self.commands[index].append([cmd, args]) else: self.commands[index] = [[cmd, args]]
def command (self, cmd, args): indices = self.indices if len(args) > 0: m = re_optarg.match(args[0]) if m: for index in m.group("list").split(","): if indices.has_key(index): indices[index].command(cmd, args[1:]) else: for index in indices.values(): index.command(cmd, args)
246518fe05858dd373693d5f39f87ebc015f46a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/246518fe05858dd373693d5f39f87ebc015f46a2/index.py
if exists(test):
if exists(test) and isfile(test):
def find_input (self, name): """ Look for a source file with the given name, and return either the complete path to the actual file or None if the file is not found. """ for path in self.path: test = join(path, name) if exists(test): return test elif exists(test + ".tex"): return test + ".tex" return None
2e3dc71000d0b1e1cf7b5830eacfd5730cae704d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e3dc71000d0b1e1cf7b5830eacfd5730cae704d/__init__.py
elif exists(test + ".tex"):
elif exists(test + ".tex") and isfile(test + ".tex"):
def find_input (self, name): """ Look for a source file with the given name, and return either the complete path to the actual file or None if the file is not found. """ for path in self.path: test = join(path, name) if exists(test): return test elif exists(test + ".tex"): return test + ".tex" return None
2e3dc71000d0b1e1cf7b5830eacfd5730cae704d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e3dc71000d0b1e1cf7b5830eacfd5730cae704d/__init__.py
deps = []
deps = {}
def main (self, cmdline): self.env = Environment(self.msg) self.modules = []
cb08ac610c3545daf35a93e2fced4bb98abd65c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cb08ac610c3545daf35a93e2fced4bb98abd65c6/cmd_info.py
deps.extend(dep.leaves()) print string.join(deps)
for file in dep.leaves(): deps[file] = None print string.join(deps.keys())
def main (self, cmdline): self.env = Environment(self.msg) self.modules = []
cb08ac610c3545daf35a93e2fced4bb98abd65c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cb08ac610c3545daf35a93e2fced4bb98abd65c6/cmd_info.py
pdfTeX = string.find(line, "pdfTeX warning") == -1
pdfTeX = string.find(line, "pdfTeX warning") != -1
def parse (self, errors=0, boxes=0, refs=0, warnings=0): """ Parse the log file for relevant information. The named arguments are booleans that indicate which information should be extracted: - errors: all errors - boxes: bad boxes - refs: warnings about references - warnings: all other warnings The function returns a generator. Each generated item is a dictionary that contains (some of) the following entries: - kind: the kind of information ("error", "box", "ref", "warning") - text: the text of the error or warning - code: the piece of code that caused an error - file, line, last, pkg: as used by Message.format_pos. """ if not self.lines: return last_file = None pos = [last_file] page = 1 parsing = 0 # 1 if we are parsing an error's text skipping = 0 # 1 if we are skipping text until an empty line something = 0 # 1 if some error was found prefix = None # the prefix for warning messages from packages accu = "" # accumulated text from the previous line for line in self.lines: line = line[:-1] # remove the line feed
9a92112acf82a4bda53a34a4604fe72c63ba7015 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/9a92112acf82a4bda53a34a4604fe72c63ba7015/__init__.py
if self.env.may_produce(source):
if exists(target) and self.env.may_produce(source):
def check (source, target, suffixes=suffixes): if self.env.may_produce(source): return 0 if suffixes == [""]: return 1 for suffix in suffixes: if source[-len(suffix):] == suffix: return 0 return 1
bdb384bf1c1bd2e6db633818964ce88b0629e4cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/bdb384bf1c1bd2e6db633818964ce88b0629e4cf/graphics.py
do_check()
ret = do_check() sys.exit(ret)
def do_setup (): """ Run the setup() function from the distutils with appropriate arguments. """ from distutils.core import setup try: mandir = expand_vars(settings.sub, settings.sub["mandir"]) except NameError: mandir = "man" setup( name = "rubber", version = settings.sub["version"], description = "The Rubber system for building LaTeX documents", long_description = """\
f267869c83912adc581f0d2b223ecdacacf304d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/f267869c83912adc581f0d2b223ecdacacf304d0/setup.py
re_file = re.compile("(\\((?P<file>[^ ()]*)|\\))")
re_file = re.compile("(\\((?P<file>[^ (){}]*)|\\))")
def register (self, name, dict={}): """ Attempt to register a package with the specified name. If a module is found, create an object from the module's class called `Module', passing it the environment and `dict' as arguments. This dictionary describes the command that caused the registration. """ r = self.load_module(name, "rubber.modules") if r == 0: self.env.msg(3, _("no support found for %s") % name) return 1 elif r == 2: self.env.msg(3, _("module %s already registered") % name) return 1 mod = self.modules[name].Module(self.env, dict) self.env.msg(2, _("module %s registered") % name) self.objects[name] = mod return 0
4caff78ef93f6743e8ec0ba9e121e84597e2cc95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/4caff78ef93f6743e8ec0ba9e121e84597e2cc95/__init__.py
file = m.group("file") if file: stack.append(file)
if line[m.start()] == '(': stack.append(m.group("file"))
def update_file (self, line, stack): """ Parse the given line of log file for file openings and closings and update the list `stack'. Newly opened files are at the end, therefore stack[0] is the main source while stack[-1] is the current one. """ m = re_file.search(line) if not m: return while m: file = m.group("file") if file: stack.append(file) else: del stack[-1] line = line[m.end():] m = re_file.search(line) return
efd83663326282b44ec1a422b5946fd05ecd3962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/efd83663326282b44ec1a422b5946fd05ecd3962/__init__.py
for file in self.source, self.target:
for file in self.source, self.target, self.pbase + ".ilg":
def clean (self): """ Remove all generated files related to the index. """ for file in self.source, self.target: if exists(file): self.env.msg(1, _("removing %s") % file) os.unlink(file)
b142a93ba4b5a025c648ddd980d439eb9c3e10df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b142a93ba4b5a025c648ddd980d439eb9c3e10df/index.py
return 1
return string.find(line, "warning:") != -1
def errors (self): """ Returns true if there was an error during the compilation. """ for line in self.lines: if line[0] == "!": return 1 return 0
cc6308ae72100b589d2a5f7aea2da96ec495a1c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cc6308ae72100b589d2a5f7aea2da96ec495a1c2/__init__.py
if cmd == "depend":
if cmd == "clean": self.removed_files.append(arg) elif cmd == "depend":
def command (self, cmd, arg): """ Execute the rubber command 'cmd' with argument 'arg'. This is called when a command is found in the source file or in a configuration file. A command name of the form 'foo.bar' is considered to be a command 'bar' for module 'foo'. """ if cmd == "depend": file = self.conf.find_input(arg) if file: self.depends[file] = DependLeaf([file]) else: self.msg(1, _("dependency '%s' not found") % arg)
cc6308ae72100b589d2a5f7aea2da96ec495a1c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cc6308ae72100b589d2a5f7aea2da96ec495a1c2/__init__.py
self.watch_file(self.base + ".toc")
self.watch_file(self.src_base + ".toc")
def h_tableofcontents (self, dict): self.watch_file(self.base + ".toc")
cc6308ae72100b589d2a5f7aea2da96ec495a1c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cc6308ae72100b589d2a5f7aea2da96ec495a1c2/__init__.py
self.watch_file(self.base + ".lof")
self.watch_file(self.src_base + ".lof")
def h_listoffigures (self, dict): self.watch_file(self.base + ".lof")
cc6308ae72100b589d2a5f7aea2da96ec495a1c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cc6308ae72100b589d2a5f7aea2da96ec495a1c2/__init__.py
self.watch_file(self.base + ".lot")
self.watch_file(self.src_base + ".lot")
def h_listoftables (self, dict): self.watch_file(self.base + ".lot")
cc6308ae72100b589d2a5f7aea2da96ec495a1c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/cc6308ae72100b589d2a5f7aea2da96ec495a1c2/__init__.py
self.date = time.time()
self.date = int(time.time())
def make (self): """ Make the destination file. This recursively makes all dependencies, then compiles the target if dependencies were modified. The semantics of the return value is the following: - 0 means that the process failed somewhere (in this node or in one of its dependencies) - 1 means that nothing had to be done - 2 means that something was recompiled (therefore nodes that depend on this one have to be remade) """ must_make = 0 for src in self.sources.values(): ret = src.make() if ret == 0: return 0 if ret == 2: must_make = 1 if must_make or self.should_make(): if self.run(): return 0 self.date = time.time() return 2 return 1
ea9927f2e332f6b861a20e238ab03e47da1c7863 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/ea9927f2e332f6b861a20e238ab03e47da1c7863/util.py
if string.strip(code) != "":
if code:
def error (self, file, line, text, code): """ This method is called when the parsing of the log file found an error. The arguments are, respectively, the name of the file and the line number where the error occurred, the description of the error, and the offending code (up to the error). """ self.write(0, _("\nline %d in %s:\n %s") % (line, file, text)) if string.strip(code) != "": self.write(0, " --> " + code)
409c0f196d6d21ec3cac485fa347364241efab3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/409c0f196d6d21ec3cac485fa347364241efab3a/__init__.py
re_line = re.compile("l\\.(?P<line>[0-9]+) ")
re_line = re.compile("l\\.(?P<line>[0-9]+)( (?P<text>.*))?$")
def register (self, name, dict={}): """ Attempt to register a package with the specified name. If a module is found, create an object from the module's class called `Module', passing it the environment and `dict' as arguments. This dictionary describes the command that caused the registration. """ r = self.load_module(name, "rubber.modules") if r == 0: self.env.msg(3, _("no support found for %s") % name) return 1 elif r == 2: self.env.msg(3, _("module %s already registered") % name) return 1 mod = self.modules[name].Module(self.env, dict) self.env.msg(2, _("module %s registered") % name) self.objects[name] = mod return 0
409c0f196d6d21ec3cac485fa347364241efab3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/409c0f196d6d21ec3cac485fa347364241efab3a/__init__.py
error, line[m.end():])
error, m.group("text"))
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None parsing = 0 # 1 if we are parsing an error's text skipping = 0 # 1 if we are skipping text until an empty line something = 0 # 1 if some error was found for line in self.lines: line = line.rstrip() if line == "": skipping = 0 elif skipping: pass elif parsing: m = re_line.match(line) if m: parsing = 0 skipping = 1 self.msg.error(pos[-1], int(m.group("line")), error, line[m.end():]) elif line[0:3] == "***": parsing = 0 skipping = 1 self.msg.abort(error, line[4:]) elif line[0] == "!": error = line[2:] parsing = 1 something = 1 else: # Here there is no error to show, so we use the text of the # line to track the source file name. However, there might be # confusing text in the log file, in particular when there is # an overfull/underfull box message (the text following this # is extracted from the source, and the extract may contain # unbalanced parentheses). Therefore we take care of this # specifically.
409c0f196d6d21ec3cac485fa347364241efab3a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/409c0f196d6d21ec3cac485fa347364241efab3a/__init__.py
old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
if self.style: old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
def set_style (self, style): """ Define the bibliography style used. This method is called when \\bibliographystyle is found. If the style file is found in the current directory, it is considered a dependency. """ old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
be71d79900a79fa47ce4eab29b5c8bafe5aee386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/be71d79900a79fa47ce4eab29b5c8bafe5aee386/bibtex.py
re_file = re.compile("(\((?P<file>[^ ()]*)|\))")
re_file = re.compile("(\\((?P<file>[^ ()]*)|\\))") re_badbox = re.compile("(Ov|Und)erfull \\\\[hv]box ")
def register (self, name, dict={}): """ Attempt to register a package with the specified name. If a module is found, create an object from the module's class called `Module', passing it the environment and `dict' as arguments. This dictionary describes the command that caused the registration. """ r = self.load_module(name, "rubber.modules") if r == 0: self.env.msg(3, _("no support found for %s") % name) return 1 elif r == 2: self.env.msg(3, _("module %s already registered") % name) return 1 mod = self.modules[name].Module(self.env, dict) self.env.msg(2, _("module %s registered") % name) self.objects[name] = mod return 0
06136d32eb3d7a9f7532309eb3c07224eb27e52d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/06136d32eb3d7a9f7532309eb3c07224eb27e52d/__init__.py
stack[0] is the main source while stack[-1] is the current one.
stack[1] is the main source while stack[-1] is the current one. The first element, stack[0], contains the string \"(no file)\" for errors that may happen outside the source.
def update_file (self, line, stack): """ Parse the given line of log file for file openings and closings and update the list `stack'. Newly opened files are at the end, therefore stack[0] is the main source while stack[-1] is the current one. """ m = re_file.search(line) if not m: return while m: if line[m.start()] == '(': stack.append(m.group("file")) else: del stack[-1] line = line[m.end():] m = re_file.search(line) return
06136d32eb3d7a9f7532309eb3c07224eb27e52d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/06136d32eb3d7a9f7532309eb3c07224eb27e52d/__init__.py
showing = 0 something = 0
showing = 0 skipping = 0 something = 0
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 something = 0 for line in self.lines: line = line.rstrip() if line == "": continue if showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 else: self.update_file(line, pos) else: if line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else: self.update_file(line, pos) return something
06136d32eb3d7a9f7532309eb3c07224eb27e52d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/06136d32eb3d7a9f7532309eb3c07224eb27e52d/__init__.py
continue if showing:
skipping = 0 elif skipping: pass elif showing:
def show_errors (self): """ Display all errors that occured during compilation. Return 0 if there was no error. """ pos = ["(no file)"] last_file = None showing = 0 something = 0 for line in self.lines: line = line.rstrip() if line == "": continue if showing: self.msg(0, line) if line[0:2] == "l." or line[0:3] == "***": showing = 0 else: self.update_file(line, pos) else: if line[0] == "!": if pos[-1] != last_file: last_file = pos[-1] self.msg(0, _("in file %s:") % last_file) self.msg(0, line) showing = 1 something = 1 else: self.update_file(line, pos) return something
06136d32eb3d7a9f7532309eb3c07224eb27e52d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/06136d32eb3d7a9f7532309eb3c07224eb27e52d/__init__.py