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 rearranges in a tensor of shape ?
def pixel_shuffle(input, upscale_factor): (batch_size, channels, in_height, in_width) = input.size() channels //= (upscale_factor ** 2) out_height = (in_height * upscale_factor) out_width = (in_width * upscale_factor) input_view = input.contiguous().view(batch_size, channels, upscale_factor, upscale_factor, in_hei...
null
null
null
elements
codeqa
def pixel shuffle input upscale factor batch size channels in height in width input size channels // upscale factor ** 2 out height in height * upscale factor out width in width * upscale factor input view input contiguous view batch size channels upscale factor upscale factor in height in width shuffle out input view ...
null
null
null
null
Question: What rearranges in a tensor of shape ? Code: def pixel_shuffle(input, upscale_factor): (batch_size, channels, in_height, in_width) = input.size() channels //= (upscale_factor ** 2) out_height = (in_height * upscale_factor) out_width = (in_width * upscale_factor) input_view = input.contiguous().view(b...
null
null
null
Where does elements rearrange ?
def pixel_shuffle(input, upscale_factor): (batch_size, channels, in_height, in_width) = input.size() channels //= (upscale_factor ** 2) out_height = (in_height * upscale_factor) out_width = (in_width * upscale_factor) input_view = input.contiguous().view(batch_size, channels, upscale_factor, upscale_factor, in_hei...
null
null
null
in a tensor of shape
codeqa
def pixel shuffle input upscale factor batch size channels in height in width input size channels // upscale factor ** 2 out height in height * upscale factor out width in width * upscale factor input view input contiguous view batch size channels upscale factor upscale factor in height in width shuffle out input view ...
null
null
null
null
Question: Where does elements rearrange ? Code: def pixel_shuffle(input, upscale_factor): (batch_size, channels, in_height, in_width) = input.size() channels //= (upscale_factor ** 2) out_height = (in_height * upscale_factor) out_width = (in_width * upscale_factor) input_view = input.contiguous().view(batch_si...
null
null
null
When are the in - db store and directory marked as obsolete ?
@pytest.mark.django_db def test_delete_mark_obsolete(project0_nongnu, project0, store0): tp = TranslationProjectFactory(project=project0, language=LanguageDBFactory()) store = StoreDBFactory(translation_project=tp, parent=tp.directory) store.update(store.deserialize(store0.serialize())) store.sync() pootle_path = ...
null
null
null
after the on - disk file ceased to exist
codeqa
@pytest mark django dbdef test delete mark obsolete project 0 nongnu project 0 store 0 tp Translation Project Factory project project 0 language Language DB Factory store Store DB Factory translation project tp parent tp directory store update store deserialize store 0 serialize store sync pootle path store pootle path...
null
null
null
null
Question: When are the in - db store and directory marked as obsolete ? Code: @pytest.mark.django_db def test_delete_mark_obsolete(project0_nongnu, project0, store0): tp = TranslationProjectFactory(project=project0, language=LanguageDBFactory()) store = StoreDBFactory(translation_project=tp, parent=tp.directory) ...
null
null
null
What does a check test ?
def is_float(value, min=None, max=None): (min_val, max_val) = _is_num_param(('min', 'max'), (min, max), to_float=True) if (not isinstance(value, (int, long, float, basestring))): raise VdtTypeError(value) if (not isinstance(value, float)): try: value = float(value) except ValueError: raise VdtTypeError(v...
null
null
null
that a given value
codeqa
def is float value min None max None min val max val is num param 'min' 'max' min max to float True if not isinstance value int long float basestring raise Vdt Type Error value if not isinstance value float try value float value except Value Error raise Vdt Type Error value if min val is not None and value < min val ra...
null
null
null
null
Question: What does a check test ? Code: def is_float(value, min=None, max=None): (min_val, max_val) = _is_num_param(('min', 'max'), (min, max), to_float=True) if (not isinstance(value, (int, long, float, basestring))): raise VdtTypeError(value) if (not isinstance(value, float)): try: value = float(value)...
null
null
null
What tests that a given value ?
def is_float(value, min=None, max=None): (min_val, max_val) = _is_num_param(('min', 'max'), (min, max), to_float=True) if (not isinstance(value, (int, long, float, basestring))): raise VdtTypeError(value) if (not isinstance(value, float)): try: value = float(value) except ValueError: raise VdtTypeError(v...
null
null
null
a check
codeqa
def is float value min None max None min val max val is num param 'min' 'max' min max to float True if not isinstance value int long float basestring raise Vdt Type Error value if not isinstance value float try value float value except Value Error raise Vdt Type Error value if min val is not None and value < min val ra...
null
null
null
null
Question: What tests that a given value ? Code: def is_float(value, min=None, max=None): (min_val, max_val) = _is_num_param(('min', 'max'), (min, max), to_float=True) if (not isinstance(value, (int, long, float, basestring))): raise VdtTypeError(value) if (not isinstance(value, float)): try: value = float...
null
null
null
What does the code make ?
def _asarray_2d_null_rows(x): x = np.asarray(x) if (x.ndim == 1): x = x[:, None] return np.any(isnull(x), axis=1)[:, None]
null
null
null
sure input is an array and is 2d
codeqa
def asarray 2d null rows x x np asarray x if x ndim 1 x x[ None]return np any isnull x axis 1 [ None]
null
null
null
null
Question: What does the code make ? Code: def _asarray_2d_null_rows(x): x = np.asarray(x) if (x.ndim == 1): x = x[:, None] return np.any(isnull(x), axis=1)[:, None]
null
null
null
What converts to a node or leaf instance ?
def convert(grammar, raw_node): (type, value, context, children) = raw_node if (children or (type in grammar.number2symbol)): if (len(children) == 1): return children[0] return Node(type, children, context=context) else: return Leaf(type, value, context=context)
null
null
null
raw node
codeqa
def convert grammar raw node type value context children raw nodeif children or type in grammar number 2 symbol if len children 1 return children[ 0 ]return Node type children context context else return Leaf type value context context
null
null
null
null
Question: What converts to a node or leaf instance ? Code: def convert(grammar, raw_node): (type, value, context, children) = raw_node if (children or (type in grammar.number2symbol)): if (len(children) == 1): return children[0] return Node(type, children, context=context) else: return Leaf(type, value,...
null
null
null
What do raw node convert ?
def convert(grammar, raw_node): (type, value, context, children) = raw_node if (children or (type in grammar.number2symbol)): if (len(children) == 1): return children[0] return Node(type, children, context=context) else: return Leaf(type, value, context=context)
null
null
null
to a node or leaf instance
codeqa
def convert grammar raw node type value context children raw nodeif children or type in grammar number 2 symbol if len children 1 return children[ 0 ]return Node type children context context else return Leaf type value context context
null
null
null
null
Question: What do raw node convert ? Code: def convert(grammar, raw_node): (type, value, context, children) = raw_node if (children or (type in grammar.number2symbol)): if (len(children) == 1): return children[0] return Node(type, children, context=context) else: return Leaf(type, value, context=context...
null
null
null
What matches the generated code ?
def verify(): for (fname, parts) in get_sources().items(): data = generate(parts) fname = os.path.join(LIBRARY, fname) if (not (open(fname).read() == data.getvalue())): raise GenerateAnsibleException(('Generated content does not match for %s' % fname))
null
null
null
the library code
codeqa
def verify for fname parts in get sources items data generate parts fname os path join LIBRARY fname if not open fname read data getvalue raise Generate Ansible Exception ' Generatedcontentdoesnotmatchfor%s' % fname
null
null
null
null
Question: What matches the generated code ? Code: def verify(): for (fname, parts) in get_sources().items(): data = generate(parts) fname = os.path.join(LIBRARY, fname) if (not (open(fname).read() == data.getvalue())): raise GenerateAnsibleException(('Generated content does not match for %s' % fname...
null
null
null
What does the code get ?
def get_dependency_graph(package_list): result = {package: set() for package in package_list} for package in package_list: setup_file = os.path.join(PROJECT_ROOT, package, 'setup.py') with open(setup_file, 'r') as file_obj: file_contents = file_obj.read() requirements = get_required_packages(file_contents) ...
null
null
null
a directed graph of package dependencies
codeqa
def get dependency graph package list result {package set for package in package list}for package in package list setup file os path join PROJECT ROOT package 'setup py' with open setup file 'r' as file obj file contents file obj read requirements get required packages file contents for requirement in requirements if n...
null
null
null
null
Question: What does the code get ? Code: def get_dependency_graph(package_list): result = {package: set() for package in package_list} for package in package_list: setup_file = os.path.join(PROJECT_ROOT, package, 'setup.py') with open(setup_file, 'r') as file_obj: file_contents = file_obj.read() requirem...
null
null
null
What do user have ?
def _has_access_location(user, action, location, course_key): checkers = {'staff': (lambda : _has_staff_access_to_location(user, location, course_key))} return _dispatch(checkers, action, user, location)
null
null
null
access to this location
codeqa
def has access location user action location course key checkers {'staff' lambda has staff access to location user location course key }return dispatch checkers action user location
null
null
null
null
Question: What do user have ? Code: def _has_access_location(user, action, location, course_key): checkers = {'staff': (lambda : _has_staff_access_to_location(user, location, course_key))} return _dispatch(checkers, action, user, location)
null
null
null
What does the code make ?
def _create_gradient_image(size, color_from, color_to, rotation): rgb_arrays = [np.linspace(color_from[x], color_to[x], size).astype('uint8') for x in range(3)] gradient = np.concatenate(rgb_arrays) picture = np.repeat(gradient, size) picture.shape = (3, size, size) image = PIL.Image.fromarray(picture.T) image = ...
null
null
null
an image with a color gradient with a specific rotation
codeqa
def create gradient image size color from color to rotation rgb arrays [np linspace color from[x] color to[x] size astype 'uint 8 ' for x in range 3 ]gradient np concatenate rgb arrays picture np repeat gradient size picture shape 3 size size image PIL Image fromarray picture T image image rotate rotation return image
null
null
null
null
Question: What does the code make ? Code: def _create_gradient_image(size, color_from, color_to, rotation): rgb_arrays = [np.linspace(color_from[x], color_to[x], size).astype('uint8') for x in range(3)] gradient = np.concatenate(rgb_arrays) picture = np.repeat(gradient, size) picture.shape = (3, size, size) im...
null
null
null
What do characters represent ?
def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
a phone number
codeqa
def normalize diallable chars only number return normalize helper number DIALLABLE CHAR MAPPINGS True
null
null
null
null
Question: What do characters represent ? Code: def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
What is representing a phone number ?
def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
characters
codeqa
def normalize diallable chars only number return normalize helper number DIALLABLE CHAR MAPPINGS True
null
null
null
null
Question: What is representing a phone number ? Code: def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
What does the code normalize ?
def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
a string of characters representing a phone number
codeqa
def normalize diallable chars only number return normalize helper number DIALLABLE CHAR MAPPINGS True
null
null
null
null
Question: What does the code normalize ? Code: def _normalize_diallable_chars_only(number): return _normalize_helper(number, _DIALLABLE_CHAR_MAPPINGS, True)
null
null
null
What does the code send to the managers ?
def mail_managers(subject, message, fail_silently=False, connection=None, html_message=None): if (not settings.MANAGERS): return mail = EmailMultiAlternatives((u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject)), message, settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS], connection=connection) if html_mess...
null
null
null
a message
codeqa
def mail managers subject message fail silently False connection None html message None if not settings MANAGERS returnmail Email Multi Alternatives u'%s%s' % settings EMAIL SUBJECT PREFIX subject message settings SERVER EMAIL [a[ 1 ] for a in settings MANAGERS] connection connection if html message mail attach alterna...
null
null
null
null
Question: What does the code send to the managers ? Code: def mail_managers(subject, message, fail_silently=False, connection=None, html_message=None): if (not settings.MANAGERS): return mail = EmailMultiAlternatives((u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject)), message, settings.SERVER_EMAIL, [a[1] for...
null
null
null
For what purpose did extra_spec set ?
@utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of flavor.')) @utils.arg('action', metavar='<action>', choices=['set', 'unset'], help=_("Actions: 'set' or 'unset'.")) @utils.arg('metadata', metavar='<key=value>', nargs='+', action='append', default=[], help=_('Extra_specs to set/unset (only key ...
null
null
null
for a flavor
codeqa
@utils arg 'flavor' metavar '<flavor>' help ' Nameor I Dofflavor ' @utils arg 'action' metavar '<action>' choices ['set' 'unset'] help " Actions 'set'or'unset' " @utils arg 'metadata' metavar '<key value>' nargs '+' action 'append' default [] help ' Extra specstoset/unset onlykeyisnecessaryonunset ' def do flavor key c...
null
null
null
null
Question: For what purpose did extra_spec set ? Code: @utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of flavor.')) @utils.arg('action', metavar='<action>', choices=['set', 'unset'], help=_("Actions: 'set' or 'unset'.")) @utils.arg('metadata', metavar='<key=value>', nargs='+', action='append', de...
null
null
null
For what purpose did extra_spec unset ?
@utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of flavor.')) @utils.arg('action', metavar='<action>', choices=['set', 'unset'], help=_("Actions: 'set' or 'unset'.")) @utils.arg('metadata', metavar='<key=value>', nargs='+', action='append', default=[], help=_('Extra_specs to set/unset (only key ...
null
null
null
for a flavor
codeqa
@utils arg 'flavor' metavar '<flavor>' help ' Nameor I Dofflavor ' @utils arg 'action' metavar '<action>' choices ['set' 'unset'] help " Actions 'set'or'unset' " @utils arg 'metadata' metavar '<key value>' nargs '+' action 'append' default [] help ' Extra specstoset/unset onlykeyisnecessaryonunset ' def do flavor key c...
null
null
null
null
Question: For what purpose did extra_spec unset ? Code: @utils.arg('flavor', metavar='<flavor>', help=_('Name or ID of flavor.')) @utils.arg('action', metavar='<action>', choices=['set', 'unset'], help=_("Actions: 'set' or 'unset'.")) @utils.arg('metadata', metavar='<key=value>', nargs='+', action='append', ...
null
null
null
What does the code determine ?
def s_num_mutations(): return blocks.CURRENT.num_mutations()
null
null
null
the number of repetitions we will be making
codeqa
def s num mutations return blocks CURRENT num mutations
null
null
null
null
Question: What does the code determine ? Code: def s_num_mutations(): return blocks.CURRENT.num_mutations()
null
null
null
What does the code get ?
def _get_basic_info(ca_name, cert, ca_dir=None): if (ca_dir is None): ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name) index_file = '{0}/index.txt'.format(ca_dir) expire_date = _four_digit_year_to_two_digit(datetime.strptime(cert.get_notAfter(), four_digit_year_fmt)) serial_number = format(cert.get_serial_nu...
null
null
null
basic info to write out to the index
codeqa
def get basic info ca name cert ca dir None if ca dir is None ca dir '{ 0 }/{ 1 }' format cert base path ca name index file '{ 0 }/index txt' format ca dir expire date four digit year to two digit datetime strptime cert get not After four digit year fmt serial number format cert get serial number 'X' subject '/'subject...
null
null
null
null
Question: What does the code get ? Code: def _get_basic_info(ca_name, cert, ca_dir=None): if (ca_dir is None): ca_dir = '{0}/{1}'.format(_cert_base_path(), ca_name) index_file = '{0}/index.txt'.format(ca_dir) expire_date = _four_digit_year_to_two_digit(datetime.strptime(cert.get_notAfter(), four_digit_year_fmt...
null
null
null
When do thread request ?
def setUp(registry=None, request=None, hook_zca=True, autocommit=True, settings=None, package=None): manager.clear() if (registry is None): registry = Registry('testing') if (package is None): package = caller_package() config = Configurator(registry=registry, autocommit=autocommit, package=package) if (settin...
null
null
null
for the duration of a single unit test
codeqa
def set Up registry None request None hook zca True autocommit True settings None package None manager clear if registry is None registry Registry 'testing' if package is None package caller package config Configurator registry registry autocommit autocommit package package if settings is None settings {}if getattr reg...
null
null
null
null
Question: When do thread request ? Code: def setUp(registry=None, request=None, hook_zca=True, autocommit=True, settings=None, package=None): manager.clear() if (registry is None): registry = Registry('testing') if (package is None): package = caller_package() config = Configurator(registry=registry, autoco...
null
null
null
What allows access without login ?
def login_notrequired(func): func.login_notrequired = True return func
null
null
null
a decorator
codeqa
def login notrequired func func login notrequired Truereturn func
null
null
null
null
Question: What allows access without login ? Code: def login_notrequired(func): func.login_notrequired = True return func
null
null
null
How did minimum variance constrain ?
@verbose def lcmv(evoked, forward, noise_cov, data_cov, reg=0.01, label=None, pick_ori=None, picks=None, rank=None, verbose=None): _check_reference(evoked) info = evoked.info data = evoked.data tmin = evoked.times[0] picks = _setup_picks(picks, info, forward, noise_cov) data = data[picks] stc = _apply_lcmv(data=...
null
null
null
linearly
codeqa
@verbosedef lcmv evoked forward noise cov data cov reg 0 01 label None pick ori None picks None rank None verbose None check reference evoked info evoked infodata evoked datatmin evoked times[ 0 ]picks setup picks picks info forward noise cov data data[picks]stc apply lcmv data data info info tmin tmin forward forward ...
null
null
null
null
Question: How did minimum variance constrain ? Code: @verbose def lcmv(evoked, forward, noise_cov, data_cov, reg=0.01, label=None, pick_ori=None, picks=None, rank=None, verbose=None): _check_reference(evoked) info = evoked.info data = evoked.data tmin = evoked.times[0] picks = _setup_picks(picks, info, forward...
null
null
null
When do the number of data points render ?
def points_for_interval(interval): range = time_range_by_interval[interval] interval = timedelta_by_name(interval) return (range.total_seconds() / interval.total_seconds())
null
null
null
for a given interval
codeqa
def points for interval interval range time range by interval[interval]interval timedelta by name interval return range total seconds / interval total seconds
null
null
null
null
Question: When do the number of data points render ? Code: def points_for_interval(interval): range = time_range_by_interval[interval] interval = timedelta_by_name(interval) return (range.total_seconds() / interval.total_seconds())
null
null
null
What does the code calculate ?
def points_for_interval(interval): range = time_range_by_interval[interval] interval = timedelta_by_name(interval) return (range.total_seconds() / interval.total_seconds())
null
null
null
the number of data points to render for a given interval
codeqa
def points for interval interval range time range by interval[interval]interval timedelta by name interval return range total seconds / interval total seconds
null
null
null
null
Question: What does the code calculate ? Code: def points_for_interval(interval): range = time_range_by_interval[interval] interval = timedelta_by_name(interval) return (range.total_seconds() / interval.total_seconds())
null
null
null
What does the code get ?
def volume_get_all_by_host(context, host): return IMPL.volume_get_all_by_host(context, host)
null
null
null
all volumes belonging to a host
codeqa
def volume get all by host context host return IMPL volume get all by host context host
null
null
null
null
Question: What does the code get ? Code: def volume_get_all_by_host(context, host): return IMPL.volume_get_all_by_host(context, host)
null
null
null
In which direction do right * scale right * ?
def normalize_timedeltas(context, builder, left, right, leftty, rightty): factor = npdatetime.get_timedelta_conversion_factor(leftty.unit, rightty.unit) if (factor is not None): return (scale_by_constant(builder, left, factor), right) factor = npdatetime.get_timedelta_conversion_factor(rightty.unit, leftty.unit) ...
null
null
null
either * left *
codeqa
def normalize timedeltas context builder left right leftty rightty factor npdatetime get timedelta conversion factor leftty unit rightty unit if factor is not None return scale by constant builder left factor right factor npdatetime get timedelta conversion factor rightty unit leftty unit if factor is not None return l...
null
null
null
null
Question: In which direction do right * scale right * ? Code: def normalize_timedeltas(context, builder, left, right, leftty, rightty): factor = npdatetime.get_timedelta_conversion_factor(leftty.unit, rightty.unit) if (factor is not None): return (scale_by_constant(builder, left, factor), right) factor = npdat...
null
null
null
How is a string named ?
def _check_plural_is_ambiguous(plural_arg): if _STRING_RE.match(plural_arg): return False fn_match = _FUNCTION_RE.match(plural_arg) if (fn_match and (fn_match.group(1) in _functions)): return False return True
null
null
null
ambiguously
codeqa
def check plural is ambiguous plural arg if STRING RE match plural arg return Falsefn match FUNCTION RE match plural arg if fn match and fn match group 1 in functions return Falsereturn True
null
null
null
null
Question: How is a string named ? Code: def _check_plural_is_ambiguous(plural_arg): if _STRING_RE.match(plural_arg): return False fn_match = _FUNCTION_RE.match(plural_arg) if (fn_match and (fn_match.group(1) in _functions)): return False return True
null
null
null
How can it be written ?
def group_significance_output_formatter(bt, test_stats, pvals, fdr_pvals, bon_pvals, means, cat_sample_indices, md_key): header = ((['OTU', 'Test-Statistic', 'P', 'FDR_P', 'Bonferroni_P'] + [('%s_mean' % i) for i in cat_sample_indices]) + [md_key]) num_lines = len(pvals) lines = [' DCTB '.join(header)] for i in ran...
null
null
null
easily
codeqa
def group significance output formatter bt test stats pvals fdr pvals bon pvals means cat sample indices md key header ['OTU' ' Test- Statistic' 'P' 'FDR P' ' Bonferroni P'] + [ '%s mean' % i for i in cat sample indices] + [md key] num lines len pvals lines [' DCTB ' join header ]for i in range num lines tmp [bt ids ax...
null
null
null
null
Question: How can it be written ? Code: def group_significance_output_formatter(bt, test_stats, pvals, fdr_pvals, bon_pvals, means, cat_sample_indices, md_key): header = ((['OTU', 'Test-Statistic', 'P', 'FDR_P', 'Bonferroni_P'] + [('%s_mean' % i) for i in cat_sample_indices]) + [md_key]) num_lines = len(pvals) l...
null
null
null
How do commands run for minion startup ?
def _run_quiet(cmd, cwd=None, stdin=None, runas=None, shell=DEFAULT_SHELL, python_shell=False, env=None, template=None, umask=None, timeout=None, reset_system_locale=True, saltenv='base', pillarenv=None, pillar_override=None): return _run(cmd, runas=runas, cwd=cwd, stdin=stdin, stderr=subprocess.STDOUT, output_logleve...
null
null
null
quietly
codeqa
def run quiet cmd cwd None stdin None runas None shell DEFAULT SHELL python shell False env None template None umask None timeout None reset system locale True saltenv 'base' pillarenv None pillar override None return run cmd runas runas cwd cwd stdin stdin stderr subprocess STDOUT output loglevel 'quiet' log callback ...
null
null
null
null
Question: How do commands run for minion startup ? Code: def _run_quiet(cmd, cwd=None, stdin=None, runas=None, shell=DEFAULT_SHELL, python_shell=False, env=None, template=None, umask=None, timeout=None, reset_system_locale=True, saltenv='base', pillarenv=None, pillar_override=None): return _run(cmd, runas=runas, c...
null
null
null
For what purpose do commands run quietly ?
def _run_quiet(cmd, cwd=None, stdin=None, runas=None, shell=DEFAULT_SHELL, python_shell=False, env=None, template=None, umask=None, timeout=None, reset_system_locale=True, saltenv='base', pillarenv=None, pillar_override=None): return _run(cmd, runas=runas, cwd=cwd, stdin=stdin, stderr=subprocess.STDOUT, output_logleve...
null
null
null
for minion startup
codeqa
def run quiet cmd cwd None stdin None runas None shell DEFAULT SHELL python shell False env None template None umask None timeout None reset system locale True saltenv 'base' pillarenv None pillar override None return run cmd runas runas cwd cwd stdin stdin stderr subprocess STDOUT output loglevel 'quiet' log callback ...
null
null
null
null
Question: For what purpose do commands run quietly ? Code: def _run_quiet(cmd, cwd=None, stdin=None, runas=None, shell=DEFAULT_SHELL, python_shell=False, env=None, template=None, umask=None, timeout=None, reset_system_locale=True, saltenv='base', pillarenv=None, pillar_override=None): return _run(cmd, runas=runas,...
null
null
null
When does code run ?
def Application_BeginRequest(app, e): pass
null
null
null
at the beginning of each request
codeqa
def Application Begin Request app e pass
null
null
null
null
Question: When does code run ? Code: def Application_BeginRequest(app, e): pass
null
null
null
What does the code compute ?
def get_distributions_for_columns(data, columns): domain = data.domain columns = [(col if isinstance(col, int) else domain.index(col)) for col in columns] try: dist_unks = data._compute_distributions(columns) except NotImplementedError: return [get_distribution(data, i) for i in columns] else: return [get_di...
null
null
null
the distributions for columns
codeqa
def get distributions for columns data columns domain data domaincolumns [ col if isinstance col int else domain index col for col in columns]try dist unks data compute distributions columns except Not Implemented Error return [get distribution data i for i in columns]else return [get distribution dist domain[col] unkn...
null
null
null
null
Question: What does the code compute ? Code: def get_distributions_for_columns(data, columns): domain = data.domain columns = [(col if isinstance(col, int) else domain.index(col)) for col in columns] try: dist_unks = data._compute_distributions(columns) except NotImplementedError: return [get_distribution(d...
null
null
null
What does the code add to the current axes ?
def volume_overlay2(ax, closes, volumes, colorup=u'k', colordown=u'r', width=4, alpha=1.0): return volume_overlay(ax, closes[:(-1)], closes[1:], volumes[1:], colorup, colordown, width, alpha)
null
null
null
a volume overlay
codeqa
def volume overlay 2 ax closes volumes colorup u'k' colordown u'r' width 4 alpha 1 0 return volume overlay ax closes[ -1 ] closes[ 1 ] volumes[ 1 ] colorup colordown width alpha
null
null
null
null
Question: What does the code add to the current axes ? Code: def volume_overlay2(ax, closes, volumes, colorup=u'k', colordown=u'r', width=4, alpha=1.0): return volume_overlay(ax, closes[:(-1)], closes[1:], volumes[1:], colorup, colordown, width, alpha)
null
null
null
What has the code ensures ?
def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
a request has permission to access the given quota class
codeqa
def authorize quota class context context class name if is user context context if not context quota class raise exception Forbidden elif context quota class class name raise exception Forbidden
null
null
null
null
Question: What has the code ensures ? Code: def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
What does a request have ?
def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
permission to access the given quota class
codeqa
def authorize quota class context context class name if is user context context if not context quota class raise exception Forbidden elif context quota class class name raise exception Forbidden
null
null
null
null
Question: What does a request have ? Code: def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
What has permission to access the given quota class ?
def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
a request
codeqa
def authorize quota class context context class name if is user context context if not context quota class raise exception Forbidden elif context quota class class name raise exception Forbidden
null
null
null
null
Question: What has permission to access the given quota class ? Code: def authorize_quota_class_context(context, class_name): if is_user_context(context): if (not context.quota_class): raise exception.Forbidden() elif (context.quota_class != class_name): raise exception.Forbidden()
null
null
null
What does the code create ?
def connect_to_images(region=None, public=True): return _create_client(ep_name='image', region=region, public=public)
null
null
null
a client for working with images
codeqa
def connect to images region None public True return create client ep name 'image' region region public public
null
null
null
null
Question: What does the code create ? Code: def connect_to_images(region=None, public=True): return _create_client(ep_name='image', region=region, public=public)
null
null
null
What does the code have on or before first_date and on or after last_date ?
def has_data_for_dates(series_or_df, first_date, last_date): dts = series_or_df.index if (not isinstance(dts, pd.DatetimeIndex)): raise TypeError(('Expected a DatetimeIndex, but got %s.' % type(dts))) (first, last) = dts[[0, (-1)]] return ((first <= first_date) and (last >= last_date))
null
null
null
data
codeqa
def has data for dates series or df first date last date dts series or df indexif not isinstance dts pd Datetime Index raise Type Error ' Expecteda Datetime Index butgot%s ' % type dts first last dts[[ 0 -1 ]]return first < first date and last > last date
null
null
null
null
Question: What does the code have on or before first_date and on or after last_date ? Code: def has_data_for_dates(series_or_df, first_date, last_date): dts = series_or_df.index if (not isinstance(dts, pd.DatetimeIndex)): raise TypeError(('Expected a DatetimeIndex, but got %s.' % type(dts))) (first, last)...
null
null
null
When does the code have the code data ?
def has_data_for_dates(series_or_df, first_date, last_date): dts = series_or_df.index if (not isinstance(dts, pd.DatetimeIndex)): raise TypeError(('Expected a DatetimeIndex, but got %s.' % type(dts))) (first, last) = dts[[0, (-1)]] return ((first <= first_date) and (last >= last_date))
null
null
null
on or before first_date and on or after last_date
codeqa
def has data for dates series or df first date last date dts series or df indexif not isinstance dts pd Datetime Index raise Type Error ' Expecteda Datetime Index butgot%s ' % type dts first last dts[[ 0 -1 ]]return first < first date and last > last date
null
null
null
null
Question: When does the code have the code data ? Code: def has_data_for_dates(series_or_df, first_date, last_date): dts = series_or_df.index if (not isinstance(dts, pd.DatetimeIndex)): raise TypeError(('Expected a DatetimeIndex, but got %s.' % type(dts))) (first, last) = dts[[0, (-1)]] return ((first <=...
null
null
null
What do the entire phrase contain ?
def phrase_text_for_head(tokens, text, head_index): (begin, end) = phrase_extent_for_head(tokens, head_index) return text[begin:end]
null
null
null
the head token
codeqa
def phrase text for head tokens text head index begin end phrase extent for head tokens head index return text[begin end]
null
null
null
null
Question: What do the entire phrase contain ? Code: def phrase_text_for_head(tokens, text, head_index): (begin, end) = phrase_extent_for_head(tokens, head_index) return text[begin:end]
null
null
null
What is containing the head token ?
def phrase_text_for_head(tokens, text, head_index): (begin, end) = phrase_extent_for_head(tokens, head_index) return text[begin:end]
null
null
null
the entire phrase
codeqa
def phrase text for head tokens text head index begin end phrase extent for head tokens head index return text[begin end]
null
null
null
null
Question: What is containing the head token ? Code: def phrase_text_for_head(tokens, text, head_index): (begin, end) = phrase_extent_for_head(tokens, head_index) return text[begin:end]
null
null
null
What does the code add to the cache dictionary ?
def AddModuleToCache(typelibclsid, lcid, major, minor, verbose=1, bFlushNow=(not is_readonly)): fname = GetGeneratedFileName(typelibclsid, lcid, major, minor) mod = _GetModule(fname) mod._in_gencache_ = 1 dict = mod.CLSIDToClassMap info = (str(typelibclsid), lcid, major, minor) for (clsid, cls) in dict.iteritems(...
null
null
null
a newly generated file
codeqa
def Add Module To Cache typelibclsid lcid major minor verbose 1 b Flush Now not is readonly fname Get Generated File Name typelibclsid lcid major minor mod Get Module fname mod in gencache 1dict mod CLSID To Class Mapinfo str typelibclsid lcid major minor for clsid cls in dict iteritems clsid To Typelib[clsid] infodict...
null
null
null
null
Question: What does the code add to the cache dictionary ? Code: def AddModuleToCache(typelibclsid, lcid, major, minor, verbose=1, bFlushNow=(not is_readonly)): fname = GetGeneratedFileName(typelibclsid, lcid, major, minor) mod = _GetModule(fname) mod._in_gencache_ = 1 dict = mod.CLSIDToClassMap info = (str(ty...
null
null
null
When did file generate ?
def AddModuleToCache(typelibclsid, lcid, major, minor, verbose=1, bFlushNow=(not is_readonly)): fname = GetGeneratedFileName(typelibclsid, lcid, major, minor) mod = _GetModule(fname) mod._in_gencache_ = 1 dict = mod.CLSIDToClassMap info = (str(typelibclsid), lcid, major, minor) for (clsid, cls) in dict.iteritems(...
null
null
null
newly
codeqa
def Add Module To Cache typelibclsid lcid major minor verbose 1 b Flush Now not is readonly fname Get Generated File Name typelibclsid lcid major minor mod Get Module fname mod in gencache 1dict mod CLSID To Class Mapinfo str typelibclsid lcid major minor for clsid cls in dict iteritems clsid To Typelib[clsid] infodict...
null
null
null
null
Question: When did file generate ? Code: def AddModuleToCache(typelibclsid, lcid, major, minor, verbose=1, bFlushNow=(not is_readonly)): fname = GetGeneratedFileName(typelibclsid, lcid, major, minor) mod = _GetModule(fname) mod._in_gencache_ = 1 dict = mod.CLSIDToClassMap info = (str(typelibclsid), lcid, major...
null
null
null
What upgrades on all virtual machines present in the specified provider ?
def upgrade_tools_all(call=None): if (call != 'function'): raise SaltCloudSystemExit('The upgrade_tools_all function must be called with -f or --function.') ret = {} vm_properties = ['name'] vm_list = salt.utils.vmware.get_mors_with_properties(_get_si(), vim.VirtualMachine, vm_properties) for vm in vm_l...
null
null
null
vmware tools
codeqa
def upgrade tools all call None if call 'function' raise Salt Cloud System Exit ' Theupgrade tools allfunctionmustbecalledwith-for--function ' ret {}vm properties ['name']vm list salt utils vmware get mors with properties get si vim Virtual Machine vm properties for vm in vm list ret[vm['name']] upg tools helper vm['ob...
null
null
null
null
Question: What upgrades on all virtual machines present in the specified provider ? Code: def upgrade_tools_all(call=None): if (call != 'function'): raise SaltCloudSystemExit('The upgrade_tools_all function must be called with -f or --function.') ret = {} vm_properties = ['name'] vm_list = salt.utils...
null
null
null
What does the code extract ?
def _sign(dval): bb = _double_as_bytes(dval) return ((bb[0] >> 7) & 1)
null
null
null
the sign bit
codeqa
def sign dval bb double as bytes dval return bb[ 0 ] >> 7 & 1
null
null
null
null
Question: What does the code extract ? Code: def _sign(dval): bb = _double_as_bytes(dval) return ((bb[0] >> 7) & 1)
null
null
null
What does the code create ?
def create_message(ctxt, project_id='fake_project', request_id='test_backup', resource_type='This is a test backup', resource_uuid='3asf434-3s433df43-434adf3-343df443', event_id=None, message_level='Error'): expires_at = (timeutils.utcnow() + datetime.timedelta(seconds=30)) message_record = {'project_id': project...
null
null
null
a message in the db
codeqa
def create message ctxt project id 'fake project' request id 'test backup' resource type ' Thisisatestbackup' resource uuid '3 asf 434 - 3 s 433 df 43 - 434 adf 3 - 343 df 443 ' event id None message level ' Error' expires at timeutils utcnow + datetime timedelta seconds 30 message record {'project id' project id 'requ...
null
null
null
null
Question: What does the code create ? Code: def create_message(ctxt, project_id='fake_project', request_id='test_backup', resource_type='This is a test backup', resource_uuid='3asf434-3s433df43-434adf3-343df443', event_id=None, message_level='Error'): expires_at = (timeutils.utcnow() + datetime.timedelta(secon...
null
null
null
How do a bundle register ?
def register(name, *args, **kwargs): if (len(args) == 0): raise TypeError('at least two arguments are required') else: if ((len(args) == 1) and (not kwargs) and isinstance(args[0], Bundle)): bundle = args[0] else: bundle = Bundle(*args, **kwargs) global _REGISTRY if (name in _REGISTRY): if (_R...
null
null
null
with the given name
codeqa
def register name *args **kwargs if len args 0 raise Type Error 'atleasttwoargumentsarerequired' else if len args 1 and not kwargs and isinstance args[ 0 ] Bundle bundle args[ 0 ]else bundle Bundle *args **kwargs global REGISTR Yif name in REGISTRY if REGISTRY[name] bundle passelse raise Registry Error ' Anotherbundlei...
null
null
null
null
Question: How do a bundle register ? Code: def register(name, *args, **kwargs): if (len(args) == 0): raise TypeError('at least two arguments are required') else: if ((len(args) == 1) and (not kwargs) and isinstance(args[0], Bundle)): bundle = args[0] else: bundle = Bundle(*args, **kwargs) globa...
null
null
null
What does the code make ?
def getNumsFromBytes(bytes, bitsPerComponent=8): if (not isinstance(bytes, str)): return ((-1), 'bytes must be a string') if (not isinstance(bitsPerComponent, int)): return ((-1), 'bitsPerComponent must be an integer') outputComponents = [] bitsStream = '' for byte in bytes: try: bitsRepresentatio...
null
null
null
the conversion between bytes and numbers
codeqa
def get Nums From Bytes bytes bits Per Component 8 if not isinstance bytes str return -1 'bytesmustbeastring' if not isinstance bits Per Component int return -1 'bits Per Componentmustbeaninteger' output Components []bits Stream ''for byte in bytes try bits Representation bin ord byte bits Representation bits Represent...
null
null
null
null
Question: What does the code make ? Code: def getNumsFromBytes(bytes, bitsPerComponent=8): if (not isinstance(bytes, str)): return ((-1), 'bytes must be a string') if (not isinstance(bitsPerComponent, int)): return ((-1), 'bitsPerComponent must be an integer') outputComponents = [] bitsStream = '' ...
null
null
null
What does the code make ?
@requires_duration def fadeout(clip, duration, final_color=None): if (final_color is None): final_color = (0 if clip.ismask else [0, 0, 0]) final_color = np.array(final_color) def fl(gf, t): if ((clip.duration - t) >= duration): return gf(t) else: fading = ((1.0 * (clip.duration - t)) / duration) retu...
null
null
null
the clip progressively fade to some color
codeqa
@requires durationdef fadeout clip duration final color None if final color is None final color 0 if clip ismask else [0 0 0] final color np array final color def fl gf t if clip duration - t > duration return gf t else fading 1 0 * clip duration - t / duration return fading * gf t + 1 - fading * final color return cli...
null
null
null
null
Question: What does the code make ? Code: @requires_duration def fadeout(clip, duration, final_color=None): if (final_color is None): final_color = (0 if clip.ismask else [0, 0, 0]) final_color = np.array(final_color) def fl(gf, t): if ((clip.duration - t) >= duration): return gf(t) else: fading = ((...
null
null
null
How does the clip fade to some color ?
@requires_duration def fadeout(clip, duration, final_color=None): if (final_color is None): final_color = (0 if clip.ismask else [0, 0, 0]) final_color = np.array(final_color) def fl(gf, t): if ((clip.duration - t) >= duration): return gf(t) else: fading = ((1.0 * (clip.duration - t)) / duration) retu...
null
null
null
progressively
codeqa
@requires durationdef fadeout clip duration final color None if final color is None final color 0 if clip ismask else [0 0 0] final color np array final color def fl gf t if clip duration - t > duration return gf t else fading 1 0 * clip duration - t / duration return fading * gf t + 1 - fading * final color return cli...
null
null
null
null
Question: How does the clip fade to some color ? Code: @requires_duration def fadeout(clip, duration, final_color=None): if (final_color is None): final_color = (0 if clip.ismask else [0, 0, 0]) final_color = np.array(final_color) def fl(gf, t): if ((clip.duration - t) >= duration): return gf(t) else: ...
null
null
null
In which direction do the parent hierarchy trace ?
def get_assignments_for_problem(problem_descriptor, user_id, course_key): locations = [] current_descriptor = problem_descriptor while current_descriptor: locations.append(current_descriptor.location) current_descriptor = current_descriptor.get_parent() assignments = GradedAssignment.objects.filter(user=user_id...
null
null
null
from a given problem
codeqa
def get assignments for problem problem descriptor user id course key locations []current descriptor problem descriptorwhile current descriptor locations append current descriptor location current descriptor current descriptor get parent assignments Graded Assignment objects filter user user id course key course key us...
null
null
null
null
Question: In which direction do the parent hierarchy trace ? Code: def get_assignments_for_problem(problem_descriptor, user_id, course_key): locations = [] current_descriptor = problem_descriptor while current_descriptor: locations.append(current_descriptor.location) current_descriptor = current_descriptor.g...
null
null
null
What does the code ensure ?
def absent(name, **client_args): ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'User {0} is not present'.format(name)} if __salt__['influxdb.user_exists'](name, **client_args): if __opts__['test']: ret['result'] = None ret['comment'] = 'User {0} will be removed'.format(name) return...
null
null
null
that given user is absent
codeqa
def absent name **client args ret {'name' name 'changes' {} 'result' True 'comment' ' User{ 0 }isnotpresent' format name }if salt ['influxdb user exists'] name **client args if opts ['test'] ret['result'] Noneret['comment'] ' User{ 0 }willberemoved' format name return retelif salt ['influxdb remove user'] name **client...
null
null
null
null
Question: What does the code ensure ? Code: def absent(name, **client_args): ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'User {0} is not present'.format(name)} if __salt__['influxdb.user_exists'](name, **client_args): if __opts__['test']: ret['result'] = None ret['comment'] = 'User...
null
null
null
Who has an award ?
@receiver(badge_was_awarded) def notify_award_recipient(sender, award, **kwargs): if (not settings.STAGE): send_award_notification.delay(award)
null
null
null
he / she
codeqa
@receiver badge was awarded def notify award recipient sender award **kwargs if not settings STAGE send award notification delay award
null
null
null
null
Question: Who has an award ? Code: @receiver(badge_was_awarded) def notify_award_recipient(sender, award, **kwargs): if (not settings.STAGE): send_award_notification.delay(award)
null
null
null
What does he / she have ?
@receiver(badge_was_awarded) def notify_award_recipient(sender, award, **kwargs): if (not settings.STAGE): send_award_notification.delay(award)
null
null
null
an award
codeqa
@receiver badge was awarded def notify award recipient sender award **kwargs if not settings STAGE send award notification delay award
null
null
null
null
Question: What does he / she have ? Code: @receiver(badge_was_awarded) def notify_award_recipient(sender, award, **kwargs): if (not settings.STAGE): send_award_notification.delay(award)
null
null
null
How did executable link ?
def get_dependencies(name, environ): PIPE = subprocess.PIPE if (sys.platform == u'darwin'): proc = subprocess.Popen((u'otool -L `which %s`' % name), stdout=PIPE, stderr=PIPE, shell=True, env=environ) elif (u'linux' in sys.platform): proc = subprocess.Popen((u'ldd `which %s`' % name), stdout=PIPE, stderr=PIP...
null
null
null
dynamically
codeqa
def get dependencies name environ PIPE subprocess PIP Eif sys platform u'darwin' proc subprocess Popen u'otool-L`which%s`' % name stdout PIPE stderr PIPE shell True env environ elif u'linux' in sys platform proc subprocess Popen u'ldd`which%s`' % name stdout PIPE stderr PIPE shell True env environ else return u' Platfo...
null
null
null
null
Question: How did executable link ? Code: def get_dependencies(name, environ): PIPE = subprocess.PIPE if (sys.platform == u'darwin'): proc = subprocess.Popen((u'otool -L `which %s`' % name), stdout=PIPE, stderr=PIPE, shell=True, env=environ) elif (u'linux' in sys.platform): proc = subprocess.Popen((u'ldd ...
null
null
null
What contains only a single < table > ?
def from_html_one(html_code, **kwargs): tables = from_html(html_code, **kwargs) try: assert (len(tables) == 1) except AssertionError: raise Exception('More than one <table> in provided HTML code! Use from_html instead.') return tables[0]
null
null
null
a string
codeqa
def from html one html code **kwargs tables from html html code **kwargs try assert len tables 1 except Assertion Error raise Exception ' Morethanone<table>inprovided HTM Lcode Usefrom htmlinstead ' return tables[ 0 ]
null
null
null
null
Question: What contains only a single < table > ? Code: def from_html_one(html_code, **kwargs): tables = from_html(html_code, **kwargs) try: assert (len(tables) == 1) except AssertionError: raise Exception('More than one <table> in provided HTML code! Use from_html instead.') return tables[0]
null
null
null
What does a string contain ?
def from_html_one(html_code, **kwargs): tables = from_html(html_code, **kwargs) try: assert (len(tables) == 1) except AssertionError: raise Exception('More than one <table> in provided HTML code! Use from_html instead.') return tables[0]
null
null
null
only a single < table >
codeqa
def from html one html code **kwargs tables from html html code **kwargs try assert len tables 1 except Assertion Error raise Exception ' Morethanone<table>inprovided HTM Lcode Usefrom htmlinstead ' return tables[ 0 ]
null
null
null
null
Question: What does a string contain ? Code: def from_html_one(html_code, **kwargs): tables = from_html(html_code, **kwargs) try: assert (len(tables) == 1) except AssertionError: raise Exception('More than one <table> in provided HTML code! Use from_html instead.') return tables[0]
null
null
null
What does the code calculate ?
def image_entropy(img): hist = img.histogram() hist_size = sum(hist) hist = [(float(h) / hist_size) for h in hist] return (- sum([(p * math.log(p, 2)) for p in hist if (p != 0)]))
null
null
null
the entropy of an image
codeqa
def image entropy img hist img histogram hist size sum hist hist [ float h / hist size for h in hist]return - sum [ p * math log p 2 for p in hist if p 0 ]
null
null
null
null
Question: What does the code calculate ? Code: def image_entropy(img): hist = img.histogram() hist_size = sum(hist) hist = [(float(h) / hist_size) for h in hist] return (- sum([(p * math.log(p, 2)) for p in hist if (p != 0)]))
null
null
null
How do an identifier quote ?
def quote(mixed, ident): if isinstance(mixed, Dialect): dialect = mixed else: dialect = get_bind(mixed).dialect return dialect.preparer(dialect).quote(ident)
null
null
null
conditionally
codeqa
def quote mixed ident if isinstance mixed Dialect dialect mixedelse dialect get bind mixed dialectreturn dialect preparer dialect quote ident
null
null
null
null
Question: How do an identifier quote ? Code: def quote(mixed, ident): if isinstance(mixed, Dialect): dialect = mixed else: dialect = get_bind(mixed).dialect return dialect.preparer(dialect).quote(ident)
null
null
null
What does the code parse ?
def parse_unified_diff_output(lines): adds = [] removes = [] for line in lines: if ((len(line) > 2) and ((line[:3] == '+++') or (line[:3] == '---'))): continue elif ((len(line) > 1) and (line[:2] == '@@')): continue elif ((len(line) > 0) and (line[0] == '+')): added_line = line[1:].lstrip().rstrip() ...
null
null
null
the unified diff output of two files
codeqa
def parse unified diff output lines adds []removes []for line in lines if len line > 2 and line[ 3] '+++' or line[ 3] '---' continueelif len line > 1 and line[ 2] '@@' continueelif len line > 0 and line[ 0 ] '+' added line line[ 1 ] lstrip rstrip if len added line 0 continueadds adds + [added line] elif len line > 0 an...
null
null
null
null
Question: What does the code parse ? Code: def parse_unified_diff_output(lines): adds = [] removes = [] for line in lines: if ((len(line) > 2) and ((line[:3] == '+++') or (line[:3] == '---'))): continue elif ((len(line) > 1) and (line[:2] == '@@')): continue elif ((len(line) > 0) and (line[0] == '+')...
null
null
null
What does the code create ?
def label_for_filter(model, field_name, lookup_expr, exclude=False): name = verbose_field_name(model, field_name) verbose_expression = ([_('exclude'), name] if exclude else [name]) if isinstance(lookup_expr, six.string_types): verbose_expression += [verbose_lookup_expr(lookup_expr)] verbose_expression = [force_te...
null
null
null
a generic label suitable for a filter
codeqa
def label for filter model field name lookup expr exclude False name verbose field name model field name verbose expression [ 'exclude' name] if exclude else [name] if isinstance lookup expr six string types verbose expression + [verbose lookup expr lookup expr ]verbose expression [force text part for part in verbose e...
null
null
null
null
Question: What does the code create ? Code: def label_for_filter(model, field_name, lookup_expr, exclude=False): name = verbose_field_name(model, field_name) verbose_expression = ([_('exclude'), name] if exclude else [name]) if isinstance(lookup_expr, six.string_types): verbose_expression += [verbose_lookup_ex...
null
null
null
What does the code create ?
def zeros(shape, dtype=None): if (not isinstance(shape, (list, tuple, TensorVariable))): shape = [shape] if (dtype is None): dtype = config.floatX return alloc(numpy.array(0, dtype=dtype), *shape)
null
null
null
a tensor filled with zeros
codeqa
def zeros shape dtype None if not isinstance shape list tuple Tensor Variable shape [shape]if dtype is None dtype config float Xreturn alloc numpy array 0 dtype dtype *shape
null
null
null
null
Question: What does the code create ? Code: def zeros(shape, dtype=None): if (not isinstance(shape, (list, tuple, TensorVariable))): shape = [shape] if (dtype is None): dtype = config.floatX return alloc(numpy.array(0, dtype=dtype), *shape)
null
null
null
Do users use passwords to login via ssh ?
def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
No
codeqa
def disable password auth sshd config '/etc/ssh/sshd config' update ssh setting sshd config ' Password Authentication' 'no'
null
null
null
null
Question: Do users use passwords to login via ssh ? Code: def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
How do users login ?
def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
via ssh
codeqa
def disable password auth sshd config '/etc/ssh/sshd config' update ssh setting sshd config ' Password Authentication' 'no'
null
null
null
null
Question: How do users login ? Code: def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
What does the code not allow ?
def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
users to use passwords to login via ssh
codeqa
def disable password auth sshd config '/etc/ssh/sshd config' update ssh setting sshd config ' Password Authentication' 'no'
null
null
null
null
Question: What does the code not allow ? Code: def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
Does the code allow users to use passwords to login via ssh ?
def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
No
codeqa
def disable password auth sshd config '/etc/ssh/sshd config' update ssh setting sshd config ' Password Authentication' 'no'
null
null
null
null
Question: Does the code allow users to use passwords to login via ssh ? Code: def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
What do users use passwords ?
def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
to login via ssh
codeqa
def disable password auth sshd config '/etc/ssh/sshd config' update ssh setting sshd config ' Password Authentication' 'no'
null
null
null
null
Question: What do users use passwords ? Code: def disable_password_auth(sshd_config='/etc/ssh/sshd_config'): _update_ssh_setting(sshd_config, 'PasswordAuthentication', 'no')
null
null
null
What does the code validate ?
def validate_publicname(username): if (len(username) < 3): return 'Public name must be at least 3 characters in length' if (len(username) > 255): return 'Public name cannot be more than 255 characters in length' if (not VALID_PUBLICNAME_RE.match(username)): return "Public name must contain...
null
null
null
the public username
codeqa
def validate publicname username if len username < 3 return ' Publicnamemustbeatleast 3 charactersinlength'if len username > 255 return ' Publicnamecannotbemorethan 255 charactersinlength'if not VALID PUBLICNAME RE match username return " Publicnamemustcontainonlylower-caseletters numbersand'-'"return ''
null
null
null
null
Question: What does the code validate ? Code: def validate_publicname(username): if (len(username) < 3): return 'Public name must be at least 3 characters in length' if (len(username) > 255): return 'Public name cannot be more than 255 characters in length' if (not VALID_PUBLICNAME_RE.match...
null
null
null
What does the code ensure ?
def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines in getTestOutput(): AreEqual(removePrompts(lines)...
null
null
null
empty lines do not break the console
codeqa
def test newlines super Console Send Keys 'output Redirect Start{ }{ }{ENTER}' super Console Send Keys '{ENTER}' super Console Send Keys ' None{ENTER}' super Console Send Keys '{ENTER}{ENTER}{ENTER}' super Console Send Keys 'output Redirect Stop{ }{ }{ENTER}' for lines in get Test Output Are Equal remove Prompts lines ...
null
null
null
null
Question: What does the code ensure ? Code: def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines in ...
null
null
null
Do empty lines break the console ?
def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines in getTestOutput(): AreEqual(removePrompts(lines)...
null
null
null
No
codeqa
def test newlines super Console Send Keys 'output Redirect Start{ }{ }{ENTER}' super Console Send Keys '{ENTER}' super Console Send Keys ' None{ENTER}' super Console Send Keys '{ENTER}{ENTER}{ENTER}' super Console Send Keys 'output Redirect Stop{ }{ }{ENTER}' for lines in get Test Output Are Equal remove Prompts lines ...
null
null
null
null
Question: Do empty lines break the console ? Code: def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for li...
null
null
null
What do empty lines not break ?
def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines in getTestOutput(): AreEqual(removePrompts(lines)...
null
null
null
the console
codeqa
def test newlines super Console Send Keys 'output Redirect Start{ }{ }{ENTER}' super Console Send Keys '{ENTER}' super Console Send Keys ' None{ENTER}' super Console Send Keys '{ENTER}{ENTER}{ENTER}' super Console Send Keys 'output Redirect Stop{ }{ }{ENTER}' for lines in get Test Output Are Equal remove Prompts lines ...
null
null
null
null
Question: What do empty lines not break ? Code: def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines...
null
null
null
What do not break the console ?
def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines in getTestOutput(): AreEqual(removePrompts(lines)...
null
null
null
empty lines
codeqa
def test newlines super Console Send Keys 'output Redirect Start{ }{ }{ENTER}' super Console Send Keys '{ENTER}' super Console Send Keys ' None{ENTER}' super Console Send Keys '{ENTER}{ENTER}{ENTER}' super Console Send Keys 'output Redirect Stop{ }{ }{ENTER}' for lines in get Test Output Are Equal remove Prompts lines ...
null
null
null
null
Question: What do not break the console ? Code: def test_newlines(): superConsole.SendKeys('outputRedirectStart{(}{)}{ENTER}') superConsole.SendKeys('{ENTER}') superConsole.SendKeys('None{ENTER}') superConsole.SendKeys('{ENTER}{ENTER}{ENTER}') superConsole.SendKeys('outputRedirectStop{(}{)}{ENTER}') for lines...
null
null
null
What did the code give ?
def customer_gateway_exists(customer_gateway_id=None, customer_gateway_name=None, region=None, key=None, keyid=None, profile=None): return resource_exists('customer_gateway', name=customer_gateway_name, resource_id=customer_gateway_id, region=region, key=key, keyid=keyid, profile=profile)
null
null
null
a customer gateway i d
codeqa
def customer gateway exists customer gateway id None customer gateway name None region None key None keyid None profile None return resource exists 'customer gateway' name customer gateway name resource id customer gateway id region region key key keyid keyid profile profile
null
null
null
null
Question: What did the code give ? Code: def customer_gateway_exists(customer_gateway_id=None, customer_gateway_name=None, region=None, key=None, keyid=None, profile=None): return resource_exists('customer_gateway', name=customer_gateway_name, resource_id=customer_gateway_id, region=region, key=key, keyid=keyid, p...
null
null
null
Where is the key the daemons name and the value a boolean indicating its status ?
def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match = start_daemon_call_regex.match(line) if match: line = line[len(match.group(1)):] for daemon...
null
null
null
a dict
codeqa
def get rc daemons flags {}try with salt utils fopen '/etc/rc' 'r' as handle lines handle readlines except IO Error log error ' Unabletoread/etc/rc' else for line in lines match start daemon call regex match line if match line line[len match group 1 ]for daemon in start daemon parameter regex findall line daemons flags...
null
null
null
null
Question: Where is the key the daemons name and the value a boolean indicating its status ? Code: def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match =...
null
null
null
What do a boolean indicate ?
def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match = start_daemon_call_regex.match(line) if match: line = line[len(match.group(1)):] for daemon...
null
null
null
its status
codeqa
def get rc daemons flags {}try with salt utils fopen '/etc/rc' 'r' as handle lines handle readlines except IO Error log error ' Unabletoread/etc/rc' else for line in lines match start daemon call regex match line if match line line[len match group 1 ]for daemon in start daemon parameter regex findall line daemons flags...
null
null
null
null
Question: What do a boolean indicate ? Code: def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match = start_daemon_call_regex.match(line) if match: ...
null
null
null
What is indicating its status ?
def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match = start_daemon_call_regex.match(line) if match: line = line[len(match.group(1)):] for daemon...
null
null
null
a boolean
codeqa
def get rc daemons flags {}try with salt utils fopen '/etc/rc' 'r' as handle lines handle readlines except IO Error log error ' Unabletoread/etc/rc' else for line in lines match start daemon call regex match line if match line line[len match group 1 ]for daemon in start daemon parameter regex findall line daemons flags...
null
null
null
null
Question: What is indicating its status ? Code: def _get_rc(): daemons_flags = {} try: with salt.utils.fopen('/etc/rc', 'r') as handle: lines = handle.readlines() except IOError: log.error('Unable to read /etc/rc') else: for line in lines: match = start_daemon_call_regex.match(line) if match: ...
null
null
null
What will return all packages for which the pattern is a match ?
def _get_version(name, results): for line in salt.utils.itertools.split(results, '\n'): if (not line): continue try: (pkgname, pkgver) = line.rsplit('-', 1) except ValueError: continue if (pkgname == name): return pkgver return None
null
null
null
pkg search
codeqa
def get version name results for line in salt utils itertools split results '\n' if not line continuetry pkgname pkgver line rsplit '-' 1 except Value Error continueif pkgname name return pkgverreturn None
null
null
null
null
Question: What will return all packages for which the pattern is a match ? Code: def _get_version(name, results): for line in salt.utils.itertools.split(results, '\n'): if (not line): continue try: (pkgname, pkgver) = line.rsplit('-', 1) except ValueError: continue if (pkgname == name): return ...
null
null
null
What will pkg search return ?
def _get_version(name, results): for line in salt.utils.itertools.split(results, '\n'): if (not line): continue try: (pkgname, pkgver) = line.rsplit('-', 1) except ValueError: continue if (pkgname == name): return pkgver return None
null
null
null
all packages for which the pattern is a match
codeqa
def get version name results for line in salt utils itertools split results '\n' if not line continuetry pkgname pkgver line rsplit '-' 1 except Value Error continueif pkgname name return pkgverreturn None
null
null
null
null
Question: What will pkg search return ? Code: def _get_version(name, results): for line in salt.utils.itertools.split(results, '\n'): if (not line): continue try: (pkgname, pkgver) = line.rsplit('-', 1) except ValueError: continue if (pkgname == name): return pkgver return None
null
null
null
What does the code approve ?
@csrf_protect @permission_required('comments.can_moderate') def approve(request, comment_id, next=None): comment = get_object_or_404(comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID) if (request.method == 'POST'): perform_approve(request, comment) return next_redirect(request, next, approve_done, c=...
null
null
null
a comment
codeqa
@csrf protect@permission required 'comments can moderate' def approve request comment id next None comment get object or 404 comments get model pk comment id site pk settings SITE ID if request method 'POST' perform approve request comment return next redirect request next approve done c comment pk else return render t...
null
null
null
null
Question: What does the code approve ? Code: @csrf_protect @permission_required('comments.can_moderate') def approve(request, comment_id, next=None): comment = get_object_or_404(comments.get_model(), pk=comment_id, site__pk=settings.SITE_ID) if (request.method == 'POST'): perform_approve(request, comment) ret...
null
null
null
How did data values chop ?
def test_read_weird(): table = '\n Col1 | Col2 |\n 1.2 "hello"\n 2.4 sdf\'s worlds\n' reader = ascii.get_reader(Reader=ascii.FixedWidth) dat = reader.read(table) assert_equal(dat.colnames, ['Col1', 'Col2']) assert_almost_equal(dat[1][0], 2.4) assert_equal(dat[0][1], '"hel') assert_equal(dat...
null
null
null
by col extent
codeqa
def test read weird table '\n Col 1 Col 2 \n 1 2"hello"\n 2 4sdf\'sworlds\n'reader ascii get reader Reader ascii Fixed Width dat reader read table assert equal dat colnames [' Col 1 ' ' Col 2 '] assert almost equal dat[ 1 ][ 0 ] 2 4 assert equal dat[ 0 ][ 1 ] '"hel' assert equal dat[ 1 ][ 1 ] "df'swo"
null
null
null
null
Question: How did data values chop ? Code: def test_read_weird(): table = '\n Col1 | Col2 |\n 1.2 "hello"\n 2.4 sdf\'s worlds\n' reader = ascii.get_reader(Reader=ascii.FixedWidth) dat = reader.read(table) assert_equal(dat.colnames, ['Col1', 'Col2']) assert_almost_equal(dat[1][0], 2.4) as...
null
null
null
What does the code make ?
def heading(headingtext, headinglevel, lang='en'): lmap = {'en': 'Heading', 'it': 'Titolo'} paragraph = makeelement('p') pr = makeelement('pPr') pStyle = makeelement('pStyle', attributes={'val': (lmap[lang] + str(headinglevel))}) run = makeelement('r') text = makeelement('t', tagtext=headingtext) pr.append(pStyl...
null
null
null
a new heading
codeqa
def heading headingtext headinglevel lang 'en' lmap {'en' ' Heading' 'it' ' Titolo'}paragraph makeelement 'p' pr makeelement 'p Pr' p Style makeelement 'p Style' attributes {'val' lmap[lang] + str headinglevel } run makeelement 'r' text makeelement 't' tagtext headingtext pr append p Style run append text paragraph app...
null
null
null
null
Question: What does the code make ? Code: def heading(headingtext, headinglevel, lang='en'): lmap = {'en': 'Heading', 'it': 'Titolo'} paragraph = makeelement('p') pr = makeelement('pPr') pStyle = makeelement('pStyle', attributes={'val': (lmap[lang] + str(headinglevel))}) run = makeelement('r') text = makeelem...
null
null
null
What does the code produce ?
def load(stream, Loader=Loader): loader = Loader(stream) try: return loader.get_single_data() finally: loader.dispose()
null
null
null
the corresponding python object
codeqa
def load stream Loader Loader loader Loader stream try return loader get single data finally loader dispose
null
null
null
null
Question: What does the code produce ? Code: def load(stream, Loader=Loader): loader = Loader(stream) try: return loader.get_single_data() finally: loader.dispose()
null
null
null
What does the code add to a zone ?
def add_rich_rule(zone, rule, permanent=True): cmd = "--zone={0} --add-rich-rule='{1}'".format(zone, rule) if permanent: cmd += ' --permanent' return __firewall_cmd(cmd)
null
null
null
a rich rule
codeqa
def add rich rule zone rule permanent True cmd "--zone {0 }--add-rich-rule '{ 1 }'" format zone rule if permanent cmd + '--permanent'return firewall cmd cmd
null
null
null
null
Question: What does the code add to a zone ? Code: def add_rich_rule(zone, rule, permanent=True): cmd = "--zone={0} --add-rich-rule='{1}'".format(zone, rule) if permanent: cmd += ' --permanent' return __firewall_cmd(cmd)
null
null
null
How does the code write information ?
def _indent_genbank(information, indent): info_parts = information.split('\n') output_info = (info_parts[0] + '\n') for info_part in info_parts[1:]: output_info += (((' ' * indent) + info_part) + '\n') return output_info
null
null
null
with the specified indent
codeqa
def indent genbank information indent info parts information split '\n' output info info parts[ 0 ] + '\n' for info part in info parts[ 1 ] output info + '' * indent + info part + '\n' return output info
null
null
null
null
Question: How does the code write information ? Code: def _indent_genbank(information, indent): info_parts = information.split('\n') output_info = (info_parts[0] + '\n') for info_part in info_parts[1:]: output_info += (((' ' * indent) + info_part) + '\n') return output_info
null
null
null
What does the code write with the specified indent ?
def _indent_genbank(information, indent): info_parts = information.split('\n') output_info = (info_parts[0] + '\n') for info_part in info_parts[1:]: output_info += (((' ' * indent) + info_part) + '\n') return output_info
null
null
null
information
codeqa
def indent genbank information indent info parts information split '\n' output info info parts[ 0 ] + '\n' for info part in info parts[ 1 ] output info + '' * indent + info part + '\n' return output info
null
null
null
null
Question: What does the code write with the specified indent ? Code: def _indent_genbank(information, indent): info_parts = information.split('\n') output_info = (info_parts[0] + '\n') for info_part in info_parts[1:]: output_info += (((' ' * indent) + info_part) + '\n') return output_info
null
null
null
What does the code get if exists ?
def get_or_empty_db_cart(cart_queryset=Cart.objects.all()): def get_cart(view): @wraps(view) def func(request, *args, **kwargs): cart = get_cart_from_request(request, cart_queryset) return view(request, cart, *args, **kwargs) return func return get_cart
null
null
null
cart
codeqa
def get or empty db cart cart queryset Cart objects all def get cart view @wraps view def func request *args **kwargs cart get cart from request request cart queryset return view request cart *args **kwargs return funcreturn get cart
null
null
null
null
Question: What does the code get if exists ? Code: def get_or_empty_db_cart(cart_queryset=Cart.objects.all()): def get_cart(view): @wraps(view) def func(request, *args, **kwargs): cart = get_cart_from_request(request, cart_queryset) return view(request, cart, *args, **kwargs) return func return get_ca...
null
null
null
What does the code ensure ?
def absent(name, if_exists=None, restrict=None, cascade=None, user=None, maintenance_db=None, db_user=None, db_password=None, db_host=None, db_port=None): ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} db_args = {'maintenance_db': maintenance_db, 'runas': user, 'host': db_host, 'user': db_user, 'p...
null
null
null
that the named extension is absent
codeqa
def absent name if exists None restrict None cascade None user None maintenance db None db user None db password None db host None db port None ret {'name' name 'changes' {} 'result' True 'comment' ''}db args {'maintenance db' maintenance db 'runas' user 'host' db host 'user' db user 'port' db port 'password' db passwo...
null
null
null
null
Question: What does the code ensure ? Code: def absent(name, if_exists=None, restrict=None, cascade=None, user=None, maintenance_db=None, db_user=None, db_password=None, db_host=None, db_port=None): ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} db_args = {'maintenance_db': maintenance_db, 'ru...
null
null
null
What stores in a profile setting ?
def putProfileSetting(name, value): global settingsDictionary if ((name in settingsDictionary) and settingsDictionary[name].isProfile()): settingsDictionary[name].setValue(value)
null
null
null
a certain value
codeqa
def put Profile Setting name value global settings Dictionaryif name in settings Dictionary and settings Dictionary[name] is Profile settings Dictionary[name] set Value value
null
null
null
null
Question: What stores in a profile setting ? Code: def putProfileSetting(name, value): global settingsDictionary if ((name in settingsDictionary) and settingsDictionary[name].isProfile()): settingsDictionary[name].setValue(value)
null
null
null
Where do a certain value store ?
def putProfileSetting(name, value): global settingsDictionary if ((name in settingsDictionary) and settingsDictionary[name].isProfile()): settingsDictionary[name].setValue(value)
null
null
null
in a profile setting
codeqa
def put Profile Setting name value global settings Dictionaryif name in settings Dictionary and settings Dictionary[name] is Profile settings Dictionary[name] set Value value
null
null
null
null
Question: Where do a certain value store ? Code: def putProfileSetting(name, value): global settingsDictionary if ((name in settingsDictionary) and settingsDictionary[name].isProfile()): settingsDictionary[name].setValue(value)
null
null
null
What does the code compute ?
def _af_parity(pi): n = len(pi) a = ([0] * n) c = 0 for j in range(n): if (a[j] == 0): c += 1 a[j] = 1 i = j while (pi[i] != j): i = pi[i] a[i] = 1 return ((n - c) % 2)
null
null
null
the parity of a permutation in array form
codeqa
def af parity pi n len pi a [0 ] * n c 0for j in range n if a[j] 0 c + 1a[j] 1i jwhile pi[i] j i pi[i]a[i] 1return n - c % 2
null
null
null
null
Question: What does the code compute ? Code: def _af_parity(pi): n = len(pi) a = ([0] * n) c = 0 for j in range(n): if (a[j] == 0): c += 1 a[j] = 1 i = j while (pi[i] != j): i = pi[i] a[i] = 1 return ((n - c) % 2)
null
null
null
What does the code add to the current axes ?
def volume_overlay2(ax, closes, volumes, colorup='k', colordown='r', width=4, alpha=1.0): return volume_overlay(ax, closes[:(-1)], closes[1:], volumes[1:], colorup, colordown, width, alpha)
null
null
null
a volume overlay
codeqa
def volume overlay 2 ax closes volumes colorup 'k' colordown 'r' width 4 alpha 1 0 return volume overlay ax closes[ -1 ] closes[ 1 ] volumes[ 1 ] colorup colordown width alpha
null
null
null
null
Question: What does the code add to the current axes ? Code: def volume_overlay2(ax, closes, volumes, colorup='k', colordown='r', width=4, alpha=1.0): return volume_overlay(ax, closes[:(-1)], closes[1:], volumes[1:], colorup, colordown, width, alpha)
null
null
null
What does the code turn into separate files for each entry ?
def write_files(journal, path, format): make_filename = (lambda entry: e.date.strftime(u'%Y-%m-%d_{0}.{1}'.format(slugify(u(e.title)), format))) for e in journal.entries: full_path = os.path.join(path, make_filename(e)) if (format == u'json'): content = (json.dumps(e.to_dict(), indent=2) + u'\n') elif (forma...
null
null
null
your journal
codeqa
def write files journal path format make filename lambda entry e date strftime u'%Y-%m-%d {0 } {1 }' format slugify u e title format for e in journal entries full path os path join path make filename e if format u'json' content json dumps e to dict indent 2 + u'\n' elif format in u'md' u'markdown' content e to md elif ...
null
null
null
null
Question: What does the code turn into separate files for each entry ? Code: def write_files(journal, path, format): make_filename = (lambda entry: e.date.strftime(u'%Y-%m-%d_{0}.{1}'.format(slugify(u(e.title)), format))) for e in journal.entries: full_path = os.path.join(path, make_filename(e)) if (format ==...
null
null
null
For what purpose does a core file drop ?
def corefile(process): if context.noptrace: log.warn_once('Skipping corefile since context.noptrace==True') return temp = tempfile.NamedTemporaryFile(prefix='pwn-corefile-') if (version() < (7, 11)): log.warn_once(('The installed GDB (%s) does not emit core-dumps which contain all of the data ...
null
null
null
for the process
codeqa
def corefile process if context noptrace log warn once ' Skippingcorefilesincecontext noptrace True' returntemp tempfile Named Temporary File prefix 'pwn-corefile-' if version < 7 11 log warn once ' Theinstalled GDB %s doesnotemitcore-dumpswhichcontainallofthedataintheprocess \n Upgradeto GDB> 7 11 forbettercore-dumps ...
null
null
null
null
Question: For what purpose does a core file drop ? Code: def corefile(process): if context.noptrace: log.warn_once('Skipping corefile since context.noptrace==True') return temp = tempfile.NamedTemporaryFile(prefix='pwn-corefile-') if (version() < (7, 11)): log.warn_once(('The installed GDB (%s) does...
null
null
null
Are valid c++ names are valid in python always ?
def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
No
codeqa
def force to valid python variable name old name new name old namenew name new name lstrip rstrip if old name in python keywords new name u'opt ' + old name return new name
null
null
null
null
Question: Are valid c++ names are valid in python always ? Code: def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
When are valid c++ names not are valid in python ?
def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
always
codeqa
def force to valid python variable name old name new name old namenew name new name lstrip rstrip if old name in python keywords new name u'opt ' + old name return new name
null
null
null
null
Question: When are valid c++ names not are valid in python ? Code: def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
Where are valid c++ names not are valid always ?
def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
in python
codeqa
def force to valid python variable name old name new name old namenew name new name lstrip rstrip if old name in python keywords new name u'opt ' + old name return new name
null
null
null
null
Question: Where are valid c++ names not are valid always ? Code: def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
What are not valid in python ?
def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
valid c++ names
codeqa
def force to valid python variable name old name new name old namenew name new name lstrip rstrip if old name in python keywords new name u'opt ' + old name return new name
null
null
null
null
Question: What are not valid in python ? Code: def force_to_valid_python_variable_name(old_name): new_name = old_name new_name = new_name.lstrip().rstrip() if (old_name in python_keywords): new_name = (u'opt_' + old_name) return new_name
null
null
null
Where do cmd start ?
def start_service(cmd, pidfile, logfile=os.devnull, chdir=None): logfh = open(logfile, 'a') pidfh = open(pidfile, 'w') proc = subprocess.Popen(cmd, stdout=logfh, stderr=logfh, cwd=chdir) pidfh.write(str(proc.pid)) pidfh.close()
null
null
null
in the background
codeqa
def start service cmd pidfile logfile os devnull chdir None logfh open logfile 'a' pidfh open pidfile 'w' proc subprocess Popen cmd stdout logfh stderr logfh cwd chdir pidfh write str proc pid pidfh close
null
null
null
null
Question: Where do cmd start ? Code: def start_service(cmd, pidfile, logfile=os.devnull, chdir=None): logfh = open(logfile, 'a') pidfh = open(pidfile, 'w') proc = subprocess.Popen(cmd, stdout=logfh, stderr=logfh, cwd=chdir) pidfh.write(str(proc.pid)) pidfh.close()
null
null
null
What starts in the background ?
def start_service(cmd, pidfile, logfile=os.devnull, chdir=None): logfh = open(logfile, 'a') pidfh = open(pidfile, 'w') proc = subprocess.Popen(cmd, stdout=logfh, stderr=logfh, cwd=chdir) pidfh.write(str(proc.pid)) pidfh.close()
null
null
null
cmd
codeqa
def start service cmd pidfile logfile os devnull chdir None logfh open logfile 'a' pidfh open pidfile 'w' proc subprocess Popen cmd stdout logfh stderr logfh cwd chdir pidfh write str proc pid pidfh close
null
null
null
null
Question: What starts in the background ? Code: def start_service(cmd, pidfile, logfile=os.devnull, chdir=None): logfh = open(logfile, 'a') pidfh = open(pidfile, 'w') proc = subprocess.Popen(cmd, stdout=logfh, stderr=logfh, cwd=chdir) pidfh.write(str(proc.pid)) pidfh.close()