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 tries getting the page from the cache ?
| def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs.pop('key_prefix', None)
if kwargs:
raise TypeError('cache_pag... | null | null | null | views
| codeqa | def cache page *args **kwargs if len args 1 or callable args[ 0 ] raise Type Error 'cache pagehasasinglemandatorypositionalargument timeout' cache timeout args[ 0 ]cache alias kwargs pop 'cache' None key prefix kwargs pop 'key prefix' None if kwargs raise Type Error 'cache pagehastwooptionalkeywordarguments cacheandkey... | null | null | null | null | Question:
What tries getting the page from the cache ?
Code:
def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs... |
null | null | null | What does views try ?
| def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs.pop('key_prefix', None)
if kwargs:
raise TypeError('cache_pag... | null | null | null | getting the page from the cache
| codeqa | def cache page *args **kwargs if len args 1 or callable args[ 0 ] raise Type Error 'cache pagehasasinglemandatorypositionalargument timeout' cache timeout args[ 0 ]cache alias kwargs pop 'cache' None key prefix kwargs pop 'key prefix' None if kwargs raise Type Error 'cache pagehastwooptionalkeywordarguments cacheandkey... | null | null | null | null | Question:
What does views try ?
Code:
def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs.pop('key_prefix', None... |
null | null | null | What does that get from the cache ?
| def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs.pop('key_prefix', None)
if kwargs:
raise TypeError('cache_pag... | null | null | null | the page
| codeqa | def cache page *args **kwargs if len args 1 or callable args[ 0 ] raise Type Error 'cache pagehasasinglemandatorypositionalargument timeout' cache timeout args[ 0 ]cache alias kwargs pop 'cache' None key prefix kwargs pop 'key prefix' None if kwargs raise Type Error 'cache pagehastwooptionalkeywordarguments cacheandkey... | null | null | null | null | Question:
What does that get from the cache ?
Code:
def cache_page(*args, **kwargs):
if ((len(args) != 1) or callable(args[0])):
raise TypeError('cache_page has a single mandatory positional argument: timeout')
cache_timeout = args[0]
cache_alias = kwargs.pop('cache', None)
key_prefix = kwargs.pop('key... |
null | null | null | What does the code send to a channel ?
| def send_message(client_id, message):
client_id = _ValidateClientId(client_id)
if isinstance(message, unicode):
message = message.encode('utf-8')
elif (not isinstance(message, str)):
raise InvalidMessageError('Message must be a string')
if (len(message) > MAXIMUM_MESSAGE_LENGTH):
raise InvalidMessageError... | null | null | null | a message
| codeqa | def send message client id message client id Validate Client Id client id if isinstance message unicode message message encode 'utf- 8 ' elif not isinstance message str raise Invalid Message Error ' Messagemustbeastring' if len message > MAXIMUM MESSAGE LENGTH raise Invalid Message Error ' Messagemustbenolongerthan%dch... | null | null | null | null | Question:
What does the code send to a channel ?
Code:
def send_message(client_id, message):
client_id = _ValidateClientId(client_id)
if isinstance(message, unicode):
message = message.encode('utf-8')
elif (not isinstance(message, str)):
raise InvalidMessageError('Message must be a string')
if (len(mess... |
null | null | null | What does the code get ?
| @log_call
def metadef_namespace_get_by_id(context, namespace_id):
try:
namespace = next((namespace for namespace in DATA['metadef_namespaces'] if (namespace['id'] == namespace_id)))
except StopIteration:
msg = (_('Metadata definition namespace not found for id=%s') % namespace_id)
LOG.warn(msg)
raise ex... | null | null | null | a namespace object
| codeqa | @log calldef metadef namespace get by id context namespace id try namespace next namespace for namespace in DATA['metadef namespaces'] if namespace['id'] namespace id except Stop Iteration msg ' Metadatadefinitionnamespacenotfoundforid %s' % namespace id LOG warn msg raise exception Metadef Namespace Not Found msg if n... | null | null | null | null | Question:
What does the code get ?
Code:
@log_call
def metadef_namespace_get_by_id(context, namespace_id):
try:
namespace = next((namespace for namespace in DATA['metadef_namespaces'] if (namespace['id'] == namespace_id)))
except StopIteration:
msg = (_('Metadata definition namespace not found for id=%s... |
null | null | null | What do files contain ?
| def contentfilter(fsname, pattern):
if (pattern is None):
return True
try:
f = open(fsname)
prog = re.compile(pattern)
for line in f:
if prog.match(line):
f.close()
return True
f.close()
except:
pass
return False
| null | null | null | the given expression
| codeqa | def contentfilter fsname pattern if pattern is None return Truetry f open fsname prog re compile pattern for line in f if prog match line f close return Truef close except passreturn False
| null | null | null | null | Question:
What do files contain ?
Code:
def contentfilter(fsname, pattern):
if (pattern is None):
return True
try:
f = open(fsname)
prog = re.compile(pattern)
for line in f:
if prog.match(line):
f.close()
return True
f.close()
except:
pass
return False
|
null | null | null | What contain the given expression ?
| def contentfilter(fsname, pattern):
if (pattern is None):
return True
try:
f = open(fsname)
prog = re.compile(pattern)
for line in f:
if prog.match(line):
f.close()
return True
f.close()
except:
pass
return False
| null | null | null | files
| codeqa | def contentfilter fsname pattern if pattern is None return Truetry f open fsname prog re compile pattern for line in f if prog match line f close return Truef close except passreturn False
| null | null | null | null | Question:
What contain the given expression ?
Code:
def contentfilter(fsname, pattern):
if (pattern is None):
return True
try:
f = open(fsname)
prog = re.compile(pattern)
for line in f:
if prog.match(line):
f.close()
return True
f.close()
except:
pass
return False
|
null | null | null | What does the code write ?
| def read(domain, key, user=None):
cmd = 'defaults read "{0}" "{1}"'.format(domain, key)
return __salt__['cmd.run'](cmd, runas=user)
| null | null | null | a default to the system
| codeqa | def read domain key user None cmd 'defaultsread"{ 0 }""{ 1 }"' format domain key return salt ['cmd run'] cmd runas user
| null | null | null | null | Question:
What does the code write ?
Code:
def read(domain, key, user=None):
cmd = 'defaults read "{0}" "{1}"'.format(domain, key)
return __salt__['cmd.run'](cmd, runas=user)
|
null | null | null | What does the code add to the load balancer in region ?
| def AddELBInstance(region, instance_id, node_type):
balancers = GetLoadBalancers(region, node_types=[node_type])
assert balancers, ('No %s load balancer in region %s' % (node_type, region))
assert (len(balancers) == 1)
b = balancers[0]
b.register_instances([instance_id])
print ('Added instance %s to %s ... | null | null | null | an instance
| codeqa | def Add ELB Instance region instance id node type balancers Get Load Balancers region node types [node type] assert balancers ' No%sloadbalancerinregion%s' % node type region assert len balancers 1 b balancers[ 0 ]b register instances [instance id] print ' Addedinstance%sto%sloadbalancerinregion%s' % instance id node t... | null | null | null | null | Question:
What does the code add to the load balancer in region ?
Code:
def AddELBInstance(region, instance_id, node_type):
balancers = GetLoadBalancers(region, node_types=[node_type])
assert balancers, ('No %s load balancer in region %s' % (node_type, region))
assert (len(balancers) == 1)
b = balancers[0... |
null | null | null | What does the code generate ?
| def randomByteString(len):
ll = int(((len / 8) + int(((len % 8) > 0))))
return ''.join([struct.pack('!Q', random.getrandbits(64)) for _ in xrange(0, ll)])[:len]
| null | null | null | a string of random bytes
| codeqa | def random Byte String len ll int len / 8 + int len % 8 > 0 return '' join [struct pack ' Q' random getrandbits 64 for in xrange 0 ll ] [ len]
| null | null | null | null | Question:
What does the code generate ?
Code:
def randomByteString(len):
ll = int(((len / 8) + int(((len % 8) > 0))))
return ''.join([struct.pack('!Q', random.getrandbits(64)) for _ in xrange(0, ll)])[:len]
|
null | null | null | When is the value an empty list ?
| @aborts
def test_require_key_exists_empty_list():
require('hosts')
| null | null | null | when given a single existing key
| codeqa | @abortsdef test require key exists empty list require 'hosts'
| null | null | null | null | Question:
When is the value an empty list ?
Code:
@aborts
def test_require_key_exists_empty_list():
require('hosts')
|
null | null | null | What does the code send to a pushover user or group ?
| def validate_user(user, device, token):
res = {'message': 'User key is invalid', 'result': False}
parameters = dict()
parameters['user'] = user
parameters['token'] = token
if device:
parameters['device'] = device
response = query(function='validate_user', method='POST', header_dict={'Content-Type': 'applicat... | null | null | null | a message
| codeqa | def validate user user device token res {'message' ' Userkeyisinvalid' 'result' False}parameters dict parameters['user'] userparameters['token'] tokenif device parameters['device'] deviceresponse query function 'validate user' method 'POST' header dict {' Content- Type' 'application/x-www-form-urlencoded'} data urlenco... | null | null | null | null | Question:
What does the code send to a pushover user or group ?
Code:
def validate_user(user, device, token):
res = {'message': 'User key is invalid', 'result': False}
parameters = dict()
parameters['user'] = user
parameters['token'] = token
if device:
parameters['device'] = device
response = query(funct... |
null | null | null | What does the code consume ?
| def consume_task(task, services=None):
if (services is None):
services = {}
logger.info((u'Consuming %r' % task))
result = None
if isinstance(task, ListTask):
service = get_service(services, task.service, config=task.config)
result = service.list(task.video, task.languages)
elif isinstance(task, DownloadTas... | null | null | null | a task
| codeqa | def consume task task services None if services is None services {}logger info u' Consuming%r' % task result Noneif isinstance task List Task service get service services task service config task config result service list task video task languages elif isinstance task Download Task for subtitle in task subtitles servi... | null | null | null | null | Question:
What does the code consume ?
Code:
def consume_task(task, services=None):
if (services is None):
services = {}
logger.info((u'Consuming %r' % task))
result = None
if isinstance(task, ListTask):
service = get_service(services, task.service, config=task.config)
result = service.list(task.video, t... |
null | null | null | What does the code save to disk ?
| def imsave(fname, arr, format_str=None):
return _imread.imsave(fname, arr, formatstr=format_str)
| null | null | null | an image
| codeqa | def imsave fname arr format str None return imread imsave fname arr formatstr format str
| null | null | null | null | Question:
What does the code save to disk ?
Code:
def imsave(fname, arr, format_str=None):
return _imread.imsave(fname, arr, formatstr=format_str)
|
null | null | null | How do border handle ?
| def _stroke_and_fill_colors(color, border):
if (not isinstance(color, colors.Color)):
raise ValueError(('Invalid color %r' % color))
if ((color == colors.white) and (border is None)):
strokecolor = colors.black
elif (border is None):
strokecolor = color
elif border:
if (not isinstance(border, colors.Color... | null | null | null | helper function
| codeqa | def stroke and fill colors color border if not isinstance color colors Color raise Value Error ' Invalidcolor%r' % color if color colors white and border is None strokecolor colors blackelif border is None strokecolor colorelif border if not isinstance border colors Color raise Value Error ' Invalidbordercolor%r' % bor... | null | null | null | null | Question:
How do border handle ?
Code:
def _stroke_and_fill_colors(color, border):
if (not isinstance(color, colors.Color)):
raise ValueError(('Invalid color %r' % color))
if ((color == colors.white) and (border is None)):
strokecolor = colors.black
elif (border is None):
strokecolor = color
elif border... |
null | null | null | What does the code get for a given i d string ?
| def album_for_id(album_id):
out = []
for plugin in find_plugins():
res = plugin.album_for_id(album_id)
if res:
out.append(res)
return out
| null | null | null | albuminfo objects
| codeqa | def album for id album id out []for plugin in find plugins res plugin album for id album id if res out append res return out
| null | null | null | null | Question:
What does the code get for a given i d string ?
Code:
def album_for_id(album_id):
out = []
for plugin in find_plugins():
res = plugin.album_for_id(album_id)
if res:
out.append(res)
return out
|
null | null | null | What does the code send to the admins ?
| def mail_admins(subject, message, fail_silently=False, connection=None, html_message=None):
if (not settings.ADMINS):
return
mail = EmailMultiAlternatives((u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject)), message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], connection=connection)
if html_message:
... | null | null | null | a message
| codeqa | def mail admins subject message fail silently False connection None html message None if not settings ADMINS returnmail Email Multi Alternatives u'%s%s' % settings EMAIL SUBJECT PREFIX subject message settings SERVER EMAIL [a[ 1 ] for a in settings ADMINS] connection connection if html message mail attach alternative h... | null | null | null | null | Question:
What does the code send to the admins ?
Code:
def mail_admins(subject, message, fail_silently=False, connection=None, html_message=None):
if (not settings.ADMINS):
return
mail = EmailMultiAlternatives((u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject)), message, settings.SERVER_EMAIL, [a[1] for a in ... |
null | null | null | What is containing all global site - packages directories ?
| def getsitepackages():
sitepackages = []
seen = set()
for prefix in PREFIXES:
if ((not prefix) or (prefix in seen)):
continue
seen.add(prefix)
if (sys.platform in ('os2emx', 'riscos', 'cli')):
sitepackages.append(os.path.join(prefix, 'Lib', 'site-packages'))
elif (os.sep == '/'):
sitepackages.append... | null | null | null | a list
| codeqa | def getsitepackages sitepackages []seen set for prefix in PREFIXES if not prefix or prefix in seen continueseen add prefix if sys platform in 'os 2 emx' 'riscos' 'cli' sitepackages append os path join prefix ' Lib' 'site-packages' elif os sep '/' sitepackages append os path join prefix 'lib' 'python' + sys version[ 3] ... | null | null | null | null | Question:
What is containing all global site - packages directories ?
Code:
def getsitepackages():
sitepackages = []
seen = set()
for prefix in PREFIXES:
if ((not prefix) or (prefix in seen)):
continue
seen.add(prefix)
if (sys.platform in ('os2emx', 'riscos', 'cli')):
sitepackages.append(os.path.join... |
null | null | null | What does the code delete ?
| def delete_command(args):
delete_zone(args.project_id, args.name)
print 'Zone {} deleted.'.format(args.name)
| null | null | null | a zone
| codeqa | def delete command args delete zone args project id args name print ' Zone{}deleted ' format args name
| null | null | null | null | Question:
What does the code delete ?
Code:
def delete_command(args):
delete_zone(args.project_id, args.name)
print 'Zone {} deleted.'.format(args.name)
|
null | null | null | What does the code get ?
| def get_request_stats():
return {'ip': get_real_ip(), 'platform': request.user_agent.platform, 'browser': request.user_agent.browser, 'version': request.user_agent.version, 'language': request.user_agent.language}
| null | null | null | ip
| codeqa | def get request stats return {'ip' get real ip 'platform' request user agent platform 'browser' request user agent browser 'version' request user agent version 'language' request user agent language}
| null | null | null | null | Question:
What does the code get ?
Code:
def get_request_stats():
return {'ip': get_real_ip(), 'platform': request.user_agent.platform, 'browser': request.user_agent.browser, 'version': request.user_agent.version, 'language': request.user_agent.language}
|
null | null | null | What does the code return ?
| def object_type_repr(obj):
if (obj is None):
return 'None'
elif (obj is Ellipsis):
return 'Ellipsis'
if (obj.__class__.__module__ == '__builtin__'):
name = obj.__class__.__name__
else:
name = ((obj.__class__.__module__ + '.') + obj.__class__.__name__)
return ('%s object' % name)
| null | null | null | the name of the objects type
| codeqa | def object type repr obj if obj is None return ' None'elif obj is Ellipsis return ' Ellipsis'if obj class module ' builtin ' name obj class name else name obj class module + ' ' + obj class name return '%sobject' % name
| null | null | null | null | Question:
What does the code return ?
Code:
def object_type_repr(obj):
if (obj is None):
return 'None'
elif (obj is Ellipsis):
return 'Ellipsis'
if (obj.__class__.__module__ == '__builtin__'):
name = obj.__class__.__name__
else:
name = ((obj.__class__.__module__ + '.') + obj.__class__.__name__)
return ... |
null | null | null | What replaces in source ?
| def _replacestrings(source):
match = re.search('var *(_\\w+)\\=\\["(.*?)"\\];', source, re.DOTALL)
if match:
(varname, strings) = match.groups()
startpoint = len(match.group(0))
lookup = strings.split('","')
variable = ('%s[%%d]' % varname)
for (index, value) in enumerate(lookup):
source = source.replac... | null | null | null | values
| codeqa | def replacestrings source match re search 'var* \\w+ \\ \\[" *? "\\] ' source re DOTALL if match varname strings match groups startpoint len match group 0 lookup strings split '" "' variable '%s[%%d]' % varname for index value in enumerate lookup source source replace variable % index '"%s"' % value return source[start... | null | null | null | null | Question:
What replaces in source ?
Code:
def _replacestrings(source):
match = re.search('var *(_\\w+)\\=\\["(.*?)"\\];', source, re.DOTALL)
if match:
(varname, strings) = match.groups()
startpoint = len(match.group(0))
lookup = strings.split('","')
variable = ('%s[%%d]' % varname)
for (index, value) i... |
null | null | null | Where do values replace ?
| def _replacestrings(source):
match = re.search('var *(_\\w+)\\=\\["(.*?)"\\];', source, re.DOTALL)
if match:
(varname, strings) = match.groups()
startpoint = len(match.group(0))
lookup = strings.split('","')
variable = ('%s[%%d]' % varname)
for (index, value) in enumerate(lookup):
source = source.replac... | null | null | null | in source
| codeqa | def replacestrings source match re search 'var* \\w+ \\ \\[" *? "\\] ' source re DOTALL if match varname strings match groups startpoint len match group 0 lookup strings split '" "' variable '%s[%%d]' % varname for index value in enumerate lookup source source replace variable % index '"%s"' % value return source[start... | null | null | null | null | Question:
Where do values replace ?
Code:
def _replacestrings(source):
match = re.search('var *(_\\w+)\\=\\["(.*?)"\\];', source, re.DOTALL)
if match:
(varname, strings) = match.groups()
startpoint = len(match.group(0))
lookup = strings.split('","')
variable = ('%s[%%d]' % varname)
for (index, value) i... |
null | null | null | What does the code get ?
| def getTextLines(text):
if ('\r' in text):
text = text.replace('\r', '\n').replace('\n\n', '\n')
textLines = text.split('\n')
if (len(textLines) == 1):
if (textLines[0] == ''):
return []
return textLines
| null | null | null | the all the lines of text of a text
| codeqa | def get Text Lines text if '\r' in text text text replace '\r' '\n' replace '\n\n' '\n' text Lines text split '\n' if len text Lines 1 if text Lines[ 0 ] '' return []return text Lines
| null | null | null | null | Question:
What does the code get ?
Code:
def getTextLines(text):
if ('\r' in text):
text = text.replace('\r', '\n').replace('\n\n', '\n')
textLines = text.split('\n')
if (len(textLines) == 1):
if (textLines[0] == ''):
return []
return textLines
|
null | null | null | What do decorator mark as a test ?
| def istest(func):
func.__test__ = True
return func
| null | null | null | a function or method
| codeqa | def istest func func test Truereturn func
| null | null | null | null | Question:
What do decorator mark as a test ?
Code:
def istest(func):
func.__test__ = True
return func
|
null | null | null | What marks a function or method as a test ?
| def istest(func):
func.__test__ = True
return func
| null | null | null | decorator
| codeqa | def istest func func test Truereturn func
| null | null | null | null | Question:
What marks a function or method as a test ?
Code:
def istest(func):
func.__test__ = True
return func
|
null | null | null | What does the code get ?
| def getNewRepository():
return CombRepository()
| null | null | null | new repository
| codeqa | def get New Repository return Comb Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return CombRepository()
|
null | null | null | In which direction does the code move a file to destination ?
| def moveFile(srcFile, destFile):
try:
shutil.move(srcFile, destFile)
fixSetGroupID(destFile)
except OSError as e:
try:
copyFile(srcFile, destFile)
os.unlink(srcFile)
except Exception as e:
raise
| null | null | null | from source
| codeqa | def move File src File dest File try shutil move src File dest File fix Set Group ID dest File except OS Error as e try copy File src File dest File os unlink src File except Exception as e raise
| null | null | null | null | Question:
In which direction does the code move a file to destination ?
Code:
def moveFile(srcFile, destFile):
try:
shutil.move(srcFile, destFile)
fixSetGroupID(destFile)
except OSError as e:
try:
copyFile(srcFile, destFile)
os.unlink(srcFile)
except Exception as e:
raise
|
null | null | null | What does the code move to destination from source ?
| def moveFile(srcFile, destFile):
try:
shutil.move(srcFile, destFile)
fixSetGroupID(destFile)
except OSError as e:
try:
copyFile(srcFile, destFile)
os.unlink(srcFile)
except Exception as e:
raise
| null | null | null | a file
| codeqa | def move File src File dest File try shutil move src File dest File fix Set Group ID dest File except OS Error as e try copy File src File dest File os unlink src File except Exception as e raise
| null | null | null | null | Question:
What does the code move to destination from source ?
Code:
def moveFile(srcFile, destFile):
try:
shutil.move(srcFile, destFile)
fixSetGroupID(destFile)
except OSError as e:
try:
copyFile(srcFile, destFile)
os.unlink(srcFile)
except Exception as e:
raise
|
null | null | null | When does the code convert ?
| def yml_to_json(filename):
jsonfilename = '{0}.json'.format(*os.path.splitext(filename))
with open(filename, 'r') as f:
contents = yaml.load(f)
with open(jsonfilename, 'w') as f:
json.dump(contents, f)
| null | null | null | a
| codeqa | def yml to json filename jsonfilename '{ 0 } json' format *os path splitext filename with open filename 'r' as f contents yaml load f with open jsonfilename 'w' as f json dump contents f
| null | null | null | null | Question:
When does the code convert ?
Code:
def yml_to_json(filename):
jsonfilename = '{0}.json'.format(*os.path.splitext(filename))
with open(filename, 'r') as f:
contents = yaml.load(f)
with open(jsonfilename, 'w') as f:
json.dump(contents, f)
|
null | null | null | How are single quotes escaped ?
| def _quote_escape(item):
rex_sqlquote = re.compile("'", re.M)
return rex_sqlquote.sub("''", item)
| null | null | null | properly
| codeqa | def quote escape item rex sqlquote re compile "'" re M return rex sqlquote sub "''" item
| null | null | null | null | Question:
How are single quotes escaped ?
Code:
def _quote_escape(item):
rex_sqlquote = re.compile("'", re.M)
return rex_sqlquote.sub("''", item)
|
null | null | null | When does the account expire ?
| def set_expire(name, date):
_set_account_policy(name, 'usingHardExpirationDate=1 hardExpireDateGMT={0}'.format(date))
return (get_expire(name) == date)
| null | null | null | the date
| codeqa | def set expire name date set account policy name 'using Hard Expiration Date 1hard Expire Date GMT {0 }' format date return get expire name date
| null | null | null | null | Question:
When does the account expire ?
Code:
def set_expire(name, date):
_set_account_policy(name, 'usingHardExpirationDate=1 hardExpireDateGMT={0}'.format(date))
return (get_expire(name) == date)
|
null | null | null | What do users view ?
| @login_required
def project_users(request, project_slug):
project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
form = UserForm(data=(request.POST or None), project=project)
if ((request.method == 'POST') and form.is_valid()):
form.save()
project_dashboard = reverse('projec... | null | null | null | view
| codeqa | @login requireddef project users request project slug project get object or 404 Project objects for admin user request user slug project slug form User Form data request POST or None project project if request method 'POST' and form is valid form save project dashboard reverse 'projects users' args [project slug] retur... | null | null | null | null | Question:
What do users view ?
Code:
@login_required
def project_users(request, project_slug):
project = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
form = UserForm(data=(request.POST or None), project=project)
if ((request.method == 'POST') and form.is_valid()):
form.sav... |
null | null | null | What does the code add ?
| def for_type_by_name(type_module, type_name, func, dtp=None):
if (dtp is None):
dtp = _deferred_type_pprinters
key = (type_module, type_name)
oldfunc = dtp.get(key, None)
if (func is not None):
dtp[key] = func
return oldfunc
| null | null | null | a pretty printer for a type specified by the module and name of a type rather than the type object itself
| codeqa | def for type by name type module type name func dtp None if dtp is None dtp deferred type pprinterskey type module type name oldfunc dtp get key None if func is not None dtp[key] funcreturn oldfunc
| null | null | null | null | Question:
What does the code add ?
Code:
def for_type_by_name(type_module, type_name, func, dtp=None):
if (dtp is None):
dtp = _deferred_type_pprinters
key = (type_module, type_name)
oldfunc = dtp.get(key, None)
if (func is not None):
dtp[key] = func
return oldfunc
|
null | null | null | Where did attributes define ?
| def copy_globals(source, globs, only_names=None, ignore_missing_names=False, names_to_ignore=(), dunder_names_to_keep=('__implements__', '__all__', '__imports__'), cleanup_globs=True):
if only_names:
if ignore_missing_names:
items = ((k, getattr(source, k, _NONE)) for k in only_names)
else:
items = ((k, geta... | null | null | null | in source
| codeqa | def copy globals source globs only names None ignore missing names False names to ignore dunder names to keep ' implements ' ' all ' ' imports ' cleanup globs True if only names if ignore missing names items k getattr source k NONE for k in only names else items k getattr source k for k in only names else items iterite... | null | null | null | null | Question:
Where did attributes define ?
Code:
def copy_globals(source, globs, only_names=None, ignore_missing_names=False, names_to_ignore=(), dunder_names_to_keep=('__implements__', '__all__', '__imports__'), cleanup_globs=True):
if only_names:
if ignore_missing_names:
items = ((k, getattr(source, k, _NONE))... |
null | null | null | What defined in source ?
| def copy_globals(source, globs, only_names=None, ignore_missing_names=False, names_to_ignore=(), dunder_names_to_keep=('__implements__', '__all__', '__imports__'), cleanup_globs=True):
if only_names:
if ignore_missing_names:
items = ((k, getattr(source, k, _NONE)) for k in only_names)
else:
items = ((k, geta... | null | null | null | attributes
| codeqa | def copy globals source globs only names None ignore missing names False names to ignore dunder names to keep ' implements ' ' all ' ' imports ' cleanup globs True if only names if ignore missing names items k getattr source k NONE for k in only names else items k getattr source k for k in only names else items iterite... | null | null | null | null | Question:
What defined in source ?
Code:
def copy_globals(source, globs, only_names=None, ignore_missing_names=False, names_to_ignore=(), dunder_names_to_keep=('__implements__', '__all__', '__imports__'), cleanup_globs=True):
if only_names:
if ignore_missing_names:
items = ((k, getattr(source, k, _NONE)) for ... |
null | null | null | What did the code add to defaults ?
| def set_default(key, val):
return frappe.db.set_default(key, val)
| null | null | null | a default value
| codeqa | def set default key val return frappe db set default key val
| null | null | null | null | Question:
What did the code add to defaults ?
Code:
def set_default(key, val):
return frappe.db.set_default(key, val)
|
null | null | null | What does the code prepare ?
| def preprocess_for_eval(image, height, width, central_fraction=0.875, scope=None):
with tf.name_scope(scope, 'eval_image', [image, height, width]):
if (image.dtype != tf.float32):
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
if central_fraction:
image = tf.image.central_crop(image, central_f... | null | null | null | one image
| codeqa | def preprocess for eval image height width central fraction 0 875 scope None with tf name scope scope 'eval image' [image height width] if image dtype tf float 32 image tf image convert image dtype image dtype tf float 32 if central fraction image tf image central crop image central fraction central fraction if height ... | null | null | null | null | Question:
What does the code prepare ?
Code:
def preprocess_for_eval(image, height, width, central_fraction=0.875, scope=None):
with tf.name_scope(scope, 'eval_image', [image, height, width]):
if (image.dtype != tf.float32):
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
if central_fraction:
... |
null | null | null | What did user specify ?
| def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
log.warn(u"Archive importing requires either 'cop... | null | null | null | list
| codeqa | def read tasks session skipped 0for toppath in session paths session ask resume toppath user toppath toppatharchive task Noneif Archive Import Task is archive syspath toppath if not session config['move'] or session config['copy'] log warn u" Archiveimportingrequireseither'copy'or'move'tobeenabled " continuelog debug u... | null | null | null | null | Question:
What did user specify ?
Code:
def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
log.warn(... |
null | null | null | Where did all the albums find ?
| def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
log.warn(u"Archive importing requires either 'cop... | null | null | null | in the user - specified list of paths
| codeqa | def read tasks session skipped 0for toppath in session paths session ask resume toppath user toppath toppatharchive task Noneif Archive Import Task is archive syspath toppath if not session config['move'] or session config['copy'] log warn u" Archiveimportingrequireseither'copy'or'move'tobeenabled " continuelog debug u... | null | null | null | null | Question:
Where did all the albums find ?
Code:
def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
l... |
null | null | null | What found in the user - specified list of paths ?
| def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
log.warn(u"Archive importing requires either 'cop... | null | null | null | all the albums
| codeqa | def read tasks session skipped 0for toppath in session paths session ask resume toppath user toppath toppatharchive task Noneif Archive Import Task is archive syspath toppath if not session config['move'] or session config['copy'] log warn u" Archiveimportingrequireseither'copy'or'move'tobeenabled " continuelog debug u... | null | null | null | null | Question:
What found in the user - specified list of paths ?
Code:
def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.conf... |
null | null | null | What is yielding all the albums found in the user - specified list of paths ?
| def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.config['move'] or session.config['copy'])):
log.warn(u"Archive importing requires either 'cop... | null | null | null | a generator
| codeqa | def read tasks session skipped 0for toppath in session paths session ask resume toppath user toppath toppatharchive task Noneif Archive Import Task is archive syspath toppath if not session config['move'] or session config['copy'] log warn u" Archiveimportingrequireseither'copy'or'move'tobeenabled " continuelog debug u... | null | null | null | null | Question:
What is yielding all the albums found in the user - specified list of paths ?
Code:
def read_tasks(session):
skipped = 0
for toppath in session.paths:
session.ask_resume(toppath)
user_toppath = toppath
archive_task = None
if ArchiveImportTask.is_archive(syspath(toppath)):
if (not (session.con... |
null | null | null | What do a string contain ?
| def key_to_english(key):
english = ''
for index in range(0, len(key), 8):
subkey = key[index:(index + 8)]
skbin = _key2bin(subkey)
p = 0
for i in range(0, 64, 2):
p = (p + _extract(skbin, i, 2))
skbin = _key2bin((subkey + chr(((p << 6) & 255))))
for i in range(0, 64, 11):
english = ((english + wordl... | null | null | null | english words
| codeqa | def key to english key english ''for index in range 0 len key 8 subkey key[index index + 8 ]skbin key 2 bin subkey p 0for i in range 0 64 2 p p + extract skbin i 2 skbin key 2 bin subkey + chr p << 6 & 255 for i in range 0 64 11 english english + wordlist[ extract skbin i 11 ] + '' return english[ -1 ]
| null | null | null | null | Question:
What do a string contain ?
Code:
def key_to_english(key):
english = ''
for index in range(0, len(key), 8):
subkey = key[index:(index + 8)]
skbin = _key2bin(subkey)
p = 0
for i in range(0, 64, 2):
p = (p + _extract(skbin, i, 2))
skbin = _key2bin((subkey + chr(((p << 6) & 255))))
for i in r... |
null | null | null | What does the code get from a path ?
| def getCircleNodesFromPoints(points, radius):
if (radius == 0.0):
print 'Warning, radius is 0 in getCircleNodesFromPoints in intercircle.'
print points
return []
circleNodes = []
oneOverRadius = (1.000001 / radius)
points = euclidean.getAwayPoints(points, radius)
for point in points:
circleNodes.app... | null | null | null | the circle nodes
| codeqa | def get Circle Nodes From Points points radius if radius 0 0 print ' Warning radiusis 0 inget Circle Nodes From Pointsinintercircle 'print pointsreturn []circle Nodes []one Over Radius 1 000001 / radius points euclidean get Away Points points radius for point in points circle Nodes append Circle Node one Over Radius po... | null | null | null | null | Question:
What does the code get from a path ?
Code:
def getCircleNodesFromPoints(points, radius):
if (radius == 0.0):
print 'Warning, radius is 0 in getCircleNodesFromPoints in intercircle.'
print points
return []
circleNodes = []
oneOverRadius = (1.000001 / radius)
points = euclidean.getAwayPoint... |
null | null | null | What does an authorization header contain ?
| def check_auth(users, encrypt=None, realm=None):
request = cherrypy.serving.request
if ('authorization' in request.headers):
ah = httpauth.parseAuthorization(request.headers['authorization'])
if (ah is None):
raise cherrypy.HTTPError(400, 'Bad Request')
if (not encrypt):
encrypt = httpauth.DIGEST_AUTH_EN... | null | null | null | credentials
| codeqa | def check auth users encrypt None realm None request cherrypy serving requestif 'authorization' in request headers ah httpauth parse Authorization request headers['authorization'] if ah is None raise cherrypy HTTP Error 400 ' Bad Request' if not encrypt encrypt httpauth DIGEST AUTH ENCODERS[httpauth MD 5 ]if hasattr us... | null | null | null | null | Question:
What does an authorization header contain ?
Code:
def check_auth(users, encrypt=None, realm=None):
request = cherrypy.serving.request
if ('authorization' in request.headers):
ah = httpauth.parseAuthorization(request.headers['authorization'])
if (ah is None):
raise cherrypy.HTTPError(400, 'Bad Re... |
null | null | null | What contains credentials ?
| def check_auth(users, encrypt=None, realm=None):
request = cherrypy.serving.request
if ('authorization' in request.headers):
ah = httpauth.parseAuthorization(request.headers['authorization'])
if (ah is None):
raise cherrypy.HTTPError(400, 'Bad Request')
if (not encrypt):
encrypt = httpauth.DIGEST_AUTH_EN... | null | null | null | an authorization header
| codeqa | def check auth users encrypt None realm None request cherrypy serving requestif 'authorization' in request headers ah httpauth parse Authorization request headers['authorization'] if ah is None raise cherrypy HTTP Error 400 ' Bad Request' if not encrypt encrypt httpauth DIGEST AUTH ENCODERS[httpauth MD 5 ]if hasattr us... | null | null | null | null | Question:
What contains credentials ?
Code:
def check_auth(users, encrypt=None, realm=None):
request = cherrypy.serving.request
if ('authorization' in request.headers):
ah = httpauth.parseAuthorization(request.headers['authorization'])
if (ah is None):
raise cherrypy.HTTPError(400, 'Bad Request')
if (no... |
null | null | null | What does a set constitute ?
| @not_implemented_for('directed')
@not_implemented_for('multigraph')
def min_edge_cover(G, matching_algorithm=None):
if (nx.number_of_isolates(G) > 0):
raise nx.NetworkXException('Graph has a node with no edge incident on it, so no edge cover exists.')
if (matching_algorithm is None):
matching_algori... | null | null | null | the minimum edge cover of the graph
| codeqa | @not implemented for 'directed' @not implemented for 'multigraph' def min edge cover G matching algorithm None if nx number of isolates G > 0 raise nx Network X Exception ' Graphhasanodewithnoedgeincidentonit sonoedgecoverexists ' if matching algorithm is None matching algorithm partial nx max weight matching maxcardin... | null | null | null | null | Question:
What does a set constitute ?
Code:
@not_implemented_for('directed')
@not_implemented_for('multigraph')
def min_edge_cover(G, matching_algorithm=None):
if (nx.number_of_isolates(G) > 0):
raise nx.NetworkXException('Graph has a node with no edge incident on it, so no edge cover exists.')
i... |
null | null | null | What constitutes the minimum edge cover of the graph ?
| @not_implemented_for('directed')
@not_implemented_for('multigraph')
def min_edge_cover(G, matching_algorithm=None):
if (nx.number_of_isolates(G) > 0):
raise nx.NetworkXException('Graph has a node with no edge incident on it, so no edge cover exists.')
if (matching_algorithm is None):
matching_algori... | null | null | null | a set
| codeqa | @not implemented for 'directed' @not implemented for 'multigraph' def min edge cover G matching algorithm None if nx number of isolates G > 0 raise nx Network X Exception ' Graphhasanodewithnoedgeincidentonit sonoedgecoverexists ' if matching algorithm is None matching algorithm partial nx max weight matching maxcardin... | null | null | null | null | Question:
What constitutes the minimum edge cover of the graph ?
Code:
@not_implemented_for('directed')
@not_implemented_for('multigraph')
def min_edge_cover(G, matching_algorithm=None):
if (nx.number_of_isolates(G) > 0):
raise nx.NetworkXException('Graph has a node with no edge incident on it, so no ... |
null | null | null | What does the code receive ?
| def webattack_vector(attack_vector):
return {'1': 'java', '2': 'browser', '3': 'harvester', '4': 'tabnapping', '5': 'webjacking', '6': 'multiattack', '7': 'fsattack'}.get(attack_vector, 'ERROR')
| null | null | null | the input given by the user from set
| codeqa | def webattack vector attack vector return {' 1 ' 'java' '2 ' 'browser' '3 ' 'harvester' '4 ' 'tabnapping' '5 ' 'webjacking' '6 ' 'multiattack' '7 ' 'fsattack'} get attack vector 'ERROR'
| null | null | null | null | Question:
What does the code receive ?
Code:
def webattack_vector(attack_vector):
return {'1': 'java', '2': 'browser', '3': 'harvester', '4': 'tabnapping', '5': 'webjacking', '6': 'multiattack', '7': 'fsattack'}.get(attack_vector, 'ERROR')
|
null | null | null | What does the code create ?
| def new_figure_manager(num, *args, **kwargs):
thisFig = Figure(*args, **kwargs)
canvas = FigureCanvasQT(thisFig)
manager = FigureManagerQT(canvas, num)
return manager
| null | null | null | a new figure manager instance
| codeqa | def new figure manager num *args **kwargs this Fig Figure *args **kwargs canvas Figure Canvas QT this Fig manager Figure Manager QT canvas num return manager
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager(num, *args, **kwargs):
thisFig = Figure(*args, **kwargs)
canvas = FigureCanvasQT(thisFig)
manager = FigureManagerQT(canvas, num)
return manager
|
null | null | null | What does the code get ?
| def getConnectionVertexes(geometryOutput):
connectionVertexes = []
addConnectionVertexes(connectionVertexes, geometryOutput)
return connectionVertexes
| null | null | null | the connections and vertexes
| codeqa | def get Connection Vertexes geometry Output connection Vertexes []add Connection Vertexes connection Vertexes geometry Output return connection Vertexes
| null | null | null | null | Question:
What does the code get ?
Code:
def getConnectionVertexes(geometryOutput):
connectionVertexes = []
addConnectionVertexes(connectionVertexes, geometryOutput)
return connectionVertexes
|
null | null | null | What does the code pull from the collection_query data ?
| @non_atomic_requests
def collection_series(request, username, slug, format, group, start, end, field):
(start, end) = get_daterange_or_404(start, end)
group = ('date' if (group == 'day') else group)
series = []
c = get_collection(request, username, slug)
full_series = _collection_query(request, c, start, end)
for... | null | null | null | a single field
| codeqa | @non atomic requestsdef collection series request username slug format group start end field start end get daterange or 404 start end group 'date' if group 'day' else group series []c get collection request username slug full series collection query request c start end for row in full series if field in row['data'] ser... | null | null | null | null | Question:
What does the code pull from the collection_query data ?
Code:
@non_atomic_requests
def collection_series(request, username, slug, format, group, start, end, field):
(start, end) = get_daterange_or_404(start, end)
group = ('date' if (group == 'day') else group)
series = []
c = get_collection(request, ... |
null | null | null | What does the code describe ?
| def vb_machinestate_to_description(machinestate):
return vb_machinestate_to_tuple(machinestate)[1]
| null | null | null | the given state
| codeqa | def vb machinestate to description machinestate return vb machinestate to tuple machinestate [1 ]
| null | null | null | null | Question:
What does the code describe ?
Code:
def vb_machinestate_to_description(machinestate):
return vb_machinestate_to_tuple(machinestate)[1]
|
null | null | null | What does the code take ?
| def make_tags_in_aws_format(tags):
formatted_tags = list()
for (key, val) in tags.items():
formatted_tags.append({'Key': key, 'Value': val})
return formatted_tags
| null | null | null | a dictionary of tags
| codeqa | def make tags in aws format tags formatted tags list for key val in tags items formatted tags append {' Key' key ' Value' val} return formatted tags
| null | null | null | null | Question:
What does the code take ?
Code:
def make_tags_in_aws_format(tags):
formatted_tags = list()
for (key, val) in tags.items():
formatted_tags.append({'Key': key, 'Value': val})
return formatted_tags
|
null | null | null | What gets a hostname from a client i d ?
| def ClientIdToHostname(client_id, token=None):
client = OpenClient(client_id, token=token)[0]
if (client and client.Get('Host')):
return client.Get('Host').Summary()
| null | null | null | scripts
| codeqa | def Client Id To Hostname client id token None client Open Client client id token token [0 ]if client and client Get ' Host' return client Get ' Host' Summary
| null | null | null | null | Question:
What gets a hostname from a client i d ?
Code:
def ClientIdToHostname(client_id, token=None):
client = OpenClient(client_id, token=token)[0]
if (client and client.Get('Host')):
return client.Get('Host').Summary()
|
null | null | null | What do scripts get from a client i d ?
| def ClientIdToHostname(client_id, token=None):
client = OpenClient(client_id, token=token)[0]
if (client and client.Get('Host')):
return client.Get('Host').Summary()
| null | null | null | a hostname
| codeqa | def Client Id To Hostname client id token None client Open Client client id token token [0 ]if client and client Get ' Host' return client Get ' Host' Summary
| null | null | null | null | Question:
What do scripts get from a client i d ?
Code:
def ClientIdToHostname(client_id, token=None):
client = OpenClient(client_id, token=token)[0]
if (client and client.Get('Host')):
return client.Get('Host').Summary()
|
null | null | null | What does the code evaluate ?
| def getEvaluatedExpressionValueBySplitLine(words, xmlElement):
evaluators = []
for (wordIndex, word) in enumerate(words):
nextWord = ''
nextWordIndex = (wordIndex + 1)
if (nextWordIndex < len(words)):
nextWord = words[nextWordIndex]
evaluator = getEvaluator(evaluators, nextWord, word, xmlElement)
if (eva... | null | null | null | the expression value
| codeqa | def get Evaluated Expression Value By Split Line words xml Element evaluators []for word Index word in enumerate words next Word ''next Word Index word Index + 1 if next Word Index < len words next Word words[next Word Index]evaluator get Evaluator evaluators next Word word xml Element if evaluator None evaluators appe... | null | null | null | null | Question:
What does the code evaluate ?
Code:
def getEvaluatedExpressionValueBySplitLine(words, xmlElement):
evaluators = []
for (wordIndex, word) in enumerate(words):
nextWord = ''
nextWordIndex = (wordIndex + 1)
if (nextWordIndex < len(words)):
nextWord = words[nextWordIndex]
evaluator = getEvaluator... |
null | null | null | What did user provide ?
| def _generate_output_dataframe(data_subset, defaults):
cols = set(data_subset.columns)
desired_cols = set(defaults)
data_subset.drop((cols - desired_cols), axis=1, inplace=True)
for col in (desired_cols - cols):
data_subset[col] = defaults[col]
return data_subset
| null | null | null | data
| codeqa | def generate output dataframe data subset defaults cols set data subset columns desired cols set defaults data subset drop cols - desired cols axis 1 inplace True for col in desired cols - cols data subset[col] defaults[col]return data subset
| null | null | null | null | Question:
What did user provide ?
Code:
def _generate_output_dataframe(data_subset, defaults):
cols = set(data_subset.columns)
desired_cols = set(defaults)
data_subset.drop((cols - desired_cols), axis=1, inplace=True)
for col in (desired_cols - cols):
data_subset[col] = defaults[col]
return data_subset
|
null | null | null | What does the code insert ?
| @frappe.whitelist()
def insert(doc=None):
if isinstance(doc, basestring):
doc = json.loads(doc)
if (doc.get(u'parent') and doc.get(u'parenttype')):
parent = frappe.get_doc(doc.get(u'parenttype'), doc.get(u'parent'))
parent.append(doc.get(u'parentfield'), doc)
parent.save()
return parent.as_dict()
else:
d... | null | null | null | a document
| codeqa | @frappe whitelist def insert doc None if isinstance doc basestring doc json loads doc if doc get u'parent' and doc get u'parenttype' parent frappe get doc doc get u'parenttype' doc get u'parent' parent append doc get u'parentfield' doc parent save return parent as dict else doc frappe get doc doc insert return doc as d... | null | null | null | null | Question:
What does the code insert ?
Code:
@frappe.whitelist()
def insert(doc=None):
if isinstance(doc, basestring):
doc = json.loads(doc)
if (doc.get(u'parent') and doc.get(u'parenttype')):
parent = frappe.get_doc(doc.get(u'parenttype'), doc.get(u'parent'))
parent.append(doc.get(u'parentfield'), doc)
pa... |
null | null | null | What did the code read ?
| def read_py_file(filename, skip_encoding_cookie=True):
with open(filename) as f:
if skip_encoding_cookie:
return ''.join(strip_encoding_cookie(f))
else:
return f.read()
| null | null | null | a python file
| codeqa | def read py file filename skip encoding cookie True with open filename as f if skip encoding cookie return '' join strip encoding cookie f else return f read
| null | null | null | null | Question:
What did the code read ?
Code:
def read_py_file(filename, skip_encoding_cookie=True):
with open(filename) as f:
if skip_encoding_cookie:
return ''.join(strip_encoding_cookie(f))
else:
return f.read()
|
null | null | null | What does the code enable ?
| def enabled(name, **kwargs):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': []}
current_beacons = __salt__['beacons.list'](show_all=True, return_yaml=False)
if (name in current_beacons):
if (('test' in __opts__) and __opts__['test']):
kwargs['test'] = True
result = __salt__['beacons.enable_be... | null | null | null | a beacon
| codeqa | def enabled name **kwargs ret {'name' name 'result' True 'changes' {} 'comment' []}current beacons salt ['beacons list'] show all True return yaml False if name in current beacons if 'test' in opts and opts ['test'] kwargs['test'] Trueresult salt ['beacons enable beacon'] name **kwargs ret['comment'] append result['com... | null | null | null | null | Question:
What does the code enable ?
Code:
def enabled(name, **kwargs):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': []}
current_beacons = __salt__['beacons.list'](show_all=True, return_yaml=False)
if (name in current_beacons):
if (('test' in __opts__) and __opts__['test']):
kwargs['test'... |
null | null | null | How does the code get a zone ?
| def get_command(args):
zone = get_zone(args.project_id, args.name)
if (not zone):
print 'Zone not found.'
else:
print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
| null | null | null | by name
| codeqa | def get command args zone get zone args project id args name if not zone print ' Zonenotfound 'else print ' Zone {} {} {}' format zone name zone dns name zone description
| null | null | null | null | Question:
How does the code get a zone ?
Code:
def get_command(args):
zone = get_zone(args.project_id, args.name)
if (not zone):
print 'Zone not found.'
else:
print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
|
null | null | null | What does the code get by name ?
| def get_command(args):
zone = get_zone(args.project_id, args.name)
if (not zone):
print 'Zone not found.'
else:
print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
| null | null | null | a zone
| codeqa | def get command args zone get zone args project id args name if not zone print ' Zonenotfound 'else print ' Zone {} {} {}' format zone name zone dns name zone description
| null | null | null | null | Question:
What does the code get by name ?
Code:
def get_command(args):
zone = get_zone(args.project_id, args.name)
if (not zone):
print 'Zone not found.'
else:
print 'Zone: {}, {}, {}'.format(zone.name, zone.dns_name, zone.description)
|
null | null | null | What does the code get from git ?
| def get_git_version():
if DEVELOP:
match = '--match=*.*.*build*'
else:
match = '--match=*.*.*'
try:
version = subprocess.check_output(('git describe --abbrev=4 --tags'.split() + [match])).strip()
except:
version = 'unknown'
fout = open('RELEASE-VERSION', 'wb')
fout.write(version)
fout.write('\n')
fou... | null | null | null | the version
| codeqa | def get git version if DEVELOP match '--match * * *build*'else match '--match * * *'try version subprocess check output 'gitdescribe--abbrev 4--tags' split + [match] strip except version 'unknown'fout open 'RELEASE-VERSION' 'wb' fout write version fout write '\n' fout close fout open 'GIT-COMMIT' 'wb' try commit subpro... | null | null | null | null | Question:
What does the code get from git ?
Code:
def get_git_version():
if DEVELOP:
match = '--match=*.*.*build*'
else:
match = '--match=*.*.*'
try:
version = subprocess.check_output(('git describe --abbrev=4 --tags'.split() + [match])).strip()
except:
version = 'unknown'
fout = open('RELEASE-VERSI... |
null | null | null | What does the code create ?
| def with_metaclass(meta, base=object):
return meta('NewBase', (base,), {})
| null | null | null | a base class with a metaclass
| codeqa | def with metaclass meta base object return meta ' New Base' base {}
| null | null | null | null | Question:
What does the code create ?
Code:
def with_metaclass(meta, base=object):
return meta('NewBase', (base,), {})
|
null | null | null | What does the code get ?
| def getSimplifiedPath(path, radius):
if (len(path) < 2):
return path
simplificationMultiplication = 256
simplificationRadius = (radius / float(simplificationMultiplication))
maximumIndex = (len(path) * simplificationMultiplication)
pointIndex = 1
while (pointIndex < maximumIndex):
oldPathLength = len(path)
... | null | null | null | path with points inside the channel removed
| codeqa | def get Simplified Path path radius if len path < 2 return pathsimplification Multiplication 256 simplification Radius radius / float simplification Multiplication maximum Index len path * simplification Multiplication point Index 1while point Index < maximum Index old Path Length len path path get Half Simplified Path... | null | null | null | null | Question:
What does the code get ?
Code:
def getSimplifiedPath(path, radius):
if (len(path) < 2):
return path
simplificationMultiplication = 256
simplificationRadius = (radius / float(simplificationMultiplication))
maximumIndex = (len(path) * simplificationMultiplication)
pointIndex = 1
while (pointIndex < ... |
null | null | null | What does the code sanitize ?
| def sanitize_file_name(name, substitute='_', as_unicode=False):
if isinstance(name, unicode):
name = name.encode(filesystem_encoding, 'ignore')
one = _filename_sanitize.sub(substitute, name)
one = re.sub('\\s', ' ', one).strip()
(bname, ext) = os.path.splitext(one)
one = re.sub('^\\.+$', '_', bname)
if as_unic... | null | null | null | the filename name
| codeqa | def sanitize file name name substitute ' ' as unicode False if isinstance name unicode name name encode filesystem encoding 'ignore' one filename sanitize sub substitute name one re sub '\\s' '' one strip bname ext os path splitext one one re sub '^\\ +$' ' ' bname if as unicode one one decode filesystem encoding one o... | null | null | null | null | Question:
What does the code sanitize ?
Code:
def sanitize_file_name(name, substitute='_', as_unicode=False):
if isinstance(name, unicode):
name = name.encode(filesystem_encoding, 'ignore')
one = _filename_sanitize.sub(substitute, name)
one = re.sub('\\s', ' ', one).strip()
(bname, ext) = os.path.splitext(on... |
null | null | null | Where did the headers give ?
| def _generate_cache_key(request, method, headerlist, key_prefix):
ctx = hashlib.md5()
for header in headerlist:
value = request.META.get(header)
if (value is not None):
ctx.update(force_bytes(value))
url = hashlib.md5(force_bytes(iri_to_uri(request.build_absolute_uri())))
cache_key = ('views.decorators.cache... | null | null | null | in the header list
| codeqa | def generate cache key request method headerlist key prefix ctx hashlib md 5 for header in headerlist value request META get header if value is not None ctx update force bytes value url hashlib md 5 force bytes iri to uri request build absolute uri cache key 'views decorators cache cache page %s %s %s %s' % key prefix ... | null | null | null | null | Question:
Where did the headers give ?
Code:
def _generate_cache_key(request, method, headerlist, key_prefix):
ctx = hashlib.md5()
for header in headerlist:
value = request.META.get(header)
if (value is not None):
ctx.update(force_bytes(value))
url = hashlib.md5(force_bytes(iri_to_uri(request.build_absolu... |
null | null | null | What given in the header list ?
| def _generate_cache_key(request, method, headerlist, key_prefix):
ctx = hashlib.md5()
for header in headerlist:
value = request.META.get(header)
if (value is not None):
ctx.update(force_bytes(value))
url = hashlib.md5(force_bytes(iri_to_uri(request.build_absolute_uri())))
cache_key = ('views.decorators.cache... | null | null | null | the headers
| codeqa | def generate cache key request method headerlist key prefix ctx hashlib md 5 for header in headerlist value request META get header if value is not None ctx update force bytes value url hashlib md 5 force bytes iri to uri request build absolute uri cache key 'views decorators cache cache page %s %s %s %s' % key prefix ... | null | null | null | null | Question:
What given in the header list ?
Code:
def _generate_cache_key(request, method, headerlist, key_prefix):
ctx = hashlib.md5()
for header in headerlist:
value = request.META.get(header)
if (value is not None):
ctx.update(force_bytes(value))
url = hashlib.md5(force_bytes(iri_to_uri(request.build_abs... |
null | null | null | What does the code add into a table ?
| def addXIntersectionsFromLoopForTable(loop, xIntersectionsTable, width):
for pointIndex in xrange(len(loop)):
pointBegin = loop[pointIndex]
pointEnd = loop[((pointIndex + 1) % len(loop))]
if (pointBegin.imag > pointEnd.imag):
pointOriginal = pointBegin
pointBegin = pointEnd
pointEnd = pointOriginal
fi... | null | null | null | the x intersections for a loop
| codeqa | def add X Intersections From Loop For Table loop x Intersections Table width for point Index in xrange len loop point Begin loop[point Index]point End loop[ point Index + 1 % len loop ]if point Begin imag > point End imag point Original point Beginpoint Begin point Endpoint End point Originalfill Begin int math ceil po... | null | null | null | null | Question:
What does the code add into a table ?
Code:
def addXIntersectionsFromLoopForTable(loop, xIntersectionsTable, width):
for pointIndex in xrange(len(loop)):
pointBegin = loop[pointIndex]
pointEnd = loop[((pointIndex + 1) % len(loop))]
if (pointBegin.imag > pointEnd.imag):
pointOriginal = pointBegin... |
null | null | null | What does the code get ?
| def precedence(state):
try:
return PRECEDENCE.index(state)
except ValueError:
return PRECEDENCE.index(None)
| null | null | null | the precedence index for state
| codeqa | def precedence state try return PRECEDENCE index state except Value Error return PRECEDENCE index None
| null | null | null | null | Question:
What does the code get ?
Code:
def precedence(state):
try:
return PRECEDENCE.index(state)
except ValueError:
return PRECEDENCE.index(None)
|
null | null | null | What does the code get ?
| def getRadialPath(begin, end, path, segmentCenter):
beginComplex = begin.dropAxis()
endComplex = end.dropAxis()
segmentCenterComplex = segmentCenter.dropAxis()
beginMinusCenterComplex = (beginComplex - segmentCenterComplex)
endMinusCenterComplex = (endComplex - segmentCenterComplex)
beginMinusCenterComplexRadius ... | null | null | null | radial path
| codeqa | def get Radial Path begin end path segment Center begin Complex begin drop Axis end Complex end drop Axis segment Center Complex segment Center drop Axis begin Minus Center Complex begin Complex - segment Center Complex end Minus Center Complex end Complex - segment Center Complex begin Minus Center Complex Radius abs ... | null | null | null | null | Question:
What does the code get ?
Code:
def getRadialPath(begin, end, path, segmentCenter):
beginComplex = begin.dropAxis()
endComplex = end.dropAxis()
segmentCenterComplex = segmentCenter.dropAxis()
beginMinusCenterComplex = (beginComplex - segmentCenterComplex)
endMinusCenterComplex = (endComplex - segmentC... |
null | null | null | What does the code remove ?
| def removeZip():
zipName = 'reprap_python_beanshell'
zipNameExtension = (zipName + '.zip')
if (zipNameExtension in os.listdir(os.getcwd())):
os.remove(zipNameExtension)
shellCommand = ('zip -r %s * -x \\*.pyc \\*~' % zipName)
if (os.system(shellCommand) != 0):
print 'Failed to execute the following ... | null | null | null | the zip file
| codeqa | def remove Zip zip Name 'reprap python beanshell'zip Name Extension zip Name + ' zip' if zip Name Extension in os listdir os getcwd os remove zip Name Extension shell Command 'zip-r%s*-x\\* pyc\\*~' % zip Name if os system shell Command 0 print ' Failedtoexecutethefollowingcommandinremove Zipinprepare 'print shell Comm... | null | null | null | null | Question:
What does the code remove ?
Code:
def removeZip():
zipName = 'reprap_python_beanshell'
zipNameExtension = (zipName + '.zip')
if (zipNameExtension in os.listdir(os.getcwd())):
os.remove(zipNameExtension)
shellCommand = ('zip -r %s * -x \\*.pyc \\*~' % zipName)
if (os.system(shellCommand) != 0)... |
null | null | null | What does the code send to the recipients of the given thread ?
| def _add_message_to_email_buffer(author_id, exploration_id, thread_id, message_id, message_length, old_status, new_status):
thread = feedback_models.FeedbackThreadModel.get_by_exp_and_thread_id(exploration_id, thread_id)
has_suggestion = thread.has_suggestion
feedback_message_reference = feedback_domain.FeedbackMess... | null | null | null | the given message
| codeqa | def add message to email buffer author id exploration id thread id message id message length old status new status thread feedback models Feedback Thread Model get by exp and thread id exploration id thread id has suggestion thread has suggestionfeedback message reference feedback domain Feedback Message Reference expl... | null | null | null | null | Question:
What does the code send to the recipients of the given thread ?
Code:
def _add_message_to_email_buffer(author_id, exploration_id, thread_id, message_id, message_length, old_status, new_status):
thread = feedback_models.FeedbackThreadModel.get_by_exp_and_thread_id(exploration_id, thread_id)
has_suggestio... |
null | null | null | How does a 303 return ?
| def update(request, course_key, note_id):
try:
note = Note.objects.get(id=note_id)
except Note.DoesNotExist:
return ApiResponse(http_response=HttpResponse('', status=404), data=None)
if (note.user.id != request.user.id):
return ApiResponse(http_response=HttpResponse('', status=403), data=None)
try:
note.cle... | null | null | null | with the read location
| codeqa | def update request course key note id try note Note objects get id note id except Note Does Not Exist return Api Response http response Http Response '' status 404 data None if note user id request user id return Api Response http response Http Response '' status 403 data None try note clean request body except Validat... | null | null | null | null | Question:
How does a 303 return ?
Code:
def update(request, course_key, note_id):
try:
note = Note.objects.get(id=note_id)
except Note.DoesNotExist:
return ApiResponse(http_response=HttpResponse('', status=404), data=None)
if (note.user.id != request.user.id):
return ApiResponse(http_response=HttpResponse(... |
null | null | null | What does the code get ?
| def getInsetLoopsFromLoops(loops, radius):
insetLoops = []
for loop in loops:
insetLoops += getInsetLoopsFromLoop(loop, radius)
return insetLoops
| null | null | null | the inset loops
| codeqa | def get Inset Loops From Loops loops radius inset Loops []for loop in loops inset Loops + get Inset Loops From Loop loop radius return inset Loops
| null | null | null | null | Question:
What does the code get ?
Code:
def getInsetLoopsFromLoops(loops, radius):
insetLoops = []
for loop in loops:
insetLoops += getInsetLoopsFromLoop(loop, radius)
return insetLoops
|
null | null | null | What does the code modify ?
| def retention_policy_alter(database, name, duration, replication, default=False, user=None, password=None, host=None, port=None):
client = _client(user=user, password=password, host=host, port=port)
client.alter_retention_policy(name, database, duration, replication, default)
return True
| null | null | null | an existing retention policy
| codeqa | def retention policy alter database name duration replication default False user None password None host None port None client client user user password password host host port port client alter retention policy name database duration replication default return True
| null | null | null | null | Question:
What does the code modify ?
Code:
def retention_policy_alter(database, name, duration, replication, default=False, user=None, password=None, host=None, port=None):
client = _client(user=user, password=password, host=host, port=port)
client.alter_retention_policy(name, database, duration, replication, de... |
null | null | null | What does the code detect ?
| def get_desktop():
if (('KDE_FULL_SESSION' in os.environ) or ('KDE_MULTIHEAD' in os.environ)):
return 'KDE'
elif (('GNOME_DESKTOP_SESSION_ID' in os.environ) or ('GNOME_KEYRING_SOCKET' in os.environ)):
return 'GNOME'
elif (('MATE_DESKTOP_SESSION_ID' in os.environ) or ('MATE_KEYRING_SOCKET' in os.environ)):
retu... | null | null | null | the current desktop environment
| codeqa | def get desktop if 'KDE FULL SESSION' in os environ or 'KDE MULTIHEAD' in os environ return 'KDE'elif 'GNOME DESKTOP SESSION ID' in os environ or 'GNOME KEYRING SOCKET' in os environ return 'GNOME'elif 'MATE DESKTOP SESSION ID' in os environ or 'MATE KEYRING SOCKET' in os environ return 'MATE'elif sys platform 'darwin'... | null | null | null | null | Question:
What does the code detect ?
Code:
def get_desktop():
if (('KDE_FULL_SESSION' in os.environ) or ('KDE_MULTIHEAD' in os.environ)):
return 'KDE'
elif (('GNOME_DESKTOP_SESSION_ID' in os.environ) or ('GNOME_KEYRING_SOCKET' in os.environ)):
return 'GNOME'
elif (('MATE_DESKTOP_SESSION_ID' in os.environ) o... |
null | null | null | What do environment variables describe ?
| def save_environment(directory, cluster, package_source):
environment_variables = get_trial_environment(cluster, package_source)
environment_strings = list()
for environment_variable in environment_variables:
environment_strings.append('export {name}={value};\n'.format(name=environment_variable, value=shell_quote... | null | null | null | the cluster
| codeqa | def save environment directory cluster package source environment variables get trial environment cluster package source environment strings list for environment variable in environment variables environment strings append 'export{name} {value} \n' format name environment variable value shell quote environment variable... | null | null | null | null | Question:
What do environment variables describe ?
Code:
def save_environment(directory, cluster, package_source):
environment_variables = get_trial_environment(cluster, package_source)
environment_strings = list()
for environment_variable in environment_variables:
environment_strings.append('export {name}={v... |
null | null | null | What is describing the cluster ?
| def save_environment(directory, cluster, package_source):
environment_variables = get_trial_environment(cluster, package_source)
environment_strings = list()
for environment_variable in environment_variables:
environment_strings.append('export {name}={value};\n'.format(name=environment_variable, value=shell_quote... | null | null | null | environment variables
| codeqa | def save environment directory cluster package source environment variables get trial environment cluster package source environment strings list for environment variable in environment variables environment strings append 'export{name} {value} \n' format name environment variable value shell quote environment variable... | null | null | null | null | Question:
What is describing the cluster ?
Code:
def save_environment(directory, cluster, package_source):
environment_variables = get_trial_environment(cluster, package_source)
environment_strings = list()
for environment_variable in environment_variables:
environment_strings.append('export {name}={value};\n... |
null | null | null | What does the code get ?
| def getNewRepository():
return PostscriptRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return Postscript Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return PostscriptRepository()
|
null | null | null | What can we do ?
| def test_lex_line_counting_multi():
entries = tokenize('\n(foo (one two))\n(foo bar)\n')
entry = entries[0]
assert (entry.start_line == 2)
assert (entry.start_column == 1)
assert (entry.end_line == 2)
assert (entry.end_column == 15)
entry = entries[1]
assert (entry.start_line == 3)
assert (entry.start_colum... | null | null | null | multi - line tokenization
| codeqa | def test lex line counting multi entries tokenize '\n foo onetwo \n foobar \n' entry entries[ 0 ]assert entry start line 2 assert entry start column 1 assert entry end line 2 assert entry end column 15 entry entries[ 1 ]assert entry start line 3 assert entry start column 1 assert entry end line 3 assert entry end colum... | null | null | null | null | Question:
What can we do ?
Code:
def test_lex_line_counting_multi():
entries = tokenize('\n(foo (one two))\n(foo bar)\n')
entry = entries[0]
assert (entry.start_line == 2)
assert (entry.start_column == 1)
assert (entry.end_line == 2)
assert (entry.end_column == 15)
entry = entries[1]
assert (entry.start_... |
null | null | null | Who earned it ?
| @task()
@timeit
def maybe_award_badge(badge_template, year, user):
badge = get_or_create_badge(badge_template, year)
if badge.is_awarded_to(user):
return
from kitsune.questions.models import Answer
qs = Answer.objects.filter(creator=user, created__gte=date(year, 1, 1), created__lt=date((year + 1), 1, 1))
if (qs.... | null | null | null | they
| codeqa | @task @timeitdef maybe award badge badge template year user badge get or create badge badge template year if badge is awarded to user returnfrom kitsune questions models import Answerqs Answer objects filter creator user created gte date year 1 1 created lt date year + 1 1 1 if qs count > 30 badge award to user return ... | null | null | null | null | Question:
Who earned it ?
Code:
@task()
@timeit
def maybe_award_badge(badge_template, year, user):
badge = get_or_create_badge(badge_template, year)
if badge.is_awarded_to(user):
return
from kitsune.questions.models import Answer
qs = Answer.objects.filter(creator=user, created__gte=date(year, 1, 1), created_... |
null | null | null | What adds a function to dictionary ?
| def add_to_dict(functions):
def decorator(func):
functions[func.__name__] = func
return func
return decorator
| null | null | null | a decorator
| codeqa | def add to dict functions def decorator func functions[func name ] funcreturn funcreturn decorator
| null | null | null | null | Question:
What adds a function to dictionary ?
Code:
def add_to_dict(functions):
def decorator(func):
functions[func.__name__] = func
return func
return decorator
|
null | null | null | What does the code create from a space - separated list of literal choices ?
| def literals(choices, prefix='', suffix=''):
return '|'.join((((prefix + re.escape(c)) + suffix) for c in choices.split()))
| null | null | null | a regex
| codeqa | def literals choices prefix '' suffix '' return ' ' join prefix + re escape c + suffix for c in choices split
| null | null | null | null | Question:
What does the code create from a space - separated list of literal choices ?
Code:
def literals(choices, prefix='', suffix=''):
return '|'.join((((prefix + re.escape(c)) + suffix) for c in choices.split()))
|
null | null | null | For what purpose do processing history write ?
| def _write_proc_history(fid, info):
if ('proc_history' not in info):
return
if (len(info['proc_history']) > 0):
start_block(fid, FIFF.FIFFB_PROCESSING_HISTORY)
for record in info['proc_history']:
start_block(fid, FIFF.FIFFB_PROCESSING_RECORD)
for (key, id_, writer) in zip(_proc_keys, _proc_ids, _proc_writ... | null | null | null | to file
| codeqa | def write proc history fid info if 'proc history' not in info returnif len info['proc history'] > 0 start block fid FIFF FIFFB PROCESSING HISTORY for record in info['proc history'] start block fid FIFF FIFFB PROCESSING RECORD for key id writer in zip proc keys proc ids proc writers if key in record writer fid id record... | null | null | null | null | Question:
For what purpose do processing history write ?
Code:
def _write_proc_history(fid, info):
if ('proc_history' not in info):
return
if (len(info['proc_history']) > 0):
start_block(fid, FIFF.FIFFB_PROCESSING_HISTORY)
for record in info['proc_history']:
start_block(fid, FIFF.FIFFB_PROCESSING_RECORD)... |
null | null | null | What did the code read ?
| def get_file_json(path):
with open(path, u'r') as f:
return json.load(f)
| null | null | null | a file
| codeqa | def get file json path with open path u'r' as f return json load f
| null | null | null | null | Question:
What did the code read ?
Code:
def get_file_json(path):
with open(path, u'r') as f:
return json.load(f)
|
null | null | null | What spawns a new development server ?
| def make_runserver(app_factory, hostname='localhost', port=5000, use_reloader=False, use_debugger=False, use_evalex=True, threaded=False, processes=1, static_files=None, extra_files=None, ssl_context=None):
_deprecated()
def action(hostname=('h', hostname), port=('p', port), reloader=use_reloader, debugger=use_debugg... | null | null | null | an action callback
| codeqa | def make runserver app factory hostname 'localhost' port 5000 use reloader False use debugger False use evalex True threaded False processes 1 static files None extra files None ssl context None deprecated def action hostname 'h' hostname port 'p' port reloader use reloader debugger use debugger evalex use evalex threa... | null | null | null | null | Question:
What spawns a new development server ?
Code:
def make_runserver(app_factory, hostname='localhost', port=5000, use_reloader=False, use_debugger=False, use_evalex=True, threaded=False, processes=1, static_files=None, extra_files=None, ssl_context=None):
_deprecated()
def action(hostname=('h', hostname), p... |
null | null | null | What does an action callback spawn ?
| def make_runserver(app_factory, hostname='localhost', port=5000, use_reloader=False, use_debugger=False, use_evalex=True, threaded=False, processes=1, static_files=None, extra_files=None, ssl_context=None):
_deprecated()
def action(hostname=('h', hostname), port=('p', port), reloader=use_reloader, debugger=use_debugg... | null | null | null | a new development server
| codeqa | def make runserver app factory hostname 'localhost' port 5000 use reloader False use debugger False use evalex True threaded False processes 1 static files None extra files None ssl context None deprecated def action hostname 'h' hostname port 'p' port reloader use reloader debugger use debugger evalex use evalex threa... | null | null | null | null | Question:
What does an action callback spawn ?
Code:
def make_runserver(app_factory, hostname='localhost', port=5000, use_reloader=False, use_debugger=False, use_evalex=True, threaded=False, processes=1, static_files=None, extra_files=None, ssl_context=None):
_deprecated()
def action(hostname=('h', hostname), por... |
null | null | null | What does the code get from the environment or password database ?
| def getuser():
import os
for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
user = os.environ.get(name)
if user:
return user
import pwd
return pwd.getpwuid(os.getuid())[0]
| null | null | null | the username
| codeqa | def getuser import osfor name in 'LOGNAME' 'USER' 'LNAME' 'USERNAME' user os environ get name if user return userimport pwdreturn pwd getpwuid os getuid [0 ]
| null | null | null | null | Question:
What does the code get from the environment or password database ?
Code:
def getuser():
import os
for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'):
user = os.environ.get(name)
if user:
return user
import pwd
return pwd.getpwuid(os.getuid())[0]
|
null | null | null | What does the code get from the table ?
| def virtual_interface_get(context, vif_id):
return IMPL.virtual_interface_get(context, vif_id)
| null | null | null | a virtual interface
| codeqa | def virtual interface get context vif id return IMPL virtual interface get context vif id
| null | null | null | null | Question:
What does the code get from the table ?
Code:
def virtual_interface_get(context, vif_id):
return IMPL.virtual_interface_get(context, vif_id)
|
null | null | null | What does the code get ?
| def getVersionFileName():
return getFabmetheusUtilitiesPath('version.txt')
| null | null | null | the file name of the version date
| codeqa | def get Version File Name return get Fabmetheus Utilities Path 'version txt'
| null | null | null | null | Question:
What does the code get ?
Code:
def getVersionFileName():
return getFabmetheusUtilitiesPath('version.txt')
|
null | null | null | What is reversed where ?
| def property_mock(request, cls, prop_name, **kwargs):
_patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
| null | null | null | the patch
| codeqa | def property mock request cls prop name **kwargs patch patch object cls prop name new callable Property Mock **kwargs request addfinalizer patch stop return patch start
| null | null | null | null | Question:
What is reversed where ?
Code:
def property_mock(request, cls, prop_name, **kwargs):
_patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
|
null | null | null | What uses it ?
| def property_mock(request, cls, prop_name, **kwargs):
_patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
| null | null | null | pytest
| codeqa | def property mock request cls prop name **kwargs patch patch object cls prop name new callable Property Mock **kwargs request addfinalizer patch stop return patch start
| null | null | null | null | Question:
What uses it ?
Code:
def property_mock(request, cls, prop_name, **kwargs):
_patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
request.addfinalizer(_patch.stop)
return _patch.start()
|
null | null | null | What does the code generate ?
| def gen_state_tag(low):
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
| null | null | null | the running dict tag string
| codeqa | def gen state tag low return '{ 0 [state]} -{ 0 [ id ]} -{ 0 [name]} -{ 0 [fun]}' format low
| null | null | null | null | Question:
What does the code generate ?
Code:
def gen_state_tag(low):
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
|
null | null | null | How do a deleted document purge ?
| @block_user_agents
@login_required
@permission_required('wiki.purge_document')
@check_readonly
@process_document_path
def purge_document(request, document_slug, document_locale):
document = get_object_or_404(Document.deleted_objects.all(), slug=document_slug, locale=document_locale)
if ((request.method == 'POST') and... | null | null | null | permanently
| codeqa | @block user agents@login required@permission required 'wiki purge document' @check readonly@process document pathdef purge document request document slug document locale document get object or 404 Document deleted objects all slug document slug locale document locale if request method 'POST' and 'confirm' in request PO... | null | null | null | null | Question:
How do a deleted document purge ?
Code:
@block_user_agents
@login_required
@permission_required('wiki.purge_document')
@check_readonly
@process_document_path
def purge_document(request, document_slug, document_locale):
document = get_object_or_404(Document.deleted_objects.all(), slug=document_slug, local... |
null | null | null | In which direction does the code move ?
| def move_in_stack(move_up):
frame = Frame.get_selected_python_frame()
while frame:
if move_up:
iter_frame = frame.older()
else:
iter_frame = frame.newer()
if (not iter_frame):
break
if iter_frame.is_python_frame():
if iter_frame.select():
iter_frame.print_summary()
return
frame = iter_fra... | null | null | null | up or down the stack
| codeqa | def move in stack move up frame Frame get selected python frame while frame if move up iter frame frame older else iter frame frame newer if not iter frame breakif iter frame is python frame if iter frame select iter frame print summary returnframe iter frameif move up print ' Unabletofindanolderpythonframe' else print... | null | null | null | null | Question:
In which direction does the code move ?
Code:
def move_in_stack(move_up):
frame = Frame.get_selected_python_frame()
while frame:
if move_up:
iter_frame = frame.older()
else:
iter_frame = frame.newer()
if (not iter_frame):
break
if iter_frame.is_python_frame():
if iter_frame.select():... |
null | null | null | When did room create ?
| def c_moves(client):
cmds = client.exits
return ('look' if (not cmds) else cmds)
| null | null | null | previously
| codeqa | def c moves client cmds client exitsreturn 'look' if not cmds else cmds
| null | null | null | null | Question:
When did room create ?
Code:
def c_moves(client):
cmds = client.exits
return ('look' if (not cmds) else cmds)
|
null | null | null | What did the code set for programmatic use with file - like i / o ?
| def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None):
(... | null | null | null | a publisher
| codeqa | def publish file source None source path None destination None destination path None reader None reader name 'standalone' parser None parser name 'restructuredtext' writer None writer name 'pseudoxml' settings None settings spec None settings overrides None config section None enable exit status None output pub publish... | null | null | null | null | Question:
What did the code set for programmatic use with file - like i / o ?
Code:
def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settin... |
null | null | null | For what purpose did the code run a publisher ?
| def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None):
(... | null | null | null | for programmatic use with file - like i / o
| codeqa | def publish file source None source path None destination None destination path None reader None reader name 'standalone' parser None parser name 'restructuredtext' writer None writer name 'pseudoxml' settings None settings spec None settings overrides None config section None enable exit status None output pub publish... | null | null | null | null | Question:
For what purpose did the code run a publisher ?
Code:
def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.