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 | How do a health check delete ?
| def delete_hc(kwargs=None, call=None):
if (call != 'function'):
raise SaltCloudSystemExit('The delete_hc function must be called with -f or --function.')
if ((not kwargs) or ('name' not in kwargs)):
log.error('A name must be specified when deleting a health check.')
return False
name = kwargs... | null | null | null | permanently
| codeqa | def delete hc kwargs None call None if call 'function' raise Salt Cloud System Exit ' Thedelete hcfunctionmustbecalledwith-for--function ' if not kwargs or 'name' not in kwargs log error ' Anamemustbespecifiedwhendeletingahealthcheck ' return Falsename kwargs['name']conn get conn utils ['cloud fire event'] 'event' 'del... | null | null | null | null | Question:
How do a health check delete ?
Code:
def delete_hc(kwargs=None, call=None):
if (call != 'function'):
raise SaltCloudSystemExit('The delete_hc function must be called with -f or --function.')
if ((not kwargs) or ('name' not in kwargs)):
log.error('A name must be specified when deleting... |
null | null | null | How does any validation function work to ensure hugs ?
| def test_any():
assert (not hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('first', 'place'))(TEST_SCHEMA))
assert hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('no', 'way'))(TEST_SCHEMA)
| null | null | null | as expected to combine validators
| codeqa | def test any assert not hug validate any hug validate contains one of 'last' 'year' hug validate contains one of 'first' 'place' TEST SCHEMA assert hug validate any hug validate contains one of 'last' 'year' hug validate contains one of 'no' 'way' TEST SCHEMA
| null | null | null | null | Question:
How does any validation function work to ensure hugs ?
Code:
def test_any():
assert (not hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('first', 'place'))(TEST_SCHEMA))
assert hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contain... |
null | null | null | For what purpose does any validation function work as expected to combine validators ?
| def test_any():
assert (not hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('first', 'place'))(TEST_SCHEMA))
assert hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('no', 'way'))(TEST_SCHEMA)
| null | null | null | to ensure hugs
| codeqa | def test any assert not hug validate any hug validate contains one of 'last' 'year' hug validate contains one of 'first' 'place' TEST SCHEMA assert hug validate any hug validate contains one of 'last' 'year' hug validate contains one of 'no' 'way' TEST SCHEMA
| null | null | null | null | Question:
For what purpose does any validation function work as expected to combine validators ?
Code:
def test_any():
assert (not hug.validate.any(hug.validate.contains_one_of('last', 'year'), hug.validate.contains_one_of('first', 'place'))(TEST_SCHEMA))
assert hug.validate.any(hug.validate.contains_one_of('last... |
null | null | null | How are memberships calculated ?
| def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
| null | null | null | how
| codeqa | def user has perm user perm obj None cache 'user' project get object project obj if not project return Falsereturn perm in get user project permissions user project cache cache
| null | null | null | null | Question:
How are memberships calculated ?
Code:
def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
|
null | null | null | What is trying to reuse the existing data in cache ?
| def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
| null | null | null | memberships
| codeqa | def user has perm user perm obj None cache 'user' project get object project obj if not project return Falsereturn perm in get user project permissions user project cache cache
| null | null | null | null | Question:
What is trying to reuse the existing data in cache ?
Code:
def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
|
null | null | null | What do memberships reuse ?
| def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
| null | null | null | the existing data in cache
| codeqa | def user has perm user perm obj None cache 'user' project get object project obj if not project return Falsereturn perm in get user project permissions user project cache cache
| null | null | null | null | Question:
What do memberships reuse ?
Code:
def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
|
null | null | null | What reuses the existing data in cache ?
| def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
| null | null | null | memberships
| codeqa | def user has perm user perm obj None cache 'user' project get object project obj if not project return Falsereturn perm in get user project permissions user project cache cache
| null | null | null | null | Question:
What reuses the existing data in cache ?
Code:
def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
|
null | null | null | What did memberships try ?
| def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
| null | null | null | to reuse the existing data in cache
| codeqa | def user has perm user perm obj None cache 'user' project get object project obj if not project return Falsereturn perm in get user project permissions user project cache cache
| null | null | null | null | Question:
What did memberships try ?
Code:
def user_has_perm(user, perm, obj=None, cache='user'):
project = _get_object_project(obj)
if (not project):
return False
return (perm in get_user_project_permissions(user, project, cache=cache))
|
null | null | null | How do a file or directory move to another location ?
| def move(src, dst):
real_dst = dst
if os.path.isdir(dst):
if _samefile(src, dst):
os.rename(src, dst)
return
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error, ("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
except OSError:
... | null | null | null | recursively
| codeqa | def move src dst real dst dstif os path isdir dst if samefile src dst os rename src dst returnreal dst os path join dst basename src if os path exists real dst raise Error " Destinationpath'%s'alreadyexists" % real dst try os rename src real dst except OS Error if os path isdir src if destinsrc src dst raise Error " Ca... | null | null | null | null | Question:
How do a file or directory move to another location ?
Code:
def move(src, dst):
real_dst = dst
if os.path.isdir(dst):
if _samefile(src, dst):
os.rename(src, dst)
return
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error, ("Destination path '%s' alread... |
null | null | null | What does the code populate according to the tree ?
| def create_class_from_element_tree(target_class, tree, namespace=None, tag=None):
if (namespace is None):
namespace = target_class.c_namespace
if (tag is None):
tag = target_class.c_tag
if (tree.tag == ('{%s}%s' % (namespace, tag))):
target = target_class()
target.harvest_element_tree(tree)
return target
... | null | null | null | members
| codeqa | def create class from element tree target class tree namespace None tag None if namespace is None namespace target class c namespaceif tag is None tag target class c tagif tree tag '{%s}%s' % namespace tag target target class target harvest element tree tree return targetelse return None
| null | null | null | null | Question:
What does the code populate according to the tree ?
Code:
def create_class_from_element_tree(target_class, tree, namespace=None, tag=None):
if (namespace is None):
namespace = target_class.c_namespace
if (tag is None):
tag = target_class.c_tag
if (tree.tag == ('{%s}%s' % (namespace, tag))):
targe... |
null | null | null | What does the code instantiate ?
| def create_class_from_element_tree(target_class, tree, namespace=None, tag=None):
if (namespace is None):
namespace = target_class.c_namespace
if (tag is None):
tag = target_class.c_tag
if (tree.tag == ('{%s}%s' % (namespace, tag))):
target = target_class()
target.harvest_element_tree(tree)
return target
... | null | null | null | the class
| codeqa | def create class from element tree target class tree namespace None tag None if namespace is None namespace target class c namespaceif tag is None tag target class c tagif tree tag '{%s}%s' % namespace tag target target class target harvest element tree tree return targetelse return None
| null | null | null | null | Question:
What does the code instantiate ?
Code:
def create_class_from_element_tree(target_class, tree, namespace=None, tag=None):
if (namespace is None):
namespace = target_class.c_namespace
if (tag is None):
tag = target_class.c_tag
if (tree.tag == ('{%s}%s' % (namespace, tag))):
target = target_class()
... |
null | null | null | How are models updated ?
| @FileSystem.in_directory(current_directory, 'django', 'dill')
def test_model_update():
(status, out) = run_scenario('leaves', 'update', 1)
assert_equals(status, 0, out)
(status, out) = run_scenario('leaves', 'update', 2)
assert_not_equals(status, 0, out)
assert ('IntegrityError: PRIMARY KEY must be unique' in... | null | null | null | through lettuce steps
| codeqa | @ File System in directory current directory 'django' 'dill' def test model update status out run scenario 'leaves' 'update' 1 assert equals status 0 out status out run scenario 'leaves' 'update' 2 assert not equals status 0 out assert ' Integrity Error PRIMARYKE Ymustbeunique' in out status out run scenario 'leaves' '... | null | null | null | null | Question:
How are models updated ?
Code:
@FileSystem.in_directory(current_directory, 'django', 'dill')
def test_model_update():
(status, out) = run_scenario('leaves', 'update', 1)
assert_equals(status, 0, out)
(status, out) = run_scenario('leaves', 'update', 2)
assert_not_equals(status, 0, out)
assert ('Integr... |
null | null | null | What replaces by one space ?
| def do_striptags(value):
if hasattr(value, '__html__'):
value = value.__html__()
return Markup(unicode(value)).striptags()
| null | null | null | adjacent whitespace
| codeqa | def do striptags value if hasattr value ' html ' value value html return Markup unicode value striptags
| null | null | null | null | Question:
What replaces by one space ?
Code:
def do_striptags(value):
if hasattr(value, '__html__'):
value = value.__html__()
return Markup(unicode(value)).striptags()
|
null | null | null | Where do adjacent whitespace replace ?
| def do_striptags(value):
if hasattr(value, '__html__'):
value = value.__html__()
return Markup(unicode(value)).striptags()
| null | null | null | by one space
| codeqa | def do striptags value if hasattr value ' html ' value value html return Markup unicode value striptags
| null | null | null | null | Question:
Where do adjacent whitespace replace ?
Code:
def do_striptags(value):
if hasattr(value, '__html__'):
value = value.__html__()
return Markup(unicode(value)).striptags()
|
null | null | null | What does the code get ?
| def volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir):
return IMPL.volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir)
| null | null | null | all volumes belonging to a project
| codeqa | def volume get all by project context project id marker limit sort key sort dir return IMPL volume get all by project context project id marker limit sort key sort dir
| null | null | null | null | Question:
What does the code get ?
Code:
def volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir):
return IMPL.volume_get_all_by_project(context, project_id, marker, limit, sort_key, sort_dir)
|
null | null | null | What does the code display ?
| def username_password_authn(environ, start_response, reference, key, redirect_uri, headers=None):
logger.info('The login page')
kwargs = dict(mako_template='login.mako', template_lookup=LOOKUP)
if headers:
kwargs['headers'] = headers
resp = Response(**kwargs)
argv = {'action': '/verify', 'login': '', 'password... | null | null | null | the login form
| codeqa | def username password authn environ start response reference key redirect uri headers None logger info ' Theloginpage' kwargs dict mako template 'login mako' template lookup LOOKUP if headers kwargs['headers'] headersresp Response **kwargs argv {'action' '/verify' 'login' '' 'password' '' 'key' key 'authn reference' re... | null | null | null | null | Question:
What does the code display ?
Code:
def username_password_authn(environ, start_response, reference, key, redirect_uri, headers=None):
logger.info('The login page')
kwargs = dict(mako_template='login.mako', template_lookup=LOOKUP)
if headers:
kwargs['headers'] = headers
resp = Response(**kwargs)
ar... |
null | null | null | What does the code remove ?
| def lstrips(text, remove):
return _strips('l', text, remove)
| null | null | null | the string remove from the right of text
| codeqa | def lstrips text remove return strips 'l' text remove
| null | null | null | null | Question:
What does the code remove ?
Code:
def lstrips(text, remove):
return _strips('l', text, remove)
|
null | null | null | How do item convert to a string ?
| def StringifyJSON(item):
if isinstance(item, (tuple, list)):
return [StringifyJSON(x) for x in item]
elif isinstance(item, dict):
result = {}
for (k, v) in item.items():
result[k] = StringifyJSON(v)
return result
elif (type(item) in (int, long, float, bool)):
return item
elif (item is None):
return N... | null | null | null | recursively
| codeqa | def Stringify JSON item if isinstance item tuple list return [ Stringify JSON x for x in item]elif isinstance item dict result {}for k v in item items result[k] Stringify JSON v return resultelif type item in int long float bool return itemelif item is None return Noneelse return utils Smart Unicode item
| null | null | null | null | Question:
How do item convert to a string ?
Code:
def StringifyJSON(item):
if isinstance(item, (tuple, list)):
return [StringifyJSON(x) for x in item]
elif isinstance(item, dict):
result = {}
for (k, v) in item.items():
result[k] = StringifyJSON(v)
return result
elif (type(item) in (int, long, float, ... |
null | null | null | What is running this smoke test ?
| def main():
defaults = {'TEST_STACK': 'tst', 'TEST_APP': ('kubsmok' + KubeSmokeTestScenario.DEFAULT_TEST_ID)}
return citest.base.TestRunner.main(parser_inits=[KubeSmokeTestScenario.initArgumentParser], default_binding_overrides=defaults, test_case_list=[KubeSmokeTest])
| null | null | null | the main method
| codeqa | def main defaults {'TEST STACK' 'tst' 'TEST APP' 'kubsmok' + Kube Smoke Test Scenario DEFAULT TEST ID }return citest base Test Runner main parser inits [ Kube Smoke Test Scenario init Argument Parser] default binding overrides defaults test case list [ Kube Smoke Test]
| null | null | null | null | Question:
What is running this smoke test ?
Code:
def main():
defaults = {'TEST_STACK': 'tst', 'TEST_APP': ('kubsmok' + KubeSmokeTestScenario.DEFAULT_TEST_ID)}
return citest.base.TestRunner.main(parser_inits=[KubeSmokeTestScenario.initArgumentParser], default_binding_overrides=defaults, test_case_list=[KubeSmokeT... |
null | null | null | What do the main method run ?
| def main():
defaults = {'TEST_STACK': 'tst', 'TEST_APP': ('kubsmok' + KubeSmokeTestScenario.DEFAULT_TEST_ID)}
return citest.base.TestRunner.main(parser_inits=[KubeSmokeTestScenario.initArgumentParser], default_binding_overrides=defaults, test_case_list=[KubeSmokeTest])
| null | null | null | this smoke test
| codeqa | def main defaults {'TEST STACK' 'tst' 'TEST APP' 'kubsmok' + Kube Smoke Test Scenario DEFAULT TEST ID }return citest base Test Runner main parser inits [ Kube Smoke Test Scenario init Argument Parser] default binding overrides defaults test case list [ Kube Smoke Test]
| null | null | null | null | Question:
What do the main method run ?
Code:
def main():
defaults = {'TEST_STACK': 'tst', 'TEST_APP': ('kubsmok' + KubeSmokeTestScenario.DEFAULT_TEST_ID)}
return citest.base.TestRunner.main(parser_inits=[KubeSmokeTestScenario.initArgumentParser], default_binding_overrides=defaults, test_case_list=[KubeSmokeTest]... |
null | null | null | When did the information return ?
| def get_jid(jid):
serv = _get_serv(ret=None)
minions = _get_list(serv, 'minions')
returns = serv.get_multi(minions, key_prefix='{0}:'.format(jid))
ret = {}
for (minion, data) in six.iteritems(returns):
ret[minion] = json.loads(data)
return ret
| null | null | null | when the specified job i d was executed
| codeqa | def get jid jid serv get serv ret None minions get list serv 'minions' returns serv get multi minions key prefix '{ 0 } ' format jid ret {}for minion data in six iteritems returns ret[minion] json loads data return ret
| null | null | null | null | Question:
When did the information return ?
Code:
def get_jid(jid):
serv = _get_serv(ret=None)
minions = _get_list(serv, 'minions')
returns = serv.get_multi(minions, key_prefix='{0}:'.format(jid))
ret = {}
for (minion, data) in six.iteritems(returns):
ret[minion] = json.loads(data)
return ret
|
null | null | null | When were return volumes were active ?
| @require_context
def volume_get_active_by_window(context, begin, end=None, project_id=None):
session = get_session()
query = session.query(models.Volume)
query = query.filter(or_((models.Volume.deleted_at == None), (models.Volume.deleted_at > begin)))
if end:
query = query.filter((models.Volume.created_at < end))... | null | null | null | during window
| codeqa | @require contextdef volume get active by window context begin end None project id None session get session query session query models Volume query query filter or models Volume deleted at None models Volume deleted at > begin if end query query filter models Volume created at < end if project id query query filter by p... | null | null | null | null | Question:
When were return volumes were active ?
Code:
@require_context
def volume_get_active_by_window(context, begin, end=None, project_id=None):
session = get_session()
query = session.query(models.Volume)
query = query.filter(or_((models.Volume.deleted_at == None), (models.Volume.deleted_at > begin)))
if en... |
null | null | null | What does which perform ?
| def basic_auth(realm, checkpassword, debug=False):
if ('"' in realm):
raise ValueError('Realm cannot contain the " (quote) character.')
request = cherrypy.serving.request
auth_header = request.headers.get('authorization')
if (auth_header is not None):
try:
(scheme, params) = auth_header.split(' ', 1)
... | null | null | null | http basic access authentication
| codeqa | def basic auth realm checkpassword debug False if '"' in realm raise Value Error ' Realmcannotcontainthe" quote character ' request cherrypy serving requestauth header request headers get 'authorization' if auth header is not None try scheme params auth header split '' 1 if scheme lower 'basic' username password base 6... | null | null | null | null | Question:
What does which perform ?
Code:
def basic_auth(realm, checkpassword, debug=False):
if ('"' in realm):
raise ValueError('Realm cannot contain the " (quote) character.')
request = cherrypy.serving.request
auth_header = request.headers.get('authorization')
if (auth_header is not None):
try:
... |
null | null | null | Where did the first object find ?
| def get_context_first_object(context, context_lookups):
return get_context_first_matching_object(context, context_lookups)[1]
| null | null | null | in the context
| codeqa | def get context first object context context lookups return get context first matching object context context lookups [1 ]
| null | null | null | null | Question:
Where did the first object find ?
Code:
def get_context_first_object(context, context_lookups):
return get_context_first_matching_object(context, context_lookups)[1]
|
null | null | null | What found in the context ?
| def get_context_first_object(context, context_lookups):
return get_context_first_matching_object(context, context_lookups)[1]
| null | null | null | the first object
| codeqa | def get context first object context context lookups return get context first matching object context context lookups [1 ]
| null | null | null | null | Question:
What found in the context ?
Code:
def get_context_first_object(context, context_lookups):
return get_context_first_matching_object(context, context_lookups)[1]
|
null | null | null | What does the code evaluate ?
| def Eval(sess, parser, num_steps, best_eval_metric):
logging.info('Evaluating training network.')
t = time.time()
num_epochs = None
num_tokens = 0
num_correct = 0
while True:
(tf_eval_epochs, tf_eval_metrics) = sess.run([parser.evaluation['epochs'], parser.evaluation['eval_metrics']])
num_tokens += tf_eval_... | null | null | null | a network
| codeqa | def Eval sess parser num steps best eval metric logging info ' Evaluatingtrainingnetwork ' t time time num epochs Nonenum tokens 0num correct 0while True tf eval epochs tf eval metrics sess run [parser evaluation['epochs'] parser evaluation['eval metrics']] num tokens + tf eval metrics[ 0 ]num correct + tf eval metrics... | null | null | null | null | Question:
What does the code evaluate ?
Code:
def Eval(sess, parser, num_steps, best_eval_metric):
logging.info('Evaluating training network.')
t = time.time()
num_epochs = None
num_tokens = 0
num_correct = 0
while True:
(tf_eval_epochs, tf_eval_metrics) = sess.run([parser.evaluation['epochs'], parser.eva... |
null | null | null | What converts to int or raise ?
| def validate_int(s):
try:
return int(s)
except ValueError:
raise ValueError(('Could not convert "%s" to int' % s))
| null | null | null | s
| codeqa | def validate int s try return int s except Value Error raise Value Error ' Couldnotconvert"%s"toint' % s
| null | null | null | null | Question:
What converts to int or raise ?
Code:
def validate_int(s):
try:
return int(s)
except ValueError:
raise ValueError(('Could not convert "%s" to int' % s))
|
null | null | null | What do s convert ?
| def validate_int(s):
try:
return int(s)
except ValueError:
raise ValueError(('Could not convert "%s" to int' % s))
| null | null | null | to int or raise
| codeqa | def validate int s try return int s except Value Error raise Value Error ' Couldnotconvert"%s"toint' % s
| null | null | null | null | Question:
What do s convert ?
Code:
def validate_int(s):
try:
return int(s)
except ValueError:
raise ValueError(('Could not convert "%s" to int' % s))
|
null | null | null | How do an error log ?
| def _raise_error_network(option, expected):
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg)
| null | null | null | with a logical formatted message
| codeqa | def raise error network option expected msg error msg network option expected log error msg raise Attribute Error msg
| null | null | null | null | Question:
How do an error log ?
Code:
def _raise_error_network(option, expected):
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg)
|
null | null | null | How do an error raise ?
| def _raise_error_network(option, expected):
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg)
| null | null | null | with a logical formatted message
| codeqa | def raise error network option expected msg error msg network option expected log error msg raise Attribute Error msg
| null | null | null | null | Question:
How do an error raise ?
Code:
def _raise_error_network(option, expected):
msg = _error_msg_network(option, expected)
log.error(msg)
raise AttributeError(msg)
|
null | null | null | When did user log ?
| def assert_request_user_has_resource_db_permission(request, resource_db, permission_type):
has_permission = request_user_has_resource_db_permission(request=request, resource_db=resource_db, permission_type=permission_type)
if (not has_permission):
user_db = get_user_db_from_request(request=request)
raise Resource... | null | null | null | currently
| codeqa | def assert request user has resource db permission request resource db permission type has permission request user has resource db permission request request resource db resource db permission type permission type if not has permission user db get user db from request request request raise Resource Access Denied Error ... | null | null | null | null | Question:
When did user log ?
Code:
def assert_request_user_has_resource_db_permission(request, resource_db, permission_type):
has_permission = request_user_has_resource_db_permission(request=request, resource_db=resource_db, permission_type=permission_type)
if (not has_permission):
user_db = get_user_db_from_r... |
null | null | null | What does the code initiate ?
| def post(url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=60, allow_redirects=False, stream=False):
return request('POST', url, params, data, headers, cookies, files, auth, timeout, allow_redirects, stream)
| null | null | null | a post request
| codeqa | def post url params None data None headers None cookies None files None auth None timeout 60 allow redirects False stream False return request 'POST' url params data headers cookies files auth timeout allow redirects stream
| null | null | null | null | Question:
What does the code initiate ?
Code:
def post(url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=60, allow_redirects=False, stream=False):
return request('POST', url, params, data, headers, cookies, files, auth, timeout, allow_redirects, stream)
|
null | null | null | What does the code remove from a list ?
| def recursive_list_removal(base_list, purge_list):
for item in purge_list:
for _item in base_list:
if (item == _item):
base_list.pop(base_list.index(item))
| null | null | null | items
| codeqa | def recursive list removal base list purge list for item in purge list for item in base list if item item base list pop base list index item
| null | null | null | null | Question:
What does the code remove from a list ?
Code:
def recursive_list_removal(base_list, purge_list):
for item in purge_list:
for _item in base_list:
if (item == _item):
base_list.pop(base_list.index(item))
|
null | null | null | What does the code validate ?
| def __virtual__():
return True
| null | null | null | the module
| codeqa | def virtual return True
| null | null | null | null | Question:
What does the code validate ?
Code:
def __virtual__():
return True
|
null | null | null | What does the code convert ?
| def _to_blockdev_map(thing):
if (not thing):
return None
if isinstance(thing, BlockDeviceMapping):
return thing
if isinstance(thing, six.string_types):
thing = json.loads(thing)
if (not isinstance(thing, dict)):
log.error("Can't convert '{0}' of type {1} to a boto.ec2.blockdevicemapping.BlockDeviceM... | null | null | null | a string
| codeqa | def to blockdev map thing if not thing return Noneif isinstance thing Block Device Mapping return thingif isinstance thing six string types thing json loads thing if not isinstance thing dict log error " Can'tconvert'{ 0 }'oftype{ 1 }toaboto ec 2 blockdevicemapping Block Device Mapping" format thing type thing return N... | null | null | null | null | Question:
What does the code convert ?
Code:
def _to_blockdev_map(thing):
if (not thing):
return None
if isinstance(thing, BlockDeviceMapping):
return thing
if isinstance(thing, six.string_types):
thing = json.loads(thing)
if (not isinstance(thing, dict)):
log.error("Can't convert '{0}' of type {1}... |
null | null | null | What does the code rotate 180 degrees ?
| def mirror(op):
return _mirror.get(op, op)
| null | null | null | a comparison operator
| codeqa | def mirror op return mirror get op op
| null | null | null | null | Question:
What does the code rotate 180 degrees ?
Code:
def mirror(op):
return _mirror.get(op, op)
|
null | null | null | What does the code validate ?
| def authenticate(api_handle, username, password):
userlist = __parse_storage()
for (user, realm, actual_blob) in userlist:
if ((user == username) and (realm == 'Cobbler')):
input = ':'.join([user, realm, password])
input_blob = md5(input).hexdigest()
if (input_blob.lower() == actual_blob.lower()):
retu... | null | null | null | a username / password combo
| codeqa | def authenticate api handle username password userlist parse storage for user realm actual blob in userlist if user username and realm ' Cobbler' input ' ' join [user realm password] input blob md 5 input hexdigest if input blob lower actual blob lower return Truereturn False
| null | null | null | null | Question:
What does the code validate ?
Code:
def authenticate(api_handle, username, password):
userlist = __parse_storage()
for (user, realm, actual_blob) in userlist:
if ((user == username) and (realm == 'Cobbler')):
input = ':'.join([user, realm, password])
input_blob = md5(input).hexdigest()
if (in... |
null | null | null | How do the new plugin register ?
| def register():
signals.article_generator_finalized.connect(ARTICLE_GROUPER)
signals.page_generator_finalized.connect(PAGE_GROUPER)
| null | null | null | code
| codeqa | def register signals article generator finalized connect ARTICLE GROUPER signals page generator finalized connect PAGE GROUPER
| null | null | null | null | Question:
How do the new plugin register ?
Code:
def register():
signals.article_generator_finalized.connect(ARTICLE_GROUPER)
signals.page_generator_finalized.connect(PAGE_GROUPER)
|
null | null | null | What does the code do ?
| def do(name, query=''):
try:
cmd = 'do_{}'.format(name)
if (cmd in globals()):
globals()[cmd](query)
else:
_out('Invalid command "{}"'.format(name))
except Exception as e:
_out('Error: {}'.format(e))
| null | null | null | something
| codeqa | def do name query '' try cmd 'do {}' format name if cmd in globals globals [cmd] query else out ' Invalidcommand"{}"' format name except Exception as e out ' Error {}' format e
| null | null | null | null | Question:
What does the code do ?
Code:
def do(name, query=''):
try:
cmd = 'do_{}'.format(name)
if (cmd in globals()):
globals()[cmd](query)
else:
_out('Invalid command "{}"'.format(name))
except Exception as e:
_out('Error: {}'.format(e))
|
null | null | null | What does the code get from keystone ?
| def get_default_role(request):
global DEFAULT_ROLE
default = getattr(settings, 'OPENSTACK_KEYSTONE_DEFAULT_ROLE', None)
if (default and (DEFAULT_ROLE is None)):
try:
roles = keystoneclient(request, admin=True).roles.list()
except Exception:
roles = []
exceptions.handle(request)
for role in roles:
i... | null | null | null | the default role object
| codeqa | def get default role request global DEFAULT ROL Edefault getattr settings 'OPENSTACK KEYSTONE DEFAULT ROLE' None if default and DEFAULT ROLE is None try roles keystoneclient request admin True roles list except Exception roles []exceptions handle request for role in roles if role id default or role name default DEFAULT... | null | null | null | null | Question:
What does the code get from keystone ?
Code:
def get_default_role(request):
global DEFAULT_ROLE
default = getattr(settings, 'OPENSTACK_KEYSTONE_DEFAULT_ROLE', None)
if (default and (DEFAULT_ROLE is None)):
try:
roles = keystoneclient(request, admin=True).roles.list()
except Exception:
roles =... |
null | null | null | What does the code retrieve from the settings object ?
| def get_stylesheet_reference(settings, relative_to=None):
if settings.stylesheet_path:
assert (not settings.stylesheet), 'stylesheet and stylesheet_path are mutually exclusive.'
if (relative_to == None):
relative_to = settings._destination
return relative_path(relative_to, settings.stylesheet_path)
else... | null | null | null | a stylesheet reference
| codeqa | def get stylesheet reference settings relative to None if settings stylesheet path assert not settings stylesheet 'stylesheetandstylesheet patharemutuallyexclusive 'if relative to None relative to settings destinationreturn relative path relative to settings stylesheet path else return settings stylesheet
| null | null | null | null | Question:
What does the code retrieve from the settings object ?
Code:
def get_stylesheet_reference(settings, relative_to=None):
if settings.stylesheet_path:
assert (not settings.stylesheet), 'stylesheet and stylesheet_path are mutually exclusive.'
if (relative_to == None):
relative_to = settings._dest... |
null | null | null | What does the code cancel ?
| def job_cancel(context, data_dict):
return {'success': False}
| null | null | null | a background job
| codeqa | def job cancel context data dict return {'success' False}
| null | null | null | null | Question:
What does the code cancel ?
Code:
def job_cancel(context, data_dict):
return {'success': False}
|
null | null | null | When did each plugin be on the path ?
| def load_plugins(build_configuration, plugins, working_set):
loaded = {}
for plugin in plugins:
req = Requirement.parse(plugin)
dist = working_set.find(req)
if (not dist):
raise PluginNotFound(u'Could not find plugin: {}'.format(req))
entries = dist.get_entry_map().get(u'pantsbuild.plugin', {})
if (u... | null | null | null | already
| codeqa | def load plugins build configuration plugins working set loaded {}for plugin in plugins req Requirement parse plugin dist working set find req if not dist raise Plugin Not Found u' Couldnotfindplugin {}' format req entries dist get entry map get u'pantsbuild plugin' {} if u'load after' in entries deps entries[u'load af... | null | null | null | null | Question:
When did each plugin be on the path ?
Code:
def load_plugins(build_configuration, plugins, working_set):
loaded = {}
for plugin in plugins:
req = Requirement.parse(plugin)
dist = working_set.find(req)
if (not dist):
raise PluginNotFound(u'Could not find plugin: {}'.format(req))
entries = ... |
null | null | null | What does the code shorten with the given length ?
| def truncate_name(name, length=None, hash_len=4):
if ((length is None) or (len(name) <= length)):
return name
hsh = hashlib.md5(force_bytes(name)).hexdigest()[:hash_len]
return ('%s%s' % (name[:(length - hash_len)], hsh))
| null | null | null | a string
| codeqa | def truncate name name length None hash len 4 if length is None or len name < length return namehsh hashlib md 5 force bytes name hexdigest [ hash len]return '%s%s' % name[ length - hash len ] hsh
| null | null | null | null | Question:
What does the code shorten with the given length ?
Code:
def truncate_name(name, length=None, hash_len=4):
if ((length is None) or (len(name) <= length)):
return name
hsh = hashlib.md5(force_bytes(name)).hexdigest()[:hash_len]
return ('%s%s' % (name[:(length - hash_len)], hsh))
|
null | null | null | When did class select ?
| def current_stream():
_lazy_init()
return torch.cuda.Stream(_cdata=torch._C._cuda_getCurrentStream())
| null | null | null | currently
| codeqa | def current stream lazy init return torch cuda Stream cdata torch C cuda get Current Stream
| null | null | null | null | Question:
When did class select ?
Code:
def current_stream():
_lazy_init()
return torch.cuda.Stream(_cdata=torch._C._cuda_getCurrentStream())
|
null | null | null | Till when does the code join the reactor thread ?
| def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():
p.cancel()
_twisted_thread = None
| null | null | null | until it stops
| codeqa | def stop reactor global twisted threaddef stop reactor ' Helperforcallingstopfromwithingthethread 'reactor stop reactor call From Thread stop reactor reactor thread join for p in reactor get Delayed Calls if p active p cancel twisted thread None
| null | null | null | null | Question:
Till when does the code join the reactor thread ?
Code:
def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.... |
null | null | null | What does the code join until it stops ?
| def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():
p.cancel()
_twisted_thread = None
| null | null | null | the reactor thread
| codeqa | def stop reactor global twisted threaddef stop reactor ' Helperforcallingstopfromwithingthethread 'reactor stop reactor call From Thread stop reactor reactor thread join for p in reactor get Delayed Calls if p active p cancel twisted thread None
| null | null | null | null | Question:
What does the code join until it stops ?
Code:
def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():... |
null | null | null | What does the code stop ?
| def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():
p.cancel()
_twisted_thread = None
| null | null | null | the reactor
| codeqa | def stop reactor global twisted threaddef stop reactor ' Helperforcallingstopfromwithingthethread 'reactor stop reactor call From Thread stop reactor reactor thread join for p in reactor get Delayed Calls if p active p cancel twisted thread None
| null | null | null | null | Question:
What does the code stop ?
Code:
def stop_reactor():
global _twisted_thread
def _stop_reactor():
'"Helper for calling stop from withing the thread.'
reactor.stop()
reactor.callFromThread(_stop_reactor)
reactor_thread.join()
for p in reactor.getDelayedCalls():
if p.active():
p.cancel()
... |
null | null | null | What does the code run ?
| def cmd_script(args):
if (len(args) < 1):
print 'usage: script <filename>'
return
run_script(args[0])
| null | null | null | a script
| codeqa | def cmd script args if len args < 1 print 'usage script<filename>'returnrun script args[ 0 ]
| null | null | null | null | Question:
What does the code run ?
Code:
def cmd_script(args):
if (len(args) < 1):
print 'usage: script <filename>'
return
run_script(args[0])
|
null | null | null | What does the code add to formatted correlation output lines ?
| def _add_metadata(bt, md_key, lines):
taxonomy_md = biom_taxonomy_formatter(bt, md_key)
if (taxonomy_md is not None):
for i in range((len(lines) - 1)):
lines[(i + 1)] = ((lines[(i + 1)] + ' DCTB ') + taxonomy_md[i])
return lines
else:
nls = ([' DCTB '.join(lines[0].split(' DCTB ')[:(-1)])] + lines[1:])
re... | null | null | null | metadata
| codeqa | def add metadata bt md key lines taxonomy md biom taxonomy formatter bt md key if taxonomy md is not None for i in range len lines - 1 lines[ i + 1 ] lines[ i + 1 ] + ' DCTB ' + taxonomy md[i] return lineselse nls [' DCTB ' join lines[ 0 ] split ' DCTB ' [ -1 ] ] + lines[ 1 ] return nls
| null | null | null | null | Question:
What does the code add to formatted correlation output lines ?
Code:
def _add_metadata(bt, md_key, lines):
taxonomy_md = biom_taxonomy_formatter(bt, md_key)
if (taxonomy_md is not None):
for i in range((len(lines) - 1)):
lines[(i + 1)] = ((lines[(i + 1)] + ' DCTB ') + taxonomy_md[i])
return lines... |
null | null | null | How do class based routers create ?
| def test_simple_class_based_view():
@hug.object.urls('/endpoint', requires=())
class MyClass(object, ):
@hug.object.get()
def my_method(self):
return 'hi there!'
@hug.object.post()
def my_method_two(self):
return 'bye'
assert (hug.test.get(api, 'endpoint').data == 'hi there!')
assert (hug.test.post(... | null | null | null | test
| codeqa | def test simple class based view @hug object urls '/endpoint' requires class My Class object @hug object get def my method self return 'hithere '@hug object post def my method two self return 'bye'assert hug test get api 'endpoint' data 'hithere ' assert hug test post api 'endpoint' data 'bye'
| null | null | null | null | Question:
How do class based routers create ?
Code:
def test_simple_class_based_view():
@hug.object.urls('/endpoint', requires=())
class MyClass(object, ):
@hug.object.get()
def my_method(self):
return 'hi there!'
@hug.object.post()
def my_method_two(self):
return 'bye'
assert (hug.test.get(api, '... |
null | null | null | How did routers base ?
| def test_simple_class_based_view():
@hug.object.urls('/endpoint', requires=())
class MyClass(object, ):
@hug.object.get()
def my_method(self):
return 'hi there!'
@hug.object.post()
def my_method_two(self):
return 'bye'
assert (hug.test.get(api, 'endpoint').data == 'hi there!')
assert (hug.test.post(... | null | null | null | class
| codeqa | def test simple class based view @hug object urls '/endpoint' requires class My Class object @hug object get def my method self return 'hithere '@hug object post def my method two self return 'bye'assert hug test get api 'endpoint' data 'hithere ' assert hug test post api 'endpoint' data 'bye'
| null | null | null | null | Question:
How did routers base ?
Code:
def test_simple_class_based_view():
@hug.object.urls('/endpoint', requires=())
class MyClass(object, ):
@hug.object.get()
def my_method(self):
return 'hi there!'
@hug.object.post()
def my_method_two(self):
return 'bye'
assert (hug.test.get(api, 'endpoint').da... |
null | null | null | What does the code locate into the shader library ?
| def find(name):
if op.exists(name):
return name
path = (op.dirname(__file__) or '.')
paths = ([path] + config['include_path'])
for path in paths:
filename = op.abspath(op.join(path, name))
if op.exists(filename):
return filename
for d in os.listdir(path):
fullpath = op.abspath(op.join(path, d))
if ... | null | null | null | a filename
| codeqa | def find name if op exists name return namepath op dirname file or ' ' paths [path] + config['include path'] for path in paths filename op abspath op join path name if op exists filename return filenamefor d in os listdir path fullpath op abspath op join path d if op isdir fullpath filename op abspath op join fullpath ... | null | null | null | null | Question:
What does the code locate into the shader library ?
Code:
def find(name):
if op.exists(name):
return name
path = (op.dirname(__file__) or '.')
paths = ([path] + config['include_path'])
for path in paths:
filename = op.abspath(op.join(path, name))
if op.exists(filename):
return filename
for ... |
null | null | null | What have the given prefix ?
| def filter_by_key_prefix(dict, prefix):
out_dict = {}
for (key, value) in dict.items():
if key.startswith(prefix):
out_dict[key] = value
return out_dict
| null | null | null | a dictionary
| codeqa | def filter by key prefix dict prefix out dict {}for key value in dict items if key startswith prefix out dict[key] valuereturn out dict
| null | null | null | null | Question:
What have the given prefix ?
Code:
def filter_by_key_prefix(dict, prefix):
out_dict = {}
for (key, value) in dict.items():
if key.startswith(prefix):
out_dict[key] = value
return out_dict
|
null | null | null | What picks the first one ?
| def _get_returner(returner_types):
for returner in returner_types:
if (returner and (returner is not None)):
return returner
| null | null | null | helper
| codeqa | def get returner returner types for returner in returner types if returner and returner is not None return returner
| null | null | null | null | Question:
What picks the first one ?
Code:
def _get_returner(returner_types):
for returner in returner_types:
if (returner and (returner is not None)):
return returner
|
null | null | null | What do helper pick ?
| def _get_returner(returner_types):
for returner in returner_types:
if (returner and (returner is not None)):
return returner
| null | null | null | the first one
| codeqa | def get returner returner types for returner in returner types if returner and returner is not None return returner
| null | null | null | null | Question:
What do helper pick ?
Code:
def _get_returner(returner_types):
for returner in returner_types:
if (returner and (returner is not None)):
return returner
|
null | null | null | By how much do a format_string format ?
| def replace_methodname(format_string, methodname):
methodnamehyphen = methodname.replace('_', '-')
ret = format_string
ret = ret.replace('{methodname}', methodname)
ret = ret.replace('{methodnamehyphen}', methodnamehyphen)
return ret
| null | null | null | partially
| codeqa | def replace methodname format string methodname methodnamehyphen methodname replace ' ' '-' ret format stringret ret replace '{methodname}' methodname ret ret replace '{methodnamehyphen}' methodnamehyphen return ret
| null | null | null | null | Question:
By how much do a format_string format ?
Code:
def replace_methodname(format_string, methodname):
methodnamehyphen = methodname.replace('_', '-')
ret = format_string
ret = ret.replace('{methodname}', methodname)
ret = ret.replace('{methodnamehyphen}', methodnamehyphen)
return ret
|
null | null | null | What monitors folders ?
| def monitor_folders(registry, xml_parent, data):
ft = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger')
ft.set('plugin', 'fstrigger')
mappings = [('path', 'path', ''), ('cron', 'spec', '')]
convert_mapping_to_xml(ft, data, mappings, fail_required=True)
includes = data.get(... | null | null | null | jenkins
| codeqa | def monitor folders registry xml parent data ft XML Sub Element xml parent 'org jenkinsci plugins fstrigger triggers Folder Content Trigger' ft set 'plugin' 'fstrigger' mappings [ 'path' 'path' '' 'cron' 'spec' '' ]convert mapping to xml ft data mappings fail required True includes data get 'includes' '' XML Sub Elemen... | null | null | null | null | Question:
What monitors folders ?
Code:
def monitor_folders(registry, xml_parent, data):
ft = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.fstrigger.triggers.FolderContentTrigger')
ft.set('plugin', 'fstrigger')
mappings = [('path', 'path', ''), ('cron', 'spec', '')]
convert_mapping_to_xml(ft, data, mapping... |
null | null | null | When is an error raised ?
| def test_sample_wt_fit():
ratio = 'auto'
cc = ClusterCentroids(ratio=ratio, random_state=RND_SEED)
assert_raises(RuntimeError, cc.sample, X, Y)
| null | null | null | when sample is called before fitting
| codeqa | def test sample wt fit ratio 'auto'cc Cluster Centroids ratio ratio random state RND SEED assert raises Runtime Error cc sample X Y
| null | null | null | null | Question:
When is an error raised ?
Code:
def test_sample_wt_fit():
ratio = 'auto'
cc = ClusterCentroids(ratio=ratio, random_state=RND_SEED)
assert_raises(RuntimeError, cc.sample, X, Y)
|
null | null | null | What does the code run ?
| def start_flask_app(host, port):
app.run(host=host, port=port)
app.config['DEBUG'] = False
app.config['TESTING'] = False
| null | null | null | the server
| codeqa | def start flask app host port app run host host port port app config['DEBUG'] Falseapp config['TESTING'] False
| null | null | null | null | Question:
What does the code run ?
Code:
def start_flask_app(host, port):
app.run(host=host, port=port)
app.config['DEBUG'] = False
app.config['TESTING'] = False
|
null | null | null | What does the code create ?
| def make_member_list(members, **attr_map):
def _fetch_memb(memb, attr_map):
return dict([(k, memb[v]) for (k, v) in attr_map.items() if (v in memb.keys())])
return [_fetch_memb(memb, attr_map) for memb in members]
| null | null | null | a dict representation of a list of members which we can use to serialize the members list
| codeqa | def make member list members **attr map def fetch memb memb attr map return dict [ k memb[v] for k v in attr map items if v in memb keys ] return [ fetch memb memb attr map for memb in members]
| null | null | null | null | Question:
What does the code create ?
Code:
def make_member_list(members, **attr_map):
def _fetch_memb(memb, attr_map):
return dict([(k, memb[v]) for (k, v) in attr_map.items() if (v in memb.keys())])
return [_fetch_memb(memb, attr_map) for memb in members]
|
null | null | null | What can we use a list of members ?
| def make_member_list(members, **attr_map):
def _fetch_memb(memb, attr_map):
return dict([(k, memb[v]) for (k, v) in attr_map.items() if (v in memb.keys())])
return [_fetch_memb(memb, attr_map) for memb in members]
| null | null | null | to serialize the members list
| codeqa | def make member list members **attr map def fetch memb memb attr map return dict [ k memb[v] for k v in attr map items if v in memb keys ] return [ fetch memb memb attr map for memb in members]
| null | null | null | null | Question:
What can we use a list of members ?
Code:
def make_member_list(members, **attr_map):
def _fetch_memb(memb, attr_map):
return dict([(k, memb[v]) for (k, v) in attr_map.items() if (v in memb.keys())])
return [_fetch_memb(memb, attr_map) for memb in members]
|
null | null | null | What does the code get ?
| def albums_for_id(album_id):
candidates = [album_for_mbid(album_id)]
candidates.extend(plugins.album_for_id(album_id))
return filter(None, candidates)
| null | null | null | a list of albums for an i d
| codeqa | def albums for id album id candidates [album for mbid album id ]candidates extend plugins album for id album id return filter None candidates
| null | null | null | null | Question:
What does the code get ?
Code:
def albums_for_id(album_id):
candidates = [album_for_mbid(album_id)]
candidates.extend(plugins.album_for_id(album_id))
return filter(None, candidates)
|
null | null | null | What does the code convert into a cookie containing the one k / v pair ?
| def morsel_to_cookie(morsel):
c = create_cookie(name=morsel.key, value=morsel.value, version=(morsel['version'] or 0), port=None, port_specified=False, domain=morsel['domain'], domain_specified=bool(morsel['domain']), domain_initial_dot=morsel['domain'].startswith('.'), path=morsel['path'], path_specified=bool(morsel[... | null | null | null | a morsel object
| codeqa | def morsel to cookie morsel c create cookie name morsel key value morsel value version morsel['version'] or 0 port None port specified False domain morsel['domain'] domain specified bool morsel['domain'] domain initial dot morsel['domain'] startswith ' ' path morsel['path'] path specified bool morsel['path'] secure boo... | null | null | null | null | Question:
What does the code convert into a cookie containing the one k / v pair ?
Code:
def morsel_to_cookie(morsel):
c = create_cookie(name=morsel.key, value=morsel.value, version=(morsel['version'] or 0), port=None, port_specified=False, domain=morsel['domain'], domain_specified=bool(morsel['domain']), domain_i... |
null | null | null | What is containing the one k / v pair ?
| def morsel_to_cookie(morsel):
c = create_cookie(name=morsel.key, value=morsel.value, version=(morsel['version'] or 0), port=None, port_specified=False, domain=morsel['domain'], domain_specified=bool(morsel['domain']), domain_initial_dot=morsel['domain'].startswith('.'), path=morsel['path'], path_specified=bool(morsel[... | null | null | null | a cookie
| codeqa | def morsel to cookie morsel c create cookie name morsel key value morsel value version morsel['version'] or 0 port None port specified False domain morsel['domain'] domain specified bool morsel['domain'] domain initial dot morsel['domain'] startswith ' ' path morsel['path'] path specified bool morsel['path'] secure boo... | null | null | null | null | Question:
What is containing the one k / v pair ?
Code:
def morsel_to_cookie(morsel):
c = create_cookie(name=morsel.key, value=morsel.value, version=(morsel['version'] or 0), port=None, port_specified=False, domain=morsel['domain'], domain_specified=bool(morsel['domain']), domain_initial_dot=morsel['domain'].start... |
null | null | null | What activates manual transaction control ?
| def commit_manually(using=None):
def inner_commit_manually(func, db=None):
def _commit_manually(*args, **kw):
try:
enter_transaction_management(using=db)
managed(True, using=db)
return func(*args, **kw)
finally:
leave_transaction_management(using=db)
return wraps(func)(_commit_manually)
if (... | null | null | null | decorator
| codeqa | def commit manually using None def inner commit manually func db None def commit manually *args **kw try enter transaction management using db managed True using db return func *args **kw finally leave transaction management using db return wraps func commit manually if using is None using DEFAULT DB ALIA Sif callable ... | null | null | null | null | Question:
What activates manual transaction control ?
Code:
def commit_manually(using=None):
def inner_commit_manually(func, db=None):
def _commit_manually(*args, **kw):
try:
enter_transaction_management(using=db)
managed(True, using=db)
return func(*args, **kw)
finally:
leave_transaction_m... |
null | null | null | What does decorator activate ?
| def commit_manually(using=None):
def inner_commit_manually(func, db=None):
def _commit_manually(*args, **kw):
try:
enter_transaction_management(using=db)
managed(True, using=db)
return func(*args, **kw)
finally:
leave_transaction_management(using=db)
return wraps(func)(_commit_manually)
if (... | null | null | null | manual transaction control
| codeqa | def commit manually using None def inner commit manually func db None def commit manually *args **kw try enter transaction management using db managed True using db return func *args **kw finally leave transaction management using db return wraps func commit manually if using is None using DEFAULT DB ALIA Sif callable ... | null | null | null | null | Question:
What does decorator activate ?
Code:
def commit_manually(using=None):
def inner_commit_manually(func, db=None):
def _commit_manually(*args, **kw):
try:
enter_transaction_management(using=db)
managed(True, using=db)
return func(*args, **kw)
finally:
leave_transaction_management(usi... |
null | null | null | How do a buffer of bytes mask ?
| def mask(buf, key):
key = [ord(i) for i in key]
buf = list(buf)
for (i, char) in enumerate(buf):
buf[i] = chr((ord(char) ^ key[(i % 4)]))
return ''.join(buf)
| null | null | null | with a masking key
| codeqa | def mask buf key key [ord i for i in key]buf list buf for i char in enumerate buf buf[i] chr ord char ^ key[ i % 4 ] return '' join buf
| null | null | null | null | Question:
How do a buffer of bytes mask ?
Code:
def mask(buf, key):
key = [ord(i) for i in key]
buf = list(buf)
for (i, char) in enumerate(buf):
buf[i] = chr((ord(char) ^ key[(i % 4)]))
return ''.join(buf)
|
null | null | null | How do a buffer of bytes unmask ?
| def mask(buf, key):
key = [ord(i) for i in key]
buf = list(buf)
for (i, char) in enumerate(buf):
buf[i] = chr((ord(char) ^ key[(i % 4)]))
return ''.join(buf)
| null | null | null | with a masking key
| codeqa | def mask buf key key [ord i for i in key]buf list buf for i char in enumerate buf buf[i] chr ord char ^ key[ i % 4 ] return '' join buf
| null | null | null | null | Question:
How do a buffer of bytes unmask ?
Code:
def mask(buf, key):
key = [ord(i) for i in key]
buf = list(buf)
for (i, char) in enumerate(buf):
buf[i] = chr((ord(char) ^ key[(i % 4)]))
return ''.join(buf)
|
null | null | null | What does the code add to the beginning of every non - blank line in s ?
| def _indent(s, indent=4):
return re.sub('(?m)^(?!$)', (indent * ' '), s)
| null | null | null | the given number of space characters
| codeqa | def indent s indent 4 return re sub ' ?m ^ ? $ ' indent * '' s
| null | null | null | null | Question:
What does the code add to the beginning of every non - blank line in s ?
Code:
def _indent(s, indent=4):
return re.sub('(?m)^(?!$)', (indent * ' '), s)
|
null | null | null | What do input image convert ?
| def convert_to_float(image, preserve_range):
if preserve_range:
image = image.astype(np.double)
else:
image = img_as_float(image)
return image
| null | null | null | to double image with the appropriate range
| codeqa | def convert to float image preserve range if preserve range image image astype np double else image img as float image return image
| null | null | null | null | Question:
What do input image convert ?
Code:
def convert_to_float(image, preserve_range):
if preserve_range:
image = image.astype(np.double)
else:
image = img_as_float(image)
return image
|
null | null | null | What converts to double image with the appropriate range ?
| def convert_to_float(image, preserve_range):
if preserve_range:
image = image.astype(np.double)
else:
image = img_as_float(image)
return image
| null | null | null | input image
| codeqa | def convert to float image preserve range if preserve range image image astype np double else image img as float image return image
| null | null | null | null | Question:
What converts to double image with the appropriate range ?
Code:
def convert_to_float(image, preserve_range):
if preserve_range:
image = image.astype(np.double)
else:
image = img_as_float(image)
return image
|
null | null | null | How do a test skip ?
| def skip(reason):
def decorator(test_item):
is_test_class = (isinstance(test_item, type) and issubclass(test_item, TestCase))
if (is_test_class and py26()):
for meth_name in (m for m in dir(test_item) if m.startswith('test_')):
patched_method = skip(reason)(getattr(test_item, meth_name))
setattr(test_it... | null | null | null | unconditionally
| codeqa | def skip reason def decorator test item is test class isinstance test item type and issubclass test item Test Case if is test class and py 26 for meth name in m for m in dir test item if m startswith 'test ' patched method skip reason getattr test item meth name setattr test item meth name patched method if not is test... | null | null | null | null | Question:
How do a test skip ?
Code:
def skip(reason):
def decorator(test_item):
is_test_class = (isinstance(test_item, type) and issubclass(test_item, TestCase))
if (is_test_class and py26()):
for meth_name in (m for m in dir(test_item) if m.startswith('test_')):
patched_method = skip(reason)(getattr(t... |
null | null | null | How is the person affiliated with ?
| def hrm_training_organisation(row):
try:
person_id = row.hrm_training.person_id
except AttributeError:
person_id = None
if person_id:
s3db = current.s3db
table = s3db.hrm_human_resource
query = ((table.person_id == person_id) & (table.status != 2))
orgs = current.db(query).select(table.organisation_id, d... | null | null | null | actively
| codeqa | def hrm training organisation row try person id row hrm training person idexcept Attribute Error person id Noneif person id s3 db current s3 dbtable s3 db hrm human resourcequery table person id person id & table status 2 orgs current db query select table organisation id distinct True if orgs output ''represent s3 db ... | null | null | null | null | Question:
How is the person affiliated with ?
Code:
def hrm_training_organisation(row):
try:
person_id = row.hrm_training.person_id
except AttributeError:
person_id = None
if person_id:
s3db = current.s3db
table = s3db.hrm_human_resource
query = ((table.person_id == person_id) & (table.status != 2))
... |
null | null | null | In which direction do connected paths get ?
| def getConnectedPaths(paths, pixelDictionary, width):
if (len(paths) < 2):
return paths
connectedPaths = []
segments = []
for pathIndex in xrange(len(paths)):
path = paths[pathIndex]
segments.append(getSegmentFromPath(path, pathIndex))
for pathIndex in xrange(0, (len(paths) - 1)):
concatenateRemovePath(con... | null | null | null | from paths
| codeqa | def get Connected Paths paths pixel Dictionary width if len paths < 2 return pathsconnected Paths []segments []for path Index in xrange len paths path paths[path Index]segments append get Segment From Path path path Index for path Index in xrange 0 len paths - 1 concatenate Remove Path connected Paths path Index paths ... | null | null | null | null | Question:
In which direction do connected paths get ?
Code:
def getConnectedPaths(paths, pixelDictionary, width):
if (len(paths) < 2):
return paths
connectedPaths = []
segments = []
for pathIndex in xrange(len(paths)):
path = paths[pathIndex]
segments.append(getSegmentFromPath(path, pathIndex))
for pathI... |
null | null | null | What returns from config whether it is a dict ?
| def as_dict(config):
if isinstance(config, basestring):
config = Parser().dict_from_file(config)
elif hasattr(config, 'read'):
config = Parser().dict_from_file(config)
return config
| null | null | null | a dict
| codeqa | def as dict config if isinstance config basestring config Parser dict from file config elif hasattr config 'read' config Parser dict from file config return config
| null | null | null | null | Question:
What returns from config whether it is a dict ?
Code:
def as_dict(config):
if isinstance(config, basestring):
config = Parser().dict_from_file(config)
elif hasattr(config, 'read'):
config = Parser().dict_from_file(config)
return config
|
null | null | null | What does the code find ?
| def s3_image_get(context, image_id):
return IMPL.s3_image_get(context, image_id)
| null | null | null | local s3 image represented by the provided i d
| codeqa | def s3 image get context image id return IMPL s3 image get context image id
| null | null | null | null | Question:
What does the code find ?
Code:
def s3_image_get(context, image_id):
return IMPL.s3_image_get(context, image_id)
|
null | null | null | What does the code remove from tree ?
| def drop_duplicate_nodes(tree, inserted_nodes):
for (name, node_list) in inserted_nodes.items():
if (len(node_list) == 1):
continue
node_list.sort(key=(lambda x: x.Score), reverse=True)
node_to_keep = node_list[0]
for n in node_list:
if (n is node_to_keep):
continue
elif (n.Parent is not None):
... | null | null | null | nodes
| codeqa | def drop duplicate nodes tree inserted nodes for name node list in inserted nodes items if len node list 1 continuenode list sort key lambda x x Score reverse True node to keep node list[ 0 ]for n in node list if n is node to keep continueelif n Parent is not None n Parent remove n tree prune return tree
| null | null | null | null | Question:
What does the code remove from tree ?
Code:
def drop_duplicate_nodes(tree, inserted_nodes):
for (name, node_list) in inserted_nodes.items():
if (len(node_list) == 1):
continue
node_list.sort(key=(lambda x: x.Score), reverse=True)
node_to_keep = node_list[0]
for n in node_list:
if (n is node... |
null | null | null | What is opening in a directory ?
| def open_dir(dirname, indexname=None, mapped=True, readonly=False):
if (indexname is None):
indexname = _DEF_INDEX_NAME
from whoosh.filedb.filestore import FileStorage
storage = FileStorage(dirname, mapped=mapped, readonly=readonly)
return storage.open_index(indexname)
| null | null | null | an index
| codeqa | def open dir dirname indexname None mapped True readonly False if indexname is None indexname DEF INDEX NAM Efrom whoosh filedb filestore import File Storagestorage File Storage dirname mapped mapped readonly readonly return storage open index indexname
| null | null | null | null | Question:
What is opening in a directory ?
Code:
def open_dir(dirname, indexname=None, mapped=True, readonly=False):
if (indexname is None):
indexname = _DEF_INDEX_NAME
from whoosh.filedb.filestore import FileStorage
storage = FileStorage(dirname, mapped=mapped, readonly=readonly)
return storage.open_index(in... |
null | null | null | What does the code run ?
| @needs('pavelib.prereqs.install_prereqs', 'pavelib.utils.test.utils.clean_reports_dir')
@cmdopts([('suites', 's', 'List of unit test suites to run. (js, lib, cms, lms)'), make_option('-c', '--cov-args', default='', help='adds as args to coverage for the test run'), make_option('--verbose', action='sto... | null | null | null | all tests
| codeqa | @needs 'pavelib prereqs install prereqs' 'pavelib utils test utils clean reports dir' @cmdopts [ 'suites' 's' ' Listofunittestsuitestorun js lib cms lms ' make option '-c' '--cov-args' default '' help 'addsasargstocoverageforthetestrun' make option '--verbose' action 'store const' const 2 dest 'verbosity' make option '... | null | null | null | null | Question:
What does the code run ?
Code:
@needs('pavelib.prereqs.install_prereqs', 'pavelib.utils.test.utils.clean_reports_dir')
@cmdopts([('suites', 's', 'List of unit test suites to run. (js, lib, cms, lms)'), make_option('-c', '--cov-args', default='', help='adds as args to coverage for the test... |
null | null | null | What does the code transform ?
| def build_response(response, request):
dict_obj = {}
dict_obj['path'] = urlparse.unquote(request.path)
dict_obj['status'] = response.status_code
dict_obj['headers'] = dict(response.headers)
body = ''
if (request.method != 'HEAD'):
try:
body = response.json
except ValueError:
body = response.body
dict_o... | null | null | null | a : class : pyramid
| codeqa | def build response response request dict obj {}dict obj['path'] urlparse unquote request path dict obj['status'] response status codedict obj['headers'] dict response headers body ''if request method 'HEAD' try body response jsonexcept Value Error body response bodydict obj['body'] bodyreturn dict obj
| null | null | null | null | Question:
What does the code transform ?
Code:
def build_response(response, request):
dict_obj = {}
dict_obj['path'] = urlparse.unquote(request.path)
dict_obj['status'] = response.status_code
dict_obj['headers'] = dict(response.headers)
body = ''
if (request.method != 'HEAD'):
try:
body = response.json
... |
null | null | null | How do a worker update ?
| def worker_update(context, id, filters=None, orm_worker=None, **values):
return IMPL.worker_update(context, id, filters=filters, orm_worker=orm_worker, **values)
| null | null | null | with given values
| codeqa | def worker update context id filters None orm worker None **values return IMPL worker update context id filters filters orm worker orm worker **values
| null | null | null | null | Question:
How do a worker update ?
Code:
def worker_update(context, id, filters=None, orm_worker=None, **values):
return IMPL.worker_update(context, id, filters=filters, orm_worker=orm_worker, **values)
|
null | null | null | What does the code get ?
| def _getTestList():
suiteNames = ['OneNodeTests', 'MultiNodeTests', 'ModelMaturityTests', 'SwarmTerminatorTests']
testNames = []
for suite in suiteNames:
for f in dir(eval(suite)):
if f.startswith('test'):
testNames.append(('%s.%s' % (suite, f)))
return testNames
| null | null | null | the list of tests that can be run from this module
| codeqa | def get Test List suite Names [' One Node Tests' ' Multi Node Tests' ' Model Maturity Tests' ' Swarm Terminator Tests']test Names []for suite in suite Names for f in dir eval suite if f startswith 'test' test Names append '%s %s' % suite f return test Names
| null | null | null | null | Question:
What does the code get ?
Code:
def _getTestList():
suiteNames = ['OneNodeTests', 'MultiNodeTests', 'ModelMaturityTests', 'SwarmTerminatorTests']
testNames = []
for suite in suiteNames:
for f in dir(eval(suite)):
if f.startswith('test'):
testNames.append(('%s.%s' % (suite, f)))
return testName... |
null | null | null | How did each version format for console output ?
| def versions_report(include_salt_cloud=False):
ver_info = versions_information(include_salt_cloud)
lib_pad = max((len(name) for name in ver_info['Dependency Versions']))
sys_pad = max((len(name) for name in ver_info['System Versions']))
padding = (max(lib_pad, sys_pad) + 1)
fmt = '{0:>{pad}}: {1}'
info = []
f... | null | null | null | properly
| codeqa | def versions report include salt cloud False ver info versions information include salt cloud lib pad max len name for name in ver info[' Dependency Versions'] sys pad max len name for name in ver info[' System Versions'] padding max lib pad sys pad + 1 fmt '{ 0 >{pad}} {1 }'info []for ver type in ' Salt Version' ' Dep... | null | null | null | null | Question:
How did each version format for console output ?
Code:
def versions_report(include_salt_cloud=False):
ver_info = versions_information(include_salt_cloud)
lib_pad = max((len(name) for name in ver_info['Dependency Versions']))
sys_pad = max((len(name) for name in ver_info['System Versions']))
padding ... |
null | null | null | What does the code return ?
| def read(path):
f = open(path, 'rb')
try:
return f.read()
finally:
f.close()
| null | null | null | the contents of a text file
| codeqa | def read path f open path 'rb' try return f read finally f close
| null | null | null | null | Question:
What does the code return ?
Code:
def read(path):
f = open(path, 'rb')
try:
return f.read()
finally:
f.close()
|
null | null | null | What does the code create ?
| def new_figure_manager(num, *args, **kwargs):
FigureClass = kwargs.pop('FigureClass', Figure)
thisFig = FigureClass(*args, **kwargs)
canvas = FigureCanvasGTK(thisFig)
manager = FigureManagerGTK(canvas, num)
return manager
| null | null | null | a new figure manager instance
| codeqa | def new figure manager num *args **kwargs Figure Class kwargs pop ' Figure Class' Figure this Fig Figure Class *args **kwargs canvas Figure Canvas GTK this Fig manager Figure Manager GTK canvas num return manager
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager(num, *args, **kwargs):
FigureClass = kwargs.pop('FigureClass', Figure)
thisFig = FigureClass(*args, **kwargs)
canvas = FigureCanvasGTK(thisFig)
manager = FigureManagerGTK(canvas, num)
return manager
|
null | null | null | What does the code do ?
| def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, subprocess=True, sys=False, aggressive=True, Event=False, builtins=True, signal=True):
(_warnings, first_time) = _check_repatching(**locals())
if ((not _warnings) and (not first_time)):
return
if os:
patch... | null | null | null | all of the default monkey patching
| codeqa | def patch all socket True dns True time True select True thread True os True ssl True httplib False subprocess True sys False aggressive True Event False builtins True signal True warnings first time check repatching **locals if not warnings and not first time returnif os patch os if time patch time if thread patch thr... | null | null | null | null | Question:
What does the code do ?
Code:
def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, subprocess=True, sys=False, aggressive=True, Event=False, builtins=True, signal=True):
(_warnings, first_time) = _check_repatching(**locals())
if ((not _warnings) and... |
null | null | null | What does the code write ?
| def _chunk_write(chunk, local_file, progress):
local_file.write(chunk)
progress.update_with_increment_value(len(chunk))
| null | null | null | a chunk to file
| codeqa | def chunk write chunk local file progress local file write chunk progress update with increment value len chunk
| null | null | null | null | Question:
What does the code write ?
Code:
def _chunk_write(chunk, local_file, progress):
local_file.write(chunk)
progress.update_with_increment_value(len(chunk))
|
null | null | null | What does the code write to a stream ?
| def show_blob(repo, blob, decode, outstream=sys.stdout):
outstream.write(decode(blob.data))
| null | null | null | a blob
| codeqa | def show blob repo blob decode outstream sys stdout outstream write decode blob data
| null | null | null | null | Question:
What does the code write to a stream ?
Code:
def show_blob(repo, blob, decode, outstream=sys.stdout):
outstream.write(decode(blob.data))
|
null | null | null | What is doing database operations ?
| def transaction_retry(max_retries=1):
def _outer(fun):
@wraps(fun)
def _inner(*args, **kwargs):
_max_retries = kwargs.pop(u'exception_retry_count', max_retries)
for retries in count(0):
try:
return fun(*args, **kwargs)
except Exception:
if (retries >= _max_retries):
raise
try:
... | null | null | null | methods
| codeqa | def transaction retry max retries 1 def outer fun @wraps fun def inner *args **kwargs max retries kwargs pop u'exception retry count' max retries for retries in count 0 try return fun *args **kwargs except Exception if retries > max retries raisetry rollback unless managed except Exception passreturn innerreturn outer
| null | null | null | null | Question:
What is doing database operations ?
Code:
def transaction_retry(max_retries=1):
def _outer(fun):
@wraps(fun)
def _inner(*args, **kwargs):
_max_retries = kwargs.pop(u'exception_retry_count', max_retries)
for retries in count(0):
try:
return fun(*args, **kwargs)
except Exception:
... |
null | null | null | What do methods do ?
| def transaction_retry(max_retries=1):
def _outer(fun):
@wraps(fun)
def _inner(*args, **kwargs):
_max_retries = kwargs.pop(u'exception_retry_count', max_retries)
for retries in count(0):
try:
return fun(*args, **kwargs)
except Exception:
if (retries >= _max_retries):
raise
try:
... | null | null | null | database operations
| codeqa | def transaction retry max retries 1 def outer fun @wraps fun def inner *args **kwargs max retries kwargs pop u'exception retry count' max retries for retries in count 0 try return fun *args **kwargs except Exception if retries > max retries raisetry rollback unless managed except Exception passreturn innerreturn outer
| null | null | null | null | Question:
What do methods do ?
Code:
def transaction_retry(max_retries=1):
def _outer(fun):
@wraps(fun)
def _inner(*args, **kwargs):
_max_retries = kwargs.pop(u'exception_retry_count', max_retries)
for retries in count(0):
try:
return fun(*args, **kwargs)
except Exception:
if (retries >... |
null | null | null | Where is the code running ?
| def _in_gce_environment(urlopen=None):
if (SETTINGS.env_name is not None):
return (SETTINGS.env_name == 'GCE_PRODUCTION')
if ((NO_GCE_CHECK != 'True') and _detect_gce_environment(urlopen=urlopen)):
SETTINGS.env_name = 'GCE_PRODUCTION'
return True
return False
| null | null | null | in the compute engine environment
| codeqa | def in gce environment urlopen None if SETTINGS env name is not None return SETTINGS env name 'GCE PRODUCTION' if NO GCE CHECK ' True' and detect gce environment urlopen urlopen SETTINGS env name 'GCE PRODUCTION'return Truereturn False
| null | null | null | null | Question:
Where is the code running ?
Code:
def _in_gce_environment(urlopen=None):
if (SETTINGS.env_name is not None):
return (SETTINGS.env_name == 'GCE_PRODUCTION')
if ((NO_GCE_CHECK != 'True') and _detect_gce_environment(urlopen=urlopen)):
SETTINGS.env_name = 'GCE_PRODUCTION'
return True
return False
|
null | null | null | What does title containing a year split ?
| def split_title_year(title):
match = re.search(u'[\\s(]([12]\\d{3})\\)?$', title)
if match:
title = title[:match.start()].strip()
year = int(match.group(1))
else:
year = None
return (title, year)
| null | null | null | into a title
| codeqa | def split title year title match re search u'[\\s ] [12 ]\\d{ 3 } \\ ?$' title if match title title[ match start ] strip year int match group 1 else year Nonereturn title year
| null | null | null | null | Question:
What does title containing a year split ?
Code:
def split_title_year(title):
match = re.search(u'[\\s(]([12]\\d{3})\\)?$', title)
if match:
title = title[:match.start()].strip()
year = int(match.group(1))
else:
year = None
return (title, year)
|
null | null | null | What splits into a title ?
| def split_title_year(title):
match = re.search(u'[\\s(]([12]\\d{3})\\)?$', title)
if match:
title = title[:match.start()].strip()
year = int(match.group(1))
else:
year = None
return (title, year)
| null | null | null | title containing a year
| codeqa | def split title year title match re search u'[\\s ] [12 ]\\d{ 3 } \\ ?$' title if match title title[ match start ] strip year int match group 1 else year Nonereturn title year
| null | null | null | null | Question:
What splits into a title ?
Code:
def split_title_year(title):
match = re.search(u'[\\s(]([12]\\d{3})\\)?$', title)
if match:
title = title[:match.start()].strip()
year = int(match.group(1))
else:
year = None
return (title, year)
|
null | null | null | How does a string return ?
| def referenced(word, article=INDEFINITE, gender=MALE):
s = ('%s&space;%s' % (_article(word, article, gender), word))
s = s.replace("'&space;", "'")
s = s.replace('&space;', ' ')
return s
| null | null | null | with the article + the word
| codeqa | def referenced word article INDEFINITE gender MALE s '%s&space %s' % article word article gender word s s replace "'&space " "'" s s replace '&space ' '' return s
| null | null | null | null | Question:
How does a string return ?
Code:
def referenced(word, article=INDEFINITE, gender=MALE):
s = ('%s&space;%s' % (_article(word, article, gender), word))
s = s.replace("'&space;", "'")
s = s.replace('&space;', ' ')
return s
|
null | null | null | which organization view for inviting an unregistered user ?
| @must_be_valid_project
@must_have_permission(ADMIN)
@must_not_be_registration
def invite_contributor_post(node, **kwargs):
fullname = request.json.get('fullname').strip()
email = request.json.get('email')
fullname = sanitize.strip_html(fullname)
if email:
email = email.lower().strip()
try:
validate_email(ema... | null | null | null | api
| codeqa | @must be valid project@must have permission ADMIN @must not be registrationdef invite contributor post node **kwargs fullname request json get 'fullname' strip email request json get 'email' fullname sanitize strip html fullname if email email email lower strip try validate email email except Validation Error as e retu... | null | null | null | null | Question:
which organization view for inviting an unregistered user ?
Code:
@must_be_valid_project
@must_have_permission(ADMIN)
@must_not_be_registration
def invite_contributor_post(node, **kwargs):
fullname = request.json.get('fullname').strip()
email = request.json.get('email')
fullname = sanitize.strip_html(... |
null | null | null | What does the code call ?
| def upgrade(migrate_engine):
meta.bind = migrate_engine
t_images = _get_table('images', meta)
t_image_members = _get_table('image_members', meta)
t_image_properties = _get_table('image_properties', meta)
dialect = migrate_engine.url.get_dialect().name
if (dialect == 'sqlite'):
_upgrade_sqlite(t_images, t_image_... | null | null | null | the correct dialect - specific upgrade
| codeqa | def upgrade migrate engine meta bind migrate enginet images get table 'images' meta t image members get table 'image members' meta t image properties get table 'image properties' meta dialect migrate engine url get dialect nameif dialect 'sqlite' upgrade sqlite t images t image members t image properties update all ids... | null | null | null | null | Question:
What does the code call ?
Code:
def upgrade(migrate_engine):
meta.bind = migrate_engine
t_images = _get_table('images', meta)
t_image_members = _get_table('image_members', meta)
t_image_properties = _get_table('image_properties', meta)
dialect = migrate_engine.url.get_dialect().name
if (dialect == '... |
null | null | null | What does the code remove from connections ?
| def _removeReceiver(receiver):
if (not sendersBack):
return False
backKey = id(receiver)
try:
backSet = sendersBack.pop(backKey)
except KeyError as err:
return False
else:
for senderkey in backSet:
try:
signals = connections[senderkey].keys()
except KeyError as err:
pass
else:
for sign... | null | null | null | receiver
| codeqa | def remove Receiver receiver if not senders Back return Falseback Key id receiver try back Set senders Back pop back Key except Key Error as err return Falseelse for senderkey in back Set try signals connections[senderkey] keys except Key Error as err passelse for signal in signals try receivers connections[senderkey][... | null | null | null | null | Question:
What does the code remove from connections ?
Code:
def _removeReceiver(receiver):
if (not sendersBack):
return False
backKey = id(receiver)
try:
backSet = sendersBack.pop(backKey)
except KeyError as err:
return False
else:
for senderkey in backSet:
try:
signals = connections[senderkey]... |
null | null | null | What does the code create ?
| def create_bucket(bucket_name):
storage_client = storage.Client()
bucket = storage_client.create_bucket(bucket_name)
print 'Bucket {} created'.format(bucket.name)
| null | null | null | a new bucket
| codeqa | def create bucket bucket name storage client storage Client bucket storage client create bucket bucket name print ' Bucket{}created' format bucket name
| null | null | null | null | Question:
What does the code create ?
Code:
def create_bucket(bucket_name):
storage_client = storage.Client()
bucket = storage_client.create_bucket(bucket_name)
print 'Bucket {} created'.format(bucket.name)
|
null | null | null | Where did binary number write ?
| def bin2long(text, endian):
assert (endian in (LITTLE_ENDIAN, BIG_ENDIAN))
bits = [(ord(character) - ord('0')) for character in text if (character in '01')]
if (endian is not BIG_ENDIAN):
bits = bits[::(-1)]
size = len(bits)
assert (0 < size)
value = 0
for bit in bits:
value *= 2
value += bit
return value... | null | null | null | in a string
| codeqa | def bin 2 long text endian assert endian in LITTLE ENDIAN BIG ENDIAN bits [ ord character - ord '0 ' for character in text if character in '01 ' ]if endian is not BIG ENDIAN bits bits[ -1 ]size len bits assert 0 < size value 0for bit in bits value * 2value + bitreturn value
| null | null | null | null | Question:
Where did binary number write ?
Code:
def bin2long(text, endian):
assert (endian in (LITTLE_ENDIAN, BIG_ENDIAN))
bits = [(ord(character) - ord('0')) for character in text if (character in '01')]
if (endian is not BIG_ENDIAN):
bits = bits[::(-1)]
size = len(bits)
assert (0 < size)
value = 0
for bi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.