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 get by prefix ?
def getStrokeRadiusByPrefix(elementNode, prefix): strokeRadius = getFloatByPrefixBeginEnd(elementNode, (prefix + 'strokeRadius'), (prefix + 'strokeWidth'), 1.0) return getFloatByPrefixBeginEnd(elementNode, (prefix + 'radius'), (prefix + 'diameter'), strokeRadius)
null
null
null
strokeradius
codeqa
def get Stroke Radius By Prefix element Node prefix stroke Radius get Float By Prefix Begin End element Node prefix + 'stroke Radius' prefix + 'stroke Width' 1 0 return get Float By Prefix Begin End element Node prefix + 'radius' prefix + 'diameter' stroke Radius
null
null
null
null
Question: What does the code get by prefix ? Code: def getStrokeRadiusByPrefix(elementNode, prefix): strokeRadius = getFloatByPrefixBeginEnd(elementNode, (prefix + 'strokeRadius'), (prefix + 'strokeWidth'), 1.0) return getFloatByPrefixBeginEnd(elementNode, (prefix + 'radius'), (prefix + 'diameter'), strokeRadius)
null
null
null
What did the code read ?
@verbose def _read_source_spaces_from_tree(fid, tree, patch_stats=False, verbose=None): spaces = dir_tree_find(tree, FIFF.FIFFB_MNE_SOURCE_SPACE) if (len(spaces) == 0): raise ValueError('No source spaces found') src = list() for s in spaces: logger.info(' Reading a source space...') this = _read_one_source_space(fid, s) logger.info(' [done]') if patch_stats: _complete_source_space_info(this) src.append(this) logger.info((' %d source spaces read' % len(spaces))) return SourceSpaces(src)
null
null
null
the source spaces
codeqa
@verbosedef read source spaces from tree fid tree patch stats False verbose None spaces dir tree find tree FIFF FIFFB MNE SOURCE SPACE if len spaces 0 raise Value Error ' Nosourcespacesfound' src list for s in spaces logger info ' Readingasourcespace ' this read one source space fid s logger info '[done]' if patch stats complete source space info this src append this logger info '%dsourcespacesread' % len spaces return Source Spaces src
null
null
null
null
Question: What did the code read ? Code: @verbose def _read_source_spaces_from_tree(fid, tree, patch_stats=False, verbose=None): spaces = dir_tree_find(tree, FIFF.FIFFB_MNE_SOURCE_SPACE) if (len(spaces) == 0): raise ValueError('No source spaces found') src = list() for s in spaces: logger.info(' Reading a source space...') this = _read_one_source_space(fid, s) logger.info(' [done]') if patch_stats: _complete_source_space_info(this) src.append(this) logger.info((' %d source spaces read' % len(spaces))) return SourceSpaces(src)
null
null
null
What does the code remove ?
def strip_whitespace(v): return (v.strip(' DCTB \n\r') if (v is not null) else v)
null
null
null
whitespace
codeqa
def strip whitespace v return v strip ' DCTB \n\r' if v is not null else v
null
null
null
null
Question: What does the code remove ? Code: def strip_whitespace(v): return (v.strip(' DCTB \n\r') if (v is not null) else v)
null
null
null
What does the code return ?
def get_related_models_tuples(model): return {(rel_mod._meta.app_label, rel_mod._meta.model_name) for rel_mod in _get_related_models(model)}
null
null
null
a list of typical tuples for all related models for the given model
codeqa
def get related models tuples model return { rel mod meta app label rel mod meta model name for rel mod in get related models model }
null
null
null
null
Question: What does the code return ? Code: def get_related_models_tuples(model): return {(rel_mod._meta.app_label, rel_mod._meta.model_name) for rel_mod in _get_related_models(model)}
null
null
null
What does the code build ?
def _error_msg_routes(iface, option, expected): msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, expected)
null
null
null
an appropriate error message from a given option and a list of expected values
codeqa
def error msg routes iface option expected msg ' Invalidoption-- Routeinterface {0 } Option {1 } Expected [{ 2 }]'return msg format iface option expected
null
null
null
null
Question: What does the code build ? Code: def _error_msg_routes(iface, option, expected): msg = 'Invalid option -- Route interface: {0}, Option: {1}, Expected: [{2}]' return msg.format(iface, option, expected)
null
null
null
What does the code retrieve ?
def _get_unique_table_field_values(model, field, sort_field): if ((field not in model.all_keys()) or (sort_field not in model.all_keys())): raise KeyError with g.lib.transaction() as tx: rows = tx.query('SELECT DISTINCT "{0}" FROM "{1}" ORDER BY "{2}"'.format(field, model._table, sort_field)) return [row[0] for row in rows]
null
null
null
all unique values belonging to a key from a model
codeqa
def get unique table field values model field sort field if field not in model all keys or sort field not in model all keys raise Key Errorwith g lib transaction as tx rows tx query 'SELECTDISTINCT"{ 0 }"FROM"{ 1 }"ORDERBY"{ 2 }"' format field model table sort field return [row[ 0 ] for row in rows]
null
null
null
null
Question: What does the code retrieve ? Code: def _get_unique_table_field_values(model, field, sort_field): if ((field not in model.all_keys()) or (sort_field not in model.all_keys())): raise KeyError with g.lib.transaction() as tx: rows = tx.query('SELECT DISTINCT "{0}" FROM "{1}" ORDER BY "{2}"'.format(field, model._table, sort_field)) return [row[0] for row in rows]
null
null
null
What does the code create ?
def CreateCampaignWithBiddingStrategy(client, bidding_strategy_id, budget_id): campaign_service = client.GetService('CampaignService', version='v201607') campaign = {'name': ('Interplanetary Cruise #%s' % uuid.uuid4()), 'budget': {'budgetId': budget_id}, 'biddingStrategyConfiguration': {'biddingStrategyId': bidding_strategy_id}, 'advertisingChannelType': 'SEARCH', 'networkSetting': {'targetGoogleSearch': 'true', 'targetSearchNetwork': 'true', 'targetContentNetwork': 'true'}} operation = {'operator': 'ADD', 'operand': campaign} response = campaign_service.mutate([operation]) new_campaign = response['value'][0] print ("Campaign with name '%s', ID '%s' and bidding scheme ID '%s' was created." % (new_campaign['name'], new_campaign['id'], new_campaign['biddingStrategyConfiguration']['biddingStrategyId'])) return new_campaign
null
null
null
a campaign with a shared bidding strategy
codeqa
def Create Campaign With Bidding Strategy client bidding strategy id budget id campaign service client Get Service ' Campaign Service' version 'v 201607 ' campaign {'name' ' Interplanetary Cruise#%s' % uuid uuid 4 'budget' {'budget Id' budget id} 'bidding Strategy Configuration' {'bidding Strategy Id' bidding strategy id} 'advertising Channel Type' 'SEARCH' 'network Setting' {'target Google Search' 'true' 'target Search Network' 'true' 'target Content Network' 'true'}}operation {'operator' 'ADD' 'operand' campaign}response campaign service mutate [operation] new campaign response['value'][ 0 ]print " Campaignwithname'%s' ID'%s'andbiddingscheme ID'%s'wascreated " % new campaign['name'] new campaign['id'] new campaign['bidding Strategy Configuration']['bidding Strategy Id'] return new campaign
null
null
null
null
Question: What does the code create ? Code: def CreateCampaignWithBiddingStrategy(client, bidding_strategy_id, budget_id): campaign_service = client.GetService('CampaignService', version='v201607') campaign = {'name': ('Interplanetary Cruise #%s' % uuid.uuid4()), 'budget': {'budgetId': budget_id}, 'biddingStrategyConfiguration': {'biddingStrategyId': bidding_strategy_id}, 'advertisingChannelType': 'SEARCH', 'networkSetting': {'targetGoogleSearch': 'true', 'targetSearchNetwork': 'true', 'targetContentNetwork': 'true'}} operation = {'operator': 'ADD', 'operand': campaign} response = campaign_service.mutate([operation]) new_campaign = response['value'][0] print ("Campaign with name '%s', ID '%s' and bidding scheme ID '%s' was created." % (new_campaign['name'], new_campaign['id'], new_campaign['biddingStrategyConfiguration']['biddingStrategyId'])) return new_campaign
null
null
null
What is using double braces ?
def template(string, **kwargs): return _swap_curly(string).format(**kwargs)
null
null
null
a string
codeqa
def template string **kwargs return swap curly string format **kwargs
null
null
null
null
Question: What is using double braces ? Code: def template(string, **kwargs): return _swap_curly(string).format(**kwargs)
null
null
null
What do a string use ?
def template(string, **kwargs): return _swap_curly(string).format(**kwargs)
null
null
null
double braces
codeqa
def template string **kwargs return swap curly string format **kwargs
null
null
null
null
Question: What do a string use ? Code: def template(string, **kwargs): return _swap_curly(string).format(**kwargs)
null
null
null
How do an entire directory tree remove ?
def remove_tree(directory, verbose=1, dry_run=0): from distutils.util import grok_environment_error global _path_created if (verbose >= 1): log.info("removing '%s' (and everything under it)", directory) if dry_run: return cmdtuples = [] _build_cmdtuple(directory, cmdtuples) for cmd in cmdtuples: try: cmd[0](cmd[1]) abspath = os.path.abspath(cmd[1]) if (abspath in _path_created): del _path_created[abspath] except (IOError, OSError) as exc: log.warn(grok_environment_error(exc, ('error removing %s: ' % directory)))
null
null
null
recursively
codeqa
def remove tree directory verbose 1 dry run 0 from distutils util import grok environment errorglobal path createdif verbose > 1 log info "removing'%s' andeverythingunderit " directory if dry run returncmdtuples [] build cmdtuple directory cmdtuples for cmd in cmdtuples try cmd[ 0 ] cmd[ 1 ] abspath os path abspath cmd[ 1 ] if abspath in path created del path created[abspath]except IO Error OS Error as exc log warn grok environment error exc 'errorremoving%s ' % directory
null
null
null
null
Question: How do an entire directory tree remove ? Code: def remove_tree(directory, verbose=1, dry_run=0): from distutils.util import grok_environment_error global _path_created if (verbose >= 1): log.info("removing '%s' (and everything under it)", directory) if dry_run: return cmdtuples = [] _build_cmdtuple(directory, cmdtuples) for cmd in cmdtuples: try: cmd[0](cmd[1]) abspath = os.path.abspath(cmd[1]) if (abspath in _path_created): del _path_created[abspath] except (IOError, OSError) as exc: log.warn(grok_environment_error(exc, ('error removing %s: ' % directory)))
null
null
null
What does the code send to the initiator of a bulk email query with a link to view the query results ?
def send_query_completion_email(recipient_id, query_id): email_subject = ('Query %s has successfully completed' % query_id) email_body_template = 'Hi %s,<br>Your query with id %s has succesfully completed its execution. Visit the result page <a href="https://www.oppia.org/emaildashboardresult/%s">here</a> to see result of your query.<br><br>Thanks!<br><br>Best wishes,<br>The Oppia Team<br><br>%s' recipient_user_settings = user_services.get_user_settings(recipient_id) email_body = (email_body_template % (recipient_user_settings.username, query_id, query_id, EMAIL_FOOTER.value)) _send_email(recipient_id, feconf.SYSTEM_COMMITTER_ID, feconf.EMAIL_INTENT_QUERY_STATUS_NOTIFICATION, email_subject, email_body, feconf.NOREPLY_EMAIL_ADDRESS)
null
null
null
an email
codeqa
def send query completion email recipient id query id email subject ' Query%shassuccessfullycompleted' % query id email body template ' Hi%s <br> Yourquerywithid%shassuccesfullycompleteditsexecution Visittheresultpage<ahref "https //www oppia org/emaildashboardresult/%s">here</a>toseeresultofyourquery <br><br> Thanks <br><br> Bestwishes <br> The Oppia Team<br><br>%s'recipient user settings user services get user settings recipient id email body email body template % recipient user settings username query id query id EMAIL FOOTER value send email recipient id feconf SYSTEM COMMITTER ID feconf EMAIL INTENT QUERY STATUS NOTIFICATION email subject email body feconf NOREPLY EMAIL ADDRESS
null
null
null
null
Question: What does the code send to the initiator of a bulk email query with a link to view the query results ? Code: def send_query_completion_email(recipient_id, query_id): email_subject = ('Query %s has successfully completed' % query_id) email_body_template = 'Hi %s,<br>Your query with id %s has succesfully completed its execution. Visit the result page <a href="https://www.oppia.org/emaildashboardresult/%s">here</a> to see result of your query.<br><br>Thanks!<br><br>Best wishes,<br>The Oppia Team<br><br>%s' recipient_user_settings = user_services.get_user_settings(recipient_id) email_body = (email_body_template % (recipient_user_settings.username, query_id, query_id, EMAIL_FOOTER.value)) _send_email(recipient_id, feconf.SYSTEM_COMMITTER_ID, feconf.EMAIL_INTENT_QUERY_STATUS_NOTIFICATION, email_subject, email_body, feconf.NOREPLY_EMAIL_ADDRESS)
null
null
null
What does this return ?
def get_course_info_section_module(request, user, course, section_key): usage_key = course.id.make_usage_key('course_info', section_key) field_data_cache = FieldDataCache([], course.id, user) return get_module(user, request, usage_key, field_data_cache, log_if_not_found=False, wrap_xmodule_display=False, static_asset_path=course.static_asset_path, course=course)
null
null
null
the course info module
codeqa
def get course info section module request user course section key usage key course id make usage key 'course info' section key field data cache Field Data Cache [] course id user return get module user request usage key field data cache log if not found False wrap xmodule display False static asset path course static asset path course course
null
null
null
null
Question: What does this return ? Code: def get_course_info_section_module(request, user, course, section_key): usage_key = course.id.make_usage_key('course_info', section_key) field_data_cache = FieldDataCache([], course.id, user) return get_module(user, request, usage_key, field_data_cache, log_if_not_found=False, wrap_xmodule_display=False, static_asset_path=course.static_asset_path, course=course)
null
null
null
What returns the course info module ?
def get_course_info_section_module(request, user, course, section_key): usage_key = course.id.make_usage_key('course_info', section_key) field_data_cache = FieldDataCache([], course.id, user) return get_module(user, request, usage_key, field_data_cache, log_if_not_found=False, wrap_xmodule_display=False, static_asset_path=course.static_asset_path, course=course)
null
null
null
this
codeqa
def get course info section module request user course section key usage key course id make usage key 'course info' section key field data cache Field Data Cache [] course id user return get module user request usage key field data cache log if not found False wrap xmodule display False static asset path course static asset path course course
null
null
null
null
Question: What returns the course info module ? Code: def get_course_info_section_module(request, user, course, section_key): usage_key = course.id.make_usage_key('course_info', section_key) field_data_cache = FieldDataCache([], course.id, user) return get_module(user, request, usage_key, field_data_cache, log_if_not_found=False, wrap_xmodule_display=False, static_asset_path=course.static_asset_path, course=course)
null
null
null
Where do tags modify ?
def modify_tags(gce, module, node, tags, state='present'): zone = node.extra['zone'].name existing_tags = node.extra['tags'] tags = [x.lower() for x in tags] tags_changed = [] if (state == 'absent'): tags_changed = _intersect_items(existing_tags, tags) if (not tags_changed): return (False, None) node_tags = _get_changed_items(existing_tags, tags) else: tags_changed = _get_changed_items(tags, existing_tags) if (not tags_changed): return (False, None) node_tags = _union_items(existing_tags, tags) try: gce.ex_set_node_tags(node, node_tags) return (True, tags_changed) except (GoogleBaseError, InvalidRequestError) as e: module.fail_json(msg=str(e), changed=False)
null
null
null
on an instance
codeqa
def modify tags gce module node tags state 'present' zone node extra['zone'] nameexisting tags node extra['tags']tags [x lower for x in tags]tags changed []if state 'absent' tags changed intersect items existing tags tags if not tags changed return False None node tags get changed items existing tags tags else tags changed get changed items tags existing tags if not tags changed return False None node tags union items existing tags tags try gce ex set node tags node node tags return True tags changed except Google Base Error Invalid Request Error as e module fail json msg str e changed False
null
null
null
null
Question: Where do tags modify ? Code: def modify_tags(gce, module, node, tags, state='present'): zone = node.extra['zone'].name existing_tags = node.extra['tags'] tags = [x.lower() for x in tags] tags_changed = [] if (state == 'absent'): tags_changed = _intersect_items(existing_tags, tags) if (not tags_changed): return (False, None) node_tags = _get_changed_items(existing_tags, tags) else: tags_changed = _get_changed_items(tags, existing_tags) if (not tags_changed): return (False, None) node_tags = _union_items(existing_tags, tags) try: gce.ex_set_node_tags(node, node_tags) return (True, tags_changed) except (GoogleBaseError, InvalidRequestError) as e: module.fail_json(msg=str(e), changed=False)
null
null
null
In which direction do a collection of hosts release ?
def force_release(hosts_to_release, username=None): hosts = models.Host.smart_get_bulk(hosts_to_release) if (not hosts): raise Exception('At least one host must be specified') user = get_user(username) if (not user.is_superuser()): raise Exception('Must be super user to force release') acls = models.AclGroup.objects.all() for user_acl in acls: user_acl.hosts.remove(*hosts) user_acl.on_host_membership_change()
null
null
null
from user
codeqa
def force release hosts to release username None hosts models Host smart get bulk hosts to release if not hosts raise Exception ' Atleastonehostmustbespecified' user get user username if not user is superuser raise Exception ' Mustbesuperusertoforcerelease' acls models Acl Group objects all for user acl in acls user acl hosts remove *hosts user acl on host membership change
null
null
null
null
Question: In which direction do a collection of hosts release ? Code: def force_release(hosts_to_release, username=None): hosts = models.Host.smart_get_bulk(hosts_to_release) if (not hosts): raise Exception('At least one host must be specified') user = get_user(username) if (not user.is_superuser()): raise Exception('Must be super user to force release') acls = models.AclGroup.objects.all() for user_acl in acls: user_acl.hosts.remove(*hosts) user_acl.on_host_membership_change()
null
null
null
What contains the edges that exist in g but not in h ?
def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
a new graph
codeqa
def difference G H if not G is multigraph H is multigraph raise nx Network X Error ' Gand Hmustbothbegraphsormultigraphs ' R nx create empty copy G R name ' Differenceof %sand%s ' % G name H name if set G set H raise nx Network X Error ' Nodesetsofgraphsnotequal' if G is multigraph edges G edges keys True else edges G edges for e in edges if not H has edge *e R add edge *e return R
null
null
null
null
Question: What contains the edges that exist in g but not in h ? Code: def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
Where do the edges exist ?
def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
in g
codeqa
def difference G H if not G is multigraph H is multigraph raise nx Network X Error ' Gand Hmustbothbegraphsormultigraphs ' R nx create empty copy G R name ' Differenceof %sand%s ' % G name H name if set G set H raise nx Network X Error ' Nodesetsofgraphsnotequal' if G is multigraph edges G edges keys True else edges G edges for e in edges if not H has edge *e R add edge *e return R
null
null
null
null
Question: Where do the edges exist ? Code: def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
What does a new graph contain ?
def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
the edges that exist in g but not in h
codeqa
def difference G H if not G is multigraph H is multigraph raise nx Network X Error ' Gand Hmustbothbegraphsormultigraphs ' R nx create empty copy G R name ' Differenceof %sand%s ' % G name H name if set G set H raise nx Network X Error ' Nodesetsofgraphsnotequal' if G is multigraph edges G edges keys True else edges G edges for e in edges if not H has edge *e R add edge *e return R
null
null
null
null
Question: What does a new graph contain ? Code: def difference(G, H): if (not (G.is_multigraph() == H.is_multigraph())): raise nx.NetworkXError('G and H must both be graphs or multigraphs.') R = nx.create_empty_copy(G) R.name = ('Difference of (%s and %s)' % (G.name, H.name)) if (set(G) != set(H)): raise nx.NetworkXError('Node sets of graphs not equal') if G.is_multigraph(): edges = G.edges(keys=True) else: edges = G.edges() for e in edges: if (not H.has_edge(*e)): R.add_edge(*e) return R
null
null
null
What does the code write ?
def write_git_changelog(): new_changelog = 'ChangeLog' if (not os.getenv('SKIP_WRITE_GIT_CHANGELOG')): if os.path.isdir('.git'): git_log_cmd = 'git log --stat' changelog = _run_shell_command(git_log_cmd) mailmap = parse_mailmap() with open(new_changelog, 'w') as changelog_file: changelog_file.write(canonicalize_emails(changelog, mailmap)) else: open(new_changelog, 'w').close()
null
null
null
a changelog based on the git changelog
codeqa
def write git changelog new changelog ' Change Log'if not os getenv 'SKIP WRITE GIT CHANGELOG' if os path isdir ' git' git log cmd 'gitlog--stat'changelog run shell command git log cmd mailmap parse mailmap with open new changelog 'w' as changelog file changelog file write canonicalize emails changelog mailmap else open new changelog 'w' close
null
null
null
null
Question: What does the code write ? Code: def write_git_changelog(): new_changelog = 'ChangeLog' if (not os.getenv('SKIP_WRITE_GIT_CHANGELOG')): if os.path.isdir('.git'): git_log_cmd = 'git log --stat' changelog = _run_shell_command(git_log_cmd) mailmap = parse_mailmap() with open(new_changelog, 'w') as changelog_file: changelog_file.write(canonicalize_emails(changelog, mailmap)) else: open(new_changelog, 'w').close()
null
null
null
What does the code get ?
def getNewRepository(): return AnalyzeRepository()
null
null
null
the repository constructor
codeqa
def get New Repository return Analyze Repository
null
null
null
null
Question: What does the code get ? Code: def getNewRepository(): return AnalyzeRepository()
null
null
null
What does the code run ?
def get_virtual_daemon(exec_method): try: os = os_detection_exec(exec_method) except BaseFrameworkException as w3: raise w3 else: if (os == 'windows'): om.out.debug('Identified remote OS as Windows, returning winVd object.') return winVd(exec_method) elif (os == 'linux'): om.out.debug('Identified remote OS as Linux, returning lnxVd object.') return lnxVd(exec_method) else: raise BaseFrameworkException(('Failed to get a virtual daemon for the remote OS: ' + os))
null
null
null
remote commands
codeqa
def get virtual daemon exec method try os os detection exec exec method except Base Framework Exception as w3 raise w3 else if os 'windows' om out debug ' Identifiedremote O Sas Windows returningwin Vdobject ' return win Vd exec method elif os 'linux' om out debug ' Identifiedremote O Sas Linux returninglnx Vdobject ' return lnx Vd exec method else raise Base Framework Exception ' Failedtogetavirtualdaemonfortheremote OS ' + os
null
null
null
null
Question: What does the code run ? Code: def get_virtual_daemon(exec_method): try: os = os_detection_exec(exec_method) except BaseFrameworkException as w3: raise w3 else: if (os == 'windows'): om.out.debug('Identified remote OS as Windows, returning winVd object.') return winVd(exec_method) elif (os == 'linux'): om.out.debug('Identified remote OS as Linux, returning lnxVd object.') return lnxVd(exec_method) else: raise BaseFrameworkException(('Failed to get a virtual daemon for the remote OS: ' + os))
null
null
null
What does the code create from a model ?
def _mock_view_index(model, category_idx, child_idx, qtbot): view = QTreeView() qtbot.add_widget(view) view.setModel(model) idx = model.indexFromItem(model.item(category_idx).child(child_idx)) view.setCurrentIndex(idx) return view
null
null
null
a tree view
codeqa
def mock view index model category idx child idx qtbot view Q Tree View qtbot add widget view view set Model model idx model index From Item model item category idx child child idx view set Current Index idx return view
null
null
null
null
Question: What does the code create from a model ? Code: def _mock_view_index(model, category_idx, child_idx, qtbot): view = QTreeView() qtbot.add_widget(view) view.setModel(model) idx = model.indexFromItem(model.item(category_idx).child(child_idx)) view.setCurrentIndex(idx) return view
null
null
null
What does the code set ?
def _mock_view_index(model, category_idx, child_idx, qtbot): view = QTreeView() qtbot.add_widget(view) view.setModel(model) idx = model.indexFromItem(model.item(category_idx).child(child_idx)) view.setCurrentIndex(idx) return view
null
null
null
the current index
codeqa
def mock view index model category idx child idx qtbot view Q Tree View qtbot add widget view view set Model model idx model index From Item model item category idx child child idx view set Current Index idx return view
null
null
null
null
Question: What does the code set ? Code: def _mock_view_index(model, category_idx, child_idx, qtbot): view = QTreeView() qtbot.add_widget(view) view.setModel(model) idx = model.indexFromItem(model.item(category_idx).child(child_idx)) view.setCurrentIndex(idx) return view
null
null
null
What does the code check based on a substring ?
@bdd.then(bdd.parsers.parse('the page should contain the html "{text}"')) def check_contents_html(quteproc, text): content = quteproc.get_content(plain=False) assert (text in content)
null
null
null
the current pages content
codeqa
@bdd then bdd parsers parse 'thepageshouldcontainthehtml"{text}"' def check contents html quteproc text content quteproc get content plain False assert text in content
null
null
null
null
Question: What does the code check based on a substring ? Code: @bdd.then(bdd.parsers.parse('the page should contain the html "{text}"')) def check_contents_html(quteproc, text): content = quteproc.get_content(plain=False) assert (text in content)
null
null
null
For what purpose does the indefinite article return ?
def indefinite_article(word): word = word.split(' ')[0] for (rule, article) in RE_ARTICLE: if (rule.search(word) is not None): return article
null
null
null
for a given word
codeqa
def indefinite article word word word split '' [0 ]for rule article in RE ARTICLE if rule search word is not None return article
null
null
null
null
Question: For what purpose does the indefinite article return ? Code: def indefinite_article(word): word = word.split(' ')[0] for (rule, article) in RE_ARTICLE: if (rule.search(word) is not None): return article
null
null
null
What does the code move ?
def local_config(mobsf_home): if (not os.path.exists(CONFIG_PATH)): os.makedirs(CONFIG_PATH) shutil.copy((mobsf_home + '\\install\\windows\\config.txt'), os.path.join(CONFIG_PATH, CONFIG_FILE))
null
null
null
local config
codeqa
def local config mobsf home if not os path exists CONFIG PATH os makedirs CONFIG PATH shutil copy mobsf home + '\\install\\windows\\config txt' os path join CONFIG PATH CONFIG FILE
null
null
null
null
Question: What does the code move ? Code: def local_config(mobsf_home): if (not os.path.exists(CONFIG_PATH)): os.makedirs(CONFIG_PATH) shutil.copy((mobsf_home + '\\install\\windows\\config.txt'), os.path.join(CONFIG_PATH, CONFIG_FILE))
null
null
null
What does the code save ?
def local_config(mobsf_home): if (not os.path.exists(CONFIG_PATH)): os.makedirs(CONFIG_PATH) shutil.copy((mobsf_home + '\\install\\windows\\config.txt'), os.path.join(CONFIG_PATH, CONFIG_FILE))
null
null
null
paths
codeqa
def local config mobsf home if not os path exists CONFIG PATH os makedirs CONFIG PATH shutil copy mobsf home + '\\install\\windows\\config txt' os path join CONFIG PATH CONFIG FILE
null
null
null
null
Question: What does the code save ? Code: def local_config(mobsf_home): if (not os.path.exists(CONFIG_PATH)): os.makedirs(CONFIG_PATH) shutil.copy((mobsf_home + '\\install\\windows\\config.txt'), os.path.join(CONFIG_PATH, CONFIG_FILE))
null
null
null
What does the code send ?
def notify_about_host_update(context, event_suffix, host_payload): host_identifier = host_payload.get('host_name') if (not host_identifier): LOG.warning(_LW('No host name specified for the notification of HostAPI.%s and it will be ignored'), event_suffix) return notifier = rpc.get_notifier(service='api', host=host_identifier) notifier.info(context, ('HostAPI.%s' % event_suffix), host_payload)
null
null
null
a notification about host update
codeqa
def notify about host update context event suffix host payload host identifier host payload get 'host name' if not host identifier LOG warning LW ' Nohostnamespecifiedforthenotificationof Host API %sanditwillbeignored' event suffix returnnotifier rpc get notifier service 'api' host host identifier notifier info context ' Host API %s' % event suffix host payload
null
null
null
null
Question: What does the code send ? Code: def notify_about_host_update(context, event_suffix, host_payload): host_identifier = host_payload.get('host_name') if (not host_identifier): LOG.warning(_LW('No host name specified for the notification of HostAPI.%s and it will be ignored'), event_suffix) return notifier = rpc.get_notifier(service='api', host=host_identifier) notifier.info(context, ('HostAPI.%s' % event_suffix), host_payload)
null
null
null
What saves under destination directory ?
@task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
docs
codeqa
@task help {'dest' ' Destinationdirectorytosavedocs'} def save ctx dest 'docs html' format 'html' print 'STEP Generatedocsin HTM Lformat' build ctx builder format print 'STEP Savedocsunder%s/' % dest source dir Path ctx config sphinx destdir / format Path dest rmtree p source dir copytree dest for part in [' buildinfo' ' doctrees'] partpath Path dest / part if partpath isdir partpath rmtree p elif partpath exists partpath remove p
null
null
null
null
Question: What saves under destination directory ? Code: @task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
Where do docs update ?
@task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
under destination directory
codeqa
@task help {'dest' ' Destinationdirectorytosavedocs'} def save ctx dest 'docs html' format 'html' print 'STEP Generatedocsin HTM Lformat' build ctx builder format print 'STEP Savedocsunder%s/' % dest source dir Path ctx config sphinx destdir / format Path dest rmtree p source dir copytree dest for part in [' buildinfo' ' doctrees'] partpath Path dest / part if partpath isdir partpath rmtree p elif partpath exists partpath remove p
null
null
null
null
Question: Where do docs update ? Code: @task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
Where do docs save ?
@task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
under destination directory
codeqa
@task help {'dest' ' Destinationdirectorytosavedocs'} def save ctx dest 'docs html' format 'html' print 'STEP Generatedocsin HTM Lformat' build ctx builder format print 'STEP Savedocsunder%s/' % dest source dir Path ctx config sphinx destdir / format Path dest rmtree p source dir copytree dest for part in [' buildinfo' ' doctrees'] partpath Path dest / part if partpath isdir partpath rmtree p elif partpath exists partpath remove p
null
null
null
null
Question: Where do docs save ? Code: @task(help={'dest': 'Destination directory to save docs'}) def save(ctx, dest='docs.html', format='html'): print('STEP: Generate docs in HTML format') build(ctx, builder=format) print(('STEP: Save docs under %s/' % dest)) source_dir = (Path(ctx.config.sphinx.destdir) / format) Path(dest).rmtree_p() source_dir.copytree(dest) for part in ['.buildinfo', '.doctrees']: partpath = (Path(dest) / part) if partpath.isdir(): partpath.rmtree_p() elif partpath.exists(): partpath.remove_p()
null
null
null
What does a predicate on a tree node describe ?
def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
the use of a previously bound node label
codeqa
def tgrep node label pred use action s l tokens assert len tokens 1 assert tokens[ 0 ] startswith u' ' node label tokens[ 0 ][ 1 ]def node label use pred n m None l None if l is None or node label not in l raise Tgrep Exception u'node label {0 }notboundinpattern' format node label node l[node label]return n is node return node label use pred
null
null
null
null
Question: What does a predicate on a tree node describe ? Code: def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
What is representing a predicate on a tree node which describes the use of a previously bound node label ?
def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
a lambda function
codeqa
def tgrep node label pred use action s l tokens assert len tokens 1 assert tokens[ 0 ] startswith u' ' node label tokens[ 0 ][ 1 ]def node label use pred n m None l None if l is None or node label not in l raise Tgrep Exception u'node label {0 }notboundinpattern' format node label node l[node label]return n is node return node label use pred
null
null
null
null
Question: What is representing a predicate on a tree node which describes the use of a previously bound node label ? Code: def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
What describes the use of a previously bound node label ?
def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
a predicate on a tree node
codeqa
def tgrep node label pred use action s l tokens assert len tokens 1 assert tokens[ 0 ] startswith u' ' node label tokens[ 0 ][ 1 ]def node label use pred n m None l None if l is None or node label not in l raise Tgrep Exception u'node label {0 }notboundinpattern' format node label node l[node label]return n is node return node label use pred
null
null
null
null
Question: What describes the use of a previously bound node label ? Code: def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
When did node label bind ?
def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
previously
codeqa
def tgrep node label pred use action s l tokens assert len tokens 1 assert tokens[ 0 ] startswith u' ' node label tokens[ 0 ][ 1 ]def node label use pred n m None l None if l is None or node label not in l raise Tgrep Exception u'node label {0 }notboundinpattern' format node label node l[node label]return n is node return node label use pred
null
null
null
null
Question: When did node label bind ? Code: def _tgrep_node_label_pred_use_action(_s, _l, tokens): assert (len(tokens) == 1) assert tokens[0].startswith(u'=') node_label = tokens[0][1:] def node_label_use_pred(n, m=None, l=None): if ((l is None) or (node_label not in l)): raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label)) node = l[node_label] return (n is node) return node_label_use_pred
null
null
null
What does the code get if it does not exist ?
def get_ipython_cache_dir(): xdgdir = get_xdg_cache_dir() if (xdgdir is None): return get_ipython_dir() ipdir = os.path.join(xdgdir, 'ipython') if ((not os.path.exists(ipdir)) and _writable_dir(xdgdir)): ensure_dir_exists(ipdir) elif (not _writable_dir(xdgdir)): return get_ipython_dir() return py3compat.cast_unicode(ipdir, fs_encoding)
null
null
null
the cache directory it is created
codeqa
def get ipython cache dir xdgdir get xdg cache dir if xdgdir is None return get ipython dir ipdir os path join xdgdir 'ipython' if not os path exists ipdir and writable dir xdgdir ensure dir exists ipdir elif not writable dir xdgdir return get ipython dir return py 3 compat cast unicode ipdir fs encoding
null
null
null
null
Question: What does the code get if it does not exist ? Code: def get_ipython_cache_dir(): xdgdir = get_xdg_cache_dir() if (xdgdir is None): return get_ipython_dir() ipdir = os.path.join(xdgdir, 'ipython') if ((not os.path.exists(ipdir)) and _writable_dir(xdgdir)): ensure_dir_exists(ipdir) elif (not _writable_dir(xdgdir)): return get_ipython_dir() return py3compat.cast_unicode(ipdir, fs_encoding)
null
null
null
What does the code get ?
def getInsetSeparateLoopsFromLoops(loops, radius, thresholdRatio=0.9): if (radius == 0.0): return loops isInset = (radius > 0) insetSeparateLoops = [] arounds = getAroundsFromLoops(loops, abs(radius), thresholdRatio) for around in arounds: if (isInset == euclidean.getIsInFilledRegion(loops, around[0])): if isInset: around.reverse() insetSeparateLoops.append(around) return insetSeparateLoops
null
null
null
the separate inset loops
codeqa
def get Inset Separate Loops From Loops loops radius threshold Ratio 0 9 if radius 0 0 return loopsis Inset radius > 0 inset Separate Loops []arounds get Arounds From Loops loops abs radius threshold Ratio for around in arounds if is Inset euclidean get Is In Filled Region loops around[ 0 ] if is Inset around reverse inset Separate Loops append around return inset Separate Loops
null
null
null
null
Question: What does the code get ? Code: def getInsetSeparateLoopsFromLoops(loops, radius, thresholdRatio=0.9): if (radius == 0.0): return loops isInset = (radius > 0) insetSeparateLoops = [] arounds = getAroundsFromLoops(loops, abs(radius), thresholdRatio) for around in arounds: if (isInset == euclidean.getIsInFilledRegion(loops, around[0])): if isInset: around.reverse() insetSeparateLoops.append(around) return insetSeparateLoops
null
null
null
What do a string represent ?
def is_valid_vpnv4_prefix(prefix): if (not isinstance(prefix, str)): return False tokens = prefix.split(':', 2) if (len(tokens) != 3): return False if (not is_valid_route_dist(':'.join([tokens[0], tokens[1]]))): return False return is_valid_ipv4_prefix(tokens[2])
null
null
null
vpnv4 prefix
codeqa
def is valid vpnv 4 prefix prefix if not isinstance prefix str return Falsetokens prefix split ' ' 2 if len tokens 3 return Falseif not is valid route dist ' ' join [tokens[ 0 ] tokens[ 1 ]] return Falsereturn is valid ipv 4 prefix tokens[ 2 ]
null
null
null
null
Question: What do a string represent ? Code: def is_valid_vpnv4_prefix(prefix): if (not isinstance(prefix, str)): return False tokens = prefix.split(':', 2) if (len(tokens) != 3): return False if (not is_valid_route_dist(':'.join([tokens[0], tokens[1]]))): return False return is_valid_ipv4_prefix(tokens[2])
null
null
null
What represents vpnv4 prefix ?
def is_valid_vpnv4_prefix(prefix): if (not isinstance(prefix, str)): return False tokens = prefix.split(':', 2) if (len(tokens) != 3): return False if (not is_valid_route_dist(':'.join([tokens[0], tokens[1]]))): return False return is_valid_ipv4_prefix(tokens[2])
null
null
null
a string
codeqa
def is valid vpnv 4 prefix prefix if not isinstance prefix str return Falsetokens prefix split ' ' 2 if len tokens 3 return Falseif not is valid route dist ' ' join [tokens[ 0 ] tokens[ 1 ]] return Falsereturn is valid ipv 4 prefix tokens[ 2 ]
null
null
null
null
Question: What represents vpnv4 prefix ? Code: def is_valid_vpnv4_prefix(prefix): if (not isinstance(prefix, str)): return False tokens = prefix.split(':', 2) if (len(tokens) != 3): return False if (not is_valid_route_dist(':'.join([tokens[0], tokens[1]]))): return False return is_valid_ipv4_prefix(tokens[2])
null
null
null
Is this function needed outside this utils module ?
def _import_mpl(): try: import matplotlib.pyplot as plt except: raise ImportError('Matplotlib is not found.') return plt
null
null
null
No
codeqa
def import mpl try import matplotlib pyplot as pltexcept raise Import Error ' Matplotlibisnotfound ' return plt
null
null
null
null
Question: Is this function needed outside this utils module ? Code: def _import_mpl(): try: import matplotlib.pyplot as plt except: raise ImportError('Matplotlib is not found.') return plt
null
null
null
Where is this function not needed ?
def _import_mpl(): try: import matplotlib.pyplot as plt except: raise ImportError('Matplotlib is not found.') return plt
null
null
null
outside this utils module
codeqa
def import mpl try import matplotlib pyplot as pltexcept raise Import Error ' Matplotlibisnotfound ' return plt
null
null
null
null
Question: Where is this function not needed ? Code: def _import_mpl(): try: import matplotlib.pyplot as plt except: raise ImportError('Matplotlib is not found.') return plt
null
null
null
What did the code set to * s * default override ?
def xlabel(s, *args, **kwargs): l = gca().set_xlabel(s, *args, **kwargs) draw_if_interactive() return l
null
null
null
the * x * axis label of the current axis
codeqa
def xlabel s *args **kwargs l gca set xlabel s *args **kwargs draw if interactive return l
null
null
null
null
Question: What did the code set to * s * default override ? Code: def xlabel(s, *args, **kwargs): l = gca().set_xlabel(s, *args, **kwargs) draw_if_interactive() return l
null
null
null
What do we have ?
def _check_for_missing_and_disallowed_fields(document, entries, fields): (missing_fields, disallowed_fields) = ([], []) for (field, in_votes, in_consensus, mandatory) in fields: if (mandatory and ((document.is_consensus and in_consensus) or (document.is_vote and in_votes))): if (field not in entries.keys()): missing_fields.append(field) elif ((document.is_consensus and (not in_consensus)) or (document.is_vote and (not in_votes))): if (field in entries.keys()): disallowed_fields.append(field) if missing_fields: raise ValueError(('Network status document is missing mandatory field: %s' % ', '.join(missing_fields))) if disallowed_fields: raise ValueError(("Network status document has fields that shouldn't appear in this document type or version: %s" % ', '.join(disallowed_fields)))
null
null
null
mandatory fields for our type
codeqa
def check for missing and disallowed fields document entries fields missing fields disallowed fields [] [] for field in votes in consensus mandatory in fields if mandatory and document is consensus and in consensus or document is vote and in votes if field not in entries keys missing fields append field elif document is consensus and not in consensus or document is vote and not in votes if field in entries keys disallowed fields append field if missing fields raise Value Error ' Networkstatusdocumentismissingmandatoryfield %s' % ' ' join missing fields if disallowed fields raise Value Error " Networkstatusdocumenthasfieldsthatshouldn'tappearinthisdocumenttypeorversion %s" % ' ' join disallowed fields
null
null
null
null
Question: What do we have ? Code: def _check_for_missing_and_disallowed_fields(document, entries, fields): (missing_fields, disallowed_fields) = ([], []) for (field, in_votes, in_consensus, mandatory) in fields: if (mandatory and ((document.is_consensus and in_consensus) or (document.is_vote and in_votes))): if (field not in entries.keys()): missing_fields.append(field) elif ((document.is_consensus and (not in_consensus)) or (document.is_vote and (not in_votes))): if (field in entries.keys()): disallowed_fields.append(field) if missing_fields: raise ValueError(('Network status document is missing mandatory field: %s' % ', '.join(missing_fields))) if disallowed_fields: raise ValueError(("Network status document has fields that shouldn't appear in this document type or version: %s" % ', '.join(disallowed_fields)))
null
null
null
When do decorator turn tracing ?
def no_tracing(func): if (not hasattr(sys, 'gettrace')): return func else: def wrapper(*args, **kwargs): original_trace = sys.gettrace() try: sys.settrace(None) return func(*args, **kwargs) finally: sys.settrace(original_trace) wrapper.__name__ = func.__name__ return wrapper
null
null
null
temporarily
codeqa
def no tracing func if not hasattr sys 'gettrace' return funcelse def wrapper *args **kwargs original trace sys gettrace try sys settrace None return func *args **kwargs finally sys settrace original trace wrapper name func name return wrapper
null
null
null
null
Question: When do decorator turn tracing ? Code: def no_tracing(func): if (not hasattr(sys, 'gettrace')): return func else: def wrapper(*args, **kwargs): original_trace = sys.gettrace() try: sys.settrace(None) return func(*args, **kwargs) finally: sys.settrace(original_trace) wrapper.__name__ = func.__name__ return wrapper
null
null
null
What did the code set ?
def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): f = (_Cfunctions.get('libvlc_video_set_aspect_ratio', None) or _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,)), None, None, MediaPlayer, ctypes.c_char_p)) return f(p_mi, psz_aspect)
null
null
null
new video aspect ratio
codeqa
def libvlc video set aspect ratio p mi psz aspect f Cfunctions get 'libvlc video set aspect ratio' None or Cfunction 'libvlc video set aspect ratio' 1 1 None None Media Player ctypes c char p return f p mi psz aspect
null
null
null
null
Question: What did the code set ? Code: def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): f = (_Cfunctions.get('libvlc_video_set_aspect_ratio', None) or _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,)), None, None, MediaPlayer, ctypes.c_char_p)) return f(p_mi, psz_aspect)
null
null
null
What did the code expect over threshold ?
def EI_empirical(samples, thresh): improvement = np.maximum((samples - thresh), 0) return improvement.mean()
null
null
null
improvement
codeqa
def EI empirical samples thresh improvement np maximum samples - thresh 0 return improvement mean
null
null
null
null
Question: What did the code expect over threshold ? Code: def EI_empirical(samples, thresh): improvement = np.maximum((samples - thresh), 0) return improvement.mean()
null
null
null
Where did the code expect improvement ?
def EI_empirical(samples, thresh): improvement = np.maximum((samples - thresh), 0) return improvement.mean()
null
null
null
over threshold
codeqa
def EI empirical samples thresh improvement np maximum samples - thresh 0 return improvement mean
null
null
null
null
Question: Where did the code expect improvement ? Code: def EI_empirical(samples, thresh): improvement = np.maximum((samples - thresh), 0) return improvement.mean()
null
null
null
What does the code take ?
def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
a string and a dictionary
codeqa
def reparam string dictionary dictionary dictionary copy vals []result []for live chunk in interpolate string if live v eval chunk dictionary result append sqlquote v else result append chunk return SQL Query join result ''
null
null
null
null
Question: What does the code take ? Code: def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
How does the code interpolate the string ?
def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
using values from the dictionary
codeqa
def reparam string dictionary dictionary dictionary copy vals []result []for live chunk in interpolate string if live v eval chunk dictionary result append sqlquote v else result append chunk return SQL Query join result ''
null
null
null
null
Question: How does the code interpolate the string ? Code: def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
What does the code use ?
def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
values from the dictionary
codeqa
def reparam string dictionary dictionary dictionary copy vals []result []for live chunk in interpolate string if live v eval chunk dictionary result append sqlquote v else result append chunk return SQL Query join result ''
null
null
null
null
Question: What does the code use ? Code: def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
What does the code interpolate using values from the dictionary ?
def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
the string
codeqa
def reparam string dictionary dictionary dictionary copy vals []result []for live chunk in interpolate string if live v eval chunk dictionary result append sqlquote v else result append chunk return SQL Query join result ''
null
null
null
null
Question: What does the code interpolate using values from the dictionary ? Code: def reparam(string_, dictionary): dictionary = dictionary.copy() vals = [] result = [] for (live, chunk) in _interpolate(string_): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) else: result.append(chunk) return SQLQuery.join(result, '')
null
null
null
What does generic step enhance without performing any check ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
the readability / understanding
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: What does generic step enhance without performing any check ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
What enhances the readability / understanding without performing any check ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
generic step
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: What enhances the readability / understanding without performing any check ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
How does generic step enhance the readability / understanding ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
without performing any check
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: How does generic step enhance the readability / understanding ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
How does generic step provide an additional remark / hint ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
without performing any check
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: How does generic step provide an additional remark / hint ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
What does generic step provide without performing any check ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
an additional remark / hint
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: What does generic step provide without performing any check ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
What provides an additional remark / hint without performing any check ?
@step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
generic step
codeqa
@step u'notethat"{remark}"' def step note that context remark log getattr context 'log' None if log log info u'NOTE %s ' % remark
null
null
null
null
Question: What provides an additional remark / hint without performing any check ? Code: @step(u'note that "{remark}"') def step_note_that(context, remark): log = getattr(context, 'log', None) if log: log.info((u'NOTE: %s;' % remark))
null
null
null
What does the code get ?
def getNewRepository(): return GcodeTimeSegmentRepository()
null
null
null
the repository constructor
codeqa
def get New Repository return Gcode Time Segment Repository
null
null
null
null
Question: What does the code get ? Code: def getNewRepository(): return GcodeTimeSegmentRepository()
null
null
null
What did the code read ?
def _read_uint32(f): return np.uint32(struct.unpack('>I', f.read(4))[0])
null
null
null
an unsigned 32-bit integer
codeqa
def read uint 32 f return np uint 32 struct unpack '>I' f read 4 [0 ]
null
null
null
null
Question: What did the code read ? Code: def _read_uint32(f): return np.uint32(struct.unpack('>I', f.read(4))[0])
null
null
null
What did the code give ?
def get_entry_point(system_tags, entry_points=ENTRY_POINTS): entry_points = entry_points.keys() for tag in system_tags: if (tag in entry_points): return tag else: return 'osf'
null
null
null
the user system_tags
codeqa
def get entry point system tags entry points ENTRY POINTS entry points entry points keys for tag in system tags if tag in entry points return tagelse return 'osf'
null
null
null
null
Question: What did the code give ? Code: def get_entry_point(system_tags, entry_points=ENTRY_POINTS): entry_points = entry_points.keys() for tag in system_tags: if (tag in entry_points): return tag else: return 'osf'
null
null
null
What does the code load ?
def load(s): clauses = [] lines = s.split('\n') pComment = re.compile('c.*') pStats = re.compile('p\\s*cnf\\s*(\\d*)\\s*(\\d*)') while (len(lines) > 0): line = lines.pop(0) if (not pComment.match(line)): m = pStats.match(line) if (not m): nums = line.rstrip('\n').split(' ') list = [] for lit in nums: if (lit != ''): if (int(lit) == 0): continue num = abs(int(lit)) sign = True if (int(lit) < 0): sign = False if sign: list.append(Symbol(('cnf_%s' % num))) else: list.append((~ Symbol(('cnf_%s' % num)))) if (len(list) > 0): clauses.append(Or(*list)) return And(*clauses)
null
null
null
a boolean expression from a string
codeqa
def load s clauses []lines s split '\n' p Comment re compile 'c *' p Stats re compile 'p\\s*cnf\\s* \\d* \\s* \\d* ' while len lines > 0 line lines pop 0 if not p Comment match line m p Stats match line if not m nums line rstrip '\n' split '' list []for lit in nums if lit '' if int lit 0 continuenum abs int lit sign Trueif int lit < 0 sign Falseif sign list append Symbol 'cnf %s' % num else list append ~ Symbol 'cnf %s' % num if len list > 0 clauses append Or *list return And *clauses
null
null
null
null
Question: What does the code load ? Code: def load(s): clauses = [] lines = s.split('\n') pComment = re.compile('c.*') pStats = re.compile('p\\s*cnf\\s*(\\d*)\\s*(\\d*)') while (len(lines) > 0): line = lines.pop(0) if (not pComment.match(line)): m = pStats.match(line) if (not m): nums = line.rstrip('\n').split(' ') list = [] for lit in nums: if (lit != ''): if (int(lit) == 0): continue num = abs(int(lit)) sign = True if (int(lit) < 0): sign = False if sign: list.append(Symbol(('cnf_%s' % num))) else: list.append((~ Symbol(('cnf_%s' % num)))) if (len(list) > 0): clauses.append(Or(*list)) return And(*clauses)
null
null
null
What is using the newton - cg method ?
def fmin_ncg(f, x0, fprime, fhess_p=None, fhess=None, args=(), avextol=1e-05, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, callback=None): opts = {'xtol': avextol, 'eps': epsilon, 'maxiter': maxiter, 'disp': disp, 'return_all': retall} res = _minimize_newtoncg(f, x0, args, fprime, fhess, fhess_p, callback=callback, **opts) if full_output: retlist = (res['x'], res['fun'], res['nfev'], res['njev'], res['nhev'], res['status']) if retall: retlist += (res['allvecs'],) return retlist elif retall: return (res['x'], res['allvecs']) else: return res['x']
null
null
null
a function
codeqa
def fmin ncg f x0 fprime fhess p None fhess None args avextol 1e- 05 epsilon epsilon maxiter None full output 0 disp 1 retall 0 callback None opts {'xtol' avextol 'eps' epsilon 'maxiter' maxiter 'disp' disp 'return all' retall}res minimize newtoncg f x0 args fprime fhess fhess p callback callback **opts if full output retlist res['x'] res['fun'] res['nfev'] res['njev'] res['nhev'] res['status'] if retall retlist + res['allvecs'] return retlistelif retall return res['x'] res['allvecs'] else return res['x']
null
null
null
null
Question: What is using the newton - cg method ? Code: def fmin_ncg(f, x0, fprime, fhess_p=None, fhess=None, args=(), avextol=1e-05, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, callback=None): opts = {'xtol': avextol, 'eps': epsilon, 'maxiter': maxiter, 'disp': disp, 'return_all': retall} res = _minimize_newtoncg(f, x0, args, fprime, fhess, fhess_p, callback=callback, **opts) if full_output: retlist = (res['x'], res['fun'], res['nfev'], res['njev'], res['nhev'], res['status']) if retall: retlist += (res['allvecs'],) return retlist elif retall: return (res['x'], res['allvecs']) else: return res['x']
null
null
null
What does the code close ?
def _eventlet_stop(client, server, conn): try: try: client.wait() finally: conn.close() except greenlet.GreenletExit: pass except Exception: greenthread.kill(server, *sys.exc_info())
null
null
null
its connection
codeqa
def eventlet stop client server conn try try client wait finally conn close except greenlet Greenlet Exit passexcept Exception greenthread kill server *sys exc info
null
null
null
null
Question: What does the code close ? Code: def _eventlet_stop(client, server, conn): try: try: client.wait() finally: conn.close() except greenlet.GreenletExit: pass except Exception: greenthread.kill(server, *sys.exc_info())
null
null
null
What do phrases like separate ?
def feat_tokens(for_artist=True): feat_words = ['ft', 'featuring', 'feat', 'feat.', 'ft.'] if for_artist: feat_words += ['with', 'vs', 'and', 'con', '&'] return '(?<=\\s)(?:{0})(?=\\s)'.format('|'.join((re.escape(x) for x in feat_words)))
null
null
null
a main artist or a song title
codeqa
def feat tokens for artist True feat words ['ft' 'featuring' 'feat' 'feat ' 'ft ']if for artist feat words + ['with' 'vs' 'and' 'con' '&']return ' ?< \\s ? {0 } ? \\s ' format ' ' join re escape x for x in feat words
null
null
null
null
Question: What do phrases like separate ? Code: def feat_tokens(for_artist=True): feat_words = ['ft', 'featuring', 'feat', 'feat.', 'ft.'] if for_artist: feat_words += ['with', 'vs', 'and', 'con', '&'] return '(?<=\\s)(?:{0})(?=\\s)'.format('|'.join((re.escape(x) for x in feat_words)))
null
null
null
What separate a main artist or a song title ?
def feat_tokens(for_artist=True): feat_words = ['ft', 'featuring', 'feat', 'feat.', 'ft.'] if for_artist: feat_words += ['with', 'vs', 'and', 'con', '&'] return '(?<=\\s)(?:{0})(?=\\s)'.format('|'.join((re.escape(x) for x in feat_words)))
null
null
null
phrases like
codeqa
def feat tokens for artist True feat words ['ft' 'featuring' 'feat' 'feat ' 'ft ']if for artist feat words + ['with' 'vs' 'and' 'con' '&']return ' ?< \\s ? {0 } ? \\s ' format ' ' join re escape x for x in feat words
null
null
null
null
Question: What separate a main artist or a song title ? Code: def feat_tokens(for_artist=True): feat_words = ['ft', 'featuring', 'feat', 'feat.', 'ft.'] if for_artist: feat_words += ['with', 'vs', 'and', 'con', '&'] return '(?<=\\s)(?:{0})(?=\\s)'.format('|'.join((re.escape(x) for x in feat_words)))
null
null
null
For what purpose do the class object return ?
def get_check_class(agentConfig, check_name): from config import get_os, get_checks_places, get_valid_check_class osname = get_os() checks_places = get_checks_places(osname, agentConfig) for check_path_builder in checks_places: check_path = check_path_builder(check_name) if (not os.path.exists(check_path)): continue (check_is_valid, check_class, load_failure) = get_valid_check_class(check_name, check_path) if check_is_valid: return check_class log.warning(('Failed to load the check class for %s.' % check_name)) return None
null
null
null
for a given check name
codeqa
def get check class agent Config check name from config import get os get checks places get valid check classosname get os checks places get checks places osname agent Config for check path builder in checks places check path check path builder check name if not os path exists check path continue check is valid check class load failure get valid check class check name check path if check is valid return check classlog warning ' Failedtoloadthecheckclassfor%s ' % check name return None
null
null
null
null
Question: For what purpose do the class object return ? Code: def get_check_class(agentConfig, check_name): from config import get_os, get_checks_places, get_valid_check_class osname = get_os() checks_places = get_checks_places(osname, agentConfig) for check_path_builder in checks_places: check_path = check_path_builder(check_name) if (not os.path.exists(check_path)): continue (check_is_valid, check_class, load_failure) = get_valid_check_class(check_name, check_path) if check_is_valid: return check_class log.warning(('Failed to load the check class for %s.' % check_name)) return None
null
null
null
How did task schedule ?
def collect_error_snapshots(): if frappe.conf.disable_error_snapshot: return try: path = get_error_snapshot_path() if (not os.path.exists(path)): return for fname in os.listdir(path): fullpath = os.path.join(path, fname) try: with open(fullpath, u'rb') as filedata: data = json.load(filedata) except ValueError: os.remove(fullpath) continue for field in [u'locals', u'exception', u'frames']: data[field] = frappe.as_json(data[field]) doc = frappe.new_doc(u'Error Snapshot') doc.update(data) doc.save() frappe.db.commit() os.remove(fullpath) clear_old_snapshots() except Exception as e: make_error_snapshot(e) raise
null
null
null
code
codeqa
def collect error snapshots if frappe conf disable error snapshot returntry path get error snapshot path if not os path exists path returnfor fname in os listdir path fullpath os path join path fname try with open fullpath u'rb' as filedata data json load filedata except Value Error os remove fullpath continuefor field in [u'locals' u'exception' u'frames'] data[field] frappe as json data[field] doc frappe new doc u' Error Snapshot' doc update data doc save frappe db commit os remove fullpath clear old snapshots except Exception as e make error snapshot e raise
null
null
null
null
Question: How did task schedule ? Code: def collect_error_snapshots(): if frappe.conf.disable_error_snapshot: return try: path = get_error_snapshot_path() if (not os.path.exists(path)): return for fname in os.listdir(path): fullpath = os.path.join(path, fname) try: with open(fullpath, u'rb') as filedata: data = json.load(filedata) except ValueError: os.remove(fullpath) continue for field in [u'locals', u'exception', u'frames']: data[field] = frappe.as_json(data[field]) doc = frappe.new_doc(u'Error Snapshot') doc.update(data) doc.save() frappe.db.commit() os.remove(fullpath) clear_old_snapshots() except Exception as e: make_error_snapshot(e) raise
null
null
null
What does the code make ?
def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
a tracking function that logs what happened
codeqa
def make track function request import track viewsdef function event type event return track views server track request event type event page 'x module' return function
null
null
null
null
Question: What does the code make ? Code: def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
What logs what happened ?
def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
a tracking function
codeqa
def make track function request import track viewsdef function event type event return track views server track request event type event page 'x module' return function
null
null
null
null
Question: What logs what happened ? Code: def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
What does a tracking function log ?
def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
what happened
codeqa
def make track function request import track viewsdef function event type event return track views server track request event type event page 'x module' return function
null
null
null
null
Question: What does a tracking function log ? Code: def make_track_function(request): import track.views def function(event_type, event): return track.views.server_track(request, event_type, event, page='x_module') return function
null
null
null
What does the code generate ?
def generate_dataset_shelve(filename, number_items=1000): if os.path.exists(filename): os.remove(filename) data = shelve.open(filename) names = get_names() totalnames = len(names) random.seed() for i in range(number_items): data[str((i + 1))] = {'name': names[random.randint(0, (totalnames - 1))], 'age': random.randint(1, 100), 'description': li_words(50, False)} data.close()
null
null
null
a dataset with number_items elements
codeqa
def generate dataset shelve filename number items 1000 if os path exists filename os remove filename data shelve open filename names get names totalnames len names random seed for i in range number items data[str i + 1 ] {'name' names[random randint 0 totalnames - 1 ] 'age' random randint 1 100 'description' li words 50 False }data close
null
null
null
null
Question: What does the code generate ? Code: def generate_dataset_shelve(filename, number_items=1000): if os.path.exists(filename): os.remove(filename) data = shelve.open(filename) names = get_names() totalnames = len(names) random.seed() for i in range(number_items): data[str((i + 1))] = {'name': names[random.randint(0, (totalnames - 1))], 'age': random.randint(1, 100), 'description': li_words(50, False)} data.close()
null
null
null
What does the code return to the given function ?
def _getargs(func): import types if (sys.version_info >= (3, 0)): if isinstance(func, types.MethodType): func = func.__func__ co = func.__code__ else: if isinstance(func, types.MethodType): func = func.im_func co = func.func_code return co.co_varnames[:co.co_argcount]
null
null
null
the names of all static arguments
codeqa
def getargs func import typesif sys version info > 3 0 if isinstance func types Method Type func func func co func code else if isinstance func types Method Type func func im funcco func func codereturn co co varnames[ co co argcount]
null
null
null
null
Question: What does the code return to the given function ? Code: def _getargs(func): import types if (sys.version_info >= (3, 0)): if isinstance(func, types.MethodType): func = func.__func__ co = func.__code__ else: if isinstance(func, types.MethodType): func = func.im_func co = func.func_code return co.co_varnames[:co.co_argcount]
null
null
null
What does the code generate ?
def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
a series of times that exceeds the given timeout
codeqa
def generate timeout series timeout iteration 0while True iteration + 1 yield iteration * timeout + iteration
null
null
null
null
Question: What does the code generate ? Code: def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
What does a series exceed ?
def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
the given timeout
codeqa
def generate timeout series timeout iteration 0while True iteration + 1 yield iteration * timeout + iteration
null
null
null
null
Question: What does a series exceed ? Code: def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
What exceeds the given timeout ?
def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
a series
codeqa
def generate timeout series timeout iteration 0while True iteration + 1 yield iteration * timeout + iteration
null
null
null
null
Question: What exceeds the given timeout ? Code: def generate_timeout_series(timeout): iteration = 0 while True: iteration += 1 (yield ((iteration * timeout) + iteration))
null
null
null
What does the code send ?
def endjob(filename, cat, status, path, bytes, fail_msg, stages, script, script_output, script_ret, test=None): tr = sabnzbd.api.Ttemplate if ((not status) and fail_msg): xstages = {tr('stage-fail'): (fail_msg,)} else: xstages = {} for stage in stages: lines = [] for line in stages[stage]: if (('\n' in line) or ('<br/>' in line)): lines.extend(line.replace('<br/>', '\n').split('\n')) else: lines.append(line) xstages[tr(('stage-' + stage.lower()))] = lines parm = {} parm['status'] = status parm['name'] = filename parm['path'] = path parm['msgid'] = '' parm['stages'] = xstages parm['script'] = script parm['script_output'] = script_output parm['script_ret'] = script_ret parm['cat'] = cat parm['size'] = ('%sB' % to_units(bytes)) parm['end_time'] = time.strftime(time_format('%Y-%m-%d %H:%M:%S'), time.localtime(time.time())).decode(codepage) return send_with_template('email', parm, test)
null
null
null
end - of - job email
codeqa
def endjob filename cat status path bytes fail msg stages script script output script ret test None tr sabnzbd api Ttemplateif not status and fail msg xstages {tr 'stage-fail' fail msg }else xstages {}for stage in stages lines []for line in stages[stage] if '\n' in line or '<br/>' in line lines extend line replace '<br/>' '\n' split '\n' else lines append line xstages[tr 'stage-' + stage lower ] linesparm {}parm['status'] statusparm['name'] filenameparm['path'] pathparm['msgid'] ''parm['stages'] xstagesparm['script'] scriptparm['script output'] script outputparm['script ret'] script retparm['cat'] catparm['size'] '%s B' % to units bytes parm['end time'] time strftime time format '%Y-%m-%d%H %M %S' time localtime time time decode codepage return send with template 'email' parm test
null
null
null
null
Question: What does the code send ? Code: def endjob(filename, cat, status, path, bytes, fail_msg, stages, script, script_output, script_ret, test=None): tr = sabnzbd.api.Ttemplate if ((not status) and fail_msg): xstages = {tr('stage-fail'): (fail_msg,)} else: xstages = {} for stage in stages: lines = [] for line in stages[stage]: if (('\n' in line) or ('<br/>' in line)): lines.extend(line.replace('<br/>', '\n').split('\n')) else: lines.append(line) xstages[tr(('stage-' + stage.lower()))] = lines parm = {} parm['status'] = status parm['name'] = filename parm['path'] = path parm['msgid'] = '' parm['stages'] = xstages parm['script'] = script parm['script_output'] = script_output parm['script_ret'] = script_ret parm['cat'] = cat parm['size'] = ('%sB' % to_units(bytes)) parm['end_time'] = time.strftime(time_format('%Y-%m-%d %H:%M:%S'), time.localtime(time.time())).decode(codepage) return send_with_template('email', parm, test)
null
null
null
What does the code calculate ?
def std_cdf(x): return (0.5 + (0.5 * tt.erf((x / tt.sqrt(2.0)))))
null
null
null
the standard normal cumulative distribution function
codeqa
def std cdf x return 0 5 + 0 5 * tt erf x / tt sqrt 2 0
null
null
null
null
Question: What does the code calculate ? Code: def std_cdf(x): return (0.5 + (0.5 * tt.erf((x / tt.sqrt(2.0)))))
null
null
null
Where do the traceback message return ?
def load_pklz_traceback(crash_filepath): try: data = loadcrash(crash_filepath) except TraitError as te: return str(te) except: raise else: return '\n'.join(data['traceback'])
null
null
null
in the given crash file
codeqa
def load pklz traceback crash filepath try data loadcrash crash filepath except Trait Error as te return str te except raiseelse return '\n' join data['traceback']
null
null
null
null
Question: Where do the traceback message return ? Code: def load_pklz_traceback(crash_filepath): try: data = loadcrash(crash_filepath) except TraitError as te: return str(te) except: raise else: return '\n'.join(data['traceback'])
null
null
null
How did the code set price list ?
def _set_price_list(quotation, cart_settings): if quotation.selling_price_list: return selling_price_list = None if quotation.customer: from erpnext.accounts.party import get_default_price_list selling_price_list = get_default_price_list(frappe.get_doc(u'Customer', quotation.customer)) if (not selling_price_list): selling_price_list = cart_settings.price_list quotation.selling_price_list = selling_price_list
null
null
null
based on customer or shopping cart default
codeqa
def set price list quotation cart settings if quotation selling price list returnselling price list Noneif quotation customer from erpnext accounts party import get default price listselling price list get default price list frappe get doc u' Customer' quotation customer if not selling price list selling price list cart settings price listquotation selling price list selling price list
null
null
null
null
Question: How did the code set price list ? Code: def _set_price_list(quotation, cart_settings): if quotation.selling_price_list: return selling_price_list = None if quotation.customer: from erpnext.accounts.party import get_default_price_list selling_price_list = get_default_price_list(frappe.get_doc(u'Customer', quotation.customer)) if (not selling_price_list): selling_price_list = cart_settings.price_list quotation.selling_price_list = selling_price_list
null
null
null
What did the code set based on customer or shopping cart default ?
def _set_price_list(quotation, cart_settings): if quotation.selling_price_list: return selling_price_list = None if quotation.customer: from erpnext.accounts.party import get_default_price_list selling_price_list = get_default_price_list(frappe.get_doc(u'Customer', quotation.customer)) if (not selling_price_list): selling_price_list = cart_settings.price_list quotation.selling_price_list = selling_price_list
null
null
null
price list
codeqa
def set price list quotation cart settings if quotation selling price list returnselling price list Noneif quotation customer from erpnext accounts party import get default price listselling price list get default price list frappe get doc u' Customer' quotation customer if not selling price list selling price list cart settings price listquotation selling price list selling price list
null
null
null
null
Question: What did the code set based on customer or shopping cart default ? Code: def _set_price_list(quotation, cart_settings): if quotation.selling_price_list: return selling_price_list = None if quotation.customer: from erpnext.accounts.party import get_default_price_list selling_price_list = get_default_price_list(frappe.get_doc(u'Customer', quotation.customer)) if (not selling_price_list): selling_price_list = cart_settings.price_list quotation.selling_price_list = selling_price_list
null
null
null
What does the code get ?
def getNewRepository(): return skeinforge_polyfile.PolyfileRepository()
null
null
null
new repository
codeqa
def get New Repository return skeinforge polyfile Polyfile Repository
null
null
null
null
Question: What does the code get ? Code: def getNewRepository(): return skeinforge_polyfile.PolyfileRepository()
null
null
null
What does the code return ?
def last(value): try: return value[(-1)] except IndexError: return u''
null
null
null
the last item in a list
codeqa
def last value try return value[ -1 ]except Index Error return u''
null
null
null
null
Question: What does the code return ? Code: def last(value): try: return value[(-1)] except IndexError: return u''
null
null
null
What does the code return ?
def strip_spaces_and_quotes(value): value = (value.strip() if value else '') if (value and (len(value) > 1) and (value[0] == value[(-1)] == '"')): value = value[1:(-1)] if (not value): value = '' return value
null
null
null
none
codeqa
def strip spaces and quotes value value value strip if value else '' if value and len value > 1 and value[ 0 ] value[ -1 ] '"' value value[ 1 -1 ]if not value value ''return value
null
null
null
null
Question: What does the code return ? Code: def strip_spaces_and_quotes(value): value = (value.strip() if value else '') if (value and (len(value) > 1) and (value[0] == value[(-1)] == '"')): value = value[1:(-1)] if (not value): value = '' return value
null
null
null
How do if file is a zip file see ?
def is_zipfile(filename): try: fpin = open(filename, 'rb') endrec = _EndRecData(fpin) fpin.close() if endrec: return True except IOError: pass return False
null
null
null
quickly
codeqa
def is zipfile filename try fpin open filename 'rb' endrec End Rec Data fpin fpin close if endrec return Trueexcept IO Error passreturn False
null
null
null
null
Question: How do if file is a zip file see ? Code: def is_zipfile(filename): try: fpin = open(filename, 'rb') endrec = _EndRecData(fpin) fpin.close() if endrec: return True except IOError: pass return False
null
null
null
What does the code read ?
def get_inventory(enterprise, config): if cache_available(config): inv = get_cache('inventory', config) else: default_group = os.path.basename(sys.argv[0]).rstrip('.py') inv = generate_inv_from_api(enterprise, config) save_cache(inv, config) return json.dumps(inv)
null
null
null
the inventory
codeqa
def get inventory enterprise config if cache available config inv get cache 'inventory' config else default group os path basename sys argv[ 0 ] rstrip ' py' inv generate inv from api enterprise config save cache inv config return json dumps inv
null
null
null
null
Question: What does the code read ? Code: def get_inventory(enterprise, config): if cache_available(config): inv = get_cache('inventory', config) else: default_group = os.path.basename(sys.argv[0]).rstrip('.py') inv = generate_inv_from_api(enterprise, config) save_cache(inv, config) return json.dumps(inv)
null
null
null
What is joining the accepted matches input ?
def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
lines
codeqa
def plot matches im 1 im 2 locs 1 locs 2 matchscores show below True im 3 appendimages im 1 im 2 if show below im 3 vstack im 3 im 3 imshow im 3 cols 1 im 1 shape[ 1 ]for i m in enumerate matchscores if m > 0 plot [locs 1 [i][ 1 ] locs 2 [m][ 1 ] + cols 1 ] [locs 1 [i][ 0 ] locs 2 [m][ 0 ]] 'c' axis 'off'
null
null
null
null
Question: What is joining the accepted matches input ? Code: def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
What does the code show ?
def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
a figure with lines joining the accepted matches input
codeqa
def plot matches im 1 im 2 locs 1 locs 2 matchscores show below True im 3 appendimages im 1 im 2 if show below im 3 vstack im 3 im 3 imshow im 3 cols 1 im 1 shape[ 1 ]for i m in enumerate matchscores if m > 0 plot [locs 1 [i][ 1 ] locs 2 [m][ 1 ] + cols 1 ] [locs 1 [i][ 0 ] locs 2 [m][ 0 ]] 'c' axis 'off'
null
null
null
null
Question: What does the code show ? Code: def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
What do lines join ?
def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
the accepted matches input
codeqa
def plot matches im 1 im 2 locs 1 locs 2 matchscores show below True im 3 appendimages im 1 im 2 if show below im 3 vstack im 3 im 3 imshow im 3 cols 1 im 1 shape[ 1 ]for i m in enumerate matchscores if m > 0 plot [locs 1 [i][ 1 ] locs 2 [m][ 1 ] + cols 1 ] [locs 1 [i][ 0 ] locs 2 [m][ 0 ]] 'c' axis 'off'
null
null
null
null
Question: What do lines join ? Code: def plot_matches(im1, im2, locs1, locs2, matchscores, show_below=True): im3 = appendimages(im1, im2) if show_below: im3 = vstack((im3, im3)) imshow(im3) cols1 = im1.shape[1] for (i, m) in enumerate(matchscores): if (m > 0): plot([locs1[i][1], (locs2[m][1] + cols1)], [locs1[i][0], locs2[m][0]], 'c') axis('off')
null
null
null
What do we mark ?
def calculate_debounced_passing(recent_results, debounce=0): if (not recent_results): return True debounce_window = recent_results[:(debounce + 1)] for r in debounce_window: if r.succeeded: return True return False
null
null
null
a search
codeqa
def calculate debounced passing recent results debounce 0 if not recent results return Truedebounce window recent results[ debounce + 1 ]for r in debounce window if r succeeded return Truereturn False
null
null
null
null
Question: What do we mark ? Code: def calculate_debounced_passing(recent_results, debounce=0): if (not recent_results): return True debounce_window = recent_results[:(debounce + 1)] for r in debounce_window: if r.succeeded: return True return False
null
null
null
For what purpose do we need the number of previous failures ?
def calculate_debounced_passing(recent_results, debounce=0): if (not recent_results): return True debounce_window = recent_results[:(debounce + 1)] for r in debounce_window: if r.succeeded: return True return False
null
null
null
to mark a search as passing or failing returns
codeqa
def calculate debounced passing recent results debounce 0 if not recent results return Truedebounce window recent results[ debounce + 1 ]for r in debounce window if r succeeded return Truereturn False
null
null
null
null
Question: For what purpose do we need the number of previous failures ? Code: def calculate_debounced_passing(recent_results, debounce=0): if (not recent_results): return True debounce_window = recent_results[:(debounce + 1)] for r in debounce_window: if r.succeeded: return True return False
null
null
null
How does the code revoke a cert ?
def revoke_cert(project_id, file_name): try: utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke', file_name, cwd=ca_folder(project_id)) utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf', '-out', CONF.crypto.crl_file, cwd=ca_folder(project_id)) except OSError: raise exception.ProjectNotFound(project_id=project_id) except processutils.ProcessExecutionError: raise exception.RevokeCertFailure(project_id=project_id)
null
null
null
by file name
codeqa
def revoke cert project id file name try utils execute 'openssl' 'ca' '-config' ' /openssl cnf' '-revoke' file name cwd ca folder project id utils execute 'openssl' 'ca' '-gencrl' '-config' ' /openssl cnf' '-out' CONF crypto crl file cwd ca folder project id except OS Error raise exception Project Not Found project id project id except processutils Process Execution Error raise exception Revoke Cert Failure project id project id
null
null
null
null
Question: How does the code revoke a cert ? Code: def revoke_cert(project_id, file_name): try: utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke', file_name, cwd=ca_folder(project_id)) utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf', '-out', CONF.crypto.crl_file, cwd=ca_folder(project_id)) except OSError: raise exception.ProjectNotFound(project_id=project_id) except processutils.ProcessExecutionError: raise exception.RevokeCertFailure(project_id=project_id)
null
null
null
What does the code revoke by file name ?
def revoke_cert(project_id, file_name): try: utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke', file_name, cwd=ca_folder(project_id)) utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf', '-out', CONF.crypto.crl_file, cwd=ca_folder(project_id)) except OSError: raise exception.ProjectNotFound(project_id=project_id) except processutils.ProcessExecutionError: raise exception.RevokeCertFailure(project_id=project_id)
null
null
null
a cert
codeqa
def revoke cert project id file name try utils execute 'openssl' 'ca' '-config' ' /openssl cnf' '-revoke' file name cwd ca folder project id utils execute 'openssl' 'ca' '-gencrl' '-config' ' /openssl cnf' '-out' CONF crypto crl file cwd ca folder project id except OS Error raise exception Project Not Found project id project id except processutils Process Execution Error raise exception Revoke Cert Failure project id project id
null
null
null
null
Question: What does the code revoke by file name ? Code: def revoke_cert(project_id, file_name): try: utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke', file_name, cwd=ca_folder(project_id)) utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf', '-out', CONF.crypto.crl_file, cwd=ca_folder(project_id)) except OSError: raise exception.ProjectNotFound(project_id=project_id) except processutils.ProcessExecutionError: raise exception.RevokeCertFailure(project_id=project_id)
null
null
null
What does the code convert to k ?
def dmp_from_sympy(f, u, K): if (not u): return dup_from_sympy(f, K) v = (u - 1) return dmp_strip([dmp_from_sympy(c, v, K) for c in f], u)
null
null
null
the ground domain of f
codeqa
def dmp from sympy f u K if not u return dup from sympy f K v u - 1 return dmp strip [dmp from sympy c v K for c in f] u
null
null
null
null
Question: What does the code convert to k ? Code: def dmp_from_sympy(f, u, K): if (not u): return dup_from_sympy(f, K) v = (u - 1) return dmp_strip([dmp_from_sympy(c, v, K) for c in f], u)
null
null
null
What equal each other ?
def ifequal(parser, token): return do_ifequal(parser, token, False)
null
null
null
the two arguments
codeqa
def ifequal parser token return do ifequal parser token False
null
null
null
null
Question: What equal each other ? Code: def ifequal(parser, token): return do_ifequal(parser, token, False)
null
null
null
What do the two arguments equal ?
def ifequal(parser, token): return do_ifequal(parser, token, False)
null
null
null
each other
codeqa
def ifequal parser token return do ifequal parser token False
null
null
null
null
Question: What do the two arguments equal ? Code: def ifequal(parser, token): return do_ifequal(parser, token, False)
null
null
null
What can we load from fixtures ?
def _foreign_key_ignoring_handle(self, *fixture_labels, **options): using = options.get('database', DEFAULT_DB_ALIAS) commit = options.get('commit', True) connection = connections[using] if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 0') _old_handle(self, *fixture_labels, **options) if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 1')
null
null
null
circular references
codeqa
def foreign key ignoring handle self *fixture labels **options using options get 'database' DEFAULT DB ALIAS commit options get 'commit' True connection connections[using]if uses mysql connection cursor connection cursor cursor execute 'SE Tforeign key checks 0' old handle self *fixture labels **options if uses mysql connection cursor connection cursor cursor execute 'SE Tforeign key checks 1'
null
null
null
null
Question: What can we load from fixtures ? Code: def _foreign_key_ignoring_handle(self, *fixture_labels, **options): using = options.get('database', DEFAULT_DB_ALIAS) commit = options.get('commit', True) connection = connections[using] if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 0') _old_handle(self, *fixture_labels, **options) if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 1')
null
null
null
For what purpose do foreign key checks ignore ?
def _foreign_key_ignoring_handle(self, *fixture_labels, **options): using = options.get('database', DEFAULT_DB_ALIAS) commit = options.get('commit', True) connection = connections[using] if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 0') _old_handle(self, *fixture_labels, **options) if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 1')
null
null
null
so we can load circular references from fixtures
codeqa
def foreign key ignoring handle self *fixture labels **options using options get 'database' DEFAULT DB ALIAS commit options get 'commit' True connection connections[using]if uses mysql connection cursor connection cursor cursor execute 'SE Tforeign key checks 0' old handle self *fixture labels **options if uses mysql connection cursor connection cursor cursor execute 'SE Tforeign key checks 1'
null
null
null
null
Question: For what purpose do foreign key checks ignore ? Code: def _foreign_key_ignoring_handle(self, *fixture_labels, **options): using = options.get('database', DEFAULT_DB_ALIAS) commit = options.get('commit', True) connection = connections[using] if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 0') _old_handle(self, *fixture_labels, **options) if uses_mysql(connection): cursor = connection.cursor() cursor.execute('SET foreign_key_checks = 1')
null
null
null
What does the code compute ?
@docstring.dedent_interpd def magnitude_spectrum(x, Fs=None, window=None, pad_to=None, sides=None): return _single_spectrum_helper(x=x, Fs=Fs, window=window, pad_to=pad_to, sides=sides, mode=u'magnitude')
null
null
null
the magnitude of the frequency spectrum of * x *
codeqa
@docstring dedent interpddef magnitude spectrum x Fs None window None pad to None sides None return single spectrum helper x x Fs Fs window window pad to pad to sides sides mode u'magnitude'
null
null
null
null
Question: What does the code compute ? Code: @docstring.dedent_interpd def magnitude_spectrum(x, Fs=None, window=None, pad_to=None, sides=None): return _single_spectrum_helper(x=x, Fs=Fs, window=window, pad_to=pad_to, sides=sides, mode=u'magnitude')
null
null
null
What is converting to normal date format ?
def ole2datetime(oledt): val = float(oledt) if (val < 61): raise ValueError(('Value is outside of acceptable range: %s ' % val)) return (OLE_TIME_ZERO + timedelta(days=val))
null
null
null
excel date
codeqa
def ole 2 datetime oledt val float oledt if val < 61 raise Value Error ' Valueisoutsideofacceptablerange %s' % val return OLE TIME ZERO + timedelta days val
null
null
null
null
Question: What is converting to normal date format ? Code: def ole2datetime(oledt): val = float(oledt) if (val < 61): raise ValueError(('Value is outside of acceptable range: %s ' % val)) return (OLE_TIME_ZERO + timedelta(days=val))
null
null
null
What do excel date convert ?
def ole2datetime(oledt): val = float(oledt) if (val < 61): raise ValueError(('Value is outside of acceptable range: %s ' % val)) return (OLE_TIME_ZERO + timedelta(days=val))
null
null
null
to normal date format
codeqa
def ole 2 datetime oledt val float oledt if val < 61 raise Value Error ' Valueisoutsideofacceptablerange %s' % val return OLE TIME ZERO + timedelta days val
null
null
null
null
Question: What do excel date convert ? Code: def ole2datetime(oledt): val = float(oledt) if (val < 61): raise ValueError(('Value is outside of acceptable range: %s ' % val)) return (OLE_TIME_ZERO + timedelta(days=val))