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 extract from the function code text ?
| def extract_first_line(func_code):
if func_code.startswith(FIRST_LINE_TEXT):
func_code = func_code.split('\n')
first_line = int(func_code[0][len(FIRST_LINE_TEXT):])
func_code = '\n'.join(func_code[1:])
else:
first_line = (-1)
return (func_code, first_line)
| null | null | null | the first line information
| codeqa | def extract first line func code if func code startswith FIRST LINE TEXT func code func code split '\n' first line int func code[ 0 ][len FIRST LINE TEXT ] func code '\n' join func code[ 1 ] else first line -1 return func code first line
| null | null | null | null | Question:
What does the code extract from the function code text ?
Code:
def extract_first_line(func_code):
if func_code.startswith(FIRST_LINE_TEXT):
func_code = func_code.split('\n')
first_line = int(func_code[0][len(FIRST_LINE_TEXT):])
func_code = '\n'.join(func_code[1:])
else:
first_line = (-1)
return... |
null | null | null | What does the code add ?
| def success(request, message, extra_tags='', fail_silently=False):
add_message(request, constants.SUCCESS, message, extra_tags=extra_tags, fail_silently=fail_silently)
| null | null | null | a message with the success level
| codeqa | def success request message extra tags '' fail silently False add message request constants SUCCESS message extra tags extra tags fail silently fail silently
| null | null | null | null | Question:
What does the code add ?
Code:
def success(request, message, extra_tags='', fail_silently=False):
add_message(request, constants.SUCCESS, message, extra_tags=extra_tags, fail_silently=fail_silently)
|
null | null | null | What did the code receive ?
| def configure_callback(conf):
global ZK_HOSTS
for node in conf.children:
if (node.key == 'Hosts'):
ZK_HOSTS = node.values[0].split(',')
else:
collectd.warning(('zookeeper plugin: Unknown config key: %s.' % node.key))
log(('Configured with hosts=%s' % ZK_HOSTS))
| null | null | null | configuration information
| codeqa | def configure callback conf global ZK HOST Sfor node in conf children if node key ' Hosts' ZK HOSTS node values[ 0 ] split ' ' else collectd warning 'zookeeperplugin Unknownconfigkey %s ' % node key log ' Configuredwithhosts %s' % ZK HOSTS
| null | null | null | null | Question:
What did the code receive ?
Code:
def configure_callback(conf):
global ZK_HOSTS
for node in conf.children:
if (node.key == 'Hosts'):
ZK_HOSTS = node.values[0].split(',')
else:
collectd.warning(('zookeeper plugin: Unknown config key: %s.' % node.key))
log(('Configured with hosts=%s' % Z... |
null | null | null | What does user select ?
| def get_selection_from_user(message, *values):
return _validate_user_input(SelectionDialog(message, values))
| null | null | null | a value
| codeqa | def get selection from user message *values return validate user input Selection Dialog message values
| null | null | null | null | Question:
What does user select ?
Code:
def get_selection_from_user(message, *values):
return _validate_user_input(SelectionDialog(message, values))
|
null | null | null | What asks user ?
| def get_selection_from_user(message, *values):
return _validate_user_input(SelectionDialog(message, values))
| null | null | null | to select a value
| codeqa | def get selection from user message *values return validate user input Selection Dialog message values
| null | null | null | null | Question:
What asks user ?
Code:
def get_selection_from_user(message, *values):
return _validate_user_input(SelectionDialog(message, values))
|
null | null | null | What does the code reset ?
| def reset():
_REGISTRY.clear()
_future_dependencies.clear()
| null | null | null | the registry of providers
| codeqa | def reset REGISTRY clear future dependencies clear
| null | null | null | null | Question:
What does the code reset ?
Code:
def reset():
_REGISTRY.clear()
_future_dependencies.clear()
|
null | null | null | When do french national days return ?
| def get_national_holidays(begin, end):
begin = datefactory(begin.year, begin.month, begin.day, begin)
end = datefactory(end.year, end.month, end.day, end)
holidays = [str2date(datestr, begin) for datestr in FRENCH_MOBILE_HOLIDAYS.values()]
for year in range(begin.year, (end.year + 1)):
for datestr in FRENCH_FIXED... | null | null | null | between begin and end
| codeqa | def get national holidays begin end begin datefactory begin year begin month begin day begin end datefactory end year end month end day end holidays [str 2 date datestr begin for datestr in FRENCH MOBILE HOLIDAYS values ]for year in range begin year end year + 1 for datestr in FRENCH FIXED HOLIDAYS values date str 2 da... | null | null | null | null | Question:
When do french national days return ?
Code:
def get_national_holidays(begin, end):
begin = datefactory(begin.year, begin.month, begin.day, begin)
end = datefactory(end.year, end.month, end.day, end)
holidays = [str2date(datestr, begin) for datestr in FRENCH_MOBILE_HOLIDAYS.values()]
for year in range(... |
null | null | null | How does a 303 return ?
| def create(request, course_key):
note = Note(course_id=course_key, user=request.user)
try:
note.clean(request.body)
except ValidationError as e:
log.debug(e)
return ApiResponse(http_response=HttpResponse('', status=400), data=None)
note.save()
response = HttpResponse('', status=303)
response['Location'] = n... | null | null | null | with the read location
| codeqa | def create request course key note Note course id course key user request user try note clean request body except Validation Error as e log debug e return Api Response http response Http Response '' status 400 data None note save response Http Response '' status 303 response[' Location'] note get absolute url return Ap... | null | null | null | null | Question:
How does a 303 return ?
Code:
def create(request, course_key):
note = Note(course_id=course_key, user=request.user)
try:
note.clean(request.body)
except ValidationError as e:
log.debug(e)
return ApiResponse(http_response=HttpResponse('', status=400), data=None)
note.save()
response = HttpRespon... |
null | null | null | What did the code set ?
| def default_keychain(name, domain='user', user=None):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
if (not os.path.exists(name)):
ret['result'] = False
ret['comment'] += 'Keychain not found at {0}'.format(name)
else:
out = __salt__['keychain.get_default_keychain'](user, domain)
if (... | null | null | null | the default keychain to use name the chain in which to use as the default domain the domain to use valid values are user|system|common|dynamic
| codeqa | def default keychain name domain 'user' user None ret {'name' name 'result' True 'comment' '' 'changes' {}}if not os path exists name ret['result'] Falseret['comment'] + ' Keychainnotfoundat{ 0 }' format name else out salt ['keychain get default keychain'] user domain if name in out ret['comment'] + '{ 0 }wasalreadythe... | null | null | null | null | Question:
What did the code set ?
Code:
def default_keychain(name, domain='user', user=None):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
if (not os.path.exists(name)):
ret['result'] = False
ret['comment'] += 'Keychain not found at {0}'.format(name)
else:
out = __salt__['keychain... |
null | null | null | How do the domain use as the default domain ?
| def default_keychain(name, domain='user', user=None):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
if (not os.path.exists(name)):
ret['result'] = False
ret['comment'] += 'Keychain not found at {0}'.format(name)
else:
out = __salt__['keychain.get_default_keychain'](user, domain)
if (... | null | null | null | the chain
| codeqa | def default keychain name domain 'user' user None ret {'name' name 'result' True 'comment' '' 'changes' {}}if not os path exists name ret['result'] Falseret['comment'] + ' Keychainnotfoundat{ 0 }' format name else out salt ['keychain get default keychain'] user domain if name in out ret['comment'] + '{ 0 }wasalreadythe... | null | null | null | null | Question:
How do the domain use as the default domain ?
Code:
def default_keychain(name, domain='user', user=None):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
if (not os.path.exists(name)):
ret['result'] = False
ret['comment'] += 'Keychain not found at {0}'.format(name)
else:
ou... |
null | null | null | What does this provide ?
| def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in instance_or_dict)]
instance = objects.Instance... | null | null | null | compatibility for callers passing old - style dict instances
| codeqa | def object compat function @functools wraps function def decorated function self context *args **kwargs def load instance instance or dict if isinstance instance or dict dict metas [meta for meta in 'metadata' 'system metadata' if meta in instance or dict ]instance objects Instance from db object context objects Instan... | null | null | null | null | Question:
What does this provide ?
Code:
def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in insta... |
null | null | null | What provides compatibility for callers passing old - style dict instances ?
| def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in instance_or_dict)]
instance = objects.Instance... | null | null | null | this
| codeqa | def object compat function @functools wraps function def decorated function self context *args **kwargs def load instance instance or dict if isinstance instance or dict dict metas [meta for meta in 'metadata' 'system metadata' if meta in instance or dict ]instance objects Instance from db object context objects Instan... | null | null | null | null | Question:
What provides compatibility for callers passing old - style dict instances ?
Code:
def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta ... |
null | null | null | What do callers pass ?
| def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in instance_or_dict)]
instance = objects.Instance... | null | null | null | old - style dict instances
| codeqa | def object compat function @functools wraps function def decorated function self context *args **kwargs def load instance instance or dict if isinstance instance or dict dict metas [meta for meta in 'metadata' 'system metadata' if meta in instance or dict ]instance objects Instance from db object context objects Instan... | null | null | null | null | Question:
What do callers pass ?
Code:
def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in instanc... |
null | null | null | What is passing old - style dict instances ?
| def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata') if (meta in instance_or_dict)]
instance = objects.Instance... | null | null | null | callers
| codeqa | def object compat function @functools wraps function def decorated function self context *args **kwargs def load instance instance or dict if isinstance instance or dict dict metas [meta for meta in 'metadata' 'system metadata' if meta in instance or dict ]instance objects Instance from db object context objects Instan... | null | null | null | null | Question:
What is passing old - style dict instances ?
Code:
def object_compat(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
def _load_instance(instance_or_dict):
if isinstance(instance_or_dict, dict):
metas = [meta for meta in ('metadata', 'system_metadata... |
null | null | null | How were the titles loaded ?
| @pytest.mark.parametrize('i, item', enumerate(ITEMS))
def test_titles(objects, i, item):
assert (objects.history.itemAt(i).title() == item.title)
| null | null | null | correctly
| codeqa | @pytest mark parametrize 'i item' enumerate ITEMS def test titles objects i item assert objects history item At i title item title
| null | null | null | null | Question:
How were the titles loaded ?
Code:
@pytest.mark.parametrize('i, item', enumerate(ITEMS))
def test_titles(objects, i, item):
assert (objects.history.itemAt(i).title() == item.title)
|
null | null | null | What does the code send to a socket ?
| def save_send(socket, data):
while (len(data) > 0):
try:
send_data_size = socket.send(data)
data = data[send_data_size:]
except error as msg:
sleep(0.01)
| null | null | null | data
| codeqa | def save send socket data while len data > 0 try send data size socket send data data data[send data size ]except error as msg sleep 0 01
| null | null | null | null | Question:
What does the code send to a socket ?
Code:
def save_send(socket, data):
while (len(data) > 0):
try:
send_data_size = socket.send(data)
data = data[send_data_size:]
except error as msg:
sleep(0.01)
|
null | null | null | What does the code replace with some other string ?
| def str_replace(arr, pat, repl, n=(-1), case=True, flags=0):
if (not (is_string_like(repl) or callable(repl))):
raise TypeError('repl must be a string or callable')
use_re = ((not case) or (len(pat) > 1) or flags or callable(repl))
if use_re:
if (not case):
flags |= re.IGNORECASE
regex = re.compile(pa... | null | null | null | occurrences of pattern / regex in the series / index
| codeqa | def str replace arr pat repl n -1 case True flags 0 if not is string like repl or callable repl raise Type Error 'replmustbeastringorcallable' use re not case or len pat > 1 or flags or callable repl if use re if not case flags re IGNORECAS Eregex re compile pat flags flags n n if n > 0 else 0 def f x return regex sub ... | null | null | null | null | Question:
What does the code replace with some other string ?
Code:
def str_replace(arr, pat, repl, n=(-1), case=True, flags=0):
if (not (is_string_like(repl) or callable(repl))):
raise TypeError('repl must be a string or callable')
use_re = ((not case) or (len(pat) > 1) or flags or callable(repl))
if us... |
null | null | null | What does the code take ?
| def MergeStandardOptions(options, params):
pass
| null | null | null | an options object generated by the command line
| codeqa | def Merge Standard Options options params pass
| null | null | null | null | Question:
What does the code take ?
Code:
def MergeStandardOptions(options, params):
pass
|
null | null | null | What returns a value between 0 and 1 ?
| @mock_autoscaling
def test_execute_policy_small_percent_change_in_capacity():
setup_autoscale_group()
conn = boto.connect_autoscale()
policy = ScalingPolicy(name=u'ScaleUp', adjustment_type=u'PercentChangeInCapacity', as_name=u'tester_group', scaling_adjustment=1)
conn.create_scaling_policy(policy)
conn.execute_po... | null | null | null | percentchangeincapacity
| codeqa | @mock autoscalingdef test execute policy small percent change in capacity setup autoscale group conn boto connect autoscale policy Scaling Policy name u' Scale Up' adjustment type u' Percent Change In Capacity' as name u'tester group' scaling adjustment 1 conn create scaling policy policy conn execute policy u' Scale U... | null | null | null | null | Question:
What returns a value between 0 and 1 ?
Code:
@mock_autoscaling
def test_execute_policy_small_percent_change_in_capacity():
setup_autoscale_group()
conn = boto.connect_autoscale()
policy = ScalingPolicy(name=u'ScaleUp', adjustment_type=u'PercentChangeInCapacity', as_name=u'tester_group', scaling_adjustm... |
null | null | null | What does the code get ?
| def sign_certificate():
LOGGER.info('Signing certificate...')
proc = subprocess.Popen(['openssl req -in /tmp/domain.csr -outform DER'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(csr_der, err) = proc.communicate()
(code, result) = _send_signed_request((DEFAULT_CA + '/acme/new-cert'), {'resou... | null | null | null | the new certificate
| codeqa | def sign certificate LOGGER info ' Signingcertificate ' proc subprocess Popen ['opensslreq-in/tmp/domain csr-outform DER'] stdout subprocess PIPE stderr subprocess PIPE shell True csr der err proc communicate code result send signed request DEFAULT CA + '/acme/new-cert' {'resource' 'new-cert' 'csr' b64 csr der } if cod... | null | null | null | null | Question:
What does the code get ?
Code:
def sign_certificate():
LOGGER.info('Signing certificate...')
proc = subprocess.Popen(['openssl req -in /tmp/domain.csr -outform DER'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
(csr_der, err) = proc.communicate()
(code, result) = _send_signed_req... |
null | null | null | What does a utility generator pad ?
| def _argsdicts(args, mydict):
if (len(args) == 0):
args = (None,)
elif (len(args) == 1):
args = _totuple(args[0])
else:
raise Exception('We should have never gotten here.')
mykeys = list(mydict.keys())
myvalues = list(map(_totuple, list(mydict.values())))
maxlength = max(list(map(len, ([args] + myvalue... | null | null | null | argument list and dictionary values
| codeqa | def argsdicts args mydict if len args 0 args None elif len args 1 args totuple args[ 0 ] else raise Exception ' Weshouldhavenevergottenhere ' mykeys list mydict keys myvalues list map totuple list mydict values maxlength max list map len [args] + myvalues for i in range maxlength thisdict {}for key value in zip mykeys ... | null | null | null | null | Question:
What does a utility generator pad ?
Code:
def _argsdicts(args, mydict):
if (len(args) == 0):
args = (None,)
elif (len(args) == 1):
args = _totuple(args[0])
else:
raise Exception('We should have never gotten here.')
mykeys = list(mydict.keys())
myvalues = list(map(_totuple, list(mydict.valu... |
null | null | null | What pads argument list and dictionary values ?
| def _argsdicts(args, mydict):
if (len(args) == 0):
args = (None,)
elif (len(args) == 1):
args = _totuple(args[0])
else:
raise Exception('We should have never gotten here.')
mykeys = list(mydict.keys())
myvalues = list(map(_totuple, list(mydict.values())))
maxlength = max(list(map(len, ([args] + myvalue... | null | null | null | a utility generator
| codeqa | def argsdicts args mydict if len args 0 args None elif len args 1 args totuple args[ 0 ] else raise Exception ' Weshouldhavenevergottenhere ' mykeys list mydict keys myvalues list map totuple list mydict values maxlength max list map len [args] + myvalues for i in range maxlength thisdict {}for key value in zip mykeys ... | null | null | null | null | Question:
What pads argument list and dictionary values ?
Code:
def _argsdicts(args, mydict):
if (len(args) == 0):
args = (None,)
elif (len(args) == 1):
args = _totuple(args[0])
else:
raise Exception('We should have never gotten here.')
mykeys = list(mydict.keys())
myvalues = list(map(_totuple, list... |
null | null | null | What do you want ?
| def add_task(queue_name, url, payload=None, **kws):
TaskQueue(queue_name).add(Task(url, payload, **kws))
| null | null | null | the task be added to
| codeqa | def add task queue name url payload None **kws Task Queue queue name add Task url payload **kws
| null | null | null | null | Question:
What do you want ?
Code:
def add_task(queue_name, url, payload=None, **kws):
TaskQueue(queue_name).add(Task(url, payload, **kws))
|
null | null | null | When do blob exist ?
| @pytest.fixture
def test_blob(cloud_config):
bucket = storage.Client().bucket(cloud_config.storage_bucket)
blob = bucket.blob('storage_snippets_test_sigil')
blob.upload_from_string("Hello, is it me you're looking for?")
return blob
| null | null | null | pre
| codeqa | @pytest fixturedef test blob cloud config bucket storage Client bucket cloud config storage bucket blob bucket blob 'storage snippets test sigil' blob upload from string " Hello isitmeyou'relookingfor?" return blob
| null | null | null | null | Question:
When do blob exist ?
Code:
@pytest.fixture
def test_blob(cloud_config):
bucket = storage.Client().bucket(cloud_config.storage_bucket)
blob = bucket.blob('storage_snippets_test_sigil')
blob.upload_from_string("Hello, is it me you're looking for?")
return blob
|
null | null | null | What matches one of the given globs ?
| def fnmatch(name, globs):
globs = ((globs,) if isinstance(globs, str) else tuple(globs))
if (len(globs) == 0):
return True
name = os.path.normcase(name)
return any((compiled_pattern.match(name) for glob in globs for compiled_pattern in _compile_pattern(glob)))
| null | null | null | name
| codeqa | def fnmatch name globs globs globs if isinstance globs str else tuple globs if len globs 0 return Truename os path normcase name return any compiled pattern match name for glob in globs for compiled pattern in compile pattern glob
| null | null | null | null | Question:
What matches one of the given globs ?
Code:
def fnmatch(name, globs):
globs = ((globs,) if isinstance(globs, str) else tuple(globs))
if (len(globs) == 0):
return True
name = os.path.normcase(name)
return any((compiled_pattern.match(name) for glob in globs for compiled_pattern in _compile_pattern(glo... |
null | null | null | What does name match ?
| def fnmatch(name, globs):
globs = ((globs,) if isinstance(globs, str) else tuple(globs))
if (len(globs) == 0):
return True
name = os.path.normcase(name)
return any((compiled_pattern.match(name) for glob in globs for compiled_pattern in _compile_pattern(glob)))
| null | null | null | one of the given globs
| codeqa | def fnmatch name globs globs globs if isinstance globs str else tuple globs if len globs 0 return Truename os path normcase name return any compiled pattern match name for glob in globs for compiled pattern in compile pattern glob
| null | null | null | null | Question:
What does name match ?
Code:
def fnmatch(name, globs):
globs = ((globs,) if isinstance(globs, str) else tuple(globs))
if (len(globs) == 0):
return True
name = os.path.normcase(name)
return any((compiled_pattern.match(name) for glob in globs for compiled_pattern in _compile_pattern(glob)))
|
null | null | null | What is containing on logs ?
| def migrate_guid_log(log):
for key in ['project', 'node']:
if (key in log.params):
value = (log.params[key] or '')
record = models.Node.load(value.lower())
if (record is not None):
log.params[key] = record._primary_key
if ('contributor' in log.params):
if isinstance(log.params['contributor'], basestr... | null | null | null | primary keys
| codeqa | def migrate guid log log for key in ['project' 'node'] if key in log params value log params[key] or '' record models Node load value lower if record is not None log params[key] record primary keyif 'contributor' in log params if isinstance log params['contributor'] basestring record models User load log params['contri... | null | null | null | null | Question:
What is containing on logs ?
Code:
def migrate_guid_log(log):
for key in ['project', 'node']:
if (key in log.params):
value = (log.params[key] or '')
record = models.Node.load(value.lower())
if (record is not None):
log.params[key] = record._primary_key
if ('contributor' in log.params):
... |
null | null | null | Where do primary keys contain ?
| def migrate_guid_log(log):
for key in ['project', 'node']:
if (key in log.params):
value = (log.params[key] or '')
record = models.Node.load(value.lower())
if (record is not None):
log.params[key] = record._primary_key
if ('contributor' in log.params):
if isinstance(log.params['contributor'], basestr... | null | null | null | on logs
| codeqa | def migrate guid log log for key in ['project' 'node'] if key in log params value log params[key] or '' record models Node load value lower if record is not None log params[key] record primary keyif 'contributor' in log params if isinstance log params['contributor'] basestring record models User load log params['contri... | null | null | null | null | Question:
Where do primary keys contain ?
Code:
def migrate_guid_log(log):
for key in ['project', 'node']:
if (key in log.params):
value = (log.params[key] or '')
record = models.Node.load(value.lower())
if (record is not None):
log.params[key] = record._primary_key
if ('contributor' in log.params)... |
null | null | null | What does the code remove from the pixel list ?
| def removeElementFromPixelListFromPoint(element, pixelDictionary, point):
stepKey = getStepKeyFromPoint(point)
removeElementFromListTable(element, stepKey, pixelDictionary)
| null | null | null | an element
| codeqa | def remove Element From Pixel List From Point element pixel Dictionary point step Key get Step Key From Point point remove Element From List Table element step Key pixel Dictionary
| null | null | null | null | Question:
What does the code remove from the pixel list ?
Code:
def removeElementFromPixelListFromPoint(element, pixelDictionary, point):
stepKey = getStepKeyFromPoint(point)
removeElementFromListTable(element, stepKey, pixelDictionary)
|
null | null | null | What does the code install if needed ?
| @task
def virtualenv_install():
prod_rev = latest_requirements_revision()
assert re.match('[0-9a-f]+', prod_rev)
active_env_rev = active_env()
if (prod_rev == active_env_rev):
assert virtualenv_verify(prod_rev), 'Active environment is not valid'
return
env_dir = ('env.%s' % prod_rev)
package_dir = ('pytho... | null | null | null | the latest virtual environment
| codeqa | @taskdef virtualenv install prod rev latest requirements revision assert re match '[ 0 - 9 a-f]+' prod rev active env rev active env if prod rev active env rev assert virtualenv verify prod rev ' Activeenvironmentisnotvalid'returnenv dir 'env %s' % prod rev package dir 'python-package %s' % prod rev requirements file '... | null | null | null | null | Question:
What does the code install if needed ?
Code:
@task
def virtualenv_install():
prod_rev = latest_requirements_revision()
assert re.match('[0-9a-f]+', prod_rev)
active_env_rev = active_env()
if (prod_rev == active_env_rev):
assert virtualenv_verify(prod_rev), 'Active environment is not valid'
ret... |
null | null | null | What does the code validate ?
| def validate(tax_number):
try:
verify_vat(tax_number)
return u'vat'
except VatCannotIdentifyValidationError:
pass
return u'unknown'
| null | null | null | a tax number
| codeqa | def validate tax number try verify vat tax number return u'vat'except Vat Cannot Identify Validation Error passreturn u'unknown'
| null | null | null | null | Question:
What does the code validate ?
Code:
def validate(tax_number):
try:
verify_vat(tax_number)
return u'vat'
except VatCannotIdentifyValidationError:
pass
return u'unknown'
|
null | null | null | How do a file or matching a list of patterns remove ?
| def recursive_rm(*patterns):
for (root, subdirs, subfiles) in os.walk('.'):
root = os.path.normpath(root)
if root.startswith('.git/'):
continue
for file in subfiles:
for pattern in patterns:
if fnmatch.fnmatch(file, pattern):
safe_remove(os.path.join(root, file))
for dir in subdirs:
for patte... | null | null | null | recursively
| codeqa | def recursive rm *patterns for root subdirs subfiles in os walk ' ' root os path normpath root if root startswith ' git/' continuefor file in subfiles for pattern in patterns if fnmatch fnmatch file pattern safe remove os path join root file for dir in subdirs for pattern in patterns if fnmatch fnmatch dir pattern safe... | null | null | null | null | Question:
How do a file or matching a list of patterns remove ?
Code:
def recursive_rm(*patterns):
for (root, subdirs, subfiles) in os.walk('.'):
root = os.path.normpath(root)
if root.startswith('.git/'):
continue
for file in subfiles:
for pattern in patterns:
if fnmatch.fnmatch(file, pattern):
... |
null | null | null | What downloads to filename ?
| def download_url(url, filename, headers):
ensure_dirs(filename)
response = requests.get(url, headers=headers, stream=True)
if (response.status_code == 200):
with open(filename, 'wb') as f:
for chunk in response.iter_content((16 * 1024)):
f.write(chunk)
| null | null | null | a file
| codeqa | def download url url filename headers ensure dirs filename response requests get url headers headers stream True if response status code 200 with open filename 'wb' as f for chunk in response iter content 16 * 1024 f write chunk
| null | null | null | null | Question:
What downloads to filename ?
Code:
def download_url(url, filename, headers):
ensure_dirs(filename)
response = requests.get(url, headers=headers, stream=True)
if (response.status_code == 200):
with open(filename, 'wb') as f:
for chunk in response.iter_content((16 * 1024)):
f.write(chunk)
|
null | null | null | What does the code delete ?
| def worker_destroy(context, **filters):
query = _worker_query(context, **filters)
return query.delete()
| null | null | null | a worker
| codeqa | def worker destroy context **filters query worker query context **filters return query delete
| null | null | null | null | Question:
What does the code delete ?
Code:
def worker_destroy(context, **filters):
query = _worker_query(context, **filters)
return query.delete()
|
null | null | null | For what purpose do gain matrix entries restrict ?
| def _restrict_gain_matrix(G, info):
if (not (len(info['chs']) == G.shape[0])):
raise ValueError(("G.shape[0] and length of info['chs'] do not match: %d != %d" % (G.shape[0], len(info['chs']))))
sel = pick_types(info, meg='grad', ref_meg=False, exclude=[])
if (len(sel) > 0):
G = G[sel]
logger.info((' ... | null | null | null | for optimal depth weighting
| codeqa | def restrict gain matrix G info if not len info['chs'] G shape[ 0 ] raise Value Error "G shape[ 0 ]andlengthofinfo['chs']donotmatch %d %d" % G shape[ 0 ] len info['chs'] sel pick types info meg 'grad' ref meg False exclude [] if len sel > 0 G G[sel]logger info '%dplanarchannels' % len sel else sel pick types info meg '... | null | null | null | null | Question:
For what purpose do gain matrix entries restrict ?
Code:
def _restrict_gain_matrix(G, info):
if (not (len(info['chs']) == G.shape[0])):
raise ValueError(("G.shape[0] and length of info['chs'] do not match: %d != %d" % (G.shape[0], len(info['chs']))))
sel = pick_types(info, meg='grad', ref_me... |
null | null | null | How do a worker update ?
| def worker_update(context, id, filters=None, orm_worker=None, **values):
filters = (filters or {})
query = _worker_query(context, id=id, **filters)
_worker_set_updated_at_field(values)
reference = (orm_worker or models.Worker)
values['race_preventer'] = (reference.race_preventer + 1)
result = query.update(values)... | null | null | null | with given values
| codeqa | def worker update context id filters None orm worker None **values filters filters or {} query worker query context id id **filters worker set updated at field values reference orm worker or models Worker values['race preventer'] reference race preventer + 1 result query update values if not result raise exception Work... | null | null | null | null | Question:
How do a worker update ?
Code:
def worker_update(context, id, filters=None, orm_worker=None, **values):
filters = (filters or {})
query = _worker_query(context, id=id, **filters)
_worker_set_updated_at_field(values)
reference = (orm_worker or models.Worker)
values['race_preventer'] = (reference.race_... |
null | null | null | What does the code create from a list of tracks ?
| def get_id_pairs(track_list):
return [(t[u'id'], t.get(u'playlistEntryId')) for t in track_list]
| null | null | null | a list of tuples
| codeqa | def get id pairs track list return [ t[u'id'] t get u'playlist Entry Id' for t in track list]
| null | null | null | null | Question:
What does the code create from a list of tracks ?
Code:
def get_id_pairs(track_list):
return [(t[u'id'], t.get(u'playlistEntryId')) for t in track_list]
|
null | null | null | What does the code get ?
| def get_storage_users(storage_path):
LOCK_PATH = os.path.join(CONF.instances_path, 'locks')
@utils.synchronized('storage-registry-lock', external=True, lock_path=LOCK_PATH)
def do_get_storage_users(storage_path):
d = {}
id_path = os.path.join(storage_path, 'compute_nodes')
if os.path.exists(id_path):
with o... | null | null | null | a list of all the users of this storage path
| codeqa | def get storage users storage path LOCK PATH os path join CONF instances path 'locks' @utils synchronized 'storage-registry-lock' external True lock path LOCK PATH def do get storage users storage path d {}id path os path join storage path 'compute nodes' if os path exists id path with open id path as f try d jsonutils... | null | null | null | null | Question:
What does the code get ?
Code:
def get_storage_users(storage_path):
LOCK_PATH = os.path.join(CONF.instances_path, 'locks')
@utils.synchronized('storage-registry-lock', external=True, lock_path=LOCK_PATH)
def do_get_storage_users(storage_path):
d = {}
id_path = os.path.join(storage_path, 'compute_no... |
null | null | null | What can parameters take ?
| def coerce_to_list(val):
if val:
if (not isinstance(val, (list, tuple))):
val = [val]
else:
val = []
return val
| null | null | null | either a single string or a list of strings
| codeqa | def coerce to list val if val if not isinstance val list tuple val [val]else val []return val
| null | null | null | null | Question:
What can parameters take ?
Code:
def coerce_to_list(val):
if val:
if (not isinstance(val, (list, tuple))):
val = [val]
else:
val = []
return val
|
null | null | null | What can take either a single string or a list of strings ?
| def coerce_to_list(val):
if val:
if (not isinstance(val, (list, tuple))):
val = [val]
else:
val = []
return val
| null | null | null | parameters
| codeqa | def coerce to list val if val if not isinstance val list tuple val [val]else val []return val
| null | null | null | null | Question:
What can take either a single string or a list of strings ?
Code:
def coerce_to_list(val):
if val:
if (not isinstance(val, (list, tuple))):
val = [val]
else:
val = []
return val
|
null | null | null | What does the code take as a path on a client ?
| def InterpolatePath(path, client, users=None, path_args=None, depth=0):
sys_formatters = {'systemroot': 'c:\\Windows'}
if path_args:
sys_formatters.update(path_args)
if users:
results = []
for user in users:
user = GetUserInfo(client, user)
if user:
formatters = dict(((x.name, y) for (x, y) in user.L... | null | null | null | a string
| codeqa | def Interpolate Path path client users None path args None depth 0 sys formatters {'systemroot' 'c \\ Windows'}if path args sys formatters update path args if users results []for user in users user Get User Info client user if user formatters dict x name y for x y in user List Set Fields formatters update sys formatter... | null | null | null | null | Question:
What does the code take as a path on a client ?
Code:
def InterpolatePath(path, client, users=None, path_args=None, depth=0):
sys_formatters = {'systemroot': 'c:\\Windows'}
if path_args:
sys_formatters.update(path_args)
if users:
results = []
for user in users:
user = GetUserInfo(client, user)... |
null | null | null | What does the code insert ?
| def simplefilter(action, category=Warning, lineno=0, append=0):
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert (isinstance(lineno, int) and (lineno >= 0)), 'lineno must be an int >= 0'
item = (action, None, category, None, lineno)
if ... | null | null | null | a simple entry into the list of warnings filters
| codeqa | def simplefilter action category Warning lineno 0 append 0 assert action in 'error' 'ignore' 'always' 'default' 'module' 'once' 'invalidaction %r' % action assert isinstance lineno int and lineno > 0 'linenomustbeanint> 0'item action None category None lineno if append filters append item else filters insert 0 item
| null | null | null | null | Question:
What does the code insert ?
Code:
def simplefilter(action, category=Warning, lineno=0, append=0):
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert (isinstance(lineno, int) and (lineno >= 0)), 'lineno must be an int >= 0'
it... |
null | null | null | How does the code get vector3 vertexes from attribute dictionary ?
| def getGeometryOutputByArguments(arguments, xmlElement):
evaluate.setAttributeDictionaryByArguments(['radius', 'sides'], arguments, xmlElement)
return getGeometryOutput(None, xmlElement)
| null | null | null | by arguments
| codeqa | def get Geometry Output By Arguments arguments xml Element evaluate set Attribute Dictionary By Arguments ['radius' 'sides'] arguments xml Element return get Geometry Output None xml Element
| null | null | null | null | Question:
How does the code get vector3 vertexes from attribute dictionary ?
Code:
def getGeometryOutputByArguments(arguments, xmlElement):
evaluate.setAttributeDictionaryByArguments(['radius', 'sides'], arguments, xmlElement)
return getGeometryOutput(None, xmlElement)
|
null | null | null | What does the code get from attribute dictionary by arguments ?
| def getGeometryOutputByArguments(arguments, xmlElement):
evaluate.setAttributeDictionaryByArguments(['radius', 'sides'], arguments, xmlElement)
return getGeometryOutput(None, xmlElement)
| null | null | null | vector3 vertexes
| codeqa | def get Geometry Output By Arguments arguments xml Element evaluate set Attribute Dictionary By Arguments ['radius' 'sides'] arguments xml Element return get Geometry Output None xml Element
| null | null | null | null | Question:
What does the code get from attribute dictionary by arguments ?
Code:
def getGeometryOutputByArguments(arguments, xmlElement):
evaluate.setAttributeDictionaryByArguments(['radius', 'sides'], arguments, xmlElement)
return getGeometryOutput(None, xmlElement)
|
null | null | null | What has the expected default value ?
| def verifyConstructorArgument(testCase, cls, argName, defaultVal, altVal, attrName=None):
if (attrName is None):
attrName = argName
actual = {}
expected = {'defaultVal': defaultVal, 'altVal': altVal}
o = cls()
actual['defaultVal'] = getattr(o, attrName)
o = cls(**{argName: altVal})
actual['altVal'] = getattr(o... | null | null | null | an attribute
| codeqa | def verify Constructor Argument test Case cls arg Name default Val alt Val attr Name None if attr Name is None attr Name arg Nameactual {}expected {'default Val' default Val 'alt Val' alt Val}o cls actual['default Val'] getattr o attr Name o cls **{arg Name alt Val} actual['alt Val'] getattr o attr Name test Case asser... | null | null | null | null | Question:
What has the expected default value ?
Code:
def verifyConstructorArgument(testCase, cls, argName, defaultVal, altVal, attrName=None):
if (attrName is None):
attrName = argName
actual = {}
expected = {'defaultVal': defaultVal, 'altVal': altVal}
o = cls()
actual['defaultVal'] = getattr(o, attrName)
... |
null | null | null | What does the code set for generating random numbers ?
| def manual_seed(seed):
return default_generator.manual_seed(seed)
| null | null | null | the seed
| codeqa | def manual seed seed return default generator manual seed seed
| null | null | null | null | Question:
What does the code set for generating random numbers ?
Code:
def manual_seed(seed):
return default_generator.manual_seed(seed)
|
null | null | null | What does the code get ?
| def loggers():
root = logging.root
existing = root.manager.loggerDict.keys()
return [logging.getLogger(name) for name in existing]
| null | null | null | list of all loggers
| codeqa | def loggers root logging rootexisting root manager logger Dict keys return [logging get Logger name for name in existing]
| null | null | null | null | Question:
What does the code get ?
Code:
def loggers():
root = logging.root
existing = root.manager.loggerDict.keys()
return [logging.getLogger(name) for name in existing]
|
null | null | null | What can user view ?
| @cache_permission
def can_add_translation(user, project):
return check_permission(user, project, 'trans.add_translation')
| null | null | null | reports on given project
| codeqa | @cache permissiondef can add translation user project return check permission user project 'trans add translation'
| null | null | null | null | Question:
What can user view ?
Code:
@cache_permission
def can_add_translation(user, project):
return check_permission(user, project, 'trans.add_translation')
|
null | null | null | For what purpose does decorator add headers to a response ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_func))(_wrapped_view_func)
| null | null | null | so that it will never be cached
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wraps view func assigned available attrs view func wrapped view func
| null | null | null | null | Question:
For what purpose does decorator add headers to a response ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_fun... |
null | null | null | What adds headers to a response so that it will never be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_func))(_wrapped_view_func)
| null | null | null | decorator
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wraps view func assigned available attrs view func wrapped view func
| null | null | null | null | Question:
What adds headers to a response so that it will never be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(vi... |
null | null | null | When will it be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_func))(_wrapped_view_func)
| null | null | null | never
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wraps view func assigned available attrs view func wrapped view func
| null | null | null | null | Question:
When will it be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_func))(_wrapped_view_func)
|
null | null | null | What does decorator add to a response so that it will never be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_attrs(view_func))(_wrapped_view_func)
| null | null | null | headers
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wraps view func assigned available attrs view func wrapped view func
| null | null | null | null | Question:
What does decorator add to a response so that it will never be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return wraps(view_func, assigned=available_at... |
null | null | null | What d the code generate ?
| def id_to_path(pk):
pk = unicode(pk)
path = [pk[(-1)]]
if (len(pk) >= 2):
path.append(pk[(-2):])
else:
path.append(pk)
path.append(pk)
return os.path.join(*path)
| null | null | null | a path from an i d
| codeqa | def id to path pk pk unicode pk path [pk[ -1 ]]if len pk > 2 path append pk[ -2 ] else path append pk path append pk return os path join *path
| null | null | null | null | Question:
What d the code generate ?
Code:
def id_to_path(pk):
pk = unicode(pk)
path = [pk[(-1)]]
if (len(pk) >= 2):
path.append(pk[(-2):])
else:
path.append(pk)
path.append(pk)
return os.path.join(*path)
|
null | null | null | What does the code remove ?
| def removeCSVFile(csvFilePath):
if (('alterations' in csvFilePath) and ('example_' not in csvFilePath)):
os.remove(csvFilePath)
print ('removeGeneratedFiles deleted ' + csvFilePath)
| null | null | null | csv file
| codeqa | def remove CSV File csv File Path if 'alterations' in csv File Path and 'example ' not in csv File Path os remove csv File Path print 'remove Generated Filesdeleted' + csv File Path
| null | null | null | null | Question:
What does the code remove ?
Code:
def removeCSVFile(csvFilePath):
if (('alterations' in csvFilePath) and ('example_' not in csvFilePath)):
os.remove(csvFilePath)
print ('removeGeneratedFiles deleted ' + csvFilePath)
|
null | null | null | What does the code delete ?
| @csrf_protect
@permission_required('comments.can_moderate')
def delete(request, comment_id, next=None):
comment = get_object_or_404(comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID)
if (request.method == 'POST'):
perform_delete(request, comment)
return next_redirect(request.POST.copy(), next, delete... | null | null | null | a comment
| codeqa | @csrf protect@permission required 'comments can moderate' def delete request comment id next None comment get object or 404 comments get model pk comment id site pk settings SITE ID if request method 'POST' perform delete request comment return next redirect request POST copy next delete done c comment pk else return r... | null | null | null | null | Question:
What does the code delete ?
Code:
@csrf_protect
@permission_required('comments.can_moderate')
def delete(request, comment_id, next=None):
comment = get_object_or_404(comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID)
if (request.method == 'POST'):
perform_delete(request, comment)
return... |
null | null | null | How do dictionary of successors return ?
| def dfs_successors(G, source=None):
d = defaultdict(list)
for (s, t) in dfs_edges(G, source=source):
d[s].append(t)
return dict(d)
| null | null | null | in depth - first - search from source
| codeqa | def dfs successors G source None d defaultdict list for s t in dfs edges G source source d[s] append t return dict d
| null | null | null | null | Question:
How do dictionary of successors return ?
Code:
def dfs_successors(G, source=None):
d = defaultdict(list)
for (s, t) in dfs_edges(G, source=source):
d[s].append(t)
return dict(d)
|
null | null | null | For what purpose do hashed password generate ?
| def passwd(passphrase=None, algorithm='sha1'):
if (passphrase is None):
for i in range(3):
p0 = getpass.getpass('Enter password: ')
p1 = getpass.getpass('Verify password: ')
if (p0 == p1):
passphrase = p0
break
else:
print 'Passwords do not match.'
else:
raise UsageError('No matc... | null | null | null | for use in notebook configuration
| codeqa | def passwd passphrase None algorithm 'sha 1 ' if passphrase is None for i in range 3 p0 getpass getpass ' Enterpassword ' p1 getpass getpass ' Verifypassword ' if p0 p1 passphrase p0 breakelse print ' Passwordsdonotmatch 'else raise Usage Error ' Nomatchingpasswordsfound Givingup ' h hashlib new algorithm salt '% 0 ' +... | null | null | null | null | Question:
For what purpose do hashed password generate ?
Code:
def passwd(passphrase=None, algorithm='sha1'):
if (passphrase is None):
for i in range(3):
p0 = getpass.getpass('Enter password: ')
p1 = getpass.getpass('Verify password: ')
if (p0 == p1):
passphrase = p0
break
else:
print... |
null | null | null | What declares a class to be a notification listener ?
| def listener(cls):
def init_wrapper(init):
@functools.wraps(init)
def __new_init__(self, *args, **kwargs):
init(self, *args, **kwargs)
_register_event_callbacks(self)
return __new_init__
def _register_event_callbacks(self):
for (event, resource_types) in self.event_callbacks.items():
for (resource_ty... | null | null | null | a class decorator
| codeqa | def listener cls def init wrapper init @functools wraps init def new init self *args **kwargs init self *args **kwargs register event callbacks self return new init def register event callbacks self for event resource types in self event callbacks items for resource type callbacks in resource types items register event... | null | null | null | null | Question:
What declares a class to be a notification listener ?
Code:
def listener(cls):
def init_wrapper(init):
@functools.wraps(init)
def __new_init__(self, *args, **kwargs):
init(self, *args, **kwargs)
_register_event_callbacks(self)
return __new_init__
def _register_event_callbacks(self):
for (e... |
null | null | null | What do a class decorator declare ?
| def listener(cls):
def init_wrapper(init):
@functools.wraps(init)
def __new_init__(self, *args, **kwargs):
init(self, *args, **kwargs)
_register_event_callbacks(self)
return __new_init__
def _register_event_callbacks(self):
for (event, resource_types) in self.event_callbacks.items():
for (resource_ty... | null | null | null | a class to be a notification listener
| codeqa | def listener cls def init wrapper init @functools wraps init def new init self *args **kwargs init self *args **kwargs register event callbacks self return new init def register event callbacks self for event resource types in self event callbacks items for resource type callbacks in resource types items register event... | null | null | null | null | Question:
What do a class decorator declare ?
Code:
def listener(cls):
def init_wrapper(init):
@functools.wraps(init)
def __new_init__(self, *args, **kwargs):
init(self, *args, **kwargs)
_register_event_callbacks(self)
return __new_init__
def _register_event_callbacks(self):
for (event, resource_typ... |
null | null | null | What contain a substring ?
| def apropos(key):
def callback(path, modname, desc):
if (modname[(-9):] == '.__init__'):
modname = (modname[:(-9)] + ' (package)')
print modname, (desc and ('- ' + desc))
def onerror(modname):
pass
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
ModuleScanner().run(callback, key, one... | null | null | null | all the one - line module summaries
| codeqa | def apropos key def callback path modname desc if modname[ -9 ] ' init ' modname modname[ -9 ] + ' package ' print modname desc and '-' + desc def onerror modname passwith warnings catch warnings warnings filterwarnings 'ignore' Module Scanner run callback key onerror onerror
| null | null | null | null | Question:
What contain a substring ?
Code:
def apropos(key):
def callback(path, modname, desc):
if (modname[(-9):] == '.__init__'):
modname = (modname[:(-9)] + ' (package)')
print modname, (desc and ('- ' + desc))
def onerror(modname):
pass
with warnings.catch_warnings():
warnings.filterwarnings('ig... |
null | null | null | What do all the one - line module summaries contain ?
| def apropos(key):
def callback(path, modname, desc):
if (modname[(-9):] == '.__init__'):
modname = (modname[:(-9)] + ' (package)')
print modname, (desc and ('- ' + desc))
def onerror(modname):
pass
with warnings.catch_warnings():
warnings.filterwarnings('ignore')
ModuleScanner().run(callback, key, one... | null | null | null | a substring
| codeqa | def apropos key def callback path modname desc if modname[ -9 ] ' init ' modname modname[ -9 ] + ' package ' print modname desc and '-' + desc def onerror modname passwith warnings catch warnings warnings filterwarnings 'ignore' Module Scanner run callback key onerror onerror
| null | null | null | null | Question:
What do all the one - line module summaries contain ?
Code:
def apropos(key):
def callback(path, modname, desc):
if (modname[(-9):] == '.__init__'):
modname = (modname[:(-9)] + ' (package)')
print modname, (desc and ('- ' + desc))
def onerror(modname):
pass
with warnings.catch_warnings():
... |
null | null | null | What does the code install ?
| def install_pip(python_cmd='python', use_sudo=True):
with cd('/tmp'):
download(GET_PIP_URL)
command = ('%(python_cmd)s get-pip.py' % locals())
if use_sudo:
run_as_root(command, pty=False)
else:
run(command, pty=False)
run('rm -f get-pip.py')
| null | null | null | the latest version of pip
| codeqa | def install pip python cmd 'python' use sudo True with cd '/tmp' download GET PIP URL command '% python cmd sget-pip py' % locals if use sudo run as root command pty False else run command pty False run 'rm-fget-pip py'
| null | null | null | null | Question:
What does the code install ?
Code:
def install_pip(python_cmd='python', use_sudo=True):
with cd('/tmp'):
download(GET_PIP_URL)
command = ('%(python_cmd)s get-pip.py' % locals())
if use_sudo:
run_as_root(command, pty=False)
else:
run(command, pty=False)
run('rm -f get-pip.py')
|
null | null | null | What does the code run ?
| def do(cls, *args, **opts):
return do_cmd(cls(*args, **opts))
| null | null | null | a command in - place
| codeqa | def do cls *args **opts return do cmd cls *args **opts
| null | null | null | null | Question:
What does the code run ?
Code:
def do(cls, *args, **opts):
return do_cmd(cls(*args, **opts))
|
null | null | null | What does the code get ?
| def get_object_properties(vim, collector, mobj, type, properties):
client_factory = vim.client.factory
if (mobj is None):
return None
usecoll = collector
if (usecoll is None):
usecoll = vim.get_service_content().propertyCollector
property_filter_spec = client_factory.create('ns0:PropertyFilterSpec')
property_... | null | null | null | the properties of the managed object specified
| codeqa | def get object properties vim collector mobj type properties client factory vim client factoryif mobj is None return Noneusecoll collectorif usecoll is None usecoll vim get service content property Collectorproperty filter spec client factory create 'ns 0 Property Filter Spec' property spec client factory create 'ns 0 ... | null | null | null | null | Question:
What does the code get ?
Code:
def get_object_properties(vim, collector, mobj, type, properties):
client_factory = vim.client.factory
if (mobj is None):
return None
usecoll = collector
if (usecoll is None):
usecoll = vim.get_service_content().propertyCollector
property_filter_spec = client_factor... |
null | null | null | What does the code generate ?
| def rand_int_id(start=0, end=2147483647):
return random.randint(start, end)
| null | null | null | a random integer value
| codeqa | def rand int id start 0 end 2147483647 return random randint start end
| null | null | null | null | Question:
What does the code generate ?
Code:
def rand_int_id(start=0, end=2147483647):
return random.randint(start, end)
|
null | null | null | What gets < spider > ?
| def cmd_get_spider_stats(args, opts):
stats = jsonrpc_call(opts, 'stats', 'get_stats', args[0])
for (name, value) in stats.items():
print(('%-40s %s' % (name, value)))
| null | null | null | stats
| codeqa | def cmd get spider stats args opts stats jsonrpc call opts 'stats' 'get stats' args[ 0 ] for name value in stats items print '%- 40 s%s' % name value
| null | null | null | null | Question:
What gets < spider > ?
Code:
def cmd_get_spider_stats(args, opts):
stats = jsonrpc_call(opts, 'stats', 'get_stats', args[0])
for (name, value) in stats.items():
print(('%-40s %s' % (name, value)))
|
null | null | null | What do stats get ?
| def cmd_get_spider_stats(args, opts):
stats = jsonrpc_call(opts, 'stats', 'get_stats', args[0])
for (name, value) in stats.items():
print(('%-40s %s' % (name, value)))
| null | null | null | < spider >
| codeqa | def cmd get spider stats args opts stats jsonrpc call opts 'stats' 'get stats' args[ 0 ] for name value in stats items print '%- 40 s%s' % name value
| null | null | null | null | Question:
What do stats get ?
Code:
def cmd_get_spider_stats(args, opts):
stats = jsonrpc_call(opts, 'stats', 'get_stats', args[0])
for (name, value) in stats.items():
print(('%-40s %s' % (name, value)))
|
null | null | null | Where does the code delete an email ?
| def delete_sent_email(crispin_client, account_id, message_id, args):
message_id_header = args.get('message_id_header')
assert message_id_header, 'Need the message_id_header'
remote_delete_sent(crispin_client, account_id, message_id_header)
| null | null | null | on the remote backend
| codeqa | def delete sent email crispin client account id message id args message id header args get 'message id header' assert message id header ' Needthemessage id header'remote delete sent crispin client account id message id header
| null | null | null | null | Question:
Where does the code delete an email ?
Code:
def delete_sent_email(crispin_client, account_id, message_id, args):
message_id_header = args.get('message_id_header')
assert message_id_header, 'Need the message_id_header'
remote_delete_sent(crispin_client, account_id, message_id_header)
|
null | null | null | What does the code delete on the remote backend ?
| def delete_sent_email(crispin_client, account_id, message_id, args):
message_id_header = args.get('message_id_header')
assert message_id_header, 'Need the message_id_header'
remote_delete_sent(crispin_client, account_id, message_id_header)
| null | null | null | an email
| codeqa | def delete sent email crispin client account id message id args message id header args get 'message id header' assert message id header ' Needthemessage id header'remote delete sent crispin client account id message id header
| null | null | null | null | Question:
What does the code delete on the remote backend ?
Code:
def delete_sent_email(crispin_client, account_id, message_id, args):
message_id_header = args.get('message_id_header')
assert message_id_header, 'Need the message_id_header'
remote_delete_sent(crispin_client, account_id, message_id_header)
|
null | null | null | What has the given permissions for the group ?
| def has_user_permission_for_group_or_org(group_id, user_name, permission):
if (not group_id):
return False
group = model.Group.get(group_id)
if (not group):
return False
group_id = group.id
if is_sysadmin(user_name):
return True
user_id = get_user_id_for_username(user_name, allow_none=True)
if (not user_id... | null | null | null | the user
| codeqa | def has user permission for group or org group id user name permission if not group id return Falsegroup model Group get group id if not group return Falsegroup id group idif is sysadmin user name return Trueuser id get user id for username user name allow none True if not user id return Falseif has user permission for... | null | null | null | null | Question:
What has the given permissions for the group ?
Code:
def has_user_permission_for_group_or_org(group_id, user_name, permission):
if (not group_id):
return False
group = model.Group.get(group_id)
if (not group):
return False
group_id = group.id
if is_sysadmin(user_name):
return True
user_id = ge... |
null | null | null | What does the code get ?
| def libvlc_media_player_get_chapter_count(p_mi):
f = (_Cfunctions.get('libvlc_media_player_get_chapter_count', None) or _Cfunction('libvlc_media_player_get_chapter_count', ((1,),), None, ctypes.c_int, MediaPlayer))
return f(p_mi)
| null | null | null | movie chapter count
| codeqa | def libvlc media player get chapter count p mi f Cfunctions get 'libvlc media player get chapter count' None or Cfunction 'libvlc media player get chapter count' 1 None ctypes c int Media Player return f p mi
| null | null | null | null | Question:
What does the code get ?
Code:
def libvlc_media_player_get_chapter_count(p_mi):
f = (_Cfunctions.get('libvlc_media_player_get_chapter_count', None) or _Cfunction('libvlc_media_player_get_chapter_count', ((1,),), None, ctypes.c_int, MediaPlayer))
return f(p_mi)
|
null | null | null | What does the code get for instance ?
| @require_context
@require_instance_exists_using_uuid
def virtual_interface_get_by_instance(context, instance_uuid):
vif_refs = _virtual_interface_query(context).filter_by(instance_uuid=instance_uuid).all()
return vif_refs
| null | null | null | all virtual interfaces
| codeqa | @require context@require instance exists using uuiddef virtual interface get by instance context instance uuid vif refs virtual interface query context filter by instance uuid instance uuid all return vif refs
| null | null | null | null | Question:
What does the code get for instance ?
Code:
@require_context
@require_instance_exists_using_uuid
def virtual_interface_get_by_instance(context, instance_uuid):
vif_refs = _virtual_interface_query(context).filter_by(instance_uuid=instance_uuid).all()
return vif_refs
|
null | null | null | What skips test if condition is false ?
| def skip_unless(condition, msg=None):
return skip_if((not condition), msg)
| null | null | null | decorator
| codeqa | def skip unless condition msg None return skip if not condition msg
| null | null | null | null | Question:
What skips test if condition is false ?
Code:
def skip_unless(condition, msg=None):
return skip_if((not condition), msg)
|
null | null | null | What do decorator skip if condition is false ?
| def skip_unless(condition, msg=None):
return skip_if((not condition), msg)
| null | null | null | test
| codeqa | def skip unless condition msg None return skip if not condition msg
| null | null | null | null | Question:
What do decorator skip if condition is false ?
Code:
def skip_unless(condition, msg=None):
return skip_if((not condition), msg)
|
null | null | null | What does the code remove ?
| def unlink(graph, node1, node2=None):
if (not isinstance(node1, Node)):
node1 = graph[node1]
if ((not isinstance(node2, Node)) and (node2 is not None)):
node2 = graph[node2]
for e in list(graph.edges):
if ((node1 in (e.node1, e.node2)) and (node2 in (e.node1, e.node2, None))):
graph.edges.remove(e)
try:
... | null | null | null | the edges between node1 and node2
| codeqa | def unlink graph node 1 node 2 None if not isinstance node 1 Node node 1 graph[node 1 ]if not isinstance node 2 Node and node 2 is not None node 2 graph[node 2 ]for e in list graph edges if node 1 in e node 1 e node 2 and node 2 in e node 1 e node 2 None graph edges remove e try node 1 links remove node 2 node 2 links ... | null | null | null | null | Question:
What does the code remove ?
Code:
def unlink(graph, node1, node2=None):
if (not isinstance(node1, Node)):
node1 = graph[node1]
if ((not isinstance(node2, Node)) and (node2 is not None)):
node2 = graph[node2]
for e in list(graph.edges):
if ((node1 in (e.node1, e.node2)) and (node2 in (e.node1, e.n... |
null | null | null | What represents a none value ?
| def is_none_string(val):
if (not isinstance(val, six.string_types)):
return False
return (val.lower() == 'none')
| null | null | null | a string
| codeqa | def is none string val if not isinstance val six string types return Falsereturn val lower 'none'
| null | null | null | null | Question:
What represents a none value ?
Code:
def is_none_string(val):
if (not isinstance(val, six.string_types)):
return False
return (val.lower() == 'none')
|
null | null | null | What do a string represent ?
| def is_none_string(val):
if (not isinstance(val, six.string_types)):
return False
return (val.lower() == 'none')
| null | null | null | a none value
| codeqa | def is none string val if not isinstance val six string types return Falsereturn val lower 'none'
| null | null | null | null | Question:
What do a string represent ?
Code:
def is_none_string(val):
if (not isinstance(val, six.string_types)):
return False
return (val.lower() == 'none')
|
null | null | null | What does the code get from paths ?
| def getGeometryOutput(derivation, elementNode):
if (derivation == None):
derivation = LineationDerivation(elementNode)
geometryOutput = []
for path in derivation.target:
sideLoop = SideLoop(path)
geometryOutput += getGeometryOutputByLoop(elementNode, sideLoop)
return geometryOutput
| null | null | null | geometry output
| codeqa | def get Geometry Output derivation element Node if derivation None derivation Lineation Derivation element Node geometry Output []for path in derivation target side Loop Side Loop path geometry Output + get Geometry Output By Loop element Node side Loop return geometry Output
| null | null | null | null | Question:
What does the code get from paths ?
Code:
def getGeometryOutput(derivation, elementNode):
if (derivation == None):
derivation = LineationDerivation(elementNode)
geometryOutput = []
for path in derivation.target:
sideLoop = SideLoop(path)
geometryOutput += getGeometryOutputByLoop(elementNode, side... |
null | null | null | When do value convert to number ?
| def typedvalue(value):
try:
return int(value)
except ValueError:
pass
try:
return float(value)
except ValueError:
pass
return value
| null | null | null | whenever possible
| codeqa | def typedvalue value try return int value except Value Error passtry return float value except Value Error passreturn value
| null | null | null | null | Question:
When do value convert to number ?
Code:
def typedvalue(value):
try:
return int(value)
except ValueError:
pass
try:
return float(value)
except ValueError:
pass
return value
|
null | null | null | What does the code get for project ?
| def fetch_crl(project_id):
if (not CONF.crypto.use_project_ca):
project_id = None
crl_file_path = crl_path(project_id)
if (not os.path.exists(crl_file_path)):
raise exception.CryptoCRLFileNotFound(project=project_id)
with open(crl_file_path, 'r') as crlfile:
return crlfile.read()
| null | null | null | crl file
| codeqa | def fetch crl project id if not CONF crypto use project ca project id Nonecrl file path crl path project id if not os path exists crl file path raise exception Crypto CRL File Not Found project project id with open crl file path 'r' as crlfile return crlfile read
| null | null | null | null | Question:
What does the code get for project ?
Code:
def fetch_crl(project_id):
if (not CONF.crypto.use_project_ca):
project_id = None
crl_file_path = crl_path(project_id)
if (not os.path.exists(crl_file_path)):
raise exception.CryptoCRLFileNotFound(project=project_id)
with open(crl_file_path, 'r') as crlfi... |
null | null | null | What does the code return ?
| def _getLastMessageFormated(acc):
m = _getLastMessage(acc)
if (m is None):
return 'None'
t = datetime.datetime.fromtimestamp(m[0]).strftime('%Y-%m-%d %H:%M')
return u'{}: {}'.format(t, m[1])
| null | null | null | the last message
| codeqa | def get Last Message Formated acc m get Last Message acc if m is None return ' None't datetime datetime fromtimestamp m[ 0 ] strftime '%Y-%m-%d%H %M' return u'{} {}' format t m[ 1 ]
| null | null | null | null | Question:
What does the code return ?
Code:
def _getLastMessageFormated(acc):
m = _getLastMessage(acc)
if (m is None):
return 'None'
t = datetime.datetime.fromtimestamp(m[0]).strftime('%Y-%m-%d %H:%M')
return u'{}: {}'.format(t, m[1])
|
null | null | null | What does the code create ?
| def LocalGroup(uname=None):
level = 3
if (uname is None):
uname = win32api.GetUserName()
if (uname.find('\\') < 0):
uname = ((win32api.GetDomainName() + '\\') + uname)
group = 'python_test_group'
try:
win32net.NetLocalGroupDel(server, group)
print "WARNING: existing local group '%s' has been deleted... | null | null | null | a local group
| codeqa | def Local Group uname None level 3if uname is None uname win 32 api Get User Name if uname find '\\' < 0 uname win 32 api Get Domain Name + '\\' + uname group 'python test group'try win 32 net Net Local Group Del server group print "WARNING existinglocalgroup'%s'hasbeendeleted "except win 32 net error passgroup data {'... | null | null | null | null | Question:
What does the code create ?
Code:
def LocalGroup(uname=None):
level = 3
if (uname is None):
uname = win32api.GetUserName()
if (uname.find('\\') < 0):
uname = ((win32api.GetDomainName() + '\\') + uname)
group = 'python_test_group'
try:
win32net.NetLocalGroupDel(server, group)
print "WARNING: ... |
null | null | null | What is available on this system ?
| def has_pbzip2():
try:
os_dep.command('pbzip2')
except ValueError:
return False
return True
| null | null | null | parallel bzip2
| codeqa | def has pbzip 2 try os dep command 'pbzip 2 ' except Value Error return Falsereturn True
| null | null | null | null | Question:
What is available on this system ?
Code:
def has_pbzip2():
try:
os_dep.command('pbzip2')
except ValueError:
return False
return True
|
null | null | null | Where is parallel bzip2 available ?
| def has_pbzip2():
try:
os_dep.command('pbzip2')
except ValueError:
return False
return True
| null | null | null | on this system
| codeqa | def has pbzip 2 try os dep command 'pbzip 2 ' except Value Error return Falsereturn True
| null | null | null | null | Question:
Where is parallel bzip2 available ?
Code:
def has_pbzip2():
try:
os_dep.command('pbzip2')
except ValueError:
return False
return True
|
null | null | null | What does the code write ?
| def write_cache_entry(f, entry):
beginoffset = f.tell()
(name, ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) = entry
write_cache_time(f, ctime)
write_cache_time(f, mtime)
flags = (len(name) | (flags & (~ 4095)))
f.write(struct.pack('>LLLLLL20sH', (dev & 4294967295), (ino & 4294967295), mode, uid, gid,... | null | null | null | an index entry to a file
| codeqa | def write cache entry f entry beginoffset f tell name ctime mtime dev ino mode uid gid size sha flags entrywrite cache time f ctime write cache time f mtime flags len name flags & ~ 4095 f write struct pack '>LLLLLL 20 s H' dev & 4294967295 ino & 4294967295 mode uid gid size hex to sha sha flags f write name real size ... | null | null | null | null | Question:
What does the code write ?
Code:
def write_cache_entry(f, entry):
beginoffset = f.tell()
(name, ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags) = entry
write_cache_time(f, ctime)
write_cache_time(f, mtime)
flags = (len(name) | (flags & (~ 4095)))
f.write(struct.pack('>LLLLLL20sH', (dev & 4... |
null | null | null | What does the code get from the user ?
| def prompt(message=u'', **kwargs):
patch_stdout = kwargs.pop(u'patch_stdout', False)
return_asyncio_coroutine = kwargs.pop(u'return_asyncio_coroutine', False)
true_color = kwargs.pop(u'true_color', False)
refresh_interval = kwargs.pop(u'refresh_interval', 0)
eventloop = kwargs.pop(u'eventloop', None)
application ... | null | null | null | input
| codeqa | def prompt message u'' **kwargs patch stdout kwargs pop u'patch stdout' False return asyncio coroutine kwargs pop u'return asyncio coroutine' False true color kwargs pop u'true color' False refresh interval kwargs pop u'refresh interval' 0 eventloop kwargs pop u'eventloop' None application create prompt application mes... | null | null | null | null | Question:
What does the code get from the user ?
Code:
def prompt(message=u'', **kwargs):
patch_stdout = kwargs.pop(u'patch_stdout', False)
return_asyncio_coroutine = kwargs.pop(u'return_asyncio_coroutine', False)
true_color = kwargs.pop(u'true_color', False)
refresh_interval = kwargs.pop(u'refresh_interval', 0... |
null | null | null | How does the code delete the collection ?
| def delete_collection(committer_id, collection_id, force_deletion=False):
collection_rights_model = collection_models.CollectionRightsModel.get(collection_id)
collection_rights_model.delete(committer_id, '', force_deletion=force_deletion)
collection_model = collection_models.CollectionModel.get(collection_id)
colle... | null | null | null | with the given collection_id
| codeqa | def delete collection committer id collection id force deletion False collection rights model collection models Collection Rights Model get collection id collection rights model delete committer id '' force deletion force deletion collection model collection models Collection Model get collection id collection model de... | null | null | null | null | Question:
How does the code delete the collection ?
Code:
def delete_collection(committer_id, collection_id, force_deletion=False):
collection_rights_model = collection_models.CollectionRightsModel.get(collection_id)
collection_rights_model.delete(committer_id, '', force_deletion=force_deletion)
collection_model... |
null | null | null | What does the code delete with the given collection_id ?
| def delete_collection(committer_id, collection_id, force_deletion=False):
collection_rights_model = collection_models.CollectionRightsModel.get(collection_id)
collection_rights_model.delete(committer_id, '', force_deletion=force_deletion)
collection_model = collection_models.CollectionModel.get(collection_id)
colle... | null | null | null | the collection
| codeqa | def delete collection committer id collection id force deletion False collection rights model collection models Collection Rights Model get collection id collection rights model delete committer id '' force deletion force deletion collection model collection models Collection Model get collection id collection model de... | null | null | null | null | Question:
What does the code delete with the given collection_id ?
Code:
def delete_collection(committer_id, collection_id, force_deletion=False):
collection_rights_model = collection_models.CollectionRightsModel.get(collection_id)
collection_rights_model.delete(committer_id, '', force_deletion=force_deletion)
c... |
null | null | null | What does the code generate ?
| def genslices(n):
return product(range((- n), (n + 1)), range((- n), (n + 1)), range((- n), (n + 1)))
| null | null | null | all possible slices
| codeqa | def genslices n return product range - n n + 1 range - n n + 1 range - n n + 1
| null | null | null | null | Question:
What does the code generate ?
Code:
def genslices(n):
return product(range((- n), (n + 1)), range((- n), (n + 1)), range((- n), (n + 1)))
|
null | null | null | What does the code remove from the signature of various classes and methods ?
| def format_signature(signature):
terms = {'\n': '', '[source]': '', u'\xb6': ''}
return replace_all(signature, terms)
| null | null | null | unwanted characters
| codeqa | def format signature signature terms {'\n' '' '[source]' '' u'\xb 6 ' ''}return replace all signature terms
| null | null | null | null | Question:
What does the code remove from the signature of various classes and methods ?
Code:
def format_signature(signature):
terms = {'\n': '', '[source]': '', u'\xb6': ''}
return replace_all(signature, terms)
|
null | null | null | What does the code assert ?
| def assert_ok(response, msg_prefix=''):
return assert_code(response, 200, msg_prefix=msg_prefix)
| null | null | null | the response was returned with status 200
| codeqa | def assert ok response msg prefix '' return assert code response 200 msg prefix msg prefix
| null | null | null | null | Question:
What does the code assert ?
Code:
def assert_ok(response, msg_prefix=''):
return assert_code(response, 200, msg_prefix=msg_prefix)
|
null | null | null | How was the response returned ?
| def assert_ok(response, msg_prefix=''):
return assert_code(response, 200, msg_prefix=msg_prefix)
| null | null | null | with status 200
| codeqa | def assert ok response msg prefix '' return assert code response 200 msg prefix msg prefix
| null | null | null | null | Question:
How was the response returned ?
Code:
def assert_ok(response, msg_prefix=''):
return assert_code(response, 200, msg_prefix=msg_prefix)
|
null | null | null | What does the code make ?
| def signsimp(expr, evaluate=None):
if (evaluate is None):
evaluate = global_evaluate[0]
expr = sympify(expr)
if ((not isinstance(expr, Expr)) or expr.is_Atom):
return expr
e = sub_post(sub_pre(expr))
if ((not isinstance(e, Expr)) or e.is_Atom):
return e
if e.is_Add:
return e.func(*[signsimp(a) for a in e.... | null | null | null | all add sub - expressions canonical wrt sign
| codeqa | def signsimp expr evaluate None if evaluate is None evaluate global evaluate[ 0 ]expr sympify expr if not isinstance expr Expr or expr is Atom return expre sub post sub pre expr if not isinstance e Expr or e is Atom return eif e is Add return e func *[signsimp a for a in e args] if evaluate e e xreplace {m - - m for m ... | null | null | null | null | Question:
What does the code make ?
Code:
def signsimp(expr, evaluate=None):
if (evaluate is None):
evaluate = global_evaluate[0]
expr = sympify(expr)
if ((not isinstance(expr, Expr)) or expr.is_Atom):
return expr
e = sub_post(sub_pre(expr))
if ((not isinstance(e, Expr)) or e.is_Atom):
return e
if e.is_... |
null | null | null | What does the code add ?
| def signsimp(expr, evaluate=None):
if (evaluate is None):
evaluate = global_evaluate[0]
expr = sympify(expr)
if ((not isinstance(expr, Expr)) or expr.is_Atom):
return expr
e = sub_post(sub_pre(expr))
if ((not isinstance(e, Expr)) or e.is_Atom):
return e
if e.is_Add:
return e.func(*[signsimp(a) for a in e.... | null | null | null | sub - expressions canonical wrt sign
| codeqa | def signsimp expr evaluate None if evaluate is None evaluate global evaluate[ 0 ]expr sympify expr if not isinstance expr Expr or expr is Atom return expre sub post sub pre expr if not isinstance e Expr or e is Atom return eif e is Add return e func *[signsimp a for a in e args] if evaluate e e xreplace {m - - m for m ... | null | null | null | null | Question:
What does the code add ?
Code:
def signsimp(expr, evaluate=None):
if (evaluate is None):
evaluate = global_evaluate[0]
expr = sympify(expr)
if ((not isinstance(expr, Expr)) or expr.is_Atom):
return expr
e = sub_post(sub_pre(expr))
if ((not isinstance(e, Expr)) or e.is_Atom):
return e
if e.is_A... |
null | null | null | In which direction do context read without any preprocessing ?
| def simple_read_words(filename='nietzsche.txt'):
with open('nietzsche.txt', 'r') as f:
words = f.read()
return words
| null | null | null | from file
| codeqa | def simple read words filename 'nietzsche txt' with open 'nietzsche txt' 'r' as f words f read return words
| null | null | null | null | Question:
In which direction do context read without any preprocessing ?
Code:
def simple_read_words(filename='nietzsche.txt'):
with open('nietzsche.txt', 'r') as f:
words = f.read()
return words
|
null | null | null | How do context read from file ?
| def simple_read_words(filename='nietzsche.txt'):
with open('nietzsche.txt', 'r') as f:
words = f.read()
return words
| null | null | null | without any preprocessing
| codeqa | def simple read words filename 'nietzsche txt' with open 'nietzsche txt' 'r' as f words f read return words
| null | null | null | null | Question:
How do context read from file ?
Code:
def simple_read_words(filename='nietzsche.txt'):
with open('nietzsche.txt', 'r') as f:
words = f.read()
return words
|
null | null | null | What does the code get ?
| def getPointsRoundZAxis(planeAngle, points):
planeArray = []
for point in points:
planeArray.append((planeAngle * point))
return planeArray
| null | null | null | points rotated by the plane angle
| codeqa | def get Points Round Z Axis plane Angle points plane Array []for point in points plane Array append plane Angle * point return plane Array
| null | null | null | null | Question:
What does the code get ?
Code:
def getPointsRoundZAxis(planeAngle, points):
planeArray = []
for point in points:
planeArray.append((planeAngle * point))
return planeArray
|
null | null | null | What does the code get ?
| def getNewRepository():
return UnpauseRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return Unpause Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return UnpauseRepository()
|
null | null | null | What does the code delete ?
| def volume_admin_metadata_delete(context, volume_id, key):
return IMPL.volume_admin_metadata_delete(context, volume_id, key)
| null | null | null | the given metadata item
| codeqa | def volume admin metadata delete context volume id key return IMPL volume admin metadata delete context volume id key
| null | null | null | null | Question:
What does the code delete ?
Code:
def volume_admin_metadata_delete(context, volume_id, key):
return IMPL.volume_admin_metadata_delete(context, volume_id, key)
|
null | null | null | What does the code inject into a disk image ?
| def inject_data(image, key=None, net=None, metadata=None, admin_password=None, files=None, partition=None, mandatory=()):
items = {'image': image, 'key': key, 'net': net, 'metadata': metadata, 'files': files, 'partition': partition}
LOG.debug('Inject data image=%(image)s key=%(key)s net=%(net)s metadata=%(metada... | null | null | null | the specified items
| codeqa | def inject data image key None net None metadata None admin password None files None partition None mandatory items {'image' image 'key' key 'net' net 'metadata' metadata 'files' files 'partition' partition}LOG debug ' Injectdataimage % image skey % key snet % net smetadata % metadata sadmin password <SANITIZED>files %... | null | null | null | null | Question:
What does the code inject into a disk image ?
Code:
def inject_data(image, key=None, net=None, metadata=None, admin_password=None, files=None, partition=None, mandatory=()):
items = {'image': image, 'key': key, 'net': net, 'metadata': metadata, 'files': files, 'partition': partition}
LOG.debug('Inject ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.