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 return ?
def get_c_type(name): if isinstance(name, asdl.Id): name = name.value if (name in asdl.builtin_types): return name else: return ('%s_ty' % name)
null
null
null
a string for the c name of the type
codeqa
def get c type name if isinstance name asdl Id name name valueif name in asdl builtin types return nameelse return '%s ty' % name
null
null
null
null
Question: What does the code return ? Code: def get_c_type(name): if isinstance(name, asdl.Id): name = name.value if (name in asdl.builtin_types): return name else: return ('%s_ty' % name)
null
null
null
What is representing the default user agent ?
def default_user_agent(name='python-requests'): return ('%s/%s' % (name, __version__))
null
null
null
a string
codeqa
def default user agent name 'python-requests' return '%s/%s' % name version
null
null
null
null
Question: What is representing the default user agent ? Code: def default_user_agent(name='python-requests'): return ('%s/%s' % (name, __version__))
null
null
null
What do a string represent ?
def default_user_agent(name='python-requests'): return ('%s/%s' % (name, __version__))
null
null
null
the default user agent
codeqa
def default user agent name 'python-requests' return '%s/%s' % name version
null
null
null
null
Question: What do a string represent ? Code: def default_user_agent(name='python-requests'): return ('%s/%s' % (name, __version__))
null
null
null
What returns within a string ?
def col(loc, strg): return ((((loc < len(strg)) and (strg[loc] == '\n')) and 1) or (loc - strg.rfind('\n', 0, loc)))
null
null
null
current column
codeqa
def col loc strg return loc < len strg and strg[loc] '\n' and 1 or loc - strg rfind '\n' 0 loc
null
null
null
null
Question: What returns within a string ? Code: def col(loc, strg): return ((((loc < len(strg)) and (strg[loc] == '\n')) and 1) or (loc - strg.rfind('\n', 0, loc)))
null
null
null
Where does current column return ?
def col(loc, strg): return ((((loc < len(strg)) and (strg[loc] == '\n')) and 1) or (loc - strg.rfind('\n', 0, loc)))
null
null
null
within a string
codeqa
def col loc strg return loc < len strg and strg[loc] '\n' and 1 or loc - strg rfind '\n' 0 loc
null
null
null
null
Question: Where does current column return ? Code: def col(loc, strg): return ((((loc < len(strg)) and (strg[loc] == '\n')) and 1) or (loc - strg.rfind('\n', 0, loc)))
null
null
null
What does the code get ?
def key_pair_get_all_by_user(context, user_id): return IMPL.key_pair_get_all_by_user(context, user_id)
null
null
null
all key_pairs by user
codeqa
def key pair get all by user context user id return IMPL key pair get all by user context user id
null
null
null
null
Question: What does the code get ? Code: def key_pair_get_all_by_user(context, user_id): return IMPL.key_pair_get_all_by_user(context, user_id)
null
null
null
What does the code return ?
@lru_cache() def get_babel_locale(locale_string): return babel.Locale.parse(locale_string, '-')
null
null
null
a babel locale
codeqa
@lru cache def get babel locale locale string return babel Locale parse locale string '-'
null
null
null
null
Question: What does the code return ? Code: @lru_cache() def get_babel_locale(locale_string): return babel.Locale.parse(locale_string, '-')
null
null
null
Where do common settings keep ?
def _create_unverified_context(protocol=PROTOCOL_SSLv23, cert_reqs=None, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): if (not isinstance(purpose, _ASN1Object)): raise TypeError(purpose) context = SSLContext(protocol) context.options |= OP_NO_SSLv2 context.options |= OP_NO_SSLv3 if (cert_reqs is not None): context.verify_mode = cert_reqs context.check_hostname = check_hostname if (keyfile and (not certfile)): raise ValueError('certfile must be specified') if (certfile or keyfile): context.load_cert_chain(certfile, keyfile) if (cafile or capath or cadata): context.load_verify_locations(cafile, capath, cadata) elif (context.verify_mode != CERT_NONE): context.load_default_certs(purpose) return context
null
null
null
in one place
codeqa
def create unverified context protocol PROTOCOL SS Lv 23 cert reqs None check hostname False purpose Purpose SERVER AUTH certfile None keyfile None cafile None capath None cadata None if not isinstance purpose ASN 1 Object raise Type Error purpose context SSL Context protocol context options OP NO SS Lv 2 context options OP NO SS Lv 3 if cert reqs is not None context verify mode cert reqscontext check hostname check hostnameif keyfile and not certfile raise Value Error 'certfilemustbespecified' if certfile or keyfile context load cert chain certfile keyfile if cafile or capath or cadata context load verify locations cafile capath cadata elif context verify mode CERT NONE context load default certs purpose return context
null
null
null
null
Question: Where do common settings keep ? Code: def _create_unverified_context(protocol=PROTOCOL_SSLv23, cert_reqs=None, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): if (not isinstance(purpose, _ASN1Object)): raise TypeError(purpose) context = SSLContext(protocol) context.options |= OP_NO_SSLv2 context.options |= OP_NO_SSLv3 if (cert_reqs is not None): context.verify_mode = cert_reqs context.check_hostname = check_hostname if (keyfile and (not certfile)): raise ValueError('certfile must be specified') if (certfile or keyfile): context.load_cert_chain(certfile, keyfile) if (cafile or capath or cadata): context.load_verify_locations(cafile, capath, cadata) elif (context.verify_mode != CERT_NONE): context.load_default_certs(purpose) return context
null
null
null
What keeps in one place ?
def _create_unverified_context(protocol=PROTOCOL_SSLv23, cert_reqs=None, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): if (not isinstance(purpose, _ASN1Object)): raise TypeError(purpose) context = SSLContext(protocol) context.options |= OP_NO_SSLv2 context.options |= OP_NO_SSLv3 if (cert_reqs is not None): context.verify_mode = cert_reqs context.check_hostname = check_hostname if (keyfile and (not certfile)): raise ValueError('certfile must be specified') if (certfile or keyfile): context.load_cert_chain(certfile, keyfile) if (cafile or capath or cadata): context.load_verify_locations(cafile, capath, cadata) elif (context.verify_mode != CERT_NONE): context.load_default_certs(purpose) return context
null
null
null
common settings
codeqa
def create unverified context protocol PROTOCOL SS Lv 23 cert reqs None check hostname False purpose Purpose SERVER AUTH certfile None keyfile None cafile None capath None cadata None if not isinstance purpose ASN 1 Object raise Type Error purpose context SSL Context protocol context options OP NO SS Lv 2 context options OP NO SS Lv 3 if cert reqs is not None context verify mode cert reqscontext check hostname check hostnameif keyfile and not certfile raise Value Error 'certfilemustbespecified' if certfile or keyfile context load cert chain certfile keyfile if cafile or capath or cadata context load verify locations cafile capath cadata elif context verify mode CERT NONE context load default certs purpose return context
null
null
null
null
Question: What keeps in one place ? Code: def _create_unverified_context(protocol=PROTOCOL_SSLv23, cert_reqs=None, check_hostname=False, purpose=Purpose.SERVER_AUTH, certfile=None, keyfile=None, cafile=None, capath=None, cadata=None): if (not isinstance(purpose, _ASN1Object)): raise TypeError(purpose) context = SSLContext(protocol) context.options |= OP_NO_SSLv2 context.options |= OP_NO_SSLv3 if (cert_reqs is not None): context.verify_mode = cert_reqs context.check_hostname = check_hostname if (keyfile and (not certfile)): raise ValueError('certfile must be specified') if (certfile or keyfile): context.load_cert_chain(certfile, keyfile) if (cafile or capath or cadata): context.load_verify_locations(cafile, capath, cadata) elif (context.verify_mode != CERT_NONE): context.load_default_certs(purpose) return context
null
null
null
When does the text s in front of the cursor ?
def AdjustCandidateInsertionText(candidates): def NewCandidateInsertionText(to_insert, text_after_cursor): overlap_len = OverlapLength(to_insert, text_after_cursor) if overlap_len: return to_insert[:(- overlap_len)] return to_insert text_after_cursor = vimsupport.TextAfterCursor() if (not text_after_cursor): return candidates new_candidates = [] for candidate in candidates: if isinstance(candidate, dict): new_candidate = candidate.copy() if (u'abbr' not in new_candidate): new_candidate[u'abbr'] = new_candidate[u'word'] new_candidate[u'word'] = NewCandidateInsertionText(new_candidate[u'word'], text_after_cursor) new_candidates.append(new_candidate) elif (isinstance(candidate, str) or isinstance(candidate, bytes)): new_candidates.append({u'abbr': candidate, u'word': NewCandidateInsertionText(candidate, text_after_cursor)}) return new_candidates
null
null
null
currently
codeqa
def Adjust Candidate Insertion Text candidates def New Candidate Insertion Text to insert text after cursor overlap len Overlap Length to insert text after cursor if overlap len return to insert[ - overlap len ]return to inserttext after cursor vimsupport Text After Cursor if not text after cursor return candidatesnew candidates []for candidate in candidates if isinstance candidate dict new candidate candidate copy if u'abbr' not in new candidate new candidate[u'abbr'] new candidate[u'word']new candidate[u'word'] New Candidate Insertion Text new candidate[u'word'] text after cursor new candidates append new candidate elif isinstance candidate str or isinstance candidate bytes new candidates append {u'abbr' candidate u'word' New Candidate Insertion Text candidate text after cursor } return new candidates
null
null
null
null
Question: When does the text s in front of the cursor ? Code: def AdjustCandidateInsertionText(candidates): def NewCandidateInsertionText(to_insert, text_after_cursor): overlap_len = OverlapLength(to_insert, text_after_cursor) if overlap_len: return to_insert[:(- overlap_len)] return to_insert text_after_cursor = vimsupport.TextAfterCursor() if (not text_after_cursor): return candidates new_candidates = [] for candidate in candidates: if isinstance(candidate, dict): new_candidate = candidate.copy() if (u'abbr' not in new_candidate): new_candidate[u'abbr'] = new_candidate[u'word'] new_candidate[u'word'] = NewCandidateInsertionText(new_candidate[u'word'], text_after_cursor) new_candidates.append(new_candidate) elif (isinstance(candidate, str) or isinstance(candidate, bytes)): new_candidates.append({u'abbr': candidate, u'word': NewCandidateInsertionText(candidate, text_after_cursor)}) return new_candidates
null
null
null
What easy_installed in the global environment ?
def force_global_eggs_after_local_site_packages(): egginsert = getattr(sys, '__egginsert', 0) for (i, path) in enumerate(sys.path): if ((i > egginsert) and path.startswith(sys.prefix)): egginsert = i sys.__egginsert = (egginsert + 1)
null
null
null
eggs
codeqa
def force global eggs after local site packages egginsert getattr sys ' egginsert' 0 for i path in enumerate sys path if i > egginsert and path startswith sys prefix egginsert isys egginsert egginsert + 1
null
null
null
null
Question: What easy_installed in the global environment ? Code: def force_global_eggs_after_local_site_packages(): egginsert = getattr(sys, '__egginsert', 0) for (i, path) in enumerate(sys.path): if ((i > egginsert) and path.startswith(sys.prefix)): egginsert = i sys.__egginsert = (egginsert + 1)
null
null
null
What does the code ensure ?
def rule_absent(name, method, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, reload=False): ip = name ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Rule not present.'} exists = __salt__['csf.exists'](method, ip, port=port, proto=proto, direction=direction, port_origin=port_origin, ip_origin=ip_origin, ttl=ttl) if (not exists): return ret else: rule = __salt__['csf.remove_rule'](method=method, ip=ip, port=port, proto=proto, direction=direction, port_origin=port_origin, ip_origin=ip_origin, comment='', ttl=ttl) if rule: comment = 'Rule has been removed.' if reload: if __salt__['csf.reload'](): comment += ' Csf reloaded.' else: comment += 'Csf unable to be reloaded.' ret['comment'] = comment ret['changes']['Rule'] = 'Removed' return ret
null
null
null
iptable is not present
codeqa
def rule absent name method port None proto 'tcp' direction 'in' port origin 'd' ip origin 's' ttl None reload False ip nameret {'name' name 'changes' {} 'result' True 'comment' ' Rulenotpresent '}exists salt ['csf exists'] method ip port port proto proto direction direction port origin port origin ip origin ip origin ttl ttl if not exists return retelse rule salt ['csf remove rule'] method method ip ip port port proto proto direction direction port origin port origin ip origin ip origin comment '' ttl ttl if rule comment ' Rulehasbeenremoved 'if reload if salt ['csf reload'] comment + ' Csfreloaded 'else comment + ' Csfunabletobereloaded 'ret['comment'] commentret['changes'][' Rule'] ' Removed'return ret
null
null
null
null
Question: What does the code ensure ? Code: def rule_absent(name, method, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, reload=False): ip = name ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Rule not present.'} exists = __salt__['csf.exists'](method, ip, port=port, proto=proto, direction=direction, port_origin=port_origin, ip_origin=ip_origin, ttl=ttl) if (not exists): return ret else: rule = __salt__['csf.remove_rule'](method=method, ip=ip, port=port, proto=proto, direction=direction, port_origin=port_origin, ip_origin=ip_origin, comment='', ttl=ttl) if rule: comment = 'Rule has been removed.' if reload: if __salt__['csf.reload'](): comment += ' Csf reloaded.' else: comment += 'Csf unable to be reloaded.' ret['comment'] = comment ret['changes']['Rule'] = 'Removed' return ret
null
null
null
By how much did properties reserve ?
def get_other_props(all_props, reserved_props): if (hasattr(all_props, 'items') and callable(all_props.items)): return dict([(k, v) for (k, v) in all_props.items() if (k not in reserved_props)])
null
null
null
non
codeqa
def get other props all props reserved props if hasattr all props 'items' and callable all props items return dict [ k v for k v in all props items if k not in reserved props ]
null
null
null
null
Question: By how much did properties reserve ? Code: def get_other_props(all_props, reserved_props): if (hasattr(all_props, 'items') and callable(all_props.items)): return dict([(k, v) for (k, v) in all_props.items() if (k not in reserved_props)])
null
null
null
What does the code retrieve from a dictionary of properties @args ?
def get_other_props(all_props, reserved_props): if (hasattr(all_props, 'items') and callable(all_props.items)): return dict([(k, v) for (k, v) in all_props.items() if (k not in reserved_props)])
null
null
null
the non - reserved properties
codeqa
def get other props all props reserved props if hasattr all props 'items' and callable all props items return dict [ k v for k v in all props items if k not in reserved props ]
null
null
null
null
Question: What does the code retrieve from a dictionary of properties @args ? Code: def get_other_props(all_props, reserved_props): if (hasattr(all_props, 'items') and callable(all_props.items)): return dict([(k, v) for (k, v) in all_props.items() if (k not in reserved_props)])
null
null
null
How are values returned ?
def fake_input(inputs): it = iter(inputs) def mock_input(prompt=''): try: return next(it) except StopIteration: raise EOFError('No more inputs given') return patch('builtins.input', mock_input)
null
null
null
in order
codeqa
def fake input inputs it iter inputs def mock input prompt '' try return next it except Stop Iteration raise EOF Error ' Nomoreinputsgiven' return patch 'builtins input' mock input
null
null
null
null
Question: How are values returned ? Code: def fake_input(inputs): it = iter(inputs) def mock_input(prompt=''): try: return next(it) except StopIteration: raise EOFError('No more inputs given') return patch('builtins.input', mock_input)
null
null
null
What does the code stop by name ?
def stop(name, call=None): datacenter_id = get_datacenter_id() conn = get_conn() node = get_node(conn, name) conn.stop_server(datacenter_id=datacenter_id, server_id=node['id']) return True
null
null
null
a machine
codeqa
def stop name call None datacenter id get datacenter id conn get conn node get node conn name conn stop server datacenter id datacenter id server id node['id'] return True
null
null
null
null
Question: What does the code stop by name ? Code: def stop(name, call=None): datacenter_id = get_datacenter_id() conn = get_conn() node = get_node(conn, name) conn.stop_server(datacenter_id=datacenter_id, server_id=node['id']) return True
null
null
null
How does the code stop a machine ?
def stop(name, call=None): datacenter_id = get_datacenter_id() conn = get_conn() node = get_node(conn, name) conn.stop_server(datacenter_id=datacenter_id, server_id=node['id']) return True
null
null
null
by name
codeqa
def stop name call None datacenter id get datacenter id conn get conn node get node conn name conn stop server datacenter id datacenter id server id node['id'] return True
null
null
null
null
Question: How does the code stop a machine ? Code: def stop(name, call=None): datacenter_id = get_datacenter_id() conn = get_conn() node = get_node(conn, name) conn.stop_server(datacenter_id=datacenter_id, server_id=node['id']) return True
null
null
null
Where is each key an argument name ?
def split_args(args): args_dict = {} for arg in args: split_arg = arg.split('=', 1) if (len(split_arg) > 1): value = split_arg[1] else: value = True args_dict[split_arg[0]] = value return args_dict
null
null
null
a dictionary
codeqa
def split args args args dict {}for arg in args split arg arg split ' ' 1 if len split arg > 1 value split arg[ 1 ]else value Trueargs dict[split arg[ 0 ]] valuereturn args dict
null
null
null
null
Question: Where is each key an argument name ? Code: def split_args(args): args_dict = {} for arg in args: split_arg = arg.split('=', 1) if (len(split_arg) > 1): value = split_arg[1] else: value = True args_dict[split_arg[0]] = value return args_dict
null
null
null
What extracts user abort ?
def ParseAbortMsg(msg): parsed = re.match(kAbortMsgRe, msg) if (not parsed): return None try: (user, device, op, class_name, method_name, request) = parsed.groups() return (user, device, op, class_name, method_name, request) except Exception as e: logging.warning(('RE matched "%s", but extracted wrong numbers of items: %r' % (msg, e))) return None
null
null
null
a user_op_manager
codeqa
def Parse Abort Msg msg parsed re match k Abort Msg Re msg if not parsed return Nonetry user device op class name method name request parsed groups return user device op class name method name request except Exception as e logging warning 'R Ematched"%s" butextractedwrongnumbersofitems %r' % msg e return None
null
null
null
null
Question: What extracts user abort ? Code: def ParseAbortMsg(msg): parsed = re.match(kAbortMsgRe, msg) if (not parsed): return None try: (user, device, op, class_name, method_name, request) = parsed.groups() return (user, device, op, class_name, method_name, request) except Exception as e: logging.warning(('RE matched "%s", but extracted wrong numbers of items: %r' % (msg, e))) return None
null
null
null
How do a user_op_manager extract user ?
def ParseAbortMsg(msg): parsed = re.match(kAbortMsgRe, msg) if (not parsed): return None try: (user, device, op, class_name, method_name, request) = parsed.groups() return (user, device, op, class_name, method_name, request) except Exception as e: logging.warning(('RE matched "%s", but extracted wrong numbers of items: %r' % (msg, e))) return None
null
null
null
abort
codeqa
def Parse Abort Msg msg parsed re match k Abort Msg Re msg if not parsed return Nonetry user device op class name method name request parsed groups return user device op class name method name request except Exception as e logging warning 'R Ematched"%s" butextractedwrongnumbersofitems %r' % msg e return None
null
null
null
null
Question: How do a user_op_manager extract user ? Code: def ParseAbortMsg(msg): parsed = re.match(kAbortMsgRe, msg) if (not parsed): return None try: (user, device, op, class_name, method_name, request) = parsed.groups() return (user, device, op, class_name, method_name, request) except Exception as e: logging.warning(('RE matched "%s", but extracted wrong numbers of items: %r' % (msg, e))) return None
null
null
null
Where did the code set an environment variable ?
def set_env(user, name, value=None): lst = list_tab(user) for env in lst['env']: if (name == env['name']): if (value != env['value']): rm_env(user, name) jret = set_env(user, name, value) if (jret == 'new'): return 'updated' else: return jret return 'present' env = {'name': name, 'value': value} lst['env'].append(env) comdat = _write_cron_lines(user, _render_tab(lst)) if comdat['retcode']: return comdat['stderr'] return 'new'
null
null
null
in the crontab
codeqa
def set env user name value None lst list tab user for env in lst['env'] if name env['name'] if value env['value'] rm env user name jret set env user name value if jret 'new' return 'updated'else return jretreturn 'present'env {'name' name 'value' value}lst['env'] append env comdat write cron lines user render tab lst if comdat['retcode'] return comdat['stderr']return 'new'
null
null
null
null
Question: Where did the code set an environment variable ? Code: def set_env(user, name, value=None): lst = list_tab(user) for env in lst['env']: if (name == env['name']): if (value != env['value']): rm_env(user, name) jret = set_env(user, name, value) if (jret == 'new'): return 'updated' else: return jret return 'present' env = {'name': name, 'value': value} lst['env'].append(env) comdat = _write_cron_lines(user, _render_tab(lst)) if comdat['retcode']: return comdat['stderr'] return 'new'
null
null
null
What did the code set in the crontab ?
def set_env(user, name, value=None): lst = list_tab(user) for env in lst['env']: if (name == env['name']): if (value != env['value']): rm_env(user, name) jret = set_env(user, name, value) if (jret == 'new'): return 'updated' else: return jret return 'present' env = {'name': name, 'value': value} lst['env'].append(env) comdat = _write_cron_lines(user, _render_tab(lst)) if comdat['retcode']: return comdat['stderr'] return 'new'
null
null
null
an environment variable
codeqa
def set env user name value None lst list tab user for env in lst['env'] if name env['name'] if value env['value'] rm env user name jret set env user name value if jret 'new' return 'updated'else return jretreturn 'present'env {'name' name 'value' value}lst['env'] append env comdat write cron lines user render tab lst if comdat['retcode'] return comdat['stderr']return 'new'
null
null
null
null
Question: What did the code set in the crontab ? Code: def set_env(user, name, value=None): lst = list_tab(user) for env in lst['env']: if (name == env['name']): if (value != env['value']): rm_env(user, name) jret = set_env(user, name, value) if (jret == 'new'): return 'updated' else: return jret return 'present' env = {'name': name, 'value': value} lst['env'].append(env) comdat = _write_cron_lines(user, _render_tab(lst)) if comdat['retcode']: return comdat['stderr'] return 'new'
null
null
null
How do the entire directory dump ?
def DumpAllObjects(): path = ('LDAP://%srootDSE' % server) rootdse = ADsGetObject(path) name = rootdse.Get('defaultNamingContext') path = (('LDAP://' + server) + name) print 'Binding to', path ob = ADsGetObject(path) _DumpObject(ob)
null
null
null
recursively
codeqa
def Dump All Objects path 'LDAP //%sroot DSE' % server rootdse A Ds Get Object path name rootdse Get 'default Naming Context' path 'LDAP //' + server + name print ' Bindingto' pathob A Ds Get Object path Dump Object ob
null
null
null
null
Question: How do the entire directory dump ? Code: def DumpAllObjects(): path = ('LDAP://%srootDSE' % server) rootdse = ADsGetObject(path) name = rootdse.Get('defaultNamingContext') path = (('LDAP://' + server) + name) print 'Binding to', path ob = ADsGetObject(path) _DumpObject(ob)
null
null
null
Where do the full path to the first match of the given command return ?
def which(command, path=None, verbose=0, exts=None): try: (absName, fromWhere) = whichgen(command, path, verbose, exts).next() except StopIteration: raise WhichError(("Could not find '%s' on the path." % command)) if verbose: return (absName, fromWhere) else: return absName
null
null
null
on the path
codeqa
def which command path None verbose 0 exts None try abs Name from Where whichgen command path verbose exts next except Stop Iteration raise Which Error " Couldnotfind'%s'onthepath " % command if verbose return abs Name from Where else return abs Name
null
null
null
null
Question: Where do the full path to the first match of the given command return ? Code: def which(command, path=None, verbose=0, exts=None): try: (absName, fromWhere) = whichgen(command, path, verbose, exts).next() except StopIteration: raise WhichError(("Could not find '%s' on the path." % command)) if verbose: return (absName, fromWhere) else: return absName
null
null
null
What returns on the path ?
def which(command, path=None, verbose=0, exts=None): try: (absName, fromWhere) = whichgen(command, path, verbose, exts).next() except StopIteration: raise WhichError(("Could not find '%s' on the path." % command)) if verbose: return (absName, fromWhere) else: return absName
null
null
null
the full path to the first match of the given command
codeqa
def which command path None verbose 0 exts None try abs Name from Where whichgen command path verbose exts next except Stop Iteration raise Which Error " Couldnotfind'%s'onthepath " % command if verbose return abs Name from Where else return abs Name
null
null
null
null
Question: What returns on the path ? Code: def which(command, path=None, verbose=0, exts=None): try: (absName, fromWhere) = whichgen(command, path, verbose, exts).next() except StopIteration: raise WhichError(("Could not find '%s' on the path." % command)) if verbose: return (absName, fromWhere) else: return absName
null
null
null
What provided on the surface of the earth ?
def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
locations
codeqa
def elevation client locations params {'locations' convert shortest path locations }return client get '/maps/api/elevation/json' params ['results']
null
null
null
null
Question: What provided on the surface of the earth ? Code: def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
Where did locations provide ?
def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
on the surface of the earth
codeqa
def elevation client locations params {'locations' convert shortest path locations }return client get '/maps/api/elevation/json' params ['results']
null
null
null
null
Question: Where did locations provide ? Code: def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
What does the code provide ?
def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
elevation data for locations provided on the surface of the earth
codeqa
def elevation client locations params {'locations' convert shortest path locations }return client get '/maps/api/elevation/json' params ['results']
null
null
null
null
Question: What does the code provide ? Code: def elevation(client, locations): params = {'locations': convert.shortest_path(locations)} return client._get('/maps/api/elevation/json', params)['results']
null
null
null
What does the code flatten with any level ?
def flatten(iterable, tr_func=None, results=None): if (results is None): results = [] for val in iterable: if isinstance(val, (list, tuple)): flatten(val, tr_func, results) elif (tr_func is None): results.append(val) else: results.append(tr_func(val)) return results
null
null
null
a list of list
codeqa
def flatten iterable tr func None results None if results is None results []for val in iterable if isinstance val list tuple flatten val tr func results elif tr func is None results append val else results append tr func val return results
null
null
null
null
Question: What does the code flatten with any level ? Code: def flatten(iterable, tr_func=None, results=None): if (results is None): results = [] for val in iterable: if isinstance(val, (list, tuple)): flatten(val, tr_func, results) elif (tr_func is None): results.append(val) else: results.append(tr_func(val)) return results
null
null
null
What does the code apply ?
def predict(model, features): (t, fi, reverse) = model if reverse: return (features[:, fi] <= t) else: return (features[:, fi] > t)
null
null
null
a learned model
codeqa
def predict model features t fi reverse modelif reverse return features[ fi] < t else return features[ fi] > t
null
null
null
null
Question: What does the code apply ? Code: def predict(model, features): (t, fi, reverse) = model if reverse: return (features[:, fi] <= t) else: return (features[:, fi] > t)
null
null
null
What does the code delete ?
@patch('twilio.rest.resources.base.Resource.request') def test_delete_transcription(req): resp = Mock() resp.content = '' resp.status_code = 204 req.return_value = (resp, {}) app = Transcription(transcriptions, 'TR123') app.delete() uri = 'https://api.twilio.com/2010-04-01/Accounts/AC123/Transcriptions/TR123' req.assert_called_with('DELETE', uri)
null
null
null
a transcription
codeqa
@patch 'twilio rest resources base Resource request' def test delete transcription req resp Mock resp content ''resp status code 204 req return value resp {} app Transcription transcriptions 'TR 123 ' app delete uri 'https //api twilio com/ 2010 - 04 - 01 / Accounts/AC 123 / Transcriptions/TR 123 'req assert called with 'DELETE' uri
null
null
null
null
Question: What does the code delete ? Code: @patch('twilio.rest.resources.base.Resource.request') def test_delete_transcription(req): resp = Mock() resp.content = '' resp.status_code = 204 req.return_value = (resp, {}) app = Transcription(transcriptions, 'TR123') app.delete() uri = 'https://api.twilio.com/2010-04-01/Accounts/AC123/Transcriptions/TR123' req.assert_called_with('DELETE', uri)
null
null
null
How do by x**n divide f ?
def gf_rshift(f, n, K): if (not n): return (f, []) else: return (f[:(- n)], f[(- n):])
null
null
null
efficiently
codeqa
def gf rshift f n K if not n return f [] else return f[ - n ] f[ - n ]
null
null
null
null
Question: How do by x**n divide f ? Code: def gf_rshift(f, n, K): if (not n): return (f, []) else: return (f[:(- n)], f[(- n):])
null
null
null
What divides f efficiently ?
def gf_rshift(f, n, K): if (not n): return (f, []) else: return (f[:(- n)], f[(- n):])
null
null
null
by x**n
codeqa
def gf rshift f n K if not n return f [] else return f[ - n ] f[ - n ]
null
null
null
null
Question: What divides f efficiently ? Code: def gf_rshift(f, n, K): if (not n): return (f, []) else: return (f[:(- n)], f[(- n):])
null
null
null
What does the code get ?
def get_names_from_cert(csr, typ=OpenSSL.crypto.FILETYPE_PEM): return _get_names_from_cert_or_req(csr, OpenSSL.crypto.load_certificate, typ)
null
null
null
a list of domains
codeqa
def get names from cert csr typ Open SSL crypto FILETYPE PEM return get names from cert or req csr Open SSL crypto load certificate typ
null
null
null
null
Question: What does the code get ? Code: def get_names_from_cert(csr, typ=OpenSSL.crypto.FILETYPE_PEM): return _get_names_from_cert_or_req(csr, OpenSSL.crypto.load_certificate, typ)
null
null
null
When is callback used ?
def read_config(ctx, param, value): cfg = ctx.ensure_object(Config) if (value is None): value = os.path.join(os.path.dirname(__file__), 'aliases.ini') cfg.read_config(value) return value
null
null
null
whenever --config is passed
codeqa
def read config ctx param value cfg ctx ensure object Config if value is None value os path join os path dirname file 'aliases ini' cfg read config value return value
null
null
null
null
Question: When is callback used ? Code: def read_config(ctx, param, value): cfg = ctx.ensure_object(Config) if (value is None): value = os.path.join(os.path.dirname(__file__), 'aliases.ini') cfg.read_config(value) return value
null
null
null
How do a list of meters return ?
@blueprint.route('/resources/<resource>/meters') def list_meters_by_resource(resource): rq = flask.request meters = rq.storage_conn.get_meters(resource=resource, project=acl.get_limited_to_project(rq.headers), metaquery=_get_metaquery(rq.args)) return flask.jsonify(meters=[m.as_dict() for m in meters])
null
null
null
by resource
codeqa
@blueprint route '/resources/<resource>/meters' def list meters by resource resource rq flask requestmeters rq storage conn get meters resource resource project acl get limited to project rq headers metaquery get metaquery rq args return flask jsonify meters [m as dict for m in meters]
null
null
null
null
Question: How do a list of meters return ? Code: @blueprint.route('/resources/<resource>/meters') def list_meters_by_resource(resource): rq = flask.request meters = rq.storage_conn.get_meters(resource=resource, project=acl.get_limited_to_project(rq.headers), metaquery=_get_metaquery(rq.args)) return flask.jsonify(meters=[m.as_dict() for m in meters])
null
null
null
What did this user access for ?
def get_forms_for_user(user): editable_forms = UserPagePermissionsProxy(user).editable_pages() editable_forms = editable_forms.filter(content_type__in=get_form_types()) for fn in hooks.get_hooks(u'filter_form_submissions_for_user'): editable_forms = fn(user, editable_forms) return editable_forms
null
null
null
the submissions
codeqa
def get forms for user user editable forms User Page Permissions Proxy user editable pages editable forms editable forms filter content type in get form types for fn in hooks get hooks u'filter form submissions for user' editable forms fn user editable forms return editable forms
null
null
null
null
Question: What did this user access for ? Code: def get_forms_for_user(user): editable_forms = UserPagePermissionsProxy(user).editable_pages() editable_forms = editable_forms.filter(content_type__in=get_form_types()) for fn in hooks.get_hooks(u'filter_form_submissions_for_user'): editable_forms = fn(user, editable_forms) return editable_forms
null
null
null
For what purpose did this user access the submissions ?
def get_forms_for_user(user): editable_forms = UserPagePermissionsProxy(user).editable_pages() editable_forms = editable_forms.filter(content_type__in=get_form_types()) for fn in hooks.get_hooks(u'filter_form_submissions_for_user'): editable_forms = fn(user, editable_forms) return editable_forms
null
null
null
for
codeqa
def get forms for user user editable forms User Page Permissions Proxy user editable pages editable forms editable forms filter content type in get form types for fn in hooks get hooks u'filter form submissions for user' editable forms fn user editable forms return editable forms
null
null
null
null
Question: For what purpose did this user access the submissions ? Code: def get_forms_for_user(user): editable_forms = UserPagePermissionsProxy(user).editable_pages() editable_forms = editable_forms.filter(content_type__in=get_form_types()) for fn in hooks.get_hooks(u'filter_form_submissions_for_user'): editable_forms = fn(user, editable_forms) return editable_forms
null
null
null
What does the code append to the list of saved errors ?
def add_error(e): saved_errors.append(e) log(('%-70s\n' % e))
null
null
null
an error message
codeqa
def add error e saved errors append e log '%- 70 s\n' % e
null
null
null
null
Question: What does the code append to the list of saved errors ? Code: def add_error(e): saved_errors.append(e) log(('%-70s\n' % e))
null
null
null
What does the code follow ?
def expand_format_text(hosts, text): return direct_format_text(expand_line(text, hosts))
null
null
null
redirects in links
codeqa
def expand format text hosts text return direct format text expand line text hosts
null
null
null
null
Question: What does the code follow ? Code: def expand_format_text(hosts, text): return direct_format_text(expand_line(text, hosts))
null
null
null
What does the code create ?
def _create_players(jsonf=None): if (jsonf is None): jsonf = _player_json_file try: data = json.loads(open(jsonf).read()) except IOError: return {} players = {} for playerid in data: players[playerid] = Player(data[playerid]) return players
null
null
null
a dict of player objects from the players
codeqa
def create players jsonf None if jsonf is None jsonf player json filetry data json loads open jsonf read except IO Error return {}players {}for playerid in data players[playerid] Player data[playerid] return players
null
null
null
null
Question: What does the code create ? Code: def _create_players(jsonf=None): if (jsonf is None): jsonf = _player_json_file try: data = json.loads(open(jsonf).read()) except IOError: return {} players = {} for playerid in data: players[playerid] = Player(data[playerid]) return players
null
null
null
What does method create ?
def iterate_all(attr, map_method, **kwargs): args = dict(((key, value) for (key, value) in kwargs.items() if (value is not None))) wait = 1 while True: try: data = map_method(**args) for elm in data[attr]: (yield elm) if ('NextMarker' in data): args['Marker'] = data['Nextmarker'] continue break except ClientError as e: if ((e.response['Error']['Code'] == 'ThrottlingException') and (wait < 600)): sleep(wait) wait = (wait * 2) continue
null
null
null
iterator
codeqa
def iterate all attr map method **kwargs args dict key value for key value in kwargs items if value is not None wait 1while True try data map method **args for elm in data[attr] yield elm if ' Next Marker' in data args[' Marker'] data[' Nextmarker']continuebreakexcept Client Error as e if e response[' Error'][' Code'] ' Throttling Exception' and wait < 600 sleep wait wait wait * 2 continue
null
null
null
null
Question: What does method create ? Code: def iterate_all(attr, map_method, **kwargs): args = dict(((key, value) for (key, value) in kwargs.items() if (value is not None))) wait = 1 while True: try: data = map_method(**args) for elm in data[attr]: (yield elm) if ('NextMarker' in data): args['Marker'] = data['Nextmarker'] continue break except ClientError as e: if ((e.response['Error']['Code'] == 'ThrottlingException') and (wait < 600)): sleep(wait) wait = (wait * 2) continue
null
null
null
What creates iterator ?
def iterate_all(attr, map_method, **kwargs): args = dict(((key, value) for (key, value) in kwargs.items() if (value is not None))) wait = 1 while True: try: data = map_method(**args) for elm in data[attr]: (yield elm) if ('NextMarker' in data): args['Marker'] = data['Nextmarker'] continue break except ClientError as e: if ((e.response['Error']['Code'] == 'ThrottlingException') and (wait < 600)): sleep(wait) wait = (wait * 2) continue
null
null
null
method
codeqa
def iterate all attr map method **kwargs args dict key value for key value in kwargs items if value is not None wait 1while True try data map method **args for elm in data[attr] yield elm if ' Next Marker' in data args[' Marker'] data[' Nextmarker']continuebreakexcept Client Error as e if e response[' Error'][' Code'] ' Throttling Exception' and wait < 600 sleep wait wait wait * 2 continue
null
null
null
null
Question: What creates iterator ? Code: def iterate_all(attr, map_method, **kwargs): args = dict(((key, value) for (key, value) in kwargs.items() if (value is not None))) wait = 1 while True: try: data = map_method(**args) for elm in data[attr]: (yield elm) if ('NextMarker' in data): args['Marker'] = data['Nextmarker'] continue break except ClientError as e: if ((e.response['Error']['Code'] == 'ThrottlingException') and (wait < 600)): sleep(wait) wait = (wait * 2) continue
null
null
null
When did the only configuration parameter need ?
def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
at compile - time
codeqa
def determine 64 bit int try try import ctypesexcept Import Error raise Value Error if ctypes sizeof ctypes c longlong 8 return u'longlongint'elif ctypes sizeof ctypes c long 8 return u'longint'elif ctypes sizeof ctypes c int 8 return u'int'else raise Value Error except Value Error return u'longlongint'
null
null
null
null
Question: When did the only configuration parameter need ? Code: def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
How does a 64-bit signed integer specify ?
def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
how
codeqa
def determine 64 bit int try try import ctypesexcept Import Error raise Value Error if ctypes sizeof ctypes c longlong 8 return u'longlongint'elif ctypes sizeof ctypes c long 8 return u'longint'elif ctypes sizeof ctypes c int 8 return u'int'else raise Value Error except Value Error return u'longlongint'
null
null
null
null
Question: How does a 64-bit signed integer specify ? Code: def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
What does the only configuration parameter needed at compile - time be ?
def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
how to specify a 64-bit signed integer
codeqa
def determine 64 bit int try try import ctypesexcept Import Error raise Value Error if ctypes sizeof ctypes c longlong 8 return u'longlongint'elif ctypes sizeof ctypes c long 8 return u'longint'elif ctypes sizeof ctypes c int 8 return u'int'else raise Value Error except Value Error return u'longlongint'
null
null
null
null
Question: What does the only configuration parameter needed at compile - time be ? Code: def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
What is how to specify a 64-bit signed integer ?
def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
the only configuration parameter needed at compile - time
codeqa
def determine 64 bit int try try import ctypesexcept Import Error raise Value Error if ctypes sizeof ctypes c longlong 8 return u'longlongint'elif ctypes sizeof ctypes c long 8 return u'longint'elif ctypes sizeof ctypes c int 8 return u'int'else raise Value Error except Value Error return u'longlongint'
null
null
null
null
Question: What is how to specify a 64-bit signed integer ? Code: def determine_64_bit_int(): try: try: import ctypes except ImportError: raise ValueError() if (ctypes.sizeof(ctypes.c_longlong) == 8): return u'long long int' elif (ctypes.sizeof(ctypes.c_long) == 8): return u'long int' elif (ctypes.sizeof(ctypes.c_int) == 8): return u'int' else: raise ValueError() except ValueError: return u'long long int'
null
null
null
When do column names on table names and dot suggest ?
def test_suggested_multiple_column_names_with_dot(completer, complete_event): text = u'SELECT users.id, users. from users u' position = len(u'SELECT users.id, users.') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(testdata.columns(u'users')))
null
null
null
when selecting multiple columns from table
codeqa
def test suggested multiple column names with dot completer complete event text u'SELEC Tusers id users fromusersu'position len u'SELEC Tusers id users ' result set completer get completions Document text text cursor position position complete event assert set result set testdata columns u'users'
null
null
null
null
Question: When do column names on table names and dot suggest ? Code: def test_suggested_multiple_column_names_with_dot(completer, complete_event): text = u'SELECT users.id, users. from users u' position = len(u'SELECT users.id, users.') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(testdata.columns(u'users')))
null
null
null
What is containing a mime document ?
def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
a file - like object
codeqa
def parse mime headers doc file headers []while True line doc file readline done line in '\r\n' '\n' '' if six PY 3 try line line decode 'utf- 8 ' except Unicode Decode Error line line decode 'latin 1 ' headers append line if done breakif six PY 3 header string '' join headers else header string '' join headers headers email parser Parser parsestr header string return Header Key Dict headers
null
null
null
null
Question: What is containing a mime document ? Code: def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
What does the code take ?
def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
a file - like object containing a mime document
codeqa
def parse mime headers doc file headers []while True line doc file readline done line in '\r\n' '\n' '' if six PY 3 try line line decode 'utf- 8 ' except Unicode Decode Error line line decode 'latin 1 ' headers append line if done breakif six PY 3 header string '' join headers else header string '' join headers headers email parser Parser parsestr header string return Header Key Dict headers
null
null
null
null
Question: What does the code take ? Code: def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
What do a file - like object contain ?
def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
a mime document
codeqa
def parse mime headers doc file headers []while True line doc file readline done line in '\r\n' '\n' '' if six PY 3 try line line decode 'utf- 8 ' except Unicode Decode Error line line decode 'latin 1 ' headers append line if done breakif six PY 3 header string '' join headers else header string '' join headers headers email parser Parser parsestr header string return Header Key Dict headers
null
null
null
null
Question: What do a file - like object contain ? Code: def parse_mime_headers(doc_file): headers = [] while True: line = doc_file.readline() done = (line in ('\r\n', '\n', '')) if six.PY3: try: line = line.decode('utf-8') except UnicodeDecodeError: line = line.decode('latin1') headers.append(line) if done: break if six.PY3: header_string = ''.join(headers) else: header_string = ''.join(headers) headers = email.parser.Parser().parsestr(header_string) return HeaderKeyDict(headers)
null
null
null
What does the code renew ?
def renew(config, unused_plugins): try: renewal.handle_renewal_request(config) finally: hooks.run_saved_post_hooks()
null
null
null
previously - obtained certificates
codeqa
def renew config unused plugins try renewal handle renewal request config finally hooks run saved post hooks
null
null
null
null
Question: What does the code renew ? Code: def renew(config, unused_plugins): try: renewal.handle_renewal_request(config) finally: hooks.run_saved_post_hooks()
null
null
null
When did certificates obtain ?
def renew(config, unused_plugins): try: renewal.handle_renewal_request(config) finally: hooks.run_saved_post_hooks()
null
null
null
previously
codeqa
def renew config unused plugins try renewal handle renewal request config finally hooks run saved post hooks
null
null
null
null
Question: When did certificates obtain ? Code: def renew(config, unused_plugins): try: renewal.handle_renewal_request(config) finally: hooks.run_saved_post_hooks()
null
null
null
What ca local bundle ?
def update_ca_bundle(target=None, source=None, merge_files=None): return salt.utils.http.update_ca_bundle(target, source, __opts__, merge_files)
null
null
null
file
codeqa
def update ca bundle target None source None merge files None return salt utils http update ca bundle target source opts merge files
null
null
null
null
Question: What ca local bundle ? Code: def update_ca_bundle(target=None, source=None, merge_files=None): return salt.utils.http.update_ca_bundle(target, source, __opts__, merge_files)
null
null
null
What ca bundle file ?
def update_ca_bundle(target=None, source=None, merge_files=None): return salt.utils.http.update_ca_bundle(target, source, __opts__, merge_files)
null
null
null
local
codeqa
def update ca bundle target None source None merge files None return salt utils http update ca bundle target source opts merge files
null
null
null
null
Question: What ca bundle file ? Code: def update_ca_bundle(target=None, source=None, merge_files=None): return salt.utils.http.update_ca_bundle(target, source, __opts__, merge_files)
null
null
null
When is a pipeline running ?
@contextmanager def simulate_running_pipeline(pipeline_target, backend, email=None, fullname=None, username=None): pipeline_data = {'backend': backend, 'kwargs': {'details': {}}} if (email is not None): pipeline_data['kwargs']['details']['email'] = email if (fullname is not None): pipeline_data['kwargs']['details']['fullname'] = fullname if (username is not None): pipeline_data['kwargs']['username'] = username pipeline_get = mock.patch('{pipeline}.get'.format(pipeline=pipeline_target), spec=True) pipeline_running = mock.patch('{pipeline}.running'.format(pipeline=pipeline_target), spec=True) mock_get = pipeline_get.start() mock_running = pipeline_running.start() mock_get.return_value = pipeline_data mock_running.return_value = True try: (yield) finally: pipeline_get.stop() pipeline_running.stop()
null
null
null
currently
codeqa
@contextmanagerdef simulate running pipeline pipeline target backend email None fullname None username None pipeline data {'backend' backend 'kwargs' {'details' {}}}if email is not None pipeline data['kwargs']['details']['email'] emailif fullname is not None pipeline data['kwargs']['details']['fullname'] fullnameif username is not None pipeline data['kwargs']['username'] usernamepipeline get mock patch '{pipeline} get' format pipeline pipeline target spec True pipeline running mock patch '{pipeline} running' format pipeline pipeline target spec True mock get pipeline get start mock running pipeline running start mock get return value pipeline datamock running return value Truetry yield finally pipeline get stop pipeline running stop
null
null
null
null
Question: When is a pipeline running ? Code: @contextmanager def simulate_running_pipeline(pipeline_target, backend, email=None, fullname=None, username=None): pipeline_data = {'backend': backend, 'kwargs': {'details': {}}} if (email is not None): pipeline_data['kwargs']['details']['email'] = email if (fullname is not None): pipeline_data['kwargs']['details']['fullname'] = fullname if (username is not None): pipeline_data['kwargs']['username'] = username pipeline_get = mock.patch('{pipeline}.get'.format(pipeline=pipeline_target), spec=True) pipeline_running = mock.patch('{pipeline}.running'.format(pipeline=pipeline_target), spec=True) mock_get = pipeline_get.start() mock_running = pipeline_running.start() mock_get.return_value = pipeline_data mock_running.return_value = True try: (yield) finally: pipeline_get.stop() pipeline_running.stop()
null
null
null
Where is this method used when exporting a repository and its dependencies ?
def get_prior_import_or_install_required_dict(app, tsr_ids, repo_info_dicts): prior_import_or_install_required_dict = {} for tsr_id in tsr_ids: prior_import_or_install_required_dict[tsr_id] = [] for repo_info_dict in repo_info_dicts: (repository, repository_dependencies) = get_repository_and_repository_dependencies_from_repo_info_dict(app, repo_info_dict) if repository: encoded_repository_id = app.security.encode_id(repository.id) if (encoded_repository_id in tsr_ids): prior_import_or_install_ids = get_repository_ids_requiring_prior_import_or_install(app, tsr_ids, repository_dependencies) prior_import_or_install_required_dict[encoded_repository_id] = prior_import_or_install_ids return prior_import_or_install_required_dict
null
null
null
in the tool shed
codeqa
def get prior import or install required dict app tsr ids repo info dicts prior import or install required dict {}for tsr id in tsr ids prior import or install required dict[tsr id] []for repo info dict in repo info dicts repository repository dependencies get repository and repository dependencies from repo info dict app repo info dict if repository encoded repository id app security encode id repository id if encoded repository id in tsr ids prior import or install ids get repository ids requiring prior import or install app tsr ids repository dependencies prior import or install required dict[encoded repository id] prior import or install idsreturn prior import or install required dict
null
null
null
null
Question: Where is this method used when exporting a repository and its dependencies ? Code: def get_prior_import_or_install_required_dict(app, tsr_ids, repo_info_dicts): prior_import_or_install_required_dict = {} for tsr_id in tsr_ids: prior_import_or_install_required_dict[tsr_id] = [] for repo_info_dict in repo_info_dicts: (repository, repository_dependencies) = get_repository_and_repository_dependencies_from_repo_info_dict(app, repo_info_dict) if repository: encoded_repository_id = app.security.encode_id(repository.id) if (encoded_repository_id in tsr_ids): prior_import_or_install_ids = get_repository_ids_requiring_prior_import_or_install(app, tsr_ids, repository_dependencies) prior_import_or_install_required_dict[encoded_repository_id] = prior_import_or_install_ids return prior_import_or_install_required_dict
null
null
null
When is this method used in the tool shed ?
def get_prior_import_or_install_required_dict(app, tsr_ids, repo_info_dicts): prior_import_or_install_required_dict = {} for tsr_id in tsr_ids: prior_import_or_install_required_dict[tsr_id] = [] for repo_info_dict in repo_info_dicts: (repository, repository_dependencies) = get_repository_and_repository_dependencies_from_repo_info_dict(app, repo_info_dict) if repository: encoded_repository_id = app.security.encode_id(repository.id) if (encoded_repository_id in tsr_ids): prior_import_or_install_ids = get_repository_ids_requiring_prior_import_or_install(app, tsr_ids, repository_dependencies) prior_import_or_install_required_dict[encoded_repository_id] = prior_import_or_install_ids return prior_import_or_install_required_dict
null
null
null
when exporting a repository and its dependencies
codeqa
def get prior import or install required dict app tsr ids repo info dicts prior import or install required dict {}for tsr id in tsr ids prior import or install required dict[tsr id] []for repo info dict in repo info dicts repository repository dependencies get repository and repository dependencies from repo info dict app repo info dict if repository encoded repository id app security encode id repository id if encoded repository id in tsr ids prior import or install ids get repository ids requiring prior import or install app tsr ids repository dependencies prior import or install required dict[encoded repository id] prior import or install idsreturn prior import or install required dict
null
null
null
null
Question: When is this method used in the tool shed ? Code: def get_prior_import_or_install_required_dict(app, tsr_ids, repo_info_dicts): prior_import_or_install_required_dict = {} for tsr_id in tsr_ids: prior_import_or_install_required_dict[tsr_id] = [] for repo_info_dict in repo_info_dicts: (repository, repository_dependencies) = get_repository_and_repository_dependencies_from_repo_info_dict(app, repo_info_dict) if repository: encoded_repository_id = app.security.encode_id(repository.id) if (encoded_repository_id in tsr_ids): prior_import_or_install_ids = get_repository_ids_requiring_prior_import_or_install(app, tsr_ids, repository_dependencies) prior_import_or_install_required_dict[encoded_repository_id] = prior_import_or_install_ids return prior_import_or_install_required_dict
null
null
null
What does the code remove if it exists ?
def install_completed_client(compiled_dir, project_client): tmp_client_dir = os.path.join(_TMP_COMPILE_DIR, project_client) install_dir = os.path.join(_DEFAULT_INSTALL_DIR, project_client) old_install_dir = os.path.join(_DEFAULT_INSTALL_DIR, (project_client + '.old')) if (not os.path.exists(_DEFAULT_INSTALL_DIR)): os.mkdir(_DEFAULT_INSTALL_DIR) if os.path.isdir(tmp_client_dir): if os.path.isdir(old_install_dir): shutil.rmtree(old_install_dir) if os.path.isdir(install_dir): os.rename(install_dir, old_install_dir) try: os.rename(tmp_client_dir, install_dir) return True except Exception as err: shutil.rmtree(install_dir) shutil.copytree(old_install_dir, install_dir) logging.error('Copying old client: %s', err) else: logging.error('Compiled directory is gone, something went wrong') return False
null
null
null
old client directory
codeqa
def install completed client compiled dir project client tmp client dir os path join TMP COMPILE DIR project client install dir os path join DEFAULT INSTALL DIR project client old install dir os path join DEFAULT INSTALL DIR project client + ' old' if not os path exists DEFAULT INSTALL DIR os mkdir DEFAULT INSTALL DIR if os path isdir tmp client dir if os path isdir old install dir shutil rmtree old install dir if os path isdir install dir os rename install dir old install dir try os rename tmp client dir install dir return Trueexcept Exception as err shutil rmtree install dir shutil copytree old install dir install dir logging error ' Copyingoldclient %s' err else logging error ' Compileddirectoryisgone somethingwentwrong' return False
null
null
null
null
Question: What does the code remove if it exists ? Code: def install_completed_client(compiled_dir, project_client): tmp_client_dir = os.path.join(_TMP_COMPILE_DIR, project_client) install_dir = os.path.join(_DEFAULT_INSTALL_DIR, project_client) old_install_dir = os.path.join(_DEFAULT_INSTALL_DIR, (project_client + '.old')) if (not os.path.exists(_DEFAULT_INSTALL_DIR)): os.mkdir(_DEFAULT_INSTALL_DIR) if os.path.isdir(tmp_client_dir): if os.path.isdir(old_install_dir): shutil.rmtree(old_install_dir) if os.path.isdir(install_dir): os.rename(install_dir, old_install_dir) try: os.rename(tmp_client_dir, install_dir) return True except Exception as err: shutil.rmtree(install_dir) shutil.copytree(old_install_dir, install_dir) logging.error('Copying old client: %s', err) else: logging.error('Compiled directory is gone, something went wrong') return False
null
null
null
For what purpose did the pickle file create ?
def teardown(): if os.path.isfile('dbm.pkl'): os.remove('dbm.pkl') control.pop_load_data()
null
null
null
for the tests
codeqa
def teardown if os path isfile 'dbm pkl' os remove 'dbm pkl' control pop load data
null
null
null
null
Question: For what purpose did the pickle file create ? Code: def teardown(): if os.path.isfile('dbm.pkl'): os.remove('dbm.pkl') control.pop_load_data()
null
null
null
What does the code delete ?
def teardown(): if os.path.isfile('dbm.pkl'): os.remove('dbm.pkl') control.pop_load_data()
null
null
null
the pickle file created for the tests
codeqa
def teardown if os path isfile 'dbm pkl' os remove 'dbm pkl' control pop load data
null
null
null
null
Question: What does the code delete ? Code: def teardown(): if os.path.isfile('dbm.pkl'): os.remove('dbm.pkl') control.pop_load_data()
null
null
null
What does the code build ?
def build_stack(obj): if (type(obj) is list): layers = map(build_stack, obj) return Stack(layers) elif (type(obj) is dict): keys = (('src', 'layername'), ('color', 'colorname'), ('mask', 'maskname'), ('opacity', 'opacity'), ('mode', 'blendmode'), ('adjustments', 'adjustments'), ('zoom', 'zoom')) args = [(arg, obj[key]) for (key, arg) in keys if (key in obj)] return Layer(**dict(args)) else: raise Exception('Uh oh')
null
null
null
a data structure of stack and layer objects from lists of dictionaries
codeqa
def build stack obj if type obj is list layers map build stack obj return Stack layers elif type obj is dict keys 'src' 'layername' 'color' 'colorname' 'mask' 'maskname' 'opacity' 'opacity' 'mode' 'blendmode' 'adjustments' 'adjustments' 'zoom' 'zoom' args [ arg obj[key] for key arg in keys if key in obj ]return Layer **dict args else raise Exception ' Uhoh'
null
null
null
null
Question: What does the code build ? Code: def build_stack(obj): if (type(obj) is list): layers = map(build_stack, obj) return Stack(layers) elif (type(obj) is dict): keys = (('src', 'layername'), ('color', 'colorname'), ('mask', 'maskname'), ('opacity', 'opacity'), ('mode', 'blendmode'), ('adjustments', 'adjustments'), ('zoom', 'zoom')) args = [(arg, obj[key]) for (key, arg) in keys if (key in obj)] return Layer(**dict(args)) else: raise Exception('Uh oh')
null
null
null
How does the code create a file ?
def make_file(path, content='', permissions=None): path.setContent(content) if (permissions is not None): path.chmod(permissions) return path
null
null
null
with given content and permissions
codeqa
def make file path content '' permissions None path set Content content if permissions is not None path chmod permissions return path
null
null
null
null
Question: How does the code create a file ? Code: def make_file(path, content='', permissions=None): path.setContent(content) if (permissions is not None): path.chmod(permissions) return path
null
null
null
What does the code create with given content and permissions ?
def make_file(path, content='', permissions=None): path.setContent(content) if (permissions is not None): path.chmod(permissions) return path
null
null
null
a file
codeqa
def make file path content '' permissions None path set Content content if permissions is not None path chmod permissions return path
null
null
null
null
Question: What does the code create with given content and permissions ? Code: def make_file(path, content='', permissions=None): path.setContent(content) if (permissions is not None): path.chmod(permissions) return path
null
null
null
What does the code remove ?
def prune_vocab(vocab, min_reduce, trim_rule=None): result = 0 old_len = len(vocab) for w in list(vocab): if (not keep_vocab_item(w, vocab[w], min_reduce, trim_rule)): result += vocab[w] del vocab[w] logger.info('pruned out %i tokens with count <=%i (before %i, after %i)', (old_len - len(vocab)), min_reduce, old_len, len(vocab)) return result
null
null
null
all entries from the vocab dictionary with count smaller than min_reduce
codeqa
def prune vocab vocab min reduce trim rule None result 0old len len vocab for w in list vocab if not keep vocab item w vocab[w] min reduce trim rule result + vocab[w]del vocab[w]logger info 'prunedout%itokenswithcount< %i before%i after%i ' old len - len vocab min reduce old len len vocab return result
null
null
null
null
Question: What does the code remove ? Code: def prune_vocab(vocab, min_reduce, trim_rule=None): result = 0 old_len = len(vocab) for w in list(vocab): if (not keep_vocab_item(w, vocab[w], min_reduce, trim_rule)): result += vocab[w] del vocab[w] logger.info('pruned out %i tokens with count <=%i (before %i, after %i)', (old_len - len(vocab)), min_reduce, old_len, len(vocab)) return result
null
null
null
How did objects track ?
@Profiler.profile def test_orm_full_objects_chunks(n): sess = Session(engine) for obj in sess.query(Customer).yield_per(1000).limit(n): pass
null
null
null
fully
codeqa
@ Profiler profiledef test orm full objects chunks n sess Session engine for obj in sess query Customer yield per 1000 limit n pass
null
null
null
null
Question: How did objects track ? Code: @Profiler.profile def test_orm_full_objects_chunks(n): sess = Session(engine) for obj in sess.query(Customer).yield_per(1000).limit(n): pass
null
null
null
What does the code get ?
def term_width(): fallback = config['ui']['terminal_width'].get(int) try: import fcntl import termios except ImportError: return fallback try: buf = fcntl.ioctl(0, termios.TIOCGWINSZ, (' ' * 4)) except IOError: return fallback try: (height, width) = struct.unpack('hh', buf) except struct.error: return fallback return width
null
null
null
the width of the terminal
codeqa
def term width fallback config['ui']['terminal width'] get int try import fcntlimport termiosexcept Import Error return fallbacktry buf fcntl ioctl 0 termios TIOCGWINSZ '' * 4 except IO Error return fallbacktry height width struct unpack 'hh' buf except struct error return fallbackreturn width
null
null
null
null
Question: What does the code get ? Code: def term_width(): fallback = config['ui']['terminal_width'].get(int) try: import fcntl import termios except ImportError: return fallback try: buf = fcntl.ioctl(0, termios.TIOCGWINSZ, (' ' * 4)) except IOError: return fallback try: (height, width) = struct.unpack('hh', buf) except struct.error: return fallback return width
null
null
null
What does the code ensure ?
def ensure_cache_root(environ=None): ensure_directory(cache_root(environ=environ))
null
null
null
that the data root exists
codeqa
def ensure cache root environ None ensure directory cache root environ environ
null
null
null
null
Question: What does the code ensure ? Code: def ensure_cache_root(environ=None): ensure_directory(cache_root(environ=environ))
null
null
null
What does the code return ?
def number_of_cliques(G, nodes=None, cliques=None): if (cliques is None): cliques = list(find_cliques(G)) if (nodes is None): nodes = list(G.nodes()) if (not isinstance(nodes, list)): v = nodes numcliq = len([1 for c in cliques if (v in c)]) else: numcliq = {} for v in nodes: numcliq[v] = len([1 for c in cliques if (v in c)]) return numcliq
null
null
null
the number of maximal cliques for each node
codeqa
def number of cliques G nodes None cliques None if cliques is None cliques list find cliques G if nodes is None nodes list G nodes if not isinstance nodes list v nodesnumcliq len [1 for c in cliques if v in c ] else numcliq {}for v in nodes numcliq[v] len [1 for c in cliques if v in c ] return numcliq
null
null
null
null
Question: What does the code return ? Code: def number_of_cliques(G, nodes=None, cliques=None): if (cliques is None): cliques = list(find_cliques(G)) if (nodes is None): nodes = list(G.nodes()) if (not isinstance(nodes, list)): v = nodes numcliq = len([1 for c in cliques if (v in c)]) else: numcliq = {} for v in nodes: numcliq[v] = len([1 for c in cliques if (v in c)]) return numcliq
null
null
null
What does the code convert to dictionaries convert a list of layer file info tuples to a dictionary using the first element as the key ?
def get_file_info_map(file_infos): return dict(((file_info[0], file_info[1:]) for file_info in file_infos))
null
null
null
a list of file info tuples
codeqa
def get file info map file infos return dict file info[ 0 ] file info[ 1 ] for file info in file infos
null
null
null
null
Question: What does the code convert to dictionaries convert a list of layer file info tuples to a dictionary using the first element as the key ? Code: def get_file_info_map(file_infos): return dict(((file_info[0], file_info[1:]) for file_info in file_infos))
null
null
null
What does the code retrieve ?
def get_system_roles(): result = Role.query(system=True) return result
null
null
null
all the available system roles
codeqa
def get system roles result Role query system True return result
null
null
null
null
Question: What does the code retrieve ? Code: def get_system_roles(): result = Role.query(system=True) return result
null
null
null
How does it decode ?
def get_path_info(environ, charset='utf-8', errors='replace'): path = wsgi_get_bytes(environ.get('PATH_INFO', '')) return to_unicode(path, charset, errors, allow_none_charset=True)
null
null
null
properly
codeqa
def get path info environ charset 'utf- 8 ' errors 'replace' path wsgi get bytes environ get 'PATH INFO' '' return to unicode path charset errors allow none charset True
null
null
null
null
Question: How does it decode ? Code: def get_path_info(environ, charset='utf-8', errors='replace'): path = wsgi_get_bytes(environ.get('PATH_INFO', '')) return to_unicode(path, charset, errors, allow_none_charset=True)
null
null
null
What does the code find ?
def find_sample_file(filename): return find_file(filename, path=os.path.join(neutron.__path__[0], '..', 'etc'))
null
null
null
a file with name filename located in the sample directory
codeqa
def find sample file filename return find file filename path os path join neutron path [0 ] ' ' 'etc'
null
null
null
null
Question: What does the code find ? Code: def find_sample_file(filename): return find_file(filename, path=os.path.join(neutron.__path__[0], '..', 'etc'))
null
null
null
What has a matching value for a supplied key ?
@core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
the item
codeqa
@core helperdef list dict filter list search field output field value for item in list if item get search field value return item get output field value return value
null
null
null
null
Question: What has a matching value for a supplied key ? Code: @core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
What does the item have ?
@core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
a matching value for a supplied key
codeqa
@core helperdef list dict filter list search field output field value for item in list if item get search field value return item get output field value return value
null
null
null
null
Question: What does the item have ? Code: @core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
What has the code returns if the item has a matching value for a supplied key ?
@core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
the value of a given key
codeqa
@core helperdef list dict filter list search field output field value for item in list if item get search field value return item get output field value return value
null
null
null
null
Question: What has the code returns if the item has a matching value for a supplied key ? Code: @core_helper def list_dict_filter(list_, search_field, output_field, value): for item in list_: if (item.get(search_field) == value): return item.get(output_field, value) return value
null
null
null
How does the code get the access token ?
def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
using the provided credentials arguments
codeqa
def get access token username password oauth 2 client id api root response requests post api root + '/oauth 2 /access token/' data {'client id' oauth 2 client id 'grant type' 'password' 'username' username 'password' password} return json loads response text get 'access token' None
null
null
null
null
Question: How does the code get the access token ? Code: def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
What does the code get using the provided credentials arguments ?
def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
the access token
codeqa
def get access token username password oauth 2 client id api root response requests post api root + '/oauth 2 /access token/' data {'client id' oauth 2 client id 'grant type' 'password' 'username' username 'password' password} return json loads response text get 'access token' None
null
null
null
null
Question: What does the code get using the provided credentials arguments ? Code: def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
What is containing the username to log in password ?
def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
a string
codeqa
def get access token username password oauth 2 client id api root response requests post api root + '/oauth 2 /access token/' data {'client id' oauth 2 client id 'grant type' 'password' 'username' username 'password' password} return json loads response text get 'access token' None
null
null
null
null
Question: What is containing the username to log in password ? Code: def get_access_token(username, password, oauth2_client_id, api_root): response = requests.post((api_root + '/oauth2/access_token/'), data={'client_id': oauth2_client_id, 'grant_type': 'password', 'username': username, 'password': password}) return json.loads(response.text).get('access_token', None)
null
null
null
What specified in the configuration ?
def _load_plugins(config): paths = config['pluginpath'].get(confit.StrSeq(split=False)) paths = map(util.normpath, paths) import beetsplug beetsplug.__path__ = (paths + beetsplug.__path__) sys.path += paths plugins.load_plugins(config['plugins'].as_str_seq()) plugins.send('pluginload') return plugins
null
null
null
the plugins
codeqa
def load plugins config paths config['pluginpath'] get confit Str Seq split False paths map util normpath paths import beetsplugbeetsplug path paths + beetsplug path sys path + pathsplugins load plugins config['plugins'] as str seq plugins send 'pluginload' return plugins
null
null
null
null
Question: What specified in the configuration ? Code: def _load_plugins(config): paths = config['pluginpath'].get(confit.StrSeq(split=False)) paths = map(util.normpath, paths) import beetsplug beetsplug.__path__ = (paths + beetsplug.__path__) sys.path += paths plugins.load_plugins(config['plugins'].as_str_seq()) plugins.send('pluginload') return plugins
null
null
null
Where did the plugins specify ?
def _load_plugins(config): paths = config['pluginpath'].get(confit.StrSeq(split=False)) paths = map(util.normpath, paths) import beetsplug beetsplug.__path__ = (paths + beetsplug.__path__) sys.path += paths plugins.load_plugins(config['plugins'].as_str_seq()) plugins.send('pluginload') return plugins
null
null
null
in the configuration
codeqa
def load plugins config paths config['pluginpath'] get confit Str Seq split False paths map util normpath paths import beetsplugbeetsplug path paths + beetsplug path sys path + pathsplugins load plugins config['plugins'] as str seq plugins send 'pluginload' return plugins
null
null
null
null
Question: Where did the plugins specify ? Code: def _load_plugins(config): paths = config['pluginpath'].get(confit.StrSeq(split=False)) paths = map(util.normpath, paths) import beetsplug beetsplug.__path__ = (paths + beetsplug.__path__) sys.path += paths plugins.load_plugins(config['plugins'].as_str_seq()) plugins.send('pluginload') return plugins
null
null
null
What did entry indicate ?
def check_shared(axs, x_shared, y_shared): shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes] for ((i1, ax1), (i2, ax2), (i3, (name, shared))) in zip(enumerate(axs), enumerate(axs), enumerate(zip(u'xy', [x_shared, y_shared]))): if (i2 <= i1): continue assert (shared[i3].joined(ax1, ax2) == shared[(i1, i2)]), (u'axes %i and %i incorrectly %ssharing %s axis' % (i1, i2, (u'not ' if shared[(i1, i2)] else u''), name))
null
null
null
whether the x axes of subplots i and j should be shared
codeqa
def check shared axs x shared y shared shared [axs[ 0 ] shared x axes axs[ 0 ] shared y axes]for i1 ax 1 i2 ax 2 i3 name shared in zip enumerate axs enumerate axs enumerate zip u'xy' [x shared y shared] if i2 < i1 continueassert shared[i 3 ] joined ax 1 ax 2 shared[ i1 i2 ] u'axes%iand%iincorrectly%ssharing%saxis' % i1 i2 u'not' if shared[ i1 i2 ] else u'' name
null
null
null
null
Question: What did entry indicate ? Code: def check_shared(axs, x_shared, y_shared): shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes] for ((i1, ax1), (i2, ax2), (i3, (name, shared))) in zip(enumerate(axs), enumerate(axs), enumerate(zip(u'xy', [x_shared, y_shared]))): if (i2 <= i1): continue assert (shared[i3].joined(ax1, ax2) == shared[(i1, i2)]), (u'axes %i and %i incorrectly %ssharing %s axis' % (i1, i2, (u'not ' if shared[(i1, i2)] else u''), name))
null
null
null
What indicates whether the x axes of subplots i and j should be shared ?
def check_shared(axs, x_shared, y_shared): shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes] for ((i1, ax1), (i2, ax2), (i3, (name, shared))) in zip(enumerate(axs), enumerate(axs), enumerate(zip(u'xy', [x_shared, y_shared]))): if (i2 <= i1): continue assert (shared[i3].joined(ax1, ax2) == shared[(i1, i2)]), (u'axes %i and %i incorrectly %ssharing %s axis' % (i1, i2, (u'not ' if shared[(i1, i2)] else u''), name))
null
null
null
entry
codeqa
def check shared axs x shared y shared shared [axs[ 0 ] shared x axes axs[ 0 ] shared y axes]for i1 ax 1 i2 ax 2 i3 name shared in zip enumerate axs enumerate axs enumerate zip u'xy' [x shared y shared] if i2 < i1 continueassert shared[i 3 ] joined ax 1 ax 2 shared[ i1 i2 ] u'axes%iand%iincorrectly%ssharing%saxis' % i1 i2 u'not' if shared[ i1 i2 ] else u'' name
null
null
null
null
Question: What indicates whether the x axes of subplots i and j should be shared ? Code: def check_shared(axs, x_shared, y_shared): shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes] for ((i1, ax1), (i2, ax2), (i3, (name, shared))) in zip(enumerate(axs), enumerate(axs), enumerate(zip(u'xy', [x_shared, y_shared]))): if (i2 <= i1): continue assert (shared[i3].joined(ax1, ax2) == shared[(i1, i2)]), (u'axes %i and %i incorrectly %ssharing %s axis' % (i1, i2, (u'not ' if shared[(i1, i2)] else u''), name))
null
null
null
What does the code remove from event context ?
def remove_shim_context(event): if ('context' in event): context = event['context'] context_fields_to_remove = set(CONTEXT_FIELDS_TO_INCLUDE) context_fields_to_remove.add('client_id') for field in context_fields_to_remove: if (field in context): del context[field]
null
null
null
obsolete fields
codeqa
def remove shim context event if 'context' in event context event['context']context fields to remove set CONTEXT FIELDS TO INCLUDE context fields to remove add 'client id' for field in context fields to remove if field in context del context[field]
null
null
null
null
Question: What does the code remove from event context ? Code: def remove_shim_context(event): if ('context' in event): context = event['context'] context_fields_to_remove = set(CONTEXT_FIELDS_TO_INCLUDE) context_fields_to_remove.add('client_id') for field in context_fields_to_remove: if (field in context): del context[field]
null
null
null
What is computed between each pair of rows in x and y ?
def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
the chi - squared kernel
codeqa
def additive chi 2 kernel X Y None if issparse X or issparse Y raise Value Error 'additive chi 2 doesnotsupportsparsematrices ' X Y check pairwise arrays X Y if X < 0 any raise Value Error ' Xcontainsnegativevalues ' if Y is not X and Y < 0 any raise Value Error ' Ycontainsnegativevalues ' result np zeros X shape[ 0 ] Y shape[ 0 ] dtype X dtype chi 2 kernel fast X Y result return result
null
null
null
null
Question: What is computed between each pair of rows in x and y ? Code: def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
What does the code compute ?
def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
the additive chi - squared kernel between observations in x and y
codeqa
def additive chi 2 kernel X Y None if issparse X or issparse Y raise Value Error 'additive chi 2 doesnotsupportsparsematrices ' X Y check pairwise arrays X Y if X < 0 any raise Value Error ' Xcontainsnegativevalues ' if Y is not X and Y < 0 any raise Value Error ' Ycontainsnegativevalues ' result np zeros X shape[ 0 ] Y shape[ 0 ] dtype X dtype chi 2 kernel fast X Y result return result
null
null
null
null
Question: What does the code compute ? Code: def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
Where is the chi - squared kernel computed ?
def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
between each pair of rows in x and y
codeqa
def additive chi 2 kernel X Y None if issparse X or issparse Y raise Value Error 'additive chi 2 doesnotsupportsparsematrices ' X Y check pairwise arrays X Y if X < 0 any raise Value Error ' Xcontainsnegativevalues ' if Y is not X and Y < 0 any raise Value Error ' Ycontainsnegativevalues ' result np zeros X shape[ 0 ] Y shape[ 0 ] dtype X dtype chi 2 kernel fast X Y result return result
null
null
null
null
Question: Where is the chi - squared kernel computed ? Code: def additive_chi2_kernel(X, Y=None): if (issparse(X) or issparse(Y)): raise ValueError('additive_chi2 does not support sparse matrices.') (X, Y) = check_pairwise_arrays(X, Y) if (X < 0).any(): raise ValueError('X contains negative values.') if ((Y is not X) and (Y < 0).any()): raise ValueError('Y contains negative values.') result = np.zeros((X.shape[0], Y.shape[0]), dtype=X.dtype) _chi2_kernel_fast(X, Y, result) return result
null
null
null
What licensed under cc - wiki ?
def all(iterable): for element in iterable: if (not element): return False return True
null
null
null
URL
codeqa
def all iterable for element in iterable if not element return Falsereturn True
null
null
null
null
Question: What licensed under cc - wiki ? Code: def all(iterable): for element in iterable: if (not element): return False return True
null
null
null
Where did URL license ?
def all(iterable): for element in iterable: if (not element): return False return True
null
null
null
under cc - wiki
codeqa
def all iterable for element in iterable if not element return Falsereturn True
null
null
null
null
Question: Where did URL license ? Code: def all(iterable): for element in iterable: if (not element): return False return True
null
null
null
What does the code convert to a string ?
def _datetime_to_rfc3339(value, ignore_zone=True): if ((not ignore_zone) and (value.tzinfo is not None)): value = (value.replace(tzinfo=None) - value.utcoffset()) return value.strftime(_RFC3339_MICROS)
null
null
null
a timestamp
codeqa
def datetime to rfc 3339 value ignore zone True if not ignore zone and value tzinfo is not None value value replace tzinfo None - value utcoffset return value strftime RFC 3339 MICROS
null
null
null
null
Question: What does the code convert to a string ? Code: def _datetime_to_rfc3339(value, ignore_zone=True): if ((not ignore_zone) and (value.tzinfo is not None)): value = (value.replace(tzinfo=None) - value.utcoffset()) return value.strftime(_RFC3339_MICROS)
null
null
null
What does the code remove from atomic group ?
def atomic_group_remove_labels(id, labels): label_objs = models.Label.smart_get_bulk(labels) models.AtomicGroup.smart_get(id).label_set.remove(*label_objs)
null
null
null
labels
codeqa
def atomic group remove labels id labels label objs models Label smart get bulk labels models Atomic Group smart get id label set remove *label objs
null
null
null
null
Question: What does the code remove from atomic group ? Code: def atomic_group_remove_labels(id, labels): label_objs = models.Label.smart_get_bulk(labels) models.AtomicGroup.smart_get(id).label_set.remove(*label_objs)
null
null
null
What does this return ?
def constrain(n, min, max): if (n < min): return min if (n > max): return max return n
null
null
null
a number
codeqa
def constrain n min max if n < min return minif n > max return maxreturn n
null
null
null
null
Question: What does this return ? Code: def constrain(n, min, max): if (n < min): return min if (n > max): return max return n
null
null
null
What returns a number ?
def constrain(n, min, max): if (n < min): return min if (n > max): return max return n
null
null
null
this
codeqa
def constrain n min max if n < min return minif n > max return maxreturn n
null
null
null
null
Question: What returns a number ? Code: def constrain(n, min, max): if (n < min): return min if (n > max): return max return n
null
null
null
What does the code raise ?
def vo_reraise(exc, config=None, pos=None, additional=u''): if (config is None): config = {} message = _format_message(str(exc), exc.__class__.__name__, config, pos) if (message.split()[0] == str(exc).split()[0]): message = str(exc) if len(additional): message += (u' ' + additional) exc.args = (message,) raise exc
null
null
null
an exception
codeqa
def vo reraise exc config None pos None additional u'' if config is None config {}message format message str exc exc class name config pos if message split [0 ] str exc split [0 ] message str exc if len additional message + u'' + additional exc args message raise exc
null
null
null
null
Question: What does the code raise ? Code: def vo_reraise(exc, config=None, pos=None, additional=u''): if (config is None): config = {} message = _format_message(str(exc), exc.__class__.__name__, config, pos) if (message.split()[0] == str(exc).split()[0]): message = str(exc) if len(additional): message += (u' ' + additional) exc.args = (message,) raise exc
null
null
null
What does the code return ?
def wordcount(value): return len(value.split())
null
null
null
the number of words
codeqa
def wordcount value return len value split
null
null
null
null
Question: What does the code return ? Code: def wordcount(value): return len(value.split())
null
null
null
which organization sends the email with the new password ?
@csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
password_reset
codeqa
@csrf protectdef password reset request response format 'html' if request POST form Password Reset Form request POST if form is valid form save return Http Response Redirect reverse 'password reset done' else form Password Reset Form return render to response 'core/password reset form' {'form' form} context instance Request Context request response format response format
null
null
null
null
Question: which organization sends the email with the new password ? Code: @csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
What does password_reset send with the new password ?
@csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
the email
codeqa
@csrf protectdef password reset request response format 'html' if request POST form Password Reset Form request POST if form is valid form save return Http Response Redirect reverse 'password reset done' else form Password Reset Form return render to response 'core/password reset form' {'form' form} context instance Request Context request response format response format
null
null
null
null
Question: What does password_reset send with the new password ? Code: @csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
How does password_reset send the email ?
@csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
with the new password
codeqa
@csrf protectdef password reset request response format 'html' if request POST form Password Reset Form request POST if form is valid form save return Http Response Redirect reverse 'password reset done' else form Password Reset Form return render to response 'core/password reset form' {'form' form} context instance Request Context request response format response format
null
null
null
null
Question: How does password_reset send the email ? Code: @csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
Who sends the email with the new password ?
@csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
password_reset
codeqa
@csrf protectdef password reset request response format 'html' if request POST form Password Reset Form request POST if form is valid form save return Http Response Redirect reverse 'password reset done' else form Password Reset Form return render to response 'core/password reset form' {'form' form} context instance Request Context request response format response format
null
null
null
null
Question: Who sends the email with the new password ? Code: @csrf_protect def password_reset(request, response_format='html'): if request.POST: form = PasswordResetForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('password_reset_done')) else: form = PasswordResetForm() return render_to_response('core/password_reset_form', {'form': form}, context_instance=RequestContext(request), response_format=response_format)
null
null
null
What does context manager set as the remote host ?
def vagrant_settings(name='', *args, **kwargs): name = _name_or_host_string(name) config = ssh_config(name) extra_args = _settings_dict(config) kwargs.update(extra_args) return settings(*args, **kwargs)
null
null
null
a vagrant vm named name
codeqa
def vagrant settings name '' *args **kwargs name name or host string name config ssh config name extra args settings dict config kwargs update extra args return settings *args **kwargs
null
null
null
null
Question: What does context manager set as the remote host ? Code: def vagrant_settings(name='', *args, **kwargs): name = _name_or_host_string(name) config = ssh_config(name) extra_args = _settings_dict(config) kwargs.update(extra_args) return settings(*args, **kwargs)