labNo float64 1 10 ⌀ | taskNo float64 0 4 ⌀ | questioner stringclasses 2
values | question stringlengths 9 201 | code stringlengths 18 30.3k | startLine float64 0 192 ⌀ | endLine float64 0 196 ⌀ | questionType stringclasses 4
values | answer stringlengths 2 905 | src stringclasses 3
values | code_processed stringlengths 12 28.3k ⌀ | id stringlengths 2 5 ⌀ | raw_code stringlengths 20 30.3k ⌀ | raw_comment stringlengths 10 242 ⌀ | comment stringlengths 9 207 ⌀ | q_code stringlengths 66 30.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
null | null | null | What does the code get from the table ?
| @require_context
@pick_context_manager_reader
def virtual_interface_get(context, vif_id):
vif_ref = _virtual_interface_query(context).filter_by(id=vif_id).first()
return vif_ref
| null | null | null | a virtual interface
| codeqa | @require context@pick context manager readerdef virtual interface get context vif id vif ref virtual interface query context filter by id vif id first return vif ref
| null | null | null | null | Question:
What does the code get from the table ?
Code:
@require_context
@pick_context_manager_reader
def virtual_interface_get(context, vif_id):
vif_ref = _virtual_interface_query(context).filter_by(id=vif_id).first()
return vif_ref
|
null | null | null | How did derivative compute ?
| def test_derivative_numerically(f, z, tol=1e-06, a=2, b=(-1), c=3, d=1):
from sympy.core.function import Derivative
z0 = random_complex_number(a, b, c, d)
f1 = f.diff(z).subs(z, z0)
f2 = Derivative(f, z).doit_numerically(z0)
return comp(f1.n(), f2.n(), tol)
| null | null | null | symbolically
| codeqa | def test derivative numerically f z tol 1e- 06 a 2 b -1 c 3 d 1 from sympy core function import Derivativez 0 random complex number a b c d f1 f diff z subs z z0 f2 Derivative f z doit numerically z0 return comp f1 n f2 n tol
| null | null | null | null | Question:
How did derivative compute ?
Code:
def test_derivative_numerically(f, z, tol=1e-06, a=2, b=(-1), c=3, d=1):
from sympy.core.function import Derivative
z0 = random_complex_number(a, b, c, d)
f1 = f.diff(z).subs(z, z0)
f2 = Derivative(f, z).doit_numerically(z0)
return comp(f1.n(), f2.n(), tol)
|
null | null | null | What does the code send ?
| def call(conf, context, topic, msg, timeout, connection_pool):
rv = multicall(conf, context, topic, msg, timeout, connection_pool)
rv = list(rv)
if (not rv):
return
return rv[(-1)]
| null | null | null | a message on a topic
| codeqa | def call conf context topic msg timeout connection pool rv multicall conf context topic msg timeout connection pool rv list rv if not rv returnreturn rv[ -1 ]
| null | null | null | null | Question:
What does the code send ?
Code:
def call(conf, context, topic, msg, timeout, connection_pool):
rv = multicall(conf, context, topic, msg, timeout, connection_pool)
rv = list(rv)
if (not rv):
return
return rv[(-1)]
|
null | null | null | What does the code send ?
| def get(url, **kwargs):
kwargs.setdefault(u'allow_redirects', True)
return request(u'get', url, **kwargs)
| null | null | null | a get request
| codeqa | def get url **kwargs kwargs setdefault u'allow redirects' True return request u'get' url **kwargs
| null | null | null | null | Question:
What does the code send ?
Code:
def get(url, **kwargs):
kwargs.setdefault(u'allow_redirects', True)
return request(u'get', url, **kwargs)
|
null | null | null | What does the code generate ?
| def rand_text(length, bad='', chars=allchars):
return rand_base(length, bad, chars)
| null | null | null | a random string
| codeqa | def rand text length bad '' chars allchars return rand base length bad chars
| null | null | null | null | Question:
What does the code generate ?
Code:
def rand_text(length, bad='', chars=allchars):
return rand_base(length, bad, chars)
|
null | null | null | What did the code receive ?
| def configure_callback(conf):
host = MESOS_HOST
port = MESOS_PORT
verboseLogging = VERBOSE_LOGGING
version = MESOS_VERSION
instance = MESOS_INSTANCE
for node in conf.children:
if (node.key == 'Host'):
host = node.values[0]
elif (node.key == 'Port'):
port = int(node.values[0])
elif (node.key == 'Verbos... | null | null | null | configuration information
| codeqa | def configure callback conf host MESOS HOS Tport MESOS POR Tverbose Logging VERBOSE LOGGIN Gversion MESOS VERSIO Ninstance MESOS INSTANC Efor node in conf children if node key ' Host' host node values[ 0 ]elif node key ' Port' port int node values[ 0 ] elif node key ' Verbose' verbose Logging bool node values[ 0 ] elif... | null | null | null | null | Question:
What did the code receive ?
Code:
def configure_callback(conf):
host = MESOS_HOST
port = MESOS_PORT
verboseLogging = VERBOSE_LOGGING
version = MESOS_VERSION
instance = MESOS_INSTANCE
for node in conf.children:
if (node.key == 'Host'):
host = node.values[0]
elif (node.key == 'Port'):
port =... |
null | null | null | What does the code get ?
| def getNewRepository():
return DrillRepository()
| null | null | null | new repository
| codeqa | def get New Repository return Drill Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return DrillRepository()
|
null | null | null | When is a transaction active ?
| def in_transaction():
from . import tasklets
return tasklets.get_context().in_transaction()
| null | null | null | currently
| codeqa | def in transaction from import taskletsreturn tasklets get context in transaction
| null | null | null | null | Question:
When is a transaction active ?
Code:
def in_transaction():
from . import tasklets
return tasklets.get_context().in_transaction()
|
null | null | null | What does the code check ?
| def _check_X(X, n_components=None, n_features=None):
X = check_array(X, dtype=[np.float64, np.float32])
if ((n_components is not None) and (X.shape[0] < n_components)):
raise ValueError(('Expected n_samples >= n_components but got n_components = %d, n_samples = %d' % (n_components, X.shape[0])))
if ((n_... | null | null | null | the input data
| codeqa | def check X X n components None n features None X check array X dtype [np float 64 np float 32 ] if n components is not None and X shape[ 0 ] < n components raise Value Error ' Expectedn samples> n componentsbutgotn components %d n samples %d' % n components X shape[ 0 ] if n features is not None and X shape[ 1 ] n fea... | null | null | null | null | Question:
What does the code check ?
Code:
def _check_X(X, n_components=None, n_features=None):
X = check_array(X, dtype=[np.float64, np.float32])
if ((n_components is not None) and (X.shape[0] < n_components)):
raise ValueError(('Expected n_samples >= n_components but got n_components = %d, n_samples ... |
null | null | null | What does the code install ?
| def InstallLibrary(name, version, explicit=True):
(installed_version, explicitly_installed) = installed.get(name, ([None] * 2))
if (name in sys.modules):
if explicit:
CheckInstalledVersion(name, version, explicit=True)
return
elif installed_version:
if (version == installed_version):
return
if explicit... | null | null | null | a package
| codeqa | def Install Library name version explicit True installed version explicitly installed installed get name [ None] * 2 if name in sys modules if explicit Check Installed Version name version explicit True returnelif installed version if version installed version returnif explicit if explicitly installed raise Value Error... | null | null | null | null | Question:
What does the code install ?
Code:
def InstallLibrary(name, version, explicit=True):
(installed_version, explicitly_installed) = installed.get(name, ([None] * 2))
if (name in sys.modules):
if explicit:
CheckInstalledVersion(name, version, explicit=True)
return
elif installed_version:
if (versi... |
null | null | null | How does the code take a class ?
| def decorator_factory(cls):
attrs = set(dir(cls))
if ('__call__' in attrs):
raise TypeError('You cannot decorate a class with a nontrivial __call__ method')
if ('call' not in attrs):
raise TypeError('You cannot decorate a class without a .call method')
cls.__call__ = __call__
return cls
| null | null | null | with a
| codeqa | def decorator factory cls attrs set dir cls if ' call ' in attrs raise Type Error ' Youcannotdecorateaclasswithanontrivial call method' if 'call' not in attrs raise Type Error ' Youcannotdecorateaclasswithouta callmethod' cls call call return cls
| null | null | null | null | Question:
How does the code take a class ?
Code:
def decorator_factory(cls):
attrs = set(dir(cls))
if ('__call__' in attrs):
raise TypeError('You cannot decorate a class with a nontrivial __call__ method')
if ('call' not in attrs):
raise TypeError('You cannot decorate a class without a .call ... |
null | null | null | What does the code take with a ?
| def decorator_factory(cls):
attrs = set(dir(cls))
if ('__call__' in attrs):
raise TypeError('You cannot decorate a class with a nontrivial __call__ method')
if ('call' not in attrs):
raise TypeError('You cannot decorate a class without a .call method')
cls.__call__ = __call__
return cls
| null | null | null | a class
| codeqa | def decorator factory cls attrs set dir cls if ' call ' in attrs raise Type Error ' Youcannotdecorateaclasswithanontrivial call method' if 'call' not in attrs raise Type Error ' Youcannotdecorateaclasswithouta callmethod' cls call call return cls
| null | null | null | null | Question:
What does the code take with a ?
Code:
def decorator_factory(cls):
attrs = set(dir(cls))
if ('__call__' in attrs):
raise TypeError('You cannot decorate a class with a nontrivial __call__ method')
if ('call' not in attrs):
raise TypeError('You cannot decorate a class without a .call ... |
null | null | null | What does the code increase ?
| def _increase_indent():
global _INDENT
_INDENT += _INDENT_STEP
| null | null | null | the indentation level
| codeqa | def increase indent global INDENT INDENT + INDENT STEP
| null | null | null | null | Question:
What does the code increase ?
Code:
def _increase_indent():
global _INDENT
_INDENT += _INDENT_STEP
|
null | null | null | What defines a ?
| def FindWebServer(options, server_desc):
server_desc = (options.server or server_desc)
if (server_desc and (not isinstance(server_desc, unicode))):
server_desc = server_desc.decode('mbcs')
server = GetWebServer(server_desc)
return server.adsPath
| null | null | null | options
| codeqa | def Find Web Server options server desc server desc options server or server desc if server desc and not isinstance server desc unicode server desc server desc decode 'mbcs' server Get Web Server server desc return server ads Path
| null | null | null | null | Question:
What defines a ?
Code:
def FindWebServer(options, server_desc):
server_desc = (options.server or server_desc)
if (server_desc and (not isinstance(server_desc, unicode))):
server_desc = server_desc.decode('mbcs')
server = GetWebServer(server_desc)
return server.adsPath
|
null | null | null | What do options define ?
| def FindWebServer(options, server_desc):
server_desc = (options.server or server_desc)
if (server_desc and (not isinstance(server_desc, unicode))):
server_desc = server_desc.decode('mbcs')
server = GetWebServer(server_desc)
return server.adsPath
| null | null | null | a
| codeqa | def Find Web Server options server desc server desc options server or server desc if server desc and not isinstance server desc unicode server desc server desc decode 'mbcs' server Get Web Server server desc return server ads Path
| null | null | null | null | Question:
What do options define ?
Code:
def FindWebServer(options, server_desc):
server_desc = (options.server or server_desc)
if (server_desc and (not isinstance(server_desc, unicode))):
server_desc = server_desc.decode('mbcs')
server = GetWebServer(server_desc)
return server.adsPath
|
null | null | null | What does the code create ?
| def new():
root = None
if (env.var('a:0') != '0'):
root = env.var('a:1')
else:
default = env.var('g:pymode_rope_project_root')
if (not default):
default = env.var('getcwd()')
root = env.var(('input("Enter project root: ", "%s")' % default))
ropefolder = env.var('g:pymode_rope_ropefolder')
prj = proj... | null | null | null | a new project
| codeqa | def new root Noneif env var 'a 0' '0 ' root env var 'a 1' else default env var 'g pymode rope project root' if not default default env var 'getcwd ' root env var 'input " Enterprojectroot " "%s" ' % default ropefolder env var 'g pymode rope ropefolder' prj project Project projectroot root ropefolder ropefolder prj clos... | null | null | null | null | Question:
What does the code create ?
Code:
def new():
root = None
if (env.var('a:0') != '0'):
root = env.var('a:1')
else:
default = env.var('g:pymode_rope_project_root')
if (not default):
default = env.var('getcwd()')
root = env.var(('input("Enter project root: ", "%s")' % default))
ropefolder =... |
null | null | null | How do a path split into components ?
| def split(path, result=None):
if (result is None):
result = []
(head, tail) = os.path.split(path)
if (head == ''):
return ([tail] + result)
if (head == path):
return result
return split(head, ([tail] + result))
| null | null | null | in a platform - neutral way
| codeqa | def split path result None if result is None result [] head tail os path split path if head '' return [tail] + result if head path return resultreturn split head [tail] + result
| null | null | null | null | Question:
How do a path split into components ?
Code:
def split(path, result=None):
if (result is None):
result = []
(head, tail) = os.path.split(path)
if (head == ''):
return ([tail] + result)
if (head == path):
return result
return split(head, ([tail] + result))
|
null | null | null | What can we stop ?
| def isFinalResult(result):
sickrage.srCore.srLogger.debug((u"Checking if we should keep searching after we've found " + result.name))
show_obj = result.episodes[0].show
(any_qualities, best_qualities) = Quality.splitQuality(show_obj.quality)
if (best_qualities and (result.quality < max(best_qualities))):
... | null | null | null | searching for other ones
| codeqa | def is Final Result result sickrage sr Core sr Logger debug u" Checkingifweshouldkeepsearchingafterwe'vefound" + result name show obj result episodes[ 0 ] show any qualities best qualities Quality split Quality show obj quality if best qualities and result quality < max best qualities return Falseelif show obj is anime... | null | null | null | null | Question:
What can we stop ?
Code:
def isFinalResult(result):
sickrage.srCore.srLogger.debug((u"Checking if we should keep searching after we've found " + result.name))
show_obj = result.episodes[0].show
(any_qualities, best_qualities) = Quality.splitQuality(show_obj.quality)
if (best_qualities and (re... |
null | null | null | What does the code clean ?
| def metric_cleanup():
global conn
conn.close()
pass
| null | null | null | the metric module
| codeqa | def metric cleanup global connconn close pass
| null | null | null | null | Question:
What does the code clean ?
Code:
def metric_cleanup():
global conn
conn.close()
pass
|
null | null | null | What does the code stop ?
| @app.route('/<slug_candidate>/shutdown')
def shutdown(slug_candidate):
check_slug_candidate(slug_candidate, shutdown_slug)
force_shutdown()
return ''
| null | null | null | the flask web server
| codeqa | @app route '/<slug candidate>/shutdown' def shutdown slug candidate check slug candidate slug candidate shutdown slug force shutdown return ''
| null | null | null | null | Question:
What does the code stop ?
Code:
@app.route('/<slug_candidate>/shutdown')
def shutdown(slug_candidate):
check_slug_candidate(slug_candidate, shutdown_slug)
force_shutdown()
return ''
|
null | null | null | What did user specify ?
| def get_path(base_path, user_path):
if os.path.isabs(user_path):
return user_path
else:
return os.path.join(base_path, user_path)
| null | null | null | path
| codeqa | def get path base path user path if os path isabs user path return user pathelse return os path join base path user path
| null | null | null | null | Question:
What did user specify ?
Code:
def get_path(base_path, user_path):
if os.path.isabs(user_path):
return user_path
else:
return os.path.join(base_path, user_path)
|
null | null | null | What return the code run the exit code ?
| def unitTests():
try:
if (sys.version[0] == '3'):
out = check_output('PYTHONPATH=. py.test-3', shell=True)
else:
out = check_output('PYTHONPATH=. py.test', shell=True)
ret = 0
except Exception as e:
out = e.output
ret = e.returncode
print out.decode('utf-8')
return ret
| null | null | null | the code run
| codeqa | def unit Tests try if sys version[ 0 ] '3 ' out check output 'PYTHONPATH py test- 3 ' shell True else out check output 'PYTHONPATH py test' shell True ret 0except Exception as e out e outputret e returncodeprint out decode 'utf- 8 ' return ret
| null | null | null | null | Question:
What return the code run the exit code ?
Code:
def unitTests():
try:
if (sys.version[0] == '3'):
out = check_output('PYTHONPATH=. py.test-3', shell=True)
else:
out = check_output('PYTHONPATH=. py.test', shell=True)
ret = 0
except Exception as e:
out = e.output
ret = e.returncode
print... |
null | null | null | What does the code run return the exit code ?
| def unitTests():
try:
if (sys.version[0] == '3'):
out = check_output('PYTHONPATH=. py.test-3', shell=True)
else:
out = check_output('PYTHONPATH=. py.test', shell=True)
ret = 0
except Exception as e:
out = e.output
ret = e.returncode
print out.decode('utf-8')
return ret
| null | null | null | the code run
| codeqa | def unit Tests try if sys version[ 0 ] '3 ' out check output 'PYTHONPATH py test- 3 ' shell True else out check output 'PYTHONPATH py test' shell True ret 0except Exception as e out e outputret e returncodeprint out decode 'utf- 8 ' return ret
| null | null | null | null | Question:
What does the code run return the exit code ?
Code:
def unitTests():
try:
if (sys.version[0] == '3'):
out = check_output('PYTHONPATH=. py.test-3', shell=True)
else:
out = check_output('PYTHONPATH=. py.test', shell=True)
ret = 0
except Exception as e:
out = e.output
ret = e.returncode
... |
null | null | null | How did format encode ?
| def str2hex(str):
result = codecs.encode(str, 'hex')
return result
| null | null | null | hex
| codeqa | def str 2 hex str result codecs encode str 'hex' return result
| null | null | null | null | Question:
How did format encode ?
Code:
def str2hex(str):
result = codecs.encode(str, 'hex')
return result
|
null | null | null | What does the code convert to hex encoded format ?
| def str2hex(str):
result = codecs.encode(str, 'hex')
return result
| null | null | null | a string
| codeqa | def str 2 hex str result codecs encode str 'hex' return result
| null | null | null | null | Question:
What does the code convert to hex encoded format ?
Code:
def str2hex(str):
result = codecs.encode(str, 'hex')
return result
|
null | null | null | When do strings extract re - ?
| @task
@timed
def i18n_fastgenerate():
sh('i18n_tool generate')
| null | null | null | first
| codeqa | @task@timeddef i18 n fastgenerate sh 'i 18 n toolgenerate'
| null | null | null | null | Question:
When do strings extract re - ?
Code:
@task
@timed
def i18n_fastgenerate():
sh('i18n_tool generate')
|
null | null | null | What is specifying that it is being run in an interactive environment ?
| def set_interactive(interactive):
global _is_interactive
_is_interactive = interactive
| null | null | null | a script
| codeqa | def set interactive interactive global is interactive is interactive interactive
| null | null | null | null | Question:
What is specifying that it is being run in an interactive environment ?
Code:
def set_interactive(interactive):
global _is_interactive
_is_interactive = interactive
|
null | null | null | When may a line break occur ?
| def _CanBreakBefore(prev_token, cur_token):
pval = prev_token.value
cval = cur_token.value
if py3compat.PY3:
if ((pval == 'yield') and (cval == 'from')):
return False
if ((pval in {'async', 'await'}) and (cval in {'def', 'with', 'for'})):
return False
if (cur_token.split_penalty >= split_penalty.UNBREAKAB... | null | null | null | before the current token
| codeqa | def Can Break Before prev token cur token pval prev token valuecval cur token valueif py 3 compat PY 3 if pval 'yield' and cval 'from' return Falseif pval in {'async' 'await'} and cval in {'def' 'with' 'for'} return Falseif cur token split penalty > split penalty UNBREAKABLE return Falseif pval '@' return Falseif cval ... | null | null | null | null | Question:
When may a line break occur ?
Code:
def _CanBreakBefore(prev_token, cur_token):
pval = prev_token.value
cval = cur_token.value
if py3compat.PY3:
if ((pval == 'yield') and (cval == 'from')):
return False
if ((pval in {'async', 'await'}) and (cval in {'def', 'with', 'for'})):
return False
if (... |
null | null | null | How do node n contain ?
| @not_implemented_for('directed')
def node_connected_component(G, n):
return set(_plain_bfs(G, n))
| null | null | null | graph
| codeqa | @not implemented for 'directed' def node connected component G n return set plain bfs G n
| null | null | null | null | Question:
How do node n contain ?
Code:
@not_implemented_for('directed')
def node_connected_component(G, n):
return set(_plain_bfs(G, n))
|
null | null | null | What does the code find ?
| def fitness_and_quality_parsed(mime_type, parsed_ranges):
best_fitness = (-1)
best_fit_q = 0
(target_type, target_subtype, target_params) = parse_media_range(mime_type)
for (type, subtype, params) in parsed_ranges:
type_match = ((type == target_type) or (type == '*') or (target_type == '*'))
subtype_match = ((s... | null | null | null | the best match for a mime - type amongst parsed media - ranges
| codeqa | def fitness and quality parsed mime type parsed ranges best fitness -1 best fit q 0 target type target subtype target params parse media range mime type for type subtype params in parsed ranges type match type target type or type '*' or target type '*' subtype match subtype target subtype or subtype '*' or target subty... | null | null | null | null | Question:
What does the code find ?
Code:
def fitness_and_quality_parsed(mime_type, parsed_ranges):
best_fitness = (-1)
best_fit_q = 0
(target_type, target_subtype, target_params) = parse_media_range(mime_type)
for (type, subtype, params) in parsed_ranges:
type_match = ((type == target_type) or (type == '*') ... |
null | null | null | Where do running containers pause ?
| def pause(path, service_names=None):
project = __load_project(path)
debug_ret = {}
result = {}
if isinstance(project, dict):
return project
else:
try:
project.pause(service_names)
if debug:
for container in project.containers():
if ((service_names is None) or (container.get('Name')[1:] in servic... | null | null | null | in the docker - compose file
| codeqa | def pause path service names None project load project path debug ret {}result {}if isinstance project dict return projectelse try project pause service names if debug for container in project containers if service names is None or container get ' Name' [1 ] in service names container inspect if not inspected debug ret... | null | null | null | null | Question:
Where do running containers pause ?
Code:
def pause(path, service_names=None):
project = __load_project(path)
debug_ret = {}
result = {}
if isinstance(project, dict):
return project
else:
try:
project.pause(service_names)
if debug:
for container in project.containers():
if ((servic... |
null | null | null | What pauses in the docker - compose file ?
| def pause(path, service_names=None):
project = __load_project(path)
debug_ret = {}
result = {}
if isinstance(project, dict):
return project
else:
try:
project.pause(service_names)
if debug:
for container in project.containers():
if ((service_names is None) or (container.get('Name')[1:] in servic... | null | null | null | running containers
| codeqa | def pause path service names None project load project path debug ret {}result {}if isinstance project dict return projectelse try project pause service names if debug for container in project containers if service names is None or container get ' Name' [1 ] in service names container inspect if not inspected debug ret... | null | null | null | null | Question:
What pauses in the docker - compose file ?
Code:
def pause(path, service_names=None):
project = __load_project(path)
debug_ret = {}
result = {}
if isinstance(project, dict):
return project
else:
try:
project.pause(service_names)
if debug:
for container in project.containers():
if (... |
null | null | null | What does the code run ?
| def catch_errors(application, environ, start_response, error_callback, ok_callback=None):
try:
app_iter = application(environ, start_response)
except:
error_callback(sys.exc_info())
raise
if (type(app_iter) in (list, tuple)):
if ok_callback:
ok_callback()
return app_iter
else:
return _wrap_app_iter(a... | null | null | null | the application
| codeqa | def catch errors application environ start response error callback ok callback None try app iter application environ start response except error callback sys exc info raiseif type app iter in list tuple if ok callback ok callback return app iterelse return wrap app iter app iter error callback ok callback
| null | null | null | null | Question:
What does the code run ?
Code:
def catch_errors(application, environ, start_response, error_callback, ok_callback=None):
try:
app_iter = application(environ, start_response)
except:
error_callback(sys.exc_info())
raise
if (type(app_iter) in (list, tuple)):
if ok_callback:
ok_callback()
ret... |
null | null | null | What does the code delete ?
| def job_delete_by_id(job_id):
Job.objects.get(pk=job_id).delete()
return (job_get_by_id(job_id) is None)
| null | null | null | a job entry based on its tag
| codeqa | def job delete by id job id Job objects get pk job id delete return job get by id job id is None
| null | null | null | null | Question:
What does the code delete ?
Code:
def job_delete_by_id(job_id):
Job.objects.get(pk=job_id).delete()
return (job_get_by_id(job_id) is None)
|
null | null | null | What does the code get ?
| def getNewDerivation(elementNode):
return SquareDerivation(elementNode)
| null | null | null | new derivation
| codeqa | def get New Derivation element Node return Square Derivation element Node
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewDerivation(elementNode):
return SquareDerivation(elementNode)
|
null | null | null | How does the code write the state dictionary out ?
| def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
| null | null | null | to disk
| codeqa | def save state state try with open config['statefile'] as filename 'w' as f pickle dump state f except IO Error as exc log error u'statefilecouldnotbewritten {0 }' format exc
| null | null | null | null | Question:
How does the code write the state dictionary out ?
Code:
def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
|
null | null | null | In which direction does the code write the state dictionary to disk ?
| def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
| null | null | null | out
| codeqa | def save state state try with open config['statefile'] as filename 'w' as f pickle dump state f except IO Error as exc log error u'statefilecouldnotbewritten {0 }' format exc
| null | null | null | null | Question:
In which direction does the code write the state dictionary to disk ?
Code:
def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
|
null | null | null | What does the code write out to disk ?
| def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
| null | null | null | the state dictionary
| codeqa | def save state state try with open config['statefile'] as filename 'w' as f pickle dump state f except IO Error as exc log error u'statefilecouldnotbewritten {0 }' format exc
| null | null | null | null | Question:
What does the code write out to disk ?
Code:
def _save_state(state):
try:
with open(config['statefile'].as_filename(), 'w') as f:
pickle.dump(state, f)
except IOError as exc:
log.error(u'state file could not be written: {0}'.format(exc))
|
null | null | null | What did the code rename ?
| def move(path, dest, replace=False):
if samefile(path, dest):
return
path = syspath(path)
dest = syspath(dest)
if (os.path.exists(dest) and (not replace)):
raise FilesystemError(u'file exists', 'rename', (path, dest))
try:
os.rename(path, dest)
except OSError:
try:
shutil.copyfile(path, dest)
os.re... | null | null | null | a file
| codeqa | def move path dest replace False if samefile path dest returnpath syspath path dest syspath dest if os path exists dest and not replace raise Filesystem Error u'fileexists' 'rename' path dest try os rename path dest except OS Error try shutil copyfile path dest os remove path except OS Error IO Error as exc raise Files... | null | null | null | null | Question:
What did the code rename ?
Code:
def move(path, dest, replace=False):
if samefile(path, dest):
return
path = syspath(path)
dest = syspath(dest)
if (os.path.exists(dest) and (not replace)):
raise FilesystemError(u'file exists', 'rename', (path, dest))
try:
os.rename(path, dest)
except OSError:... |
null | null | null | How do a and b have the same lowercase representation ?
| def equalsIgnoreCase(a, b):
return ((a == b) or (string.lower(a) == string.lower(b)))
| null | null | null | iff
| codeqa | def equals Ignore Case a b return a b or string lower a string lower b
| null | null | null | null | Question:
How do a and b have the same lowercase representation ?
Code:
def equalsIgnoreCase(a, b):
return ((a == b) or (string.lower(a) == string.lower(b)))
|
null | null | null | What computes in a weighted graph ?
| def all_pairs_bellman_ford_path(G, cutoff=None, weight='weight'):
path = single_source_bellman_ford_path
return {n: path(G, n, cutoff=cutoff, weight=weight) for n in G}
| null | null | null | shortest paths between all nodes
| codeqa | def all pairs bellman ford path G cutoff None weight 'weight' path single source bellman ford pathreturn {n path G n cutoff cutoff weight weight for n in G}
| null | null | null | null | Question:
What computes in a weighted graph ?
Code:
def all_pairs_bellman_ford_path(G, cutoff=None, weight='weight'):
path = single_source_bellman_ford_path
return {n: path(G, n, cutoff=cutoff, weight=weight) for n in G}
|
null | null | null | For what purpose did files need ?
| def remove_gulp_files():
for filename in ['gulpfile.js']:
os.remove(os.path.join(PROJECT_DIRECTORY, filename))
| null | null | null | for grunt
| codeqa | def remove gulp files for filename in ['gulpfile js'] os remove os path join PROJECT DIRECTORY filename
| null | null | null | null | Question:
For what purpose did files need ?
Code:
def remove_gulp_files():
for filename in ['gulpfile.js']:
os.remove(os.path.join(PROJECT_DIRECTORY, filename))
|
null | null | null | How do spectral norm of a complex matrix estimate ?
| def idz_snorm(m, n, matveca, matvec, its=20):
(snorm, v) = _id.idz_snorm(m, n, matveca, matvec, its)
return snorm
| null | null | null | by the randomized power method
| codeqa | def idz snorm m n matveca matvec its 20 snorm v id idz snorm m n matveca matvec its return snorm
| null | null | null | null | Question:
How do spectral norm of a complex matrix estimate ?
Code:
def idz_snorm(m, n, matveca, matvec, its=20):
(snorm, v) = _id.idz_snorm(m, n, matveca, matvec, its)
return snorm
|
null | null | null | What does the code get ?
| def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
if (len(loop) < 3):
return [loop]
derivation = RoundDerivation(elementNode, prefix, sideLength)
if (derivation.radius == 0.0):
return loop
roundLoop = []
sidesPerRadian = ((0.5 / math.pi) * evaluate.getSidesMinimumThreeBasedOnPrecision(elem... | null | null | null | round loop
| codeqa | def get Manipulated Paths close element Node loop prefix side Length if len loop < 3 return [loop]derivation Round Derivation element Node prefix side Length if derivation radius 0 0 return loopround Loop []sides Per Radian 0 5 / math pi * evaluate get Sides Minimum Three Based On Precision element Node side Length for... | null | null | null | null | Question:
What does the code get ?
Code:
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
if (len(loop) < 3):
return [loop]
derivation = RoundDerivation(elementNode, prefix, sideLength)
if (derivation.radius == 0.0):
return loop
roundLoop = []
sidesPerRadian = ((0.5 / math.pi) * evalu... |
null | null | null | What does the code raise ?
| def exception(message='Test Exception'):
raise Exception(message)
| null | null | null | an exception
| codeqa | def exception message ' Test Exception' raise Exception message
| null | null | null | null | Question:
What does the code raise ?
Code:
def exception(message='Test Exception'):
raise Exception(message)
|
null | null | null | What does the code output optionally ?
| def exception(message='Test Exception'):
raise Exception(message)
| null | null | null | the full stack
| codeqa | def exception message ' Test Exception' raise Exception message
| null | null | null | null | Question:
What does the code output optionally ?
Code:
def exception(message='Test Exception'):
raise Exception(message)
|
null | null | null | What does the code provide optionally ?
| def exception(message='Test Exception'):
raise Exception(message)
| null | null | null | an error message
| codeqa | def exception message ' Test Exception' raise Exception message
| null | null | null | null | Question:
What does the code provide optionally ?
Code:
def exception(message='Test Exception'):
raise Exception(message)
|
null | null | null | What does the code save into the file given by the filename ?
| def saveMeshes(filename, objects):
ext = os.path.splitext(filename)[1].lower()
if (ext == '.stl'):
stl.saveScene(filename, objects)
return
if (ext == '.amf'):
amf.saveScene(filename, objects)
return
print ('Error: Unknown model extension: %s' % ext)
| null | null | null | a list of objects
| codeqa | def save Meshes filename objects ext os path splitext filename [1 ] lower if ext ' stl' stl save Scene filename objects returnif ext ' amf' amf save Scene filename objects returnprint ' Error Unknownmodelextension %s' % ext
| null | null | null | null | Question:
What does the code save into the file given by the filename ?
Code:
def saveMeshes(filename, objects):
ext = os.path.splitext(filename)[1].lower()
if (ext == '.stl'):
stl.saveScene(filename, objects)
return
if (ext == '.amf'):
amf.saveScene(filename, objects)
return
print ('Error: Unknown mo... |
null | null | null | What does the code determine ?
| def get_default_project():
result = check_run_quick('gcloud config list', echo=False)
return re.search('project = (.*)\n', result.stdout).group(1)
| null | null | null | the default project name
| codeqa | def get default project result check run quick 'gcloudconfiglist' echo False return re search 'project * \n' result stdout group 1
| null | null | null | null | Question:
What does the code determine ?
Code:
def get_default_project():
result = check_run_quick('gcloud config list', echo=False)
return re.search('project = (.*)\n', result.stdout).group(1)
|
null | null | null | What detects in the file located in google cloud storage ?
| def syntax_file(gcs_uri):
language_client = language.Client()
document = language_client.document_from_url(gcs_uri)
tokens = document.analyze_syntax()
for token in tokens:
print '{}: {}'.format(token.part_of_speech, token.text_content)
| null | null | null | syntax
| codeqa | def syntax file gcs uri language client language Client document language client document from url gcs uri tokens document analyze syntax for token in tokens print '{} {}' format token part of speech token text content
| null | null | null | null | Question:
What detects in the file located in google cloud storage ?
Code:
def syntax_file(gcs_uri):
language_client = language.Client()
document = language_client.document_from_url(gcs_uri)
tokens = document.analyze_syntax()
for token in tokens:
print '{}: {}'.format(token.part_of_speech, token.text_content... |
null | null | null | Where does syntax detect ?
| def syntax_file(gcs_uri):
language_client = language.Client()
document = language_client.document_from_url(gcs_uri)
tokens = document.analyze_syntax()
for token in tokens:
print '{}: {}'.format(token.part_of_speech, token.text_content)
| null | null | null | in the file located in google cloud storage
| codeqa | def syntax file gcs uri language client language Client document language client document from url gcs uri tokens document analyze syntax for token in tokens print '{} {}' format token part of speech token text content
| null | null | null | null | Question:
Where does syntax detect ?
Code:
def syntax_file(gcs_uri):
language_client = language.Client()
document = language_client.document_from_url(gcs_uri)
tokens = document.analyze_syntax()
for token in tokens:
print '{}: {}'.format(token.part_of_speech, token.text_content)
|
null | null | null | How do that commit ?
| def autocommit(using=None):
warnings.warn('autocommit is deprecated in favor of set_autocommit.', PendingDeprecationWarning, stacklevel=2)
def entering(using):
enter_transaction_management(managed=False, using=using)
def exiting(exc_type, using):
leave_transaction_management(using=using)
return _transacti... | null | null | null | on save
| codeqa | def autocommit using None warnings warn 'autocommitisdeprecatedinfavorofset autocommit ' Pending Deprecation Warning stacklevel 2 def entering using enter transaction management managed False using using def exiting exc type using leave transaction management using using return transaction func entering exiting using
| null | null | null | null | Question:
How do that commit ?
Code:
def autocommit(using=None):
warnings.warn('autocommit is deprecated in favor of set_autocommit.', PendingDeprecationWarning, stacklevel=2)
def entering(using):
enter_transaction_management(managed=False, using=using)
def exiting(exc_type, using):
leave_transaction_m... |
null | null | null | How do art embed into imported albums ?
| @EmbedCoverArtPlugin.listen('album_imported')
def album_imported(lib, album):
if (album.artpath and config['embedart']['auto']):
embed_album(album, config['embedart']['maxwidth'].get(int), True)
| null | null | null | automatically
| codeqa | @ Embed Cover Art Plugin listen 'album imported' def album imported lib album if album artpath and config['embedart']['auto'] embed album album config['embedart']['maxwidth'] get int True
| null | null | null | null | Question:
How do art embed into imported albums ?
Code:
@EmbedCoverArtPlugin.listen('album_imported')
def album_imported(lib, album):
if (album.artpath and config['embedart']['auto']):
embed_album(album, config['embedart']['maxwidth'].get(int), True)
|
null | null | null | What does the code get from a package ?
| def get_data(package, resource):
loader = get_loader(package)
if ((loader is None) or (not hasattr(loader, 'get_data'))):
return None
mod = (sys.modules.get(package) or loader.load_module(package))
if ((mod is None) or (not hasattr(mod, '__file__'))):
return None
parts = resource.split('/')
parts.insert(0, os... | null | null | null | a resource
| codeqa | def get data package resource loader get loader package if loader is None or not hasattr loader 'get data' return Nonemod sys modules get package or loader load module package if mod is None or not hasattr mod ' file ' return Noneparts resource split '/' parts insert 0 os path dirname mod file resource name os path joi... | null | null | null | null | Question:
What does the code get from a package ?
Code:
def get_data(package, resource):
loader = get_loader(package)
if ((loader is None) or (not hasattr(loader, 'get_data'))):
return None
mod = (sys.modules.get(package) or loader.load_module(package))
if ((mod is None) or (not hasattr(mod, '__file__'))):
... |
null | null | null | How did random string generate ?
| def get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
if (not using_sysrandom):
random.seed(hashlib.sha256(('%s%s%s' % (random.getstate(), time.time(), settings.SECRET_KEY))).digest())
return ''.join([random.choice(allowed_chars) for i in range(length)])
| null | null | null | securely
| codeqa | def get random string length 12 allowed chars 'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 ' if not using sysrandom random seed hashlib sha 256 '%s%s%s' % random getstate time time settings SECRET KEY digest return '' join [random choice allowed chars for i in range length ]
| null | null | null | null | Question:
How did random string generate ?
Code:
def get_random_string(length=12, allowed_chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'):
if (not using_sysrandom):
random.seed(hashlib.sha256(('%s%s%s' % (random.getstate(), time.time(), settings.SECRET_KEY))).digest())
return ''.join([ra... |
null | null | null | What did the code give ?
| def _salt_cipher_secret(secret):
salt = _get_new_csrf_string()
chars = CSRF_ALLOWED_CHARS
pairs = zip((chars.index(x) for x in secret), (chars.index(x) for x in salt))
cipher = ''.join((chars[((x + y) % len(chars))] for (x, y) in pairs))
return (salt + cipher)
| null | null | null | a secret
| codeqa | def salt cipher secret secret salt get new csrf string chars CSRF ALLOWED CHAR Spairs zip chars index x for x in secret chars index x for x in salt cipher '' join chars[ x + y % len chars ] for x y in pairs return salt + cipher
| null | null | null | null | Question:
What did the code give ?
Code:
def _salt_cipher_secret(secret):
salt = _get_new_csrf_string()
chars = CSRF_ALLOWED_CHARS
pairs = zip((chars.index(x) for x in secret), (chars.index(x) for x in salt))
cipher = ''.join((chars[((x + y) % len(chars))] for (x, y) in pairs))
return (salt + cipher)
|
null | null | null | What did the code deprecate to ?
| @deprecated.Callable(deprecation=u'4.0', removal=u'5.0', alternative=u'Please use celery.app.backends.by_url')
def get_backend_by_url(backend=None, loader=None):
return _backends.by_url(backend=backend, loader=loader)
| null | null | null | alias
| codeqa | @deprecated Callable deprecation u' 4 0' removal u' 5 0' alternative u' Pleaseusecelery app backends by url' def get backend by url backend None loader None return backends by url backend backend loader loader
| null | null | null | null | Question:
What did the code deprecate to ?
Code:
@deprecated.Callable(deprecation=u'4.0', removal=u'5.0', alternative=u'Please use celery.app.backends.by_url')
def get_backend_by_url(backend=None, loader=None):
return _backends.by_url(backend=backend, loader=loader)
|
null | null | null | What does the code get from derivation ?
| def getGeometryOutputByNegativesPositives(derivation, negatives, positives, xmlElement):
positiveOutput = trianglemesh.getUnifiedOutput(positives)
if (len(negatives) < 1):
return solid.getGeometryOutputByManipulation(positiveOutput, xmlElement)
return solid.getGeometryOutputByManipulation({'difference': {'shapes':... | null | null | null | triangle mesh
| codeqa | def get Geometry Output By Negatives Positives derivation negatives positives xml Element positive Output trianglemesh get Unified Output positives if len negatives < 1 return solid get Geometry Output By Manipulation positive Output xml Element return solid get Geometry Output By Manipulation {'difference' {'shapes' [... | null | null | null | null | Question:
What does the code get from derivation ?
Code:
def getGeometryOutputByNegativesPositives(derivation, negatives, positives, xmlElement):
positiveOutput = trianglemesh.getUnifiedOutput(positives)
if (len(negatives) < 1):
return solid.getGeometryOutputByManipulation(positiveOutput, xmlElement)
return so... |
null | null | null | For what purpose did the composite index definition need ?
| def IndexXmlForQuery(kind, ancestor, props):
xml = []
xml.append(('<datastore-index kind="%s" ancestor="%s">' % (kind, ('true' if ancestor else 'false'))))
for (name, direction) in props:
xml.append((' <property name="%s" direction="%s" />' % (name, ('asc' if (direction == ASCENDING) else 'desc'))))
xml.ap... | null | null | null | for a query
| codeqa | def Index Xml For Query kind ancestor props xml []xml append '<datastore-indexkind "%s"ancestor "%s">' % kind 'true' if ancestor else 'false' for name direction in props xml append '<propertyname "%s"direction "%s"/>' % name 'asc' if direction ASCENDING else 'desc' xml append '</datastore-index>' return '\n' join xml
| null | null | null | null | Question:
For what purpose did the composite index definition need ?
Code:
def IndexXmlForQuery(kind, ancestor, props):
xml = []
xml.append(('<datastore-index kind="%s" ancestor="%s">' % (kind, ('true' if ancestor else 'false'))))
for (name, direction) in props:
xml.append((' <property name="%s" directio... |
null | null | null | What does the code insert ?
| def simplefilter(action, category=Warning, lineno=0, append=0):
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert (isinstance(lineno, int) and (lineno >= 0)), 'lineno must be an int >= 0'
item = (action, None, category, None, lineno)
if ... | null | null | null | a simple entry into the list of warnings filters
| codeqa | def simplefilter action category Warning lineno 0 append 0 assert action in 'error' 'ignore' 'always' 'default' 'module' 'once' 'invalidaction %r' % action assert isinstance lineno int and lineno > 0 'linenomustbeanint> 0'item action None category None lineno if append filters append item else filters insert 0 item
| null | null | null | null | Question:
What does the code insert ?
Code:
def simplefilter(action, category=Warning, lineno=0, append=0):
assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
assert (isinstance(lineno, int) and (lineno >= 0)), 'lineno must be an int >= 0'
it... |
null | null | null | What does the code update ?
| @route(bp, '/<product_id>', methods=['PUT'])
def update(product_id):
form = UpdateProductForm()
if form.validate_on_submit():
return products.update(products.get_or_404(product_id), **request.json)
raise OverholtFormError(form.errors)
| null | null | null | a product
| codeqa | @route bp '/<product id>' methods ['PUT'] def update product id form Update Product Form if form validate on submit return products update products get or 404 product id **request json raise Overholt Form Error form errors
| null | null | null | null | Question:
What does the code update ?
Code:
@route(bp, '/<product_id>', methods=['PUT'])
def update(product_id):
form = UpdateProductForm()
if form.validate_on_submit():
return products.update(products.get_or_404(product_id), **request.json)
raise OverholtFormError(form.errors)
|
null | null | null | What does the code replace with ?
| def fix_eols(s):
s = re.sub('(?<!\\r)\\n', CRLF, s)
s = re.sub('\\r(?!\\n)', CRLF, s)
return s
| null | null | null | all line - ending characters
| codeqa | def fix eols s s re sub ' ?< \\r \\n' CRLF s s re sub '\\r ? \\n ' CRLF s return s
| null | null | null | null | Question:
What does the code replace with ?
Code:
def fix_eols(s):
s = re.sub('(?<!\\r)\\n', CRLF, s)
s = re.sub('\\r(?!\\n)', CRLF, s)
return s
|
null | null | null | How does a getter property return ?
| def optionalcascade(cont_attr, item_attr, doc=''):
def getter(self):
if self._items:
return getattr(self[0], item_attr)
else:
return getattr(self, cont_attr)
def setter(self, value):
setattr(self, cont_attr, value)
for item in self:
setattr(item, item_attr, value)
return property(fget=getter, fset=s... | null | null | null | with a cascading setter
| codeqa | def optionalcascade cont attr item attr doc '' def getter self if self items return getattr self[ 0 ] item attr else return getattr self cont attr def setter self value setattr self cont attr value for item in self setattr item item attr value return property fget getter fset setter doc doc
| null | null | null | null | Question:
How does a getter property return ?
Code:
def optionalcascade(cont_attr, item_attr, doc=''):
def getter(self):
if self._items:
return getattr(self[0], item_attr)
else:
return getattr(self, cont_attr)
def setter(self, value):
setattr(self, cont_attr, value)
for item in self:
setattr(item... |
null | null | null | What does the code calculate ?
| def image_entropy(im):
if (not isinstance(im, Image.Image)):
return 0
hist = im.histogram()
hist_size = float(sum(hist))
hist = [(h / hist_size) for h in hist]
return (- sum([(p * math.log(p, 2)) for p in hist if (p != 0)]))
| null | null | null | the entropy of an image
| codeqa | def image entropy im if not isinstance im Image Image return 0hist im histogram hist size float sum hist hist [ h / hist size for h in hist]return - sum [ p * math log p 2 for p in hist if p 0 ]
| null | null | null | null | Question:
What does the code calculate ?
Code:
def image_entropy(im):
if (not isinstance(im, Image.Image)):
return 0
hist = im.histogram()
hist_size = float(sum(hist))
hist = [(h / hist_size) for h in hist]
return (- sum([(p * math.log(p, 2)) for p in hist if (p != 0)]))
|
null | null | null | What does the code compute from an essential matrix ?
| def compute_P_from_essential(E):
(U, S, V) = svd(E)
if (det(dot(U, V)) < 0):
V = (- V)
E = dot(U, dot(diag([1, 1, 0]), V))
Z = skew([0, 0, (-1)])
W = array([[0, (-1), 0], [1, 0, 0], [0, 0, 1]])
P2 = [vstack((dot(U, dot(W, V)).T, U[:, 2])).T, vstack((dot(U, dot(W, V)).T, (- U[:, 2]))).T, vstack((dot(U, dot(W.T, ... | null | null | null | the second camera matrix
| codeqa | def compute P from essential E U S V svd E if det dot U V < 0 V - V E dot U dot diag [1 1 0] V Z skew [0 0 -1 ] W array [[ 0 -1 0] [1 0 0] [0 0 1]] P2 [vstack dot U dot W V T U[ 2] T vstack dot U dot W V T - U[ 2] T vstack dot U dot W T V T U[ 2] T vstack dot U dot W T V T - U[ 2] T]return P2
| null | null | null | null | Question:
What does the code compute from an essential matrix ?
Code:
def compute_P_from_essential(E):
(U, S, V) = svd(E)
if (det(dot(U, V)) < 0):
V = (- V)
E = dot(U, dot(diag([1, 1, 0]), V))
Z = skew([0, 0, (-1)])
W = array([[0, (-1), 0], [1, 0, 0], [0, 0, 1]])
P2 = [vstack((dot(U, dot(W, V)).T, U[:, 2]))... |
null | null | null | What did the code set ?
| def set_chassis_location(location, host=None, admin_username=None, admin_password=None):
return __execute_cmd('setsysinfo -c chassislocation {0}'.format(location), host=host, admin_username=admin_username, admin_password=admin_password)
| null | null | null | the location of the chassis
| codeqa | def set chassis location location host None admin username None admin password None return execute cmd 'setsysinfo-cchassislocation{ 0 }' format location host host admin username admin username admin password admin password
| null | null | null | null | Question:
What did the code set ?
Code:
def set_chassis_location(location, host=None, admin_username=None, admin_password=None):
return __execute_cmd('setsysinfo -c chassislocation {0}'.format(location), host=host, admin_username=admin_username, admin_password=admin_password)
|
null | null | null | What does the code load from disk ?
| def get_template(template_name, scope=u'task'):
if (not template_name.endswith(u'.template')):
template_name += u'.template'
locations = []
if scope:
locations.append(((scope + u'/') + template_name))
locations.append(template_name)
for location in locations:
try:
return environment.get_template(location)... | null | null | null | a template
| codeqa | def get template template name scope u'task' if not template name endswith u' template' template name + u' template'locations []if scope locations append scope + u'/' + template name locations append template name for location in locations try return environment get template location except Template Not Found passelse ... | null | null | null | null | Question:
What does the code load from disk ?
Code:
def get_template(template_name, scope=u'task'):
if (not template_name.endswith(u'.template')):
template_name += u'.template'
locations = []
if scope:
locations.append(((scope + u'/') + template_name))
locations.append(template_name)
for location in locati... |
null | null | null | What does the code do ?
| def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, subprocess=True, sys=False, aggressive=True, Event=False, builtins=True, signal=True):
(_warnings, first_time) = _check_repatching(**locals())
if ((not _warnings) and (not first_time)):
return
if os:
patch... | null | null | null | all of the default monkey patching
| codeqa | def patch all socket True dns True time True select True thread True os True ssl True httplib False subprocess True sys False aggressive True Event False builtins True signal True warnings first time check repatching **locals if not warnings and not first time returnif os patch os if time patch time if thread patch thr... | null | null | null | null | Question:
What does the code do ?
Code:
def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False, subprocess=True, sys=False, aggressive=True, Event=False, builtins=True, signal=True):
(_warnings, first_time) = _check_repatching(**locals())
if ((not _warnings) and... |
null | null | null | What does the code get from every point on a path and between points ?
| def getPointsFromPath(path, radius, thresholdRatio=0.9):
if (len(path) < 1):
return []
if (len(path) < 2):
return path
radius = abs(radius)
points = []
addHalfPath(path, points, radius, thresholdRatio)
addHalfPath(path[::(-1)], points, radius, thresholdRatio)
return points
| null | null | null | the points
| codeqa | def get Points From Path path radius threshold Ratio 0 9 if len path < 1 return []if len path < 2 return pathradius abs radius points []add Half Path path points radius threshold Ratio add Half Path path[ -1 ] points radius threshold Ratio return points
| null | null | null | null | Question:
What does the code get from every point on a path and between points ?
Code:
def getPointsFromPath(path, radius, thresholdRatio=0.9):
if (len(path) < 1):
return []
if (len(path) < 2):
return path
radius = abs(radius)
points = []
addHalfPath(path, points, radius, thresholdRatio)
addHalfPath(path[... |
null | null | null | What does the code get ?
| def _buildArgs(f, self=None, kwargs={}):
argTuples = getArgumentDescriptions(f)
argTuples = argTuples[1:]
init = TPRegion.__init__
ourArgNames = [t[0] for t in getArgumentDescriptions(init)]
ourArgNames += ['numberOfCols']
for argTuple in argTuples[:]:
if (argTuple[0] in ourArgNames):
argTuples.remove(argTup... | null | null | null | the default arguments from the function
| codeqa | def build Args f self None kwargs {} arg Tuples get Argument Descriptions f arg Tuples arg Tuples[ 1 ]init TP Region init our Arg Names [t[ 0 ] for t in get Argument Descriptions init ]our Arg Names + ['number Of Cols']for arg Tuple in arg Tuples[ ] if arg Tuple[ 0 ] in our Arg Names arg Tuples remove arg Tuple if self... | null | null | null | null | Question:
What does the code get ?
Code:
def _buildArgs(f, self=None, kwargs={}):
argTuples = getArgumentDescriptions(f)
argTuples = argTuples[1:]
init = TPRegion.__init__
ourArgNames = [t[0] for t in getArgumentDescriptions(init)]
ourArgNames += ['numberOfCols']
for argTuple in argTuples[:]:
if (argTuple[0... |
null | null | null | What does the code remove from conference ?
| def remove_users_in_conference(id, user, users):
if (checking_conference(id) and is_owner_user(id, user)):
conferences = get_memcached(get_key('conferences'))
for val in users:
del conferences[id]['users'][val]
set_memcached(get_key('conferences'), conferences)
return get_new_message_for_user(user)
| null | null | null | users
| codeqa | def remove users in conference id user users if checking conference id and is owner user id user conferences get memcached get key 'conferences' for val in users del conferences[id]['users'][val]set memcached get key 'conferences' conferences return get new message for user user
| null | null | null | null | Question:
What does the code remove from conference ?
Code:
def remove_users_in_conference(id, user, users):
if (checking_conference(id) and is_owner_user(id, user)):
conferences = get_memcached(get_key('conferences'))
for val in users:
del conferences[id]['users'][val]
set_memcached(get_key('conferences'... |
null | null | null | What do model convert ?
| def to_dict(model_instance, dictionary=None):
if (dictionary is None):
dictionary = {}
model_instance._to_entity(dictionary)
return dictionary
| null | null | null | to dictionary
| codeqa | def to dict model instance dictionary None if dictionary is None dictionary {}model instance to entity dictionary return dictionary
| null | null | null | null | Question:
What do model convert ?
Code:
def to_dict(model_instance, dictionary=None):
if (dictionary is None):
dictionary = {}
model_instance._to_entity(dictionary)
return dictionary
|
null | null | null | What converts to dictionary ?
| def to_dict(model_instance, dictionary=None):
if (dictionary is None):
dictionary = {}
model_instance._to_entity(dictionary)
return dictionary
| null | null | null | model
| codeqa | def to dict model instance dictionary None if dictionary is None dictionary {}model instance to entity dictionary return dictionary
| null | null | null | null | Question:
What converts to dictionary ?
Code:
def to_dict(model_instance, dictionary=None):
if (dictionary is None):
dictionary = {}
model_instance._to_entity(dictionary)
return dictionary
|
null | null | null | What does the code clear from the requestor ?
| def _clear_user_info_cookie(cookie_name=_COOKIE_NAME):
cookie = Cookie.SimpleCookie()
cookie[cookie_name] = ''
cookie[cookie_name]['path'] = '/'
cookie[cookie_name]['max-age'] = '0'
if AppDashboardHelper.USE_SHIBBOLETH:
cookie[cookie_name]['domain'] = AppDashboardHelper.SHIBBOLETH_COOKIE_DOMAIN
return cookie[co... | null | null | null | the user info cookie
| codeqa | def clear user info cookie cookie name COOKIE NAME cookie Cookie Simple Cookie cookie[cookie name] ''cookie[cookie name]['path'] '/'cookie[cookie name]['max-age'] '0 'if App Dashboard Helper USE SHIBBOLETH cookie[cookie name]['domain'] App Dashboard Helper SHIBBOLETH COOKIE DOMAI Nreturn cookie[cookie name] Output Stri... | null | null | null | null | Question:
What does the code clear from the requestor ?
Code:
def _clear_user_info_cookie(cookie_name=_COOKIE_NAME):
cookie = Cookie.SimpleCookie()
cookie[cookie_name] = ''
cookie[cookie_name]['path'] = '/'
cookie[cookie_name]['max-age'] = '0'
if AppDashboardHelper.USE_SHIBBOLETH:
cookie[cookie_name]['domain... |
null | null | null | How do a long string print ?
| def _pretty_longstring(defstr, prefix=u'', wrap_at=65):
outstr = u''
for line in textwrap.fill(defstr, wrap_at).split(u'\n'):
outstr += ((prefix + line) + u'\n')
return outstr
| null | null | null | pretty
| codeqa | def pretty longstring defstr prefix u'' wrap at 65 outstr u''for line in textwrap fill defstr wrap at split u'\n' outstr + prefix + line + u'\n' return outstr
| null | null | null | null | Question:
How do a long string print ?
Code:
def _pretty_longstring(defstr, prefix=u'', wrap_at=65):
outstr = u''
for line in textwrap.fill(defstr, wrap_at).split(u'\n'):
outstr += ((prefix + line) + u'\n')
return outstr
|
null | null | null | What does the code decode ?
| def bz2_decode(input, errors='strict'):
assert (errors == 'strict')
output = bz2.decompress(input)
return (output, len(input))
| null | null | null | the object input
| codeqa | def bz 2 decode input errors 'strict' assert errors 'strict' output bz 2 decompress input return output len input
| null | null | null | null | Question:
What does the code decode ?
Code:
def bz2_decode(input, errors='strict'):
assert (errors == 'strict')
output = bz2.decompress(input)
return (output, len(input))
|
null | null | null | What does the code return ?
| def bz2_decode(input, errors='strict'):
assert (errors == 'strict')
output = bz2.decompress(input)
return (output, len(input))
| null | null | null | a tuple
| codeqa | def bz 2 decode input errors 'strict' assert errors 'strict' output bz 2 decompress input return output len input
| null | null | null | null | Question:
What does the code return ?
Code:
def bz2_decode(input, errors='strict'):
assert (errors == 'strict')
output = bz2.decompress(input)
return (output, len(input))
|
null | null | null | What does the code get ?
| def get_disk_backing_file(path, basename=True):
backing_file = images.qemu_img_info(path).backing_file
if (backing_file and basename):
backing_file = os.path.basename(backing_file)
return backing_file
| null | null | null | the backing file of a disk image
| codeqa | def get disk backing file path basename True backing file images qemu img info path backing fileif backing file and basename backing file os path basename backing file return backing file
| null | null | null | null | Question:
What does the code get ?
Code:
def get_disk_backing_file(path, basename=True):
backing_file = images.qemu_img_info(path).backing_file
if (backing_file and basename):
backing_file = os.path.basename(backing_file)
return backing_file
|
null | null | null | What contains one paragraph only ?
| def _is_only_paragraph(node):
if (len(node) == 0):
return False
elif (len(node) > 1):
for subnode in node[1:]:
if (not isinstance(subnode, nodes.system_message)):
return False
if isinstance(node[0], nodes.paragraph):
return True
return False
| null | null | null | the node
| codeqa | def is only paragraph node if len node 0 return Falseelif len node > 1 for subnode in node[ 1 ] if not isinstance subnode nodes system message return Falseif isinstance node[ 0 ] nodes paragraph return Truereturn False
| null | null | null | null | Question:
What contains one paragraph only ?
Code:
def _is_only_paragraph(node):
if (len(node) == 0):
return False
elif (len(node) > 1):
for subnode in node[1:]:
if (not isinstance(subnode, nodes.system_message)):
return False
if isinstance(node[0], nodes.paragraph):
return True
return False
|
null | null | null | What does the node contain only ?
| def _is_only_paragraph(node):
if (len(node) == 0):
return False
elif (len(node) > 1):
for subnode in node[1:]:
if (not isinstance(subnode, nodes.system_message)):
return False
if isinstance(node[0], nodes.paragraph):
return True
return False
| null | null | null | one paragraph
| codeqa | def is only paragraph node if len node 0 return Falseelif len node > 1 for subnode in node[ 1 ] if not isinstance subnode nodes system message return Falseif isinstance node[ 0 ] nodes paragraph return Truereturn False
| null | null | null | null | Question:
What does the node contain only ?
Code:
def _is_only_paragraph(node):
if (len(node) == 0):
return False
elif (len(node) > 1):
for subnode in node[1:]:
if (not isinstance(subnode, nodes.system_message)):
return False
if isinstance(node[0], nodes.paragraph):
return True
return False
|
null | null | null | How does the code render the comment form ?
| def render_comment_form(parser, token):
return RenderCommentFormNode.handle_token(parser, token)
| null | null | null | through the comments / form
| codeqa | def render comment form parser token return Render Comment Form Node handle token parser token
| null | null | null | null | Question:
How does the code render the comment form ?
Code:
def render_comment_form(parser, token):
return RenderCommentFormNode.handle_token(parser, token)
|
null | null | null | What does the code render through the comments / form ?
| def render_comment_form(parser, token):
return RenderCommentFormNode.handle_token(parser, token)
| null | null | null | the comment form
| codeqa | def render comment form parser token return Render Comment Form Node handle token parser token
| null | null | null | null | Question:
What does the code render through the comments / form ?
Code:
def render_comment_form(parser, token):
return RenderCommentFormNode.handle_token(parser, token)
|
null | null | null | What does the code create ?
| @log_call
def task_create(context, values):
global DATA
task_values = copy.deepcopy(values)
task_id = task_values.get('id', str(uuid.uuid4()))
required_attributes = ['type', 'status', 'input']
allowed_attributes = ['id', 'type', 'status', 'input', 'result', 'owner', 'message', 'expires_at', 'created_at', 'updated_... | null | null | null | a task object
| codeqa | @log calldef task create context values global DAT Atask values copy deepcopy values task id task values get 'id' str uuid uuid 4 required attributes ['type' 'status' 'input']allowed attributes ['id' 'type' 'status' 'input' 'result' 'owner' 'message' 'expires at' 'created at' 'updated at' 'deleted at' 'deleted']if task... | null | null | null | null | Question:
What does the code create ?
Code:
@log_call
def task_create(context, values):
global DATA
task_values = copy.deepcopy(values)
task_id = task_values.get('id', str(uuid.uuid4()))
required_attributes = ['type', 'status', 'input']
allowed_attributes = ['id', 'type', 'status', 'input', 'result', 'owner', ... |
null | null | null | What does the code add to vector3rackprofiles ?
| def addRackHole(derivation, vector3RackProfiles, x, xmlElement):
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 vector 3 Rack Profiles x xml Element 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, vector3RackProfiles, x, xmlElement):
rackHole = euclidean.getComplexPolygon(complex(x, (- derivation.rackHoleBelow)), derivation.rackHoleRadius, (-13))
vector3RackProfiles.append(euclidean.getVector3Path(rackHole))
|
null | null | null | How do server run ?
| def wnb(port=8000, runBrowser=True, logfilename=None):
global server_mode, logfile
server_mode = (not runBrowser)
if logfilename:
try:
logfile = open(logfilename, 'a', 1)
except IOError as e:
sys.stderr.write("Couldn't open %s for writing: %s", logfilename, e)
sys.exit(1)
else:
logfile = None
u... | null | null | null | code
| codeqa | def wnb port 8000 run Browser True logfilename None global server mode logfileserver mode not run Browser if logfilename try logfile open logfilename 'a' 1 except IO Error as e sys stderr write " Couldn'topen%sforwriting %s" logfilename e sys exit 1 else logfile Noneurl 'http //localhost ' + str port server ready Noneb... | null | null | null | null | Question:
How do server run ?
Code:
def wnb(port=8000, runBrowser=True, logfilename=None):
global server_mode, logfile
server_mode = (not runBrowser)
if logfilename:
try:
logfile = open(logfilename, 'a', 1)
except IOError as e:
sys.stderr.write("Couldn't open %s for writing: %s", logfilename, e)
... |
null | null | null | How do whose inputs / outputs not match ?
| def test_invalid_operands():
with pytest.raises(ModelDefinitionError):
(Rotation2D | Gaussian1D)
with pytest.raises(ModelDefinitionError):
(Rotation2D(90) | Gaussian1D(1, 0, 0.1))
with pytest.raises(ModelDefinitionError):
(Rotation2D + Gaussian1D)
with pytest.raises(ModelDefinitionError):
(Rotation2D(90) + ... | null | null | null | correctly
| codeqa | def test invalid operands with pytest raises Model Definition Error Rotation 2 D Gaussian 1 D with pytest raises Model Definition Error Rotation 2 D 90 Gaussian 1 D 1 0 0 1 with pytest raises Model Definition Error Rotation 2 D + Gaussian 1 D with pytest raises Model Definition Error Rotation 2 D 90 + Gaussian 1 D 1 0 ... | null | null | null | null | Question:
How do whose inputs / outputs not match ?
Code:
def test_invalid_operands():
with pytest.raises(ModelDefinitionError):
(Rotation2D | Gaussian1D)
with pytest.raises(ModelDefinitionError):
(Rotation2D(90) | Gaussian1D(1, 0, 0.1))
with pytest.raises(ModelDefinitionError):
(Rotation2D + Gaussian1D)
... |
null | null | null | When did date / time convert to seconds ?
| def epoch(t):
if (not hasattr(t, 'tzinfo')):
return
return int(time.mktime(append_tz(t).timetuple()))
| null | null | null | since epoch
| codeqa | def epoch t if not hasattr t 'tzinfo' returnreturn int time mktime append tz t timetuple
| null | null | null | null | Question:
When did date / time convert to seconds ?
Code:
def epoch(t):
if (not hasattr(t, 'tzinfo')):
return
return int(time.mktime(append_tz(t).timetuple()))
|
null | null | null | For what purpose do tags retrieve ?
| def get_tags(name=None, instance_id=None, call=None, location=None, kwargs=None, resource_id=None):
if (location is None):
location = get_location()
if (instance_id is None):
if (resource_id is None):
if name:
instance_id = _get_node(name)['instanceId']
elif ('instance_id' in kwargs):
instance_id = ... | null | null | null | for a resource
| codeqa | def get tags name None instance id None call None location None kwargs None resource id None if location is None location get location if instance id is None if resource id is None if name instance id get node name ['instance Id']elif 'instance id' in kwargs instance id kwargs['instance id']elif 'resource id' in kwargs... | null | null | null | null | Question:
For what purpose do tags retrieve ?
Code:
def get_tags(name=None, instance_id=None, call=None, location=None, kwargs=None, resource_id=None):
if (location is None):
location = get_location()
if (instance_id is None):
if (resource_id is None):
if name:
instance_id = _get_node(name)['instanceId... |
null | null | null | What does the code flatten ?
| def flatten_dict(d, parent_key=''):
items = []
for (k, v) in d.items():
new_key = (((parent_key + '.') + k) if parent_key else k)
if isinstance(v, collections.MutableMapping):
items.extend(list(flatten_dict(v, new_key).items()))
else:
items.append((new_key, v))
return dict(items)
| null | null | null | a nested dictionary
| codeqa | def flatten dict d parent key '' items []for k v in d items new key parent key + ' ' + k if parent key else k if isinstance v collections Mutable Mapping items extend list flatten dict v new key items else items append new key v return dict items
| null | null | null | null | Question:
What does the code flatten ?
Code:
def flatten_dict(d, parent_key=''):
items = []
for (k, v) in d.items():
new_key = (((parent_key + '.') + k) if parent_key else k)
if isinstance(v, collections.MutableMapping):
items.extend(list(flatten_dict(v, new_key).items()))
else:
items.append((new_key,... |
null | null | null | What add timestamps to the console log ?
| def timestamps(registry, xml_parent, data):
XML.SubElement(xml_parent, 'hudson.plugins.timestamper.TimestamperBuildWrapper')
| null | null | null | timestamps
| codeqa | def timestamps registry xml parent data XML Sub Element xml parent 'hudson plugins timestamper Timestamper Build Wrapper'
| null | null | null | null | Question:
What add timestamps to the console log ?
Code:
def timestamps(registry, xml_parent, data):
XML.SubElement(xml_parent, 'hudson.plugins.timestamper.TimestamperBuildWrapper')
|
null | null | null | What do timestamps add to the console log ?
| def timestamps(registry, xml_parent, data):
XML.SubElement(xml_parent, 'hudson.plugins.timestamper.TimestamperBuildWrapper')
| null | null | null | timestamps
| codeqa | def timestamps registry xml parent data XML Sub Element xml parent 'hudson plugins timestamper Timestamper Build Wrapper'
| null | null | null | null | Question:
What do timestamps add to the console log ?
Code:
def timestamps(registry, xml_parent, data):
XML.SubElement(xml_parent, 'hudson.plugins.timestamper.TimestamperBuildWrapper')
|
null | null | null | What does the code add ?
| def apply_extra_context(extra_context, context):
for (key, value) in extra_context.iteritems():
if callable(value):
context[key] = value()
else:
context[key] = value
| null | null | null | items
| codeqa | def apply extra context extra context context for key value in extra context iteritems if callable value context[key] value else context[key] value
| null | null | null | null | Question:
What does the code add ?
Code:
def apply_extra_context(extra_context, context):
for (key, value) in extra_context.iteritems():
if callable(value):
context[key] = value()
else:
context[key] = value
|
null | null | null | What does the code require ?
| @pytest.fixture
def en_tutorial_po(po_directory, settings, english_tutorial):
return _require_store(english_tutorial, settings.POOTLE_TRANSLATION_DIRECTORY, 'tutorial.po')
| null | null | null | the /en / tutorial / tutorial
| codeqa | @pytest fixturedef en tutorial po po directory settings english tutorial return require store english tutorial settings POOTLE TRANSLATION DIRECTORY 'tutorial po'
| null | null | null | null | Question:
What does the code require ?
Code:
@pytest.fixture
def en_tutorial_po(po_directory, settings, english_tutorial):
return _require_store(english_tutorial, settings.POOTLE_TRANSLATION_DIRECTORY, 'tutorial.po')
|
null | null | null | What does a hostname use ?
| def get_hostname(module=None, version=None, instance=None):
def _ResultHook(rpc):
mapped_errors = [modules_service_pb.ModulesServiceError.INVALID_MODULE, modules_service_pb.ModulesServiceError.INVALID_INSTANCES]
_CheckAsyncResult(rpc, mapped_errors, [])
return rpc.response.hostname()
request = modules_service_p... | null | null | null | to contact the module
| codeqa | def get hostname module None version None instance None def Result Hook rpc mapped errors [modules service pb Modules Service Error INVALID MODULE modules service pb Modules Service Error INVALID INSTANCES] Check Async Result rpc mapped errors [] return rpc response hostname request modules service pb Get Hostname Requ... | null | null | null | null | Question:
What does a hostname use ?
Code:
def get_hostname(module=None, version=None, instance=None):
def _ResultHook(rpc):
mapped_errors = [modules_service_pb.ModulesServiceError.INVALID_MODULE, modules_service_pb.ModulesServiceError.INVALID_INSTANCES]
_CheckAsyncResult(rpc, mapped_errors, [])
return rpc.r... |
null | null | null | What uses to contact the module ?
| def get_hostname(module=None, version=None, instance=None):
def _ResultHook(rpc):
mapped_errors = [modules_service_pb.ModulesServiceError.INVALID_MODULE, modules_service_pb.ModulesServiceError.INVALID_INSTANCES]
_CheckAsyncResult(rpc, mapped_errors, [])
return rpc.response.hostname()
request = modules_service_p... | null | null | null | a hostname
| codeqa | def get hostname module None version None instance None def Result Hook rpc mapped errors [modules service pb Modules Service Error INVALID MODULE modules service pb Modules Service Error INVALID INSTANCES] Check Async Result rpc mapped errors [] return rpc response hostname request modules service pb Get Hostname Requ... | null | null | null | null | Question:
What uses to contact the module ?
Code:
def get_hostname(module=None, version=None, instance=None):
def _ResultHook(rpc):
mapped_errors = [modules_service_pb.ModulesServiceError.INVALID_MODULE, modules_service_pb.ModulesServiceError.INVALID_INSTANCES]
_CheckAsyncResult(rpc, mapped_errors, [])
retur... |
null | null | null | What does the code create ?
| def technical_404_response(request, exception):
try:
tried = exception.args[0][u'tried']
except (IndexError, TypeError, KeyError):
tried = []
else:
if ((not tried) or ((request.path == u'/') and (len(tried) == 1) and (len(tried[0]) == 1) and (getattr(tried[0][0], u'app_name', u'') == getattr(tried[0][0], u'nam... | null | null | null | a technical 404 error response
| codeqa | def technical 404 response request exception try tried exception args[ 0 ][u'tried']except Index Error Type Error Key Error tried []else if not tried or request path u'/' and len tried 1 and len tried[ 0 ] 1 and getattr tried[ 0 ][ 0 ] u'app name' u'' getattr tried[ 0 ][ 0 ] u'namespace' u'' u'admin' return default url... | null | null | null | null | Question:
What does the code create ?
Code:
def technical_404_response(request, exception):
try:
tried = exception.args[0][u'tried']
except (IndexError, TypeError, KeyError):
tried = []
else:
if ((not tried) or ((request.path == u'/') and (len(tried) == 1) and (len(tried[0]) == 1) and (getattr(tried[0][0],... |
null | null | null | What does the code populate with the most recent data ?
| @require_admin_context
def compute_node_update(context, compute_id, values, auto_adjust):
session = get_session()
if auto_adjust:
_adjust_compute_node_values_for_utilization(context, values, session)
with session.begin(subtransactions=True):
values['updated_at'] = timeutils.utcnow()
convert_datetimes(values, '... | null | null | null | the capacity fields
| codeqa | @require admin contextdef compute node update context compute id values auto adjust session get session if auto adjust adjust compute node values for utilization context values session with session begin subtransactions True values['updated at'] timeutils utcnow convert datetimes values 'created at' 'deleted at' 'updat... | null | null | null | null | Question:
What does the code populate with the most recent data ?
Code:
@require_admin_context
def compute_node_update(context, compute_id, values, auto_adjust):
session = get_session()
if auto_adjust:
_adjust_compute_node_values_for_utilization(context, values, session)
with session.begin(subtransactions=True... |
null | null | null | How does the code populate the capacity fields ?
| @require_admin_context
def compute_node_update(context, compute_id, values, auto_adjust):
session = get_session()
if auto_adjust:
_adjust_compute_node_values_for_utilization(context, values, session)
with session.begin(subtransactions=True):
values['updated_at'] = timeutils.utcnow()
convert_datetimes(values, '... | null | null | null | with the most recent data
| codeqa | @require admin contextdef compute node update context compute id values auto adjust session get session if auto adjust adjust compute node values for utilization context values session with session begin subtransactions True values['updated at'] timeutils utcnow convert datetimes values 'created at' 'deleted at' 'updat... | null | null | null | null | Question:
How does the code populate the capacity fields ?
Code:
@require_admin_context
def compute_node_update(context, compute_id, values, auto_adjust):
session = get_session()
if auto_adjust:
_adjust_compute_node_values_for_utilization(context, values, session)
with session.begin(subtransactions=True):
va... |
null | null | null | How do gaps in the data handle ?
| def zip_timeseries(*series, **kwargs):
next_slice = (max if (kwargs.get('order', 'descending') == 'descending') else min)
iterators = [PeekableIterator(s) for s in series]
widths = []
for w in iterators:
r = w.peek()
if r:
(date, values) = r
widths.append(len(values))
else:
widths.append(0)
while Tr... | null | null | null | gracefully
| codeqa | def zip timeseries *series **kwargs next slice max if kwargs get 'order' 'descending' 'descending' else min iterators [ Peekable Iterator s for s in series]widths []for w in iterators r w peek if r date values rwidths append len values else widths append 0 while True items [it peek for it in iterators]if not any items ... | null | null | null | null | Question:
How do gaps in the data handle ?
Code:
def zip_timeseries(*series, **kwargs):
next_slice = (max if (kwargs.get('order', 'descending') == 'descending') else min)
iterators = [PeekableIterator(s) for s in series]
widths = []
for w in iterators:
r = w.peek()
if r:
(date, values) = r
widths.appe... |
null | null | null | What does the code provide ?
| def test_slice_delslice_forbidden():
global setVal
class foo:
def __delslice__(self, i, j, value):
global setVal
setVal = (i, j, value)
def __delitem__(self, index):
global setVal
setVal = index
del foo()[::None]
AreEqual(setVal, slice(None, None, None))
del foo()[::None]
AreEqual(setVal, slice(No... | null | null | null | no value for step
| codeqa | def test slice delslice forbidden global set Valclass foo def delslice self i j value global set Valset Val i j value def delitem self index global set Valset Val indexdel foo [ None] Are Equal set Val slice None None None del foo [ None] Are Equal set Val slice None None None
| null | null | null | null | Question:
What does the code provide ?
Code:
def test_slice_delslice_forbidden():
global setVal
class foo:
def __delslice__(self, i, j, value):
global setVal
setVal = (i, j, value)
def __delitem__(self, index):
global setVal
setVal = index
del foo()[::None]
AreEqual(setVal, slice(None, None, Non... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.