text
stringlengths 0
828
|
---|
il.Assign(length2, il.Len(arg)),
|
il.Assign(i, il.Integer(0)),
|
il.Assign(p, pos),
|
il.while_(il.and_(il.Lt(i, length2), il.Lt(p, length), il.Eq(il.GetItem(text, p), il.GetItem(arg, i))),
|
il.AddAssign(p, il.Integer(1)),
|
il.AddAssign(i, il.Integer(1)),
|
),
|
il.If(il.Lt(i, length2),
|
il.failcont(il.NONE),
|
il.begin(il.append_failcont(compiler,
|
il.SetParseState(il.Tuple(text, pos))),
|
il.SetParseState(il.Tuple(text, p)),
|
cont(arg)))))
|
else:
|
raise CompileTypeError"
|
4859,"def update_version(self, version, step=1):
|
""Compute an new version and write it as a tag""
|
# update the version based on the flags passed.
|
if self.config.patch:
|
version.patch += step
|
if self.config.minor:
|
version.minor += step
|
if self.config.major:
|
version.major += step
|
if self.config.build:
|
version.build_number += step
|
if self.config.build_number:
|
version.build_number = self.config.build_number
|
# create a new tag in the repo with the new version.
|
if self.config.dry_run:
|
log.info('Not updating repo to version {0}, because of --dry-run'.format(version))
|
else:
|
version = self.call_plugin_function('set_version', version)
|
return version"
|
4860,"def row(self):
|
""""""Returns current data row: MyDBRow object, or None""""""
|
ret = None
|
i = self.tableWidget.currentRow()
|
if i >= 0:
|
ret = self._data[i]
|
return ret"
|
4861,"def _find_id(self, id_):
|
""""""Moves to row where formula is (if found, otherwise does nothing)""""""
|
for i, row in enumerate(self._data):
|
if row[""id""] == id_:
|
t = self.tableWidget
|
# idx = t.itemFromIndex()
|
t.setCurrentCell(i, 0)
|
break"
|
4862,"def _wanna_emit_id_changed(self):
|
""""""Filters intentions to emit the id_changed signal (only does if id really changed)""""""
|
if self._last_id != self._get_id():
|
self._last_id = self._get_id()
|
self.id_changed.emit()"
|
4863,"def _get_id(self):
|
""""""Getter because using the id property from within was not working""""""
|
ret = None
|
row = self.row
|
if row:
|
ret = row[""id""]
|
return ret"
|
4864,"def time_pipeline(iterable, *steps):
|
'''
|
This times the steps in a pipeline. Give it an iterable to test against
|
followed by the steps of the pipeline seperated in individual functions.
|
Example Usage:
|
```
|
from random import choice, randint
|
l = [randint(0,50) for i in range(100)]
|
step1 = lambda iterable:(i for i in iterable if i%5==0)
|
step2 = lambda iterable:(i for i in iterable if i%8==3)
|
step3 = lambda iterable:sorted((1.0*i)/50 for i in iterable)
|
step4 = lambda iterable:(float(float(float(float(i*3)))) for i in iterable)
|
print('filter first')
|
time_pipeline(l, step1, step2, step3, step4)
|
print('process first')
|
time_pipeline(l, step3, step4, step1, step2)
|
print('filter, process, filter, process')
|
time_pipeline(l, step1, step3, step2, step4)
|
```
|
Outputs:
|
filter first
|
step 1 | 2.0427s | step1 = lambda iterable:(i for i in iterable if i%5==0)
|
step 2 | 2.0510s | step2 = lambda iterable:(i for i in iterable if i%8==3)
|
step 3 | 2.4839s | step3 = lambda iterable:sorted((1.0*i)/50 for i in iterable)
|
step 4 | 2.8446s | step4 = lambda iterable:(float(float(float(float(i*3)))) for i in iterable)
|
process first
|
step 1 | 7.5291s | step3 = lambda iterable:sorted((1.0*i)/50 for i in iterable)
|
step 2 | 20.6732s | step4 = lambda iterable:(float(float(float(float(i*3)))) for i in iterable)
|
step 3 | 16.8470s | step1 = lambda iterable:(i for i in iterable if i%5==0)
|
step 4 | 16.8269s | step2 = lambda iterable:(i for i in iterable if i%8==3)
|
filter, process, filter, process
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.