bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def __init__(self, columns=None, transaction=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
def __init__(self, columns=None, cls=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
31,000
def __init__(self, columns=None, transaction=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
def __init__(self, columns=None, transaction=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
31,001
def __init__(self, columns=None, transaction=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
def __init__(self, columns=None, transaction=None, searcher=None, **kwargs): """ @param columns: A list of Columns. Only the C{read} attribute needs to be set.
31,002
def doSearch(self, *ignore): """ Performs the abstract search. The result ends up in aSearch.value as a list and returns the length of the list. """ data = {} for i in xrange(len(self.columns)): e = self.entries[i] c = self.columns[i] if e.value != '': # '' means `don't filter by me' data[c.attribute] = e.value
def doSearch(self, *ignore): """ Performs the abstract search. The result ends up in aSearch.value as a list and returns the length of the list. """ data = {} for i in xrange(len(self.columns)): e = self.entries[i] c = self.columns[i] if e.value != '': # '' means `don't filter by me' data[c.attribute] = e.value
31,003
code= """def %(methodName)s (self, control, *ignore): print control.value self.value.%(methodName)s(control.value)"""
code= """def %(methodName)s (self, control, *ignore): print control.value self.value.%(methodName)s(control.value)"""
31,004
def __init__(self, *a, **kw): print dir(CountryEditor) return super(CountryEditor, self).__init__(*a, **kw)
def __init__(self, *a, **kw): return super(CountryEditor, self).__init__(*a, **kw)
31,005
def testNew (self): self.widget.newModel (Country) self.assert_ (isinstance (self.widget.value, Country))
def testNew (self): self.widget.newModel (self.widget, Country) self.assert_ (isinstance (self.widget.value, Country))
31,006
def setattr(self, attr, value): """ Find the attribute referred to by 'attr', and set it to 'value'. """ pos = attr.rfind('.') if pos > -1: path = attr[:pos] attr = attr[pos+1:] obj = traverse(self, path) else: obj = self return setattr(obj, attr, value)
def setattr(self, attr, value): """ Find the attribute referred to by 'attr', and set it to 'value'. """ pos = attr.rfind('.') if pos > -1: path = attr[:pos] attr = attr[pos+1:] obj = traverse(self, path) else: obj = self return setattr(obj, attr, value)
31,007
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans = Transaction() v= cimarron.skin.VBox (parent=self.win)
31,008
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
31,009
def save(self, ignore): self.trans.save()
def save(self, *ignore): self.trans.save()
31,010
def discard(self, ignore): self.trans.discard() self.stockEditor.refresh()
def discard(self, *ignore): self.trans.discard() self.stockEditor.refresh()
31,011
def addToDetails(self, detail): self.amount += detail.amount print 'total amount ', self.amount super(Invoice, self).addToDetails(detail)
def addToDetails(self, detail): self.amount += detail.amount print 'total amount ', self.amount super(Invoice, self).addToDetails(detail)
31,012
def removeFromDetails(self, detail): self.amount -= detail.amount print 'total amount ', self.amount super(Invoice, self).removeFromDetails(detail)
def removeFromDetails(self, detail): self.amount -= detail.amount
31,013
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans = Transaction() v= cimarron.skin.VBox (parent=self.win)
31,014
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
def __init__(self, **kw): super(StockAdjustmentWindow, self).__init__(**kw) self.win.title = "Stock Adjustment" self.trans= Transaction () v= cimarron.skin.VBox (parent=self.win)
31,015
def save(self, ignore): self.trans.save()
def save(self, *ignore): self.trans.save()
31,016
def discard(self, ignore): self.trans.discard() self.stockEditor.refresh()
def discard(self, *ignore): self.trans.discard() self.stockEditor.refresh()
31,017
def _schedule(timeout, callback, repeat=False): def cb(): gobject.timeout_add(timeout, callback) if repeat: cb() cb()
def _schedule(timeout, callback, repeat=0): if repeat: def cb(): callback() gobject.timeout_add(timeout, cb) else: cb = callback gobject.timeout_add(timeout, cb)
31,018
def field (self, field): fieldName= self.__fieldName__ (field.name) contents= ["'%s'" % fieldName] try: try: relation= field.get_reference () type= 'RToOne' contents+= ["'%s'" % self.__tableName__ (relation.name)] if field.inverse: # contents+= ["inverse='%s'" % self.__pluralFieldName__ (field.inverse)] contents+= ["in...
def field (self, field): fieldName= self.__fieldName__ (field.name) contents= ["'%s'" % fieldName] try: try: relation= field.get_reference () type= 'RToOne' contents+= ["'%s'" % self.__tableName__ (relation.name)] if field.inverse: # contents+= ["inverse='%s'" % self.__pluralFieldName__ (field.inverse)] contents+= ["in...
31,019
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.window.title = "Receipt Generation" self.trans = Transaction() self.target=Receipt(date=today()) self.trans.track(self.target)
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.window.title = "Receipt Generation" self.trans = Transaction() self.target=Receipt(date=today()) self.trans.track(self.target)
31,020
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.window.title = "Receipt Generation" self.trans = Transaction() self.target=Receipt(date=today()) self.trans.track(self.target)
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.window.title = "Receipt Generation" self.trans = Transaction() self.target=Receipt(date=today()) self.trans.track(self.target)
31,021
def refresh (self): for i in xrange (len (self.data)): if len (self.labels)<=i: # the row does not exist, so we add it h= cimarron.skin.HBox (parent=self.widget) b= cimarron.skin.Label ( parent= h, text= ' ', row= i )
def refresh (self): for i in xrange (len (self.data)): if len (self.labels)<=i: # the row does not exist, so we add it h= cimarron.skin.HBox (parent=self.widget) b= cimarron.skin.Label ( parent= h, text= ' ', row= i )
31,022
def will_focus_out (self, entry, *ignore): entry.onAction ()
def will_focus_out (self, entry, *ignore): entry.onAction ()
31,023
def concreteParenter (self, child): super (Notebook, self).concreteParenter (child) if getattr (child, '_widget', None): label= gtk.Label() label.set_text (child.label) self._widget.set_tab_label (child._widget, label)
def _concreteParenter (self, child): super (Notebook, self)._concreteParenter (child) if getattr (child, '_widget', None): label= gtk.Label() label.set_text (child.label) self._widget.set_tab_label (child._widget, label)
31,024
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in [[['7', self.numberButton], ['4', self.numberButton], ['1', sel...
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in ((('7', self.numberButton), ('4', self.numberButton), ('1', sel...
31,025
def operate(self, sender=None): if not self.resetInput: if self.op == None: self.X = float(self.display.text) else: if self.op == '+': self.X = self.X + float(self.display.text) elif self.op == '-': self.X = self.X - float(self.display.text) elif self.op == '*': self.X = self.X * float(self.display.text) elif self.op =...
def operate(self, sender=None): if not self.resetInput: if self.op == None: self.X = float(self.display.text) else: if self.op == '+': self.X = self.X + float(self.display.text) elif self.op == '-': self.X = self.X - float(self.display.text) elif self.op == '*': self.X = self.X * float(self.display.text) elif self.op =...
31,026
def export(self, xot, **opts): """return the xml document to create the screen represented by the xot""" self.xot= xot
def export(self, xot, **opts): """return the xml document to create the screen represented by the xot""" self.xot= xot
31,027
def export(self, xot, **opts): """return the xml document to create the screen represented by the xot""" self.xot= xot
def export(self, xot, **opts): """return the xml document to create the screen represented by the xot""" self.xot= xot
31,028
def export(self, xot, **opts): """return the xml document to create the screen represented by the xot""" self.xot= xot
defexport(self,xot,**opts):"""returnthexmldocumenttocreatethescreenrepresentedbythexot"""self.xot=xot
31,029
def makeTab (self, xmlObj, crud): kind_name= xmlObj.prop ('name') KindName= MakeFieldName (kind_name) kind = self.xot.tables[kind_name]
def makeTab (self, xmlObj, crud): kind_name= xmlObj.prop ('name') KindName= MakeFieldName (kind_name) kind = self.xot.tables[kind_name]
31,030
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in ((('7', self.numberButton), ('4', self.numberButton), ('1', sel...
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in (({'label': '7', 'onAction': self.numberButton}, {'label': '4',...
31,031
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in ((('7', self.numberButton), ('4', self.numberButton), ('1', sel...
def __init__(self, **kw): super(CalculatorController, self).__init__(**kw) self.win.title = 'Calculator' vbox = cimarron.skin.VBox(parent=self.win) self.display = cimarron.skin.Label(parent=vbox, text='0') hbox = cimarron.skin.HBox(parent=vbox) for aRow in ((('7', self.numberButton), ('4', self.numberButton), ('1', sel...
31,032
def clear(self, sender=None): self.op = None self.display.text = '0' self.X = 0 self.resetInput = True
def clear(self, sender=None): self.op = None self.display.text = '0' self.X = 0 self.resetInput = True
31,033
def operate(self, sender=None): if not self.resetInput: val = float(self.display.text) if self.op is not None: val = self.op(self.X, val) self.display.text = str(val) self.resetInput = True self.X = val self.op = self.operations[sender.label]
def operate(self, sender=None): if not self.resetInput: val = float(self.display.text) if self.op is not None: val = self.op(self.X, val) self.display.text = str(val) self.resetInput = True self.X = val self.op = self.operations[sender.label]
31,034
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actually...
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{_config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actuall...
31,035
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actually...
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actually...
31,036
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actually...
def _config(skin_name=DEFAULT_SKIN_NAME): """ Although currently a function, L{config} will probably become a class because we strongly suspect people will want to actually do some configuration loading here. In fact, one thing we learned while implementing the first Cimarrón is that a lot of functionality is actually...
31,037
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
def__getattr__(self,attr):#areweahack,orwhat?_config()forkinself.__dict__:ifknotinskin.__dict__:delself.__dict__[k]fork,vinskin.__dict__.items():self.__dict__[k]=vreturngetattr(skin,attr)
31,038
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
def __getattr__(self, attr): # are we a hack, or what? _config() self.__dict__.clear() self.__dict__.update(skin.__dict__) return getattr(skin, attr)
31,039
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
31,040
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
def __getattr__(self, attr): # are we a hack, or what? _config() for k in self.__dict__: if k not in skin.__dict__: del self.__dict__[k] for k, v in skin.__dict__.items(): self.__dict__[k] = v return getattr(skin, attr)
31,041
def __init__(self, columns=None, **kwargs): from fvl.cimarron import skin if columns is None: columns = [] super(SelectionWindow, self).__init__(parent=self.parent, title='Select', size=(40, 25), **kwargs) vbox = skin.VBox(parent=self.window) self.grid = skin.SelectionGrid(parent=vbox, columns=columns, onAction=self.o...
def __init__(self, columns=None, **kwargs): from fvl.cimarron import skin if columns is None: columns = [] super(SelectionWindow, self).__init__(parent=self.parent, title='Select', size=(40, 25), **kwargs) vbox = skin.VBox(parent=self.window) self.grid = skin.SelectionGrid(parent=vbox, columns=columns, onAction=self.o...
31,042
def attributesToConnect(cls): """ See L{XmlMixin.attributesToConnect <fvl.cimarron.skins.common.XmlMixin.attributesToConnect>} """ attrs = super (Search, cls).attributesToConnect() return attrs+['searcher']
def attributesToConnect(cls): """ See L{XmlMixin.attributesToConnect <fvl.cimarron.skins.common.XmlMixin.attributesToConnect>} """ attrs = super (Search, cls).attributesToConnect() return attrs+['searcher']
31,043
def _set_columns(self, columns): logger.debug (`columns`) if columns is not None: from fvl.cimarron.skin import Label, Button for column in columns: # build label and entry Label(text=column.name+":", parent=self.h) entryConstr = column.entry entry = entryConstr(parent=self.h, onAction=self.search) entry.delegates.appe...
def _set_columns(self, columns): logger.debug (`columns`) if columns is not None: from fvl.cimarron.skin import Label, Button for column in columns: # build label and entry Label(text=column.name+":", parent=self.h) entryConstr = column.entry entry = entryConstr(parent=self.h, onAction=self.search) entry.delegates.appe...
31,044
def doSearch(self, *ignore): """ Performs the abstract search. The result ends up in aSearch.value as a list and returns the length of the list. """ self.window.disable() try: qual = None for i in xrange(len(self.columns)): e = self.entries[i] if e.value != '' and e.value is not None: value = e.value c = self.columns[i...
def doSearch(self, *ignore): """ Performs the abstract search. The result ends up in aSearch.value as a list and returns the length of the list. """ self.window.disable() try: qual = None for i in xrange(len(self.columns)): e = self.entries[i] if e.value != '' and e.value is not None: value = e.value c = self.columns[i...
31,045
def selectedValue(cell, path, colNo, *ignore): logger.debug(self.value) # update the grid grid._cell_edited(cell, path, self.value, colNo)
def selectedValue(cell, path, colNo, *ignore): logger.debug(self.value) # update the grid grid._cell_edited(cell, path, self.value, colNo)
31,046
def _get_columns(self): return super(SearchEntry, self)._get_columns()
def _get_columns(self): return super(SearchEntry, self)._get_columns()
31,047
def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.name)
def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.name)
31,048
def skeleton(self, parent=None): skel = super(Container, self).skeleton(parent) for child in self.children: child.skeleton(skel) return skel
def skeleton(self, parent=None): skel = super(Container, self).skeleton(parent) for child in self.children: child.skeleton(skel) return skel
31,049
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.win.title = "Receipt Generation" self.trans = Transaction() #self.commitValue(Receipt()) theReceipt = Receipt() self.target = theReceipt #self.target = Receipt() #self.trans.track(self.value) self.trans.track(theReceipt)
def __init__(self, **kw): super(ReceiptWindow, self).__init__(**kw) self.win.title = "Receipt Generation" self.trans = Transaction() #self.commitValue(Receipt()) theReceipt = Receipt() self.target = theReceipt #self.target = Receipt() #self.trans.track(self.value) self.trans.track(theReceipt)
31,050
def discard(self, *ignore): self.trans.discard() self.target = None self.refresh()
def discard(self, *ignore): self.trans.discard() self.target = None self.refresh()
31,051
def setUp (self): self.target = dict(foo=1, bar=2, baz=3)
def setUp (self): self.target = dict(foo=1, bar=2, baz=3)
31,052
def setUp (self): self.target = dict(foo=1, bar=2, baz=3)
def setUp (self): self.target = dict(foo=1, bar=2, baz=3)
31,053
def testSetValue(self): """ This assumes that setting the value re-fires refresh() """ self.widget.entry.value = 'quux' self.widget.target = dict(quux='-13') self.assertEqual(self.widget.label.text, '-13')
def testSetValue(self): """ This assumes that setting the value re-fires refresh() """ self.widget.entry.value = 'quux' self.widget.newTarget (dict(quux='-13')) self.assertEqual(self.widget.label.text, '-13')
31,054
def setUp (self): super (TestCRUDController, self).setUp () self.widget= CRUDController.fromXmlFile ('test/testCrud.xml') self.widget.parent= self.parent= self.app self.widget.target= self.target= Person ( "Freeman", "Newman", [Address (text="San luis 870"), Address (text="San luis 594 2D")] ) self.attribute= 'name' se...
def setUp (self): super (TestCRUDController, self).setUp () self.widget= CRUDController.fromXmlFile ('test/testCrud.xml') self.widget.parent= self.parent= self.app person= Person ("Freeman", "Newman", [Address (text="San luis 870"), Address (text="San luis 594 2D")] ) self.attribute= 'name' self.value= 'Freeman'...
31,055
def setUp (self): super (TestCRUDController, self).setUp () self.widget= CRUDController.fromXmlFile ('test/testCrud.xml') self.widget.parent= self.parent= self.app self.widget.target= self.target= Person ( "Freeman", "Newman", [Address (text="San luis 870"), Address (text="San luis 594 2D")] ) self.attribute= 'name' se...
def setUp (self): super (TestCRUDController, self).setUp () self.widget= CRUDController.fromXmlFile ('test/testCrud.xml') self.widget.parent= self.parent= self.app self.widget.target= self.target= Person ( "Freeman", "Newman", [Address (text="San luis 870"), Address (text="San luis 594 2D")] ) self.setUpControl (target...
31,056
def testRefresh (self): self.widget.target= self.target self.assertEqual (self.widget.editors[0].target, self.target) self.assertEqual (self.widget.editors[1].target, self.target.getAddresses ())
def testRefresh (self): self.assertEqual (self.widget.editors[0].target, self.target) self.assertEqual (self.widget.editors[1].target, self.target.getAddresses ())
31,057
def __init__ (self, cls=None, searchColumns=None, editorClass=None, filename=None, store=None, **kwargs): from fvl.cimarron.skin import Notebook, VBox, Button
def __init__ (self, cls=None, searchColumns=None, editorClass=None, filename=None, store=None, **kwargs): from fvl.cimarron.skin import Notebook, VBox, Button
31,058
def search(query, operator='and'): """Execute a search given by 'query' as a list/tuple of filter ids. 'operator' can be 'and' or 'or' to search for matches in all or any filter.
def search(query, operator='and'): """Execute a search given by 'query' as a list/tuple of filter ids. 'operator' can be 'and' or 'or' to search for matches in all or any filter.
31,059
def _text2list(text): # Helper: splitter input may be a string or a list of strings try: text + u"" except: return text else: return [text]
def _text2list(text): # Helper: splitter input may be a string or a list of strings try: text + u"" except: return text else: return [text]
31,060
headingTypedef = re.compile(r'typedef')
headingTypedef = re.compile(r'typedef')
31,061
headingTypedef = re.compile(r'typedef')
headingTypedef = re.compile(r'typedef')
31,062
headingTypedef = re.compile(r'typedef')
headingTypedef = re.compile(r'typedef')
31,063
def convertBody(text): text = body.sub(bodyReplacement, text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', text) text = footer.sub(r'', text, 1) text = s...
def convertBody(text): text = body.sub(bodyReplacement, text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', text) text = footer.sub(r'', text, 1) text = s...
31,064
def convertAIndex(text): text = re.sub(r'<H2>Variables</H2>', r'<H2>typedefs</H2>', text) text = re.sub(r'<H1>Table of contents</H1>', r'<table bgcolor="#e0d090" width=100% cellpadding=5>\n<tr>\n' \ r'<th align=left width=100%><font size=+3>Table of Contents</font></th>\n' \ r'<th align=right ><a href="index.html"><IM...
def convertAIndex(text): text = re.sub(r'<H2>Variables</H2>', r'<H2>typedefs</H2>', text) text = re.sub(r'<H1>Table of contents</H1>', r'<table bgcolor="#e0d090" width=100% cellpadding=5>\n<tr>\n' \ r'<th align=left width=100%><font size=+3>Table of Contents</font></th>\n' \ r'<th align=right ><a href="index.html"><IM...
31,065
def convertHIER(text): text = re.sub(r'<H1>(.*?)</H1>', r'<table bgcolor="#e0d090" width=100% cellpadding=5>\n<tr>\n' \ r'<th align=left width=100%><font size=+3>\1</font></th>\n' \ r'<th align=right ><a href="index.html"><IMG border=0 SRC="documents/vigra.gif"></a>' \ r'<tr>\n</table>', text) return text
def convertHIER(text): text = re.sub(r'<H1>(.*?)</H1>', r'<table bgcolor="#e0d090" width=100% cellpadding=5>\n<tr>\n' \ r'<th align=left width=100%><font size=+3>\1</font></th>\n' \ r'<th align=right ><a href="index.html"><IMG border=0 SRC="documents/vigra.gif"></a>' \ r'<tr>\n</table>', text) return text
31,066
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertBody(text) if fileName == str(sys.argv[1]) + '/index.html': text = convertIndex(text, str(sys.argv[2])) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) elif fileName == str(sys.argv[1]) + ...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertBody(text) if fileName == str(sys.argv[1]) + '/index.html': text = convertIndex(text, str(sys.argv[2])) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) elif fileName == str(sys.argv[1]) + ...
31,067
def convertHeading(text): # create a table for the heading (with down arrow at left and VIGRA logo at right) text = heading.sub( r'<table cellpadding=5 bgcolor="#e0d090">\n<tr>\n\1\n' + r'</font></th>\n' + r'<th align=right ><a href="index.html"><IMG border=0 SRC="documents/vigra3.gif"></a>' + r'</th></tr>\n</table>\n'...
def convertHeading(text): # create a table for the heading (with down arrow at left and VIGRA logo at right) text = heading.sub( r'<table cellpadding=5 bgcolor="#e0d090">\n<tr>\n\1\n' + r'</font></th>\n' + r'<th align=right ><a href="index.html"><IMG border=0 SRC="documents/vigra3.gif"></a>' + r'</th></tr>\n</table>\n'...
31,068
def convertBody(text): text = body.sub(r'<body bgcolor="#f8f0e0" link="#0040b0" vlink="#a00040">', text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', te...
def convertBody(text): text = body.sub(r'<body bgcolor="#f8f0e0" link="#0040b0" vlink="#a00040">', text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', te...
31,069
def convertBody(text): text = body.sub(r'<body bgcolor="#f8f0e0" link="#0040b0" vlink="#a00040">', text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', te...
def convertBody(text): text = body.sub(r'<body bgcolor="#f8f0e0" link="#0040b0" vlink="#a00040">', text, 1) text = callOperator.sub(r'operator()', text) text = tag.sub(r'<\1>', text) text = atag.sub(r'<a name="\1">', text) text = umlaut.sub(r'&\1;', text) text = squared.sub(r'&#178', text) text = cube.sub(r'&#179', te...
31,070
def convertAIndex(text): return re.sub(r'<H2>Variables</H2>', r'<H2>typedefs</H2>', text)
def convertAIndex(text): text = re.sub(r'<H2>Variables</H2>', r'<H2>typedefs</H2>', text) text = re.sub(r'<H1>Table of contents</H1>', r'<table bgcolor=" r'<th align=left width=100%><font size=+3>Table of Contents</font></th>\n' \ r'<th align=right ><a href="index.html"><IMG border=0 SRC="documents/vigra.gif"></a>' \ ...
31,071
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() headingText = findHeading(text) newHeadingText = convertHeading(headingText) text = heading.sub(newHeadingText, text) text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) if fileName ...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) if fileName == str(sys.argv[1]) + '/index.html': text = convertIndex(text, str(sys.argv[2])) f = open(fileName, 'w+') f.write(tex...
31,072
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() headingText = findHeading(text) newHeadingText = convertHeading(headingText) text = heading.sub(newHeadingText, text) text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) if fileName ...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() headingText = findHeading(text) newHeadingText = convertHeading(headingText) text = heading.sub(newHeadingText, text) text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) elif fileNam...
31,073
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() headingText = findHeading(text) newHeadingText = convertHeading(headingText) text = heading.sub(newHeadingText, text) text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) if fileName ...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() headingText = findHeading(text) newHeadingText = convertHeading(headingText) text = heading.sub(newHeadingText, text) text = convertBody(text) if fileName == str(sys.argv[1]) + '/aindex.html': text = convertAIndex(text) if fileName ...
31,074
def findExplicitDeclarations(text): decl = {} t = text while len(t): m = re.search(r'Declarations?:[^\(]*?\s*([a-zA-Z_][a-zA-Z_0-9]*) *\(', t) if not m: break decl[m.groups()[0]] = 1 t = t[m.end():] t = "" for i in decl.keys(): t = t + i + "|" if t: return "(" + t[:-1] + ")" else: return None
def findExplicitDeclarations(text): decl = {} t = text while len(t): m = re.search(r'Declarations?:[^\(]*?(\s*<a class="code"[^>]*>|\s*)([a-zA-Z_][a-zA-Z_0-9]*)(</a>| *)\(', t) if not m: break decl[m.groups()[0]] = 1 t = t[m.end():] t = "" for i in decl.keys(): t = t + i + "|" if t: return "(" + t[:-1] + ")" else: retu...
31,075
def findExplicitDeclarations(text): decl = {} t = text while len(t): m = re.search(r'Declarations?:[^\(]*?\s*([a-zA-Z_][a-zA-Z_0-9]*) *\(', t) if not m: break decl[m.groups()[0]] = 1 t = t[m.end():] t = "" for i in decl.keys(): t = t + i + "|" if t: return "(" + t[:-1] + ")" else: return None
def findExplicitDeclarations(text): decl = {} t = text while len(t): m = re.search(r'Declarations?:[^\(]*?\s*([a-zA-Z_][a-zA-Z_0-9]*) *\(', t) if not m: break decl[m.groups()[1]] = 1 t = t[m.end():] t = "" for i in decl.keys(): t = t + i + "|" if t: return "(" + t[:-1] + ")" else: return None
31,076
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertHeader(text) if not re.search(r'.*source.html', fileName): text = convertPage(text) else: text = convertSource(text) if re.search(r'.*/group__.*html', fileName): text = typedefField.sub(r'<br><b>&nbsp;\1</b><br>&nbsp;'...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertHeader(text) if not re.search(r'.*source.html', fileName): text = convertPage(text) else: text = convertSource(text) if re.search(r'.*/group__.*html', fileName): text = typedefField.sub(r'<br><b>&nbsp;\1</b><br>&nbsp;'...
31,077
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertHeader(text) if not re.search(r'.*source.html', fileName): text = convertPage(text) else: text = convertSource(text) if re.search(r'.*/group__.*html', fileName): text = typedefField.sub(r'<br><b>&nbsp;\1</b><br>&nbsp;'...
def processFile(fileName): print fileName f = open(fileName) text = f.read() f.close() text = convertHeader(text) if not re.search(r'.*source.html', fileName): text = convertPage(text) else: text = convertSource(text) if re.search(r'.*/group__.*html', fileName): text = typedefField.sub(r'<br><b>&nbsp;\1</b><br>&nbsp;'...
31,078
def go(self): glutInitWindowSize(500,500) glutInitWindowPosition(100,100) glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE) self.win = glutCreateWindow("iSink ROV Simulator") self.init() glutDisplayFunc(self.display) glutIdleFunc(self.doframe) self.thistime = self.lastime = time() glutMainLoop()
def go(self): glutInitWindowSize(500,500) glutInitWindowPosition(100,100) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE) self.win = glutCreateWindow("iSink ROV Simulator") self.init() glutDisplayFunc(self.display) glutIdleFunc(self.doframe) self.thistime = self.lastime = time() glutMainLoop()
31,079
def get_backup_info(config): """ @type configfile: ConfigParser @param configfile: The config file to read from @rtype: dictionary of tuples @return: Maps directory to a tuple of (src, days, weeks) Config file format: # Name directory pair [locations] trac = /var/backup/trac # Specifies a weekly and inremental # W...
def get_backup_info(config): """ @type configfile: ConfigParser @param configfile: The config file to read from @rtype: dictionary of tuples @return: Maps directory to a tuple of (src, days, weeks) Config file format: # Name directory pair [locations] trac = /var/backup/trac # Specifies a weekly and inremental # W...
31,080
def date_name(path): """ Takes a file specified by path and returns its name in strftime format %F_%T which is its last modified time """ # Get the modification time from the timestamp of the fill mod_time = datetime.fromtimestamp(os.stat(path).st_mtime) # Grab our parent directory base_dir = os.path.split(path)[0] # J...
def date_name(path): """ Takes a file specified by path and returns its name in strftime format %F_%T which is its last modified time """ # Get the modification time from the timestamp of the fill mod_time = datetime.fromtimestamp(os.stat(path).st_mtime) # Grab our parent directory # Join the two and rename the file d...
31,081
def date_name(path): """ Takes a file specified by path and returns its name in strftime format %F_%T which is its last modified time """ # Get the modification time from the timestamp of the fill mod_time = datetime.fromtimestamp(os.stat(path).st_mtime) # Grab our parent directory base_dir = os.path.split(path)[0] # J...
def date_name(path): """ Takes a file specified by path and returns its name in strftime format %F_%T which is its last modified time """ # Get the modification time from the timestamp of the fill mod_time = datetime.fromtimestamp(os.stat(path).st_mtime) # Grab our parent directory base_dir = os.path.split(path)[0] # J...
31,082
def ensure_path(path): """ Makes sure a path exists, and if it doesn't it will create it """ if ~os.path.exists(path): os.makedirs(path);
def ensure_path(path): """ Makes sure a path exists, and if it doesn't it will create it """ if os.path.exists(path) is False: os.makedirs(path);
31,083
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
31,084
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
31,085
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
31,086
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
def main(argv=None): # Parse are command line parser = OptionParser() parser.add_option("-c", "--config", dest="configfile", help="The location of config", default='etc/opt/backup.cfg') (options, args) = parser.parse_args() # Read the config file and pull out usefull information config = ConfigParser() config.read(o...
31,087
def run_config(configfile, location = None): """ Loads the config file and call run_location """ # Parse config file config = ConfigParser() config.optionxform = lambda x: x config.read(configfile) if not config.has_section('locations'): print 'ERROR: Configuration file: %s does not have a \'locations\'' \ ' section' %...
def run_config(configfile, location = None): """ Loads the config file and call run_location """ # Parse config file config = ConfigParser() config.optionxform = lambda x: x config.read(configfile) if not config.has_section('locations'): print 'ERROR: Configuration file: %s does not have a \'locations\'' \ ' section' %...
31,088
def main(): # Parse are command line parser = OptionParser(description= \ 'This runs a config file that is basically a mapping of locations to'\ 'commands. Each command name for each location must be unique, see'\ 'test config in the tools/build-deps for an example') parser.add_option("-c", "--config", dest="configfil...
def main(): # Parse are command line parser = OptionParser(description= \ 'This runs a config file that is basically a mapping of locations to'\ 'commands. Each command name for each location must be unique, see'\ 'test config in the tools/build-deps for an example') parser.add_option("-c", "--config", dest="configfil...
31,089
def quote(str): return repr(str)
def quote(s): s = s.replace('\\', '\\\\') s = s.replace('\0', '\\0') s = s.replace('\b', '\\b') s = s.replace('\n', '\\n') s = s.replace('\r', '\\r') s = s.replace('\t', '\\t') s = s.replace('\z', '\\z') s = s.replace("'", "\\'") s = s.replace('"', '\\"') return "'" + s + "'"
31,090
def dump_contents(contents): print "INSERT INTO `toc` (`book_id`, `parent_id`, `number`, `name`, `link`) VALUES" parent_id = 0 id = parent_id + 1 for entry in contents: id = dump_contents_entry(entry, id, parent_id) print ";" print "UPDATE `toc` SET `parent_id` = LAST_INSERT_ID() + `parent_id` - 1 WHERE `book_id` = @b...
def dump_contents(contents): print "INSERT INTO `toc` (`book_id`, `parent_id`, `number`, `name`, `link`) VALUES" id = dump_contents_entry(contents, 0, 1) print "UPDATE `toc` SET `parent_id` = LAST_INSERT_ID() + `parent_id` - 1 WHERE `book_id` = @book_id AND `parent_id` != 1;"
31,091
def dump_contents_entry(entry, id, parent_id): print " (@book_id, %d, %d, %s, %s)," % (parent_id, entry.number, quote(entry.name.encode('utf-8')), quote(entry.link.encode('utf-8'))) parent_id = id id = parent_id + 1 for subentry in entry: id = dump_contents_entry(subentry, id, parent_id) return id
def dump_contents_entry(entry, parent_id, last): id = parent_id + 1 for subentry in entry: id = dump_contents_entry(subentry, id, parent_id) return id
31,092
def dump_contents_entry(entry, id, parent_id): print " (@book_id, %d, %d, %s, %s)," % (parent_id, entry.number, quote(entry.name.encode('utf-8')), quote(entry.link.encode('utf-8'))) parent_id = id id = parent_id + 1 for subentry in entry: id = dump_contents_entry(subentry, id, parent_id) return id
def dump_contents_entry(entry, id, parent_id): print " (@book_id, %d, %d, %s, %s)," % (parent_id, entry.number, quote(entry.name.encode('utf-8')), quote(entry.link.encode('utf-8'))) parent_id = id id = parent_id + 1 for subentry in entry: sublast = last and subentry is entry[-1] print " (@book_id, %d, %d, %s, %s)%s" ...
31,093
def dump_archive(archive): print "INSERT INTO `pages` (book_id, path, data) VALUES" for path in archive.list(): data = archive.open(path).read() print " (@book_id, %s, %s)," % (quote(path.encode('utf-8')), quote(data)) print ";"
def dump_archive(archive): print "INSERT INTO `pages` (book_id, path, content) VALUES" paths = archive.list() for path in paths: last = path is paths[-1] content = archive.open(path).read() print " (@book_id, %s, %s)%s" % (quote(path.encode('utf-8')), quote(content), last and ';' or ',')
31,094
def main(): import sys from DevHelp import factory for arg in sys.argv[1:]: try: book = factory(arg) except: raise dump(book)
def main(): from HTB import factory for arg in sys.argv[1:]: try: book = factory(arg) except: raise dump(book)
31,095
def __init__(self, search_path = None): Book.CachingFactory.__init__(self) self._search_path = [ os.path.join(os.getenv('HOME'), '.devhelp2', 'books'), '/usr/share/gtk-doc/html'] if search_path is not None: self._search_path.extend(search_path) self._path_hash = {}
def __init__(self, search_path = None): Book.CachingFactory.__init__(self) self._search_path = [ os.path.join(os.getenv('HOME', ''), '.devhelp2', 'books'), '/usr/share/gtk-doc/html'] if search_path is not None: self._search_path.extend(search_path) self._path_hash = {}
31,096
def enumerate_uncached(self): enum = Book.List() self._path_hash = {} for dir in self._search_path: for name in os.listdir(dir): spec = os.path.join(dir, name, name + '.devhelp') if os.path.isfile(spec): self._path_hash[name] = spec enum.append(name)
def enumerate_uncached(self): enum = Book.List() self._path_hash = {} for dir in self._search_path: for name in os.listdir(dir): spec = os.path.join(dir, name, name + '.devhelp') if os.path.isfile(spec): self._path_hash[name] = spec enum.append(name)
31,097
def insert(self, index, item): item._parentref = weakred.ref(self) item.number = index + 1 self._children.insert(index, item) self._renumber()
def insert(self, index, item): item._parentref = weakref.ref(self) item.number = index + 1 self._children.insert(index, item) self._renumber()
31,098
def _get_children(self): """Get the first child."""
def _get_children(self): """Get the first child."""
31,099