labNo float64 1 10 ⌀ | taskNo float64 0 4 ⌀ | questioner stringclasses 2
values | question stringlengths 9 201 | code stringlengths 18 30.3k | startLine float64 0 192 ⌀ | endLine float64 0 196 ⌀ | questionType stringclasses 4
values | answer stringlengths 2 905 | src stringclasses 3
values | code_processed stringlengths 12 28.3k ⌀ | id stringlengths 2 5 ⌀ | raw_code stringlengths 20 30.3k ⌀ | raw_comment stringlengths 10 242 ⌀ | comment stringlengths 9 207 ⌀ | q_code stringlengths 66 30.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
null | null | null | What does the code accommodate into the levels list ?
| def _get_level(value, levels, prefix=None):
if ((value > 1) or (value < 0)):
raise ValueError(('Encountered invalid normalized alpha diversity value %s. Normalized values must be between 0 and 1.' % value))
check = [i for i in range(0, len(levels)) if (levels[i] == value)]
if len(check):
value_leve... | null | null | null | a value
| codeqa | def get level value levels prefix None if value > 1 or value < 0 raise Value Error ' Encounteredinvalidnormalizedalphadiversityvalue%s Normalizedvaluesmustbebetween 0 and 1 ' % value check [i for i in range 0 len levels if levels[i] value ]if len check value level check[ 0 ] + 2 else value level searchsorted levels val... | null | null | null | null | Question:
What does the code accommodate into the levels list ?
Code:
def _get_level(value, levels, prefix=None):
if ((value > 1) or (value < 0)):
raise ValueError(('Encountered invalid normalized alpha diversity value %s. Normalized values must be between 0 and 1.' % value))
check = [i for i in r... |
null | null | null | What does the code destroy if it does not exist ?
| def service_destroy(context, instance_id):
return IMPL.service_destroy(context, instance_id)
| null | null | null | the service
| codeqa | def service destroy context instance id return IMPL service destroy context instance id
| null | null | null | null | Question:
What does the code destroy if it does not exist ?
Code:
def service_destroy(context, instance_id):
return IMPL.service_destroy(context, instance_id)
|
null | null | null | How does the code translate a matrix ?
| def translate_matrix((a, b, c, d, e, f), (x, y)):
return (a, b, c, d, (((x * a) + (y * c)) + e), (((x * b) + (y * d)) + f))
| null | null | null | by
| codeqa | def translate matrix a b c d e f x y return a b c d x * a + y * c + e x * b + y * d + f
| null | null | null | null | Question:
How does the code translate a matrix ?
Code:
def translate_matrix((a, b, c, d, e, f), (x, y)):
return (a, b, c, d, (((x * a) + (y * c)) + e), (((x * b) + (y * d)) + f))
|
null | null | null | What does the code translate by ?
| def translate_matrix((a, b, c, d, e, f), (x, y)):
return (a, b, c, d, (((x * a) + (y * c)) + e), (((x * b) + (y * d)) + f))
| null | null | null | a matrix
| codeqa | def translate matrix a b c d e f x y return a b c d x * a + y * c + e x * b + y * d + f
| null | null | null | null | Question:
What does the code translate by ?
Code:
def translate_matrix((a, b, c, d, e, f), (x, y)):
return (a, b, c, d, (((x * a) + (y * c)) + e), (((x * b) + (y * d)) + f))
|
null | null | null | What can accept arbitrary files ?
| def test_write_noformat_arbitrary_file(tmpdir):
_writers.update(_WRITERS_ORIGINAL)
testfile = str(tmpdir.join(u'foo.example'))
with pytest.raises(io_registry.IORegistryError) as exc:
Table().write(testfile)
assert str(exc.value).startswith(u'Format could not be identified.')
| null | null | null | all identifier functions
| codeqa | def test write noformat arbitrary file tmpdir writers update WRITERS ORIGINAL testfile str tmpdir join u'foo example' with pytest raises io registry IO Registry Error as exc Table write testfile assert str exc value startswith u' Formatcouldnotbeidentified '
| null | null | null | null | Question:
What can accept arbitrary files ?
Code:
def test_write_noformat_arbitrary_file(tmpdir):
_writers.update(_WRITERS_ORIGINAL)
testfile = str(tmpdir.join(u'foo.example'))
with pytest.raises(io_registry.IORegistryError) as exc:
Table().write(testfile)
assert str(exc.value).startswith(u'Format could not... |
null | null | null | What can all identifier functions accept ?
| def test_write_noformat_arbitrary_file(tmpdir):
_writers.update(_WRITERS_ORIGINAL)
testfile = str(tmpdir.join(u'foo.example'))
with pytest.raises(io_registry.IORegistryError) as exc:
Table().write(testfile)
assert str(exc.value).startswith(u'Format could not be identified.')
| null | null | null | arbitrary files
| codeqa | def test write noformat arbitrary file tmpdir writers update WRITERS ORIGINAL testfile str tmpdir join u'foo example' with pytest raises io registry IO Registry Error as exc Table write testfile assert str exc value startswith u' Formatcouldnotbeidentified '
| null | null | null | null | Question:
What can all identifier functions accept ?
Code:
def test_write_noformat_arbitrary_file(tmpdir):
_writers.update(_WRITERS_ORIGINAL)
testfile = str(tmpdir.join(u'foo.example'))
with pytest.raises(io_registry.IORegistryError) as exc:
Table().write(testfile)
assert str(exc.value).startswith(u'Format c... |
null | null | null | What does the code get from media service discover object ?
| def libvlc_media_discoverer_event_manager(p_mdis):
f = (_Cfunctions.get('libvlc_media_discoverer_event_manager', None) or _Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager), ctypes.c_void_p, MediaDiscoverer))
return f(p_mdis)
| null | null | null | event manager
| codeqa | def libvlc media discoverer event manager p mdis f Cfunctions get 'libvlc media discoverer event manager' None or Cfunction 'libvlc media discoverer event manager' 1 class result Event Manager ctypes c void p Media Discoverer return f p mdis
| null | null | null | null | Question:
What does the code get from media service discover object ?
Code:
def libvlc_media_discoverer_event_manager(p_mdis):
f = (_Cfunctions.get('libvlc_media_discoverer_event_manager', None) or _Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager), ctypes.c_void_p, MediaDiscov... |
null | null | null | What do the given list of classes arrange ?
| def getclasstree(classes, unique=0):
children = {}
roots = []
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if (not (parent in children)):
children[parent] = []
children[parent].append(c)
if (unique and (parent in classes)):
break
elif (c not in roots):
roots.append(c)
... | null | null | null | into a hierarchy of nested lists
| codeqa | def getclasstree classes unique 0 children {}roots []for c in classes if c bases for parent in c bases if not parent in children children[parent] []children[parent] append c if unique and parent in classes breakelif c not in roots roots append c for parent in children if parent not in classes roots append parent return... | null | null | null | null | Question:
What do the given list of classes arrange ?
Code:
def getclasstree(classes, unique=0):
children = {}
roots = []
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if (not (parent in children)):
children[parent] = []
children[parent].append(c)
if (unique and (parent in cl... |
null | null | null | What arranges into a hierarchy of nested lists ?
| def getclasstree(classes, unique=0):
children = {}
roots = []
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if (not (parent in children)):
children[parent] = []
children[parent].append(c)
if (unique and (parent in classes)):
break
elif (c not in roots):
roots.append(c)
... | null | null | null | the given list of classes
| codeqa | def getclasstree classes unique 0 children {}roots []for c in classes if c bases for parent in c bases if not parent in children children[parent] []children[parent] append c if unique and parent in classes breakelif c not in roots roots append c for parent in children if parent not in classes roots append parent return... | null | null | null | null | Question:
What arranges into a hierarchy of nested lists ?
Code:
def getclasstree(classes, unique=0):
children = {}
roots = []
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if (not (parent in children)):
children[parent] = []
children[parent].append(c)
if (unique and (parent ... |
null | null | null | How did inputs modify ?
| @pytest.mark.parametrize('initial_text, edited_text', [('', 'Hello'), ('Hello', 'World'), ('H\xc3\xa4ll\xc3\xb6 W\xc3\xb6rld', '\xc3\x9cberpr\xc3\xbcfung'), ('\\u2603', '\\u2601')])
def test_modify(editor, initial_text, edited_text):
editor.edit(initial_text)
with open(editor._file.name, 'r', encoding='utf-8') as f... | null | null | null | correctly
| codeqa | @pytest mark parametrize 'initial text edited text' [ '' ' Hello' ' Hello' ' World' 'H\xc 3 \xa 4 ll\xc 3 \xb 6 W\xc 3 \xb 6 rld' '\xc 3 \x 9 cberpr\xc 3 \xbcfung' '\\u 2603 ' '\\u 2601 ' ] def test modify editor initial text edited text editor edit initial text with open editor file name 'r' encoding 'utf- 8 ' as f as... | null | null | null | null | Question:
How did inputs modify ?
Code:
@pytest.mark.parametrize('initial_text, edited_text', [('', 'Hello'), ('Hello', 'World'), ('H\xc3\xa4ll\xc3\xb6 W\xc3\xb6rld', '\xc3\x9cberpr\xc3\xbcfung'), ('\\u2603', '\\u2601')])
def test_modify(editor, initial_text, edited_text):
editor.edit(initial_text)
with open(ed... |
null | null | null | When did remotes configure ?
| def _clear_old_remotes():
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
for repo in repos:
try:
cachedir_ls.remove(repo['hash'])
except ValueError:
pass
to_remove = []
for item in cachedir_ls:
if (item in ('has... | null | null | null | no longer
| codeqa | def clear old remotes bp os path join opts ['cachedir'] 'svnfs' try cachedir ls os listdir bp except OS Error cachedir ls []repos init for repo in repos try cachedir ls remove repo['hash'] except Value Error passto remove []for item in cachedir ls if item in 'hash' 'refs' continuepath os path join bp item if os path is... | null | null | null | null | Question:
When did remotes configure ?
Code:
def _clear_old_remotes():
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
for repo in repos:
try:
cachedir_ls.remove(repo['hash'])
except ValueError:
pass
to_remove =... |
null | null | null | What does the code remove ?
| def _clear_old_remotes():
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
for repo in repos:
try:
cachedir_ls.remove(repo['hash'])
except ValueError:
pass
to_remove = []
for item in cachedir_ls:
if (item in ('has... | null | null | null | cache directories for remotes no longer configured
| codeqa | def clear old remotes bp os path join opts ['cachedir'] 'svnfs' try cachedir ls os listdir bp except OS Error cachedir ls []repos init for repo in repos try cachedir ls remove repo['hash'] except Value Error passto remove []for item in cachedir ls if item in 'hash' 'refs' continuepath os path join bp item if os path is... | null | null | null | null | Question:
What does the code remove ?
Code:
def _clear_old_remotes():
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
try:
cachedir_ls = os.listdir(bp_)
except OSError:
cachedir_ls = []
repos = init()
for repo in repos:
try:
cachedir_ls.remove(repo['hash'])
except ValueError:
pass
to_remove = ... |
null | null | null | Where are experimental artifacts placed ?
| def get_output_dir(imdb, net=None):
outdir = osp.abspath(osp.join(__C.ROOT_DIR, 'output', __C.EXP_DIR, imdb.name))
if (net is not None):
outdir = osp.join(outdir, net.name)
if (not os.path.exists(outdir)):
os.makedirs(outdir)
return outdir
| null | null | null | the directory
| codeqa | def get output dir imdb net None outdir osp abspath osp join C ROOT DIR 'output' C EXP DIR imdb name if net is not None outdir osp join outdir net name if not os path exists outdir os makedirs outdir return outdir
| null | null | null | null | Question:
Where are experimental artifacts placed ?
Code:
def get_output_dir(imdb, net=None):
outdir = osp.abspath(osp.join(__C.ROOT_DIR, 'output', __C.EXP_DIR, imdb.name))
if (net is not None):
outdir = osp.join(outdir, net.name)
if (not os.path.exists(outdir)):
os.makedirs(outdir)
return outdir
|
null | null | null | What does the code find ?
| def nlargest(n, iterable, key=None):
(in1, in2) = tee(iterable)
it = izip(imap(key, in1), imap(neg, count()), in2)
result = _nlargest(n, it)
return map(itemgetter(2), result)
| null | null | null | the n largest elements in a dataset
| codeqa | def nlargest n iterable key None in 1 in 2 tee iterable it izip imap key in 1 imap neg count in 2 result nlargest n it return map itemgetter 2 result
| null | null | null | null | Question:
What does the code find ?
Code:
def nlargest(n, iterable, key=None):
(in1, in2) = tee(iterable)
it = izip(imap(key, in1), imap(neg, count()), in2)
result = _nlargest(n, it)
return map(itemgetter(2), result)
|
null | null | null | What did the code set to 7bit or 8bit ?
| def encode_7or8bit(msg):
orig = msg.get_payload(decode=True)
if (orig is None):
msg['Content-Transfer-Encoding'] = '7bit'
return
try:
orig.decode('ascii')
except UnicodeError:
msg['Content-Transfer-Encoding'] = '8bit'
else:
msg['Content-Transfer-Encoding'] = '7bit'
| null | null | null | the content - transfer - encoding header
| codeqa | def encode 7or 8 bit msg orig msg get payload decode True if orig is None msg[' Content- Transfer- Encoding'] '7 bit'returntry orig decode 'ascii' except Unicode Error msg[' Content- Transfer- Encoding'] '8 bit'else msg[' Content- Transfer- Encoding'] '7 bit'
| null | null | null | null | Question:
What did the code set to 7bit or 8bit ?
Code:
def encode_7or8bit(msg):
orig = msg.get_payload(decode=True)
if (orig is None):
msg['Content-Transfer-Encoding'] = '7bit'
return
try:
orig.decode('ascii')
except UnicodeError:
msg['Content-Transfer-Encoding'] = '8bit'
else:
msg['Content-Transfer... |
null | null | null | For what purpose do full path return to the user - shared data ?
| def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
if (system in ['win32', 'darwin']):
path = site_data_dir(appname, appauthor)
if (appname and version):
path = os.path.join(path, version)
else:
path = os.getenv('XDG_CONFIG_DIRS', '/etc/xdg')
pathlist = [os.path.expanduser(x.... | null | null | null | for this application
| codeqa | def site config dir appname None appauthor None version None multipath False if system in ['win 32 ' 'darwin'] path site data dir appname appauthor if appname and version path os path join path version else path os getenv 'XDG CONFIG DIRS' '/etc/xdg' pathlist [os path expanduser x rstrip os sep for x in path split os p... | null | null | null | null | Question:
For what purpose do full path return to the user - shared data ?
Code:
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
if (system in ['win32', 'darwin']):
path = site_data_dir(appname, appauthor)
if (appname and version):
path = os.path.join(path, version)
else:
... |
null | null | null | How does the code change the system ?
| def init(runlevel):
return 'Not implemented on Windows at this time.'
| null | null | null | runlevel
| codeqa | def init runlevel return ' Notimplementedon Windowsatthistime '
| null | null | null | null | Question:
How does the code change the system ?
Code:
def init(runlevel):
return 'Not implemented on Windows at this time.'
|
null | null | null | By how much did the code read ?
| def _gpi10iterator(handle):
for inline in handle:
if (inline[0] == '!'):
continue
inrec = inline.rstrip('\n').split(' DCTB ')
if (len(inrec) == 1):
continue
inrec[5] = inrec[5].split('|')
inrec[8] = inrec[8].split('|')
(yield dict(zip(GPI10FIELDS, inrec)))
| null | null | null | 1
| codeqa | def gpi 10 iterator handle for inline in handle if inline[ 0 ] ' ' continueinrec inline rstrip '\n' split ' DCTB ' if len inrec 1 continueinrec[ 5 ] inrec[ 5 ] split ' ' inrec[ 8 ] inrec[ 8 ] split ' ' yield dict zip GPI 10 FIELDS inrec
| null | null | null | null | Question:
By how much did the code read ?
Code:
def _gpi10iterator(handle):
for inline in handle:
if (inline[0] == '!'):
continue
inrec = inline.rstrip('\n').split(' DCTB ')
if (len(inrec) == 1):
continue
inrec[5] = inrec[5].split('|')
inrec[8] = inrec[8].split('|')
(yield dict(zip(GPI10FIELDS, i... |
null | null | null | What does the code get ?
| def getNewDerivation(elementNode):
return TextDerivation(elementNode)
| null | null | null | new derivation
| codeqa | def get New Derivation element Node return Text Derivation element Node
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewDerivation(elementNode):
return TextDerivation(elementNode)
|
null | null | null | What does the code interpret as a boolean - like value ?
| def bool_from_string(subject):
if isinstance(subject, bool):
return subject
elif isinstance(subject, int):
return (subject == 1)
if hasattr(subject, 'startswith'):
if (subject.strip().lower() in ('true', 'on', '1', 'yes', 'y')):
return True
return False
| null | null | null | a string
| codeqa | def bool from string subject if isinstance subject bool return subjectelif isinstance subject int return subject 1 if hasattr subject 'startswith' if subject strip lower in 'true' 'on' '1 ' 'yes' 'y' return Truereturn False
| null | null | null | null | Question:
What does the code interpret as a boolean - like value ?
Code:
def bool_from_string(subject):
if isinstance(subject, bool):
return subject
elif isinstance(subject, int):
return (subject == 1)
if hasattr(subject, 'startswith'):
if (subject.strip().lower() in ('true', 'on', '1', 'yes', 'y')):
re... |
null | null | null | What does the code get ?
| def getPrecision(elementNode):
return getCascadeFloatWithoutSelf((0.2 * getLayerHeight(elementNode)), elementNode, 'precision')
| null | null | null | the cascade precision
| codeqa | def get Precision element Node return get Cascade Float Without Self 0 2 * get Layer Height element Node element Node 'precision'
| null | null | null | null | Question:
What does the code get ?
Code:
def getPrecision(elementNode):
return getCascadeFloatWithoutSelf((0.2 * getLayerHeight(elementNode)), elementNode, 'precision')
|
null | null | null | In which direction does the code send ?
| def _send_instance_update_notification(context, instance, old_vm_state=None, old_task_state=None, new_vm_state=None, new_task_state=None, service='compute', host=None):
payload = info_from_instance(context, instance, None, None)
if (not new_vm_state):
new_vm_state = instance['vm_state']
if (not new_task_state):
... | null | null | null | compute
| codeqa | def send instance update notification context instance old vm state None old task state None new vm state None new task state None service 'compute' host None payload info from instance context instance None None if not new vm state new vm state instance['vm state']if not new task state new task state instance['task st... | null | null | null | null | Question:
In which direction does the code send ?
Code:
def _send_instance_update_notification(context, instance, old_vm_state=None, old_task_state=None, new_vm_state=None, new_task_state=None, service='compute', host=None):
payload = info_from_instance(context, instance, None, None)
if (not new_vm_state):
new_... |
null | null | null | When does the password expire ?
| def symptom_minimum_password_age_greater_than_expires_days():
min_age = CONF.security_compliance.minimum_password_age
expires = CONF.security_compliance.password_expires_days
return ((min_age >= expires) if ((min_age > 0) and (expires > 0)) else False)
| null | null | null | days
| codeqa | def symptom minimum password age greater than expires days min age CONF security compliance minimum password ageexpires CONF security compliance password expires daysreturn min age > expires if min age > 0 and expires > 0 else False
| null | null | null | null | Question:
When does the password expire ?
Code:
def symptom_minimum_password_age_greater_than_expires_days():
min_age = CONF.security_compliance.minimum_password_age
expires = CONF.security_compliance.password_expires_days
return ((min_age >= expires) if ((min_age > 0) and (expires > 0)) else False)
|
null | null | null | What does the code get ?
| def getLiftedOutput(derivation, geometryOutput):
if (derivation.moveType.lower()[:1] == 'm'):
return geometryOutput
geometryOutputVertexes = matrix.getVertexes(geometryOutput)
translation = Vector3(0.0, 0.0, (- euclidean.getBottomByPath(geometryOutputVertexes)))
euclidean.translateVector3Path(geometryOutputVertex... | null | null | null | extrude output for a rack
| codeqa | def get Lifted Output derivation geometry Output if derivation move Type lower [ 1] 'm' return geometry Outputgeometry Output Vertexes matrix get Vertexes geometry Output translation Vector 3 0 0 0 0 - euclidean get Bottom By Path geometry Output Vertexes euclidean translate Vector 3 Path geometry Output Vertexes trans... | null | null | null | null | Question:
What does the code get ?
Code:
def getLiftedOutput(derivation, geometryOutput):
if (derivation.moveType.lower()[:1] == 'm'):
return geometryOutput
geometryOutputVertexes = matrix.getVertexes(geometryOutput)
translation = Vector3(0.0, 0.0, (- euclidean.getBottomByPath(geometryOutputVertexes)))
euclid... |
null | null | null | What does the code remove ?
| def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
source_volid = Column('source_volid', String(36))
volumes.drop_column(source_volid)
| null | null | null | source volume i d column
| codeqa | def downgrade migrate engine meta Meta Data meta bind migrate enginevolumes Table 'volumes' meta autoload True source volid Column 'source volid' String 36 volumes drop column source volid
| null | null | null | null | Question:
What does the code remove ?
Code:
def downgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
source_volid = Column('source_volid', String(36))
volumes.drop_column(source_volid)
|
null | null | null | What does the code add to a document ?
| @login_required
@require_POST
def add_contributor(request, document_slug):
document = get_object_or_404(Document, locale=request.LANGUAGE_CODE, slug=document_slug)
if (not document.allows(request.user, 'edit')):
raise PermissionDenied
form = AddContributorForm(request.POST)
if form.is_valid():
for user in form.... | null | null | null | a contributor
| codeqa | @login required@require POS Tdef add contributor request document slug document get object or 404 Document locale request LANGUAGE CODE slug document slug if not document allows request user 'edit' raise Permission Deniedform Add Contributor Form request POST if form is valid for user in form cleaned data['users'] docu... | null | null | null | null | Question:
What does the code add to a document ?
Code:
@login_required
@require_POST
def add_contributor(request, document_slug):
document = get_object_or_404(Document, locale=request.LANGUAGE_CODE, slug=document_slug)
if (not document.allows(request.user, 'edit')):
raise PermissionDenied
form = AddContributor... |
null | null | null | What saves state to the configuration file ?
| @sopel.module.require_privmsg
@sopel.module.require_admin
@sopel.module.commands(u'save')
@sopel.module.example(u'.save')
def save_config(bot, trigger):
bot.config.save()
| null | null | null | state
| codeqa | @sopel module require privmsg@sopel module require admin@sopel module commands u'save' @sopel module example u' save' def save config bot trigger bot config save
| null | null | null | null | Question:
What saves state to the configuration file ?
Code:
@sopel.module.require_privmsg
@sopel.module.require_admin
@sopel.module.commands(u'save')
@sopel.module.example(u'.save')
def save_config(bot, trigger):
bot.config.save()
|
null | null | null | What do state save to the configuration file ?
| @sopel.module.require_privmsg
@sopel.module.require_admin
@sopel.module.commands(u'save')
@sopel.module.example(u'.save')
def save_config(bot, trigger):
bot.config.save()
| null | null | null | state
| codeqa | @sopel module require privmsg@sopel module require admin@sopel module commands u'save' @sopel module example u' save' def save config bot trigger bot config save
| null | null | null | null | Question:
What do state save to the configuration file ?
Code:
@sopel.module.require_privmsg
@sopel.module.require_admin
@sopel.module.commands(u'save')
@sopel.module.example(u'.save')
def save_config(bot, trigger):
bot.config.save()
|
null | null | null | Where do a formatted diff between current files and original return ?
| def diff(*paths):
ret = {}
pkg_to_paths = {}
for pth in paths:
pth_pkg = __salt__['lowpkg.owner'](pth)
if (not pth_pkg):
ret[pth] = ((os.path.exists(pth) and 'Not managed') or 'N/A')
else:
if (pkg_to_paths.get(pth_pkg) is None):
pkg_to_paths[pth_pkg] = []
pkg_to_paths[pth_pkg].append(pth)
if pkg... | null | null | null | in a package
| codeqa | def diff *paths ret {}pkg to paths {}for pth in paths pth pkg salt ['lowpkg owner'] pth if not pth pkg ret[pth] os path exists pth and ' Notmanaged' or 'N/A' else if pkg to paths get pth pkg is None pkg to paths[pth pkg] []pkg to paths[pth pkg] append pth if pkg to paths local pkgs salt ['pkg download'] *pkg to paths k... | null | null | null | null | Question:
Where do a formatted diff between current files and original return ?
Code:
def diff(*paths):
ret = {}
pkg_to_paths = {}
for pth in paths:
pth_pkg = __salt__['lowpkg.owner'](pth)
if (not pth_pkg):
ret[pth] = ((os.path.exists(pth) and 'Not managed') or 'N/A')
else:
if (pkg_to_paths.get(pth_... |
null | null | null | What returns in a package ?
| def diff(*paths):
ret = {}
pkg_to_paths = {}
for pth in paths:
pth_pkg = __salt__['lowpkg.owner'](pth)
if (not pth_pkg):
ret[pth] = ((os.path.exists(pth) and 'Not managed') or 'N/A')
else:
if (pkg_to_paths.get(pth_pkg) is None):
pkg_to_paths[pth_pkg] = []
pkg_to_paths[pth_pkg].append(pth)
if pkg... | null | null | null | a formatted diff between current files and original
| codeqa | def diff *paths ret {}pkg to paths {}for pth in paths pth pkg salt ['lowpkg owner'] pth if not pth pkg ret[pth] os path exists pth and ' Notmanaged' or 'N/A' else if pkg to paths get pth pkg is None pkg to paths[pth pkg] []pkg to paths[pth pkg] append pth if pkg to paths local pkgs salt ['pkg download'] *pkg to paths k... | null | null | null | null | Question:
What returns in a package ?
Code:
def diff(*paths):
ret = {}
pkg_to_paths = {}
for pth in paths:
pth_pkg = __salt__['lowpkg.owner'](pth)
if (not pth_pkg):
ret[pth] = ((os.path.exists(pth) and 'Not managed') or 'N/A')
else:
if (pkg_to_paths.get(pth_pkg) is None):
pkg_to_paths[pth_pkg] =... |
null | null | null | What does the code find ?
| def sproot(tck, mest=10):
if isinstance(tck, BSpline):
if (tck.c.ndim > 1):
mesg = 'Calling sproot() with BSpline objects with c.ndim > 1 is not recommended.'
warnings.warn(mesg, DeprecationWarning)
(t, c, k) = tck.tck
sh = tuple(range(c.ndim))
c = c.transpose((sh[1:] + (0,)))
return _impl.s... | null | null | null | the roots of a cubic b - spline
| codeqa | def sproot tck mest 10 if isinstance tck B Spline if tck c ndim > 1 mesg ' Callingsproot with B Splineobjectswithc ndim> 1 isnotrecommended 'warnings warn mesg Deprecation Warning t c k tck tcksh tuple range c ndim c c transpose sh[ 1 ] + 0 return impl sproot t c k mest else return impl sproot tck mest
| null | null | null | null | Question:
What does the code find ?
Code:
def sproot(tck, mest=10):
if isinstance(tck, BSpline):
if (tck.c.ndim > 1):
mesg = 'Calling sproot() with BSpline objects with c.ndim > 1 is not recommended.'
warnings.warn(mesg, DeprecationWarning)
(t, c, k) = tck.tck
sh = tuple(range(c.ndim))
c =... |
null | null | null | How do average move ?
| def SMA(ds, count, timeperiod=(- (2 ** 31))):
return call_talib_with_ds(ds, count, talib.SMA, timeperiod)
| null | null | null | simple
| codeqa | def SMA ds count timeperiod - 2 ** 31 return call talib with ds ds count talib SMA timeperiod
| null | null | null | null | Question:
How do average move ?
Code:
def SMA(ds, count, timeperiod=(- (2 ** 31))):
return call_talib_with_ds(ds, count, talib.SMA, timeperiod)
|
null | null | null | For what purpose does the table object return ?
| def get_images_table(meta):
images = Table('images', meta, Column('id', Integer(), primary_key=True, nullable=False), Column('name', String(255)), Column('disk_format', String(20)), Column('container_format', String(20)), Column('size', Integer()), Column('status', String(30), nullable=False), Column('is_public', Bool... | null | null | null | for the images table that corresponds to the images table definition of this version
| codeqa | def get images table meta images Table 'images' meta Column 'id' Integer primary key True nullable False Column 'name' String 255 Column 'disk format' String 20 Column 'container format' String 20 Column 'size' Integer Column 'status' String 30 nullable False Column 'is public' Boolean nullable False default False inde... | null | null | null | null | Question:
For what purpose does the table object return ?
Code:
def get_images_table(meta):
images = Table('images', meta, Column('id', Integer(), primary_key=True, nullable=False), Column('name', String(255)), Column('disk_format', String(20)), Column('container_format', String(20)), Column('size', Integer()), Co... |
null | null | null | What did the code set ?
| def param_set(name, value, retries=3):
name = name.upper()
return mpstate.mav_param.mavset(mpstate.master(), name, value, retries=retries)
| null | null | null | a parameter
| codeqa | def param set name value retries 3 name name upper return mpstate mav param mavset mpstate master name value retries retries
| null | null | null | null | Question:
What did the code set ?
Code:
def param_set(name, value, retries=3):
name = name.upper()
return mpstate.mav_param.mavset(mpstate.master(), name, value, retries=retries)
|
null | null | null | How does the code get a namespace ?
| def get(context, name, session):
namespace_rec = _get_by_name(context, name, session)
return namespace_rec.to_dict()
| null | null | null | by name
| codeqa | def get context name session namespace rec get by name context name session return namespace rec to dict
| null | null | null | null | Question:
How does the code get a namespace ?
Code:
def get(context, name, session):
namespace_rec = _get_by_name(context, name, session)
return namespace_rec.to_dict()
|
null | null | null | What does the code get by name ?
| def get(context, name, session):
namespace_rec = _get_by_name(context, name, session)
return namespace_rec.to_dict()
| null | null | null | a namespace
| codeqa | def get context name session namespace rec get by name context name session return namespace rec to dict
| null | null | null | null | Question:
What does the code get by name ?
Code:
def get(context, name, session):
namespace_rec = _get_by_name(context, name, session)
return namespace_rec.to_dict()
|
null | null | null | What has volumes ?
| def group_has_volumes_filter(attached_or_with_snapshots=False):
return IMPL.group_has_volumes_filter(attached_or_with_snapshots)
| null | null | null | a group
| codeqa | def group has volumes filter attached or with snapshots False return IMPL group has volumes filter attached or with snapshots
| null | null | null | null | Question:
What has volumes ?
Code:
def group_has_volumes_filter(attached_or_with_snapshots=False):
return IMPL.group_has_volumes_filter(attached_or_with_snapshots)
|
null | null | null | When did server configuration make ?
| def rollback(config, plugins):
client.rollback(config.installer, config.checkpoints, config, plugins)
| null | null | null | during install
| codeqa | def rollback config plugins client rollback config installer config checkpoints config plugins
| null | null | null | null | Question:
When did server configuration make ?
Code:
def rollback(config, plugins):
client.rollback(config.installer, config.checkpoints, config, plugins)
|
null | null | null | What does the code convert to a byte string ?
| def _long2bytesBigEndian(n, blocksize=0):
s = ''
pack = struct.pack
while (n > 0):
s = (pack('>I', (n & 4294967295L)) + s)
n = (n >> 32)
for i in range(len(s)):
if (s[i] != '\x00'):
break
else:
s = '\x00'
i = 0
s = s[i:]
if ((blocksize > 0) and (len(s) % blocksize)):
s = (((blocksize - (len(s) % b... | null | null | null | a long integer
| codeqa | def long 2 bytes Big Endian n blocksize 0 s ''pack struct packwhile n > 0 s pack '>I' n & 4294967295 L + s n n >> 32 for i in range len s if s[i] '\x 00 ' breakelse s '\x 00 'i 0s s[i ]if blocksize > 0 and len s % blocksize s blocksize - len s % blocksize * '\x 00 ' + s return s
| null | null | null | null | Question:
What does the code convert to a byte string ?
Code:
def _long2bytesBigEndian(n, blocksize=0):
s = ''
pack = struct.pack
while (n > 0):
s = (pack('>I', (n & 4294967295L)) + s)
n = (n >> 32)
for i in range(len(s)):
if (s[i] != '\x00'):
break
else:
s = '\x00'
i = 0
s = s[i:]
if ((blocksiz... |
null | null | null | How do user exist ?
| def user_exists_in_group(user_name, group_name, region=None, key=None, keyid=None, profile=None):
users = get_group_members(group_name=group_name, region=region, key=key, keyid=keyid, profile=profile)
if users:
for _user in users:
if (user_name == _user['user_name']):
msg = 'Username : {0} is already in... | null | null | null | in group
| codeqa | def user exists in group user name group name region None key None keyid None profile None users get group members group name group name region region key key keyid keyid profile profile if users for user in users if user name user['user name'] msg ' Username {0 }isalreadyingroup{ 1 } 'log info msg format user name gro... | null | null | null | null | Question:
How do user exist ?
Code:
def user_exists_in_group(user_name, group_name, region=None, key=None, keyid=None, profile=None):
users = get_group_members(group_name=group_name, region=region, key=key, keyid=keyid, profile=profile)
if users:
for _user in users:
if (user_name == _user['user_name']):
... |
null | null | null | How does a new image append the two images ?
| def appendimages(im1, im2):
rows1 = im1.shape[0]
rows2 = im2.shape[0]
if (rows1 < rows2):
im1 = concatenate((im1, zeros(((rows2 - rows1), im1.shape[1]))), axis=0)
elif (rows1 > rows2):
im2 = concatenate((im2, zeros(((rows1 - rows2), im2.shape[1]))), axis=0)
return concatenate((im1, im2), axis=1)
| null | null | null | side - by - side
| codeqa | def appendimages im 1 im 2 rows 1 im 1 shape[ 0 ]rows 2 im 2 shape[ 0 ]if rows 1 < rows 2 im 1 concatenate im 1 zeros rows 2 - rows 1 im 1 shape[ 1 ] axis 0 elif rows 1 > rows 2 im 2 concatenate im 2 zeros rows 1 - rows 2 im 2 shape[ 1 ] axis 0 return concatenate im 1 im 2 axis 1
| null | null | null | null | Question:
How does a new image append the two images ?
Code:
def appendimages(im1, im2):
rows1 = im1.shape[0]
rows2 = im2.shape[0]
if (rows1 < rows2):
im1 = concatenate((im1, zeros(((rows2 - rows1), im1.shape[1]))), axis=0)
elif (rows1 > rows2):
im2 = concatenate((im2, zeros(((rows1 - rows2), im2.shape[1]))... |
null | null | null | What does the code deduce ?
| def parse_encoding(fp):
pos = fp.tell()
fp.seek(0)
try:
line1 = fp.readline()
has_bom = line1.startswith(codecs.BOM_UTF8)
if has_bom:
line1 = line1[len(codecs.BOM_UTF8):]
m = _PYTHON_MAGIC_COMMENT_re.match(line1.decode('ascii', 'ignore'))
if (not m):
try:
import parser
parser.suite(line1.deco... | null | null | null | the encoding of a python source file from magic comment
| codeqa | def parse encoding fp pos fp tell fp seek 0 try line 1 fp readline has bom line 1 startswith codecs BOM UTF 8 if has bom line 1 line 1 [len codecs BOM UTF 8 ]m PYTHON MAGIC COMMENT re match line 1 decode 'ascii' 'ignore' if not m try import parserparser suite line 1 decode 'ascii' 'ignore' except Import Error Syntax Er... | null | null | null | null | Question:
What does the code deduce ?
Code:
def parse_encoding(fp):
pos = fp.tell()
fp.seek(0)
try:
line1 = fp.readline()
has_bom = line1.startswith(codecs.BOM_UTF8)
if has_bom:
line1 = line1[len(codecs.BOM_UTF8):]
m = _PYTHON_MAGIC_COMMENT_re.match(line1.decode('ascii', 'ignore'))
if (not m):
tr... |
null | null | null | What does the code create ?
| def list_new(t):
name = raw_input(light_magenta("New list's name: ", rl=True))
mode = raw_input(light_magenta("New list's mode (public/private): ", rl=True))
description = raw_input(light_magenta("New list's description: ", rl=True))
try:
t.lists.create(name=name, mode=mode, description=description)
p... | null | null | null | a new list
| codeqa | def list new t name raw input light magenta " Newlist'sname " rl True mode raw input light magenta " Newlist'smode public/private " rl True description raw input light magenta " Newlist'sdescription " rl True try t lists create name name mode mode description description print Nicely green name + 'listiscreated ' excep... | null | null | null | null | Question:
What does the code create ?
Code:
def list_new(t):
name = raw_input(light_magenta("New list's name: ", rl=True))
mode = raw_input(light_magenta("New list's mode (public/private): ", rl=True))
description = raw_input(light_magenta("New list's description: ", rl=True))
try:
t.lists.create(na... |
null | null | null | What does the code amend with command line options ?
| def _configure(options):
if (getattr(options, 'config', None) is not None):
config_path = options.config
del options.config
config.set_file(config_path)
config.set_args(options)
if config['verbose'].get(bool):
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO)
config_path = config.user_config_p... | null | null | null | the global configuration object
| codeqa | def configure options if getattr options 'config' None is not None config path options configdel options configconfig set file config path config set args options if config['verbose'] get bool log set Level logging DEBUG else log set Level logging INFO config path config user config path if os path isfile config path l... | null | null | null | null | Question:
What does the code amend with command line options ?
Code:
def _configure(options):
if (getattr(options, 'config', None) is not None):
config_path = options.config
del options.config
config.set_file(config_path)
config.set_args(options)
if config['verbose'].get(bool):
log.setLevel(logging.DEBUG... |
null | null | null | How do a server respond ?
| def wait_for_server(server, port):
print 'Checking server {server} on port {port}'.format(server=server, port=port)
if tasks.environment.dry_run:
return True
attempts = 0
server_ok = False
while (attempts < 30):
try:
connection = httplib.HTTPConnection(server, port, timeout=10)
connection.request('G... | null | null | null | with status 200
| codeqa | def wait for server server port print ' Checkingserver{server}onport{port}' format server server port port if tasks environment dry run return Trueattempts 0server ok Falsewhile attempts < 30 try connection httplib HTTP Connection server port timeout 10 connection request 'GET' '/' response connection getresponse if in... | null | null | null | null | Question:
How do a server respond ?
Code:
def wait_for_server(server, port):
print 'Checking server {server} on port {port}'.format(server=server, port=port)
if tasks.environment.dry_run:
return True
attempts = 0
server_ok = False
while (attempts < 30):
try:
connection = httplib.HTTPConnection(serv... |
null | null | null | How should a feature with background print it ?
| @with_setup(prepare_stdout)
def test_output_background_with_success_colorless():
from lettuce import step
line = currentframe().f_lineno
@step(u'the variable "(\\w+)" holds (\\d+)')
@step(u'the variable "(\\w+)" is equal to (\\d+)')
def just_pass(step, *args):
pass
filename = bg_feature_name('simple')... | null | null | null | accordingly
| codeqa | @with setup prepare stdout def test output background with success colorless from lettuce import stepline currentframe f lineno@step u'thevariable" \\w+ "holds \\d+ ' @step u'thevariable" \\w+ "isequalto \\d+ ' def just pass step *args passfilename bg feature name 'simple' runner Runner filename verbosity 3 no color Tr... | null | null | null | null | Question:
How should a feature with background print it ?
Code:
@with_setup(prepare_stdout)
def test_output_background_with_success_colorless():
from lettuce import step
line = currentframe().f_lineno
@step(u'the variable "(\\w+)" holds (\\d+)')
@step(u'the variable "(\\w+)" is equal to (\\d+)')
def ... |
null | null | null | What do generator collect from queue ?
| def collect_replies(conn, channel, queue, *args, **kwargs):
no_ack = kwargs.setdefault(u'no_ack', True)
received = False
try:
for (body, message) in itermessages(conn, channel, queue, *args, **kwargs):
if (not no_ack):
message.ack()
received = True
(yield body)
finally:
if received:
channel.afte... | null | null | null | replies
| codeqa | def collect replies conn channel queue *args **kwargs no ack kwargs setdefault u'no ack' True received Falsetry for body message in itermessages conn channel queue *args **kwargs if not no ack message ack received True yield body finally if received channel after reply message received queue name
| null | null | null | null | Question:
What do generator collect from queue ?
Code:
def collect_replies(conn, channel, queue, *args, **kwargs):
no_ack = kwargs.setdefault(u'no_ack', True)
received = False
try:
for (body, message) in itermessages(conn, channel, queue, *args, **kwargs):
if (not no_ack):
message.ack()
received = Tr... |
null | null | null | What is collecting replies from queue ?
| def collect_replies(conn, channel, queue, *args, **kwargs):
no_ack = kwargs.setdefault(u'no_ack', True)
received = False
try:
for (body, message) in itermessages(conn, channel, queue, *args, **kwargs):
if (not no_ack):
message.ack()
received = True
(yield body)
finally:
if received:
channel.afte... | null | null | null | generator
| codeqa | def collect replies conn channel queue *args **kwargs no ack kwargs setdefault u'no ack' True received Falsetry for body message in itermessages conn channel queue *args **kwargs if not no ack message ack received True yield body finally if received channel after reply message received queue name
| null | null | null | null | Question:
What is collecting replies from queue ?
Code:
def collect_replies(conn, channel, queue, *args, **kwargs):
no_ack = kwargs.setdefault(u'no_ack', True)
received = False
try:
for (body, message) in itermessages(conn, channel, queue, *args, **kwargs):
if (not no_ack):
message.ack()
received = T... |
null | null | null | What should we recreate ?
| def _should_create_database(connection):
if (not _can_support_reuse_db(connection)):
return True
try:
connection.cursor()
except Exception:
return True
return (not _reusing_db())
| null | null | null | the given db
| codeqa | def should create database connection if not can support reuse db connection return Truetry connection cursor except Exception return Truereturn not reusing db
| null | null | null | null | Question:
What should we recreate ?
Code:
def _should_create_database(connection):
if (not _can_support_reuse_db(connection)):
return True
try:
connection.cursor()
except Exception:
return True
return (not _reusing_db())
|
null | null | null | What did the code set ?
| def interactive(b):
rcParams['interactive'] = b
| null | null | null | interactive mode
| codeqa | def interactive b rc Params['interactive'] b
| null | null | null | null | Question:
What did the code set ?
Code:
def interactive(b):
rcParams['interactive'] = b
|
null | null | null | How do lock fixture block ?
| @pytest.fixture
def nb_lock():
return lock(block=False)
| null | null | null | non
| codeqa | @pytest fixturedef nb lock return lock block False
| null | null | null | null | Question:
How do lock fixture block ?
Code:
@pytest.fixture
def nb_lock():
return lock(block=False)
|
null | null | null | What do file have ?
| def isFileWithFileTypeWithoutWords(fileType, fileName, words):
fileName = os.path.basename(fileName)
fileTypeDot = ('.' + fileType)
if (not fileName.endswith(fileTypeDot)):
return False
for word in words:
if (fileName.find(word) >= 0):
return False
return True
| null | null | null | a given file type
| codeqa | def is File With File Type Without Words file Type file Name words file Name os path basename file Name file Type Dot ' ' + file Type if not file Name endswith file Type Dot return Falsefor word in words if file Name find word > 0 return Falsereturn True
| null | null | null | null | Question:
What do file have ?
Code:
def isFileWithFileTypeWithoutWords(fileType, fileName, words):
fileName = os.path.basename(fileName)
fileTypeDot = ('.' + fileType)
if (not fileName.endswith(fileTypeDot)):
return False
for word in words:
if (fileName.find(word) >= 0):
return False
return True
|
null | null | null | What has a given file type ?
| def isFileWithFileTypeWithoutWords(fileType, fileName, words):
fileName = os.path.basename(fileName)
fileTypeDot = ('.' + fileType)
if (not fileName.endswith(fileTypeDot)):
return False
for word in words:
if (fileName.find(word) >= 0):
return False
return True
| null | null | null | file
| codeqa | def is File With File Type Without Words file Type file Name words file Name os path basename file Name file Type Dot ' ' + file Type if not file Name endswith file Type Dot return Falsefor word in words if file Name find word > 0 return Falsereturn True
| null | null | null | null | Question:
What has a given file type ?
Code:
def isFileWithFileTypeWithoutWords(fileType, fileName, words):
fileName = os.path.basename(fileName)
fileTypeDot = ('.' + fileType)
if (not fileName.endswith(fileTypeDot)):
return False
for word in words:
if (fileName.find(word) >= 0):
return False
return Tru... |
null | null | null | What does the code remove from the registry ?
| def _remove_key(path, base=win32con.HKEY_CLASSES_ROOT):
try:
win32api.RegDeleteKey(base, path)
except win32api.error as (code, fn, msg):
if (code != winerror.ERROR_FILE_NOT_FOUND):
raise win32api.error(code, fn, msg)
| null | null | null | a string
| codeqa | def remove key path base win 32 con HKEY CLASSES ROOT try win 32 api Reg Delete Key base path except win 32 api error as code fn msg if code winerror ERROR FILE NOT FOUND raise win 32 api error code fn msg
| null | null | null | null | Question:
What does the code remove from the registry ?
Code:
def _remove_key(path, base=win32con.HKEY_CLASSES_ROOT):
try:
win32api.RegDeleteKey(base, path)
except win32api.error as (code, fn, msg):
if (code != winerror.ERROR_FILE_NOT_FOUND):
raise win32api.error(code, fn, msg)
|
null | null | null | What does the code insert ?
| def filterwarnings(action, message='', category=Warning, module='', lineno=0, append=0):
import re
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert isinstance(message, basestring), 'message must be a string'
assert isinstance(category, (t... | null | null | null | an entry into the list of warnings filters
| codeqa | def filterwarnings action message '' category Warning module '' lineno 0 append 0 import reassert action in 'error' 'ignore' 'always' 'default' 'module' 'once' 'invalidaction %r' % action assert isinstance message basestring 'messagemustbeastring'assert isinstance category type types Class Type 'categorymustbeaclass'as... | null | null | null | null | Question:
What does the code insert ?
Code:
def filterwarnings(action, message='', category=Warning, module='', lineno=0, append=0):
import re
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert isinstance(message, basestring), 'message must... |
null | null | null | What does the code run ?
| def runtest(test, verbose, quiet, test_times, testdir=None, huntrleaks=False):
try:
return runtest_inner(test, verbose, quiet, test_times, testdir, huntrleaks)
finally:
cleanup_test_droppings(test, verbose)
| null | null | null | a single test
| codeqa | def runtest test verbose quiet test times testdir None huntrleaks False try return runtest inner test verbose quiet test times testdir huntrleaks finally cleanup test droppings test verbose
| null | null | null | null | Question:
What does the code run ?
Code:
def runtest(test, verbose, quiet, test_times, testdir=None, huntrleaks=False):
try:
return runtest_inner(test, verbose, quiet, test_times, testdir, huntrleaks)
finally:
cleanup_test_droppings(test, verbose)
|
null | null | null | When should new code use ?
| def python_3000_not_equal(logical_line):
pos = logical_line.find('<>')
if (pos > (-1)):
(yield (pos, "W603 '<>' is deprecated, use '!='"))
| null | null | null | always
| codeqa | def python 3000 not equal logical line pos logical line find '<>' if pos > -1 yield pos "W 603 '<>'isdeprecated use' '"
| null | null | null | null | Question:
When should new code use ?
Code:
def python_3000_not_equal(logical_line):
pos = logical_line.find('<>')
if (pos > (-1)):
(yield (pos, "W603 '<>' is deprecated, use '!='"))
|
null | null | null | What returns over the lines in the file ?
| def _read(path, encoding='utf-8', comment=';;;'):
if path:
if (isinstance(path, basestring) and os.path.exists(path)):
f = open(path, 'rb')
elif isinstance(path, basestring):
f = path.splitlines()
else:
f = path
for (i, line) in enumerate(f):
line = (line.strip(codecs.BOM_UTF8) if ((i == 0) and isi... | null | null | null | an iterator
| codeqa | def read path encoding 'utf- 8 ' comment ' ' if path if isinstance path basestring and os path exists path f open path 'rb' elif isinstance path basestring f path splitlines else f pathfor i line in enumerate f line line strip codecs BOM UTF 8 if i 0 and isinstance line str else line line line strip line decode utf 8 l... | null | null | null | null | Question:
What returns over the lines in the file ?
Code:
def _read(path, encoding='utf-8', comment=';;;'):
if path:
if (isinstance(path, basestring) and os.path.exists(path)):
f = open(path, 'rb')
elif isinstance(path, basestring):
f = path.splitlines()
else:
f = path
for (i, line) in enumerate(f... |
null | null | null | Where does an iterator return ?
| def _read(path, encoding='utf-8', comment=';;;'):
if path:
if (isinstance(path, basestring) and os.path.exists(path)):
f = open(path, 'rb')
elif isinstance(path, basestring):
f = path.splitlines()
else:
f = path
for (i, line) in enumerate(f):
line = (line.strip(codecs.BOM_UTF8) if ((i == 0) and isi... | null | null | null | over the lines in the file
| codeqa | def read path encoding 'utf- 8 ' comment ' ' if path if isinstance path basestring and os path exists path f open path 'rb' elif isinstance path basestring f path splitlines else f pathfor i line in enumerate f line line strip codecs BOM UTF 8 if i 0 and isinstance line str else line line line strip line decode utf 8 l... | null | null | null | null | Question:
Where does an iterator return ?
Code:
def _read(path, encoding='utf-8', comment=';;;'):
if path:
if (isinstance(path, basestring) and os.path.exists(path)):
f = open(path, 'rb')
elif isinstance(path, basestring):
f = path.splitlines()
else:
f = path
for (i, line) in enumerate(f):
line... |
null | null | null | What does the code create ?
| def reverse_field_path(model, path):
reversed_path = []
parent = model
pieces = path.split(LOOKUP_SEP)
for piece in pieces:
field = parent._meta.get_field(piece)
direct = ((not field.auto_created) or field.concrete)
if (len(reversed_path) == (len(pieces) - 1)):
try:
get_model_from_relation(field)
ex... | null | null | null | a reversed field path
| codeqa | def reverse field path model path reversed path []parent modelpieces path split LOOKUP SEP for piece in pieces field parent meta get field piece direct not field auto created or field concrete if len reversed path len pieces - 1 try get model from relation field except Not Relation Field breakif direct related name fie... | null | null | null | null | Question:
What does the code create ?
Code:
def reverse_field_path(model, path):
reversed_path = []
parent = model
pieces = path.split(LOOKUP_SEP)
for piece in pieces:
field = parent._meta.get_field(piece)
direct = ((not field.auto_created) or field.concrete)
if (len(reversed_path) == (len(pieces) - 1)):
... |
null | null | null | For what purpose do full path return to the user - specific data ?
| def user_data_dir(appname, roaming=False):
if WINDOWS:
const = ((roaming and 'CSIDL_APPDATA') or 'CSIDL_LOCAL_APPDATA')
path = os.path.join(os.path.normpath(_get_win_folder(const)), appname)
elif (sys.platform == 'darwin'):
path = os.path.join(expanduser('~/Library/Application Support/'), appname)
else:
pat... | null | null | null | for this application
| codeqa | def user data dir appname roaming False if WINDOWS const roaming and 'CSIDL APPDATA' or 'CSIDL LOCAL APPDATA' path os path join os path normpath get win folder const appname elif sys platform 'darwin' path os path join expanduser '~/ Library/ Application Support/' appname else path os path join os getenv 'XDG DATA HOME... | null | null | null | null | Question:
For what purpose do full path return to the user - specific data ?
Code:
def user_data_dir(appname, roaming=False):
if WINDOWS:
const = ((roaming and 'CSIDL_APPDATA') or 'CSIDL_LOCAL_APPDATA')
path = os.path.join(os.path.normpath(_get_win_folder(const)), appname)
elif (sys.platform == 'darwin'):
p... |
null | null | null | What does the code return ?
| def get_rotation(rotation):
try:
angle = float(rotation)
except (ValueError, TypeError):
isString = isinstance(rotation, six.string_types)
if ((isString and (rotation == u'horizontal')) or (rotation is None)):
angle = 0.0
elif (isString and (rotation == u'vertical')):
angle = 90.0
else:
raise Value... | null | null | null | the text angle
| codeqa | def get rotation rotation try angle float rotation except Value Error Type Error is String isinstance rotation six string types if is String and rotation u'horizontal' or rotation is None angle 0 0elif is String and rotation u'vertical' angle 90 0else raise Value Error u"rotationis{ 0 }expectedeither'horizontal''vertic... | null | null | null | null | Question:
What does the code return ?
Code:
def get_rotation(rotation):
try:
angle = float(rotation)
except (ValueError, TypeError):
isString = isinstance(rotation, six.string_types)
if ((isString and (rotation == u'horizontal')) or (rotation is None)):
angle = 0.0
elif (isString and (rotation == u'ver... |
null | null | null | What does the code choose ?
| def choose_account(accounts):
labels = [acc.slug for acc in accounts]
(code, index) = z_util(interfaces.IDisplay).menu('Please choose an account', labels, force_interactive=True)
if (code == display_util.OK):
return accounts[index]
else:
return None
| null | null | null | an account
| codeqa | def choose account accounts labels [acc slug for acc in accounts] code index z util interfaces I Display menu ' Pleasechooseanaccount' labels force interactive True if code display util OK return accounts[index]else return None
| null | null | null | null | Question:
What does the code choose ?
Code:
def choose_account(accounts):
labels = [acc.slug for acc in accounts]
(code, index) = z_util(interfaces.IDisplay).menu('Please choose an account', labels, force_interactive=True)
if (code == display_util.OK):
return accounts[index]
else:
return None
|
null | null | null | What does the code restart from normal boot disk again ?
| @utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
def do_unrescue(cs, args):
_find_server(cs, args.server).unrescue()
| null | null | null | the server
| codeqa | @utils arg 'server' metavar '<server>' help ' Nameor I Dofserver ' def do unrescue cs args find server cs args server unrescue
| null | null | null | null | Question:
What does the code restart from normal boot disk again ?
Code:
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
def do_unrescue(cs, args):
_find_server(cs, args.server).unrescue()
|
null | null | null | What runs a test with a configuration enabled ?
| def with_site_configuration(domain='test.localhost', configuration=None):
def _decorator(func):
@wraps(func)
def _decorated(*args, **kwargs):
(site, __) = Site.objects.get_or_create(domain=domain, name=domain)
(site_configuration, created) = SiteConfiguration.objects.get_or_create(site=site, defaults={'enabl... | null | null | null | a decorator
| codeqa | def with site configuration domain 'test localhost' configuration None def decorator func @wraps func def decorated *args **kwargs site Site objects get or create domain domain name domain site configuration created Site Configuration objects get or create site site defaults {'enabled' True 'values' configuration} if n... | null | null | null | null | Question:
What runs a test with a configuration enabled ?
Code:
def with_site_configuration(domain='test.localhost', configuration=None):
def _decorator(func):
@wraps(func)
def _decorated(*args, **kwargs):
(site, __) = Site.objects.get_or_create(domain=domain, name=domain)
(site_configuration, created) =... |
null | null | null | When does time return ?
| def get_time_in_millisecs(datetime_obj):
seconds = (time.mktime(datetime_obj.timetuple()) * 1000)
return (seconds + (datetime_obj.microsecond / 1000.0))
| null | null | null | in milliseconds
| codeqa | def get time in millisecs datetime obj seconds time mktime datetime obj timetuple * 1000 return seconds + datetime obj microsecond / 1000 0
| null | null | null | null | Question:
When does time return ?
Code:
def get_time_in_millisecs(datetime_obj):
seconds = (time.mktime(datetime_obj.timetuple()) * 1000)
return (seconds + (datetime_obj.microsecond / 1000.0))
|
null | null | null | What provide a translation for some technical message i d to store partial date formats ?
| def get_partial_date_formats():
warnings.warn("'django.utils.translation.get_partial_date_formats' is deprecated. Please update your code to use the new i18n aware formatting.", DeprecationWarning)
from django.conf import settings
year_month_format = ugettext('YEAR_MONTH_FORMAT')
month_day_format = uge... | null | null | null | translation files
| codeqa | def get partial date formats warnings warn "'django utils translation get partial date formats'isdeprecated Pleaseupdateyourcodetousethenewi 18 nawareformatting " Deprecation Warning from django conf import settingsyear month format ugettext 'YEAR MONTH FORMAT' month day format ugettext 'MONTH DAY FORMAT' if year month... | null | null | null | null | Question:
What provide a translation for some technical message i d to store partial date formats ?
Code:
def get_partial_date_formats():
warnings.warn("'django.utils.translation.get_partial_date_formats' is deprecated. Please update your code to use the new i18n aware formatting.", DeprecationWarning... |
null | null | null | What updates packages on the system ?
| def update(name, source=None, pre_versions=False):
choc_path = _find_chocolatey(__context__, __salt__)
if (_LooseVersion(chocolatey_version()) >= _LooseVersion('0.9.8.24')):
log.warning('update is deprecated, using upgrade')
return upgrade(name, source=source, pre_versions=pre_versions)
cmd = [choc_path, 'up... | null | null | null | chocolatey
| codeqa | def update name source None pre versions False choc path find chocolatey context salt if Loose Version chocolatey version > Loose Version '0 9 8 24 ' log warning 'updateisdeprecated usingupgrade' return upgrade name source source pre versions pre versions cmd [choc path 'update' name]if source cmd extend ['--source' so... | null | null | null | null | Question:
What updates packages on the system ?
Code:
def update(name, source=None, pre_versions=False):
choc_path = _find_chocolatey(__context__, __salt__)
if (_LooseVersion(chocolatey_version()) >= _LooseVersion('0.9.8.24')):
log.warning('update is deprecated, using upgrade')
return upgrade(name, source... |
null | null | null | What does the code retrieve from the specified path ?
| def get_config(config_path):
if (not os.path.exists(config_path)):
raise ConfigDoesNotExistException
logger.debug(u'config_path is {0}'.format(config_path))
with io.open(config_path, encoding=u'utf-8') as file_handle:
try:
yaml_dict = poyo.parse_string(file_handle.read())
except poyo.exceptions.PoyoExcept... | null | null | null | the config
| codeqa | def get config config path if not os path exists config path raise Config Does Not Exist Exceptionlogger debug u'config pathis{ 0 }' format config path with io open config path encoding u'utf- 8 ' as file handle try yaml dict poyo parse string file handle read except poyo exceptions Poyo Exception as e raise Invalid Co... | null | null | null | null | Question:
What does the code retrieve from the specified path ?
Code:
def get_config(config_path):
if (not os.path.exists(config_path)):
raise ConfigDoesNotExistException
logger.debug(u'config_path is {0}'.format(config_path))
with io.open(config_path, encoding=u'utf-8') as file_handle:
try:
yaml_dict =... |
null | null | null | What do email notification regard ?
| def send_notification(net_device):
current_time = datetime.now()
sender = 'sender@twb-tech.com'
recipient = 'recipient@twb-tech.com'
subject = 'Device {0} was modified'.format(net_device.device_name)
message = '\nThe running configuration of {0} was modified. \n\nThis change was detected at: {1}\n\... | null | null | null | modified device
| codeqa | def send notification net device current time datetime now sender 'sender@twb-tech com'recipient 'recipient@twb-tech com'subject ' Device{ 0 }wasmodified' format net device device name message '\n Therunningconfigurationof{ 0 }wasmodified \n\n Thischangewasdetectedat {1 }\n\n' format net device device name current time... | null | null | null | null | Question:
What do email notification regard ?
Code:
def send_notification(net_device):
current_time = datetime.now()
sender = 'sender@twb-tech.com'
recipient = 'recipient@twb-tech.com'
subject = 'Device {0} was modified'.format(net_device.device_name)
message = '\nThe running configuration of {0} was ... |
null | null | null | What is regarding modified device ?
| def send_notification(net_device):
current_time = datetime.now()
sender = 'sender@twb-tech.com'
recipient = 'recipient@twb-tech.com'
subject = 'Device {0} was modified'.format(net_device.device_name)
message = '\nThe running configuration of {0} was modified. \n\nThis change was detected at: {1}\n\... | null | null | null | email notification
| codeqa | def send notification net device current time datetime now sender 'sender@twb-tech com'recipient 'recipient@twb-tech com'subject ' Device{ 0 }wasmodified' format net device device name message '\n Therunningconfigurationof{ 0 }wasmodified \n\n Thischangewasdetectedat {1 }\n\n' format net device device name current time... | null | null | null | null | Question:
What is regarding modified device ?
Code:
def send_notification(net_device):
current_time = datetime.now()
sender = 'sender@twb-tech.com'
recipient = 'recipient@twb-tech.com'
subject = 'Device {0} was modified'.format(net_device.device_name)
message = '\nThe running configuration of {0} was ... |
null | null | null | When did security check register ?
| def unregister_security_check(name):
_populate_security_checks()
try:
del _security_checks[name]
except KeyError:
logging.error((u'Failed to unregister unknown security check "%s"' % name))
raise KeyError((u'"%s" is not a registered security check' % name))
| null | null | null | previously
| codeqa | def unregister security check name populate security checks try del security checks[name]except Key Error logging error u' Failedtounregisterunknownsecuritycheck"%s"' % name raise Key Error u'"%s"isnotaregisteredsecuritycheck' % name
| null | null | null | null | Question:
When did security check register ?
Code:
def unregister_security_check(name):
_populate_security_checks()
try:
del _security_checks[name]
except KeyError:
logging.error((u'Failed to unregister unknown security check "%s"' % name))
raise KeyError((u'"%s" is not a registered security ch... |
null | null | null | Where is a condition true ?
| def where(condition, given_condition=None, **kwargs):
if (given_condition is not None):
return where(given(condition, given_condition, **kwargs), **kwargs)
return pspace(condition).where(condition, **kwargs)
| null | null | null | the domain
| codeqa | def where condition given condition None **kwargs if given condition is not None return where given condition given condition **kwargs **kwargs return pspace condition where condition **kwargs
| null | null | null | null | Question:
Where is a condition true ?
Code:
def where(condition, given_condition=None, **kwargs):
if (given_condition is not None):
return where(given(condition, given_condition, **kwargs), **kwargs)
return pspace(condition).where(condition, **kwargs)
|
null | null | null | What matches the string ?
| def assert_match(pattern, string, msg=None):
assert_not_none(re.search(pattern, string), msg)
| null | null | null | the pattern
| codeqa | def assert match pattern string msg None assert not none re search pattern string msg
| null | null | null | null | Question:
What matches the string ?
Code:
def assert_match(pattern, string, msg=None):
assert_not_none(re.search(pattern, string), msg)
|
null | null | null | How will a page redirect this ?
| def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
| null | null | null | correctly
| codeqa | def replace jump to id urls course id jump to id base url block view frag context return wrap fragment frag static replace replace jump to id urls frag content course id jump to id base url
| null | null | null | null | Question:
How will a page redirect this ?
Code:
def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
|
null | null | null | What will a page redirect correctly ?
| def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
| null | null | null | this
| codeqa | def replace jump to id urls course id jump to id base url block view frag context return wrap fragment frag static replace replace jump to id urls frag content course id jump to id base url
| null | null | null | null | Question:
What will a page redirect correctly ?
Code:
def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
|
null | null | null | What will redirect this correctly ?
| def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
| null | null | null | a page
| codeqa | def replace jump to id urls course id jump to id base url block view frag context return wrap fragment frag static replace replace jump to id urls frag content course id jump to id base url
| null | null | null | null | Question:
What will redirect this correctly ?
Code:
def replace_jump_to_id_urls(course_id, jump_to_id_base_url, block, view, frag, context):
return wrap_fragment(frag, static_replace.replace_jump_to_id_urls(frag.content, course_id, jump_to_id_base_url))
|
null | null | null | What does the code start ?
| def runWithJsonFile(expJsonFilePath, options, outputLabel, permWorkDir):
if ('verbosityCount' in options):
verbosity = options['verbosityCount']
del options['verbosityCount']
else:
verbosity = 1
_setupInterruptHandling()
with open(expJsonFilePath, 'r') as jsonFile:
expJsonConfig = json.loads(jsonFile.read()... | null | null | null | a swarm
| codeqa | def run With Json File exp Json File Path options output Label perm Work Dir if 'verbosity Count' in options verbosity options['verbosity Count']del options['verbosity Count']else verbosity 1 setup Interrupt Handling with open exp Json File Path 'r' as json File exp Json Config json loads json File read out Dir os path... | null | null | null | null | Question:
What does the code start ?
Code:
def runWithJsonFile(expJsonFilePath, options, outputLabel, permWorkDir):
if ('verbosityCount' in options):
verbosity = options['verbosityCount']
del options['verbosityCount']
else:
verbosity = 1
_setupInterruptHandling()
with open(expJsonFilePath, 'r') as jsonFil... |
null | null | null | What does the code make ?
| def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
return iter([None])
else:
return consumer.call(... | null | null | null | a call that returns multiple times
| codeqa | def multicall conf context topic msg timeout None check serialize msg method msg get 'method' if not method returnargs msg get 'args' {} version msg get 'version' None try consumer CONSUMERS[topic][ 0 ]except Key Error Index Error return iter [ None] else return consumer call context version method args timeout
| null | null | null | null | Question:
What does the code make ?
Code:
def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
retu... |
null | null | null | When does a call return ?
| def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
return iter([None])
else:
return consumer.call(... | null | null | null | multiple times
| codeqa | def multicall conf context topic msg timeout None check serialize msg method msg get 'method' if not method returnargs msg get 'args' {} version msg get 'version' None try consumer CONSUMERS[topic][ 0 ]except Key Error Index Error return iter [ None] else return consumer call context version method args timeout
| null | null | null | null | Question:
When does a call return ?
Code:
def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
retu... |
null | null | null | What return active conferences ?
| def get_active_conferences(user):
conferences = get_memcached(get_key('conferences'))
list_conferences = []
for key in conferences.keys():
if (user in conferences[key]['users'].keys()):
list_conferences.append(dict(id=key, title=conferences[key]['info']['title'], creator=conferences[key]['info']['creator'], cre... | null | null | null | active conferences
| codeqa | def get active conferences user conferences get memcached get key 'conferences' list conferences []for key in conferences keys if user in conferences[key]['users'] keys list conferences append dict id key title conferences[key]['info']['title'] creator conferences[key]['info']['creator'] creation date str conferences[k... | null | null | null | null | Question:
What return active conferences ?
Code:
def get_active_conferences(user):
conferences = get_memcached(get_key('conferences'))
list_conferences = []
for key in conferences.keys():
if (user in conferences[key]['users'].keys()):
list_conferences.append(dict(id=key, title=conferences[key]['info']['titl... |
null | null | null | What do active conferences return ?
| def get_active_conferences(user):
conferences = get_memcached(get_key('conferences'))
list_conferences = []
for key in conferences.keys():
if (user in conferences[key]['users'].keys()):
list_conferences.append(dict(id=key, title=conferences[key]['info']['title'], creator=conferences[key]['info']['creator'], cre... | null | null | null | active conferences
| codeqa | def get active conferences user conferences get memcached get key 'conferences' list conferences []for key in conferences keys if user in conferences[key]['users'] keys list conferences append dict id key title conferences[key]['info']['title'] creator conferences[key]['info']['creator'] creation date str conferences[k... | null | null | null | null | Question:
What do active conferences return ?
Code:
def get_active_conferences(user):
conferences = get_memcached(get_key('conferences'))
list_conferences = []
for key in conferences.keys():
if (user in conferences[key]['users'].keys()):
list_conferences.append(dict(id=key, title=conferences[key]['info']['t... |
null | null | null | When did the system boot time express in seconds ?
| def boot_time():
return cext.boot_time()
| null | null | null | since the epoch
| codeqa | def boot time return cext boot time
| null | null | null | null | Question:
When did the system boot time express in seconds ?
Code:
def boot_time():
return cext.boot_time()
|
null | null | null | How did the system boot time express since the epoch ?
| def boot_time():
return cext.boot_time()
| null | null | null | in seconds
| codeqa | def boot time return cext boot time
| null | null | null | null | Question:
How did the system boot time express since the epoch ?
Code:
def boot_time():
return cext.boot_time()
|
null | null | null | What does the code remove from sequence wile preserving order ?
| def deduplicate(seq):
seen = set()
return [x for x in seq if ((x not in seen) and (not seen.add(x)))]
| null | null | null | duplicates
| codeqa | def deduplicate seq seen set return [x for x in seq if x not in seen and not seen add x ]
| null | null | null | null | Question:
What does the code remove from sequence wile preserving order ?
Code:
def deduplicate(seq):
seen = set()
return [x for x in seq if ((x not in seen) and (not seen.add(x)))]
|
null | null | null | What does the code get ?
| def getCraftModule(pluginName):
return archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), pluginName)
| null | null | null | craft module
| codeqa | def get Craft Module plugin Name return archive get Module With Directory Path get Plugins Directory Path plugin Name
| null | null | null | null | Question:
What does the code get ?
Code:
def getCraftModule(pluginName):
return archive.getModuleWithDirectoryPath(getPluginsDirectoryPath(), pluginName)
|
null | null | null | When did review request register ?
| def unregister_review_request_fieldset(fieldset):
try:
fieldset_registry.unregister(fieldset)
except ItemLookupError as e:
logging.error(u'Failed to unregister unknown review request fieldset "%s"', fieldset.fieldset_id)
raise e
| null | null | null | previously
| codeqa | def unregister review request fieldset fieldset try fieldset registry unregister fieldset except Item Lookup Error as e logging error u' Failedtounregisterunknownreviewrequestfieldset"%s"' fieldset fieldset id raise e
| null | null | null | null | Question:
When did review request register ?
Code:
def unregister_review_request_fieldset(fieldset):
try:
fieldset_registry.unregister(fieldset)
except ItemLookupError as e:
logging.error(u'Failed to unregister unknown review request fieldset "%s"', fieldset.fieldset_id)
raise e
|
null | null | null | What does the code return 5 seconds later ?
| def get_poem():
def canceler(d):
delayed_call.cancel()
d = Deferred(canceler)
from twisted.internet import reactor
delayed_call = reactor.callLater(5, send_poem, d)
return d
| null | null | null | a poem
| codeqa | def get poem def canceler d delayed call cancel d Deferred canceler from twisted internet import reactordelayed call reactor call Later 5 send poem d return d
| null | null | null | null | Question:
What does the code return 5 seconds later ?
Code:
def get_poem():
def canceler(d):
delayed_call.cancel()
d = Deferred(canceler)
from twisted.internet import reactor
delayed_call = reactor.callLater(5, send_poem, d)
return d
|
null | null | null | When does the code return a poem ?
| def get_poem():
def canceler(d):
delayed_call.cancel()
d = Deferred(canceler)
from twisted.internet import reactor
delayed_call = reactor.callLater(5, send_poem, d)
return d
| null | null | null | 5 seconds later
| codeqa | def get poem def canceler d delayed call cancel d Deferred canceler from twisted internet import reactordelayed call reactor call Later 5 send poem d return d
| null | null | null | null | Question:
When does the code return a poem ?
Code:
def get_poem():
def canceler(d):
delayed_call.cancel()
d = Deferred(canceler)
from twisted.internet import reactor
delayed_call = reactor.callLater(5, send_poem, d)
return d
|
null | null | null | What does the code get from a path ?
| def getCircleNodesFromPoints(points, radius):
circleNodes = []
oneOverRadius = (1.0 / radius)
points = euclidean.getAwayPoints(points, (0.001 * radius))
for point in points:
circleNodes.append(CircleNode((point * oneOverRadius), len(circleNodes)))
return circleNodes
| null | null | null | the circle nodes
| codeqa | def get Circle Nodes From Points points radius circle Nodes []one Over Radius 1 0 / radius points euclidean get Away Points points 0 001 * radius for point in points circle Nodes append Circle Node point * one Over Radius len circle Nodes return circle Nodes
| null | null | null | null | Question:
What does the code get from a path ?
Code:
def getCircleNodesFromPoints(points, radius):
circleNodes = []
oneOverRadius = (1.0 / radius)
points = euclidean.getAwayPoints(points, (0.001 * radius))
for point in points:
circleNodes.append(CircleNode((point * oneOverRadius), len(circleNodes)))
return c... |
null | null | null | What does the code return as a numeric value ?
| def weight_as_number(weight):
if isinstance(weight, str):
try:
weight = weight_dict[weight.lower()]
except KeyError:
weight = 400
elif (weight in range(100, 1000, 100)):
pass
else:
raise ValueError, 'weight not a valid integer'
return weight
| null | null | null | the weight property
| codeqa | def weight as number weight if isinstance weight str try weight weight dict[weight lower ]except Key Error weight 400 elif weight in range 100 1000 100 passelse raise Value Error 'weightnotavalidinteger'return weight
| null | null | null | null | Question:
What does the code return as a numeric value ?
Code:
def weight_as_number(weight):
if isinstance(weight, str):
try:
weight = weight_dict[weight.lower()]
except KeyError:
weight = 400
elif (weight in range(100, 1000, 100)):
pass
else:
raise ValueError, 'weight not a valid integer'
ret... |
null | null | null | What does the code write as a list of edges ?
| @open_file(1, mode='wb')
def write_edgelist(G, path, comments='#', delimiter=' ', data=True, encoding='utf-8'):
for line in generate_edgelist(G, delimiter, data):
line += '\n'
path.write(line.encode(encoding))
| null | null | null | a bipartite graph
| codeqa | @open file 1 mode 'wb' def write edgelist G path comments '#' delimiter '' data True encoding 'utf- 8 ' for line in generate edgelist G delimiter data line + '\n'path write line encode encoding
| null | null | null | null | Question:
What does the code write as a list of edges ?
Code:
@open_file(1, mode='wb')
def write_edgelist(G, path, comments='#', delimiter=' ', data=True, encoding='utf-8'):
for line in generate_edgelist(G, delimiter, data):
line += '\n'
path.write(line.encode(encoding))
|
null | null | null | What does the code add if the orbits are large enough ?
| def addOrbitsIfLarge(distanceFeedRate, loop, orbitalFeedRatePerSecond, temperatureChangeTime, z):
if orbitsAreLarge(loop, temperatureChangeTime):
addOrbits(distanceFeedRate, loop, orbitalFeedRatePerSecond, temperatureChangeTime, z)
| null | null | null | orbits with the extruder off
| codeqa | def add Orbits If Large distance Feed Rate loop orbital Feed Rate Per Second temperature Change Time z if orbits Are Large loop temperature Change Time add Orbits distance Feed Rate loop orbital Feed Rate Per Second temperature Change Time z
| null | null | null | null | Question:
What does the code add if the orbits are large enough ?
Code:
def addOrbitsIfLarge(distanceFeedRate, loop, orbitalFeedRatePerSecond, temperatureChangeTime, z):
if orbitsAreLarge(loop, temperatureChangeTime):
addOrbits(distanceFeedRate, loop, orbitalFeedRatePerSecond, temperatureChangeTime, z)
|
null | null | null | How does a closable object close ?
| def quiet_close(closable):
try:
closable.close()
except Exception:
logger.debug(u'Exception while closing', exc_info=True)
| null | null | null | quietly
| codeqa | def quiet close closable try closable close except Exception logger debug u' Exceptionwhileclosing' exc info True
| null | null | null | null | Question:
How does a closable object close ?
Code:
def quiet_close(closable):
try:
closable.close()
except Exception:
logger.debug(u'Exception while closing', exc_info=True)
|
null | null | null | How does the code get metric from list in this module ?
| def get_phylogenetic_metric(name):
for metric in phylogenetic_metrics:
if (metric.__name__.lower() == name.lower()):
return metric
raise AttributeError
| null | null | null | by name
| codeqa | def get phylogenetic metric name for metric in phylogenetic metrics if metric name lower name lower return metricraise Attribute Error
| null | null | null | null | Question:
How does the code get metric from list in this module ?
Code:
def get_phylogenetic_metric(name):
for metric in phylogenetic_metrics:
if (metric.__name__.lower() == name.lower()):
return metric
raise AttributeError
|
null | null | null | What does the code send to a user ?
| def notify_user(user, msg, **kwargs):
Notification.objects.create(recipient=user, subject=msg, **kwargs)
| null | null | null | a simple notification
| codeqa | def notify user user msg **kwargs Notification objects create recipient user subject msg **kwargs
| null | null | null | null | Question:
What does the code send to a user ?
Code:
def notify_user(user, msg, **kwargs):
Notification.objects.create(recipient=user, subject=msg, **kwargs)
|
null | null | null | What does the code delete from the instance ?
| def instance_tag_delete_all(context, instance_uuid):
return IMPL.instance_tag_delete_all(context, instance_uuid)
| null | null | null | all tags
| codeqa | def instance tag delete all context instance uuid return IMPL instance tag delete all context instance uuid
| null | null | null | null | Question:
What does the code delete from the instance ?
Code:
def instance_tag_delete_all(context, instance_uuid):
return IMPL.instance_tag_delete_all(context, instance_uuid)
|
null | null | null | How did writable set ?
| def _make_writable_recursive(path):
if sys.platform.startswith('win'):
return
for (root, dirs, files) in os.walk(path, topdown=False):
for f in (dirs + files):
_make_writable(os.path.join(root, f))
| null | null | null | recursively
| codeqa | def make writable recursive path if sys platform startswith 'win' returnfor root dirs files in os walk path topdown False for f in dirs + files make writable os path join root f
| null | null | null | null | Question:
How did writable set ?
Code:
def _make_writable_recursive(path):
if sys.platform.startswith('win'):
return
for (root, dirs, files) in os.walk(path, topdown=False):
for f in (dirs + files):
_make_writable(os.path.join(root, f))
|
null | null | null | How does the code run the code ?
| def run_expecting_error(*args):
process = Popen((['flocker-volume'] + list(args)), stderr=PIPE)
result = process.stderr.read()
exit_code = process.wait()
if (exit_code == 0):
raise AssertionError('flocker-volume exited with code 0.')
return result
| null | null | null | with
| codeqa | def run expecting error *args process Popen ['flocker-volume'] + list args stderr PIPE result process stderr read exit code process wait if exit code 0 raise Assertion Error 'flocker-volumeexitedwithcode 0 ' return result
| null | null | null | null | Question:
How does the code run the code ?
Code:
def run_expecting_error(*args):
process = Popen((['flocker-volume'] + list(args)), stderr=PIPE)
result = process.stderr.read()
exit_code = process.wait()
if (exit_code == 0):
raise AssertionError('flocker-volume exited with code 0.')
return result
|
null | null | null | What does the code add to the pixel list ?
| def addElementToPixelList(element, pixelDictionary, x, y):
stepKey = getStepKey(x, y)
addElementToListTable(element, stepKey, pixelDictionary)
| null | null | null | an element
| codeqa | def add Element To Pixel List element pixel Dictionary x y step Key get Step Key x y add Element To List Table element step Key pixel Dictionary
| null | null | null | null | Question:
What does the code add to the pixel list ?
Code:
def addElementToPixelList(element, pixelDictionary, x, y):
stepKey = getStepKey(x, y)
addElementToListTable(element, stepKey, pixelDictionary)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.