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 raise ?
def ValidateString(value, name='unused', exception=datastore_errors.BadValueError, max_len=_MAX_STRING_LENGTH, empty_ok=False): if ((value is None) and empty_ok): return if ((not isinstance(value, basestring)) or isinstance(value, Blob)): raise exception(('%s should be a string; received %s (a %s):' % (na...
null
null
null
an exception if value is not a valid string or a subclass thereof
codeqa
def Validate String value name 'unused' exception datastore errors Bad Value Error max len MAX STRING LENGTH empty ok False if value is None and empty ok returnif not isinstance value basestring or isinstance value Blob raise exception '%sshouldbeastring received%s a%s ' % name value typename value if not value and not...
null
null
null
null
Question: What does the code raise ? Code: def ValidateString(value, name='unused', exception=datastore_errors.BadValueError, max_len=_MAX_STRING_LENGTH, empty_ok=False): if ((value is None) and empty_ok): return if ((not isinstance(value, basestring)) or isinstance(value, Blob)): raise exception(('%s should...
null
null
null
What do the service return ?
def WaitForServiceStatus(serviceName, status, waitSecs, machine=None): for i in range((waitSecs * 4)): now_status = QueryServiceStatus(serviceName, machine)[1] if (now_status == status): break win32api.Sleep(250) else: raise pywintypes.error, (winerror.ERROR_SERVICE_REQUEST_TIMEOUT, 'QueryServiceStatus', w...
null
null
null
the specified status
codeqa
def Wait For Service Status service Name status wait Secs machine None for i in range wait Secs * 4 now status Query Service Status service Name machine [1 ]if now status status breakwin 32 api Sleep 250 else raise pywintypes error winerror ERROR SERVICE REQUEST TIMEOUT ' Query Service Status' win 32 api Format Message...
null
null
null
null
Question: What do the service return ? Code: def WaitForServiceStatus(serviceName, status, waitSecs, machine=None): for i in range((waitSecs * 4)): now_status = QueryServiceStatus(serviceName, machine)[1] if (now_status == status): break win32api.Sleep(250) else: raise pywintypes.error, (winerror.ERROR...
null
null
null
What returns the specified status ?
def WaitForServiceStatus(serviceName, status, waitSecs, machine=None): for i in range((waitSecs * 4)): now_status = QueryServiceStatus(serviceName, machine)[1] if (now_status == status): break win32api.Sleep(250) else: raise pywintypes.error, (winerror.ERROR_SERVICE_REQUEST_TIMEOUT, 'QueryServiceStatus', w...
null
null
null
the service
codeqa
def Wait For Service Status service Name status wait Secs machine None for i in range wait Secs * 4 now status Query Service Status service Name machine [1 ]if now status status breakwin 32 api Sleep 250 else raise pywintypes error winerror ERROR SERVICE REQUEST TIMEOUT ' Query Service Status' win 32 api Format Message...
null
null
null
null
Question: What returns the specified status ? Code: def WaitForServiceStatus(serviceName, status, waitSecs, machine=None): for i in range((waitSecs * 4)): now_status = QueryServiceStatus(serviceName, machine)[1] if (now_status == status): break win32api.Sleep(250) else: raise pywintypes.error, (winerro...
null
null
null
What is valid on the target in this context ?
def enforce(context, action, target): init() return _ENFORCER.enforce(action, target, context.to_policy_values(), do_raise=True, exc=exception.PolicyNotAuthorized, action=action)
null
null
null
the action
codeqa
def enforce context action target init return ENFORCER enforce action target context to policy values do raise True exc exception Policy Not Authorized action action
null
null
null
null
Question: What is valid on the target in this context ? Code: def enforce(context, action, target): init() return _ENFORCER.enforce(action, target, context.to_policy_values(), do_raise=True, exc=exception.PolicyNotAuthorized, action=action)
null
null
null
Where is the action valid on the target ?
def enforce(context, action, target): init() return _ENFORCER.enforce(action, target, context.to_policy_values(), do_raise=True, exc=exception.PolicyNotAuthorized, action=action)
null
null
null
in this context
codeqa
def enforce context action target init return ENFORCER enforce action target context to policy values do raise True exc exception Policy Not Authorized action action
null
null
null
null
Question: Where is the action valid on the target ? Code: def enforce(context, action, target): init() return _ENFORCER.enforce(action, target, context.to_policy_values(), do_raise=True, exc=exception.PolicyNotAuthorized, action=action)
null
null
null
What is describing specific flavor ?
@require_context @pick_context_manager_reader def flavor_get(context, id): result = _flavor_get_query(context).filter_by(id=id).first() if (not result): raise exception.FlavorNotFound(flavor_id=id) return _dict_with_extra_specs(result)
null
null
null
a dict
codeqa
@require context@pick context manager readerdef flavor get context id result flavor get query context filter by id id first if not result raise exception Flavor Not Found flavor id id return dict with extra specs result
null
null
null
null
Question: What is describing specific flavor ? Code: @require_context @pick_context_manager_reader def flavor_get(context, id): result = _flavor_get_query(context).filter_by(id=id).first() if (not result): raise exception.FlavorNotFound(flavor_id=id) return _dict_with_extra_specs(result)
null
null
null
What may contain handlers ?
def _apps(): def _in_exclusions(module_name): settings_exclusions = getattr(settings, 'RAPIDSMS_HANDLERS_EXCLUDE_APPS', []) return ((module_name == 'rapidsms.contrib.handlers') or module_name.startswith('django.contrib.') or (module_name in settings_exclusions)) return [module_name for module_name in settings.INS...
null
null
null
the apps
codeqa
def apps def in exclusions module name settings exclusions getattr settings 'RAPIDSMS HANDLERS EXCLUDE APPS' [] return module name 'rapidsms contrib handlers' or module name startswith 'django contrib ' or module name in settings exclusions return [module name for module name in settings INSTALLED APPS if not in exclus...
null
null
null
null
Question: What may contain handlers ? Code: def _apps(): def _in_exclusions(module_name): settings_exclusions = getattr(settings, 'RAPIDSMS_HANDLERS_EXCLUDE_APPS', []) return ((module_name == 'rapidsms.contrib.handlers') or module_name.startswith('django.contrib.') or (module_name in settings_exclusions)) ret...
null
null
null
What may the apps contain ?
def _apps(): def _in_exclusions(module_name): settings_exclusions = getattr(settings, 'RAPIDSMS_HANDLERS_EXCLUDE_APPS', []) return ((module_name == 'rapidsms.contrib.handlers') or module_name.startswith('django.contrib.') or (module_name in settings_exclusions)) return [module_name for module_name in settings.INS...
null
null
null
handlers
codeqa
def apps def in exclusions module name settings exclusions getattr settings 'RAPIDSMS HANDLERS EXCLUDE APPS' [] return module name 'rapidsms contrib handlers' or module name startswith 'django contrib ' or module name in settings exclusions return [module name for module name in settings INSTALLED APPS if not in exclus...
null
null
null
null
Question: What may the apps contain ? Code: def _apps(): def _in_exclusions(module_name): settings_exclusions = getattr(settings, 'RAPIDSMS_HANDLERS_EXCLUDE_APPS', []) return ((module_name == 'rapidsms.contrib.handlers') or module_name.startswith('django.contrib.') or (module_name in settings_exclusions)) ret...
null
null
null
What does the code install ?
def test_install_package_with_latin1_setup(script, data): to_install = data.packages.join('SetupPyLatin1') script.pip('install', to_install)
null
null
null
a package with a setup
codeqa
def test install package with latin 1 setup script data to install data packages join ' Setup Py Latin 1 ' script pip 'install' to install
null
null
null
null
Question: What does the code install ? Code: def test_install_package_with_latin1_setup(script, data): to_install = data.packages.join('SetupPyLatin1') script.pip('install', to_install)
null
null
null
What does the code initialize ?
def init_params(options): params = OrderedDict() params['Wemb'] = norm_weight(options['n_words'], options['dim_word']) params = get_layer('ff')[0](options, params, prefix='ff_state', nin=options['dimctx'], nout=options['dim']) params = get_layer(options['decoder'])[0](options, params, prefix='decoder', nin=options[...
null
null
null
all parameters
codeqa
def init params options params Ordered Dict params[' Wemb'] norm weight options['n words'] options['dim word'] params get layer 'ff' [0 ] options params prefix 'ff state' nin options['dimctx'] nout options['dim'] params get layer options['decoder'] [0 ] options params prefix 'decoder' nin options['dim word'] dim option...
null
null
null
null
Question: What does the code initialize ? Code: def init_params(options): params = OrderedDict() params['Wemb'] = norm_weight(options['n_words'], options['dim_word']) params = get_layer('ff')[0](options, params, prefix='ff_state', nin=options['dimctx'], nout=options['dim']) params = get_layer(options['decoder']...
null
null
null
How do the resolver check ?
def check_resolver(resolver): check_method = getattr(resolver, 'check', None) if (check_method is not None): return check_method() elif (not hasattr(resolver, 'resolve')): return get_warning_for_invalid_pattern(resolver) else: return []
null
null
null
recursively
codeqa
def check resolver resolver check method getattr resolver 'check' None if check method is not None return check method elif not hasattr resolver 'resolve' return get warning for invalid pattern resolver else return []
null
null
null
null
Question: How do the resolver check ? Code: def check_resolver(resolver): check_method = getattr(resolver, 'check', None) if (check_method is not None): return check_method() elif (not hasattr(resolver, 'resolve')): return get_warning_for_invalid_pattern(resolver) else: return []
null
null
null
How does the code get triangle mesh from attribute dictionary ?
def getGeometryOutputByArguments(arguments, xmlElement): return getGeometryOutput(None, xmlElement)
null
null
null
by arguments
codeqa
def get Geometry Output By Arguments arguments xml Element return get Geometry Output None xml Element
null
null
null
null
Question: How does the code get triangle mesh from attribute dictionary ? Code: def getGeometryOutputByArguments(arguments, xmlElement): return getGeometryOutput(None, xmlElement)
null
null
null
What does the code get from attribute dictionary by arguments ?
def getGeometryOutputByArguments(arguments, xmlElement): return getGeometryOutput(None, xmlElement)
null
null
null
triangle mesh
codeqa
def get Geometry Output By Arguments arguments xml Element return get Geometry Output None xml Element
null
null
null
null
Question: What does the code get from attribute dictionary by arguments ? Code: def getGeometryOutputByArguments(arguments, xmlElement): return getGeometryOutput(None, xmlElement)
null
null
null
What do benchmarks use ?
def with_text(no_text=False, text=False, utext=False): values = [] if no_text: values.append(0) if text: values.append(1) if utext: values.append(2) def set_value(function): try: function.TEXT.add(values) except AttributeError: function.TEXT = set(values) return function return set_value
null
null
null
text
codeqa
def with text no text False text False utext False values []if no text values append 0 if text values append 1 if utext values append 2 def set value function try function TEXT add values except Attribute Error function TEXT set values return functionreturn set value
null
null
null
null
Question: What do benchmarks use ? Code: def with_text(no_text=False, text=False, utext=False): values = [] if no_text: values.append(0) if text: values.append(1) if utext: values.append(2) def set_value(function): try: function.TEXT.add(values) except AttributeError: function.TEXT = set(values...
null
null
null
What use text ?
def with_text(no_text=False, text=False, utext=False): values = [] if no_text: values.append(0) if text: values.append(1) if utext: values.append(2) def set_value(function): try: function.TEXT.add(values) except AttributeError: function.TEXT = set(values) return function return set_value
null
null
null
benchmarks
codeqa
def with text no text False text False utext False values []if no text values append 0 if text values append 1 if utext values append 2 def set value function try function TEXT add values except Attribute Error function TEXT set values return functionreturn set value
null
null
null
null
Question: What use text ? Code: def with_text(no_text=False, text=False, utext=False): values = [] if no_text: values.append(0) if text: values.append(1) if utext: values.append(2) def set_value(function): try: function.TEXT.add(values) except AttributeError: function.TEXT = set(values) retur...
null
null
null
What does the code get by side loop ?
def getGeometryOutputByLoop(sideLoop, xmlElement): sideLoop.rotate(xmlElement) return getGeometryOutputByManipulation(sideLoop, xmlElement)
null
null
null
geometry output
codeqa
def get Geometry Output By Loop side Loop xml Element side Loop rotate xml Element return get Geometry Output By Manipulation side Loop xml Element
null
null
null
null
Question: What does the code get by side loop ? Code: def getGeometryOutputByLoop(sideLoop, xmlElement): sideLoop.rotate(xmlElement) return getGeometryOutputByManipulation(sideLoop, xmlElement)
null
null
null
How does the code get geometry output ?
def getGeometryOutputByLoop(sideLoop, xmlElement): sideLoop.rotate(xmlElement) return getGeometryOutputByManipulation(sideLoop, xmlElement)
null
null
null
by side loop
codeqa
def get Geometry Output By Loop side Loop xml Element side Loop rotate xml Element return get Geometry Output By Manipulation side Loop xml Element
null
null
null
null
Question: How does the code get geometry output ? Code: def getGeometryOutputByLoop(sideLoop, xmlElement): sideLoop.rotate(xmlElement) return getGeometryOutputByManipulation(sideLoop, xmlElement)
null
null
null
What does the code clean ?
def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
any stubs that need cleanup
codeqa
def Tear Down Stubs logging info ' Applyingallpendingtransactionsandsavingthedatastore' datastore stub apiproxy stub map apiproxy Get Stub 'datastore v3 ' datastore stub Write
null
null
null
null
Question: What does the code clean ? Code: def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
What do any stubs need ?
def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
cleanup
codeqa
def Tear Down Stubs logging info ' Applyingallpendingtransactionsandsavingthedatastore' datastore stub apiproxy stub map apiproxy Get Stub 'datastore v3 ' datastore stub Write
null
null
null
null
Question: What do any stubs need ? Code: def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
What need cleanup ?
def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
any stubs
codeqa
def Tear Down Stubs logging info ' Applyingallpendingtransactionsandsavingthedatastore' datastore stub apiproxy stub map apiproxy Get Stub 'datastore v3 ' datastore stub Write
null
null
null
null
Question: What need cleanup ? Code: def _TearDownStubs(): logging.info('Applying all pending transactions and saving the datastore') datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3') datastore_stub.Write()
null
null
null
What is the code skip if a custom user model is in use ?
def skip_if_custom_user(test_func): return skipIf((settings.AUTH_USER_MODEL != 'auth.User'), 'Custom user model in use')(test_func)
null
null
null
a test
codeqa
def skip if custom user test func return skip If settings AUTH USER MODEL 'auth User' ' Customusermodelinuse' test func
null
null
null
null
Question: What is the code skip if a custom user model is in use ? Code: def skip_if_custom_user(test_func): return skipIf((settings.AUTH_USER_MODEL != 'auth.User'), 'Custom user model in use')(test_func)
null
null
null
What matches the value to any of a set of options ?
def is_option(value, *options): if (not isinstance(value, basestring)): raise VdtTypeError(value) if (not (value in options)): raise VdtValueError(value) return value
null
null
null
this check
codeqa
def is option value *options if not isinstance value basestring raise Vdt Type Error value if not value in options raise Vdt Value Error value return value
null
null
null
null
Question: What matches the value to any of a set of options ? Code: def is_option(value, *options): if (not isinstance(value, basestring)): raise VdtTypeError(value) if (not (value in options)): raise VdtValueError(value) return value
null
null
null
What does this check match ?
def is_option(value, *options): if (not isinstance(value, basestring)): raise VdtTypeError(value) if (not (value in options)): raise VdtValueError(value) return value
null
null
null
the value to any of a set of options
codeqa
def is option value *options if not isinstance value basestring raise Vdt Type Error value if not value in options raise Vdt Value Error value return value
null
null
null
null
Question: What does this check match ? Code: def is_option(value, *options): if (not isinstance(value, basestring)): raise VdtTypeError(value) if (not (value in options)): raise VdtValueError(value) return value
null
null
null
What does the code remove from an application ?
def rm_handler(app, handler_name, func, key=None): handler_funcs_name = '{0}_funcs'.format(handler_name) handler_funcs = getattr(app, handler_funcs_name) try: handler_funcs.get(key, []).remove(func) except ValueError: pass
null
null
null
a handler
codeqa
def rm handler app handler name func key None handler funcs name '{ 0 } funcs' format handler name handler funcs getattr app handler funcs name try handler funcs get key [] remove func except Value Error pass
null
null
null
null
Question: What does the code remove from an application ? Code: def rm_handler(app, handler_name, func, key=None): handler_funcs_name = '{0}_funcs'.format(handler_name) handler_funcs = getattr(app, handler_funcs_name) try: handler_funcs.get(key, []).remove(func) except ValueError: pass
null
null
null
What does the code return ?
def avail_sizes(conn=None, call=None): if (call == 'action'): raise SaltCloudSystemExit('The avail_sizes function must be called with -f or --function, or with the --list-sizes option') if (not conn): conn = get_conn() sizes = conn.list_sizes() ret = {} for size in sizes: if (isinstance(size.na...
null
null
null
a dict of all available vm images on the cloud provider with relevant data
codeqa
def avail sizes conn None call None if call 'action' raise Salt Cloud System Exit ' Theavail sizesfunctionmustbecalledwith-for--function orwiththe--list-sizesoption' if not conn conn get conn sizes conn list sizes ret {}for size in sizes if isinstance size name string types and not six PY 3 size name size name encode '...
null
null
null
null
Question: What does the code return ? Code: def avail_sizes(conn=None, call=None): if (call == 'action'): raise SaltCloudSystemExit('The avail_sizes function must be called with -f or --function, or with the --list-sizes option') if (not conn): conn = get_conn() sizes = conn.list_sizes() ret =...
null
null
null
What does the code resolve ?
def LinGetRawDevice(path): device_map = GetMountpoints() path = utils.SmartUnicode(path) mount_point = path = utils.NormalizePath(path, '/') result = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS) while mount_point: try: (result.path, fs_type) = device_map[mount_point] if (fs_type in ['ext2', ...
null
null
null
the raw device that contains the path
codeqa
def Lin Get Raw Device path device map Get Mountpoints path utils Smart Unicode path mount point path utils Normalize Path path '/' result rdf paths Path Spec pathtype rdf paths Path Spec Path Type OS while mount point try result path fs type device map[mount point]if fs type in ['ext 2 ' 'ext 3 ' 'ext 4 ' 'vfat' 'ntfs...
null
null
null
null
Question: What does the code resolve ? Code: def LinGetRawDevice(path): device_map = GetMountpoints() path = utils.SmartUnicode(path) mount_point = path = utils.NormalizePath(path, '/') result = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.OS) while mount_point: try: (result.path, fs_type) = de...
null
null
null
When does the code call a function ?
def RetryWithBackoff(callable_func, retry_notify_func, initial_delay=1, backoff_factor=2, max_delay=60, max_tries=20): delay = initial_delay num_tries = 0 while True: (done, opaque_value) = callable_func() num_tries += 1 if done: return (True, opaque_value) if (num_tries >= max_tries): return (False, o...
null
null
null
multiple times
codeqa
def Retry With Backoff callable func retry notify func initial delay 1 backoff factor 2 max delay 60 max tries 20 delay initial delaynum tries 0while True done opaque value callable func num tries + 1if done return True opaque value if num tries > max tries return False opaque value retry notify func opaque value delay...
null
null
null
null
Question: When does the code call a function ? Code: def RetryWithBackoff(callable_func, retry_notify_func, initial_delay=1, backoff_factor=2, max_delay=60, max_tries=20): delay = initial_delay num_tries = 0 while True: (done, opaque_value) = callable_func() num_tries += 1 if done: return (True, opaque_...
null
null
null
What does the code call multiple times ?
def RetryWithBackoff(callable_func, retry_notify_func, initial_delay=1, backoff_factor=2, max_delay=60, max_tries=20): delay = initial_delay num_tries = 0 while True: (done, opaque_value) = callable_func() num_tries += 1 if done: return (True, opaque_value) if (num_tries >= max_tries): return (False, o...
null
null
null
a function
codeqa
def Retry With Backoff callable func retry notify func initial delay 1 backoff factor 2 max delay 60 max tries 20 delay initial delaynum tries 0while True done opaque value callable func num tries + 1if done return True opaque value if num tries > max tries return False opaque value retry notify func opaque value delay...
null
null
null
null
Question: What does the code call multiple times ? Code: def RetryWithBackoff(callable_func, retry_notify_func, initial_delay=1, backoff_factor=2, max_delay=60, max_tries=20): delay = initial_delay num_tries = 0 while True: (done, opaque_value) = callable_func() num_tries += 1 if done: return (True, opa...
null
null
null
What does the code add to the context for caching and easy access ?
@register.tag('with') def do_with(parser, token): bits = token.split_contents() remaining_bits = bits[1:] extra_context = token_kwargs(remaining_bits, parser, support_legacy=True) if (not extra_context): raise TemplateSyntaxError(('%r expected at least one variable assignment' % bits[0])) if remaining_bits...
null
null
null
one or more values
codeqa
@register tag 'with' def do with parser token bits token split contents remaining bits bits[ 1 ]extra context token kwargs remaining bits parser support legacy True if not extra context raise Template Syntax Error '%rexpectedatleastonevariableassignment' % bits[ 0 ] if remaining bits raise Template Syntax Error '%rrece...
null
null
null
null
Question: What does the code add to the context for caching and easy access ? Code: @register.tag('with') def do_with(parser, token): bits = token.split_contents() remaining_bits = bits[1:] extra_context = token_kwargs(remaining_bits, parser, support_legacy=True) if (not extra_context): raise TemplateSyntaxEr...
null
null
null
For what purpose does transaction management enter ?
def enter_transaction_management(managed=True, using=None, forced=False): get_connection(using).enter_transaction_management(managed, forced)
null
null
null
for a running thread
codeqa
def enter transaction management managed True using None forced False get connection using enter transaction management managed forced
null
null
null
null
Question: For what purpose does transaction management enter ? Code: def enter_transaction_management(managed=True, using=None, forced=False): get_connection(using).enter_transaction_management(managed, forced)
null
null
null
What does the code make ?
def make_relative_path(source, dest, dest_is_directory=True): source = os.path.dirname(source) if (not dest_is_directory): dest_filename = os.path.basename(dest) dest = os.path.dirname(dest) dest = os.path.normpath(os.path.abspath(dest)) source = os.path.normpath(os.path.abspath(source)) dest_parts = dest.stri...
null
null
null
a filename relative
codeqa
def make relative path source dest dest is directory True source os path dirname source if not dest is directory dest filename os path basename dest dest os path dirname dest dest os path normpath os path abspath dest source os path normpath os path abspath source dest parts dest strip os path sep split os path sep sou...
null
null
null
null
Question: What does the code make ? Code: def make_relative_path(source, dest, dest_is_directory=True): source = os.path.dirname(source) if (not dest_is_directory): dest_filename = os.path.basename(dest) dest = os.path.dirname(dest) dest = os.path.normpath(os.path.abspath(dest)) source = os.path.normpath(os...
null
null
null
What does the code make ?
def Scatter(xs, ys=None, **options): options = _Underride(options, color='blue', alpha=0.2, s=30, edgecolors='none') if ((ys is None) and isinstance(xs, pandas.Series)): ys = xs.values xs = xs.index pyplot.scatter(xs, ys, **options)
null
null
null
a scatter plot
codeqa
def Scatter xs ys None **options options Underride options color 'blue' alpha 0 2 s 30 edgecolors 'none' if ys is None and isinstance xs pandas Series ys xs valuesxs xs indexpyplot scatter xs ys **options
null
null
null
null
Question: What does the code make ? Code: def Scatter(xs, ys=None, **options): options = _Underride(options, color='blue', alpha=0.2, s=30, edgecolors='none') if ((ys is None) and isinstance(xs, pandas.Series)): ys = xs.values xs = xs.index pyplot.scatter(xs, ys, **options)
null
null
null
What does the code remove from a variable ?
def escape_invalid_characters(name, invalid_char_list, replace_with='_'): for char in invalid_char_list: if (char in name): name = name.replace(char, replace_with) return name
null
null
null
invalid characters
codeqa
def escape invalid characters name invalid char list replace with ' ' for char in invalid char list if char in name name name replace char replace with return name
null
null
null
null
Question: What does the code remove from a variable ? Code: def escape_invalid_characters(name, invalid_char_list, replace_with='_'): for char in invalid_char_list: if (char in name): name = name.replace(char, replace_with) return name
null
null
null
What d the code ensure ?
def _mkdirp(d): try: os.makedirs(d) except OSError as e: if (e.errno != errno.EEXIST): raise
null
null
null
directory d exists no guarantee that the directory is writable
codeqa
def mkdirp d try os makedirs d except OS Error as e if e errno errno EEXIST raise
null
null
null
null
Question: What d the code ensure ? Code: def _mkdirp(d): try: os.makedirs(d) except OSError as e: if (e.errno != errno.EEXIST): raise
null
null
null
What does the code get ?
def getInsetSeparateLoopsFromLoops(inset, loops, thresholdRatio=0.9): isInset = (inset > 0) insetSeparateLoops = [] radius = abs(inset) arounds = getAroundsFromLoops(loops, radius, thresholdRatio) for around in arounds: leftPoint = euclidean.getLeftPoint(around) if (isInset == euclidean.getIsInFilledRegion(loo...
null
null
null
the separate inset loops
codeqa
def get Inset Separate Loops From Loops inset loops threshold Ratio 0 9 is Inset inset > 0 inset Separate Loops []radius abs inset arounds get Arounds From Loops loops radius threshold Ratio for around in arounds left Point euclidean get Left Point around if is Inset euclidean get Is In Filled Region loops left Point i...
null
null
null
null
Question: What does the code get ? Code: def getInsetSeparateLoopsFromLoops(inset, loops, thresholdRatio=0.9): isInset = (inset > 0) insetSeparateLoops = [] radius = abs(inset) arounds = getAroundsFromLoops(loops, radius, thresholdRatio) for around in arounds: leftPoint = euclidean.getLeftPoint(around) if ...
null
null
null
How does which output format is desired determine ?
def determine_format(request, serializer, default_format=u'application/json'): format = request.GET.get(u'format') if format: if (format in serializer.formats): return serializer.get_mime_for_format(format) if ((u'callback' in request.GET) and (u'jsonp' in serializer.formats)): return serializer.get_mime_for_...
null
null
null
smartly
codeqa
def determine format request serializer default format u'application/json' format request GET get u'format' if format if format in serializer formats return serializer get mime for format format if u'callback' in request GET and u'jsonp' in serializer formats return serializer get mime for format u'jsonp' accept reques...
null
null
null
null
Question: How does which output format is desired determine ? Code: def determine_format(request, serializer, default_format=u'application/json'): format = request.GET.get(u'format') if format: if (format in serializer.formats): return serializer.get_mime_for_format(format) if ((u'callback' in request.GET) ...
null
null
null
Where was translation used ?
@register.simple_tag def get_location_links(unit): ret = [] if (len(unit.location) == 0): return u'' if unit.location.isdigit(): return (_(u'unit ID %s') % unit.location) for location in unit.location.split(u','): location = location.strip() if (location == u''): continue location_parts = location.sp...
null
null
null
where
codeqa
@register simple tagdef get location links unit ret []if len unit location 0 return u''if unit location isdigit return u'unit ID%s' % unit location for location in unit location split u' ' location location strip if location u'' continuelocation parts location split u' ' if len location parts 2 filename line location p...
null
null
null
null
Question: Where was translation used ? Code: @register.simple_tag def get_location_links(unit): ret = [] if (len(unit.location) == 0): return u'' if unit.location.isdigit(): return (_(u'unit ID %s') % unit.location) for location in unit.location.split(u','): location = location.strip() if (location ==...
null
null
null
What was used where ?
@register.simple_tag def get_location_links(unit): ret = [] if (len(unit.location) == 0): return u'' if unit.location.isdigit(): return (_(u'unit ID %s') % unit.location) for location in unit.location.split(u','): location = location.strip() if (location == u''): continue location_parts = location.sp...
null
null
null
translation
codeqa
@register simple tagdef get location links unit ret []if len unit location 0 return u''if unit location isdigit return u'unit ID%s' % unit location for location in unit location split u' ' location location strip if location u'' continuelocation parts location split u' ' if len location parts 2 filename line location p...
null
null
null
null
Question: What was used where ? Code: @register.simple_tag def get_location_links(unit): ret = [] if (len(unit.location) == 0): return u'' if unit.location.isdigit(): return (_(u'unit ID %s') % unit.location) for location in unit.location.split(u','): location = location.strip() if (location == u''): ...
null
null
null
What does the code create ?
def create_policy(policy_name, policy_document, path=None, description=None, region=None, key=None, keyid=None, profile=None): conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if (not isinstance(policy_document, six.string_types)): policy_document = json.dumps(policy_document) params = {} fo...
null
null
null
a policy
codeqa
def create policy policy name policy document path None description None region None key None keyid None profile None conn get conn region region key key keyid keyid profile profile if not isinstance policy document six string types policy document json dumps policy document params {}for arg in 'path' 'description' if ...
null
null
null
null
Question: What does the code create ? Code: def create_policy(policy_name, policy_document, path=None, description=None, region=None, key=None, keyid=None, profile=None): conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) if (not isinstance(policy_document, six.string_types)): policy_documen...
null
null
null
What does the code return ?
@keep_lazy_text def get_valid_filename(s): s = force_text(s).strip().replace(' ', '_') return re.sub('(?u)[^-\\w.]', '', s)
null
null
null
the given string converted to a string that can be used for a clean filename
codeqa
@keep lazy textdef get valid filename s s force text s strip replace '' ' ' return re sub ' ?u [^-\\w ]' '' s
null
null
null
null
Question: What does the code return ? Code: @keep_lazy_text def get_valid_filename(s): s = force_text(s).strip().replace(' ', '_') return re.sub('(?u)[^-\\w.]', '', s)
null
null
null
What does the code get ?
def get_pools(client): return [server.pool for server in client._get_topology().select_servers(any_server_selector)]
null
null
null
all pools
codeqa
def get pools client return [server pool for server in client get topology select servers any server selector ]
null
null
null
null
Question: What does the code get ? Code: def get_pools(client): return [server.pool for server in client._get_topology().select_servers(any_server_selector)]
null
null
null
What does the code run ?
def main(): parser = argparse.ArgumentParser(description='release.yml producer', epilog='Licensed "Apache 2.0"') parser.add_argument('-f', '--file', help='<Required> ansible-role-requirements.yml file location', default='ansible-role-requirements.yml') parser.add_argument('-v', '--version', help='<Required> T...
null
null
null
the main application
codeqa
def main parser argparse Argument Parser description 'release ymlproducer' epilog ' Licensed" Apache 2 0"' parser add argument '-f' '--file' help '< Required>ansible-role-requirements ymlfilelocation' default 'ansible-role-requirements yml' parser add argument '-v' '--version' help '< Required> Thereleaseversiontoinclu...
null
null
null
null
Question: What does the code run ? Code: def main(): parser = argparse.ArgumentParser(description='release.yml producer', epilog='Licensed "Apache 2.0"') parser.add_argument('-f', '--file', help='<Required> ansible-role-requirements.yml file location', default='ansible-role-requirements.yml') parser.add_ar...
null
null
null
What sends at layer 2 ?
@conf.commands.register def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, return_packets=False, *args, **kargs): if ((iface is None) and (iface_hint is not None)): iface = conf.route.route(iface_hint)[0] return __gen_send(conf.L2socket(iface=iface, *args, **kargs), ...
null
null
null
packets
codeqa
@conf commands registerdef sendp x inter 0 loop 0 iface None iface hint None count None verbose None realtime None return packets False *args **kargs if iface is None and iface hint is not None iface conf route route iface hint [0 ]return gen send conf L2 socket iface iface *args **kargs x inter inter loop loop count c...
null
null
null
null
Question: What sends at layer 2 ? Code: @conf.commands.register def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, return_packets=False, *args, **kargs): if ((iface is None) and (iface_hint is not None)): iface = conf.route.route(iface_hint)[0] return __gen_send(...
null
null
null
Where do packets send ?
@conf.commands.register def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, return_packets=False, *args, **kargs): if ((iface is None) and (iface_hint is not None)): iface = conf.route.route(iface_hint)[0] return __gen_send(conf.L2socket(iface=iface, *args, **kargs), ...
null
null
null
at layer 2
codeqa
@conf commands registerdef sendp x inter 0 loop 0 iface None iface hint None count None verbose None realtime None return packets False *args **kargs if iface is None and iface hint is not None iface conf route route iface hint [0 ]return gen send conf L2 socket iface iface *args **kargs x inter inter loop loop count c...
null
null
null
null
Question: Where do packets send ? Code: @conf.commands.register def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, return_packets=False, *args, **kargs): if ((iface is None) and (iface_hint is not None)): iface = conf.route.route(iface_hint)[0] return __gen_send(...
null
null
null
What does a word - wrap function preserve ?
def wrap(text, width): def _generator(): it = iter(text.split(' ')) word = it.next() (yield word) pos = ((len(word) - word.rfind('\n')) - 1) for word in it: if ('\n' in word): lines = word.split('\n') else: lines = (word,) pos += (len(lines[0]) + 1) if (pos > width): (yield '\n') ...
null
null
null
existing line breaks and most spaces in the text
codeqa
def wrap text width def generator it iter text split '' word it next yield word pos len word - word rfind '\n' - 1 for word in it if '\n' in word lines word split '\n' else lines word pos + len lines[ 0 ] + 1 if pos > width yield '\n' pos len lines[ -1 ] else yield '' if len lines > 1 pos len lines[ -1 ] yield word ret...
null
null
null
null
Question: What does a word - wrap function preserve ? Code: def wrap(text, width): def _generator(): it = iter(text.split(' ')) word = it.next() (yield word) pos = ((len(word) - word.rfind('\n')) - 1) for word in it: if ('\n' in word): lines = word.split('\n') else: lines = (word,) pos ...
null
null
null
What preserves existing line breaks and most spaces in the text ?
def wrap(text, width): def _generator(): it = iter(text.split(' ')) word = it.next() (yield word) pos = ((len(word) - word.rfind('\n')) - 1) for word in it: if ('\n' in word): lines = word.split('\n') else: lines = (word,) pos += (len(lines[0]) + 1) if (pos > width): (yield '\n') ...
null
null
null
a word - wrap function
codeqa
def wrap text width def generator it iter text split '' word it next yield word pos len word - word rfind '\n' - 1 for word in it if '\n' in word lines word split '\n' else lines word pos + len lines[ 0 ] + 1 if pos > width yield '\n' pos len lines[ -1 ] else yield '' if len lines > 1 pos len lines[ -1 ] yield word ret...
null
null
null
null
Question: What preserves existing line breaks and most spaces in the text ? Code: def wrap(text, width): def _generator(): it = iter(text.split(' ')) word = it.next() (yield word) pos = ((len(word) - word.rfind('\n')) - 1) for word in it: if ('\n' in word): lines = word.split('\n') else: l...
null
null
null
When are examples with plots displayed ?
def _plots_first(fname): if (not (fname.startswith('plot') and fname.endswith('.py'))): return ('zz' + fname) return fname
null
null
null
first
codeqa
def plots first fname if not fname startswith 'plot' and fname endswith ' py' return 'zz' + fname return fname
null
null
null
null
Question: When are examples with plots displayed ? Code: def _plots_first(fname): if (not (fname.startswith('plot') and fname.endswith('.py'))): return ('zz' + fname) return fname
null
null
null
What does the code create ?
def organization_create(context, data_dict): data_dict.setdefault('type', 'organization') _check_access('organization_create', context, data_dict) return _group_or_org_create(context, data_dict, is_org=True)
null
null
null
a new organization
codeqa
def organization create context data dict data dict setdefault 'type' 'organization' check access 'organization create' context data dict return group or org create context data dict is org True
null
null
null
null
Question: What does the code create ? Code: def organization_create(context, data_dict): data_dict.setdefault('type', 'organization') _check_access('organization_create', context, data_dict) return _group_or_org_create(context, data_dict, is_org=True)
null
null
null
What did the code refresh ?
def grains_refresh(): DETAILS['grains_cache'] = {} return grains()
null
null
null
the grains
codeqa
def grains refresh DETAILS['grains cache'] {}return grains
null
null
null
null
Question: What did the code refresh ? Code: def grains_refresh(): DETAILS['grains_cache'] = {} return grains()
null
null
null
How did modules import ?
def disallow_proxying(): ScopeReplacer._should_proxy = False
null
null
null
lazily
codeqa
def disallow proxying Scope Replacer should proxy False
null
null
null
null
Question: How did modules import ? Code: def disallow_proxying(): ScopeReplacer._should_proxy = False
null
null
null
How do image flip ?
def flip_vertical(request, fileobjects): transpose_image(request, fileobjects, 1)
null
null
null
vertically
codeqa
def flip vertical request fileobjects transpose image request fileobjects 1
null
null
null
null
Question: How do image flip ? Code: def flip_vertical(request, fileobjects): transpose_image(request, fileobjects, 1)
null
null
null
Where do the counts differ ?
def _count_diff_all_purpose(actual, expected): (s, t) = (list(actual), list(expected)) (m, n) = (len(s), len(t)) NULL = object() result = [] for (i, elem) in enumerate(s): if (elem is NULL): continue cnt_s = cnt_t = 0 for j in range(i, m): if (s[j] == elem): cnt_s += 1 s[j] = NULL for (j, oth...
null
null
null
where
codeqa
def count diff all purpose actual expected s t list actual list expected m n len s len t NULL object result []for i elem in enumerate s if elem is NULL continuecnt s cnt t 0for j in range i m if s[j] elem cnt s + 1s[j] NUL Lfor j other elem in enumerate t if other elem elem cnt t + 1t[j] NUL Lif cnt s cnt t diff Mismat...
null
null
null
null
Question: Where do the counts differ ? Code: def _count_diff_all_purpose(actual, expected): (s, t) = (list(actual), list(expected)) (m, n) = (len(s), len(t)) NULL = object() result = [] for (i, elem) in enumerate(s): if (elem is NULL): continue cnt_s = cnt_t = 0 for j in range(i, m): if (s[j] == el...
null
null
null
What differ where ?
def _count_diff_all_purpose(actual, expected): (s, t) = (list(actual), list(expected)) (m, n) = (len(s), len(t)) NULL = object() result = [] for (i, elem) in enumerate(s): if (elem is NULL): continue cnt_s = cnt_t = 0 for j in range(i, m): if (s[j] == elem): cnt_s += 1 s[j] = NULL for (j, oth...
null
null
null
the counts
codeqa
def count diff all purpose actual expected s t list actual list expected m n len s len t NULL object result []for i elem in enumerate s if elem is NULL continuecnt s cnt t 0for j in range i m if s[j] elem cnt s + 1s[j] NUL Lfor j other elem in enumerate t if other elem elem cnt t + 1t[j] NUL Lif cnt s cnt t diff Mismat...
null
null
null
null
Question: What differ where ? Code: def _count_diff_all_purpose(actual, expected): (s, t) = (list(actual), list(expected)) (m, n) = (len(s), len(t)) NULL = object() result = [] for (i, elem) in enumerate(s): if (elem is NULL): continue cnt_s = cnt_t = 0 for j in range(i, m): if (s[j] == elem): ...
null
null
null
What does the code return ?
def parselinenos(spec, total): items = list() parts = spec.split(',') for part in parts: try: begend = part.strip().split('-') if (len(begend) > 2): raise ValueError if (len(begend) == 1): items.append((int(begend[0]) - 1)) else: start = (((begend[0] == '') and 0) or (int(begend[0]) - 1)) ...
null
null
null
a list of wanted line numbers
codeqa
def parselinenos spec total items list parts spec split ' ' for part in parts try begend part strip split '-' if len begend > 2 raise Value Errorif len begend 1 items append int begend[ 0 ] - 1 else start begend[ 0 ] '' and 0 or int begend[ 0 ] - 1 end begend[ 1 ] '' and total or int begend[ 1 ] items extend range star...
null
null
null
null
Question: What does the code return ? Code: def parselinenos(spec, total): items = list() parts = spec.split(',') for part in parts: try: begend = part.strip().split('-') if (len(begend) > 2): raise ValueError if (len(begend) == 1): items.append((int(begend[0]) - 1)) else: start = (((be...
null
null
null
What does the code take ?
def display_timestamps_pair_compact(time_m_2): if (len(time_m_2) == 0): return '(empty)' time_m_2 = np.array(time_m_2) low = time_m_2[:, 0].mean() high = time_m_2[:, 1].mean() low = max(low, 0) if (high < 0): logger.warn('Harmless warning: upper-bound on clock skew is negative: (%s, %s). Please let...
null
null
null
a list of the following form
codeqa
def display timestamps pair compact time m 2 if len time m 2 0 return ' empty 'time m 2 np array time m 2 low time m 2[ 0] mean high time m 2[ 1] mean low max low 0 if high < 0 logger warn ' Harmlesswarning upper-boundonclockskewisnegative %s %s Pleaselet Gregknowaboutthis ' low high return '{}-{}' format display times...
null
null
null
null
Question: What does the code take ? Code: def display_timestamps_pair_compact(time_m_2): if (len(time_m_2) == 0): return '(empty)' time_m_2 = np.array(time_m_2) low = time_m_2[:, 0].mean() high = time_m_2[:, 1].mean() low = max(low, 0) if (high < 0): logger.warn('Harmless warning: upper-bound on clock...
null
null
null
How did job dict format ?
def _format_job_instance(job): ret = {'Function': job.get('fun', 'unknown-function'), 'Arguments': list(job.get('arg', [])), 'Target': job.get('tgt', 'unknown-target'), 'Target-type': job.get('tgt_type', []), 'User': job.get('user', 'root')} if ('metadata' in job): ret['Metadata'] = job.get('metadata', {}) elif ('...
null
null
null
properly
codeqa
def format job instance job ret {' Function' job get 'fun' 'unknown-function' ' Arguments' list job get 'arg' [] ' Target' job get 'tgt' 'unknown-target' ' Target-type' job get 'tgt type' [] ' User' job get 'user' 'root' }if 'metadata' in job ret[' Metadata'] job get 'metadata' {} elif 'kwargs' in job if 'metadata' in ...
null
null
null
null
Question: How did job dict format ? Code: def _format_job_instance(job): ret = {'Function': job.get('fun', 'unknown-function'), 'Arguments': list(job.get('arg', [])), 'Target': job.get('tgt', 'unknown-target'), 'Target-type': job.get('tgt_type', []), 'User': job.get('user', 'root')} if ('metadata' in job): ret[...
null
null
null
Where does image window ?
def available_capabilities(image=None): if (salt.utils.version_cmp(__grains__['osversion'], '10') == (-1)): raise NotImplementedError('`installed_capabilities` is not available on this version of Windows: {0}'.format(__grains__['osversion'])) return _get_components('Capability Identity', 'Capabilities', '...
null
null
null
offline
codeqa
def available capabilities image None if salt utils version cmp grains ['osversion'] '10 ' -1 raise Not Implemented Error '`installed capabilities`isnotavailableonthisversionof Windows {0 }' format grains ['osversion'] return get components ' Capability Identity' ' Capabilities' ' Not Present'
null
null
null
null
Question: Where does image window ? Code: def available_capabilities(image=None): if (salt.utils.version_cmp(__grains__['osversion'], '10') == (-1)): raise NotImplementedError('`installed_capabilities` is not available on this version of Windows: {0}'.format(__grains__['osversion'])) return _get_compon...
null
null
null
What windows offline ?
def available_capabilities(image=None): if (salt.utils.version_cmp(__grains__['osversion'], '10') == (-1)): raise NotImplementedError('`installed_capabilities` is not available on this version of Windows: {0}'.format(__grains__['osversion'])) return _get_components('Capability Identity', 'Capabilities', '...
null
null
null
image
codeqa
def available capabilities image None if salt utils version cmp grains ['osversion'] '10 ' -1 raise Not Implemented Error '`installed capabilities`isnotavailableonthisversionof Windows {0 }' format grains ['osversion'] return get components ' Capability Identity' ' Capabilities' ' Not Present'
null
null
null
null
Question: What windows offline ? Code: def available_capabilities(image=None): if (salt.utils.version_cmp(__grains__['osversion'], '10') == (-1)): raise NotImplementedError('`installed_capabilities` is not available on this version of Windows: {0}'.format(__grains__['osversion'])) return _get_component...
null
null
null
What does the code create ?
def new_figure_manager_given_figure(num, figure): canvas = FigureCanvasSVG(figure) manager = FigureManagerSVG(canvas, num) return manager
null
null
null
a new figure manager instance for the given figure
codeqa
def new figure manager given figure num figure canvas Figure Canvas SVG figure manager Figure Manager SVG canvas num return manager
null
null
null
null
Question: What does the code create ? Code: def new_figure_manager_given_figure(num, figure): canvas = FigureCanvasSVG(figure) manager = FigureManagerSVG(canvas, num) return manager
null
null
null
What does the code create ?
def libvlc_media_list_new(p_instance): f = (_Cfunctions.get('libvlc_media_list_new', None) or _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList), ctypes.c_void_p, Instance)) return f(p_instance)
null
null
null
an empty media list
codeqa
def libvlc media list new p instance f Cfunctions get 'libvlc media list new' None or Cfunction 'libvlc media list new' 1 class result Media List ctypes c void p Instance return f p instance
null
null
null
null
Question: What does the code create ? Code: def libvlc_media_list_new(p_instance): f = (_Cfunctions.get('libvlc_media_list_new', None) or _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList), ctypes.c_void_p, Instance)) return f(p_instance)
null
null
null
How did the argument split into words ?
def capwords(s, sep=None): return (sep or ' ').join((x.capitalize() for x in s.split(sep)))
null
null
null
using split
codeqa
def capwords s sep None return sep or '' join x capitalize for x in s split sep
null
null
null
null
Question: How did the argument split into words ? Code: def capwords(s, sep=None): return (sep or ' ').join((x.capitalize() for x in s.split(sep)))
null
null
null
What does the code translate to the given locale ?
def translate(translatable, locale): localize = oslo_i18n.translate if isinstance(translatable, exceptions.NeutronException): translatable.msg = localize(translatable.msg, locale) elif isinstance(translatable, exc.HTTPError): translatable.detail = localize(translatable.detail, locale) elif isinstance(translatab...
null
null
null
the object
codeqa
def translate translatable locale localize oslo i18 n translateif isinstance translatable exceptions Neutron Exception translatable msg localize translatable msg locale elif isinstance translatable exc HTTP Error translatable detail localize translatable detail locale elif isinstance translatable Exception translatable...
null
null
null
null
Question: What does the code translate to the given locale ? Code: def translate(translatable, locale): localize = oslo_i18n.translate if isinstance(translatable, exceptions.NeutronException): translatable.msg = localize(translatable.msg, locale) elif isinstance(translatable, exc.HTTPError): translatable.det...
null
null
null
What does the code get ?
def getNewDerivation(elementNode): return SolidDerivation(elementNode)
null
null
null
new derivation
codeqa
def get New Derivation element Node return Solid Derivation element Node
null
null
null
null
Question: What does the code get ? Code: def getNewDerivation(elementNode): return SolidDerivation(elementNode)
null
null
null
For what purpose do them store ?
def index(document, filename, chapterReference): entries = domhelpers.findElementsWithAttribute(document, 'class', 'index') if (not entries): return i = 0 for entry in entries: i += 1 anchor = ('index%02d' % i) if chapterReference: ref = (getSectionReference(entry) or chapterReference) else: ref = '...
null
null
null
for later use
codeqa
def index document filename chapter Reference entries domhelpers find Elements With Attribute document 'class' 'index' if not entries returni 0for entry in entries i + 1anchor 'index% 02 d' % i if chapter Reference ref get Section Reference entry or chapter Reference else ref 'link'indexer add Entry filename anchor ent...
null
null
null
null
Question: For what purpose do them store ? Code: def index(document, filename, chapterReference): entries = domhelpers.findElementsWithAttribute(document, 'class', 'index') if (not entries): return i = 0 for entry in entries: i += 1 anchor = ('index%02d' % i) if chapterReference: ref = (getSectionRef...
null
null
null
In which direction can the index link to those entries ?
def index(document, filename, chapterReference): entries = domhelpers.findElementsWithAttribute(document, 'class', 'index') if (not entries): return i = 0 for entry in entries: i += 1 anchor = ('index%02d' % i) if chapterReference: ref = (getSectionReference(entry) or chapterReference) else: ref = '...
null
null
null
back
codeqa
def index document filename chapter Reference entries domhelpers find Elements With Attribute document 'class' 'index' if not entries returni 0for entry in entries i + 1anchor 'index% 02 d' % i if chapter Reference ref get Section Reference entry or chapter Reference else ref 'link'indexer add Entry filename anchor ent...
null
null
null
null
Question: In which direction can the index link to those entries ? Code: def index(document, filename, chapterReference): entries = domhelpers.findElementsWithAttribute(document, 'class', 'index') if (not entries): return i = 0 for entry in entries: i += 1 anchor = ('index%02d' % i) if chapterReference:...
null
null
null
Where do all non - index values be in the upper left corner of the matrix ?
def copy_index_matrix(A, B, index, index_rows=False, index_cols=False, is_diagonal=False, inplace=False, prefix=None): if (prefix is None): prefix = find_best_blas_type((A, B))[0] copy = prefix_copy_index_matrix_map[prefix] if (not inplace): B = np.copy(B, order='F') try: if (not A.is_f_contig()): raise Va...
null
null
null
a time - varying matrix
codeqa
def copy index matrix A B index index rows False index cols False is diagonal False inplace False prefix None if prefix is None prefix find best blas type A B [0 ]copy prefix copy index matrix map[prefix]if not inplace B np copy B order 'F' try if not A is f contig raise Value Error except A np asfortranarray A copy A ...
null
null
null
null
Question: Where do all non - index values be in the upper left corner of the matrix ? Code: def copy_index_matrix(A, B, index, index_rows=False, index_cols=False, is_diagonal=False, inplace=False, prefix=None): if (prefix is None): prefix = find_best_blas_type((A, B))[0] copy = prefix_copy_index_matrix_map[pref...
null
null
null
What does the code delete ?
def list_delete(t): slug = raw_input(light_magenta('Your list that you want to delete: ', rl=True)) try: t.lists.destroy(slug='-'.join(slug.split()), owner_screen_name=g['original_name']) printNicely(green((slug + ' list is deleted.'))) except: debug_option() printNicely(red('Oops something is w...
null
null
null
a list
codeqa
def list delete t slug raw input light magenta ' Yourlistthatyouwanttodelete ' rl True try t lists destroy slug '-' join slug split owner screen name g['original name'] print Nicely green slug + 'listisdeleted ' except debug option print Nicely red ' Oopssomethingiswrongwith Twitter '
null
null
null
null
Question: What does the code delete ? Code: def list_delete(t): slug = raw_input(light_magenta('Your list that you want to delete: ', rl=True)) try: t.lists.destroy(slug='-'.join(slug.split()), owner_screen_name=g['original_name']) printNicely(green((slug + ' list is deleted.'))) except: debug_op...
null
null
null
What matches the default orientation ?
@cleanup def test__EventCollection__get_orientation(): (_, coll, props) = generate_EventCollection_plot() assert_equal(props[u'orientation'], coll.get_orientation())
null
null
null
the input orientation
codeqa
@cleanupdef test Event Collection get orientation coll props generate Event Collection plot assert equal props[u'orientation'] coll get orientation
null
null
null
null
Question: What matches the default orientation ? Code: @cleanup def test__EventCollection__get_orientation(): (_, coll, props) = generate_EventCollection_plot() assert_equal(props[u'orientation'], coll.get_orientation())
null
null
null
What does the input orientation match ?
@cleanup def test__EventCollection__get_orientation(): (_, coll, props) = generate_EventCollection_plot() assert_equal(props[u'orientation'], coll.get_orientation())
null
null
null
the default orientation
codeqa
@cleanupdef test Event Collection get orientation coll props generate Event Collection plot assert equal props[u'orientation'] coll get orientation
null
null
null
null
Question: What does the input orientation match ? Code: @cleanup def test__EventCollection__get_orientation(): (_, coll, props) = generate_EventCollection_plot() assert_equal(props[u'orientation'], coll.get_orientation())
null
null
null
What raises exception ?
def tryit(rule): def try_rl(expr): try: return rule(expr) except Exception: return expr return try_rl
null
null
null
rule
codeqa
def tryit rule def try rl expr try return rule expr except Exception return exprreturn try rl
null
null
null
null
Question: What raises exception ? Code: def tryit(rule): def try_rl(expr): try: return rule(expr) except Exception: return expr return try_rl
null
null
null
What do rule raise ?
def tryit(rule): def try_rl(expr): try: return rule(expr) except Exception: return expr return try_rl
null
null
null
exception
codeqa
def tryit rule def try rl expr try return rule expr except Exception return exprreturn try rl
null
null
null
null
Question: What do rule raise ? Code: def tryit(rule): def try_rl(expr): try: return rule(expr) except Exception: return expr return try_rl
null
null
null
How does the code remove a mine ?
@mine.command('remove') @click.argument('x', type=float) @click.argument('y', type=float) def mine_remove(x, y): click.echo(('Removed mine at %s,%s' % (x, y)))
null
null
null
at a specific coordinate
codeqa
@mine command 'remove' @click argument 'x' type float @click argument 'y' type float def mine remove x y click echo ' Removedmineat%s %s' % x y
null
null
null
null
Question: How does the code remove a mine ? Code: @mine.command('remove') @click.argument('x', type=float) @click.argument('y', type=float) def mine_remove(x, y): click.echo(('Removed mine at %s,%s' % (x, y)))
null
null
null
What does the code remove at a specific coordinate ?
@mine.command('remove') @click.argument('x', type=float) @click.argument('y', type=float) def mine_remove(x, y): click.echo(('Removed mine at %s,%s' % (x, y)))
null
null
null
a mine
codeqa
@mine command 'remove' @click argument 'x' type float @click argument 'y' type float def mine remove x y click echo ' Removedmineat%s %s' % x y
null
null
null
null
Question: What does the code remove at a specific coordinate ? Code: @mine.command('remove') @click.argument('x', type=float) @click.argument('y', type=float) def mine_remove(x, y): click.echo(('Removed mine at %s,%s' % (x, y)))
null
null
null
How do the unit conversion classes register ?
def register(): import matplotlib.units as mplU mplU.registry[str] = StrConverter() mplU.registry[Epoch] = EpochConverter() mplU.registry[UnitDbl] = UnitDblConverter()
null
null
null
code
codeqa
def register import matplotlib units as mpl Umpl U registry[str] Str Converter mpl U registry[ Epoch] Epoch Converter mpl U registry[ Unit Dbl] Unit Dbl Converter
null
null
null
null
Question: How do the unit conversion classes register ? Code: def register(): import matplotlib.units as mplU mplU.registry[str] = StrConverter() mplU.registry[Epoch] = EpochConverter() mplU.registry[UnitDbl] = UnitDblConverter()
null
null
null
What uploads attachments ?
def allow_add_attachment_by(user): if (user.is_superuser or user.is_staff): return True if user.has_perm('attachments.add_attachment'): return True if user.has_perm('attachments.disallow_add_attachment'): return False return True
null
null
null
the user
codeqa
def allow add attachment by user if user is superuser or user is staff return Trueif user has perm 'attachments add attachment' return Trueif user has perm 'attachments disallow add attachment' return Falsereturn True
null
null
null
null
Question: What uploads attachments ? Code: def allow_add_attachment_by(user): if (user.is_superuser or user.is_staff): return True if user.has_perm('attachments.add_attachment'): return True if user.has_perm('attachments.disallow_add_attachment'): return False return True
null
null
null
What did the user upload ?
def allow_add_attachment_by(user): if (user.is_superuser or user.is_staff): return True if user.has_perm('attachments.add_attachment'): return True if user.has_perm('attachments.disallow_add_attachment'): return False return True
null
null
null
attachments
codeqa
def allow add attachment by user if user is superuser or user is staff return Trueif user has perm 'attachments add attachment' return Trueif user has perm 'attachments disallow add attachment' return Falsereturn True
null
null
null
null
Question: What did the user upload ? Code: def allow_add_attachment_by(user): if (user.is_superuser or user.is_staff): return True if user.has_perm('attachments.add_attachment'): return True if user.has_perm('attachments.disallow_add_attachment'): return False return True
null
null
null
What does the code get ?
def description(): for desc in _description.splitlines(): print desc
null
null
null
description of brainstorm dataset
codeqa
def description for desc in description splitlines print desc
null
null
null
null
Question: What does the code get ? Code: def description(): for desc in _description.splitlines(): print desc
null
null
null
How do numbers return ?
def _is_num_param(names, values, to_float=False): fun = ((to_float and float) or int) out_params = [] for (name, val) in zip(names, values): if (val is None): out_params.append(val) elif isinstance(val, (int, long, float, basestring)): try: out_params.append(fun(val)) except ValueError as e: rai...
null
null
null
from inputs
codeqa
def is num param names values to float False fun to float and float or int out params []for name val in zip names values if val is None out params append val elif isinstance val int long float basestring try out params append fun val except Value Error as e raise Vdt Param Error name val else raise Vdt Param Error name...
null
null
null
null
Question: How do numbers return ? Code: def _is_num_param(names, values, to_float=False): fun = ((to_float and float) or int) out_params = [] for (name, val) in zip(names, values): if (val is None): out_params.append(val) elif isinstance(val, (int, long, float, basestring)): try: out_params.append(...
null
null
null
When do email send with invoice to pay service fee ?
def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name, date=date), html=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['message'].format(even...
null
null
null
every month
codeqa
def send followup email for monthly fee payment email event name date amount payment url send email to email action MONTHLY PAYMENT FOLLOWUP EMAIL subject MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['subject'] format event name event name date date html MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['message'] format event name event...
null
null
null
null
Question: When do email send with invoice to pay service fee ? Code: def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name, date...
null
null
null
How do email send to pay service fee every month ?
def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name, date=date), html=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['message'].format(even...
null
null
null
with invoice
codeqa
def send followup email for monthly fee payment email event name date amount payment url send email to email action MONTHLY PAYMENT FOLLOWUP EMAIL subject MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['subject'] format event name event name date date html MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['message'] format event name event...
null
null
null
null
Question: How do email send to pay service fee every month ? Code: def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name, date=d...
null
null
null
For what purpose do email send with invoice every month ?
def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name, date=date), html=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['message'].format(even...
null
null
null
to pay service fee
codeqa
def send followup email for monthly fee payment email event name date amount payment url send email to email action MONTHLY PAYMENT FOLLOWUP EMAIL subject MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['subject'] format event name event name date date html MAILS[MONTHLY PAYMENT FOLLOWUP EMAIL]['message'] format event name event...
null
null
null
null
Question: For what purpose do email send with invoice every month ? Code: def send_followup_email_for_monthly_fee_payment(email, event_name, date, amount, payment_url): send_email(to=email, action=MONTHLY_PAYMENT_FOLLOWUP_EMAIL, subject=MAILS[MONTHLY_PAYMENT_FOLLOWUP_EMAIL]['subject'].format(event_name=event_name,...
null
null
null
What starts on the local node ?
def startup(): if _TRAFFICLINE: cmd = _traffic_line('-U') else: cmd = _traffic_ctl('server', 'start') log.debug('Running: %s', cmd) _subprocess(cmd) return _statuscmd()
null
null
null
traffic server
codeqa
def startup if TRAFFICLINE cmd traffic line '-U' else cmd traffic ctl 'server' 'start' log debug ' Running %s' cmd subprocess cmd return statuscmd
null
null
null
null
Question: What starts on the local node ? Code: def startup(): if _TRAFFICLINE: cmd = _traffic_line('-U') else: cmd = _traffic_ctl('server', 'start') log.debug('Running: %s', cmd) _subprocess(cmd) return _statuscmd()
null
null
null
Where do traffic server start ?
def startup(): if _TRAFFICLINE: cmd = _traffic_line('-U') else: cmd = _traffic_ctl('server', 'start') log.debug('Running: %s', cmd) _subprocess(cmd) return _statuscmd()
null
null
null
on the local node
codeqa
def startup if TRAFFICLINE cmd traffic line '-U' else cmd traffic ctl 'server' 'start' log debug ' Running %s' cmd subprocess cmd return statuscmd
null
null
null
null
Question: Where do traffic server start ? Code: def startup(): if _TRAFFICLINE: cmd = _traffic_line('-U') else: cmd = _traffic_ctl('server', 'start') log.debug('Running: %s', cmd) _subprocess(cmd) return _statuscmd()
null
null
null
What does the code get ?
def getNewRepository(): return PrefaceRepository()
null
null
null
the repository constructor
codeqa
def get New Repository return Preface Repository
null
null
null
null
Question: What does the code get ? Code: def getNewRepository(): return PrefaceRepository()
null
null
null
By how much did layers connect ?
def expanded_data_double_fc(n=100): (expanded_training_data, _, _) = network3.load_data_shared('../data/mnist_expanded.pkl.gz') for j in range(3): print ('Training with expanded data, %s neurons in two FC layers, run num %s' % (n, j)) net = Network([ConvPoolLayer(image_shape=(mini_batch_size, 1, 28, 2...
null
null
null
fully
codeqa
def expanded data double fc n 100 expanded training data network 3 load data shared ' /data/mnist expanded pkl gz' for j in range 3 print ' Trainingwithexpandeddata %sneuronsintwo F Clayers runnum%s' % n j net Network [ Conv Pool Layer image shape mini batch size 1 28 28 filter shape 20 1 5 5 poolsize 2 2 activation fn...
null
null
null
null
Question: By how much did layers connect ? Code: def expanded_data_double_fc(n=100): (expanded_training_data, _, _) = network3.load_data_shared('../data/mnist_expanded.pkl.gz') for j in range(3): print ('Training with expanded data, %s neurons in two FC layers, run num %s' % (n, j)) net = Network(...
null
null
null
What does the code compute ?
def fourier_transform(f, x, k, **hints): return FourierTransform(f, x, k).doit(**hints)
null
null
null
the unitary
codeqa
def fourier transform f x k **hints return Fourier Transform f x k doit **hints
null
null
null
null
Question: What does the code compute ? Code: def fourier_transform(f, x, k, **hints): return FourierTransform(f, x, k).doit(**hints)
null
null
null
What will store the language information dictionary for the given language code in a context variable ?
@register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyntaxError((u"'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))) return GetLanguageInfoNode(pars...
null
null
null
this
codeqa
@register tag u'get language info' def do get language info parser token args token split contents if len args 5 or args[ 1 ] u'for' or args[ 3 ] u'as' raise Template Syntax Error u"'%s'requires'forstringasvariable' got%r " % args[ 0 ] args[ 1 ] return Get Language Info Node parser compile filter args[ 2 ] args[ 4 ]
null
null
null
null
Question: What will store the language information dictionary for the given language code in a context variable ? Code: @register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyn...
null
null
null
What will this store in a context variable ?
@register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyntaxError((u"'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))) return GetLanguageInfoNode(pars...
null
null
null
the language information dictionary for the given language code
codeqa
@register tag u'get language info' def do get language info parser token args token split contents if len args 5 or args[ 1 ] u'for' or args[ 3 ] u'as' raise Template Syntax Error u"'%s'requires'forstringasvariable' got%r " % args[ 0 ] args[ 1 ] return Get Language Info Node parser compile filter args[ 2 ] args[ 4 ]
null
null
null
null
Question: What will this store in a context variable ? Code: @register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyntaxError((u"'%s' requires 'for string as variable' (g...
null
null
null
How will this store the language information dictionary for the given language code ?
@register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyntaxError((u"'%s' requires 'for string as variable' (got %r)" % (args[0], args[1:]))) return GetLanguageInfoNode(pars...
null
null
null
in a context variable
codeqa
@register tag u'get language info' def do get language info parser token args token split contents if len args 5 or args[ 1 ] u'for' or args[ 3 ] u'as' raise Template Syntax Error u"'%s'requires'forstringasvariable' got%r " % args[ 0 ] args[ 1 ] return Get Language Info Node parser compile filter args[ 2 ] args[ 4 ]
null
null
null
null
Question: How will this store the language information dictionary for the given language code ? Code: @register.tag(u'get_language_info') def do_get_language_info(parser, token): args = token.split_contents() if ((len(args) != 5) or (args[1] != u'for') or (args[3] != u'as')): raise TemplateSyntaxError((u"'%s' ...
null
null
null
When is an error raised ?
def test_ada_fit_invalid_ratio(): ratio = (1.0 / 10000.0) ada = ADASYN(ratio=ratio, random_state=RND_SEED) assert_raises(RuntimeError, ada.fit, X, Y)
null
null
null
when the balancing ratio to fit is smaller than the one of the data
codeqa
def test ada fit invalid ratio ratio 1 0 / 10000 0 ada ADASYN ratio ratio random state RND SEED assert raises Runtime Error ada fit X Y
null
null
null
null
Question: When is an error raised ? Code: def test_ada_fit_invalid_ratio(): ratio = (1.0 / 10000.0) ada = ADASYN(ratio=ratio, random_state=RND_SEED) assert_raises(RuntimeError, ada.fit, X, Y)
null
null
null
Who d strings ?
def parse_course_and_usage_keys(course_id, usage_id): course_key = CourseKey.from_string(course_id) usage_id = unquote_slashes(usage_id) usage_key = UsageKey.from_string(usage_id).map_into_course(course_key) return (course_key, usage_key)
null
null
null
i
codeqa
def parse course and usage keys course id usage id course key Course Key from string course id usage id unquote slashes usage id usage key Usage Key from string usage id map into course course key return course key usage key
null
null
null
null
Question: Who d strings ? Code: def parse_course_and_usage_keys(course_id, usage_id): course_key = CourseKey.from_string(course_id) usage_id = unquote_slashes(usage_id) usage_key = UsageKey.from_string(usage_id).map_into_course(course_key) return (course_key, usage_key)
null
null
null
For what purpose do additional variables calculate ?
def CalculateVariables(default_variables, params): flavor = gyp.common.GetFlavor(params) if (flavor == 'mac'): default_variables.setdefault('OS', 'mac') default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib') default_variables.setdefault('SHARED_LIB_DIR', generator_default_variables['PRODUCT_DIR']) defaul...
null
null
null
for use in the build
codeqa
def Calculate Variables default variables params flavor gyp common Get Flavor params if flavor 'mac' default variables setdefault 'OS' 'mac' default variables setdefault 'SHARED LIB SUFFIX' ' dylib' default variables setdefault 'SHARED LIB DIR' generator default variables['PRODUCT DIR'] default variables setdefault 'LI...
null
null
null
null
Question: For what purpose do additional variables calculate ? Code: def CalculateVariables(default_variables, params): flavor = gyp.common.GetFlavor(params) if (flavor == 'mac'): default_variables.setdefault('OS', 'mac') default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib') default_variables.setdefau...
null
null
null
What does the code decode ?
def quopri_decode(input, errors='strict'): assert (errors == 'strict') f = StringIO(input) g = StringIO() quopri.decode(f, g) output = g.getvalue() return (output, len(input))
null
null
null
the input
codeqa
def quopri decode input errors 'strict' assert errors 'strict' f String IO input g String IO quopri decode f g output g getvalue return output len input
null
null
null
null
Question: What does the code decode ? Code: def quopri_decode(input, errors='strict'): assert (errors == 'strict') f = StringIO(input) g = StringIO() quopri.decode(f, g) output = g.getvalue() return (output, len(input))
null
null
null
When do we see every page of the response ?
def _repeat(api_call, *args, **kwargs): marker = None while True: raw_resp = api_call(marker=marker, *args, **kwargs) resp = _unwrap_response(raw_resp) (yield resp) marker = resp.get('marker') if (not marker): return
null
null
null
ve
codeqa
def repeat api call *args **kwargs marker Nonewhile True raw resp api call marker marker *args **kwargs resp unwrap response raw resp yield resp marker resp get 'marker' if not marker return
null
null
null
null
Question: When do we see every page of the response ? Code: def _repeat(api_call, *args, **kwargs): marker = None while True: raw_resp = api_call(marker=marker, *args, **kwargs) resp = _unwrap_response(raw_resp) (yield resp) marker = resp.get('marker') if (not marker): return
null
null
null
What do we see ve ?
def _repeat(api_call, *args, **kwargs): marker = None while True: raw_resp = api_call(marker=marker, *args, **kwargs) resp = _unwrap_response(raw_resp) (yield resp) marker = resp.get('marker') if (not marker): return
null
null
null
every page of the response
codeqa
def repeat api call *args **kwargs marker Nonewhile True raw resp api call marker marker *args **kwargs resp unwrap response raw resp yield resp marker resp get 'marker' if not marker return
null
null
null
null
Question: What do we see ve ? Code: def _repeat(api_call, *args, **kwargs): marker = None while True: raw_resp = api_call(marker=marker, *args, **kwargs) resp = _unwrap_response(raw_resp) (yield resp) marker = resp.get('marker') if (not marker): return
null
null
null
What does the code add ?
def addToMenu(master, menu, repository, window): CraftMenuSaveListener(menu, window)
null
null
null
a tool plugin menu
codeqa
def add To Menu master menu repository window Craft Menu Save Listener menu window
null
null
null
null
Question: What does the code add ? Code: def addToMenu(master, menu, repository, window): CraftMenuSaveListener(menu, window)
null
null
null
What do we add when ?
def test_elemwise_collapse5(): shape = (4, 5) a = cuda_ndarray.CudaNdarray(theano._asarray(numpy.random.rand(*shape), dtype='float32')) a = theano._asarray(numpy.random.rand(*shape), dtype='float32') a2 = tcn.shared_constructor(a, 'a') a3 = a2.dimshuffle('x', 'x', 0, 1) b = tcn.CudaNdarrayType((False, False, Fals...
null
null
null
a scalar
codeqa
def test elemwise collapse 5 shape 4 5 a cuda ndarray Cuda Ndarray theano asarray numpy random rand *shape dtype 'float 32 ' a theano asarray numpy random rand *shape dtype 'float 32 ' a2 tcn shared constructor a 'a' a3 a2 dimshuffle 'x' 'x' 0 1 b tcn Cuda Ndarray Type False False False False c a3 + b + 2 f pfunc [b] [...
null
null
null
null
Question: What do we add when ? Code: def test_elemwise_collapse5(): shape = (4, 5) a = cuda_ndarray.CudaNdarray(theano._asarray(numpy.random.rand(*shape), dtype='float32')) a = theano._asarray(numpy.random.rand(*shape), dtype='float32') a2 = tcn.shared_constructor(a, 'a') a3 = a2.dimshuffle('x', 'x', 0, 1) b...
null
null
null
How does a template from the given template source string render ?
def render_template_string(source, **context): ctx = _app_ctx_stack.top ctx.app.update_template_context(context) return _render(ctx.app.jinja_env.from_string(source), context, ctx.app)
null
null
null
with the given context
codeqa
def render template string source **context ctx app ctx stack topctx app update template context context return render ctx app jinja env from string source context ctx app
null
null
null
null
Question: How does a template from the given template source string render ? Code: def render_template_string(source, **context): ctx = _app_ctx_stack.top ctx.app.update_template_context(context) return _render(ctx.app.jinja_env.from_string(source), context, ctx.app)
null
null
null
What does the code contain ?
def is_sorted(exp): return _contains(exp, Sorted)
null
null
null
a reduced node
codeqa
def is sorted exp return contains exp Sorted
null
null
null
null
Question: What does the code contain ? Code: def is_sorted(exp): return _contains(exp, Sorted)
null
null
null
What does the code get ?
def pkg_commit_hash(pkg_path): pth = os.path.join(pkg_path, COMMIT_INFO_FNAME) if (not os.path.isfile(pth)): raise IOError((u'Missing commit info file %s' % pth)) cfg_parser = ConfigParser() cfg_parser.read(pth) archive_subst = cfg_parser.get(u'commit hash', u'archive_subst_hash') if (not archive_subst.sta...
null
null
null
short form of commit hash given directory pkg_path
codeqa
def pkg commit hash pkg path pth os path join pkg path COMMIT INFO FNAME if not os path isfile pth raise IO Error u' Missingcommitinfofile%s' % pth cfg parser Config Parser cfg parser read pth archive subst cfg parser get u'commithash' u'archive subst hash' if not archive subst startswith u'$ Format' return u'archivesu...
null
null
null
null
Question: What does the code get ? Code: def pkg_commit_hash(pkg_path): pth = os.path.join(pkg_path, COMMIT_INFO_FNAME) if (not os.path.isfile(pth)): raise IOError((u'Missing commit info file %s' % pth)) cfg_parser = ConfigParser() cfg_parser.read(pth) archive_subst = cfg_parser.get(u'commit hash', u'ar...