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 split into a string path to the module and the name of the class ?
| def get_mod_func(callback):
dot = callback.rfind('.')
if (dot == (-1)):
return (callback, '')
return (callback[:dot], callback[(dot + 1):])
| null | null | null | the string path to a class
| codeqa | def get mod func callback dot callback rfind ' ' if dot -1 return callback '' return callback[ dot] callback[ dot + 1 ]
| null | null | null | null | Question:
What does the code split into a string path to the module and the name of the class ?
Code:
def get_mod_func(callback):
dot = callback.rfind('.')
if (dot == (-1)):
return (callback, '')
return (callback[:dot], callback[(dot + 1):])
|
null | null | null | How did lists of expressions handle ?
| def my_evalf(expr, chop=False):
if isinstance(expr, list):
try:
return [x.evalf(chop=chop) for x in expr]
except Exception:
return expr
try:
return expr.evalf(chop=chop)
except Exception:
return expr
| null | null | null | without dropping out
| codeqa | def my evalf expr chop False if isinstance expr list try return [x evalf chop chop for x in expr]except Exception return exprtry return expr evalf chop chop except Exception return expr
| null | null | null | null | Question:
How did lists of expressions handle ?
Code:
def my_evalf(expr, chop=False):
if isinstance(expr, list):
try:
return [x.evalf(chop=chop) for x in expr]
except Exception:
return expr
try:
return expr.evalf(chop=chop)
except Exception:
return expr
|
null | null | null | When does error raise ?
| def test_error_on_file_to_FileLinks():
td = mkdtemp()
tf1 = NamedTemporaryFile(dir=td)
nt.assert_raises(ValueError, display.FileLinks, tf1.name)
| null | null | null | when passed file
| codeqa | def test error on file to File Links td mkdtemp tf 1 Named Temporary File dir td nt assert raises Value Error display File Links tf 1 name
| null | null | null | null | Question:
When does error raise ?
Code:
def test_error_on_file_to_FileLinks():
td = mkdtemp()
tf1 = NamedTemporaryFile(dir=td)
nt.assert_raises(ValueError, display.FileLinks, tf1.name)
|
null | null | null | What did user save ?
| @command('ls')
def ls():
if (not g.userpl):
g.message = util.F('no playlists')
g.content = (g.content or content.generate_songlist_display(zeromsg=g.message))
else:
g.content = content.playlists_display()
g.message = util.F('pl help')
| null | null | null | playlists
| codeqa | @command 'ls' def ls if not g userpl g message util F 'noplaylists' g content g content or content generate songlist display zeromsg g message else g content content playlists display g message util F 'plhelp'
| null | null | null | null | Question:
What did user save ?
Code:
@command('ls')
def ls():
if (not g.userpl):
g.message = util.F('no playlists')
g.content = (g.content or content.generate_songlist_display(zeromsg=g.message))
else:
g.content = content.playlists_display()
g.message = util.F('pl help')
|
null | null | null | What does the code extract from another frame by name ?
| def extract_vars_above(*names):
callerNS = sys._getframe(2).f_locals
return dict(((k, callerNS[k]) for k in names))
| null | null | null | a set of variables
| codeqa | def extract vars above *names caller NS sys getframe 2 f localsreturn dict k caller NS[k] for k in names
| null | null | null | null | Question:
What does the code extract from another frame by name ?
Code:
def extract_vars_above(*names):
callerNS = sys._getframe(2).f_locals
return dict(((k, callerNS[k]) for k in names))
|
null | null | null | How does the code extract a set of variables from another frame ?
| def extract_vars_above(*names):
callerNS = sys._getframe(2).f_locals
return dict(((k, callerNS[k]) for k in names))
| null | null | null | by name
| codeqa | def extract vars above *names caller NS sys getframe 2 f localsreturn dict k caller NS[k] for k in names
| null | null | null | null | Question:
How does the code extract a set of variables from another frame ?
Code:
def extract_vars_above(*names):
callerNS = sys._getframe(2).f_locals
return dict(((k, callerNS[k]) for k in names))
|
null | null | null | Where did an index entry split into a given number of parts ?
| def split_into(n, type, value):
parts = [x.strip() for x in value.split(';', (n - 1))]
if (sum((1 for part in parts if part)) < n):
raise ValueError(('invalid %s index entry %r' % (type, value)))
return parts
| null | null | null | at semicolons
| codeqa | def split into n type value parts [x strip for x in value split ' ' n - 1 ]if sum 1 for part in parts if part < n raise Value Error 'invalid%sindexentry%r' % type value return parts
| null | null | null | null | Question:
Where did an index entry split into a given number of parts ?
Code:
def split_into(n, type, value):
parts = [x.strip() for x in value.split(';', (n - 1))]
if (sum((1 for part in parts if part)) < n):
raise ValueError(('invalid %s index entry %r' % (type, value)))
return parts
|
null | null | null | What split into a given number of parts at semicolons ?
| def split_into(n, type, value):
parts = [x.strip() for x in value.split(';', (n - 1))]
if (sum((1 for part in parts if part)) < n):
raise ValueError(('invalid %s index entry %r' % (type, value)))
return parts
| null | null | null | an index entry
| codeqa | def split into n type value parts [x strip for x in value split ' ' n - 1 ]if sum 1 for part in parts if part < n raise Value Error 'invalid%sindexentry%r' % type value return parts
| null | null | null | null | Question:
What split into a given number of parts at semicolons ?
Code:
def split_into(n, type, value):
parts = [x.strip() for x in value.split(';', (n - 1))]
if (sum((1 for part in parts if part)) < n):
raise ValueError(('invalid %s index entry %r' % (type, value)))
return parts
|
null | null | null | What uses to return the time zone names sorted longitudinally ?
| def GetSortedTimeZoneNames():
tzs = list(GetIndexedTimeZoneNames())
tzs.sort()
return zip(*tzs)[1]
| null | null | null | getindexedtimezonenames
| codeqa | def Get Sorted Time Zone Names tzs list Get Indexed Time Zone Names tzs sort return zip *tzs [1 ]
| null | null | null | null | Question:
What uses to return the time zone names sorted longitudinally ?
Code:
def GetSortedTimeZoneNames():
tzs = list(GetIndexedTimeZoneNames())
tzs.sort()
return zip(*tzs)[1]
|
null | null | null | How did the time zone names sort ?
| def GetSortedTimeZoneNames():
tzs = list(GetIndexedTimeZoneNames())
tzs.sort()
return zip(*tzs)[1]
| null | null | null | longitudinally
| codeqa | def Get Sorted Time Zone Names tzs list Get Indexed Time Zone Names tzs sort return zip *tzs [1 ]
| null | null | null | null | Question:
How did the time zone names sort ?
Code:
def GetSortedTimeZoneNames():
tzs = list(GetIndexedTimeZoneNames())
tzs.sort()
return zip(*tzs)[1]
|
null | null | null | When is rule used ?
| def debug(rule, file=None):
if (file is None):
from sys import stdout
file = stdout
def debug_rl(*args, **kwargs):
expr = args[0]
result = rule(*args, **kwargs)
if (result != expr):
file.write(('Rule: %s\n' % get_function_name(rule)))
file.write(('In: %s\nOut: %s\n\n' % (expr, result)))
return... | null | null | null | each time
| codeqa | def debug rule file None if file is None from sys import stdoutfile stdoutdef debug rl *args **kwargs expr args[ 0 ]result rule *args **kwargs if result expr file write ' Rule %s\n' % get function name rule file write ' In %s\n Out %s\n\n' % expr result return resultreturn debug rl
| null | null | null | null | Question:
When is rule used ?
Code:
def debug(rule, file=None):
if (file is None):
from sys import stdout
file = stdout
def debug_rl(*args, **kwargs):
expr = args[0]
result = rule(*args, **kwargs)
if (result != expr):
file.write(('Rule: %s\n' % get_function_name(rule)))
file.write(('In: %s\nOu... |
null | null | null | What does the code create in the vm record ?
| @add_to_dict(_after_create_functions)
def after_VM_create(vm_ref, vm_rec):
vm_rec.setdefault('domid', '-1')
vm_rec.setdefault('is_control_domain', False)
vm_rec.setdefault('is_a_template', False)
vm_rec.setdefault('memory_static_max', str((8 * units.Gi)))
vm_rec.setdefault('memory_dynamic_max', str((8 * units.Gi))... | null | null | null | read - only fields
| codeqa | @add to dict after create functions def after VM create vm ref vm rec vm rec setdefault 'domid' '- 1 ' vm rec setdefault 'is control domain' False vm rec setdefault 'is a template' False vm rec setdefault 'memory static max' str 8 * units Gi vm rec setdefault 'memory dynamic max' str 8 * units Gi vm rec setdefault 'VCP... | null | null | null | null | Question:
What does the code create in the vm record ?
Code:
@add_to_dict(_after_create_functions)
def after_VM_create(vm_ref, vm_rec):
vm_rec.setdefault('domid', '-1')
vm_rec.setdefault('is_control_domain', False)
vm_rec.setdefault('is_a_template', False)
vm_rec.setdefault('memory_static_max', str((8 * units.G... |
null | null | null | Where does the code create read - only fields ?
| @add_to_dict(_after_create_functions)
def after_VM_create(vm_ref, vm_rec):
vm_rec.setdefault('domid', '-1')
vm_rec.setdefault('is_control_domain', False)
vm_rec.setdefault('is_a_template', False)
vm_rec.setdefault('memory_static_max', str((8 * units.Gi)))
vm_rec.setdefault('memory_dynamic_max', str((8 * units.Gi))... | null | null | null | in the vm record
| codeqa | @add to dict after create functions def after VM create vm ref vm rec vm rec setdefault 'domid' '- 1 ' vm rec setdefault 'is control domain' False vm rec setdefault 'is a template' False vm rec setdefault 'memory static max' str 8 * units Gi vm rec setdefault 'memory dynamic max' str 8 * units Gi vm rec setdefault 'VCP... | null | null | null | null | Question:
Where does the code create read - only fields ?
Code:
@add_to_dict(_after_create_functions)
def after_VM_create(vm_ref, vm_rec):
vm_rec.setdefault('domid', '-1')
vm_rec.setdefault('is_control_domain', False)
vm_rec.setdefault('is_a_template', False)
vm_rec.setdefault('memory_static_max', str((8 * unit... |
null | null | null | What wants the given content_type as a response ?
| def accepts_content_type(request, content_type):
if (not hasattr(request, 'headers')):
return False
accept = request.headers.get('accept', None)
if (not accept):
return None
return (content_type in str(accept))
| null | null | null | the request
| codeqa | def accepts content type request content type if not hasattr request 'headers' return Falseaccept request headers get 'accept' None if not accept return Nonereturn content type in str accept
| null | null | null | null | Question:
What wants the given content_type as a response ?
Code:
def accepts_content_type(request, content_type):
if (not hasattr(request, 'headers')):
return False
accept = request.headers.get('accept', None)
if (not accept):
return None
return (content_type in str(accept))
|
null | null | null | What does the code get ?
| def get_chassis_name(host=None, admin_username=None, admin_password=None):
return bare_rac_cmd('getchassisname', host=host, admin_username=admin_username, admin_password=admin_password)
| null | null | null | the name of a chassis
| codeqa | def get chassis name host None admin username None admin password None return bare rac cmd 'getchassisname' host host admin username admin username admin password admin password
| null | null | null | null | Question:
What does the code get ?
Code:
def get_chassis_name(host=None, admin_username=None, admin_password=None):
return bare_rac_cmd('getchassisname', host=host, admin_username=admin_username, admin_password=admin_password)
|
null | null | null | What do a simple dialogue allow ?
| def fileSaveDlg(initFilePath='', initFileName='', prompt=_translate('Select file to save'), allowed=None):
if (allowed is None):
allowed = 'All files (*.*);;txt (*.txt);;pickled files (*.pickle *.pkl);;shelved files (*.shelf)'
global qtapp
qtapp = ensureQtApp()
fdir = os.path.join(initFilePath, initFil... | null | null | null | write access to the file system
| codeqa | def file Save Dlg init File Path '' init File Name '' prompt translate ' Selectfiletosave' allowed None if allowed is None allowed ' Allfiles * * txt * txt pickledfiles * pickle* pkl shelvedfiles * shelf 'global qtappqtapp ensure Qt App fdir os path join init File Path init File Name r Qt Widgets Q File Dialog get Save... | null | null | null | null | Question:
What do a simple dialogue allow ?
Code:
def fileSaveDlg(initFilePath='', initFileName='', prompt=_translate('Select file to save'), allowed=None):
if (allowed is None):
allowed = 'All files (*.*);;txt (*.txt);;pickled files (*.pickle *.pkl);;shelved files (*.shelf)'
global qtapp
qtapp = en... |
null | null | null | What do decorator factory make ?
| def mock_responses(resps):
def wrapper(func):
@responses.activate
@functools.wraps(func)
def wrapped(*args, **kwargs):
for resp in resps:
responses.add(*resp.args, **resp.kwargs)
return func(*args, **kwargs)
return wrapped
return wrapper
| null | null | null | tests more dry
| codeqa | def mock responses resps def wrapper func @responses activate@functools wraps func def wrapped *args **kwargs for resp in resps responses add *resp args **resp kwargs return func *args **kwargs return wrappedreturn wrapper
| null | null | null | null | Question:
What do decorator factory make ?
Code:
def mock_responses(resps):
def wrapper(func):
@responses.activate
@functools.wraps(func)
def wrapped(*args, **kwargs):
for resp in resps:
responses.add(*resp.args, **resp.kwargs)
return func(*args, **kwargs)
return wrapped
return wrapper
|
null | null | null | What makes tests more dry ?
| def mock_responses(resps):
def wrapper(func):
@responses.activate
@functools.wraps(func)
def wrapped(*args, **kwargs):
for resp in resps:
responses.add(*resp.args, **resp.kwargs)
return func(*args, **kwargs)
return wrapped
return wrapper
| null | null | null | decorator factory
| codeqa | def mock responses resps def wrapper func @responses activate@functools wraps func def wrapped *args **kwargs for resp in resps responses add *resp args **resp kwargs return func *args **kwargs return wrappedreturn wrapper
| null | null | null | null | Question:
What makes tests more dry ?
Code:
def mock_responses(resps):
def wrapper(func):
@responses.activate
@functools.wraps(func)
def wrapped(*args, **kwargs):
for resp in resps:
responses.add(*resp.args, **resp.kwargs)
return func(*args, **kwargs)
return wrapped
return wrapper
|
null | null | null | What generate 1 ?
| def POSform(variables, minterms, dontcares=None):
variables = [sympify(v) for v in variables]
if (minterms == []):
return false
minterms = [list(i) for i in minterms]
dontcares = [list(i) for i in (dontcares or [])]
for d in dontcares:
if (d in minterms):
raise ValueError(('%s in minterms is also in d... | null | null | null | all input combinations
| codeqa | def PO Sform variables minterms dontcares None variables [sympify v for v in variables]if minterms [] return falseminterms [list i for i in minterms]dontcares [list i for i in dontcares or [] ]for d in dontcares if d in minterms raise Value Error '%sinmintermsisalsoindontcares' % d maxterms []for t in product [0 1] rep... | null | null | null | null | Question:
What generate 1 ?
Code:
def POSform(variables, minterms, dontcares=None):
variables = [sympify(v) for v in variables]
if (minterms == []):
return false
minterms = [list(i) for i in minterms]
dontcares = [list(i) for i in (dontcares or [])]
for d in dontcares:
if (d in minterms):
raise ValueErr... |
null | null | null | What do all input combinations generate ?
| def POSform(variables, minterms, dontcares=None):
variables = [sympify(v) for v in variables]
if (minterms == []):
return false
minterms = [list(i) for i in minterms]
dontcares = [list(i) for i in (dontcares or [])]
for d in dontcares:
if (d in minterms):
raise ValueError(('%s in minterms is also in d... | null | null | null | 1
| codeqa | def PO Sform variables minterms dontcares None variables [sympify v for v in variables]if minterms [] return falseminterms [list i for i in minterms]dontcares [list i for i in dontcares or [] ]for d in dontcares if d in minterms raise Value Error '%sinmintermsisalsoindontcares' % d maxterms []for t in product [0 1] rep... | null | null | null | null | Question:
What do all input combinations generate ?
Code:
def POSform(variables, minterms, dontcares=None):
variables = [sympify(v) for v in variables]
if (minterms == []):
return false
minterms = [list(i) for i in minterms]
dontcares = [list(i) for i in (dontcares or [])]
for d in dontcares:
if (d in mint... |
null | null | null | What are the crypto maps using ?
| def main():
cisco_file = 'cisco_ipsec.txt'
cisco_cfg = CiscoConfParse(cisco_file)
crypto_maps = cisco_cfg.find_objects_w_child(parentspec='crypto map CRYPTO', childspec='pfs group2')
print '\nCrypto Maps using PFS group2:'
for entry in crypto_maps:
print ' {0}'.format(entry.text)
print
| null | null | null | pfs group2
| codeqa | def main cisco file 'cisco ipsec txt'cisco cfg Cisco Conf Parse cisco file crypto maps cisco cfg find objects w child parentspec 'cryptomap CRYPTO' childspec 'pfsgroup 2 ' print '\n Crypto Mapsusing PF Sgroup 2 'for entry in crypto maps print '{ 0 }' format entry text print
| null | null | null | null | Question:
What are the crypto maps using ?
Code:
def main():
cisco_file = 'cisco_ipsec.txt'
cisco_cfg = CiscoConfParse(cisco_file)
crypto_maps = cisco_cfg.find_objects_w_child(parentspec='crypto map CRYPTO', childspec='pfs group2')
print '\nCrypto Maps using PFS group2:'
for entry in crypto_maps:
prin... |
null | null | null | What does the code write selected portion ?
| def extract(structure, chain_id, start, end, filename):
sel = ChainSelector(chain_id, start, end)
io = PDBIO()
io.set_structure(structure)
io.save(filename, sel)
| null | null | null | to filename
| codeqa | def extract structure chain id start end filename sel Chain Selector chain id start end io PDBIO io set structure structure io save filename sel
| null | null | null | null | Question:
What does the code write selected portion ?
Code:
def extract(structure, chain_id, start, end, filename):
sel = ChainSelector(chain_id, start, end)
io = PDBIO()
io.set_structure(structure)
io.save(filename, sel)
|
null | null | null | What solved in scenario outlines ?
| def test_solved_steps_also_have_scenario_as_attribute():
scenario = Scenario.from_string(OUTLINED_SCENARIO)
for step in scenario.solved_steps:
assert_equals(step.scenario, scenario)
| null | null | null | steps
| codeqa | def test solved steps also have scenario as attribute scenario Scenario from string OUTLINED SCENARIO for step in scenario solved steps assert equals step scenario scenario
| null | null | null | null | Question:
What solved in scenario outlines ?
Code:
def test_solved_steps_also_have_scenario_as_attribute():
scenario = Scenario.from_string(OUTLINED_SCENARIO)
for step in scenario.solved_steps:
assert_equals(step.scenario, scenario)
|
null | null | null | Where did steps solve ?
| def test_solved_steps_also_have_scenario_as_attribute():
scenario = Scenario.from_string(OUTLINED_SCENARIO)
for step in scenario.solved_steps:
assert_equals(step.scenario, scenario)
| null | null | null | in scenario outlines
| codeqa | def test solved steps also have scenario as attribute scenario Scenario from string OUTLINED SCENARIO for step in scenario solved steps assert equals step scenario scenario
| null | null | null | null | Question:
Where did steps solve ?
Code:
def test_solved_steps_also_have_scenario_as_attribute():
scenario = Scenario.from_string(OUTLINED_SCENARIO)
for step in scenario.solved_steps:
assert_equals(step.scenario, scenario)
|
null | null | null | What d the code extracts from the path ?
| def GetClientURNFromPath(path):
try:
return ClientURN(path.split('/')[1])
except (type_info.TypeValueError, IndexError):
return None
| null | null | null | the client i d
| codeqa | def Get Client URN From Path path try return Client URN path split '/' [1 ] except type info Type Value Error Index Error return None
| null | null | null | null | Question:
What d the code extracts from the path ?
Code:
def GetClientURNFromPath(path):
try:
return ClientURN(path.split('/')[1])
except (type_info.TypeValueError, IndexError):
return None
|
null | null | null | What does the code perform ?
| def match(value, pattern='', ignorecase=False, multiline=False):
return regex(value, pattern, ignorecase, multiline, 'match')
| null | null | null | a re
| codeqa | def match value pattern '' ignorecase False multiline False return regex value pattern ignorecase multiline 'match'
| null | null | null | null | Question:
What does the code perform ?
Code:
def match(value, pattern='', ignorecase=False, multiline=False):
return regex(value, pattern, ignorecase, multiline, 'match')
|
null | null | null | What does the code serialize ?
| def _dump_function(func):
func_info = (func.func_name, func.func_defaults, func.func_closure)
code_info = (func.func_code.co_argcount, func.func_code.co_nlocals, func.func_code.co_stacksize, func.func_code.co_flags, func.func_code.co_code, func.func_code.co_consts, func.func_code.co_names, func.func_code.co_varnames,... | null | null | null | a function
| codeqa | def dump function func func info func func name func func defaults func func closure code info func func code co argcount func func code co nlocals func func code co stacksize func func code co flags func func code co code func func code co consts func func code co names func func code co varnames func func code co fil... | null | null | null | null | Question:
What does the code serialize ?
Code:
def _dump_function(func):
func_info = (func.func_name, func.func_defaults, func.func_closure)
code_info = (func.func_code.co_argcount, func.func_code.co_nlocals, func.func_code.co_stacksize, func.func_code.co_flags, func.func_code.co_code, func.func_code.co_consts, f... |
null | null | null | For what purpose does the tag return ?
| def get_impl_tag():
return '{0}{1}'.format(get_abbr_impl(), get_impl_ver())
| null | null | null | for this specific implementation
| codeqa | def get impl tag return '{ 0 }{ 1 }' format get abbr impl get impl ver
| null | null | null | null | Question:
For what purpose does the tag return ?
Code:
def get_impl_tag():
return '{0}{1}'.format(get_abbr_impl(), get_impl_ver())
|
null | null | null | When do virtual disk exist ?
| def detach_virtual_disk_spec(client_factory, device, destroy_disk=False):
virtual_device_config = client_factory.create('ns0:VirtualDeviceConfigSpec')
virtual_device_config.operation = 'remove'
if destroy_disk:
virtual_device_config.fileOperation = 'destroy'
virtual_device_config.device = device
return virtual_d... | null | null | null | already
| codeqa | def detach virtual disk spec client factory device destroy disk False virtual device config client factory create 'ns 0 Virtual Device Config Spec' virtual device config operation 'remove'if destroy disk virtual device config file Operation 'destroy'virtual device config device devicereturn virtual device config
| null | null | null | null | Question:
When do virtual disk exist ?
Code:
def detach_virtual_disk_spec(client_factory, device, destroy_disk=False):
virtual_device_config = client_factory.create('ns0:VirtualDeviceConfigSpec')
virtual_device_config.operation = 'remove'
if destroy_disk:
virtual_device_config.fileOperation = 'destroy'
virtua... |
null | null | null | What does the code restrict to a selection of channels ?
| def pick_info(info, sel=(), copy=True):
info._check_consistency()
if copy:
info = deepcopy(info)
if (sel is None):
return info
elif (len(sel) == 0):
raise ValueError('No channels match the selection.')
info['chs'] = [info['chs'][k] for k in sel]
info._update_redundant()
info['bads'] = [ch for ch in inf... | null | null | null | an info structure
| codeqa | def pick info info sel copy True info check consistency if copy info deepcopy info if sel is None return infoelif len sel 0 raise Value Error ' Nochannelsmatchtheselection ' info['chs'] [info['chs'][k] for k in sel]info update redundant info['bads'] [ch for ch in info['bads'] if ch in info['ch names'] ]comps deepcopy i... | null | null | null | null | Question:
What does the code restrict to a selection of channels ?
Code:
def pick_info(info, sel=(), copy=True):
info._check_consistency()
if copy:
info = deepcopy(info)
if (sel is None):
return info
elif (len(sel) == 0):
raise ValueError('No channels match the selection.')
info['chs'] = [info['chs']... |
null | null | null | What does the code take from the config ?
| def parse_size(size_input):
prefixes = [None, u'K', u'M', u'G', u'T', u'P']
try:
return int(size_input)
except ValueError:
size_input = size_input.upper().rstrip(u'IB')
(value, unit) = (float(size_input[:(-1)]), size_input[(-1):])
if (unit not in prefixes):
raise ValueError(u"should be in format '0-x ... | null | null | null | a size string
| codeqa | def parse size size input prefixes [ None u'K' u'M' u'G' u'T' u'P']try return int size input except Value Error size input size input upper rstrip u'IB' value unit float size input[ -1 ] size input[ -1 ] if unit not in prefixes raise Value Error u"shouldbeinformat' 0 -x Ki B Mi B Gi B Ti B Pi B '" return int 1024 ** pr... | null | null | null | null | Question:
What does the code take from the config ?
Code:
def parse_size(size_input):
prefixes = [None, u'K', u'M', u'G', u'T', u'P']
try:
return int(size_input)
except ValueError:
size_input = size_input.upper().rstrip(u'IB')
(value, unit) = (float(size_input[:(-1)]), size_input[(-1):])
if (unit not in ... |
null | null | null | What does the code setup ?
| def setup_platform(hass, config, add_devices, discovery_info=None):
from vasttrafik import JournyPlanner
planner = JournyPlanner(config.get(CONF_KEY), config.get(CONF_SECRET))
sensors = []
for departure in config.get(CONF_DEPARTURES):
sensors.append(VasttrafikDepartureSensor(planner, departure.get(CONF_NAME), dep... | null | null | null | the departure sensor
| codeqa | def setup platform hass config add devices discovery info None from vasttrafik import Journy Plannerplanner Journy Planner config get CONF KEY config get CONF SECRET sensors []for departure in config get CONF DEPARTURES sensors append Vasttrafik Departure Sensor planner departure get CONF NAME departure get CONF FROM d... | null | null | null | null | Question:
What does the code setup ?
Code:
def setup_platform(hass, config, add_devices, discovery_info=None):
from vasttrafik import JournyPlanner
planner = JournyPlanner(config.get(CONF_KEY), config.get(CONF_SECRET))
sensors = []
for departure in config.get(CONF_DEPARTURES):
sensors.append(VasttrafikDepartu... |
null | null | null | What does the code resize ?
| @utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of new flavor.'))
@utils.arg('--poll', dest='poll', action='store_true', default=False, help=_('Report the server resize progress until it completes.'))
def do_resize(cs,... | null | null | null | a server
| codeqa | @utils arg 'server' metavar '<server>' help ' Nameor I Dofserver ' @utils arg 'flavor' metavar '<flavor>' help ' Nameor I Dofnewflavor ' @utils arg '--poll' dest 'poll' action 'store true' default False help ' Reporttheserverresizeprogressuntilitcompletes ' def do resize cs args server find server cs args server flavor... | null | null | null | null | Question:
What does the code resize ?
Code:
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of new flavor.'))
@utils.arg('--poll', dest='poll', action='store_true', default=False, help=_('Report the server resize prog... |
null | null | null | What does the code setup ?
| def setup_scanner(hass, config, see):
def offset():
'Return random offset.'
return ((random.randrange(500, 2000) / 200000.0) * random.choice(((-1), 1)))
def random_see(dev_id, name):
'Randomize a sighting.'
see(dev_id=dev_id, host_name=name, gps=((hass.config.latitude + offset()), (hass.config.longitude +... | null | null | null | the demo tracker
| codeqa | def setup scanner hass config see def offset ' Returnrandomoffset 'return random randrange 500 2000 / 200000 0 * random choice -1 1 def random see dev id name ' Randomizeasighting 'see dev id dev id host name name gps hass config latitude + offset hass config longitude + offset gps accuracy random randrange 50 150 batt... | null | null | null | null | Question:
What does the code setup ?
Code:
def setup_scanner(hass, config, see):
def offset():
'Return random offset.'
return ((random.randrange(500, 2000) / 200000.0) * random.choice(((-1), 1)))
def random_see(dev_id, name):
'Randomize a sighting.'
see(dev_id=dev_id, host_name=name, gps=((hass.config... |
null | null | null | In which direction do command send ?
| def send_command(remote_conn, cmd='', delay=1):
if (cmd != ''):
cmd = cmd.strip()
remote_conn.send((cmd + '\n'))
time.sleep(delay)
if remote_conn.recv_ready():
return remote_conn.recv(MAX_BUFFER)
else:
return ''
| null | null | null | down the channel
| codeqa | def send command remote conn cmd '' delay 1 if cmd '' cmd cmd strip remote conn send cmd + '\n' time sleep delay if remote conn recv ready return remote conn recv MAX BUFFER else return ''
| null | null | null | null | Question:
In which direction do command send ?
Code:
def send_command(remote_conn, cmd='', delay=1):
if (cmd != ''):
cmd = cmd.strip()
remote_conn.send((cmd + '\n'))
time.sleep(delay)
if remote_conn.recv_ready():
return remote_conn.recv(MAX_BUFFER)
else:
return ''
|
null | null | null | What does the code get from file ?
| def get_file_lines(path):
data = get_file_content(path)
if data:
ret = data.splitlines()
else:
ret = []
return ret
| null | null | null | list of lines
| codeqa | def get file lines path data get file content path if data ret data splitlines else ret []return ret
| null | null | null | null | Question:
What does the code get from file ?
Code:
def get_file_lines(path):
data = get_file_content(path)
if data:
ret = data.splitlines()
else:
ret = []
return ret
|
null | null | null | What does the code return ?
| def proxytype():
return 'junos'
| null | null | null | the name of this proxy
| codeqa | def proxytype return 'junos'
| null | null | null | null | Question:
What does the code return ?
Code:
def proxytype():
return 'junos'
|
null | null | null | What does the code remove ?
| def lazify(dsk):
return valmap(lazify_task, dsk)
| null | null | null | unnecessary calls to list in tasks
| codeqa | def lazify dsk return valmap lazify task dsk
| null | null | null | null | Question:
What does the code remove ?
Code:
def lazify(dsk):
return valmap(lazify_task, dsk)
|
null | null | null | What does the code create ?
| def random_threshold_sequence(n, p, seed=None):
if (not (seed is None)):
random.seed(seed)
if (not (0 <= p <= 1)):
raise ValueError('p must be in [0,1]')
cs = ['d']
for i in range(1, n):
if (random.random() < p):
cs.append('d')
else:
cs.append('i')
return cs
| null | null | null | a random threshold sequence of size n
| codeqa | def random threshold sequence n p seed None if not seed is None random seed seed if not 0 < p < 1 raise Value Error 'pmustbein[ 0 1]' cs ['d']for i in range 1 n if random random < p cs append 'd' else cs append 'i' return cs
| null | null | null | null | Question:
What does the code create ?
Code:
def random_threshold_sequence(n, p, seed=None):
if (not (seed is None)):
random.seed(seed)
if (not (0 <= p <= 1)):
raise ValueError('p must be in [0,1]')
cs = ['d']
for i in range(1, n):
if (random.random() < p):
cs.append('d')
else:
cs.append('i')
... |
null | null | null | What does the code build ?
| def buildNestedNetwork():
N = FeedForwardNetwork('outer')
a = LinearLayer(1, name='a')
b = LinearLayer(2, name='b')
c = buildNetwork(2, 3, 1)
c.name = 'inner'
N.addInputModule(a)
N.addModule(c)
N.addOutputModule(b)
N.addConnection(FullConnection(a, b))
N.addConnection(FullConnection(b, c))
N.sortModules()
r... | null | null | null | a nested network
| codeqa | def build Nested Network N Feed Forward Network 'outer' a Linear Layer 1 name 'a' b Linear Layer 2 name 'b' c build Network 2 3 1 c name 'inner'N add Input Module a N add Module c N add Output Module b N add Connection Full Connection a b N add Connection Full Connection b c N sort Modules return N
| null | null | null | null | Question:
What does the code build ?
Code:
def buildNestedNetwork():
N = FeedForwardNetwork('outer')
a = LinearLayer(1, name='a')
b = LinearLayer(2, name='b')
c = buildNetwork(2, 3, 1)
c.name = 'inner'
N.addInputModule(a)
N.addModule(c)
N.addOutputModule(b)
N.addConnection(FullConnection(a, b))
N.addConne... |
null | null | null | What does the code help ?
| @public
def rationalize(x, maxcoeff=10000):
(p0, p1) = (0, 1)
(q0, q1) = (1, 0)
a = floor(x)
while ((a < maxcoeff) or (q1 == 0)):
p = ((a * p1) + p0)
q = ((a * q1) + q0)
(p0, p1) = (p1, p)
(q0, q1) = (q1, q)
if (x == a):
break
x = (1 / (x - a))
a = floor(x)
return (sympify(p) / q)
| null | null | null | identifying a rational number from a float value by using a continued fraction
| codeqa | @publicdef rationalize x maxcoeff 10000 p0 p1 0 1 q0 q1 1 0 a floor x while a < maxcoeff or q1 0 p a * p1 + p0 q a * q1 + q0 p0 p1 p1 p q0 q1 q1 q if x a breakx 1 / x - a a floor x return sympify p / q
| null | null | null | null | Question:
What does the code help ?
Code:
@public
def rationalize(x, maxcoeff=10000):
(p0, p1) = (0, 1)
(q0, q1) = (1, 0)
a = floor(x)
while ((a < maxcoeff) or (q1 == 0)):
p = ((a * p1) + p0)
q = ((a * q1) + q0)
(p0, p1) = (p1, p)
(q0, q1) = (q1, q)
if (x == a):
break
x = (1 / (x - a))
a = floo... |
null | null | null | How does a rational number identify from a float value ?
| @public
def rationalize(x, maxcoeff=10000):
(p0, p1) = (0, 1)
(q0, q1) = (1, 0)
a = floor(x)
while ((a < maxcoeff) or (q1 == 0)):
p = ((a * p1) + p0)
q = ((a * q1) + q0)
(p0, p1) = (p1, p)
(q0, q1) = (q1, q)
if (x == a):
break
x = (1 / (x - a))
a = floor(x)
return (sympify(p) / q)
| null | null | null | by using a continued fraction
| codeqa | @publicdef rationalize x maxcoeff 10000 p0 p1 0 1 q0 q1 1 0 a floor x while a < maxcoeff or q1 0 p a * p1 + p0 q a * q1 + q0 p0 p1 p1 p q0 q1 q1 q if x a breakx 1 / x - a a floor x return sympify p / q
| null | null | null | null | Question:
How does a rational number identify from a float value ?
Code:
@public
def rationalize(x, maxcoeff=10000):
(p0, p1) = (0, 1)
(q0, q1) = (1, 0)
a = floor(x)
while ((a < maxcoeff) or (q1 == 0)):
p = ((a * p1) + p0)
q = ((a * q1) + q0)
(p0, p1) = (p1, p)
(q0, q1) = (q1, q)
if (x == a):
break... |
null | null | null | What will this function return ?
| def pullnodeIDs(in_network, name_key=u'dn_name'):
import networkx as nx
import numpy as np
from nipype.interfaces.base import isdefined
if (not isdefined(in_network)):
raise ValueError
return None
try:
ntwk = nx.read_graphml(in_network)
except:
ntwk = nx.read_gpickle(in_network)
nodedata = ntwk.node
ids... | null | null | null | the values contained
| codeqa | def pullnode I Ds in network name key u'dn name' import networkx as nximport numpy as npfrom nipype interfaces base import isdefinedif not isdefined in network raise Value Errorreturn Nonetry ntwk nx read graphml in network except ntwk nx read gpickle in network nodedata ntwk nodeids []integer nodelist []for node in li... | null | null | null | null | Question:
What will this function return ?
Code:
def pullnodeIDs(in_network, name_key=u'dn_name'):
import networkx as nx
import numpy as np
from nipype.interfaces.base import isdefined
if (not isdefined(in_network)):
raise ValueError
return None
try:
ntwk = nx.read_graphml(in_network)
except:
ntwk = n... |
null | null | null | What does the code get ?
| def getDictionaryWithoutList(dictionary, withoutList):
dictionaryWithoutList = {}
for key in dictionary:
if (key not in withoutList):
dictionaryWithoutList[key] = dictionary[key]
return dictionaryWithoutList
| null | null | null | the dictionary without the keys in the list
| codeqa | def get Dictionary Without List dictionary without List dictionary Without List {}for key in dictionary if key not in without List dictionary Without List[key] dictionary[key]return dictionary Without List
| null | null | null | null | Question:
What does the code get ?
Code:
def getDictionaryWithoutList(dictionary, withoutList):
dictionaryWithoutList = {}
for key in dictionary:
if (key not in withoutList):
dictionaryWithoutList[key] = dictionary[key]
return dictionaryWithoutList
|
null | null | null | How do all modules on the global python path iterate ?
| def walkModules(importPackages=False):
return theSystemPath.walkModules(importPackages=importPackages)
| null | null | null | deeply
| codeqa | def walk Modules import Packages False return the System Path walk Modules import Packages import Packages
| null | null | null | null | Question:
How do all modules on the global python path iterate ?
Code:
def walkModules(importPackages=False):
return theSystemPath.walkModules(importPackages=importPackages)
|
null | null | null | For what purpose do key keys insert ?
| def add_backtrack_keys(products):
for (p_k, p_v) in products.iteritems():
p_v['key'] = p_k
for (c_k, c_v) in p_v['categories'].iteritems():
c_v['key'] = c_k
| null | null | null | so we can go from product or category back to key
| codeqa | def add backtrack keys products for p k p v in products iteritems p v['key'] p kfor c k c v in p v['categories'] iteritems c v['key'] c k
| null | null | null | null | Question:
For what purpose do key keys insert ?
Code:
def add_backtrack_keys(products):
for (p_k, p_v) in products.iteritems():
p_v['key'] = p_k
for (c_k, c_v) in p_v['categories'].iteritems():
c_v['key'] = c_k
|
null | null | null | Where do packets receive ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | at layer 2
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
Where do packets receive ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | What receives at layer 2 ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | packets
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
What receives at layer 2 ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | What sends at layer 2 ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | packets
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
What sends at layer 2 ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | Where do packets send ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | at layer 2
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
Where do packets send ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | What does the code create ?
| def asRowMatrix(X):
if (len(X) == 0):
return np.array([])
total = 1
for i in range(0, np.ndim(X[0])):
total = (total * X[0].shape[i])
mat = np.empty([0, total], dtype=X[0].dtype)
for row in X:
mat = np.append(mat, row.reshape(1, (-1)), axis=0)
return np.asmatrix(mat)
| null | null | null | a row - matrix
| codeqa | def as Row Matrix X if len X 0 return np array [] total 1for i in range 0 np ndim X[ 0 ] total total * X[ 0 ] shape[i] mat np empty [0 total] dtype X[ 0 ] dtype for row in X mat np append mat row reshape 1 -1 axis 0 return np asmatrix mat
| null | null | null | null | Question:
What does the code create ?
Code:
def asRowMatrix(X):
if (len(X) == 0):
return np.array([])
total = 1
for i in range(0, np.ndim(X[0])):
total = (total * X[0].shape[i])
mat = np.empty([0, total], dtype=X[0].dtype)
for row in X:
mat = np.append(mat, row.reshape(1, (-1)), axis=0)
return np.asmatr... |
null | null | null | What updates their server addresses ?
| def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_domain == old_domain):
return True
new_parent_domain = ... | null | null | null | our customers
| codeqa | def matching subdomains new value old value if new value is None and old value is not None return Falseif new value lower old value lower return Truenew domain naked domain new value old domain naked domain old value if new domain old domain return Truenew parent domain parent domain new value old parent domain parent ... | null | null | null | null | Question:
What updates their server addresses ?
Code:
def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_... |
null | null | null | What do we allow ?
| def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_domain == old_domain):
return True
new_parent_domain = ... | null | null | null | our customers to update their server addresses
| codeqa | def matching subdomains new value old value if new value is None and old value is not None return Falseif new value lower old value lower return Truenew domain naked domain new value old domain naked domain old value if new domain old domain return Truenew parent domain parent domain new value old parent domain parent ... | null | null | null | null | Question:
What do we allow ?
Code:
def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_domain == old_domai... |
null | null | null | What do our customers update ?
| def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_domain == old_domain):
return True
new_parent_domain = ... | null | null | null | their server addresses
| codeqa | def matching subdomains new value old value if new value is None and old value is not None return Falseif new value lower old value lower return Truenew domain naked domain new value old domain naked domain old value if new domain old domain return Truenew parent domain parent domain new value old parent domain parent ... | null | null | null | null | Question:
What do our customers update ?
Code:
def matching_subdomains(new_value, old_value):
if ((new_value is None) and (old_value is not None)):
return False
if (new_value.lower() == old_value.lower()):
return True
new_domain = naked_domain(new_value)
old_domain = naked_domain(old_value)
if (new_domain ... |
null | null | null | What does the code make ?
| def AFTER_SETUP():
admin.command('enablesharding', ShardMONGODB_DB)
for (collection, keystr) in COLLECTION_KEYS.iteritems():
key = SON(((k, 1) for k in keystr.split(',')))
admin.command('shardcollection', ((ShardMONGODB_DB + '.') + collection), key=key)
admin.command('shardcollection', (((ShardMONGODB_DB + '.') ... | null | null | null | index and shard keys
| codeqa | def AFTER SETUP admin command 'enablesharding' Shard MONGODB DB for collection keystr in COLLECTION KEYS iteritems key SON k 1 for k in keystr split ' ' admin command 'shardcollection' Shard MONGODB DB + ' ' + collection key key admin command 'shardcollection' Shard MONGODB DB + ' ' + Grid Fs Collection + ' files' key ... | null | null | null | null | Question:
What does the code make ?
Code:
def AFTER_SETUP():
admin.command('enablesharding', ShardMONGODB_DB)
for (collection, keystr) in COLLECTION_KEYS.iteritems():
key = SON(((k, 1) for k in keystr.split(',')))
admin.command('shardcollection', ((ShardMONGODB_DB + '.') + collection), key=key)
admin.command... |
null | null | null | What does the code get ?
| def quotes_historical_yahoo(ticker, date1, date2, asobject=False, adjusted=True, cachename=None):
fh = fetch_historical_yahoo(ticker, date1, date2, cachename)
try:
ret = parse_yahoo_historical(fh, asobject, adjusted)
except IOError as exc:
warnings.warn(((('urlopen() failure\n' + url) + '\n') + exc.strerror[1])... | null | null | null | historical data for ticker between date1 and date2
| codeqa | def quotes historical yahoo ticker date 1 date 2 asobject False adjusted True cachename None fh fetch historical yahoo ticker date 1 date 2 cachename try ret parse yahoo historical fh asobject adjusted except IO Error as exc warnings warn 'urlopen failure\n' + url + '\n' + exc strerror[ 1 ] return Nonereturn ret
| null | null | null | null | Question:
What does the code get ?
Code:
def quotes_historical_yahoo(ticker, date1, date2, asobject=False, adjusted=True, cachename=None):
fh = fetch_historical_yahoo(ticker, date1, date2, cachename)
try:
ret = parse_yahoo_historical(fh, asobject, adjusted)
except IOError as exc:
warnings.warn(((('urlopen() ... |
null | null | null | When does it not exist ?
| def ensure_directory_exists(d):
if (not os.path.exists(d)):
os.makedirs(d)
| null | null | null | already
| codeqa | def ensure directory exists d if not os path exists d os makedirs d
| null | null | null | null | Question:
When does it not exist ?
Code:
def ensure_directory_exists(d):
if (not os.path.exists(d)):
os.makedirs(d)
|
null | null | null | What does the code create if it does not already exist ?
| def ensure_directory_exists(d):
if (not os.path.exists(d)):
os.makedirs(d)
| null | null | null | the given directory
| codeqa | def ensure directory exists d if not os path exists d os makedirs d
| null | null | null | null | Question:
What does the code create if it does not already exist ?
Code:
def ensure_directory_exists(d):
if (not os.path.exists(d)):
os.makedirs(d)
|
null | null | null | What does the code get ?
| def get_affected_files(allow_limited=True):
diff_base = None
if in_travis():
if in_travis_pr():
diff_base = travis_branch()
else:
diff_base = local_diff_branch()
if ((diff_base is not None) and allow_limited):
result = subprocess.check_output(['git', 'diff', '--name-only', diff_base])
print(('Using file... | null | null | null | a list of files in the repository
| codeqa | def get affected files allow limited True diff base Noneif in travis if in travis pr diff base travis branch else diff base local diff branch if diff base is not None and allow limited result subprocess check output ['git' 'diff' '--name-only' diff base] print ' Usingfileschangedrelativeto%s ' % diff base print '-' * 6... | null | null | null | null | Question:
What does the code get ?
Code:
def get_affected_files(allow_limited=True):
diff_base = None
if in_travis():
if in_travis_pr():
diff_base = travis_branch()
else:
diff_base = local_diff_branch()
if ((diff_base is not None) and allow_limited):
result = subprocess.check_output(['git', 'diff', '--... |
null | null | null | What does the code get ?
| def getJoinedPath(path, subName=''):
if (subName == ''):
return path
return os.path.join(path, subName)
| null | null | null | the joined file path
| codeqa | def get Joined Path path sub Name '' if sub Name '' return pathreturn os path join path sub Name
| null | null | null | null | Question:
What does the code get ?
Code:
def getJoinedPath(path, subName=''):
if (subName == ''):
return path
return os.path.join(path, subName)
|
null | null | null | What does the code get ?
| def getNewRepository():
return FeedRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return Feed Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return FeedRepository()
|
null | null | null | In which direction did a local rpm pass ?
| def local_nvra(module, path):
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
fd = os.open(path, os.O_RDONLY)
try:
header = ts.hdrFromFdno(fd)
finally:
os.close(fd)
return ('%s-%s-%s.%s' % (header[rpm.RPMTAG_NAME], header[rpm.RPMTAG_VERSION], header[rpm.RPMTAG_RELEASE], header[rpm.RPMTAG_ARC... | null | null | null | in
| codeqa | def local nvra module path ts rpm Transaction Set ts set VS Flags rpm RPMVSF NOSIGNATURES fd os open path os O RDONLY try header ts hdr From Fdno fd finally os close fd return '%s-%s-%s %s' % header[rpm RPMTAG NAME] header[rpm RPMTAG VERSION] header[rpm RPMTAG RELEASE] header[rpm RPMTAG ARCH]
| null | null | null | null | Question:
In which direction did a local rpm pass ?
Code:
def local_nvra(module, path):
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
fd = os.open(path, os.O_RDONLY)
try:
header = ts.hdrFromFdno(fd)
finally:
os.close(fd)
return ('%s-%s-%s.%s' % (header[rpm.RPMTAG_NAME], header[rpm.RPMT... |
null | null | null | What does the logger load ?
| def init_request_processor(conf_path, app_section, *args, **kwargs):
(conf, logger, log_name) = _initrp(conf_path, app_section, *args, **kwargs)
app = loadapp(conf_path, global_conf={'log_name': log_name})
return (app, conf, logger, log_name)
| null | null | null | the request processor
| codeqa | def init request processor conf path app section *args **kwargs conf logger log name initrp conf path app section *args **kwargs app loadapp conf path global conf {'log name' log name} return app conf logger log name
| null | null | null | null | Question:
What does the logger load ?
Code:
def init_request_processor(conf_path, app_section, *args, **kwargs):
(conf, logger, log_name) = _initrp(conf_path, app_section, *args, **kwargs)
app = loadapp(conf_path, global_conf={'log_name': log_name})
return (app, conf, logger, log_name)
|
null | null | null | What loads the request processor ?
| def init_request_processor(conf_path, app_section, *args, **kwargs):
(conf, logger, log_name) = _initrp(conf_path, app_section, *args, **kwargs)
app = loadapp(conf_path, global_conf={'log_name': log_name})
return (app, conf, logger, log_name)
| null | null | null | the logger
| codeqa | def init request processor conf path app section *args **kwargs conf logger log name initrp conf path app section *args **kwargs app loadapp conf path global conf {'log name' log name} return app conf logger log name
| null | null | null | null | Question:
What loads the request processor ?
Code:
def init_request_processor(conf_path, app_section, *args, **kwargs):
(conf, logger, log_name) = _initrp(conf_path, app_section, *args, **kwargs)
app = loadapp(conf_path, global_conf={'log_name': log_name})
return (app, conf, logger, log_name)
|
null | null | null | How do the surfaces intersect ?
| def _check_surfaces(surfs):
for surf in surfs:
_assert_complete_surface(surf)
for (surf_1, surf_2) in zip(surfs[:(-1)], surfs[1:]):
logger.info(('Checking that %s surface is inside %s surface...' % (_surf_name[surf_2['id']], _surf_name[surf_1['id']])))
_assert_inside(surf_2, surf_1)
| null | null | null | non
| codeqa | def check surfaces surfs for surf in surfs assert complete surface surf for surf 1 surf 2 in zip surfs[ -1 ] surfs[ 1 ] logger info ' Checkingthat%ssurfaceisinside%ssurface ' % surf name[surf 2['id']] surf name[surf 1['id']] assert inside surf 2 surf 1
| null | null | null | null | Question:
How do the surfaces intersect ?
Code:
def _check_surfaces(surfs):
for surf in surfs:
_assert_complete_surface(surf)
for (surf_1, surf_2) in zip(surfs[:(-1)], surfs[1:]):
logger.info(('Checking that %s surface is inside %s surface...' % (_surf_name[surf_2['id']], _surf_name[surf_1['id']])))
... |
null | null | null | What do strings contain ?
| def simple_python_completion():
python_completion = []
python_completion += builtin_module_names
python_completion += tuple(dir(__builtins__))
python_completion += [module_name[1] for module_name in iter_modules()]
try:
python_completion += tuple(__builtins__.__dict__.keys())
except:
pass
python_completion =... | null | null | null | python words for simple completion
| codeqa | def simple python completion python completion []python completion + builtin module namespython completion + tuple dir builtins python completion + [module name[ 1 ] for module name in iter modules ]try python completion + tuple builtins dict keys except passpython completion tuple sorted set python completion return p... | null | null | null | null | Question:
What do strings contain ?
Code:
def simple_python_completion():
python_completion = []
python_completion += builtin_module_names
python_completion += tuple(dir(__builtins__))
python_completion += [module_name[1] for module_name in iter_modules()]
try:
python_completion += tuple(__builtins__.__dict_... |
null | null | null | What is containing python words for simple completion ?
| def simple_python_completion():
python_completion = []
python_completion += builtin_module_names
python_completion += tuple(dir(__builtins__))
python_completion += [module_name[1] for module_name in iter_modules()]
try:
python_completion += tuple(__builtins__.__dict__.keys())
except:
pass
python_completion =... | null | null | null | strings
| codeqa | def simple python completion python completion []python completion + builtin module namespython completion + tuple dir builtins python completion + [module name[ 1 ] for module name in iter modules ]try python completion + tuple builtins dict keys except passpython completion tuple sorted set python completion return p... | null | null | null | null | Question:
What is containing python words for simple completion ?
Code:
def simple_python_completion():
python_completion = []
python_completion += builtin_module_names
python_completion += tuple(dir(__builtins__))
python_completion += [module_name[1] for module_name in iter_modules()]
try:
python_completion... |
null | null | null | What does it contain only ?
| @LocalContext
def printable(raw_bytes, *a, **kw):
return encode(raw_bytes, expr=re_printable, *a, **kw)
| null | null | null | non - space printable bytes
| codeqa | @ Local Contextdef printable raw bytes *a **kw return encode raw bytes expr re printable *a **kw
| null | null | null | null | Question:
What does it contain only ?
Code:
@LocalContext
def printable(raw_bytes, *a, **kw):
return encode(raw_bytes, expr=re_printable, *a, **kw)
|
null | null | null | For what purpose does the current path check ?
| def is_available(command, cached=True):
if (' ' in command):
command = command.split(' ')[0]
if (command in SHELL_COMMANDS):
return True
elif (cached and (command in CMD_AVAILABLE_CACHE)):
return CMD_AVAILABLE_CACHE[command]
else:
cmd_exists = (distutils.spawn.find_executable(command) is not None)
CMD_A... | null | null | null | to see if a command is available or not
| codeqa | def is available command cached True if '' in command command command split '' [0 ]if command in SHELL COMMANDS return Trueelif cached and command in CMD AVAILABLE CACHE return CMD AVAILABLE CACHE[command]else cmd exists distutils spawn find executable command is not None CMD AVAILABLE CACHE[command] cmd existsreturn c... | null | null | null | null | Question:
For what purpose does the current path check ?
Code:
def is_available(command, cached=True):
if (' ' in command):
command = command.split(' ')[0]
if (command in SHELL_COMMANDS):
return True
elif (cached and (command in CMD_AVAILABLE_CACHE)):
return CMD_AVAILABLE_CACHE[command]
else:
cmd_exis... |
null | null | null | Where does the target return ?
| def _GetOrCreateTargetByName(targets, target_name):
if (target_name in targets):
return (False, targets[target_name])
target = Target(target_name)
targets[target_name] = target
return (True, target)
| null | null | null | at targets[target_name
| codeqa | def Get Or Create Target By Name targets target name if target name in targets return False targets[target name] target Target target name targets[target name] targetreturn True target
| null | null | null | null | Question:
Where does the target return ?
Code:
def _GetOrCreateTargetByName(targets, target_name):
if (target_name in targets):
return (False, targets[target_name])
target = Target(target_name)
targets[target_name] = target
return (True, target)
|
null | null | null | What does the code convert into a cookie containing the one k / v pair ?
| def morsel_to_cookie(morsel):
expires = None
if morsel['max-age']:
expires = (time.time() + morsel['max-age'])
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = (time.mktime(time.strptime(morsel['expires'], time_template)) - time.timezone)
return create_cookie(comment=morsel['co... | null | null | null | a morsel object
| codeqa | def morsel to cookie morsel expires Noneif morsel['max-age'] expires time time + morsel['max-age'] elif morsel['expires'] time template '%a %d-%b-%Y%H %M %SGMT'expires time mktime time strptime morsel['expires'] time template - time timezone return create cookie comment morsel['comment'] comment url bool morsel['commen... | null | null | null | null | Question:
What does the code convert into a cookie containing the one k / v pair ?
Code:
def morsel_to_cookie(morsel):
expires = None
if morsel['max-age']:
expires = (time.time() + morsel['max-age'])
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = (time.mktime(time.strptime... |
null | null | null | What is containing the one k / v pair ?
| def morsel_to_cookie(morsel):
expires = None
if morsel['max-age']:
expires = (time.time() + morsel['max-age'])
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = (time.mktime(time.strptime(morsel['expires'], time_template)) - time.timezone)
return create_cookie(comment=morsel['co... | null | null | null | a cookie
| codeqa | def morsel to cookie morsel expires Noneif morsel['max-age'] expires time time + morsel['max-age'] elif morsel['expires'] time template '%a %d-%b-%Y%H %M %SGMT'expires time mktime time strptime morsel['expires'] time template - time timezone return create cookie comment morsel['comment'] comment url bool morsel['commen... | null | null | null | null | Question:
What is containing the one k / v pair ?
Code:
def morsel_to_cookie(morsel):
expires = None
if morsel['max-age']:
expires = (time.time() + morsel['max-age'])
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = (time.mktime(time.strptime(morsel['expires'], time_template... |
null | null | null | What does the code get ?
| def getNewRepository():
return LashRepository()
| null | null | null | new repository
| codeqa | def get New Repository return Lash Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return LashRepository()
|
null | null | null | What does this split into a list ?
| def oo_split(string, separator=','):
if isinstance(string, list):
return string
return string.split(separator)
| null | null | null | the input string
| codeqa | def oo split string separator ' ' if isinstance string list return stringreturn string split separator
| null | null | null | null | Question:
What does this split into a list ?
Code:
def oo_split(string, separator=','):
if isinstance(string, list):
return string
return string.split(separator)
|
null | null | null | What splits the input string into a list ?
| def oo_split(string, separator=','):
if isinstance(string, list):
return string
return string.split(separator)
| null | null | null | this
| codeqa | def oo split string separator ' ' if isinstance string list return stringreturn string split separator
| null | null | null | null | Question:
What splits the input string into a list ?
Code:
def oo_split(string, separator=','):
if isinstance(string, list):
return string
return string.split(separator)
|
null | null | null | What did the code give ?
| def to_progress_instance(progress):
if callable(progress):
return CallableRemoteProgress(progress)
elif (progress is None):
return RemoteProgress()
else:
return progress
| null | null | null | the progress
| codeqa | def to progress instance progress if callable progress return Callable Remote Progress progress elif progress is None return Remote Progress else return progress
| null | null | null | null | Question:
What did the code give ?
Code:
def to_progress_instance(progress):
if callable(progress):
return CallableRemoteProgress(progress)
elif (progress is None):
return RemoteProgress()
else:
return progress
|
null | null | null | What will hide the bug intentionally not ?
| def unverified_raw_input():
superConsole.SendKeys('x = raw_input{(}"foo:"{)}{ENTER}')
superConsole.SendKeys('{ENTER}')
| null | null | null | checking output on this test as redirecting stdout / stderr
| codeqa | def unverified raw input super Console Send Keys 'x raw input{ }"foo "{ }{ENTER}' super Console Send Keys '{ENTER}'
| null | null | null | null | Question:
What will hide the bug intentionally not ?
Code:
def unverified_raw_input():
superConsole.SendKeys('x = raw_input{(}"foo:"{)}{ENTER}')
superConsole.SendKeys('{ENTER}')
|
null | null | null | What will checking output on this test as redirecting stdout / stderr hide intentionally not ?
| def unverified_raw_input():
superConsole.SendKeys('x = raw_input{(}"foo:"{)}{ENTER}')
superConsole.SendKeys('{ENTER}')
| null | null | null | the bug
| codeqa | def unverified raw input super Console Send Keys 'x raw input{ }"foo "{ }{ENTER}' super Console Send Keys '{ENTER}'
| null | null | null | null | Question:
What will checking output on this test as redirecting stdout / stderr hide intentionally not ?
Code:
def unverified_raw_input():
superConsole.SendKeys('x = raw_input{(}"foo:"{)}{ENTER}')
superConsole.SendKeys('{ENTER}')
|
null | null | null | How did which force its own key ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | brute
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
How did which force its own key ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | What forces its own key brute ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | which
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
What forces its own key brute ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | What uses to encrypt a random string which is used in a known plaintext attack to brute force its own key ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | key passed in
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
What uses to encrypt a random string which is used in a known plaintext attack to brute force its own key ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | What does key passed in use ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | to encrypt a random string which is used in a known plaintext attack to brute force its own key
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
What does key passed in use ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | In which direction did key pass ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | in
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
In which direction did key pass ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | Where is which used ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | in a known plaintext attack
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
Where is which used ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | What is used in a known plaintext attack ?
| def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
| null | null | null | which
| codeqa | def known Plaintext known key random plaintext stallion AES new known key encrypted string Encode AES stallion random plaintext return encrypted string
| null | null | null | null | Question:
What is used in a known plaintext attack ?
Code:
def knownPlaintext(known_key, random_plaintext):
stallion = AES.new(known_key)
encrypted_string = EncodeAES(stallion, random_plaintext)
return encrypted_string
|
null | null | null | What does the code add to the context ?
| def ng_model_options(request):
return {u'EDITCART_NG_MODEL_OPTIONS': app_settings.EDITCART_NG_MODEL_OPTIONS, u'ADD2CART_NG_MODEL_OPTIONS': app_settings.ADD2CART_NG_MODEL_OPTIONS}
| null | null | null | ng - model - options
| codeqa | def ng model options request return {u'EDITCART NG MODEL OPTIONS' app settings EDITCART NG MODEL OPTIONS u'ADD 2 CART NG MODEL OPTIONS' app settings ADD 2 CART NG MODEL OPTIONS}
| null | null | null | null | Question:
What does the code add to the context ?
Code:
def ng_model_options(request):
return {u'EDITCART_NG_MODEL_OPTIONS': app_settings.EDITCART_NG_MODEL_OPTIONS, u'ADD2CART_NG_MODEL_OPTIONS': app_settings.ADD2CART_NG_MODEL_OPTIONS}
|
null | null | null | What does the code compute ?
| def ghd(ref, hyp, ins_cost=2.0, del_cost=2.0, shift_cost_coeff=1.0, boundary='1'):
ref_idx = [i for (i, val) in enumerate(ref) if (val == boundary)]
hyp_idx = [i for (i, val) in enumerate(hyp) if (val == boundary)]
nref_bound = len(ref_idx)
nhyp_bound = len(hyp_idx)
if ((nref_bound == 0) and (nhyp_bound == 0)):
... | null | null | null | the generalized hamming distance for a reference and a hypothetical segmentation
| codeqa | def ghd ref hyp ins cost 2 0 del cost 2 0 shift cost coeff 1 0 boundary '1 ' ref idx [i for i val in enumerate ref if val boundary ]hyp idx [i for i val in enumerate hyp if val boundary ]nref bound len ref idx nhyp bound len hyp idx if nref bound 0 and nhyp bound 0 return 0 0elif nref bound > 0 and nhyp bound 0 return ... | null | null | null | null | Question:
What does the code compute ?
Code:
def ghd(ref, hyp, ins_cost=2.0, del_cost=2.0, shift_cost_coeff=1.0, boundary='1'):
ref_idx = [i for (i, val) in enumerate(ref) if (val == boundary)]
hyp_idx = [i for (i, val) in enumerate(hyp) if (val == boundary)]
nref_bound = len(ref_idx)
nhyp_bound = len(hyp_idx)
... |
null | null | null | How does the code get triangle mesh from attribute dictionary ?
| def getGeometryOutputByArguments(arguments, elementNode):
return getGeometryOutput(None, elementNode)
| null | null | null | by arguments
| codeqa | def get Geometry Output By Arguments arguments element Node return get Geometry Output None element Node
| null | null | null | null | Question:
How does the code get triangle mesh from attribute dictionary ?
Code:
def getGeometryOutputByArguments(arguments, elementNode):
return getGeometryOutput(None, elementNode)
|
null | null | null | What does the code get from attribute dictionary by arguments ?
| def getGeometryOutputByArguments(arguments, elementNode):
return getGeometryOutput(None, elementNode)
| null | null | null | triangle mesh
| codeqa | def get Geometry Output By Arguments arguments element Node return get Geometry Output None element Node
| null | null | null | null | Question:
What does the code get from attribute dictionary by arguments ?
Code:
def getGeometryOutputByArguments(arguments, elementNode):
return getGeometryOutput(None, elementNode)
|
null | null | null | What used a handler function to handle suspicious interface nodes ?
| def _iface_hdlr(iface_node):
return True
| null | null | null | by interfaces
| codeqa | def iface hdlr iface node return True
| null | null | null | null | Question:
What used a handler function to handle suspicious interface nodes ?
Code:
def _iface_hdlr(iface_node):
return True
|
null | null | null | What adds to an element - either single quotes or double quotes ?
| def elem_quote(member, nonquote=True, stringify=False, encoding=None):
if (not isinstance(member, basestring)):
if stringify:
member = str(member)
else:
raise TypeError(('Can only quote strings. "%s"' % str(member)))
if (encoding and isinstance(member, str)):
member = unicode(member, encoding)
if ('\... | null | null | null | the most appropriate quote
| codeqa | def elem quote member nonquote True stringify False encoding None if not isinstance member basestring if stringify member str member else raise Type Error ' Canonlyquotestrings "%s"' % str member if encoding and isinstance member str member unicode member encoding if '\n' in member raise Quote Error ' Multilinevaluesca... | null | null | null | null | Question:
What adds to an element - either single quotes or double quotes ?
Code:
def elem_quote(member, nonquote=True, stringify=False, encoding=None):
if (not isinstance(member, basestring)):
if stringify:
member = str(member)
else:
raise TypeError(('Can only quote strings. "%s"' % str(member)))
i... |
null | null | null | What do the most appropriate quote add ?
| def elem_quote(member, nonquote=True, stringify=False, encoding=None):
if (not isinstance(member, basestring)):
if stringify:
member = str(member)
else:
raise TypeError(('Can only quote strings. "%s"' % str(member)))
if (encoding and isinstance(member, str)):
member = unicode(member, encoding)
if ('\... | null | null | null | to an element - either single quotes or double quotes
| codeqa | def elem quote member nonquote True stringify False encoding None if not isinstance member basestring if stringify member str member else raise Type Error ' Canonlyquotestrings "%s"' % str member if encoding and isinstance member str member unicode member encoding if '\n' in member raise Quote Error ' Multilinevaluesca... | null | null | null | null | Question:
What do the most appropriate quote add ?
Code:
def elem_quote(member, nonquote=True, stringify=False, encoding=None):
if (not isinstance(member, basestring)):
if stringify:
member = str(member)
else:
raise TypeError(('Can only quote strings. "%s"' % str(member)))
if (encoding and isinstanc... |
null | null | null | Where does a hex escape sequence parse ?
| def parse_repl_hex_escape(source, expected_len, type):
digits = []
for i in range(expected_len):
ch = source.get()
if (ch not in HEX_DIGITS):
raise error(('incomplete escape \\%s%s' % (type, ''.join(digits))), source.string, source.pos)
digits.append(ch)
return int(''.join(digits), 16)
| null | null | null | in a replacement string
| codeqa | def parse repl hex escape source expected len type digits []for i in range expected len ch source get if ch not in HEX DIGITS raise error 'incompleteescape\\%s%s' % type '' join digits source string source pos digits append ch return int '' join digits 16
| null | null | null | null | Question:
Where does a hex escape sequence parse ?
Code:
def parse_repl_hex_escape(source, expected_len, type):
digits = []
for i in range(expected_len):
ch = source.get()
if (ch not in HEX_DIGITS):
raise error(('incomplete escape \\%s%s' % (type, ''.join(digits))), source.string, source.pos)
digits.ap... |
null | null | null | What parses in a replacement string ?
| def parse_repl_hex_escape(source, expected_len, type):
digits = []
for i in range(expected_len):
ch = source.get()
if (ch not in HEX_DIGITS):
raise error(('incomplete escape \\%s%s' % (type, ''.join(digits))), source.string, source.pos)
digits.append(ch)
return int(''.join(digits), 16)
| null | null | null | a hex escape sequence
| codeqa | def parse repl hex escape source expected len type digits []for i in range expected len ch source get if ch not in HEX DIGITS raise error 'incompleteescape\\%s%s' % type '' join digits source string source pos digits append ch return int '' join digits 16
| null | null | null | null | Question:
What parses in a replacement string ?
Code:
def parse_repl_hex_escape(source, expected_len, type):
digits = []
for i in range(expected_len):
ch = source.get()
if (ch not in HEX_DIGITS):
raise error(('incomplete escape \\%s%s' % (type, ''.join(digits))), source.string, source.pos)
digits.appen... |
null | null | null | What does the code get ?
| def get_humidity():
return _sensehat.get_humidity()
| null | null | null | the percentage of relative humidity from the humidity sensor
| codeqa | def get humidity return sensehat get humidity
| null | null | null | null | Question:
What does the code get ?
Code:
def get_humidity():
return _sensehat.get_humidity()
|
null | null | null | When do old tweets for each locale purge ?
| @cronjobs.register
def purge_tweets():
pin_this_thread()
for locale in settings.SUMO_LANGUAGES:
locale = settings.LOCALES[locale].iso639_1
if (not locale):
continue
oldest = _get_oldest_tweet(locale, settings.CC_MAX_TWEETS)
if oldest:
log.debug(('Truncating tweet list: Removing tweets older than ... | null | null | null | periodically
| codeqa | @cronjobs registerdef purge tweets pin this thread for locale in settings SUMO LANGUAGES locale settings LOCALES[locale] iso 639 1if not locale continueoldest get oldest tweet locale settings CC MAX TWEETS if oldest log debug ' Truncatingtweetlist Removingtweetsolderthan%s for[%s] ' % oldest created locale Tweet object... | null | null | null | null | Question:
When do old tweets for each locale purge ?
Code:
@cronjobs.register
def purge_tweets():
pin_this_thread()
for locale in settings.SUMO_LANGUAGES:
locale = settings.LOCALES[locale].iso639_1
if (not locale):
continue
oldest = _get_oldest_tweet(locale, settings.CC_MAX_TWEETS)
if oldest:
log.de... |
null | null | null | What does the code determine ?
| def hypermedia_out():
request = cherrypy.serving.request
request._hypermedia_inner_handler = request.handler
request.handler = hypermedia_handler
| null | null | null | the best handler for the requested content type
| codeqa | def hypermedia out request cherrypy serving requestrequest hypermedia inner handler request handlerrequest handler hypermedia handler
| null | null | null | null | Question:
What does the code determine ?
Code:
def hypermedia_out():
request = cherrypy.serving.request
request._hypermedia_inner_handler = request.handler
request.handler = hypermedia_handler
|
null | null | null | What does the code transform into the requested content type ?
| def hypermedia_out():
request = cherrypy.serving.request
request._hypermedia_inner_handler = request.handler
request.handler = hypermedia_handler
| null | null | null | the output from that handler
| codeqa | def hypermedia out request cherrypy serving requestrequest hypermedia inner handler request handlerrequest handler hypermedia handler
| null | null | null | null | Question:
What does the code transform into the requested content type ?
Code:
def hypermedia_out():
request = cherrypy.serving.request
request._hypermedia_inner_handler = request.handler
request.handler = hypermedia_handler
|
null | null | null | How did the default scheduler mark ?
| def clear(tag=None):
default_scheduler.clear(tag)
| null | null | null | with the given tag
| codeqa | def clear tag None default scheduler clear tag
| null | null | null | null | Question:
How did the default scheduler mark ?
Code:
def clear(tag=None):
default_scheduler.clear(tag)
|
null | null | null | What deletes on the default scheduler marked with the given tag ?
| def clear(tag=None):
default_scheduler.clear(tag)
| null | null | null | scheduled jobs
| codeqa | def clear tag None default scheduler clear tag
| null | null | null | null | Question:
What deletes on the default scheduler marked with the given tag ?
Code:
def clear(tag=None):
default_scheduler.clear(tag)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.