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 cleave ?
def writeOutput(fileName, shouldAnalyze=True): startTime = time.time() print (('File ' + archive.getSummarizedFileName(fileName)) + ' is being cleaved.') repository = CleaveRepository() settings.getReadRepository(repository) cleaveGcode = getCraftedText(fileName, '', repository) if (cleaveGcode == ''): return suffixFileName = (fileName[:fileName.rfind('.')] + '_cleave.svg') suffixDirectoryName = os.path.dirname(suffixFileName) suffixReplacedBaseName = os.path.basename(suffixFileName).replace(' ', '_') suffixFileName = os.path.join(suffixDirectoryName, suffixReplacedBaseName) archive.writeFileText(suffixFileName, cleaveGcode) print ('The cleaved file is saved as ' + archive.getSummarizedFileName(suffixFileName)) print ('It took %s to cleave the file.' % euclidean.getDurationString((time.time() - startTime))) if shouldAnalyze: settings.openSVGPage(suffixFileName, repository.svgViewer.value)
null
null
null
a gnu triangulated surface file
codeqa
def write Output file Name should Analyze True start Time time time print ' File' + archive get Summarized File Name file Name + 'isbeingcleaved ' repository Cleave Repository settings get Read Repository repository cleave Gcode get Crafted Text file Name '' repository if cleave Gcode '' returnsuffix File Name file Name[ file Name rfind ' ' ] + ' cleave svg' suffix Directory Name os path dirname suffix File Name suffix Replaced Base Name os path basename suffix File Name replace '' ' ' suffix File Name os path join suffix Directory Name suffix Replaced Base Name archive write File Text suffix File Name cleave Gcode print ' Thecleavedfileissavedas' + archive get Summarized File Name suffix File Name print ' Ittook%stocleavethefile ' % euclidean get Duration String time time - start Time if should Analyze settings open SVG Page suffix File Name repository svg Viewer value
null
null
null
null
Question: What does the code cleave ? Code: def writeOutput(fileName, shouldAnalyze=True): startTime = time.time() print (('File ' + archive.getSummarizedFileName(fileName)) + ' is being cleaved.') repository = CleaveRepository() settings.getReadRepository(repository) cleaveGcode = getCraftedText(fileName, '', repository) if (cleaveGcode == ''): return suffixFileName = (fileName[:fileName.rfind('.')] + '_cleave.svg') suffixDirectoryName = os.path.dirname(suffixFileName) suffixReplacedBaseName = os.path.basename(suffixFileName).replace(' ', '_') suffixFileName = os.path.join(suffixDirectoryName, suffixReplacedBaseName) archive.writeFileText(suffixFileName, cleaveGcode) print ('The cleaved file is saved as ' + archive.getSummarizedFileName(suffixFileName)) print ('It took %s to cleave the file.' % euclidean.getDurationString((time.time() - startTime))) if shouldAnalyze: settings.openSVGPage(suffixFileName, repository.svgViewer.value)
null
null
null
How is a function called ?
def meter_calls(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): meter(('%s_calls' % get_qualname(fn))).mark() return fn(*args, **kwargs) return wrapper
null
null
null
the rate
codeqa
def meter calls fn @functools wraps fn def wrapper *args **kwargs meter '%s calls' % get qualname fn mark return fn *args **kwargs return wrapper
null
null
null
null
Question: How is a function called ? Code: def meter_calls(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): meter(('%s_calls' % get_qualname(fn))).mark() return fn(*args, **kwargs) return wrapper
null
null
null
What does the code get ?
def count(context, namespace_name, session): namespace = namespace_api.get(context, namespace_name, session) query = session.query(func.count(models.MetadefTag.id)).filter_by(namespace_id=namespace['id']) return query.scalar()
null
null
null
the count of objects for a namespace
codeqa
def count context namespace name session namespace namespace api get context namespace name session query session query func count models Metadef Tag id filter by namespace id namespace['id'] return query scalar
null
null
null
null
Question: What does the code get ? Code: def count(context, namespace_name, session): namespace = namespace_api.get(context, namespace_name, session) query = session.query(func.count(models.MetadefTag.id)).filter_by(namespace_id=namespace['id']) return query.scalar()
null
null
null
What does the code return via rest_sample ?
def status(name, sig=None): proxy_fn = 'rest_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
the status for a service
codeqa
def status name sig None proxy fn 'rest sample service status'resp proxy [proxy fn] name if resp['comment'] 'stopped' return Falseif resp['comment'] 'running' return True
null
null
null
null
Question: What does the code return via rest_sample ? Code: def status(name, sig=None): proxy_fn = 'rest_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
How does the code return the status for a service ?
def status(name, sig=None): proxy_fn = 'rest_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
via rest_sample
codeqa
def status name sig None proxy fn 'rest sample service status'resp proxy [proxy fn] name if resp['comment'] 'stopped' return Falseif resp['comment'] 'running' return True
null
null
null
null
Question: How does the code return the status for a service ? Code: def status(name, sig=None): proxy_fn = 'rest_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
What does the code convert to list of int ?
def str2intlist(data, intsize=4): result = [] data = decode_string_escape(data)[::(-1)] l = len(data) data = ((('\x00' * (intsize - (l % intsize))) + data) if ((l % intsize) != 0) else data) for i in range(0, l, intsize): if (intsize == 8): val = struct.unpack('>Q', data[i:(i + intsize)])[0] else: val = struct.unpack('>L', data[i:(i + intsize)])[0] result = ([val] + result) return result
null
null
null
a string
codeqa
def str 2 intlist data intsize 4 result []data decode string escape data [ -1 ]l len data data '\x 00 ' * intsize - l % intsize + data if l % intsize 0 else data for i in range 0 l intsize if intsize 8 val struct unpack '>Q' data[i i + intsize ] [0 ]else val struct unpack '>L' data[i i + intsize ] [0 ]result [val] + result return result
null
null
null
null
Question: What does the code convert to list of int ? Code: def str2intlist(data, intsize=4): result = [] data = decode_string_escape(data)[::(-1)] l = len(data) data = ((('\x00' * (intsize - (l % intsize))) + data) if ((l % intsize) != 0) else data) for i in range(0, l, intsize): if (intsize == 8): val = struct.unpack('>Q', data[i:(i + intsize)])[0] else: val = struct.unpack('>L', data[i:(i + intsize)])[0] result = ([val] + result) return result
null
null
null
What does the code find ?
def find_module_file(module, dirlist): list = find_file(module, [], dirlist) if (not list): return module if (len(list) > 1): log.info(('WARNING: multiple copies of %s found' % module)) return os.path.join(list[0], module)
null
null
null
a module in a set of possible folders
codeqa
def find module file module dirlist list find file module [] dirlist if not list return moduleif len list > 1 log info 'WARNING multiplecopiesof%sfound' module return os path join list[ 0 ] module
null
null
null
null
Question: What does the code find ? Code: def find_module_file(module, dirlist): list = find_file(module, [], dirlist) if (not list): return module if (len(list) > 1): log.info(('WARNING: multiple copies of %s found' % module)) return os.path.join(list[0], module)
null
null
null
What do the class regard ?
def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest, mod_path, sph, sphinx=True): if c_name.startswith('_'): c_sk.append(c_name) return (False, False, None) c = False c_dt = False try: (source, line_no) = inspect.getsourcelines(obj) except IOError: return (False, False, None) c = True full_name = ('LINE %d: %s' % (line_no, c_name)) if (not obj.__doc__): c_md.append(full_name) elif (not ('>>>' in obj.__doc__)): c_mdt.append(full_name) elif _is_indirect(c_name, obj.__doc__): c_idt.append(full_name) else: c_dt = True c_has_doctest.append(full_name) in_sphinx = False if sphinx: in_sphinx = find_sphinx(c_name, mod_path) if (not in_sphinx): sph.append(full_name) return (c_dt, c, source)
null
null
null
documentation
codeqa
def process class c name obj c sk c md c mdt c idt c has doctest mod path sph sphinx True if c name startswith ' ' c sk append c name return False False None c Falsec dt Falsetry source line no inspect getsourcelines obj except IO Error return False False None c Truefull name 'LINE%d %s' % line no c name if not obj doc c md append full name elif not '>>>' in obj doc c mdt append full name elif is indirect c name obj doc c idt append full name else c dt Truec has doctest append full name in sphinx Falseif sphinx in sphinx find sphinx c name mod path if not in sphinx sph append full name return c dt c source
null
null
null
null
Question: What do the class regard ? Code: def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest, mod_path, sph, sphinx=True): if c_name.startswith('_'): c_sk.append(c_name) return (False, False, None) c = False c_dt = False try: (source, line_no) = inspect.getsourcelines(obj) except IOError: return (False, False, None) c = True full_name = ('LINE %d: %s' % (line_no, c_name)) if (not obj.__doc__): c_md.append(full_name) elif (not ('>>>' in obj.__doc__)): c_mdt.append(full_name) elif _is_indirect(c_name, obj.__doc__): c_idt.append(full_name) else: c_dt = True c_has_doctest.append(full_name) in_sphinx = False if sphinx: in_sphinx = find_sphinx(c_name, mod_path) if (not in_sphinx): sph.append(full_name) return (c_dt, c, source)
null
null
null
What is regarding documentation ?
def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest, mod_path, sph, sphinx=True): if c_name.startswith('_'): c_sk.append(c_name) return (False, False, None) c = False c_dt = False try: (source, line_no) = inspect.getsourcelines(obj) except IOError: return (False, False, None) c = True full_name = ('LINE %d: %s' % (line_no, c_name)) if (not obj.__doc__): c_md.append(full_name) elif (not ('>>>' in obj.__doc__)): c_mdt.append(full_name) elif _is_indirect(c_name, obj.__doc__): c_idt.append(full_name) else: c_dt = True c_has_doctest.append(full_name) in_sphinx = False if sphinx: in_sphinx = find_sphinx(c_name, mod_path) if (not in_sphinx): sph.append(full_name) return (c_dt, c, source)
null
null
null
the class
codeqa
def process class c name obj c sk c md c mdt c idt c has doctest mod path sph sphinx True if c name startswith ' ' c sk append c name return False False None c Falsec dt Falsetry source line no inspect getsourcelines obj except IO Error return False False None c Truefull name 'LINE%d %s' % line no c name if not obj doc c md append full name elif not '>>>' in obj doc c mdt append full name elif is indirect c name obj doc c idt append full name else c dt Truec has doctest append full name in sphinx Falseif sphinx in sphinx find sphinx c name mod path if not in sphinx sph append full name return c dt c source
null
null
null
null
Question: What is regarding documentation ? Code: def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest, mod_path, sph, sphinx=True): if c_name.startswith('_'): c_sk.append(c_name) return (False, False, None) c = False c_dt = False try: (source, line_no) = inspect.getsourcelines(obj) except IOError: return (False, False, None) c = True full_name = ('LINE %d: %s' % (line_no, c_name)) if (not obj.__doc__): c_md.append(full_name) elif (not ('>>>' in obj.__doc__)): c_mdt.append(full_name) elif _is_indirect(c_name, obj.__doc__): c_idt.append(full_name) else: c_dt = True c_has_doctest.append(full_name) in_sphinx = False if sphinx: in_sphinx = find_sphinx(c_name, mod_path) if (not in_sphinx): sph.append(full_name) return (c_dt, c, source)
null
null
null
What does the code add to the context ?
def media(request): return {'MEDIA_URL': settings.MEDIA_URL}
null
null
null
media - related context variables
codeqa
def media request return {'MEDIA URL' settings MEDIA URL}
null
null
null
null
Question: What does the code add to the context ? Code: def media(request): return {'MEDIA_URL': settings.MEDIA_URL}
null
null
null
How do integer increase ?
def getSerial(filename='/tmp/twisted-names.serial'): serial = time.strftime('%Y%m%d') o = os.umask(127) try: if (not os.path.exists(filename)): f = file(filename, 'w') f.write((serial + ' 0')) f.close() finally: os.umask(o) serialFile = file(filename, 'r') (lastSerial, ID) = serialFile.readline().split() ID = (((lastSerial == serial) and (int(ID) + 1)) or 0) serialFile.close() serialFile = file(filename, 'w') serialFile.write(('%s %d' % (serial, ID))) serialFile.close() serial = (serial + ('%02d' % (ID,))) return serial
null
null
null
monotonically
codeqa
def get Serial filename '/tmp/twisted-names serial' serial time strftime '%Y%m%d' o os umask 127 try if not os path exists filename f file filename 'w' f write serial + '0 ' f close finally os umask o serial File file filename 'r' last Serial ID serial File readline split ID last Serial serial and int ID + 1 or 0 serial File close serial File file filename 'w' serial File write '%s%d' % serial ID serial File close serial serial + '% 02 d' % ID return serial
null
null
null
null
Question: How do integer increase ? Code: def getSerial(filename='/tmp/twisted-names.serial'): serial = time.strftime('%Y%m%d') o = os.umask(127) try: if (not os.path.exists(filename)): f = file(filename, 'w') f.write((serial + ' 0')) f.close() finally: os.umask(o) serialFile = file(filename, 'r') (lastSerial, ID) = serialFile.readline().split() ID = (((lastSerial == serial) and (int(ID) + 1)) or 0) serialFile.close() serialFile = file(filename, 'w') serialFile.write(('%s %d' % (serial, ID))) serialFile.close() serial = (serial + ('%02d' % (ID,))) return serial
null
null
null
What does the code return via rest_sample ?
def status(name, sig=None): proxy_fn = 'ssh_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
the status for a service
codeqa
def status name sig None proxy fn 'ssh sample service status'resp proxy [proxy fn] name if resp['comment'] 'stopped' return Falseif resp['comment'] 'running' return True
null
null
null
null
Question: What does the code return via rest_sample ? Code: def status(name, sig=None): proxy_fn = 'ssh_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
How does the code return the status for a service ?
def status(name, sig=None): proxy_fn = 'ssh_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
via rest_sample
codeqa
def status name sig None proxy fn 'ssh sample service status'resp proxy [proxy fn] name if resp['comment'] 'stopped' return Falseif resp['comment'] 'running' return True
null
null
null
null
Question: How does the code return the status for a service ? Code: def status(name, sig=None): proxy_fn = 'ssh_sample.service_status' resp = __proxy__[proxy_fn](name) if (resp['comment'] == 'stopped'): return False if (resp['comment'] == 'running'): return True
null
null
null
What did the code set ?
def set_log_level(verbose=None, return_old_level=False): if (verbose is None): verbose = get_config('MNE_LOGGING_LEVEL', 'INFO') elif isinstance(verbose, bool): if (verbose is True): verbose = 'INFO' else: verbose = 'WARNING' if isinstance(verbose, string_types): verbose = verbose.upper() logging_types = dict(DEBUG=logging.DEBUG, INFO=logging.INFO, WARNING=logging.WARNING, ERROR=logging.ERROR, CRITICAL=logging.CRITICAL) if (verbose not in logging_types): raise ValueError('verbose must be of a valid type') verbose = logging_types[verbose] logger = logging.getLogger('mne') old_verbose = logger.level logger.setLevel(verbose) return (old_verbose if return_old_level else None)
null
null
null
the logging level
codeqa
def set log level verbose None return old level False if verbose is None verbose get config 'MNE LOGGING LEVEL' 'INFO' elif isinstance verbose bool if verbose is True verbose 'INFO'else verbose 'WARNING'if isinstance verbose string types verbose verbose upper logging types dict DEBUG logging DEBUG INFO logging INFO WARNING logging WARNING ERROR logging ERROR CRITICAL logging CRITICAL if verbose not in logging types raise Value Error 'verbosemustbeofavalidtype' verbose logging types[verbose]logger logging get Logger 'mne' old verbose logger levellogger set Level verbose return old verbose if return old level else None
null
null
null
null
Question: What did the code set ? Code: def set_log_level(verbose=None, return_old_level=False): if (verbose is None): verbose = get_config('MNE_LOGGING_LEVEL', 'INFO') elif isinstance(verbose, bool): if (verbose is True): verbose = 'INFO' else: verbose = 'WARNING' if isinstance(verbose, string_types): verbose = verbose.upper() logging_types = dict(DEBUG=logging.DEBUG, INFO=logging.INFO, WARNING=logging.WARNING, ERROR=logging.ERROR, CRITICAL=logging.CRITICAL) if (verbose not in logging_types): raise ValueError('verbose must be of a valid type') verbose = logging_types[verbose] logger = logging.getLogger('mne') old_verbose = logger.level logger.setLevel(verbose) return (old_verbose if return_old_level else None)
null
null
null
What does the code remove from a document ?
def _document_lock_clear(document_id, user_name): try: redis = redis_client(name='default') key = _document_lock_key.format(id=document_id) locked_by = redis.get(key) if (locked_by == user_name): return redis.delete(key) else: return False except RedisError as e: statsd.incr('redis.errror') log.error(('Redis error: %s' % e)) return False
null
null
null
a lock
codeqa
def document lock clear document id user name try redis redis client name 'default' key document lock key format id document id locked by redis get key if locked by user name return redis delete key else return Falseexcept Redis Error as e statsd incr 'redis errror' log error ' Rediserror %s' % e return False
null
null
null
null
Question: What does the code remove from a document ? Code: def _document_lock_clear(document_id, user_name): try: redis = redis_client(name='default') key = _document_lock_key.format(id=document_id) locked_by = redis.get(key) if (locked_by == user_name): return redis.delete(key) else: return False except RedisError as e: statsd.incr('redis.errror') log.error(('Redis error: %s' % e)) return False
null
null
null
What does the code add ?
@service.soap('AddStrings', returns={'AddResult': str}, args={'a': str, 'b': str}) @service.soap('AddIntegers', returns={'AddResult': int}, args={'a': int, 'b': int}) def add(a, b): return (a + b)
null
null
null
two values
codeqa
@service soap ' Add Strings' returns {' Add Result' str} args {'a' str 'b' str} @service soap ' Add Integers' returns {' Add Result' int} args {'a' int 'b' int} def add a b return a + b
null
null
null
null
Question: What does the code add ? Code: @service.soap('AddStrings', returns={'AddResult': str}, args={'a': str, 'b': str}) @service.soap('AddIntegers', returns={'AddResult': int}, args={'a': int, 'b': int}) def add(a, b): return (a + b)
null
null
null
What does the code make ?
@removals.remove(message='Use keystoneclient.session.request instead.', version='1.7.0', removal_version='2.0.0') def request(*args, **kwargs): return client_session.request(*args, **kwargs)
null
null
null
a request
codeqa
@removals remove message ' Usekeystoneclient session requestinstead ' version '1 7 0' removal version '2 0 0' def request *args **kwargs return client session request *args **kwargs
null
null
null
null
Question: What does the code make ? Code: @removals.remove(message='Use keystoneclient.session.request instead.', version='1.7.0', removal_version='2.0.0') def request(*args, **kwargs): return client_session.request(*args, **kwargs)
null
null
null
What is containing invalid values ?
def test_invalid_sigma_clip(): data = np.ones((5, 5)) data[(2, 2)] = 1000 data[(3, 4)] = np.nan data[(1, 1)] = np.inf result = sigma_clip(data) assert result.mask[(2, 2)] assert result.mask[(3, 4)] assert result.mask[(1, 1)]
null
null
null
data
codeqa
def test invalid sigma clip data np ones 5 5 data[ 2 2 ] 1000 data[ 3 4 ] np nandata[ 1 1 ] np infresult sigma clip data assert result mask[ 2 2 ]assert result mask[ 3 4 ]assert result mask[ 1 1 ]
null
null
null
null
Question: What is containing invalid values ? Code: def test_invalid_sigma_clip(): data = np.ones((5, 5)) data[(2, 2)] = 1000 data[(3, 4)] = np.nan data[(1, 1)] = np.inf result = sigma_clip(data) assert result.mask[(2, 2)] assert result.mask[(3, 4)] assert result.mask[(1, 1)]
null
null
null
What do data contain ?
def test_invalid_sigma_clip(): data = np.ones((5, 5)) data[(2, 2)] = 1000 data[(3, 4)] = np.nan data[(1, 1)] = np.inf result = sigma_clip(data) assert result.mask[(2, 2)] assert result.mask[(3, 4)] assert result.mask[(1, 1)]
null
null
null
invalid values
codeqa
def test invalid sigma clip data np ones 5 5 data[ 2 2 ] 1000 data[ 3 4 ] np nandata[ 1 1 ] np infresult sigma clip data assert result mask[ 2 2 ]assert result mask[ 3 4 ]assert result mask[ 1 1 ]
null
null
null
null
Question: What do data contain ? Code: def test_invalid_sigma_clip(): data = np.ones((5, 5)) data[(2, 2)] = 1000 data[(3, 4)] = np.nan data[(1, 1)] = np.inf result = sigma_clip(data) assert result.mask[(2, 2)] assert result.mask[(3, 4)] assert result.mask[(1, 1)]
null
null
null
What does the code dump to a buffer ?
def dump_crl(type, crl): bio = _new_mem_buf() if (type == FILETYPE_PEM): ret = _lib.PEM_write_bio_X509_CRL(bio, crl._crl) elif (type == FILETYPE_ASN1): ret = _lib.i2d_X509_CRL_bio(bio, crl._crl) elif (type == FILETYPE_TEXT): ret = _lib.X509_CRL_print(bio, crl._crl) else: raise ValueError('type argument must be FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT') assert (ret == 1) return _bio_to_string(bio)
null
null
null
a certificate revocation list
codeqa
def dump crl type crl bio new mem buf if type FILETYPE PEM ret lib PEM write bio X509 CRL bio crl crl elif type FILETYPE ASN 1 ret lib i2 d X509 CRL bio bio crl crl elif type FILETYPE TEXT ret lib X509 CRL print bio crl crl else raise Value Error 'typeargumentmustbe FILETYPE PEM FILETYPE ASN 1 or FILETYPE TEXT' assert ret 1 return bio to string bio
null
null
null
null
Question: What does the code dump to a buffer ? Code: def dump_crl(type, crl): bio = _new_mem_buf() if (type == FILETYPE_PEM): ret = _lib.PEM_write_bio_X509_CRL(bio, crl._crl) elif (type == FILETYPE_ASN1): ret = _lib.i2d_X509_CRL_bio(bio, crl._crl) elif (type == FILETYPE_TEXT): ret = _lib.X509_CRL_print(bio, crl._crl) else: raise ValueError('type argument must be FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT') assert (ret == 1) return _bio_to_string(bio)
null
null
null
What is yielding the paths of all files that should be copied ?
def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
the storage directories
codeqa
def get files storage ignore patterns [] location '' directories files storage listdir location for fn in files if is ignored fn ignore patterns continueif location fn os path join location fn yield fn for dir in directories if is ignored dir ignore patterns continueif location dir os path join location dir for fn in get files storage ignore patterns dir yield fn
null
null
null
null
Question: What is yielding the paths of all files that should be copied ? Code: def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
How do the storage directories yielding the paths of all files that should be copied walk ?
def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
recursively
codeqa
def get files storage ignore patterns [] location '' directories files storage listdir location for fn in files if is ignored fn ignore patterns continueif location fn os path join location fn yield fn for dir in directories if is ignored dir ignore patterns continueif location dir os path join location dir for fn in get files storage ignore patterns dir yield fn
null
null
null
null
Question: How do the storage directories yielding the paths of all files that should be copied walk ? Code: def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
What do the storage directories yield ?
def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
the paths of all files that should be copied
codeqa
def get files storage ignore patterns [] location '' directories files storage listdir location for fn in files if is ignored fn ignore patterns continueif location fn os path join location fn yield fn for dir in directories if is ignored dir ignore patterns continueif location dir os path join location dir for fn in get files storage ignore patterns dir yield fn
null
null
null
null
Question: What do the storage directories yield ? Code: def get_files(storage, ignore_patterns=[], location=''): (directories, files) = storage.listdir(location) for fn in files: if is_ignored(fn, ignore_patterns): continue if location: fn = os.path.join(location, fn) (yield fn) for dir in directories: if is_ignored(dir, ignore_patterns): continue if location: dir = os.path.join(location, dir) for fn in get_files(storage, ignore_patterns, dir): (yield fn)
null
null
null
How do a new one set ?
def _PushConnection(new_connection): __InitConnection() _thread_local.connection_stack.append(new_connection)
null
null
null
internal method
codeqa
def Push Connection new connection Init Connection thread local connection stack append new connection
null
null
null
null
Question: How do a new one set ? Code: def _PushConnection(new_connection): __InitConnection() _thread_local.connection_stack.append(new_connection)
null
null
null
What does the code add in database ?
def db_add_group(**kwargs): name = kwargs.get('name') group = get_object(AssetGroup, name=name) asset_id_list = kwargs.pop('asset_select') if (not group): group = AssetGroup(**kwargs) group.save() for asset_id in asset_id_list: group_add_asset(group, asset_id)
null
null
null
a asset group
codeqa
def db add group **kwargs name kwargs get 'name' group get object Asset Group name name asset id list kwargs pop 'asset select' if not group group Asset Group **kwargs group save for asset id in asset id list group add asset group asset id
null
null
null
null
Question: What does the code add in database ? Code: def db_add_group(**kwargs): name = kwargs.get('name') group = get_object(AssetGroup, name=name) asset_id_list = kwargs.pop('asset_select') if (not group): group = AssetGroup(**kwargs) group.save() for asset_id in asset_id_list: group_add_asset(group, asset_id)
null
null
null
When do check policy correspond to the wrapped methods ?
def wrap_check_policy(func): @functools.wraps(func) def wrapped(self, context, target_obj, *args, **kwargs): check_policy(context, func.__name__, target_obj) return func(self, context, target_obj, *args, **kwargs) return wrapped
null
null
null
prior to execution
codeqa
def wrap check policy func @functools wraps func def wrapped self context target obj *args **kwargs check policy context func name target obj return func self context target obj *args **kwargs return wrapped
null
null
null
null
Question: When do check policy correspond to the wrapped methods ? Code: def wrap_check_policy(func): @functools.wraps(func) def wrapped(self, context, target_obj, *args, **kwargs): check_policy(context, func.__name__, target_obj) return func(self, context, target_obj, *args, **kwargs) return wrapped
null
null
null
How do a list of annotated sentences for a full - text document print ?
def _pretty_fulltext_sentences(sents): outstr = u'' outstr += u'full-text document ({0.ID}) {0.name}:\n\n'.format(sents) outstr += u'[corpid] {0.corpid}\n[corpname] {0.corpname}\n[description] {0.description}\n[URL] {0.URL}\n\n'.format(sents) outstr += u'[sentence]\n'.format(sents) for (i, sent) in enumerate(sents.sentence): outstr += u'[{0}] {1}\n'.format(i, sent.text) outstr += u'\n' return outstr
null
null
null
pretty
codeqa
def pretty fulltext sentences sents outstr u''outstr + u'full-textdocument {0 ID} {0 name} \n\n' format sents outstr + u'[corpid]{ 0 corpid}\n[corpname]{ 0 corpname}\n[description]{ 0 description}\n[URL]{ 0 URL}\n\n' format sents outstr + u'[sentence]\n' format sents for i sent in enumerate sents sentence outstr + u'[{ 0 }]{ 1 }\n' format i sent text outstr + u'\n'return outstr
null
null
null
null
Question: How do a list of annotated sentences for a full - text document print ? Code: def _pretty_fulltext_sentences(sents): outstr = u'' outstr += u'full-text document ({0.ID}) {0.name}:\n\n'.format(sents) outstr += u'[corpid] {0.corpid}\n[corpname] {0.corpname}\n[description] {0.description}\n[URL] {0.URL}\n\n'.format(sents) outstr += u'[sentence]\n'.format(sents) for (i, sent) in enumerate(sents.sentence): outstr += u'[{0}] {1}\n'.format(i, sent.text) outstr += u'\n' return outstr
null
null
null
What does the code ensure ?
def security_group_ensure_default(context, session=None): try: default_group = security_group_get_by_name(context, context.project_id, 'default', columns_to_join=[], session=session) return (True, default_group) except exception.NotFound: values = {'name': 'default', 'description': 'default', 'user_id': context.user_id, 'project_id': context.project_id} default_group = security_group_create(context, values, session=session) for default_rule in security_group_default_rule_list(context): rule_values = {'protocol': default_rule.protocol, 'from_port': default_rule.from_port, 'to_port': default_rule.to_port, 'cidr': default_rule.cidr, 'parent_group_id': default_group.id} security_group_rule_create(context, rule_values) return (False, default_group)
null
null
null
default security group exists for a project_id
codeqa
def security group ensure default context session None try default group security group get by name context context project id 'default' columns to join [] session session return True default group except exception Not Found values {'name' 'default' 'description' 'default' 'user id' context user id 'project id' context project id}default group security group create context values session session for default rule in security group default rule list context rule values {'protocol' default rule protocol 'from port' default rule from port 'to port' default rule to port 'cidr' default rule cidr 'parent group id' default group id}security group rule create context rule values return False default group
null
null
null
null
Question: What does the code ensure ? Code: def security_group_ensure_default(context, session=None): try: default_group = security_group_get_by_name(context, context.project_id, 'default', columns_to_join=[], session=session) return (True, default_group) except exception.NotFound: values = {'name': 'default', 'description': 'default', 'user_id': context.user_id, 'project_id': context.project_id} default_group = security_group_create(context, values, session=session) for default_rule in security_group_default_rule_list(context): rule_values = {'protocol': default_rule.protocol, 'from_port': default_rule.from_port, 'to_port': default_rule.to_port, 'cidr': default_rule.cidr, 'parent_group_id': default_group.id} security_group_rule_create(context, rule_values) return (False, default_group)
null
null
null
What returns from version ?
def get_main_version(version=None): version = get_complete_version(version) candidate_pos = _get_candidate_pos(version) return _get_version_string(version[:candidate_pos])
null
null
null
main version
codeqa
def get main version version None version get complete version version candidate pos get candidate pos version return get version string version[ candidate pos]
null
null
null
null
Question: What returns from version ? Code: def get_main_version(version=None): version = get_complete_version(version) candidate_pos = _get_candidate_pos(version) return _get_version_string(version[:candidate_pos])
null
null
null
What does main version return ?
def get_main_version(version=None): version = get_complete_version(version) candidate_pos = _get_candidate_pos(version) return _get_version_string(version[:candidate_pos])
null
null
null
from version
codeqa
def get main version version None version get complete version version candidate pos get candidate pos version return get version string version[ candidate pos]
null
null
null
null
Question: What does main version return ? Code: def get_main_version(version=None): version = get_complete_version(version) candidate_pos = _get_candidate_pos(version) return _get_version_string(version[:candidate_pos])
null
null
null
When did explorations publish ?
def get_recently_published_exp_summary_dicts(limit): recently_published_exploration_summaries = [exp_summary for exp_summary in exp_services.get_recently_published_exp_summaries(limit).values()] summaries = sorted(recently_published_exploration_summaries, key=(lambda exp_summary: exp_summary.first_published_msec), reverse=True) return get_displayable_exp_summary_dicts(summaries)
null
null
null
recently
codeqa
def get recently published exp summary dicts limit recently published exploration summaries [exp summary for exp summary in exp services get recently published exp summaries limit values ]summaries sorted recently published exploration summaries key lambda exp summary exp summary first published msec reverse True return get displayable exp summary dicts summaries
null
null
null
null
Question: When did explorations publish ? Code: def get_recently_published_exp_summary_dicts(limit): recently_published_exploration_summaries = [exp_summary for exp_summary in exp_services.get_recently_published_exp_summaries(limit).values()] summaries = sorted(recently_published_exploration_summaries, key=(lambda exp_summary: exp_summary.first_published_msec), reverse=True) return get_displayable_exp_summary_dicts(summaries)
null
null
null
What did the code read ?
def _gpa10iterator(handle): for inline in handle: if (inline[0] == '!'): continue inrec = inline.rstrip('\n').split(' DCTB ') if (len(inrec) == 1): continue inrec[2] = inrec[2].split('|') inrec[4] = inrec[4].split('|') inrec[6] = inrec[6].split('|') inrec[10] = inrec[10].split('|') (yield dict(zip(GPA10FIELDS, inrec)))
null
null
null
gpa 1
codeqa
def gpa 10 iterator handle for inline in handle if inline[ 0 ] ' ' continueinrec inline rstrip '\n' split ' DCTB ' if len inrec 1 continueinrec[ 2 ] inrec[ 2 ] split ' ' inrec[ 4 ] inrec[ 4 ] split ' ' inrec[ 6 ] inrec[ 6 ] split ' ' inrec[ 10 ] inrec[ 10 ] split ' ' yield dict zip GPA 10 FIELDS inrec
null
null
null
null
Question: What did the code read ? Code: def _gpa10iterator(handle): for inline in handle: if (inline[0] == '!'): continue inrec = inline.rstrip('\n').split(' DCTB ') if (len(inrec) == 1): continue inrec[2] = inrec[2].split('|') inrec[4] = inrec[4].split('|') inrec[6] = inrec[6].split('|') inrec[10] = inrec[10].split('|') (yield dict(zip(GPA10FIELDS, inrec)))
null
null
null
What commands action ?
def action_description(text): def _decorator(func): func.description = text return func return _decorator
null
null
null
a description
codeqa
def action description text def decorator func func description textreturn funcreturn decorator
null
null
null
null
Question: What commands action ? Code: def action_description(text): def _decorator(func): func.description = text return func return _decorator
null
null
null
What does a traditional - style method take ?
def cr_uid_id(method): method._api = 'cr_uid_id' return method
null
null
null
cr
codeqa
def cr uid id method method api 'cr uid id'return method
null
null
null
null
Question: What does a traditional - style method take ? Code: def cr_uid_id(method): method._api = 'cr_uid_id' return method
null
null
null
What does the code separate into its component parts ?
def split_named_range(range_string): destinations = [] for range_string in range_string.split(','): match = NAMED_RANGE_RE.match(range_string) if (not match): raise NamedRangeException(('Invalid named range string: "%s"' % range_string)) else: (sheet_name, xlrange) = match.groups()[:2] destinations.append((sheet_name, xlrange)) return destinations
null
null
null
a named range
codeqa
def split named range range string destinations []for range string in range string split ' ' match NAMED RANGE RE match range string if not match raise Named Range Exception ' Invalidnamedrangestring "%s"' % range string else sheet name xlrange match groups [ 2]destinations append sheet name xlrange return destinations
null
null
null
null
Question: What does the code separate into its component parts ? Code: def split_named_range(range_string): destinations = [] for range_string in range_string.split(','): match = NAMED_RANGE_RE.match(range_string) if (not match): raise NamedRangeException(('Invalid named range string: "%s"' % range_string)) else: (sheet_name, xlrange) = match.groups()[:2] destinations.append((sheet_name, xlrange)) return destinations
null
null
null
Whom do dictionaries describe ?
def _fetch_vhd_image(context, session, instance, image_id): LOG.debug('Asking xapi to fetch vhd image %s', image_id, instance=instance) handler = _choose_download_handler(context, instance) try: vdis = handler.download_image(context, session, instance, image_id) except Exception: default_handler = _default_download_handler() if (type(handler) == type(default_handler)): raise LOG.exception(_LE("Download handler '%(handler)s' raised an exception, falling back to default handler '%(default_handler)s'"), {'handler': handler, 'default_handler': default_handler}) vdis = default_handler.download_image(context, session, instance, image_id) scan_default_sr(session) vdi_uuid = vdis['root']['uuid'] try: _check_vdi_size(context, session, instance, vdi_uuid) except Exception: with excutils.save_and_reraise_exception(): msg = 'Error while checking vdi size' LOG.debug(msg, instance=instance, exc_info=True) for vdi in vdis.values(): vdi_uuid = vdi['uuid'] vdi_ref = session.call_xenapi('VDI.get_by_uuid', vdi_uuid) safe_destroy_vdis(session, [vdi_ref]) return vdis
null
null
null
vdis
codeqa
def fetch vhd image context session instance image id LOG debug ' Askingxapitofetchvhdimage%s' image id instance instance handler choose download handler context instance try vdis handler download image context session instance image id except Exception default handler default download handler if type handler type default handler raise LOG exception LE " Downloadhandler'% handler s'raisedanexception fallingbacktodefaulthandler'% default handler s'" {'handler' handler 'default handler' default handler} vdis default handler download image context session instance image id scan default sr session vdi uuid vdis['root']['uuid']try check vdi size context session instance vdi uuid except Exception with excutils save and reraise exception msg ' Errorwhilecheckingvdisize'LOG debug msg instance instance exc info True for vdi in vdis values vdi uuid vdi['uuid']vdi ref session call xenapi 'VDI get by uuid' vdi uuid safe destroy vdis session [vdi ref] return vdis
null
null
null
null
Question: Whom do dictionaries describe ? Code: def _fetch_vhd_image(context, session, instance, image_id): LOG.debug('Asking xapi to fetch vhd image %s', image_id, instance=instance) handler = _choose_download_handler(context, instance) try: vdis = handler.download_image(context, session, instance, image_id) except Exception: default_handler = _default_download_handler() if (type(handler) == type(default_handler)): raise LOG.exception(_LE("Download handler '%(handler)s' raised an exception, falling back to default handler '%(default_handler)s'"), {'handler': handler, 'default_handler': default_handler}) vdis = default_handler.download_image(context, session, instance, image_id) scan_default_sr(session) vdi_uuid = vdis['root']['uuid'] try: _check_vdi_size(context, session, instance, vdi_uuid) except Exception: with excutils.save_and_reraise_exception(): msg = 'Error while checking vdi size' LOG.debug(msg, instance=instance, exc_info=True) for vdi in vdis.values(): vdi_uuid = vdi['uuid'] vdi_ref = session.call_xenapi('VDI.get_by_uuid', vdi_uuid) safe_destroy_vdis(session, [vdi_ref]) return vdis
null
null
null
What downloaded it last ?
def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
the user
codeqa
def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match '^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header mtime rfc 822 mktime tz rfc 822 parsedate tz matches group 1 header len matches group 3 if header len and int header len size raise Value Errorif mtime > header mtime raise Value Errorexcept Attribute Error Value Error return Truereturn False
null
null
null
null
Question: What downloaded it last ? Code: def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
When did something modify ?
def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
since the user last downloaded it
codeqa
def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match '^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header mtime rfc 822 mktime tz rfc 822 parsedate tz matches group 1 header len matches group 3 if header len and int header len size raise Value Errorif mtime > header mtime raise Value Errorexcept Attribute Error Value Error return Truereturn False
null
null
null
null
Question: When did something modify ? Code: def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
When did the user download it ?
def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
last
codeqa
def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match '^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header mtime rfc 822 mktime tz rfc 822 parsedate tz matches group 1 header len matches group 3 if header len and int header len size raise Value Errorif mtime > header mtime raise Value Errorexcept Attribute Error Value Error return Truereturn False
null
null
null
null
Question: When did the user download it ? Code: def was_modified_since(header=None, mtime=0, size=0): try: if (header is None): raise ValueError matches = re.match('^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE) header_mtime = rfc822.mktime_tz(rfc822.parsedate_tz(matches.group(1))) header_len = matches.group(3) if (header_len and (int(header_len) != size)): raise ValueError if (mtime > header_mtime): raise ValueError except (AttributeError, ValueError): return True return False
null
null
null
What does the code reset ?
@task @needs(['stop']) def reset(): _reset()
null
null
null
a development environment
codeqa
@task@needs ['stop'] def reset reset
null
null
null
null
Question: What does the code reset ? Code: @task @needs(['stop']) def reset(): _reset()
null
null
null
What do staff browse ?
def filebrowser_view(view): return staff_member_required(never_cache(view))
null
null
null
the files
codeqa
def filebrowser view view return staff member required never cache view
null
null
null
null
Question: What do staff browse ? Code: def filebrowser_view(view): return staff_member_required(never_cache(view))
null
null
null
What browses the files ?
def filebrowser_view(view): return staff_member_required(never_cache(view))
null
null
null
staff
codeqa
def filebrowser view view return staff member required never cache view
null
null
null
null
Question: What browses the files ? Code: def filebrowser_view(view): return staff_member_required(never_cache(view))
null
null
null
How do predicate call ?
def loop_until(reactor, predicate, steps=None): if (steps is None): steps = repeat(0.1) steps = iter(steps) action = LOOP_UNTIL_ACTION(predicate=predicate) d = action.run(DeferredContext, maybeDeferred(action.run, predicate)) def loop(result): if (not result): LOOP_UNTIL_ITERATION_MESSAGE(result=result).write() try: delay = steps.next() except StopIteration: raise LoopExceeded(predicate, result) d = deferLater(reactor, delay, action.run, predicate) d.addCallback(partial(action.run, loop)) return d action.addSuccessFields(result=result) return result d.addCallback(loop) return d.addActionFinish()
null
null
null
repeatedly
codeqa
def loop until reactor predicate steps None if steps is None steps repeat 0 1 steps iter steps action LOOP UNTIL ACTION predicate predicate d action run Deferred Context maybe Deferred action run predicate def loop result if not result LOOP UNTIL ITERATION MESSAGE result result write try delay steps next except Stop Iteration raise Loop Exceeded predicate result d defer Later reactor delay action run predicate d add Callback partial action run loop return daction add Success Fields result result return resultd add Callback loop return d add Action Finish
null
null
null
null
Question: How do predicate call ? Code: def loop_until(reactor, predicate, steps=None): if (steps is None): steps = repeat(0.1) steps = iter(steps) action = LOOP_UNTIL_ACTION(predicate=predicate) d = action.run(DeferredContext, maybeDeferred(action.run, predicate)) def loop(result): if (not result): LOOP_UNTIL_ITERATION_MESSAGE(result=result).write() try: delay = steps.next() except StopIteration: raise LoopExceeded(predicate, result) d = deferLater(reactor, delay, action.run, predicate) d.addCallback(partial(action.run, loop)) return d action.addSuccessFields(result=result) return result d.addCallback(loop) return d.addActionFinish()
null
null
null
How does lane mask generate ?
def generate_lane_mask(aln, entropy_threshold): if (entropy_threshold == 0.0): result = (['1'] * aln.sequence_length()) else: entropies = aln.position_entropies(nan_on_non_standard_chars=False) entropy_cutoff = np.percentile(entropies, ((1 - entropy_threshold) * 100.0), interpolation='nearest') result = [] for entropy in entropies: if (entropy >= entropy_cutoff): result.append('0') else: result.append('1') return ''.join(result)
null
null
null
dynamically
codeqa
def generate lane mask aln entropy threshold if entropy threshold 0 0 result [' 1 '] * aln sequence length else entropies aln position entropies nan on non standard chars False entropy cutoff np percentile entropies 1 - entropy threshold * 100 0 interpolation 'nearest' result []for entropy in entropies if entropy > entropy cutoff result append '0 ' else result append '1 ' return '' join result
null
null
null
null
Question: How does lane mask generate ? Code: def generate_lane_mask(aln, entropy_threshold): if (entropy_threshold == 0.0): result = (['1'] * aln.sequence_length()) else: entropies = aln.position_entropies(nan_on_non_standard_chars=False) entropy_cutoff = np.percentile(entropies, ((1 - entropy_threshold) * 100.0), interpolation='nearest') result = [] for entropy in entropies: if (entropy >= entropy_cutoff): result.append('0') else: result.append('1') return ''.join(result)
null
null
null
What does the code convert ?
def escape(s): if hasattr(s, '__html__'): return s.__html__() return Markup(text_type(s).replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;').replace("'", '&#39;').replace('"', '&#34;'))
null
null
null
the characters
codeqa
def escape s if hasattr s ' html ' return s html return Markup text type s replace '&' '&amp ' replace '>' '&gt ' replace '<' '&lt ' replace "'" '&# 39 ' replace '"' '&# 34 '
null
null
null
null
Question: What does the code convert ? Code: def escape(s): if hasattr(s, '__html__'): return s.__html__() return Markup(text_type(s).replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;').replace("'", '&#39;').replace('"', '&#34;'))
null
null
null
In which direction do multiple columns select when ?
def test_suggested_multiple_column_names(completer, complete_event): text = u'SELECT id, from custom.products' position = len(u'SELECT id, ') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(((testdata.columns(u'products', u'custom') + testdata.functions()) + list((testdata.builtin_functions() + testdata.keywords())))))
null
null
null
from table
codeqa
def test suggested multiple column names completer complete event text u'SELEC Tid fromcustom products'position len u'SELEC Tid ' result set completer get completions Document text text cursor position position complete event assert set result set testdata columns u'products' u'custom' + testdata functions + list testdata builtin functions + testdata keywords
null
null
null
null
Question: In which direction do multiple columns select when ? Code: def test_suggested_multiple_column_names(completer, complete_event): text = u'SELECT id, from custom.products' position = len(u'SELECT id, ') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(((testdata.columns(u'products', u'custom') + testdata.functions()) + list((testdata.builtin_functions() + testdata.keywords())))))
null
null
null
When do column and function names suggest ?
def test_suggested_multiple_column_names(completer, complete_event): text = u'SELECT id, from custom.products' position = len(u'SELECT id, ') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(((testdata.columns(u'products', u'custom') + testdata.functions()) + list((testdata.builtin_functions() + testdata.keywords())))))
null
null
null
when selecting multiple columns from table
codeqa
def test suggested multiple column names completer complete event text u'SELEC Tid fromcustom products'position len u'SELEC Tid ' result set completer get completions Document text text cursor position position complete event assert set result set testdata columns u'products' u'custom' + testdata functions + list testdata builtin functions + testdata keywords
null
null
null
null
Question: When do column and function names suggest ? Code: def test_suggested_multiple_column_names(completer, complete_event): text = u'SELECT id, from custom.products' position = len(u'SELECT id, ') result = set(completer.get_completions(Document(text=text, cursor_position=position), complete_event)) assert (set(result) == set(((testdata.columns(u'products', u'custom') + testdata.functions()) + list((testdata.builtin_functions() + testdata.keywords())))))
null
null
null
What does the code normalize ?
def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
the version
codeqa
def norm version version build '' l version split ' ' if build l append build try ints map int l except Value Error strings lelse strings list map str ints version ' ' join strings[ 3] return version
null
null
null
null
Question: What does the code normalize ? Code: def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
What does the code return using the format major ?
def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
a single version string
codeqa
def norm version version build '' l version split ' ' if build l append build try ints map int l except Value Error strings lelse strings list map str ints version ' ' join strings[ 3] return version
null
null
null
null
Question: What does the code return using the format major ? Code: def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
What does the code build ?
def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
strings
codeqa
def norm version version build '' l version split ' ' if build l append build try ints map int l except Value Error strings lelse strings list map str ints version ' ' join strings[ 3] return version
null
null
null
null
Question: What does the code build ? Code: def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
How does the code return a single version string ?
def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
using the format major
codeqa
def norm version version build '' l version split ' ' if build l append build try ints map int l except Value Error strings lelse strings list map str ints version ' ' join strings[ 3] return version
null
null
null
null
Question: How does the code return a single version string ? Code: def _norm_version(version, build=''): l = version.split('.') if build: l.append(build) try: ints = map(int, l) except ValueError: strings = l else: strings = list(map(str, ints)) version = '.'.join(strings[:3]) return version
null
null
null
What does the code delete ?
@login_required @permission_required_or_403('forums_forum.post_delete_forum', (Forum, 'slug__iexact', 'forum_slug')) def delete_post(request, forum_slug, thread_id, post_id): forum = get_object_or_404(Forum, slug=forum_slug) thread = get_object_or_404(Thread, pk=thread_id, forum=forum) post = get_object_or_404(Post, pk=post_id, thread=thread) if (request.method == 'GET'): return render(request, 'forums/confirm_post_delete.html', {'forum': forum, 'thread': thread, 'post': post}) log.warning(('User %s is deleting post with id=%s' % (request.user, post.id))) post.delete() statsd.incr('forums.delete_post') try: Thread.objects.get(pk=thread_id) goto = reverse('forums.posts', args=[forum_slug, thread_id]) except Thread.DoesNotExist: goto = reverse('forums.threads', args=[forum_slug]) return HttpResponseRedirect(goto)
null
null
null
a post
codeqa
@login required@permission required or 403 'forums forum post delete forum' Forum 'slug iexact' 'forum slug' def delete post request forum slug thread id post id forum get object or 404 Forum slug forum slug thread get object or 404 Thread pk thread id forum forum post get object or 404 Post pk post id thread thread if request method 'GET' return render request 'forums/confirm post delete html' {'forum' forum 'thread' thread 'post' post} log warning ' User%sisdeletingpostwithid %s' % request user post id post delete statsd incr 'forums delete post' try Thread objects get pk thread id goto reverse 'forums posts' args [forum slug thread id] except Thread Does Not Exist goto reverse 'forums threads' args [forum slug] return Http Response Redirect goto
null
null
null
null
Question: What does the code delete ? Code: @login_required @permission_required_or_403('forums_forum.post_delete_forum', (Forum, 'slug__iexact', 'forum_slug')) def delete_post(request, forum_slug, thread_id, post_id): forum = get_object_or_404(Forum, slug=forum_slug) thread = get_object_or_404(Thread, pk=thread_id, forum=forum) post = get_object_or_404(Post, pk=post_id, thread=thread) if (request.method == 'GET'): return render(request, 'forums/confirm_post_delete.html', {'forum': forum, 'thread': thread, 'post': post}) log.warning(('User %s is deleting post with id=%s' % (request.user, post.id))) post.delete() statsd.incr('forums.delete_post') try: Thread.objects.get(pk=thread_id) goto = reverse('forums.posts', args=[forum_slug, thread_id]) except Thread.DoesNotExist: goto = reverse('forums.threads', args=[forum_slug]) return HttpResponseRedirect(goto)
null
null
null
When did formats implement ?
def default_formats(): return {'html': {'nbconvert_template': 'basic', 'label': 'Notebook', 'icon': 'book'}, 'slides': {'nbconvert_template': 'slides_reveal', 'label': 'Slides', 'icon': 'gift', 'test': (lambda nb, json: ('"slideshow"' in json))}, 'script': {'label': 'Code', 'icon': 'code', 'content_type': 'text/plain; charset=UTF-8'}}
null
null
null
currently
codeqa
def default formats return {'html' {'nbconvert template' 'basic' 'label' ' Notebook' 'icon' 'book'} 'slides' {'nbconvert template' 'slides reveal' 'label' ' Slides' 'icon' 'gift' 'test' lambda nb json '"slideshow"' in json } 'script' {'label' ' Code' 'icon' 'code' 'content type' 'text/plain charset UTF- 8 '}}
null
null
null
null
Question: When did formats implement ? Code: def default_formats(): return {'html': {'nbconvert_template': 'basic', 'label': 'Notebook', 'icon': 'book'}, 'slides': {'nbconvert_template': 'slides_reveal', 'label': 'Slides', 'icon': 'gift', 'test': (lambda nb, json: ('"slideshow"' in json))}, 'script': {'label': 'Code', 'icon': 'code', 'content_type': 'text/plain; charset=UTF-8'}}
null
null
null
What returns within a string ?
def col(loc, strg): return (loc - strg.rfind('\n', 0, loc))
null
null
null
current column
codeqa
def col loc strg return loc - strg rfind '\n' 0 loc
null
null
null
null
Question: What returns within a string ? Code: def col(loc, strg): return (loc - strg.rfind('\n', 0, loc))
null
null
null
Where does current column return ?
def col(loc, strg): return (loc - strg.rfind('\n', 0, loc))
null
null
null
within a string
codeqa
def col loc strg return loc - strg rfind '\n' 0 loc
null
null
null
null
Question: Where does current column return ? Code: def col(loc, strg): return (loc - strg.rfind('\n', 0, loc))
null
null
null
How do ties break ?
def argmin_random_tie(seq, func): return random.choice(argmin_list(seq, func))
null
null
null
at random
codeqa
def argmin random tie seq func return random choice argmin list seq func
null
null
null
null
Question: How do ties break ? Code: def argmin_random_tie(seq, func): return random.choice(argmin_list(seq, func))
null
null
null
When did modules load ?
def lsmod(): ret = [] for line in __salt__['cmd.run']('lsmod').splitlines(): comps = line.split() if (not (len(comps) > 2)): continue if (comps[0] == 'Module'): continue mdat = {'size': comps[1], 'module': comps[0], 'depcount': comps[2]} if (len(comps) > 3): mdat['deps'] = comps[3].split(',') else: mdat['deps'] = [] ret.append(mdat) return ret
null
null
null
currently
codeqa
def lsmod ret []for line in salt ['cmd run'] 'lsmod' splitlines comps line split if not len comps > 2 continueif comps[ 0 ] ' Module' continuemdat {'size' comps[ 1 ] 'module' comps[ 0 ] 'depcount' comps[ 2 ]}if len comps > 3 mdat['deps'] comps[ 3 ] split ' ' else mdat['deps'] []ret append mdat return ret
null
null
null
null
Question: When did modules load ? Code: def lsmod(): ret = [] for line in __salt__['cmd.run']('lsmod').splitlines(): comps = line.split() if (not (len(comps) > 2)): continue if (comps[0] == 'Module'): continue mdat = {'size': comps[1], 'module': comps[0], 'depcount': comps[2]} if (len(comps) > 3): mdat['deps'] = comps[3].split(',') else: mdat['deps'] = [] ret.append(mdat) return ret
null
null
null
What is the source reporting ?
@blueprint.route('/sources/<source>/users') def list_users_by_source(source): return _list_users(source=source)
null
null
null
data
codeqa
@blueprint route '/sources/<source>/users' def list users by source source return list users source source
null
null
null
null
Question: What is the source reporting ? Code: @blueprint.route('/sources/<source>/users') def list_users_by_source(source): return _list_users(source=source)
null
null
null
What is reporting data ?
@blueprint.route('/sources/<source>/users') def list_users_by_source(source): return _list_users(source=source)
null
null
null
the source
codeqa
@blueprint route '/sources/<source>/users' def list users by source source return list users source source
null
null
null
null
Question: What is reporting data ? Code: @blueprint.route('/sources/<source>/users') def list_users_by_source(source): return _list_users(source=source)
null
null
null
What parses the model data to compress extra fields ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
us
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: What parses the model data to compress extra fields ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
What do us parse to compress extra fields ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
the model data
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: What do us parse to compress extra fields ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
For what purpose do us parse the model data ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
to compress extra fields
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: For what purpose do us parse the model data ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
What does us specify ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
a database
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: What does us specify ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
Where do wrapper create ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
around
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: Where do wrapper create ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
What do us compress ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
extra fields
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: What do us compress ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
What creates around ?
@set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
wrapper
codeqa
@set databasedef get or create item **kwargs if item return Item create or get **parse model data item
null
null
null
null
Question: What creates around ? Code: @set_database def get_or_create(item, **kwargs): if item: return Item.create_or_get(**parse_model_data(item))
null
null
null
What does the code return ?
def bit_size(number): return int(math.ceil(math.log(number, 2)))
null
null
null
the number of bits required to hold a specific long number
codeqa
def bit size number return int math ceil math log number 2
null
null
null
null
Question: What does the code return ? Code: def bit_size(number): return int(math.ceil(math.log(number, 2)))
null
null
null
What does the code delete ?
def delete_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, region=None, key=None, keyid=None, profile=None): if (not _exactly_one((route_table_name, route_table_id))): raise SaltInvocationError('One (but not both) of route_table_id or route_table_name must be provided.') if (destination_cidr_block is None): raise SaltInvocationError('destination_cidr_block is required.') try: if route_table_name: route_table_id = _get_resource_id('route_table', route_table_name, region=region, key=key, keyid=keyid, profile=profile) if (not route_table_id): return {'created': False, 'error': {'message': 'route table {0} does not exist.'.format(route_table_name)}} except BotoServerError as e: return {'created': False, 'error': salt.utils.boto.get_error(e)} return _delete_resource(resource='route', resource_id=route_table_id, destination_cidr_block=destination_cidr_block, region=region, key=key, keyid=keyid, profile=profile)
null
null
null
a route
codeqa
def delete route route table id None destination cidr block None route table name None region None key None keyid None profile None if not exactly one route table name route table id raise Salt Invocation Error ' One butnotboth ofroute table idorroute table namemustbeprovided ' if destination cidr block is None raise Salt Invocation Error 'destination cidr blockisrequired ' try if route table name route table id get resource id 'route table' route table name region region key key keyid keyid profile profile if not route table id return {'created' False 'error' {'message' 'routetable{ 0 }doesnotexist ' format route table name }}except Boto Server Error as e return {'created' False 'error' salt utils boto get error e }return delete resource resource 'route' resource id route table id destination cidr block destination cidr block region region key key keyid keyid profile profile
null
null
null
null
Question: What does the code delete ? Code: def delete_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, region=None, key=None, keyid=None, profile=None): if (not _exactly_one((route_table_name, route_table_id))): raise SaltInvocationError('One (but not both) of route_table_id or route_table_name must be provided.') if (destination_cidr_block is None): raise SaltInvocationError('destination_cidr_block is required.') try: if route_table_name: route_table_id = _get_resource_id('route_table', route_table_name, region=region, key=key, keyid=keyid, profile=profile) if (not route_table_id): return {'created': False, 'error': {'message': 'route table {0} does not exist.'.format(route_table_name)}} except BotoServerError as e: return {'created': False, 'error': salt.utils.boto.get_error(e)} return _delete_resource(resource='route', resource_id=route_table_id, destination_cidr_block=destination_cidr_block, region=region, key=key, keyid=keyid, profile=profile)
null
null
null
What does the code return ?
def IPNetwork(address, version=None): if version: if (version == 4): return IPv4Network(address) elif (version == 6): return IPv6Network(address) try: return IPv4Network(address) except (IPv4IpValidationError, IPv4NetmaskValidationError): pass try: return IPv6Network(address) except (IPv6IpValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 network' % address))
null
null
null
an object of the correct type
codeqa
def IP Network address version None if version if version 4 return I Pv 4 Network address elif version 6 return I Pv 6 Network address try return I Pv 4 Network address except I Pv 4 Ip Validation Error I Pv 4 Netmask Validation Error passtry return I Pv 6 Network address except I Pv 6 Ip Validation Error I Pv 6 Netmask Validation Error passraise Value Error '%rdoesnotappeartobean I Pv 4 or I Pv 6 network' % address
null
null
null
null
Question: What does the code return ? Code: def IPNetwork(address, version=None): if version: if (version == 4): return IPv4Network(address) elif (version == 6): return IPv6Network(address) try: return IPv4Network(address) except (IPv4IpValidationError, IPv4NetmaskValidationError): pass try: return IPv6Network(address) except (IPv6IpValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 network' % address))
null
null
null
What does the code create ?
def lowstate_file_refs(chunks, extras=''): refs = {} for chunk in chunks: if (not isinstance(chunk, dict)): continue saltenv = 'base' crefs = [] for state in chunk: if (state == '__env__'): saltenv = chunk[state] elif state.startswith('__'): continue crefs.extend(salt_refs(chunk[state])) if crefs: if (saltenv not in refs): refs[saltenv] = [] refs[saltenv].append(crefs) if extras: extra_refs = extras.split(',') if extra_refs: for env in refs: for x in extra_refs: refs[env].append([x]) return refs
null
null
null
a list of file ref objects to reconcile
codeqa
def lowstate file refs chunks extras '' refs {}for chunk in chunks if not isinstance chunk dict continuesaltenv 'base'crefs []for state in chunk if state ' env ' saltenv chunk[state]elif state startswith ' ' continuecrefs extend salt refs chunk[state] if crefs if saltenv not in refs refs[saltenv] []refs[saltenv] append crefs if extras extra refs extras split ' ' if extra refs for env in refs for x in extra refs refs[env] append [x] return refs
null
null
null
null
Question: What does the code create ? Code: def lowstate_file_refs(chunks, extras=''): refs = {} for chunk in chunks: if (not isinstance(chunk, dict)): continue saltenv = 'base' crefs = [] for state in chunk: if (state == '__env__'): saltenv = chunk[state] elif state.startswith('__'): continue crefs.extend(salt_refs(chunk[state])) if crefs: if (saltenv not in refs): refs[saltenv] = [] refs[saltenv].append(crefs) if extras: extra_refs = extras.split(',') if extra_refs: for env in refs: for x in extra_refs: refs[env].append([x]) return refs
null
null
null
What logs how long a particular function took to execute ?
def timefunc(func): @functools.wraps(func) def inner(*args, **kwargs): start_time = time.time() try: return func(*args, **kwargs) finally: total_time = (time.time() - start_time) LOG.debug((_("timefunc: '%(name)s' took %(total_time).2f secs") % dict(name=func.__name__, total_time=total_time))) return inner
null
null
null
decorator
codeqa
def timefunc func @functools wraps func def inner *args **kwargs start time time time try return func *args **kwargs finally total time time time - start time LOG debug "timefunc '% name s'took% total time 2fsecs" % dict name func name total time total time return inner
null
null
null
null
Question: What logs how long a particular function took to execute ? Code: def timefunc(func): @functools.wraps(func) def inner(*args, **kwargs): start_time = time.time() try: return func(*args, **kwargs) finally: total_time = (time.time() - start_time) LOG.debug((_("timefunc: '%(name)s' took %(total_time).2f secs") % dict(name=func.__name__, total_time=total_time))) return inner
null
null
null
What does decorator log ?
def timefunc(func): @functools.wraps(func) def inner(*args, **kwargs): start_time = time.time() try: return func(*args, **kwargs) finally: total_time = (time.time() - start_time) LOG.debug((_("timefunc: '%(name)s' took %(total_time).2f secs") % dict(name=func.__name__, total_time=total_time))) return inner
null
null
null
how long a particular function took to execute
codeqa
def timefunc func @functools wraps func def inner *args **kwargs start time time time try return func *args **kwargs finally total time time time - start time LOG debug "timefunc '% name s'took% total time 2fsecs" % dict name func name total time total time return inner
null
null
null
null
Question: What does decorator log ? Code: def timefunc(func): @functools.wraps(func) def inner(*args, **kwargs): start_time = time.time() try: return func(*args, **kwargs) finally: total_time = (time.time() - start_time) LOG.debug((_("timefunc: '%(name)s' took %(total_time).2f secs") % dict(name=func.__name__, total_time=total_time))) return inner
null
null
null
In which direction did the entire contents of a file read ?
def _slurp(filename): with open(filename) as f: return f.read()
null
null
null
in
codeqa
def slurp filename with open filename as f return f read
null
null
null
null
Question: In which direction did the entire contents of a file read ? Code: def _slurp(filename): with open(filename) as f: return f.read()
null
null
null
What is matching the filters into a cluster ?
def volume_include_in_cluster(context, cluster, partial_rename=True, **filters): return IMPL.volume_include_in_cluster(context, cluster, partial_rename, **filters)
null
null
null
all volumes
codeqa
def volume include in cluster context cluster partial rename True **filters return IMPL volume include in cluster context cluster partial rename **filters
null
null
null
null
Question: What is matching the filters into a cluster ? Code: def volume_include_in_cluster(context, cluster, partial_rename=True, **filters): return IMPL.volume_include_in_cluster(context, cluster, partial_rename, **filters)
null
null
null
What do all volumes match into a cluster ?
def volume_include_in_cluster(context, cluster, partial_rename=True, **filters): return IMPL.volume_include_in_cluster(context, cluster, partial_rename, **filters)
null
null
null
the filters
codeqa
def volume include in cluster context cluster partial rename True **filters return IMPL volume include in cluster context cluster partial rename **filters
null
null
null
null
Question: What do all volumes match into a cluster ? Code: def volume_include_in_cluster(context, cluster, partial_rename=True, **filters): return IMPL.volume_include_in_cluster(context, cluster, partial_rename, **filters)
null
null
null
How do send block ?
def isend(var, dest, tag): return MPISend(dest, tag)(var)
null
null
null
non
codeqa
def isend var dest tag return MPI Send dest tag var
null
null
null
null
Question: How do send block ? Code: def isend(var, dest, tag): return MPISend(dest, tag)(var)
null
null
null
What does the code update with the data for the current document ?
def push(session_id=None, url=None, app_path=None, document=None, state=None, io_loop=None, validate=True): if (state is None): state = _state if (not session_id): session_id = state.session_id_allowing_none if (not url): url = state.url if (not app_path): app_path = state.app_path assert (session_id is not None) assert (url is not None) assert (app_path is not None) if (not document): document = state.document if (not document): warnings.warn('No document to push') if validate: document.validate() _push_to_server(session_id=session_id, url=url, app_path=app_path, document=document, io_loop=io_loop)
null
null
null
the server
codeqa
def push session id None url None app path None document None state None io loop None validate True if state is None state stateif not session id session id state session id allowing noneif not url url state urlif not app path app path state app pathassert session id is not None assert url is not None assert app path is not None if not document document state documentif not document warnings warn ' Nodocumenttopush' if validate document validate push to server session id session id url url app path app path document document io loop io loop
null
null
null
null
Question: What does the code update with the data for the current document ? Code: def push(session_id=None, url=None, app_path=None, document=None, state=None, io_loop=None, validate=True): if (state is None): state = _state if (not session_id): session_id = state.session_id_allowing_none if (not url): url = state.url if (not app_path): app_path = state.app_path assert (session_id is not None) assert (url is not None) assert (app_path is not None) if (not document): document = state.document if (not document): warnings.warn('No document to push') if validate: document.validate() _push_to_server(session_id=session_id, url=url, app_path=app_path, document=document, io_loop=io_loop)
null
null
null
What do windows convert to string ?
@deprecated('Use TimedeltaWin64 field type') def durationWin64(field): assert (hasattr(field, 'value') and hasattr(field, 'size')) assert (field.size == 64) delta = doDurationWin64(field.value) return humanDuration(delta)
null
null
null
windows
codeqa
@deprecated ' Use Timedelta Win 64 fieldtype' def duration Win 64 field assert hasattr field 'value' and hasattr field 'size' assert field size 64 delta do Duration Win 64 field value return human Duration delta
null
null
null
null
Question: What do windows convert to string ? Code: @deprecated('Use TimedeltaWin64 field type') def durationWin64(field): assert (hasattr(field, 'value') and hasattr(field, 'size')) assert (field.size == 64) delta = doDurationWin64(field.value) return humanDuration(delta)
null
null
null
What did you strip to determine if we need to force season folders to be enabled or not ?
def check_force_season_folders(pattern=None, multi=None, anime_type=None): if (pattern is None): pattern = sickbeard.NAMING_PATTERN if (anime_type is None): anime_type = sickbeard.NAMING_ANIME valid = (not validate_name(pattern, None, anime_type, file_only=True)) if (multi is not None): valid = (valid or (not validate_name(pattern, multi, anime_type, file_only=True))) return valid
null
null
null
the folders
codeqa
def check force season folders pattern None multi None anime type None if pattern is None pattern sickbeard NAMING PATTER Nif anime type is None anime type sickbeard NAMING ANIM Evalid not validate name pattern None anime type file only True if multi is not None valid valid or not validate name pattern multi anime type file only True return valid
null
null
null
null
Question: What did you strip to determine if we need to force season folders to be enabled or not ? Code: def check_force_season_folders(pattern=None, multi=None, anime_type=None): if (pattern is None): pattern = sickbeard.NAMING_PATTERN if (anime_type is None): anime_type = sickbeard.NAMING_ANIME valid = (not validate_name(pattern, None, anime_type, file_only=True)) if (multi is not None): valid = (valid or (not validate_name(pattern, multi, anime_type, file_only=True))) return valid
null
null
null
For what purpose is an undefined - step snippet provided ?
@then(u'an undefined-step snippet should exist for "{step}"') def step_undefined_step_snippet_should_exist_for(context, step): undefined_step_snippet = make_undefined_step_snippet(step) context.execute_steps(u'Then the command output should contain:\n """\n {undefined_step_snippet}\n """\n '.format(undefined_step_snippet=text_indent(undefined_step_snippet, 4)))
null
null
null
for a step in behave command output
codeqa
@then u'anundefined-stepsnippetshouldexistfor"{step}"' def step undefined step snippet should exist for context step undefined step snippet make undefined step snippet step context execute steps u' Thenthecommandoutputshouldcontain \n"""\n{undefined step snippet}\n"""\n' format undefined step snippet text indent undefined step snippet 4
null
null
null
null
Question: For what purpose is an undefined - step snippet provided ? Code: @then(u'an undefined-step snippet should exist for "{step}"') def step_undefined_step_snippet_should_exist_for(context, step): undefined_step_snippet = make_undefined_step_snippet(step) context.execute_steps(u'Then the command output should contain:\n """\n {undefined_step_snippet}\n """\n '.format(undefined_step_snippet=text_indent(undefined_step_snippet, 4)))
null
null
null
How d volume types get ?
def volume_types_get_by_name_or_id(context, volume_type_list): return IMPL.volume_types_get_by_name_or_id(context, volume_type_list)
null
null
null
by name
codeqa
def volume types get by name or id context volume type list return IMPL volume types get by name or id context volume type list
null
null
null
null
Question: How d volume types get ? Code: def volume_types_get_by_name_or_id(context, volume_type_list): return IMPL.volume_types_get_by_name_or_id(context, volume_type_list)
null
null
null
How do nodes inferred by the given statement generate ?
def _annotated_unpack_infer(stmt, context=None): if isinstance(stmt, (List, Tuple)): for elt in stmt.elts: inferred = safe_infer(elt) if (inferred and (inferred is not YES)): (yield (elt, inferred)) return for infered in stmt.infer(context): if (infered is YES): continue (yield (stmt, infered))
null
null
null
recursively
codeqa
def annotated unpack infer stmt context None if isinstance stmt List Tuple for elt in stmt elts inferred safe infer elt if inferred and inferred is not YES yield elt inferred returnfor infered in stmt infer context if infered is YES continue yield stmt infered
null
null
null
null
Question: How do nodes inferred by the given statement generate ? Code: def _annotated_unpack_infer(stmt, context=None): if isinstance(stmt, (List, Tuple)): for elt in stmt.elts: inferred = safe_infer(elt) if (inferred and (inferred is not YES)): (yield (elt, inferred)) return for infered in stmt.infer(context): if (infered is YES): continue (yield (stmt, infered))
null
null
null
What does the code convert ?
def normalize_path(path): return os.path.normcase(os.path.realpath(os.path.expanduser(path)))
null
null
null
a path to its canonical
codeqa
def normalize path path return os path normcase os path realpath os path expanduser path
null
null
null
null
Question: What does the code convert ? Code: def normalize_path(path): return os.path.normcase(os.path.realpath(os.path.expanduser(path)))
null
null
null
What does the code add to vector3rackprofiles ?
def addRackHole(derivation, elementNode, vector3RackProfiles, x): rackHole = euclidean.getComplexPolygon(complex(x, (- derivation.rackHoleBelow)), derivation.rackHoleRadius, (-13)) vector3RackProfiles.append(euclidean.getVector3Path(rackHole))
null
null
null
rack hole
codeqa
def add Rack Hole derivation element Node vector 3 Rack Profiles x rack Hole euclidean get Complex Polygon complex x - derivation rack Hole Below derivation rack Hole Radius -13 vector 3 Rack Profiles append euclidean get Vector 3 Path rack Hole
null
null
null
null
Question: What does the code add to vector3rackprofiles ? Code: def addRackHole(derivation, elementNode, vector3RackProfiles, x): rackHole = euclidean.getComplexPolygon(complex(x, (- derivation.rackHoleBelow)), derivation.rackHoleRadius, (-13)) vector3RackProfiles.append(euclidean.getVector3Path(rackHole))
null
null
null
What did the code read ?
def _read_int32(f): return np.int32(struct.unpack('>i', f.read(4))[0])
null
null
null
a signed 32-bit integer
codeqa
def read int 32 f return np int 32 struct unpack '>i' f read 4 [0 ]
null
null
null
null
Question: What did the code read ? Code: def _read_int32(f): return np.int32(struct.unpack('>i', f.read(4))[0])
null
null
null
How do request do ?
def request(config_content, layer_name, format, row, column, zoom): if (sys.version_info.major == 2): is_string = isinstance(config_content, basestring) else: is_string = isinstance(config_content, (str, bytes)) if is_string: absolute_file_name = create_temp_file(config_content) config = parseConfig(absolute_file_name) else: config = parseConfig(config_content) layer = config.layers[layer_name] coord = Coordinate(int(row), int(column), int(zoom)) (mime_type, tile_content) = getTile(layer, coord, format) if is_string: os.remove(absolute_file_name) return (mime_type, tile_content)
null
null
null
helper method
codeqa
def request config content layer name format row column zoom if sys version info major 2 is string isinstance config content basestring else is string isinstance config content str bytes if is string absolute file name create temp file config content config parse Config absolute file name else config parse Config config content layer config layers[layer name]coord Coordinate int row int column int zoom mime type tile content get Tile layer coord format if is string os remove absolute file name return mime type tile content
null
null
null
null
Question: How do request do ? Code: def request(config_content, layer_name, format, row, column, zoom): if (sys.version_info.major == 2): is_string = isinstance(config_content, basestring) else: is_string = isinstance(config_content, (str, bytes)) if is_string: absolute_file_name = create_temp_file(config_content) config = parseConfig(absolute_file_name) else: config = parseConfig(config_content) layer = config.layers[layer_name] coord = Coordinate(int(row), int(column), int(zoom)) (mime_type, tile_content) = getTile(layer, coord, format) if is_string: os.remove(absolute_file_name) return (mime_type, tile_content)
null
null
null
How do an error log ?
def _raise_error_iface(iface, option, expected): msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
null
null
null
with a logical formatted message
codeqa
def raise error iface iface option expected msg error msg iface iface option expected log error msg raise Attribute Error msg
null
null
null
null
Question: How do an error log ? Code: def _raise_error_iface(iface, option, expected): msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
null
null
null
How do an error raise ?
def _raise_error_iface(iface, option, expected): msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
null
null
null
with a logical formatted message
codeqa
def raise error iface iface option expected msg error msg iface iface option expected log error msg raise Attribute Error msg
null
null
null
null
Question: How do an error raise ? Code: def _raise_error_iface(iface, option, expected): msg = _error_msg_iface(iface, option, expected) log.error(msg) raise AttributeError(msg)
null
null
null
What does the groups of digits found in our candidate phone number match ?
def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
our expectations
codeqa
def all number groups remain grouped numobj normalized candidate formatted number groups from index 0if numobj country code source Country Code Source FROM DEFAULT COUNTRY country code str numobj country code from index normalized candidate find country code + len country code for ii formatted number group in enumerate formatted number groups from index normalized candidate find formatted number group from index if from index < 0 return Falsefrom index + len formatted number group if ii 0 and from index < len normalized candidate region region code for country code numobj country code if ndd prefix for region region True is not None and normalized candidate[from index] isdigit nsn national significant number numobj return normalized candidate[ from index - len formatted number group ] startswith nsn return normalized candidate[from index ] find numobj extension or U EMPTY STRING -1
null
null
null
null
Question: What does the groups of digits found in our candidate phone number match ? Code: def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
What found the in our candidate phone number ?
def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
the
codeqa
def all number groups remain grouped numobj normalized candidate formatted number groups from index 0if numobj country code source Country Code Source FROM DEFAULT COUNTRY country code str numobj country code from index normalized candidate find country code + len country code for ii formatted number group in enumerate formatted number groups from index normalized candidate find formatted number group from index if from index < 0 return Falsefrom index + len formatted number group if ii 0 and from index < len normalized candidate region region code for country code numobj country code if ndd prefix for region region True is not None and normalized candidate[from index] isdigit nsn national significant number numobj return normalized candidate[ from index - len formatted number group ] startswith nsn return normalized candidate[from index ] find numobj extension or U EMPTY STRING -1
null
null
null
null
Question: What found the in our candidate phone number ? Code: def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
What match our expectations ?
def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
the groups of digits found in our candidate phone number
codeqa
def all number groups remain grouped numobj normalized candidate formatted number groups from index 0if numobj country code source Country Code Source FROM DEFAULT COUNTRY country code str numobj country code from index normalized candidate find country code + len country code for ii formatted number group in enumerate formatted number groups from index normalized candidate find formatted number group from index if from index < 0 return Falsefrom index + len formatted number group if ii 0 and from index < len normalized candidate region region code for country code numobj country code if ndd prefix for region region True is not None and normalized candidate[from index] isdigit nsn national significant number numobj return normalized candidate[ from index - len formatted number group ] startswith nsn return normalized candidate[from index ] find numobj extension or U EMPTY STRING -1
null
null
null
null
Question: What match our expectations ? Code: def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
Where did the find the ?
def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
in our candidate phone number
codeqa
def all number groups remain grouped numobj normalized candidate formatted number groups from index 0if numobj country code source Country Code Source FROM DEFAULT COUNTRY country code str numobj country code from index normalized candidate find country code + len country code for ii formatted number group in enumerate formatted number groups from index normalized candidate find formatted number group from index if from index < 0 return Falsefrom index + len formatted number group if ii 0 and from index < len normalized candidate region region code for country code numobj country code if ndd prefix for region region True is not None and normalized candidate[from index] isdigit nsn national significant number numobj return normalized candidate[ from index - len formatted number group ] startswith nsn return normalized candidate[from index ] find numobj extension or U EMPTY STRING -1
null
null
null
null
Question: Where did the find the ? Code: def _all_number_groups_remain_grouped(numobj, normalized_candidate, formatted_number_groups): from_index = 0 if (numobj.country_code_source != CountryCodeSource.FROM_DEFAULT_COUNTRY): country_code = str(numobj.country_code) from_index = (normalized_candidate.find(country_code) + len(country_code)) for (ii, formatted_number_group) in enumerate(formatted_number_groups): from_index = normalized_candidate.find(formatted_number_group, from_index) if (from_index < 0): return False from_index += len(formatted_number_group) if ((ii == 0) and (from_index < len(normalized_candidate))): region = region_code_for_country_code(numobj.country_code) if ((ndd_prefix_for_region(region, True) is not None) and normalized_candidate[from_index].isdigit()): nsn = national_significant_number(numobj) return normalized_candidate[(from_index - len(formatted_number_group)):].startswith(nsn) return (normalized_candidate[from_index:].find((numobj.extension or U_EMPTY_STRING)) != (-1))
null
null
null
What do callback decorator require ?
def auth_basic(check, realm='private', text='Access denied'): def decorator(func): def wrapper(*a, **ka): (user, password) = (request.auth or (None, None)) if ((user is None) or (not check(user, password))): response.headers['WWW-Authenticate'] = ('Basic realm="%s"' % realm) return HTTPError(401, text) return func(*a, **ka) return wrapper return decorator
null
null
null
http auth
codeqa
def auth basic check realm 'private' text ' Accessdenied' def decorator func def wrapper *a **ka user password request auth or None None if user is None or not check user password response headers['WWW- Authenticate'] ' Basicrealm "%s"' % realm return HTTP Error 401 text return func *a **ka return wrapperreturn decorator
null
null
null
null
Question: What do callback decorator require ? Code: def auth_basic(check, realm='private', text='Access denied'): def decorator(func): def wrapper(*a, **ka): (user, password) = (request.auth or (None, None)) if ((user is None) or (not check(user, password))): response.headers['WWW-Authenticate'] = ('Basic realm="%s"' % realm) return HTTPError(401, text) return func(*a, **ka) return wrapper return decorator
null
null
null
What does the code send to the request output ?
def send_file(req, f, content_type): if (f is None): (yield req.not_found('File not found')) return try: req.respond(HTTP_OK, content_type) while True: data = f.read(10240) if (not data): break (yield data) f.close() except IOError: f.close() (yield req.error('Error reading file')) except: f.close() raise
null
null
null
a file - like object
codeqa
def send file req f content type if f is None yield req not found ' Filenotfound' returntry req respond HTTP OK content type while True data f read 10240 if not data break yield data f close except IO Error f close yield req error ' Errorreadingfile' except f close raise
null
null
null
null
Question: What does the code send to the request output ? Code: def send_file(req, f, content_type): if (f is None): (yield req.not_found('File not found')) return try: req.respond(HTTP_OK, content_type) while True: data = f.read(10240) if (not data): break (yield data) f.close() except IOError: f.close() (yield req.error('Error reading file')) except: f.close() raise
null
null
null
What do user - callable function create ?
def mkdtemp(suffix=None, prefix=None, dir=None): (prefix, suffix, dir, output_type) = _sanitize_params(prefix, suffix, dir) names = _get_candidate_names() if (output_type is bytes): names = map(_os.fsencode, names) for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, ((prefix + name) + suffix)) try: _os.mkdir(file, 448) except FileExistsError: continue except PermissionError: if ((_os.name == 'nt') and _os.path.isdir(dir) and _os.access(dir, _os.W_OK)): continue else: raise return file raise FileExistsError(_errno.EEXIST, 'No usable temporary directory name found')
null
null
null
a unique temporary directory
codeqa
def mkdtemp suffix None prefix None dir None prefix suffix dir output type sanitize params prefix suffix dir names get candidate names if output type is bytes names map os fsencode names for seq in range TMP MAX name next names file os path join dir prefix + name + suffix try os mkdir file 448 except File Exists Error continueexcept Permission Error if os name 'nt' and os path isdir dir and os access dir os W OK continueelse raisereturn fileraise File Exists Error errno EEXIST ' Nousabletemporarydirectorynamefound'
null
null
null
null
Question: What do user - callable function create ? Code: def mkdtemp(suffix=None, prefix=None, dir=None): (prefix, suffix, dir, output_type) = _sanitize_params(prefix, suffix, dir) names = _get_candidate_names() if (output_type is bytes): names = map(_os.fsencode, names) for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, ((prefix + name) + suffix)) try: _os.mkdir(file, 448) except FileExistsError: continue except PermissionError: if ((_os.name == 'nt') and _os.path.isdir(dir) and _os.access(dir, _os.W_OK)): continue else: raise return file raise FileExistsError(_errno.EEXIST, 'No usable temporary directory name found')
null
null
null
What creates a unique temporary directory ?
def mkdtemp(suffix=None, prefix=None, dir=None): (prefix, suffix, dir, output_type) = _sanitize_params(prefix, suffix, dir) names = _get_candidate_names() if (output_type is bytes): names = map(_os.fsencode, names) for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, ((prefix + name) + suffix)) try: _os.mkdir(file, 448) except FileExistsError: continue except PermissionError: if ((_os.name == 'nt') and _os.path.isdir(dir) and _os.access(dir, _os.W_OK)): continue else: raise return file raise FileExistsError(_errno.EEXIST, 'No usable temporary directory name found')
null
null
null
user - callable function
codeqa
def mkdtemp suffix None prefix None dir None prefix suffix dir output type sanitize params prefix suffix dir names get candidate names if output type is bytes names map os fsencode names for seq in range TMP MAX name next names file os path join dir prefix + name + suffix try os mkdir file 448 except File Exists Error continueexcept Permission Error if os name 'nt' and os path isdir dir and os access dir os W OK continueelse raisereturn fileraise File Exists Error errno EEXIST ' Nousabletemporarydirectorynamefound'
null
null
null
null
Question: What creates a unique temporary directory ? Code: def mkdtemp(suffix=None, prefix=None, dir=None): (prefix, suffix, dir, output_type) = _sanitize_params(prefix, suffix, dir) names = _get_candidate_names() if (output_type is bytes): names = map(_os.fsencode, names) for seq in range(TMP_MAX): name = next(names) file = _os.path.join(dir, ((prefix + name) + suffix)) try: _os.mkdir(file, 448) except FileExistsError: continue except PermissionError: if ((_os.name == 'nt') and _os.path.isdir(dir) and _os.access(dir, _os.W_OK)): continue else: raise return file raise FileExistsError(_errno.EEXIST, 'No usable temporary directory name found')
null
null
null
What can the user access ?
def _view_on_get(request): return ((request.method == 'GET') and acl.action_allowed(request, 'ReviewerTools', 'View'))
null
null
null
this page
codeqa
def view on get request return request method 'GET' and acl action allowed request ' Reviewer Tools' ' View'
null
null
null
null
Question: What can the user access ? Code: def _view_on_get(request): return ((request.method == 'GET') and acl.action_allowed(request, 'ReviewerTools', 'View'))
null
null
null
What can access this page ?
def _view_on_get(request): return ((request.method == 'GET') and acl.action_allowed(request, 'ReviewerTools', 'View'))
null
null
null
the user
codeqa
def view on get request return request method 'GET' and acl action allowed request ' Reviewer Tools' ' View'
null
null
null
null
Question: What can access this page ? Code: def _view_on_get(request): return ((request.method == 'GET') and acl.action_allowed(request, 'ReviewerTools', 'View'))
null
null
null
How do as many characters as possible return ?
def truncate_text(text, limit, killwords=False, end='...'): text = text.strip() text_length = len(text) if (text_length < limit): return (text, (limit - text_length)) text = jinja2.filters.do_truncate(text, limit, killwords, end='') return ((text + end), 0)
null
null
null
without going over the limit
codeqa
def truncate text text limit killwords False end ' ' text text strip text length len text if text length < limit return text limit - text length text jinja 2 filters do truncate text limit killwords end '' return text + end 0
null
null
null
null
Question: How do as many characters as possible return ? Code: def truncate_text(text, limit, killwords=False, end='...'): text = text.strip() text_length = len(text) if (text_length < limit): return (text, (limit - text_length)) text = jinja2.filters.do_truncate(text, limit, killwords, end='') return ((text + end), 0)
null
null
null
When being the file read ?
def filename(): if (not _state): raise RuntimeError, 'no active input()' return _state.filename()
null
null
null
currently
codeqa
def filename if not state raise Runtime Error 'noactiveinput 'return state filename
null
null
null
null
Question: When being the file read ? Code: def filename(): if (not _state): raise RuntimeError, 'no active input()' return _state.filename()