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 remove from the dictionary in the value ?
| def removeTrueFromDictionary(dictionary, key):
if (key in dictionary):
if getBooleanFromValue(dictionary[key]):
del dictionary[key]
| null | null | null | key
| codeqa | def remove True From Dictionary dictionary key if key in dictionary if get Boolean From Value dictionary[key] del dictionary[key]
| null | null | null | null | Question:
What does the code remove from the dictionary in the value ?
Code:
def removeTrueFromDictionary(dictionary, key):
if (key in dictionary):
if getBooleanFromValue(dictionary[key]):
del dictionary[key]
|
null | null | null | How does the code remove key from the dictionary ?
| def removeTrueFromDictionary(dictionary, key):
if (key in dictionary):
if getBooleanFromValue(dictionary[key]):
del dictionary[key]
| null | null | null | in the value
| codeqa | def remove True From Dictionary dictionary key if key in dictionary if get Boolean From Value dictionary[key] del dictionary[key]
| null | null | null | null | Question:
How does the code remove key from the dictionary ?
Code:
def removeTrueFromDictionary(dictionary, key):
if (key in dictionary):
if getBooleanFromValue(dictionary[key]):
del dictionary[key]
|
null | null | null | Where does the code run a command ?
| @task
def sudo(command, show=True, *args, **kwargs):
if show:
print_command(command)
with hide(u'running'):
return _sudo(command, *args, **kwargs)
| null | null | null | on the remote server
| codeqa | @taskdef sudo command show True *args **kwargs if show print command command with hide u'running' return sudo command *args **kwargs
| null | null | null | null | Question:
Where does the code run a command ?
Code:
@task
def sudo(command, show=True, *args, **kwargs):
if show:
print_command(command)
with hide(u'running'):
return _sudo(command, *args, **kwargs)
|
null | null | null | What does the code run on the remote server ?
| @task
def sudo(command, show=True, *args, **kwargs):
if show:
print_command(command)
with hide(u'running'):
return _sudo(command, *args, **kwargs)
| null | null | null | a command
| codeqa | @taskdef sudo command show True *args **kwargs if show print command command with hide u'running' return sudo command *args **kwargs
| null | null | null | null | Question:
What does the code run on the remote server ?
Code:
@task
def sudo(command, show=True, *args, **kwargs):
if show:
print_command(command)
with hide(u'running'):
return _sudo(command, *args, **kwargs)
|
null | null | null | What does the code process ?
| def inputhook(context):
signal.signal(signal.SIGINT, glut_int_handler)
try:
t = clock()
if (glut.glutGetWindow() == 0):
glut.glutSetWindow(1)
glutMainLoopEvent()
return 0
while (not context.input_is_ready()):
glutMainLoopEvent()
used_time = (clock() - t)
if (used_time > 10.0):
time.sleep(1... | null | null | null | pending events only
| codeqa | def inputhook context signal signal signal SIGINT glut int handler try t clock if glut glut Get Window 0 glut glut Set Window 1 glut Main Loop Event return 0while not context input is ready glut Main Loop Event used time clock - t if used time > 10 0 time sleep 1 0 elif used time > 0 1 time sleep 0 05 else time sleep 0... | null | null | null | null | Question:
What does the code process ?
Code:
def inputhook(context):
signal.signal(signal.SIGINT, glut_int_handler)
try:
t = clock()
if (glut.glutGetWindow() == 0):
glut.glutSetWindow(1)
glutMainLoopEvent()
return 0
while (not context.input_is_ready()):
glutMainLoopEvent()
used_time = (clock(... |
null | null | null | What does the code select ?
| def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "type": %s') % s_type)
LOG.warn(msg)
conti... | null | null | null | an endpoint from the service catalog
| codeqa | def get endpoint service catalog service type 'image' endpoint region None endpoint type 'public URL' endpoint Nonefor service in service catalog s type Nonetry s type service['type']except Key Error msg ' Encounteredservicewithno"type" %s' % s type LOG warn msg continueif s type service type for ep in service['endpoin... | null | null | null | null | Question:
What does the code select ?
Code:
def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "... |
null | null | null | What do services match ?
| def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "type": %s') % s_type)
LOG.warn(msg)
conti... | null | null | null | both type and region
| codeqa | def get endpoint service catalog service type 'image' endpoint region None endpoint type 'public URL' endpoint Nonefor service in service catalog s type Nonetry s type service['type']except Key Error msg ' Encounteredservicewithno"type" %s' % s type LOG warn msg continueif s type service type for ep in service['endpoin... | null | null | null | null | Question:
What do services match ?
Code:
def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "typ... |
null | null | null | What do we search ?
| def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "type": %s') % s_type)
LOG.warn(msg)
conti... | null | null | null | the full service catalog for services matching both type and region
| codeqa | def get endpoint service catalog service type 'image' endpoint region None endpoint type 'public URL' endpoint Nonefor service in service catalog s type Nonetry s type service['type']except Key Error msg ' Encounteredservicewithno"type" %s' % s type LOG warn msg continueif s type service type for ep in service['endpoin... | null | null | null | null | Question:
What do we search ?
Code:
def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "type": ... |
null | null | null | What is matching both type and region ?
| def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service with no "type": %s') % s_type)
LOG.warn(msg)
conti... | null | null | null | services
| codeqa | def get endpoint service catalog service type 'image' endpoint region None endpoint type 'public URL' endpoint Nonefor service in service catalog s type Nonetry s type service['type']except Key Error msg ' Encounteredservicewithno"type" %s' % s type LOG warn msg continueif s type service type for ep in service['endpoin... | null | null | null | null | Question:
What is matching both type and region ?
Code:
def get_endpoint(service_catalog, service_type='image', endpoint_region=None, endpoint_type='publicURL'):
endpoint = None
for service in service_catalog:
s_type = None
try:
s_type = service['type']
except KeyError:
msg = (_('Encountered service ... |
null | null | null | How do memory usage return ?
| def memory(since=0.0):
if ACTUALLY_MEASURE_MEMORY:
return (_VmB('VmSize:') - since)
| null | null | null | in bytes
| codeqa | def memory since 0 0 if ACTUALLY MEASURE MEMORY return Vm B ' Vm Size ' - since
| null | null | null | null | Question:
How do memory usage return ?
Code:
def memory(since=0.0):
if ACTUALLY_MEASURE_MEMORY:
return (_VmB('VmSize:') - since)
|
null | null | null | When is an error raised ?
| def test_cc_fit_invalid_ratio():
ratio = (1.0 / 10000.0)
cc = ClusterCentroids(ratio=ratio, random_state=RND_SEED)
assert_raises(RuntimeError, cc.fit, X, Y)
| null | null | null | when the balancing ratio to fit is smaller than the one of the data
| codeqa | def test cc fit invalid ratio ratio 1 0 / 10000 0 cc Cluster Centroids ratio ratio random state RND SEED assert raises Runtime Error cc fit X Y
| null | null | null | null | Question:
When is an error raised ?
Code:
def test_cc_fit_invalid_ratio():
ratio = (1.0 / 10000.0)
cc = ClusterCentroids(ratio=ratio, random_state=RND_SEED)
assert_raises(RuntimeError, cc.fit, X, Y)
|
null | null | null | What does the code remove ?
| def group_type_access_remove(context, type_id, project_id):
return IMPL.group_type_access_remove(context, type_id, project_id)
| null | null | null | group type access for project
| codeqa | def group type access remove context type id project id return IMPL group type access remove context type id project id
| null | null | null | null | Question:
What does the code remove ?
Code:
def group_type_access_remove(context, type_id, project_id):
return IMPL.group_type_access_remove(context, type_id, project_id)
|
null | null | null | When do occurrences overlap ?
| def sub(pattern, repl, string, count=0):
return _compile(pattern, 0).sub(repl, string, count)
| null | null | null | non
| codeqa | def sub pattern repl string count 0 return compile pattern 0 sub repl string count
| null | null | null | null | Question:
When do occurrences overlap ?
Code:
def sub(pattern, repl, string, count=0):
return _compile(pattern, 0).sub(repl, string, count)
|
null | null | null | What escapes the given string ?
| def escape(str):
return commands.mkarg(str)[1:]
| null | null | null | shell
| codeqa | def escape str return commands mkarg str [1 ]
| null | null | null | null | Question:
What escapes the given string ?
Code:
def escape(str):
return commands.mkarg(str)[1:]
|
null | null | null | What do shell escape ?
| def escape(str):
return commands.mkarg(str)[1:]
| null | null | null | the given string
| codeqa | def escape str return commands mkarg str [1 ]
| null | null | null | null | Question:
What do shell escape ?
Code:
def escape(str):
return commands.mkarg(str)[1:]
|
null | null | null | How do into applicable_aside_types patch ?
| def null_applicable_aside_types(block):
return []
| null | null | null | monkey
| codeqa | def null applicable aside types block return []
| null | null | null | null | Question:
How do into applicable_aside_types patch ?
Code:
def null_applicable_aside_types(block):
return []
|
null | null | null | What did the user store ?
| def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: %(users_quota)s') % {'users_quota': users_quota}))
ra... | null | null | null | an image
| codeqa | def get remaining quota context db api image id None users quota CONF user storage quotapattern re compile '^ \\d+ K M G T ?B ?$' match pattern match users quota if not match LOG error LE ' Invalidvalueforoptionuser storage quota % users quota s' % {'users quota' users quota} raise exception Invalid Option Value option... | null | null | null | null | Question:
What did the user store ?
Code:
def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: %(users_q... |
null | null | null | For what purpose did method call ?
| def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: %(users_quota)s') % {'users_quota': users_quota}))
ra... | null | null | null | to see if the user is allowed to store an image
| codeqa | def get remaining quota context db api image id None users quota CONF user storage quotapattern re compile '^ \\d+ K M G T ?B ?$' match pattern match users quota if not match LOG error LE ' Invalidvalueforoptionuser storage quota % users quota s' % {'users quota' users quota} raise exception Invalid Option Value option... | null | null | null | null | Question:
For what purpose did method call ?
Code:
def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: ... |
null | null | null | What stores an image ?
| def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: %(users_quota)s') % {'users_quota': users_quota}))
ra... | null | null | null | the user
| codeqa | def get remaining quota context db api image id None users quota CONF user storage quotapattern re compile '^ \\d+ K M G T ?B ?$' match pattern match users quota if not match LOG error LE ' Invalidvalueforoptionuser storage quota % users quota s' % {'users quota' users quota} raise exception Invalid Option Value option... | null | null | null | null | Question:
What stores an image ?
Code:
def get_remaining_quota(context, db_api, image_id=None):
users_quota = CONF.user_storage_quota
pattern = re.compile('^(\\d+)((K|M|G|T)?B)?$')
match = pattern.match(users_quota)
if (not match):
LOG.error((_LE('Invalid value for option user_storage_quota: %(users_quot... |
null | null | null | What does the groups of digits found in our candidate phone number match ?
| def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
else:
candidate_number_group_index = (len(candidat... | null | null | null | our expectations
| codeqa | def all number groups are exactly present numobj normalized candidate formatted number groups candidate groups re split NON DIGITS PATTERN normalized candidate if numobj extension is not None candidate number group index len candidate groups - 2 else candidate number group index len candidate groups - 1 if len candidat... | null | null | null | null | Question:
What does the groups of digits found in our candidate phone number match ?
Code:
def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_... |
null | null | null | What found the in our candidate phone number ?
| def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
else:
candidate_number_group_index = (len(candidat... | null | null | null | the
| codeqa | def all number groups are exactly present numobj normalized candidate formatted number groups candidate groups re split NON DIGITS PATTERN normalized candidate if numobj extension is not None candidate number group index len candidate groups - 2 else candidate number group index len candidate groups - 1 if len candidat... | null | null | null | null | Question:
What found the in our candidate phone number ?
Code:
def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate... |
null | null | null | What match our expectations ?
| def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
else:
candidate_number_group_index = (len(candidat... | null | null | null | the groups of digits found in our candidate phone number
| codeqa | def all number groups are exactly present numobj normalized candidate formatted number groups candidate groups re split NON DIGITS PATTERN normalized candidate if numobj extension is not None candidate number group index len candidate groups - 2 else candidate number group index len candidate groups - 1 if len candidat... | null | null | null | null | Question:
What match our expectations ?
Code:
def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
el... |
null | null | null | Where did the find the ?
| def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
else:
candidate_number_group_index = (len(candidat... | null | null | null | in our candidate phone number
| codeqa | def all number groups are exactly present numobj normalized candidate formatted number groups candidate groups re split NON DIGITS PATTERN normalized candidate if numobj extension is not None candidate number group index len candidate groups - 2 else candidate number group index len candidate groups - 1 if len candidat... | null | null | null | null | Question:
Where did the find the ?
Code:
def _all_number_groups_are_exactly_present(numobj, normalized_candidate, formatted_number_groups):
candidate_groups = re.split(NON_DIGITS_PATTERN, normalized_candidate)
if (numobj.extension is not None):
candidate_number_group_index = (len(candidate_groups) - 2)
else:
... |
null | null | null | What does the code add to the staging area ?
| def add(repo='.', paths=None):
with open_repo_closing(repo) as r:
if (not paths):
paths = []
for (dirpath, dirnames, filenames) in os.walk(r.path):
if ('.git' in dirnames):
dirnames.remove('.git')
for filename in filenames:
paths.append(os.path.join(dirpath[(len(r.path) + 1):], filename))
r... | null | null | null | files
| codeqa | def add repo ' ' paths None with open repo closing repo as r if not paths paths []for dirpath dirnames filenames in os walk r path if ' git' in dirnames dirnames remove ' git' for filename in filenames paths append os path join dirpath[ len r path + 1 ] filename r stage paths
| null | null | null | null | Question:
What does the code add to the staging area ?
Code:
def add(repo='.', paths=None):
with open_repo_closing(repo) as r:
if (not paths):
paths = []
for (dirpath, dirnames, filenames) in os.walk(r.path):
if ('.git' in dirnames):
dirnames.remove('.git')
for filename in filenames:
path... |
null | null | null | What does the code save ?
| @should_profile_cpu
def stop_cpu_profiling():
cancel_thread(SAVE_THREAD_PTR)
dump_data()
| null | null | null | profiling information
| codeqa | @should profile cpudef stop cpu profiling cancel thread SAVE THREAD PTR dump data
| null | null | null | null | Question:
What does the code save ?
Code:
@should_profile_cpu
def stop_cpu_profiling():
cancel_thread(SAVE_THREAD_PTR)
dump_data()
|
null | null | null | What does the code retrieve from an app_name / model_name combo ?
| def get_model_from_url_params(app_name, model_name):
model = registry.get_by_natural_key(app_name, model_name)
if (model is None):
raise Http404
return model
| null | null | null | a content type
| codeqa | def get model from url params app name model name model registry get by natural key app name model name if model is None raise Http 404 return model
| null | null | null | null | Question:
What does the code retrieve from an app_name / model_name combo ?
Code:
def get_model_from_url_params(app_name, model_name):
model = registry.get_by_natural_key(app_name, model_name)
if (model is None):
raise Http404
return model
|
null | null | null | What does context manager copy to the destination ?
| @contextmanager
def copy_file(source, dest, overwrite=False):
source = os.path.join(settings.ROOT, source)
dest = os.path.join(settings.ROOT, dest)
if (not overwrite):
assert (not os.path.exists(dest))
if (not os.path.exists(os.path.dirname(dest))):
os.makedirs(os.path.dirname(dest))
shutil.copyfile(source, de... | null | null | null | the source file
| codeqa | @contextmanagerdef copy file source dest overwrite False source os path join settings ROOT source dest os path join settings ROOT dest if not overwrite assert not os path exists dest if not os path exists os path dirname dest os makedirs os path dirname dest shutil copyfile source dest yield if os path exists dest os u... | null | null | null | null | Question:
What does context manager copy to the destination ?
Code:
@contextmanager
def copy_file(source, dest, overwrite=False):
source = os.path.join(settings.ROOT, source)
dest = os.path.join(settings.ROOT, dest)
if (not overwrite):
assert (not os.path.exists(dest))
if (not os.path.exists(os.path.dirname(d... |
null | null | null | What copies the source file to the destination ?
| @contextmanager
def copy_file(source, dest, overwrite=False):
source = os.path.join(settings.ROOT, source)
dest = os.path.join(settings.ROOT, dest)
if (not overwrite):
assert (not os.path.exists(dest))
if (not os.path.exists(os.path.dirname(dest))):
os.makedirs(os.path.dirname(dest))
shutil.copyfile(source, de... | null | null | null | context manager
| codeqa | @contextmanagerdef copy file source dest overwrite False source os path join settings ROOT source dest os path join settings ROOT dest if not overwrite assert not os path exists dest if not os path exists os path dirname dest os makedirs os path dirname dest shutil copyfile source dest yield if os path exists dest os u... | null | null | null | null | Question:
What copies the source file to the destination ?
Code:
@contextmanager
def copy_file(source, dest, overwrite=False):
source = os.path.join(settings.ROOT, source)
dest = os.path.join(settings.ROOT, dest)
if (not overwrite):
assert (not os.path.exists(dest))
if (not os.path.exists(os.path.dirname(dest... |
null | null | null | What can we stop ?
| def isFinalResult(result):
logger.log((u"Checking if we should keep searching after we've found " + result.name), logger.DEBUG)
show_obj = result.episodes[0].show
(any_qualities, best_qualities) = Quality.splitQuality(show_obj.quality)
if (best_qualities and (result.quality < max(best_qualities))):
retur... | null | null | null | searching for other ones
| codeqa | def is Final Result result logger log u" Checkingifweshouldkeepsearchingafterwe'vefound" + result name logger DEBUG show obj result episodes[ 0 ] show any qualities best qualities Quality split Quality show obj quality if best qualities and result quality < max best qualities return Falseelif any qualities and result q... | null | null | null | null | Question:
What can we stop ?
Code:
def isFinalResult(result):
logger.log((u"Checking if we should keep searching after we've found " + result.name), logger.DEBUG)
show_obj = result.episodes[0].show
(any_qualities, best_qualities) = Quality.splitQuality(show_obj.quality)
if (best_qualities and (result.q... |
null | null | null | How does a list of all subdirectories in the test suite build ?
| def getSubDirectories(testdir):
subdirs = [os.path.join(testdir, d) for d in filter(os.path.isdir, [os.path.join(testdir, dd) for dd in os.listdir(testdir)])]
for d in copy(subdirs):
subdirs.extend(getSubDirectories(os.path.join(testdir, d)))
return subdirs
| null | null | null | recursively
| codeqa | def get Sub Directories testdir subdirs [os path join testdir d for d in filter os path isdir [os path join testdir dd for dd in os listdir testdir ] ]for d in copy subdirs subdirs extend get Sub Directories os path join testdir d return subdirs
| null | null | null | null | Question:
How does a list of all subdirectories in the test suite build ?
Code:
def getSubDirectories(testdir):
subdirs = [os.path.join(testdir, d) for d in filter(os.path.isdir, [os.path.join(testdir, dd) for dd in os.listdir(testdir)])]
for d in copy(subdirs):
subdirs.extend(getSubDirectories(os.path.join(tes... |
null | null | null | What returns over a series of lists of length size from iterable ?
| def group(seq, size):
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
(yield [seq.next() for i in xrange(size)])
| null | null | null | an iterator
| codeqa | def group seq size if not hasattr seq 'next' seq iter seq while True yield [seq next for i in xrange size ]
| null | null | null | null | Question:
What returns over a series of lists of length size from iterable ?
Code:
def group(seq, size):
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
(yield [seq.next() for i in xrange(size)])
|
null | null | null | Where does an iterator return ?
| def group(seq, size):
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
(yield [seq.next() for i in xrange(size)])
| null | null | null | over a series of lists of length size from iterable
| codeqa | def group seq size if not hasattr seq 'next' seq iter seq while True yield [seq next for i in xrange size ]
| null | null | null | null | Question:
Where does an iterator return ?
Code:
def group(seq, size):
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
(yield [seq.next() for i in xrange(size)])
|
null | null | null | What does the code add to positives ?
| def addPositives(derivation, paths, positives):
portionDirections = getSpacedPortionDirections(derivation.interpolationDictionary)
for path in paths:
loopLists = getLoopListsByPath(derivation, None, path, portionDirections)
geometryOutput = triangle_mesh.getPillarsOutput(loopLists)
positives.append(geometryOutp... | null | null | null | pillars output
| codeqa | def add Positives derivation paths positives portion Directions get Spaced Portion Directions derivation interpolation Dictionary for path in paths loop Lists get Loop Lists By Path derivation None path portion Directions geometry Output triangle mesh get Pillars Output loop Lists positives append geometry Output
| null | null | null | null | Question:
What does the code add to positives ?
Code:
def addPositives(derivation, paths, positives):
portionDirections = getSpacedPortionDirections(derivation.interpolationDictionary)
for path in paths:
loopLists = getLoopListsByPath(derivation, None, path, portionDirections)
geometryOutput = triangle_mesh.g... |
null | null | null | How does a string parse as a float ?
| def atof(string, func=float):
return func(delocalize(string))
| null | null | null | according to the locale settings
| codeqa | def atof string func float return func delocalize string
| null | null | null | null | Question:
How does a string parse as a float ?
Code:
def atof(string, func=float):
return func(delocalize(string))
|
null | null | null | What does the code read ?
| def read_images(path, image_size=None):
c = 0
X = []
y = []
folder_names = []
for (dirname, dirnames, filenames) in os.walk(path):
for subdirname in dirnames:
folder_names.append(subdirname)
subject_path = os.path.join(dirname, subdirname)
for filename in os.listdir(subject_path):
try:
im = cv2... | null | null | null | the images in a given folder
| codeqa | def read images path image size None c 0X []y []folder names []for dirname dirnames filenames in os walk path for subdirname in dirnames folder names append subdirname subject path os path join dirname subdirname for filename in os listdir subject path try im cv 2 imread os path join subject path filename cv 2 IMREAD G... | null | null | null | null | Question:
What does the code read ?
Code:
def read_images(path, image_size=None):
c = 0
X = []
y = []
folder_names = []
for (dirname, dirnames, filenames) in os.walk(path):
for subdirname in dirnames:
folder_names.append(subdirname)
subject_path = os.path.join(dirname, subdirname)
for filename in os... |
null | null | null | What generates in a paginated list ?
| @register.simple_tag
def paginator_number(cl, i):
if (i == DOT):
return u'... '
elif (i == cl.page_num):
return format_html(u'<span class="this-page">{0}</span> ', (i + 1))
else:
return format_html(u'<a href="{0}"{1}>{2}</a> ', cl.get_query_string({PAGE_VAR: i}), mark_safe((u' class="end"' if (i == (cl.p... | null | null | null | an individual page index link
| codeqa | @register simple tagdef paginator number cl i if i DOT return u' 'elif i cl page num return format html u'<spanclass "this-page">{ 0 }</span>' i + 1 else return format html u'<ahref "{ 0 }"{ 1 }>{ 2 }</a>' cl get query string {PAGE VAR i} mark safe u'class "end"' if i cl paginator num pages - 1 else u'' i + 1
| null | null | null | null | Question:
What generates in a paginated list ?
Code:
@register.simple_tag
def paginator_number(cl, i):
if (i == DOT):
return u'... '
elif (i == cl.page_num):
return format_html(u'<span class="this-page">{0}</span> ', (i + 1))
else:
return format_html(u'<a href="{0}"{1}>{2}</a> ', cl.get_query_string({... |
null | null | null | Where does an individual page index link generate ?
| @register.simple_tag
def paginator_number(cl, i):
if (i == DOT):
return u'... '
elif (i == cl.page_num):
return format_html(u'<span class="this-page">{0}</span> ', (i + 1))
else:
return format_html(u'<a href="{0}"{1}>{2}</a> ', cl.get_query_string({PAGE_VAR: i}), mark_safe((u' class="end"' if (i == (cl.p... | null | null | null | in a paginated list
| codeqa | @register simple tagdef paginator number cl i if i DOT return u' 'elif i cl page num return format html u'<spanclass "this-page">{ 0 }</span>' i + 1 else return format html u'<ahref "{ 0 }"{ 1 }>{ 2 }</a>' cl get query string {PAGE VAR i} mark safe u'class "end"' if i cl paginator num pages - 1 else u'' i + 1
| null | null | null | null | Question:
Where does an individual page index link generate ?
Code:
@register.simple_tag
def paginator_number(cl, i):
if (i == DOT):
return u'... '
elif (i == cl.page_num):
return format_html(u'<span class="this-page">{0}</span> ', (i + 1))
else:
return format_html(u'<a href="{0}"{1}>{2}</a> ', cl.get... |
null | null | null | What did the code build ?
| def build_desired_iface_config(module):
module.custom_desired_config = {'addr_family': None, 'auto': True, 'config': {}, 'name': module.params.get('name')}
for _attr in ['slaves', 'mode', 'xmit_hash_policy', 'miimon', 'lacp_rate', 'lacp_bypass_allow', 'lacp_bypass_period', 'lacp_bypass_all_active', 'min_links']:
bu... | null | null | null | ifupdown2 compatible hash
| codeqa | def build desired iface config module module custom desired config {'addr family' None 'auto' True 'config' {} 'name' module params get 'name' }for attr in ['slaves' 'mode' 'xmit hash policy' 'miimon' 'lacp rate' 'lacp bypass allow' 'lacp bypass period' 'lacp bypass all active' 'min links'] build bond attr module attr ... | null | null | null | null | Question:
What did the code build ?
Code:
def build_desired_iface_config(module):
module.custom_desired_config = {'addr_family': None, 'auto': True, 'config': {}, 'name': module.params.get('name')}
for _attr in ['slaves', 'mode', 'xmit_hash_policy', 'miimon', 'lacp_rate', 'lacp_bypass_allow', 'lacp_bypass_period'... |
null | null | null | What does the code take ?
| def build_desired_iface_config(module):
module.custom_desired_config = {'addr_family': None, 'auto': True, 'config': {}, 'name': module.params.get('name')}
for _attr in ['slaves', 'mode', 'xmit_hash_policy', 'miimon', 'lacp_rate', 'lacp_bypass_allow', 'lacp_bypass_period', 'lacp_bypass_all_active', 'min_links']:
bu... | null | null | null | parameters defined
| codeqa | def build desired iface config module module custom desired config {'addr family' None 'auto' True 'config' {} 'name' module params get 'name' }for attr in ['slaves' 'mode' 'xmit hash policy' 'miimon' 'lacp rate' 'lacp bypass allow' 'lacp bypass period' 'lacp bypass all active' 'min links'] build bond attr module attr ... | null | null | null | null | Question:
What does the code take ?
Code:
def build_desired_iface_config(module):
module.custom_desired_config = {'addr_family': None, 'auto': True, 'config': {}, 'name': module.params.get('name')}
for _attr in ['slaves', 'mode', 'xmit_hash_policy', 'miimon', 'lacp_rate', 'lacp_bypass_allow', 'lacp_bypass_period'... |
null | null | null | What does the code populate ?
| @register.tag
def get_media_prefix(parser, token):
return PrefixNode.handle_token(parser, token, 'MEDIA_URL')
| null | null | null | a template variable with the static prefix
| codeqa | @register tagdef get media prefix parser token return Prefix Node handle token parser token 'MEDIA URL'
| null | null | null | null | Question:
What does the code populate ?
Code:
@register.tag
def get_media_prefix(parser, token):
return PrefixNode.handle_token(parser, token, 'MEDIA_URL')
|
null | null | null | How does keys remove from a list or dict ?
| def recursively_remove_key(obj, key_to_remove):
if isinstance(obj, list):
for item in obj:
recursively_remove_key(item, key_to_remove)
elif isinstance(obj, dict):
if (key_to_remove in obj):
del obj[key_to_remove]
for (key, unused_value) in obj.items():
recursively_remove_key(obj[key], key_to_remove)
| null | null | null | recursively
| codeqa | def recursively remove key obj key to remove if isinstance obj list for item in obj recursively remove key item key to remove elif isinstance obj dict if key to remove in obj del obj[key to remove]for key unused value in obj items recursively remove key obj[key] key to remove
| null | null | null | null | Question:
How does keys remove from a list or dict ?
Code:
def recursively_remove_key(obj, key_to_remove):
if isinstance(obj, list):
for item in obj:
recursively_remove_key(item, key_to_remove)
elif isinstance(obj, dict):
if (key_to_remove in obj):
del obj[key_to_remove]
for (key, unused_value) in obj... |
null | null | null | What does the code write ?
| def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
set_ca_path(cacert_path)
ca_dir = '{0}/{1}'.format(cert_base_path(), ca_name)
(index_file, expire_date, serial_number, subject) = _get_basic_info(ca_name, cert, ca_dir)
index_data = '{0} DCTB {1} DCTB DCTB {2} DCTB unknown DCTB {3}'.format(st... | null | null | null | the index
| codeqa | def write cert to database ca name cert cacert path None status 'V' set ca path cacert path ca dir '{ 0 }/{ 1 }' format cert base path ca name index file expire date serial number subject get basic info ca name cert ca dir index data '{ 0 } DCTB {1 } DCTB DCTB {2 } DCTB unknown DCTB {3 }' format status expire date seri... | null | null | null | null | Question:
What does the code write ?
Code:
def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
set_ca_path(cacert_path)
ca_dir = '{0}/{1}'.format(cert_base_path(), ca_name)
(index_file, expire_date, serial_number, subject) = _get_basic_info(ca_name, cert, ca_dir)
index_data = '{0} DCTB {1}... |
null | null | null | How did the storage manager choose ?
| def load(configuration, logger):
storage_type = configuration.get('storage', 'type')
if (storage_type == 'multifilesystem'):
collection_class = Collection
else:
collection_class = import_module(storage_type).Collection
class CollectionCopy(collection_class, ):
'Collection copy, avoids overriding the orig... | null | null | null | in configuration
| codeqa | def load configuration logger storage type configuration get 'storage' 'type' if storage type 'multifilesystem' collection class Collectionelse collection class import module storage type Collectionclass Collection Copy collection class ' Collectioncopy avoidsoverridingtheoriginalclassattributes ' Collection Copy confi... | null | null | null | null | Question:
How did the storage manager choose ?
Code:
def load(configuration, logger):
storage_type = configuration.get('storage', 'type')
if (storage_type == 'multifilesystem'):
collection_class = Collection
else:
collection_class = import_module(storage_type).Collection
class CollectionCopy(collection_clas... |
null | null | null | Till when should it be not changed ?
| def host_pointer(obj):
if isinstance(obj, (int, long)):
return obj
forcewritable = isinstance(obj, np.void)
return mviewbuf.memoryview_get_buffer(obj, forcewritable)
| null | null | null | until the operation which can be asynchronous completes
| codeqa | def host pointer obj if isinstance obj int long return objforcewritable isinstance obj np void return mviewbuf memoryview get buffer obj forcewritable
| null | null | null | null | Question:
Till when should it be not changed ?
Code:
def host_pointer(obj):
if isinstance(obj, (int, long)):
return obj
forcewritable = isinstance(obj, np.void)
return mviewbuf.memoryview_get_buffer(obj, forcewritable)
|
null | null | null | What does the code remove from a text or byte string ?
| def strip_whitespace(s):
if isinstance(s, str):
return b(''.join(s.split()))
else:
return b('').join(s.split())
| null | null | null | whitespace
| codeqa | def strip whitespace s if isinstance s str return b '' join s split else return b '' join s split
| null | null | null | null | Question:
What does the code remove from a text or byte string ?
Code:
def strip_whitespace(s):
if isinstance(s, str):
return b(''.join(s.split()))
else:
return b('').join(s.split())
|
null | null | null | How do a missing indexer convert ?
| def convert_missing_indexer(indexer):
if isinstance(indexer, dict):
indexer = indexer['key']
if isinstance(indexer, bool):
raise KeyError('cannot use a single bool to index into setitem')
return (indexer, True)
return (indexer, False)
| null | null | null | reverse
| codeqa | def convert missing indexer indexer if isinstance indexer dict indexer indexer['key']if isinstance indexer bool raise Key Error 'cannotuseasinglebooltoindexintosetitem' return indexer True return indexer False
| null | null | null | null | Question:
How do a missing indexer convert ?
Code:
def convert_missing_indexer(indexer):
if isinstance(indexer, dict):
indexer = indexer['key']
if isinstance(indexer, bool):
raise KeyError('cannot use a single bool to index into setitem')
return (indexer, True)
return (indexer, False)
|
null | null | null | What does the code detach from an instance ?
| def detach_volume(name=None, kwargs=None, instance_id=None, call=None):
if (call != 'action'):
raise SaltCloudSystemExit('The detach_volume action must be called with -a or --action.')
if (not kwargs):
kwargs = {}
if ('volume_id' not in kwargs):
log.error('A volume_id is required.')
return False
... | null | null | null | a volume
| codeqa | def detach volume name None kwargs None instance id None call None if call 'action' raise Salt Cloud System Exit ' Thedetach volumeactionmustbecalledwith-aor--action ' if not kwargs kwargs {}if 'volume id' not in kwargs log error ' Avolume idisrequired ' return Falseparams {' Action' ' Detach Volume' ' Volume Id' kwarg... | null | null | null | null | Question:
What does the code detach from an instance ?
Code:
def detach_volume(name=None, kwargs=None, instance_id=None, call=None):
if (call != 'action'):
raise SaltCloudSystemExit('The detach_volume action must be called with -a or --action.')
if (not kwargs):
kwargs = {}
if ('volume_id' not in kw... |
null | null | null | How do the dataset save to disk ?
| def shutdown(host=None, port=None, db=None, password=None):
server = _connect(host, port, db, password)
try:
server.ping()
except redis.ConnectionError:
return False
server.shutdown()
try:
server.ping()
except redis.ConnectionError:
return True
return False
| null | null | null | synchronously
| codeqa | def shutdown host None port None db None password None server connect host port db password try server ping except redis Connection Error return Falseserver shutdown try server ping except redis Connection Error return Truereturn False
| null | null | null | null | Question:
How do the dataset save to disk ?
Code:
def shutdown(host=None, port=None, db=None, password=None):
server = _connect(host, port, db, password)
try:
server.ping()
except redis.ConnectionError:
return False
server.shutdown()
try:
server.ping()
except redis.ConnectionError:
return True
return... |
null | null | null | How do the server shut then ?
| def shutdown(host=None, port=None, db=None, password=None):
server = _connect(host, port, db, password)
try:
server.ping()
except redis.ConnectionError:
return False
server.shutdown()
try:
server.ping()
except redis.ConnectionError:
return True
return False
| null | null | null | synchronously
| codeqa | def shutdown host None port None db None password None server connect host port db password try server ping except redis Connection Error return Falseserver shutdown try server ping except redis Connection Error return Truereturn False
| null | null | null | null | Question:
How do the server shut then ?
Code:
def shutdown(host=None, port=None, db=None, password=None):
server = _connect(host, port, db, password)
try:
server.ping()
except redis.ConnectionError:
return False
server.shutdown()
try:
server.ping()
except redis.ConnectionError:
return True
return Fal... |
null | null | null | What does the code get ?
| def getLoopLayers(archivableObjects, importRadius, layerThickness, maximumZ, shouldPrintWarning, z, zoneArrangement):
loopLayers = []
while (z <= maximumZ):
triangle_mesh.getLoopLayerAppend(loopLayers, z).loops = getEmptyZLoops(archivableObjects, importRadius, True, z, zoneArrangement)
z += layerThickness
return... | null | null | null | loop layers
| codeqa | def get Loop Layers archivable Objects import Radius layer Thickness maximum Z should Print Warning z zone Arrangement loop Layers []while z < maximum Z triangle mesh get Loop Layer Append loop Layers z loops get Empty Z Loops archivable Objects import Radius True z zone Arrangement z + layer Thicknessreturn loop Layer... | null | null | null | null | Question:
What does the code get ?
Code:
def getLoopLayers(archivableObjects, importRadius, layerThickness, maximumZ, shouldPrintWarning, z, zoneArrangement):
loopLayers = []
while (z <= maximumZ):
triangle_mesh.getLoopLayerAppend(loopLayers, z).loops = getEmptyZLoops(archivableObjects, importRadius, True, z, z... |
null | null | null | What did the code read ?
| def read_input(port):
import RPi.GPIO as GPIO
return GPIO.input(port)
| null | null | null | a value
| codeqa | def read input port import R Pi GPIO as GPI Oreturn GPIO input port
| null | null | null | null | Question:
What did the code read ?
Code:
def read_input(port):
import RPi.GPIO as GPIO
return GPIO.input(port)
|
null | null | null | In which direction did java test coverage flags based on the environment pass ?
| def _generate_java_test_coverage_flag(env):
env_dict = env.Dictionary()
jacoco_agent = env_dict.get('JACOCOAGENT')
if jacoco_agent:
jacoco_agent = os.path.abspath(jacoco_agent)
target_under_test_package = env_dict.get('JAVATARGETUNDERTESTPKG')
if target_under_test_package:
options = []
options.append(('i... | null | null | null | in
| codeqa | def generate java test coverage flag env env dict env Dictionary jacoco agent env dict get 'JACOCOAGENT' if jacoco agent jacoco agent os path abspath jacoco agent target under test package env dict get 'JAVATARGETUNDERTESTPKG' if target under test package options []options append 'includes %s' % ' ' join [ p + ' *' for... | null | null | null | null | Question:
In which direction did java test coverage flags based on the environment pass ?
Code:
def _generate_java_test_coverage_flag(env):
env_dict = env.Dictionary()
jacoco_agent = env_dict.get('JACOCOAGENT')
if jacoco_agent:
jacoco_agent = os.path.abspath(jacoco_agent)
target_under_test_package = env_dict... |
null | null | null | What does the code return ?
| def ip_address(address):
try:
return IPv4Address(address)
except (AddressValueError, NetmaskValueError):
pass
try:
return IPv6Address(address)
except (AddressValueError, NetmaskValueError):
pass
if isinstance(address, bytes):
raise AddressValueError((u'%r does not appear to be an IPv4 or IPv6 a... | null | null | null | an object of the correct type
| codeqa | def ip address address try return I Pv 4 Address address except Address Value Error Netmask Value Error passtry return I Pv 6 Address address except Address Value Error Netmask Value Error passif isinstance address bytes raise Address Value Error u'%rdoesnotappeartobean I Pv 4 or I Pv 6 address Didyoupassinabytes strin... | null | null | null | null | Question:
What does the code return ?
Code:
def ip_address(address):
try:
return IPv4Address(address)
except (AddressValueError, NetmaskValueError):
pass
try:
return IPv6Address(address)
except (AddressValueError, NetmaskValueError):
pass
if isinstance(address, bytes):
raise AddressValueError((u'%r ... |
null | null | null | What does the code get ?
| def get_comment_form(parser, token):
return CommentFormNode.handle_token(parser, token)
| null | null | null | a form object to post a new comment
| codeqa | def get comment form parser token return Comment Form Node handle token parser token
| null | null | null | null | Question:
What does the code get ?
Code:
def get_comment_form(parser, token):
return CommentFormNode.handle_token(parser, token)
|
null | null | null | What does the code remove from a file ?
| def delete(filename):
OggTheora(filename).delete()
| null | null | null | tags
| codeqa | def delete filename Ogg Theora filename delete
| null | null | null | null | Question:
What does the code remove from a file ?
Code:
def delete(filename):
OggTheora(filename).delete()
|
null | null | null | What does the code add from a reversed convex polygon ?
| def addFacesByConvexReversed(faces, indexedLoop):
addFacesByConvex(faces, indexedLoop[::(-1)])
| null | null | null | faces
| codeqa | def add Faces By Convex Reversed faces indexed Loop add Faces By Convex faces indexed Loop[ -1 ]
| null | null | null | null | Question:
What does the code add from a reversed convex polygon ?
Code:
def addFacesByConvexReversed(faces, indexedLoop):
addFacesByConvex(faces, indexedLoop[::(-1)])
|
null | null | null | What does the code delete ?
| def delete(cont, path=None, profile=None):
swift_conn = _auth(profile)
if (path is None):
return swift_conn.delete_container(cont)
else:
return swift_conn.delete_object(cont, path)
| null | null | null | a container
| codeqa | def delete cont path None profile None swift conn auth profile if path is None return swift conn delete container cont else return swift conn delete object cont path
| null | null | null | null | Question:
What does the code delete ?
Code:
def delete(cont, path=None, profile=None):
swift_conn = _auth(profile)
if (path is None):
return swift_conn.delete_container(cont)
else:
return swift_conn.delete_object(cont, path)
|
null | null | null | For what purpose do the glance metadata return ?
| @require_context
@require_volume_exists
def volume_glance_metadata_get(context, volume_id):
return _volume_glance_metadata_get(context, volume_id)
| null | null | null | for the specified volume
| codeqa | @require context@require volume existsdef volume glance metadata get context volume id return volume glance metadata get context volume id
| null | null | null | null | Question:
For what purpose do the glance metadata return ?
Code:
@require_context
@require_volume_exists
def volume_glance_metadata_get(context, volume_id):
return _volume_glance_metadata_get(context, volume_id)
|
null | null | null | What has user passed ?
| @receiver(COURSE_CERT_AWARDED, sender=GeneratedCertificate)
def handle_course_cert_awarded(sender, user, course_key, **kwargs):
if is_prerequisite_courses_enabled():
fulfill_course_milestone(course_key, user)
| null | null | null | the course
| codeqa | @receiver COURSE CERT AWARDED sender Generated Certificate def handle course cert awarded sender user course key **kwargs if is prerequisite courses enabled fulfill course milestone course key user
| null | null | null | null | Question:
What has user passed ?
Code:
@receiver(COURSE_CERT_AWARDED, sender=GeneratedCertificate)
def handle_course_cert_awarded(sender, user, course_key, **kwargs):
if is_prerequisite_courses_enabled():
fulfill_course_milestone(course_key, user)
|
null | null | null | For what purpose does the current active catalog return ?
| def catalog():
global _default, _active
t = _active.get(currentThread(), None)
if (t is not None):
return t
if (_default is None):
from google.appengine._internal.django.conf import settings
_default = translation(settings.LANGUAGE_CODE)
return _default
| null | null | null | for further processing
| codeqa | def catalog global default activet active get current Thread None if t is not None return tif default is None from google appengine internal django conf import settings default translation settings LANGUAGE CODE return default
| null | null | null | null | Question:
For what purpose does the current active catalog return ?
Code:
def catalog():
global _default, _active
t = _active.get(currentThread(), None)
if (t is not None):
return t
if (_default is None):
from google.appengine._internal.django.conf import settings
_default = translation(settings.LANGUAGE_... |
null | null | null | What does the code get ?
| def getNewRepository():
return SkeinisoRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return Skeiniso Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return SkeinisoRepository()
|
null | null | null | What does the code get ?
| def families(root=None, displayof=None):
if (not root):
root = tkinter._default_root
args = ()
if displayof:
args = ('-displayof', displayof)
return root.tk.splitlist(root.tk.call('font', 'families', *args))
| null | null | null | font families
| codeqa | def families root None displayof None if not root root tkinter default rootargs if displayof args '-displayof' displayof return root tk splitlist root tk call 'font' 'families' *args
| null | null | null | null | Question:
What does the code get ?
Code:
def families(root=None, displayof=None):
if (not root):
root = tkinter._default_root
args = ()
if displayof:
args = ('-displayof', displayof)
return root.tk.splitlist(root.tk.call('font', 'families', *args))
|
null | null | null | What does the code verify ?
| def num_plurals(catalog, message):
if (not message.pluralizable):
if (not isinstance(message.string, string_types)):
raise TranslationError('Found plural forms for non-pluralizable message')
return
elif (catalog is None):
return
msgstrs = message.string
if (not isinstance(msgstrs, (list, tuple))):
m... | null | null | null | the number of plurals in the translation
| codeqa | def num plurals catalog message if not message pluralizable if not isinstance message string string types raise Translation Error ' Foundpluralformsfornon-pluralizablemessage' returnelif catalog is None returnmsgstrs message stringif not isinstance msgstrs list tuple msgstrs msgstrs if len msgstrs catalog num plurals r... | null | null | null | null | Question:
What does the code verify ?
Code:
def num_plurals(catalog, message):
if (not message.pluralizable):
if (not isinstance(message.string, string_types)):
raise TranslationError('Found plural forms for non-pluralizable message')
return
elif (catalog is None):
return
msgstrs = message.string
... |
null | null | null | What does the code generate ?
| def gen(id_=None, keysize=2048):
if (id_ is None):
id_ = hashlib.sha512(os.urandom(32)).hexdigest()
else:
id_ = clean.filename(id_)
ret = {'priv': '', 'pub': ''}
priv = salt.crypt.gen_keys(__opts__['pki_dir'], id_, keysize)
pub = '{0}.pub'.format(priv[:priv.rindex('.')])
with salt.utils.fopen(priv) as fp_:
... | null | null | null | a key pair
| codeqa | def gen id None keysize 2048 if id is None id hashlib sha 512 os urandom 32 hexdigest else id clean filename id ret {'priv' '' 'pub' ''}priv salt crypt gen keys opts ['pki dir'] id keysize pub '{ 0 } pub' format priv[ priv rindex ' ' ] with salt utils fopen priv as fp ret['priv'] fp read with salt utils fopen pub as fp... | null | null | null | null | Question:
What does the code generate ?
Code:
def gen(id_=None, keysize=2048):
if (id_ is None):
id_ = hashlib.sha512(os.urandom(32)).hexdigest()
else:
id_ = clean.filename(id_)
ret = {'priv': '', 'pub': ''}
priv = salt.crypt.gen_keys(__opts__['pki_dir'], id_, keysize)
pub = '{0}.pub'.format(priv[:priv.rin... |
null | null | null | What did the code set ?
| def set_price_list_and_rate(quotation, cart_settings):
_set_price_list(quotation, cart_settings)
quotation.price_list_currency = quotation.currency = quotation.plc_conversion_rate = quotation.conversion_rate = None
for item in quotation.get(u'items'):
item.price_list_rate = item.discount_percentage = item.rate = i... | null | null | null | price list
| codeqa | def set price list and rate quotation cart settings set price list quotation cart settings quotation price list currency quotation currency quotation plc conversion rate quotation conversion rate Nonefor item in quotation get u'items' item price list rate item discount percentage item rate item amount Nonequotation run... | null | null | null | null | Question:
What did the code set ?
Code:
def set_price_list_and_rate(quotation, cart_settings):
_set_price_list(quotation, cart_settings)
quotation.price_list_currency = quotation.currency = quotation.plc_conversion_rate = quotation.conversion_rate = None
for item in quotation.get(u'items'):
item.price_list_rat... |
null | null | null | What does the code delete ?
| def delete_policy(policy_name, region=None, key=None, keyid=None, profile=None):
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
policy_arn = _get_policy_arn(policy_name, region, key, keyid, profile)
if (not policy_exists(policy_arn, region, key, keyid, profile)):
return True
try:
conn.de... | null | null | null | a policy
| codeqa | def delete policy policy name region None key None keyid None profile None conn get conn region region key key keyid keyid profile profile policy arn get policy arn policy name region key keyid profile if not policy exists policy arn region key keyid profile return Truetry conn delete policy policy arn log info ' Delet... | null | null | null | null | Question:
What does the code delete ?
Code:
def delete_policy(policy_name, region=None, key=None, keyid=None, profile=None):
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
policy_arn = _get_policy_arn(policy_name, region, key, keyid, profile)
if (not policy_exists(policy_arn, region, key,... |
null | null | null | What does the code get ?
| def item_candidates(item, artist, title):
out = []
for plugin in find_plugins():
out.extend(plugin.item_candidates(item, artist, title))
return out
| null | null | null | musicbrainz candidates for an item from the plugins
| codeqa | def item candidates item artist title out []for plugin in find plugins out extend plugin item candidates item artist title return out
| null | null | null | null | Question:
What does the code get ?
Code:
def item_candidates(item, artist, title):
out = []
for plugin in find_plugins():
out.extend(plugin.item_candidates(item, artist, title))
return out
|
null | null | null | When did kind size values retrieve ?
| def CacheStats(formatted_results):
kinds_and_sizes = dict(((kind['kind_name'], kind['total_bytes']) for kind in formatted_results))
memcache.set(KINDS_AND_SIZES_VAR, kinds_and_sizes, namespace=MEMCACHE_NAMESPACE)
| null | null | null | last
| codeqa | def Cache Stats formatted results kinds and sizes dict kind['kind name'] kind['total bytes'] for kind in formatted results memcache set KINDS AND SIZES VAR kinds and sizes namespace MEMCACHE NAMESPACE
| null | null | null | null | Question:
When did kind size values retrieve ?
Code:
def CacheStats(formatted_results):
kinds_and_sizes = dict(((kind['kind_name'], kind['total_bytes']) for kind in formatted_results))
memcache.set(KINDS_AND_SIZES_VAR, kinds_and_sizes, namespace=MEMCACHE_NAMESPACE)
|
null | null | null | What did the code give ?
| def deduplicate_countries(country, dup_country):
regions = dup_country.region_set.all()
if regions.exists():
regions.update(country=country)
cities = dup_country.city_set.all()
if cities.exists():
cities.update(country=country)
users = dup_country.userprofile_set.all()
if users.exists():
users.update(geo_co... | null | null | null | 2 country instances
| codeqa | def deduplicate countries country dup country regions dup country region set all if regions exists regions update country country cities dup country city set all if cities exists cities update country country users dup country userprofile set all if users exists users update geo country country dup country delete
| null | null | null | null | Question:
What did the code give ?
Code:
def deduplicate_countries(country, dup_country):
regions = dup_country.region_set.all()
if regions.exists():
regions.update(country=country)
cities = dup_country.city_set.all()
if cities.exists():
cities.update(country=country)
users = dup_country.userprofile_set.al... |
null | null | null | What does the code synthesize ?
| def synthesize_nonce(s, key, timestamp=None):
if (timestamp is None):
timestamp = int(time.time())
h = md5_hex(('%s:%s:%s' % (timestamp, s, key)))
nonce = ('%s:%s' % (timestamp, h))
return nonce
| null | null | null | a nonce value which resists spoofing and can be checked for staleness
| codeqa | def synthesize nonce s key timestamp None if timestamp is None timestamp int time time h md 5 hex '%s %s %s' % timestamp s key nonce '%s %s' % timestamp h return nonce
| null | null | null | null | Question:
What does the code synthesize ?
Code:
def synthesize_nonce(s, key, timestamp=None):
if (timestamp is None):
timestamp = int(time.time())
h = md5_hex(('%s:%s:%s' % (timestamp, s, key)))
nonce = ('%s:%s' % (timestamp, h))
return nonce
|
null | null | null | What does the code get ?
| def getNewRepository():
return AnalyzeRepository()
| null | null | null | new repository
| codeqa | def get New Repository return Analyze Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return AnalyzeRepository()
|
null | null | null | What does the code get ?
| def get_rollbacks():
return _proxy_cmd('get_rollbacks')
| null | null | null | a list of stored configuration rollbacks
| codeqa | def get rollbacks return proxy cmd 'get rollbacks'
| null | null | null | null | Question:
What does the code get ?
Code:
def get_rollbacks():
return _proxy_cmd('get_rollbacks')
|
null | null | null | What does the code make ?
| def osx_hibernate():
osx_standby()
| null | null | null | osx system sleep
| codeqa | def osx hibernate osx standby
| null | null | null | null | Question:
What does the code make ?
Code:
def osx_hibernate():
osx_standby()
|
null | null | null | What does the code get ?
| def template(*args, **kwargs):
tpl = (args[0] if args else None)
adapter = kwargs.pop('template_adapter', SimpleTemplate)
lookup = kwargs.pop('template_lookup', TEMPLATE_PATH)
tplid = (id(lookup), tpl)
if ((tplid not in TEMPLATES) or DEBUG):
settings = kwargs.pop('template_settings', {})
if isinstance(tpl, ada... | null | null | null | a rendered template as a string iterator
| codeqa | def template *args **kwargs tpl args[ 0 ] if args else None adapter kwargs pop 'template adapter' Simple Template lookup kwargs pop 'template lookup' TEMPLATE PATH tplid id lookup tpl if tplid not in TEMPLATES or DEBUG settings kwargs pop 'template settings' {} if isinstance tpl adapter TEMPLATES[tplid] tplif settings ... | null | null | null | null | Question:
What does the code get ?
Code:
def template(*args, **kwargs):
tpl = (args[0] if args else None)
adapter = kwargs.pop('template_adapter', SimpleTemplate)
lookup = kwargs.pop('template_lookup', TEMPLATE_PATH)
tplid = (id(lookup), tpl)
if ((tplid not in TEMPLATES) or DEBUG):
settings = kwargs.pop('tem... |
null | null | null | What does the code convert to a null - terminated string buffer ?
| def stn(s, length):
return (s[:length] + ((length - len(s)) * NUL))
| null | null | null | a python string
| codeqa | def stn s length return s[ length] + length - len s * NUL
| null | null | null | null | Question:
What does the code convert to a null - terminated string buffer ?
Code:
def stn(s, length):
return (s[:length] + ((length - len(s)) * NUL))
|
null | null | null | What does the code take ?
| def flatten_blocks(lines, num_indents=(-1)):
INDENTATION = (' ' * 4)
if (not lines):
return ''
if isinstance(lines, six.string_types):
return ((INDENTATION * num_indents) + lines)
return '\n'.join([flatten_blocks(line, (num_indents + 1)) for line in lines])
| null | null | null | a list or string
| codeqa | def flatten blocks lines num indents -1 INDENTATION '' * 4 if not lines return ''if isinstance lines six string types return INDENTATION * num indents + lines return '\n' join [flatten blocks line num indents + 1 for line in lines]
| null | null | null | null | Question:
What does the code take ?
Code:
def flatten_blocks(lines, num_indents=(-1)):
INDENTATION = (' ' * 4)
if (not lines):
return ''
if isinstance(lines, six.string_types):
return ((INDENTATION * num_indents) + lines)
return '\n'.join([flatten_blocks(line, (num_indents + 1)) for line in lines])
|
null | null | null | What declares that only the first n arguments may be positional ?
| def positional(max_pos_args):
__ndb_debug__ = 'SKIP'
def positional_decorator(wrapped):
if (not DEBUG):
return wrapped
__ndb_debug__ = 'SKIP'
@wrapping(wrapped)
def positional_wrapper(*args, **kwds):
__ndb_debug__ = 'SKIP'
if (len(args) > max_pos_args):
plural_s = ''
if (max_pos_args != 1):
... | null | null | null | a decorator
| codeqa | def positional max pos args ndb debug 'SKIP'def positional decorator wrapped if not DEBUG return wrapped ndb debug 'SKIP'@wrapping wrapped def positional wrapper *args **kwds ndb debug 'SKIP'if len args > max pos args plural s ''if max pos args 1 plural s 's'raise Type Error '%s takesatmost%dpositionalargument%s %dgive... | null | null | null | null | Question:
What declares that only the first n arguments may be positional ?
Code:
def positional(max_pos_args):
__ndb_debug__ = 'SKIP'
def positional_decorator(wrapped):
if (not DEBUG):
return wrapped
__ndb_debug__ = 'SKIP'
@wrapping(wrapped)
def positional_wrapper(*args, **kwds):
__ndb_debug__ = 'S... |
null | null | null | What returns from config whether it is a dict ?
| def as_dict(config):
if isinstance(config, text_or_bytes):
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 text or bytes 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, text_or_bytes):
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 get ?
| def getNewRepository():
return CoolRepository()
| null | null | null | new repository
| codeqa | def get New Repository return Cool Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return CoolRepository()
|
null | null | null | What does the code get ?
| def worker_get_all(context, **filters):
query = _worker_query(context, **filters)
return (query.all() if query else [])
| null | null | null | all workers that match given criteria
| codeqa | def worker get all context **filters query worker query context **filters return query all if query else []
| null | null | null | null | Question:
What does the code get ?
Code:
def worker_get_all(context, **filters):
query = _worker_query(context, **filters)
return (query.all() if query else [])
|
null | null | null | What does the code get ?
| def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
wedgeCenter = evaluate.getVector3ByPrefix(Vector3(), (prefix + 'center'), xmlElement)
loop.append(wedgeCenter)
return [loop]
| null | null | null | wedge loop
| codeqa | def get Manipulated Paths close loop prefix side Length xml Element wedge Center evaluate get Vector 3 By Prefix Vector 3 prefix + 'center' xml Element loop append wedge Center return [loop]
| null | null | null | null | Question:
What does the code get ?
Code:
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
wedgeCenter = evaluate.getVector3ByPrefix(Vector3(), (prefix + 'center'), xmlElement)
loop.append(wedgeCenter)
return [loop]
|
null | null | null | What does the code initialize ?
| def init_parser():
parser = argparse.ArgumentParser(description='Restore application code and data.')
main_args = parser.add_argument_group('main args')
main_args.add_argument('-a', '--app-id', required=True, help='The application ID to restore data under.')
main_args.add_argument('-b', '--backup-dir', r... | null | null | null | the command line argument parser
| codeqa | def init parser parser argparse Argument Parser description ' Restoreapplicationcodeanddata ' main args parser add argument group 'mainargs' main args add argument '-a' '--app-id' required True help ' Theapplication I Dtorestoredataunder ' main args add argument '-b' '--backup-dir' required True help ' Thebackupdirecto... | null | null | null | null | Question:
What does the code initialize ?
Code:
def init_parser():
parser = argparse.ArgumentParser(description='Restore application code and data.')
main_args = parser.add_argument_group('main args')
main_args.add_argument('-a', '--app-id', required=True, help='The application ID to restore data unde... |
null | null | null | What does the code return ?
| def load():
from statsmodels.tools import categorical
data = _get_data()
raw_data = categorical(data, col='firm', drop=True)
ds = du.process_recarray(data, endog_idx=0, stack=False)
ds.raw_data = raw_data
return ds
| null | null | null | a dataset class
| codeqa | def load from statsmodels tools import categoricaldata get data raw data categorical data col 'firm' drop True ds du process recarray data endog idx 0 stack False ds raw data raw datareturn ds
| null | null | null | null | Question:
What does the code return ?
Code:
def load():
from statsmodels.tools import categorical
data = _get_data()
raw_data = categorical(data, col='firm', drop=True)
ds = du.process_recarray(data, endog_idx=0, stack=False)
ds.raw_data = raw_data
return ds
|
null | null | null | Where do all non - missing values be in the upper left corner of the matrix ?
| def reorder_missing_matrix(matrix, missing, reorder_rows=False, reorder_cols=False, is_diagonal=False, inplace=False, prefix=None):
if (prefix is None):
prefix = find_best_blas_type((matrix,))[0]
reorder = prefix_reorder_missing_matrix_map[prefix]
if (not inplace):
matrix = np.copy(matrix, order='F')
reorder(ma... | null | null | null | a time - varying matrix
| codeqa | def reorder missing matrix matrix missing reorder rows False reorder cols False is diagonal False inplace False prefix None if prefix is None prefix find best blas type matrix [0 ]reorder prefix reorder missing matrix map[prefix]if not inplace matrix np copy matrix order 'F' reorder matrix np asfortranarray missing reo... | null | null | null | null | Question:
Where do all non - missing values be in the upper left corner of the matrix ?
Code:
def reorder_missing_matrix(matrix, missing, reorder_rows=False, reorder_cols=False, is_diagonal=False, inplace=False, prefix=None):
if (prefix is None):
prefix = find_best_blas_type((matrix,))[0]
reorder = prefix_reord... |
null | null | null | What does the code get from multiplier ?
| def getVector3ByMultiplierPrefix(multiplier, prefix, vector3, xmlElement):
if (multiplier == 0.0):
return vector3
oldMultipliedValueVector3 = (vector3 * multiplier)
vector3ByPrefix = getVector3ByPrefix(oldMultipliedValueVector3.copy(), prefix, xmlElement)
if (vector3ByPrefix == oldMultipliedValueVector3):
retur... | null | null | null | vector3
| codeqa | def get Vector 3 By Multiplier Prefix multiplier prefix vector 3 xml Element if multiplier 0 0 return vector 3 old Multiplied Value Vector 3 vector 3 * multiplier vector 3 By Prefix get Vector 3 By Prefix old Multiplied Value Vector 3 copy prefix xml Element if vector 3 By Prefix old Multiplied Value Vector 3 return ve... | null | null | null | null | Question:
What does the code get from multiplier ?
Code:
def getVector3ByMultiplierPrefix(multiplier, prefix, vector3, xmlElement):
if (multiplier == 0.0):
return vector3
oldMultipliedValueVector3 = (vector3 * multiplier)
vector3ByPrefix = getVector3ByPrefix(oldMultipliedValueVector3.copy(), prefix, xmlElement... |
null | null | null | What does the code unset ?
| @config.command()
@click.option('--no-input', default=False, is_flag=True, help='Do not show confirmation.')
@click.argument('option')
@configuration
def delete(option, no_input):
from sentry import options
from sentry.options.manager import UnknownOption
if (not no_input):
click.confirm(('Are you sure you ... | null | null | null | a configuration option
| codeqa | @config command @click option '--no-input' default False is flag True help ' Donotshowconfirmation ' @click argument 'option' @configurationdef delete option no input from sentry import optionsfrom sentry options manager import Unknown Optionif not no input click confirm ' Areyousureyouwanttodelete"%s"?' % option defau... | null | null | null | null | Question:
What does the code unset ?
Code:
@config.command()
@click.option('--no-input', default=False, is_flag=True, help='Do not show confirmation.')
@click.argument('option')
@configuration
def delete(option, no_input):
from sentry import options
from sentry.options.manager import UnknownOption
if (not no_... |
null | null | null | What does the code find ?
| def best_match(supported, header):
parsed_header = [parse_media_range(r) for r in _filter_blank(header.split(','))]
weighted_matches = []
pos = 0
for mime_type in supported:
weighted_matches.append((fitness_and_quality_parsed(mime_type, parsed_header), pos, mime_type))
pos += 1
weighted_matches.sort()
return ... | null | null | null | the best match for all the media - ranges listed in header
| codeqa | def best match supported header parsed header [parse media range r for r in filter blank header split ' ' ]weighted matches []pos 0for mime type in supported weighted matches append fitness and quality parsed mime type parsed header pos mime type pos + 1weighted matches sort return weighted matches[ -1 ][ 0 ][ 1 ] and ... | null | null | null | null | Question:
What does the code find ?
Code:
def best_match(supported, header):
parsed_header = [parse_media_range(r) for r in _filter_blank(header.split(','))]
weighted_matches = []
pos = 0
for mime_type in supported:
weighted_matches.append((fitness_and_quality_parsed(mime_type, parsed_header), pos, mime_type)... |
null | null | null | What does the code take ?
| def best_match(supported, header):
parsed_header = [parse_media_range(r) for r in _filter_blank(header.split(','))]
weighted_matches = []
pos = 0
for mime_type in supported:
weighted_matches.append((fitness_and_quality_parsed(mime_type, parsed_header), pos, mime_type))
pos += 1
weighted_matches.sort()
return ... | null | null | null | a list of supported mime - types
| codeqa | def best match supported header parsed header [parse media range r for r in filter blank header split ' ' ]weighted matches []pos 0for mime type in supported weighted matches append fitness and quality parsed mime type parsed header pos mime type pos + 1weighted matches sort return weighted matches[ -1 ][ 0 ][ 1 ] and ... | null | null | null | null | Question:
What does the code take ?
Code:
def best_match(supported, header):
parsed_header = [parse_media_range(r) for r in _filter_blank(header.split(','))]
weighted_matches = []
pos = 0
for mime_type in supported:
weighted_matches.append((fitness_and_quality_parsed(mime_type, parsed_header), pos, mime_type)... |
null | null | null | For what purpose must napalm library be installed ?
| def __virtual__():
if (HAS_NAPALM and ('proxy' in __opts__)):
return __virtualname__
else:
return (False, 'The module SNMP (napalm_snmp) cannot be loaded: NAPALM or proxy could not be loaded.')
| null | null | null | for this module to work
| codeqa | def virtual if HAS NAPALM and 'proxy' in opts return virtualname else return False ' Themodule SNMP napalm snmp cannotbeloaded NAPAL Morproxycouldnotbeloaded '
| null | null | null | null | Question:
For what purpose must napalm library be installed ?
Code:
def __virtual__():
if (HAS_NAPALM and ('proxy' in __opts__)):
return __virtualname__
else:
return (False, 'The module SNMP (napalm_snmp) cannot be loaded: NAPALM or proxy could not be loaded.')
|
null | null | null | What does the code get ?
| def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
if (len(loop) < 3):
return [loop]
if (not evaluate.getEvaluatedBooleanDefault(True, (prefix + 'activate'), xmlElement)):
return [loop]
overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
overhangPlaneAngle = euclidean.getWiddershinsU... | null | null | null | path with overhangs removed or filled in
| codeqa | def get Manipulated Paths close loop prefix side Length xml Element if len loop < 3 return [loop]if not evaluate get Evaluated Boolean Default True prefix + 'activate' xml Element return [loop]overhang Angle evaluate get Overhang Support Angle xml Element overhang Plane Angle euclidean get Widdershins Unit Polar 0 5 * ... | null | null | null | null | Question:
What does the code get ?
Code:
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
if (len(loop) < 3):
return [loop]
if (not evaluate.getEvaluatedBooleanDefault(True, (prefix + 'activate'), xmlElement)):
return [loop]
overhangAngle = evaluate.getOverhangSupportAngle(xmlElement)
o... |
null | null | null | What does the code convert into a string of binary digits ?
| def _key2bin(s):
kl = map((lambda x: ord(x)), s)
kl = map((lambda x: (binary[(x / 16)] + binary[(x & 15)])), kl)
return ''.join(kl)
| null | null | null | a key
| codeqa | def key 2 bin s kl map lambda x ord x s kl map lambda x binary[ x / 16 ] + binary[ x & 15 ] kl return '' join kl
| null | null | null | null | Question:
What does the code convert into a string of binary digits ?
Code:
def _key2bin(s):
kl = map((lambda x: ord(x)), s)
kl = map((lambda x: (binary[(x / 16)] + binary[(x & 15)])), kl)
return ''.join(kl)
|
null | null | null | Where does the code insert a new entry ?
| def create(name, endpoint='incidents', api_url=None, page_id=None, api_key=None, api_version=None, **kwargs):
ret = _default_ret(name)
endpoint_sg = endpoint[:(-1)]
if __opts__['test']:
ret['comment'] = 'The following {endpoint} would be created:'.format(endpoint=endpoint_sg)
ret['result'] = None
ret['cha... | null | null | null | under a specific endpoint
| codeqa | def create name endpoint 'incidents' api url None page id None api key None api version None **kwargs ret default ret name endpoint sg endpoint[ -1 ]if opts ['test'] ret['comment'] ' Thefollowing{endpoint}wouldbecreated ' format endpoint endpoint sg ret['result'] Noneret['changes'][endpoint] {}for karg warg in six iter... | null | null | null | null | Question:
Where does the code insert a new entry ?
Code:
def create(name, endpoint='incidents', api_url=None, page_id=None, api_key=None, api_version=None, **kwargs):
ret = _default_ret(name)
endpoint_sg = endpoint[:(-1)]
if __opts__['test']:
ret['comment'] = 'The following {endpoint} would be created:'.f... |
null | null | null | What does the code insert under a specific endpoint ?
| def create(name, endpoint='incidents', api_url=None, page_id=None, api_key=None, api_version=None, **kwargs):
ret = _default_ret(name)
endpoint_sg = endpoint[:(-1)]
if __opts__['test']:
ret['comment'] = 'The following {endpoint} would be created:'.format(endpoint=endpoint_sg)
ret['result'] = None
ret['cha... | null | null | null | a new entry
| codeqa | def create name endpoint 'incidents' api url None page id None api key None api version None **kwargs ret default ret name endpoint sg endpoint[ -1 ]if opts ['test'] ret['comment'] ' Thefollowing{endpoint}wouldbecreated ' format endpoint endpoint sg ret['result'] Noneret['changes'][endpoint] {}for karg warg in six iter... | null | null | null | null | Question:
What does the code insert under a specific endpoint ?
Code:
def create(name, endpoint='incidents', api_url=None, page_id=None, api_key=None, api_version=None, **kwargs):
ret = _default_ret(name)
endpoint_sg = endpoint[:(-1)]
if __opts__['test']:
ret['comment'] = 'The following {endpoint} would be... |
null | null | null | What does the code create ?
| def new_figure_manager(num, *args, **kwargs):
DEBUG_MSG('new_figure_manager()', 3, None)
_create_wx_app()
FigureClass = kwargs.pop('FigureClass', Figure)
fig = FigureClass(*args, **kwargs)
frame = FigureFrameWx(num, fig)
figmgr = frame.get_figure_manager()
if matplotlib.is_interactive():
figmgr.frame.Show()
r... | null | null | null | a new figure manager instance
| codeqa | def new figure manager num *args **kwargs DEBUG MSG 'new figure manager ' 3 None create wx app Figure Class kwargs pop ' Figure Class' Figure fig Figure Class *args **kwargs frame Figure Frame Wx num fig figmgr frame get figure manager if matplotlib is interactive figmgr frame Show return figmgr
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager(num, *args, **kwargs):
DEBUG_MSG('new_figure_manager()', 3, None)
_create_wx_app()
FigureClass = kwargs.pop('FigureClass', Figure)
fig = FigureClass(*args, **kwargs)
frame = FigureFrameWx(num, fig)
figmgr = frame.get_figure_manager()
if matpl... |
null | null | null | What does the code sanitize ?
| def sanitize_host(host):
return ''.join([c for c in host[0:255] if (c in ((ascii_letters + digits) + '.-'))])
| null | null | null | host string
| codeqa | def sanitize host host return '' join [c for c in host[ 0 255 ] if c in ascii letters + digits + ' -' ]
| null | null | null | null | Question:
What does the code sanitize ?
Code:
def sanitize_host(host):
return ''.join([c for c in host[0:255] if (c in ((ascii_letters + digits) + '.-'))])
|
null | null | null | What does the code return ?
| def run_command(args, added_env=None, cwd=None):
log.msg(format='Running %(args)r with environment %(env)r and working directory %(cwd)s', args=args, env=added_env, cwd=cwd)
if added_env:
env = os.environ.copy()
env.update(env)
else:
env = None
try:
return check_output(args=args, env=env, cwd=cwd)
... | null | null | null | its output
| codeqa | def run command args added env None cwd None log msg format ' Running% args rwithenvironment% env randworkingdirectory% cwd s' args args env added env cwd cwd if added env env os environ copy env update env else env Nonetry return check output args args env env cwd cwd except Called Process Error as e print e output
| null | null | null | null | Question:
What does the code return ?
Code:
def run_command(args, added_env=None, cwd=None):
log.msg(format='Running %(args)r with environment %(env)r and working directory %(cwd)s', args=args, env=added_env, cwd=cwd)
if added_env:
env = os.environ.copy()
env.update(env)
else:
env = None
try:
re... |
null | null | null | When do many term translations update ?
| def term_translation_update_many(context, data_dict):
model = context['model']
if (not (data_dict.get('data') and isinstance(data_dict.get('data'), list))):
raise ValidationError({'error': 'term_translation_update_many needs to have a list of dicts in field data'})
context['defer_commit'] = True
action ... | null | null | null | at once
| codeqa | def term translation update many context data dict model context['model']if not data dict get 'data' and isinstance data dict get 'data' list raise Validation Error {'error' 'term translation update manyneedstohavealistofdictsinfielddata'} context['defer commit'] Trueaction get action 'term translation update' for num ... | null | null | null | null | Question:
When do many term translations update ?
Code:
def term_translation_update_many(context, data_dict):
model = context['model']
if (not (data_dict.get('data') and isinstance(data_dict.get('data'), list))):
raise ValidationError({'error': 'term_translation_update_many needs to have a list of dicts ... |
null | null | null | When do many term translations create ?
| def term_translation_update_many(context, data_dict):
model = context['model']
if (not (data_dict.get('data') and isinstance(data_dict.get('data'), list))):
raise ValidationError({'error': 'term_translation_update_many needs to have a list of dicts in field data'})
context['defer_commit'] = True
action ... | null | null | null | at once
| codeqa | def term translation update many context data dict model context['model']if not data dict get 'data' and isinstance data dict get 'data' list raise Validation Error {'error' 'term translation update manyneedstohavealistofdictsinfielddata'} context['defer commit'] Trueaction get action 'term translation update' for num ... | null | null | null | null | Question:
When do many term translations create ?
Code:
def term_translation_update_many(context, data_dict):
model = context['model']
if (not (data_dict.get('data') and isinstance(data_dict.get('data'), list))):
raise ValidationError({'error': 'term_translation_update_many needs to have a list of dicts ... |
null | null | null | How does the code open a bzip2-compressed file ?
| def open(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None):
if ('t' in mode):
if ('b' in mode):
raise ValueError(('Invalid mode: %r' % (mode,)))
else:
if (encoding is not None):
raise ValueError("Argument 'encoding' not supported in binary mode")
if (errors is not Non... | null | null | null | in binary or text mode
| codeqa | def open filename mode 'rb' compresslevel 9 encoding None errors None newline None if 't' in mode if 'b' in mode raise Value Error ' Invalidmode %r' % mode else if encoding is not None raise Value Error " Argument'encoding'notsupportedinbinarymode" if errors is not None raise Value Error " Argument'errors'notsupportedi... | null | null | null | null | Question:
How does the code open a bzip2-compressed file ?
Code:
def open(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None):
if ('t' in mode):
if ('b' in mode):
raise ValueError(('Invalid mode: %r' % (mode,)))
else:
if (encoding is not None):
raise ValueError("Argument '... |
null | null | null | What does the code open in binary or text mode ?
| def open(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None):
if ('t' in mode):
if ('b' in mode):
raise ValueError(('Invalid mode: %r' % (mode,)))
else:
if (encoding is not None):
raise ValueError("Argument 'encoding' not supported in binary mode")
if (errors is not Non... | null | null | null | a bzip2-compressed file
| codeqa | def open filename mode 'rb' compresslevel 9 encoding None errors None newline None if 't' in mode if 'b' in mode raise Value Error ' Invalidmode %r' % mode else if encoding is not None raise Value Error " Argument'encoding'notsupportedinbinarymode" if errors is not None raise Value Error " Argument'errors'notsupportedi... | null | null | null | null | Question:
What does the code open in binary or text mode ?
Code:
def open(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None):
if ('t' in mode):
if ('b' in mode):
raise ValueError(('Invalid mode: %r' % (mode,)))
else:
if (encoding is not None):
raise ValueError("Argument '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.