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 ?
| def _ResolvePath(included_from, included_path, basepath):
python_lib = '$PYTHON_LIB'
appscale_server = '/root/appscale/AppServer'
included_from = included_from.replace(python_lib, appscale_server)
included_path = included_path.replace(python_lib, appscale_server)
basepath = basepath.replace(python_lib, appscale_se... | null | null | null | the absolute path of the file to be included
| codeqa | def Resolve Path included from included path basepath python lib '$PYTHON LIB'appscale server '/root/appscale/ App Server'included from included from replace python lib appscale server included path included path replace python lib appscale server basepath basepath replace python lib appscale server path os path join o... | null | null | null | null | Question:
What does the code get ?
Code:
def _ResolvePath(included_from, included_path, basepath):
python_lib = '$PYTHON_LIB'
appscale_server = '/root/appscale/AppServer'
included_from = included_from.replace(python_lib, appscale_server)
included_path = included_path.replace(python_lib, appscale_server)
basepa... |
null | null | null | Who d compute to a specified relative precision ?
| def iddp_id(eps, A):
A = np.asfortranarray(A)
(k, idx, rnorms) = _id.iddp_id(eps, A)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (k, idx, proj)
| null | null | null | i d of a real matrix
| codeqa | def iddp id eps A A np asfortranarray A k idx rnorms id iddp id eps A n A shape[ 1 ]proj A T ravel [ k * n - k ] reshape k n - k order 'F' return k idx proj
| null | null | null | null | Question:
Who d compute to a specified relative precision ?
Code:
def iddp_id(eps, A):
A = np.asfortranarray(A)
(k, idx, rnorms) = _id.iddp_id(eps, A)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (k, idx, proj)
|
null | null | null | What d i d of a real matrix compute ?
| def iddp_id(eps, A):
A = np.asfortranarray(A)
(k, idx, rnorms) = _id.iddp_id(eps, A)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (k, idx, proj)
| null | null | null | to a specified relative precision
| codeqa | def iddp id eps A A np asfortranarray A k idx rnorms id iddp id eps A n A shape[ 1 ]proj A T ravel [ k * n - k ] reshape k n - k order 'F' return k idx proj
| null | null | null | null | Question:
What d i d of a real matrix compute ?
Code:
def iddp_id(eps, A):
A = np.asfortranarray(A)
(k, idx, rnorms) = _id.iddp_id(eps, A)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (k, idx, proj)
|
null | null | null | What does the code return ?
| def from_edgelist(edgelist, create_using=None):
G = _prep_create_using(create_using)
G.add_edges_from(edgelist)
return G
| null | null | null | a graph
| codeqa | def from edgelist edgelist create using None G prep create using create using G add edges from edgelist return G
| null | null | null | null | Question:
What does the code return ?
Code:
def from_edgelist(edgelist, create_using=None):
G = _prep_create_using(create_using)
G.add_edges_from(edgelist)
return G
|
null | null | null | What does the code get ?
| def getTopPaths(paths):
top = (-9.876543219876543e+17)
for path in paths:
for point in path:
top = max(top, point.z)
return top
| null | null | null | the top of the paths
| codeqa | def get Top Paths paths top -9 876543219876543 e+ 17 for path in paths for point in path top max top point z return top
| null | null | null | null | Question:
What does the code get ?
Code:
def getTopPaths(paths):
top = (-9.876543219876543e+17)
for path in paths:
for point in path:
top = max(top, point.z)
return top
|
null | null | null | What does the code convert into its hex encoding ?
| def _hexify(data, chunksize=None):
if (chunksize is None):
chunksize = _hex_chunksize
hex = data.encode('hex_codec')
l = len(hex)
if (l > chunksize):
chunks = []
i = 0
while (i < l):
chunks.append(hex[i:(i + chunksize)])
i += chunksize
hex = ' '.join(chunks)
return hex
| null | null | null | a binary string
| codeqa | def hexify data chunksize None if chunksize is None chunksize hex chunksizehex data encode 'hex codec' l len hex if l > chunksize chunks []i 0while i < l chunks append hex[i i + chunksize ] i + chunksizehex '' join chunks return hex
| null | null | null | null | Question:
What does the code convert into its hex encoding ?
Code:
def _hexify(data, chunksize=None):
if (chunksize is None):
chunksize = _hex_chunksize
hex = data.encode('hex_codec')
l = len(hex)
if (l > chunksize):
chunks = []
i = 0
while (i < l):
chunks.append(hex[i:(i + chunksize)])
i += chunk... |
null | null | null | How do image levels - async version adjust ?
| def im_feeling_lucky_async(image_data, output_encoding=PNG, quality=None, correct_orientation=UNCHANGED_ORIENTATION, rpc=None, transparent_substitution_rgb=None):
image = Image(image_data)
image.im_feeling_lucky()
image.set_correct_orientation(correct_orientation)
return image.execute_transforms_async(output_encodi... | null | null | null | automatically
| codeqa | def im feeling lucky async image data output encoding PNG quality None correct orientation UNCHANGED ORIENTATION rpc None transparent substitution rgb None image Image image data image im feeling lucky image set correct orientation correct orientation return image execute transforms async output encoding output encodin... | null | null | null | null | Question:
How do image levels - async version adjust ?
Code:
def im_feeling_lucky_async(image_data, output_encoding=PNG, quality=None, correct_orientation=UNCHANGED_ORIENTATION, rpc=None, transparent_substitution_rgb=None):
image = Image(image_data)
image.im_feeling_lucky()
image.set_correct_orientation(correct_... |
null | null | null | Where did the code set the given properties ?
| @_get_client
def image_update(client, image_id, values, purge_props=False, from_state=None, v1_mode=False):
return client.image_update(values=values, image_id=image_id, purge_props=purge_props, from_state=from_state, v1_mode=v1_mode)
| null | null | null | on an image
| codeqa | @ get clientdef image update client image id values purge props False from state None v1 mode False return client image update values values image id image id purge props purge props from state from state v1 mode v1 mode
| null | null | null | null | Question:
Where did the code set the given properties ?
Code:
@_get_client
def image_update(client, image_id, values, purge_props=False, from_state=None, v1_mode=False):
return client.image_update(values=values, image_id=image_id, purge_props=purge_props, from_state=from_state, v1_mode=v1_mode)
|
null | null | null | What did the code set on an image ?
| @_get_client
def image_update(client, image_id, values, purge_props=False, from_state=None, v1_mode=False):
return client.image_update(values=values, image_id=image_id, purge_props=purge_props, from_state=from_state, v1_mode=v1_mode)
| null | null | null | the given properties
| codeqa | @ get clientdef image update client image id values purge props False from state None v1 mode False return client image update values values image id image id purge props purge props from state from state v1 mode v1 mode
| null | null | null | null | Question:
What did the code set on an image ?
Code:
@_get_client
def image_update(client, image_id, values, purge_props=False, from_state=None, v1_mode=False):
return client.image_update(values=values, image_id=image_id, purge_props=purge_props, from_state=from_state, v1_mode=v1_mode)
|
null | null | null | What does this function determine ?
| def __virtual__():
if (not HAS_LIBVIRT):
return (False, 'Unable to locate or import python libvirt library.')
if (get_configured_provider() is False):
return (False, "The 'libvirt' provider is not configured.")
return __virtualname__
| null | null | null | whether or not to make this cloud module available upon execution
| codeqa | def virtual if not HAS LIBVIRT return False ' Unabletolocateorimportpythonlibvirtlibrary ' if get configured provider is False return False " The'libvirt'providerisnotconfigured " return virtualname
| null | null | null | null | Question:
What does this function determine ?
Code:
def __virtual__():
if (not HAS_LIBVIRT):
return (False, 'Unable to locate or import python libvirt library.')
if (get_configured_provider() is False):
return (False, "The 'libvirt' provider is not configured.")
return __virtualname__
|
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, None)
if (value is not None):
ctx.update(force_bytes(value))
path = hashlib.md5(force_bytes(iri_to_uri(request.get_full_path())))
cache_key = (u'views.decorators.ca... | 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 None if value is not None ctx update force bytes value path hashlib md 5 force bytes iri to uri request get full path cache key u'views decorators cache cache page %s %s %s %s' % key prefi... | 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, None)
if (value is not None):
ctx.update(force_bytes(value))
path = hashlib.md5(force_bytes(iri_to_uri(request.get_f... |
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, None)
if (value is not None):
ctx.update(force_bytes(value))
path = hashlib.md5(force_bytes(iri_to_uri(request.get_full_path())))
cache_key = (u'views.decorators.ca... | 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 None if value is not None ctx update force bytes value path hashlib md 5 force bytes iri to uri request get full path cache key u'views decorators cache cache page %s %s %s %s' % key prefi... | 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, None)
if (value is not None):
ctx.update(force_bytes(value))
path = hashlib.md5(force_bytes(iri_to_uri(request.ge... |
null | null | null | When do things set ?
| def post_begin():
for fn in post_configure:
fn(options, file_config)
global util, fixtures, engines, exclusions, assertions, warnings, profiling, config, testing
from sqlalchemy import testing
from sqlalchemy.testing import fixtures, engines, exclusions
from sqlalchemy.testing import assertions, warnings, profil... | null | null | null | later
| codeqa | def post begin for fn in post configure fn options file config global util fixtures engines exclusions assertions warnings profiling config testingfrom sqlalchemy import testingfrom sqlalchemy testing import fixtures engines exclusionsfrom sqlalchemy testing import assertions warnings profilingfrom sqlalchemy testing i... | null | null | null | null | Question:
When do things set ?
Code:
def post_begin():
for fn in post_configure:
fn(options, file_config)
global util, fixtures, engines, exclusions, assertions, warnings, profiling, config, testing
from sqlalchemy import testing
from sqlalchemy.testing import fixtures, engines, exclusions
from sqlalchemy.te... |
null | null | null | What does the code setup ?
| def setup_platform(hass, config, add_devices, discovery_info=None):
import pywink
for switch in pywink.get_switches():
add_devices([WinkToggleDevice(switch, hass)])
for switch in pywink.get_powerstrip_outlets():
add_devices([WinkToggleDevice(switch, hass)])
for switch in pywink.get_sirens():
add_devices([Wink... | null | null | null | the wink platform
| codeqa | def setup platform hass config add devices discovery info None import pywinkfor switch in pywink get switches add devices [ Wink Toggle Device switch hass ] for switch in pywink get powerstrip outlets add devices [ Wink Toggle Device switch hass ] for switch in pywink get sirens add devices [ Wink Toggle Device switch ... | null | null | null | null | Question:
What does the code setup ?
Code:
def setup_platform(hass, config, add_devices, discovery_info=None):
import pywink
for switch in pywink.get_switches():
add_devices([WinkToggleDevice(switch, hass)])
for switch in pywink.get_powerstrip_outlets():
add_devices([WinkToggleDevice(switch, hass)])
for swi... |
null | null | null | What does the code execute ?
| def orchestrate_high(data, test=None, queue=False, pillar=None, **kwargs):
if ((pillar is not None) and (not isinstance(pillar, dict))):
raise SaltInvocationError('Pillar data must be formatted as a dictionary')
__opts__['file_client'] = 'local'
minion = salt.minion.MasterMinion(__opts__)
running = minion.... | null | null | null | a single state orchestration routine
| codeqa | def orchestrate high data test None queue False pillar None **kwargs if pillar is not None and not isinstance pillar dict raise Salt Invocation Error ' Pillardatamustbeformattedasadictionary' opts ['file client'] 'local'minion salt minion Master Minion opts running minion functions['state high'] data test None queue Fa... | null | null | null | null | Question:
What does the code execute ?
Code:
def orchestrate_high(data, test=None, queue=False, pillar=None, **kwargs):
if ((pillar is not None) and (not isinstance(pillar, dict))):
raise SaltInvocationError('Pillar data must be formatted as a dictionary')
__opts__['file_client'] = 'local'
minion = salt... |
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 equals expression ?
| def p_statement_assign(t):
names[t[1]] = t[3]
| null | null | null | name
| codeqa | def p statement assign t names[t[ 1 ]] t[ 3 ]
| null | null | null | null | Question:
What equals expression ?
Code:
def p_statement_assign(t):
names[t[1]] = t[3]
|
null | null | null | What does name equal ?
| def p_statement_assign(t):
names[t[1]] = t[3]
| null | null | null | expression
| codeqa | def p statement assign t names[t[ 1 ]] t[ 3 ]
| null | null | null | null | Question:
What does name equal ?
Code:
def p_statement_assign(t):
names[t[1]] = t[3]
|
null | null | null | What does the code get ?
| @lockutils.synchronized('storage-registry-lock', 'nova-', external=True)
def get_storage_users(storage_path):
d = {}
id_path = os.path.join(storage_path, 'compute_nodes')
if os.path.exists(id_path):
with open(id_path) as f:
d = json.loads(f.read())
recent_users = []
for node in d:
if ((time.time() - d[node]... | null | null | null | a list of all the users of this storage path
| codeqa | @lockutils synchronized 'storage-registry-lock' 'nova-' external True def get storage users storage path d {}id path os path join storage path 'compute nodes' if os path exists id path with open id path as f d json loads f read recent users []for node in d if time time - d[node] < TWENTY FOUR HOURS recent users append ... | null | null | null | null | Question:
What does the code get ?
Code:
@lockutils.synchronized('storage-registry-lock', 'nova-', external=True)
def get_storage_users(storage_path):
d = {}
id_path = os.path.join(storage_path, 'compute_nodes')
if os.path.exists(id_path):
with open(id_path) as f:
d = json.loads(f.read())
recent_users = []... |
null | null | null | How do a string mark as safe for output purposes ?
| def mark_safe(s):
if isinstance(s, SafeData):
return s
if (isinstance(s, str) or (isinstance(s, Promise) and s._delegate_str)):
return SafeString(s)
if isinstance(s, (unicode, Promise)):
return SafeUnicode(s)
return SafeString(str(s))
| null | null | null | explicitly
| codeqa | def mark safe s if isinstance s Safe Data return sif isinstance s str or isinstance s Promise and s delegate str return Safe String s if isinstance s unicode Promise return Safe Unicode s return Safe String str s
| null | null | null | null | Question:
How do a string mark as safe for output purposes ?
Code:
def mark_safe(s):
if isinstance(s, SafeData):
return s
if (isinstance(s, str) or (isinstance(s, Promise) and s._delegate_str)):
return SafeString(s)
if isinstance(s, (unicode, Promise)):
return SafeUnicode(s)
return SafeString(str(s))
|
null | null | null | What does the code convert ?
| def load_from_file(file_name, package_context=''):
if VERBOSE:
if package_context:
sys.stdout.write(('Load spec from %s into namespace [%s]\n' % (file_name, package_context)))
else:
sys.stdout.write(('Load spec from %s\n' % file_name))
base_file_name = os.path.basename(file_name)
type_ = base_file... | null | null | null | the
| codeqa | def load from file file name package context '' if VERBOSE if package context sys stdout write ' Loadspecfrom%sintonamespace[%s]\n' % file name package context else sys stdout write ' Loadspecfrom%s\n' % file name base file name os path basename file name type base file name[ - len EXT ]base type type if package contex... | null | null | null | null | Question:
What does the code convert ?
Code:
def load_from_file(file_name, package_context=''):
if VERBOSE:
if package_context:
sys.stdout.write(('Load spec from %s into namespace [%s]\n' % (file_name, package_context)))
else:
sys.stdout.write(('Load spec from %s\n' % file_name))
base_file_name... |
null | null | null | When did tasks schedule ?
| @inspect_command(alias=u'dump_schedule')
def scheduled(state, **kwargs):
return list(_iter_schedule_requests(state.consumer.timer))
| null | null | null | currently
| codeqa | @inspect command alias u'dump schedule' def scheduled state **kwargs return list iter schedule requests state consumer timer
| null | null | null | null | Question:
When did tasks schedule ?
Code:
@inspect_command(alias=u'dump_schedule')
def scheduled(state, **kwargs):
return list(_iter_schedule_requests(state.consumer.timer))
|
null | null | null | What installs a package from the given path ?
| def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_return_success(cmd)
| null | null | null | internal function
| codeqa | def install from path path if not os path exists path msg ' Filenotfound {0 }' format path raise Salt Invocation Error msg cmd 'installer-pkg"{ 0 }"-target/' format path return salt utils mac utils execute return success cmd
| null | null | null | null | Question:
What installs a package from the given path ?
Code:
def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_return_success(cmd)... |
null | null | null | In which direction do internal function install a package ?
| def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_return_success(cmd)
| null | null | null | from the given path
| codeqa | def install from path path if not os path exists path msg ' Filenotfound {0 }' format path raise Salt Invocation Error msg cmd 'installer-pkg"{ 0 }"-target/' format path return salt utils mac utils execute return success cmd
| null | null | null | null | Question:
In which direction do internal function install a package ?
Code:
def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_retur... |
null | null | null | What do internal function install from the given path ?
| def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_return_success(cmd)
| null | null | null | a package
| codeqa | def install from path path if not os path exists path msg ' Filenotfound {0 }' format path raise Salt Invocation Error msg cmd 'installer-pkg"{ 0 }"-target/' format path return salt utils mac utils execute return success cmd
| null | null | null | null | Question:
What do internal function install from the given path ?
Code:
def _install_from_path(path):
if (not os.path.exists(path)):
msg = 'File not found: {0}'.format(path)
raise SaltInvocationError(msg)
cmd = 'installer -pkg "{0}" -target /'.format(path)
return salt.utils.mac_utils.execute_return_su... |
null | null | null | When did users connect ?
| def users():
retlist = []
rawlist = cext.users()
for item in rawlist:
(user, tty, hostname, tstamp, user_process) = item
if (not user_process):
continue
if ((hostname == ':0.0') or (hostname == ':0')):
hostname = 'localhost'
nt = _common.suser(user, (tty or None), hostname, tstamp)
retlist.append(nt)... | null | null | null | currently
| codeqa | def users retlist []rawlist cext users for item in rawlist user tty hostname tstamp user process itemif not user process continueif hostname ' 0 0' or hostname ' 0' hostname 'localhost'nt common suser user tty or None hostname tstamp retlist append nt return retlist
| null | null | null | null | Question:
When did users connect ?
Code:
def users():
retlist = []
rawlist = cext.users()
for item in rawlist:
(user, tty, hostname, tstamp, user_process) = item
if (not user_process):
continue
if ((hostname == ':0.0') or (hostname == ':0')):
hostname = 'localhost'
nt = _common.suser(user, (tty or ... |
null | null | null | How do firewall rules stop ?
| def reload():
if (not _status_apf()):
return __apf_cmd('-r')
| null | null | null | cli example
| codeqa | def reload if not status apf return apf cmd '-r'
| null | null | null | null | Question:
How do firewall rules stop ?
Code:
def reload():
if (not _status_apf()):
return __apf_cmd('-r')
|
null | null | null | How does one of a set of duplicates in different locations find ?
| def test_duplicates_sort_ok(data):
finder = PackageFinder([data.find_links, data.find_links2], [], session=PipSession())
req = InstallRequirement.from_line('duplicate')
found = finder.find_requirement(req, False)
assert found.url.endswith('duplicate-1.0.tar.gz'), found
| null | null | null | successfully
| codeqa | def test duplicates sort ok data finder Package Finder [data find links data find links 2 ] [] session Pip Session req Install Requirement from line 'duplicate' found finder find requirement req False assert found url endswith 'duplicate- 1 0 tar gz' found
| null | null | null | null | Question:
How does one of a set of duplicates in different locations find ?
Code:
def test_duplicates_sort_ok(data):
finder = PackageFinder([data.find_links, data.find_links2], [], session=PipSession())
req = InstallRequirement.from_line('duplicate')
found = finder.find_requirement(req, False)
assert found.url.... |
null | null | null | What does the code get ?
| def storage_directory(datadir, partition, name_hash):
return os.path.join(datadir, str(partition), name_hash[(-3):], name_hash)
| null | null | null | the storage directory
| codeqa | def storage directory datadir partition name hash return os path join datadir str partition name hash[ -3 ] name hash
| null | null | null | null | Question:
What does the code get ?
Code:
def storage_directory(datadir, partition, name_hash):
return os.path.join(datadir, str(partition), name_hash[(-3):], name_hash)
|
null | null | null | How does the code return a chunk ?
| def serve_file(load, fnd):
if ('env' in load):
salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This warning will be removed in Salt Oxygen.")
load.pop... | null | null | null | based on the data received
| codeqa | def serve file load fnd if 'env' in load salt utils warn until ' Oxygen' " Parameter'env'hasbeendetectedintheargumentlist Thisparameterisnolongerusedandhasbeenreplacedby'saltenv'asof Salt 2016 11 0 Thiswarningwillberemovedin Salt Oxygen " load pop 'env' ret {'data' '' 'dest' ''}if not all x in load for x in 'path' 'loc... | null | null | null | null | Question:
How does the code return a chunk ?
Code:
def serve_file(load, fnd):
if ('env' in load):
salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This war... |
null | null | null | What does the code return based on the data received ?
| def serve_file(load, fnd):
if ('env' in load):
salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 2016.11.0. This warning will be removed in Salt Oxygen.")
load.pop... | null | null | null | a chunk
| codeqa | def serve file load fnd if 'env' in load salt utils warn until ' Oxygen' " Parameter'env'hasbeendetectedintheargumentlist Thisparameterisnolongerusedandhasbeenreplacedby'saltenv'asof Salt 2016 11 0 Thiswarningwillberemovedin Salt Oxygen " load pop 'env' ret {'data' '' 'dest' ''}if not all x in load for x in 'path' 'loc... | null | null | null | null | Question:
What does the code return based on the data received ?
Code:
def serve_file(load, fnd):
if ('env' in load):
salt.utils.warn_until('Oxygen', "Parameter 'env' has been detected in the argument list. This parameter is no longer used and has been replaced by 'saltenv' as of Salt 20... |
null | null | null | How do localization check ?
| def nova_is_not(logical_line):
split_line = logical_line.split()
if ((len(split_line) == 5) and (split_line[0] == 'if') and (split_line[1] == 'not') and (split_line[3] == 'is')):
(yield (logical_line.find('not'), "N901: Use the 'is not' operator for when testing for unequal identities"))
| null | null | null | in line
| codeqa | def nova is not logical line split line logical line split if len split line 5 and split line[ 0 ] 'if' and split line[ 1 ] 'not' and split line[ 3 ] 'is' yield logical line find 'not' "N 901 Usethe'isnot'operatorforwhentestingforunequalidentities"
| null | null | null | null | Question:
How do localization check ?
Code:
def nova_is_not(logical_line):
split_line = logical_line.split()
if ((len(split_line) == 5) and (split_line[0] == 'if') and (split_line[1] == 'not') and (split_line[3] == 'is')):
(yield (logical_line.find('not'), "N901: Use the 'is not' operator for when testi... |
null | null | null | How do pool implementation return ?
| def get_implementation(cls):
return symbol_by_name(cls, ALIASES)
| null | null | null | by name
| codeqa | def get implementation cls return symbol by name cls ALIASES
| null | null | null | null | Question:
How do pool implementation return ?
Code:
def get_implementation(cls):
return symbol_by_name(cls, ALIASES)
|
null | null | null | What does the code calculate ?
| def scoreatpercentile(data, per, limit=(), alphap=0.4, betap=0.4, axis=0, masknan=None):
per = np.asarray(per, float)
if ((per < 0).any() or (per > 100.0).any()):
raise ValueError(('The percentile should be between 0. and 100. ! (got %s)' % per))
return quantiles(data, prob=[(per / 100.0)], alphap=alphap... | null | null | null | the score at the given per percentile of the sequence a
| codeqa | def scoreatpercentile data per limit alphap 0 4 betap 0 4 axis 0 masknan None per np asarray per float if per < 0 any or per > 100 0 any raise Value Error ' Thepercentileshouldbebetween 0 and 100 got%s ' % per return quantiles data prob [ per / 100 0 ] alphap alphap betap betap limit limit axis axis masknan masknan squ... | null | null | null | null | Question:
What does the code calculate ?
Code:
def scoreatpercentile(data, per, limit=(), alphap=0.4, betap=0.4, axis=0, masknan=None):
per = np.asarray(per, float)
if ((per < 0).any() or (per > 100.0).any()):
raise ValueError(('The percentile should be between 0. and 100. ! (got %s)' % per))
return ... |
null | null | null | How does local variables assign to self ?
| def autoassign(self, locals):
for (key, value) in locals.iteritems():
if (key == 'self'):
continue
setattr(self, key, value)
| null | null | null | automatically
| codeqa | def autoassign self locals for key value in locals iteritems if key 'self' continuesetattr self key value
| null | null | null | null | Question:
How does local variables assign to self ?
Code:
def autoassign(self, locals):
for (key, value) in locals.iteritems():
if (key == 'self'):
continue
setattr(self, key, value)
|
null | null | null | What does the code get ?
| def getNewDerivation(elementNode):
return evaluate.EmptyObject(elementNode)
| null | null | null | new derivation
| codeqa | def get New Derivation element Node return evaluate Empty Object element Node
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewDerivation(elementNode):
return evaluate.EmptyObject(elementNode)
|
null | null | null | What does the code stop ?
| def RestartService(serviceName, args=None, waitSeconds=30, machine=None):
try:
StopService(serviceName, machine)
except pywintypes.error as exc:
if (exc.winerror != winerror.ERROR_SERVICE_NOT_ACTIVE):
raise
for i in range(waitSeconds):
try:
StartService(serviceName, args, machine)
break
except pywin... | null | null | null | the service
| codeqa | def Restart Service service Name args None wait Seconds 30 machine None try Stop Service service Name machine except pywintypes error as exc if exc winerror winerror ERROR SERVICE NOT ACTIVE raisefor i in range wait Seconds try Start Service service Name args machine breakexcept pywintypes error as exc if exc winerror ... | null | null | null | null | Question:
What does the code stop ?
Code:
def RestartService(serviceName, args=None, waitSeconds=30, machine=None):
try:
StopService(serviceName, machine)
except pywintypes.error as exc:
if (exc.winerror != winerror.ERROR_SERVICE_NOT_ACTIVE):
raise
for i in range(waitSeconds):
try:
StartService(servi... |
null | null | null | How does an array split into multiple sub arrays ?
| def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_size = (((size - 1) // indices_or_sections) + 1)
indices = [(i * each_size) for... | null | null | null | along a given axis
| codeqa | def array split ary indices or sections axis 0 ndim ary ndimif - ndim > axis or ndim < axis raise Index Error ' Axisexceedsndim' axis % ndimsize ary shape[axis]if numpy isscalar indices or sections each size size - 1 // indices or sections + 1 indices [ i * each size for i in six moves range 1 indices or sections ]else... | null | null | null | null | Question:
How does an array split into multiple sub arrays ?
Code:
def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_size = (((... |
null | null | null | What splits into multiple sub arrays along a given axis ?
| def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_size = (((size - 1) // indices_or_sections) + 1)
indices = [(i * each_size) for... | null | null | null | an array
| codeqa | def array split ary indices or sections axis 0 ndim ary ndimif - ndim > axis or ndim < axis raise Index Error ' Axisexceedsndim' axis % ndimsize ary shape[axis]if numpy isscalar indices or sections each size size - 1 // indices or sections + 1 indices [ i * each size for i in six moves range 1 indices or sections ]else... | null | null | null | null | Question:
What splits into multiple sub arrays along a given axis ?
Code:
def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_siz... |
null | null | null | What does an array split along a given axis ?
| def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_size = (((size - 1) // indices_or_sections) + 1)
indices = [(i * each_size) for... | null | null | null | into multiple sub arrays
| codeqa | def array split ary indices or sections axis 0 ndim ary ndimif - ndim > axis or ndim < axis raise Index Error ' Axisexceedsndim' axis % ndimsize ary shape[axis]if numpy isscalar indices or sections each size size - 1 // indices or sections + 1 indices [ i * each size for i in six moves range 1 indices or sections ]else... | null | null | null | null | Question:
What does an array split along a given axis ?
Code:
def array_split(ary, indices_or_sections, axis=0):
ndim = ary.ndim
if (((- ndim) > axis) or (ndim <= axis)):
raise IndexError('Axis exceeds ndim')
axis %= ndim
size = ary.shape[axis]
if numpy.isscalar(indices_or_sections):
each_size = (((size ... |
null | null | null | When did authentication backend register ?
| def unregister_auth_backend(backend_cls):
warn(u'reviewboard.accounts.backends.unregister_auth_backend() is deprecated. Use reviewboard.accounts.backends.auth_backends.unregister() instead.', DeprecationWarning)
auth_backends.unregister(backend_cls)
| null | null | null | previously
| codeqa | def unregister auth backend backend cls warn u'reviewboard accounts backends unregister auth backend isdeprecated Usereviewboard accounts backends auth backends unregister instead ' Deprecation Warning auth backends unregister backend cls
| null | null | null | null | Question:
When did authentication backend register ?
Code:
def unregister_auth_backend(backend_cls):
warn(u'reviewboard.accounts.backends.unregister_auth_backend() is deprecated. Use reviewboard.accounts.backends.auth_backends.unregister() instead.', DeprecationWarning)
auth_backends.unregister(backend_cls)
|
null | null | null | When do authentication backend ?
| def unregister_auth_backend(backend_cls):
warn(u'reviewboard.accounts.backends.unregister_auth_backend() is deprecated. Use reviewboard.accounts.backends.auth_backends.unregister() instead.', DeprecationWarning)
auth_backends.unregister(backend_cls)
| null | null | null | previously
| codeqa | def unregister auth backend backend cls warn u'reviewboard accounts backends unregister auth backend isdeprecated Usereviewboard accounts backends auth backends unregister instead ' Deprecation Warning auth backends unregister backend cls
| null | null | null | null | Question:
When do authentication backend ?
Code:
def unregister_auth_backend(backend_cls):
warn(u'reviewboard.accounts.backends.unregister_auth_backend() is deprecated. Use reviewboard.accounts.backends.auth_backends.unregister() instead.', DeprecationWarning)
auth_backends.unregister(backend_cls)
|
null | null | null | What is the code takes ?
| def is_sorted(seq):
return all(((seq[(i - 1)] <= seq[i]) for i in range(1, len(seq))))
| null | null | null | a list of integers
| codeqa | def is sorted seq return all seq[ i - 1 ] < seq[i] for i in range 1 len seq
| null | null | null | null | Question:
What is the code takes ?
Code:
def is_sorted(seq):
return all(((seq[(i - 1)] <= seq[i]) for i in range(1, len(seq))))
|
null | null | null | How do two filename lists walk ?
| def newer_pairwise(sources, targets):
if (len(sources) != len(targets)):
raise ValueError, "'sources' and 'targets' must be same length"
n_sources = []
n_targets = []
for i in range(len(sources)):
if newer(sources[i], targets[i]):
n_sources.append(sources[i])
n_targets.append(targets[i])
return (n_... | null | null | null | in parallel
| codeqa | def newer pairwise sources targets if len sources len targets raise Value Error "'sources'and'targets'mustbesamelength"n sources []n targets []for i in range len sources if newer sources[i] targets[i] n sources append sources[i] n targets append targets[i] return n sources n targets
| null | null | null | null | Question:
How do two filename lists walk ?
Code:
def newer_pairwise(sources, targets):
if (len(sources) != len(targets)):
raise ValueError, "'sources' and 'targets' must be same length"
n_sources = []
n_targets = []
for i in range(len(sources)):
if newer(sources[i], targets[i]):
n_sources.append(so... |
null | null | null | When did this function call ?
| def init(opts):
if ('host' not in opts['proxy']):
log.critical("No 'host' key found in pillar for this proxy.")
return False
if ('username' not in opts['proxy']):
log.critical("No 'username' key found in pillar for this proxy.")
return False
if ('passwords' not in opts['proxy']):
log.critic... | null | null | null | when the proxy starts up
| codeqa | def init opts if 'host' not in opts['proxy'] log critical " No'host'keyfoundinpillarforthisproxy " return Falseif 'username' not in opts['proxy'] log critical " No'username'keyfoundinpillarforthisproxy " return Falseif 'passwords' not in opts['proxy'] log critical " No'passwords'keyfoundinpillarforthisproxy " return Fa... | null | null | null | null | Question:
When did this function call ?
Code:
def init(opts):
if ('host' not in opts['proxy']):
log.critical("No 'host' key found in pillar for this proxy.")
return False
if ('username' not in opts['proxy']):
log.critical("No 'username' key found in pillar for this proxy.")
return False
i... |
null | null | null | What does the code get ?
| def get_dashboard(slug, orgname=None, profile='grafana'):
if isinstance(profile, string_types):
profile = __salt__['config.option'](profile)
if orgname:
switch_org(orgname, profile)
response = requests.get('{0}/api/dashboards/db/{1}'.format(profile['grafana_url'], slug), auth=_get_auth(profile), headers=_get_hea... | null | null | null | a dashboard
| codeqa | def get dashboard slug orgname None profile 'grafana' if isinstance profile string types profile salt ['config option'] profile if orgname switch org orgname profile response requests get '{ 0 }/api/dashboards/db/{ 1 }' format profile['grafana url'] slug auth get auth profile headers get headers profile timeout profile... | null | null | null | null | Question:
What does the code get ?
Code:
def get_dashboard(slug, orgname=None, profile='grafana'):
if isinstance(profile, string_types):
profile = __salt__['config.option'](profile)
if orgname:
switch_org(orgname, profile)
response = requests.get('{0}/api/dashboards/db/{1}'.format(profile['grafana_url'], slu... |
null | null | null | What does the code get ?
| @register.tag
def get_latest_posts(parser, token):
try:
(tag_name, arg) = token.contents.split(None, 1)
except ValueError:
raise template.TemplateSyntaxError, ('%s tag requires arguments' % token.contents.split()[0])
m = re.search('(.*?) as (\\w+)', arg)
if (not m):
raise template.TemplateSyntaxError, ('... | null | null | null | any number of latest posts
| codeqa | @register tagdef get latest posts parser token try tag name arg token contents split None 1 except Value Error raise template Template Syntax Error '%stagrequiresarguments' % token contents split [0 ] m re search ' *? as \\w+ ' arg if not m raise template Template Syntax Error '%staghadinvalidarguments' % tag name form... | null | null | null | null | Question:
What does the code get ?
Code:
@register.tag
def get_latest_posts(parser, token):
try:
(tag_name, arg) = token.contents.split(None, 1)
except ValueError:
raise template.TemplateSyntaxError, ('%s tag requires arguments' % token.contents.split()[0])
m = re.search('(.*?) as (\\w+)', arg)
if (not... |
null | null | null | What does the code finish for an instance ?
| def action_finish(context, values):
return IMPL.action_finish(context, values)
| null | null | null | an action
| codeqa | def action finish context values return IMPL action finish context values
| null | null | null | null | Question:
What does the code finish for an instance ?
Code:
def action_finish(context, values):
return IMPL.action_finish(context, values)
|
null | null | null | For what purpose does the code finish an action ?
| def action_finish(context, values):
return IMPL.action_finish(context, values)
| null | null | null | for an instance
| codeqa | def action finish context values return IMPL action finish context values
| null | null | null | null | Question:
For what purpose does the code finish an action ?
Code:
def action_finish(context, values):
return IMPL.action_finish(context, values)
|
null | null | null | What does the code ask for their password ?
| def authorization_headers(username, server):
if (not username):
if ('AUTOTEST_USER' in os.environ):
username = os.environ['AUTOTEST_USER']
else:
username = getpass.getuser()
password = getpass.getpass(('Enter the password for %s: ' % username))
base64string = base64.encodestring(('%s:%s' % (username, ... | null | null | null | the user
| codeqa | def authorization headers username server if not username if 'AUTOTEST USER' in os environ username os environ['AUTOTEST USER']else username getpass getuser password getpass getpass ' Enterthepasswordfor%s ' % username base 64 string base 64 encodestring '%s %s' % username password [ -1 ]return {'AUTHORIZATION' ' Basic... | null | null | null | null | Question:
What does the code ask for their password ?
Code:
def authorization_headers(username, server):
if (not username):
if ('AUTOTEST_USER' in os.environ):
username = os.environ['AUTOTEST_USER']
else:
username = getpass.getuser()
password = getpass.getpass(('Enter the password for %s: ' % usern... |
null | null | null | What does the code rotate randomly or non - randomly ?
| def rotation(x, rg=20, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
if is_random:
theta = ((np.pi / 180) * np.random.uniform((- rg), rg))
else:
theta = ((np.pi / 180) * rg)
rotation_matrix = np.array([[np.cos(theta), (- np.sin(theta)), 0], [np.sin(theta), np.cos(the... | null | null | null | an image
| codeqa | def rotation x rg 20 is random False row index 0 col index 1 channel index 2 fill mode 'nearest' cval 0 0 if is random theta np pi / 180 * np random uniform - rg rg else theta np pi / 180 * rg rotation matrix np array [[np cos theta - np sin theta 0] [np sin theta np cos theta 0] [0 0 1]] h w x shape[row index] x shape... | null | null | null | null | Question:
What does the code rotate randomly or non - randomly ?
Code:
def rotation(x, rg=20, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
if is_random:
theta = ((np.pi / 180) * np.random.uniform((- rg), rg))
else:
theta = ((np.pi / 180) * rg)
rotation_matrix = ... |
null | null | null | How does the code rotate an image ?
| def rotation(x, rg=20, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
if is_random:
theta = ((np.pi / 180) * np.random.uniform((- rg), rg))
else:
theta = ((np.pi / 180) * rg)
rotation_matrix = np.array([[np.cos(theta), (- np.sin(theta)), 0], [np.sin(theta), np.cos(the... | null | null | null | randomly or non - randomly
| codeqa | def rotation x rg 20 is random False row index 0 col index 1 channel index 2 fill mode 'nearest' cval 0 0 if is random theta np pi / 180 * np random uniform - rg rg else theta np pi / 180 * rg rotation matrix np array [[np cos theta - np sin theta 0] [np sin theta np cos theta 0] [0 0 1]] h w x shape[row index] x shape... | null | null | null | null | Question:
How does the code rotate an image ?
Code:
def rotation(x, rg=20, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
if is_random:
theta = ((np.pi / 180) * np.random.uniform((- rg), rg))
else:
theta = ((np.pi / 180) * rg)
rotation_matrix = np.array([[np.cos(t... |
null | null | null | What does the code execute from a string buffer ?
| def execute_string(buf, **kw):
fp = StringIO(buf)
kw['source'] = ['<string buffer>']
if (not kw.has_key('no_reset')):
kw['no_reset'] = True
_execute_script(fp, **kw)
| null | null | null | commands
| codeqa | def execute string buf **kw fp String IO buf kw['source'] ['<stringbuffer>']if not kw has key 'no reset' kw['no reset'] True execute script fp **kw
| null | null | null | null | Question:
What does the code execute from a string buffer ?
Code:
def execute_string(buf, **kw):
fp = StringIO(buf)
kw['source'] = ['<string buffer>']
if (not kw.has_key('no_reset')):
kw['no_reset'] = True
_execute_script(fp, **kw)
|
null | null | null | What is described at URL ?
| def odnoklassniki_oauth_sig(data, client_secret):
suffix = md5('{0:s}{1:s}'.format(data['access_token'], client_secret).encode('utf-8')).hexdigest()
check_list = sorted(['{0:s}={1:s}'.format(key, value) for (key, value) in data.items() if (key != 'access_token')])
return md5((''.join(check_list) + suffix).encode('ut... | null | null | null | algorithm
| codeqa | def odnoklassniki oauth sig data client secret suffix md 5 '{ 0 s}{ 1 s}' format data['access token'] client secret encode 'utf- 8 ' hexdigest check list sorted ['{ 0 s} {1 s}' format key value for key value in data items if key 'access token' ] return md 5 '' join check list + suffix encode 'utf- 8 ' hexdigest
| null | null | null | null | Question:
What is described at URL ?
Code:
def odnoklassniki_oauth_sig(data, client_secret):
suffix = md5('{0:s}{1:s}'.format(data['access_token'], client_secret).encode('utf-8')).hexdigest()
check_list = sorted(['{0:s}={1:s}'.format(key, value) for (key, value) in data.items() if (key != 'access_token')])
retur... |
null | null | null | What does the code get ?
| def getVector3(x=0.0, y=0.0, z=0.0):
return Vector3(x, y, z)
| null | null | null | the vector3
| codeqa | def get Vector 3 x 0 0 y 0 0 z 0 0 return Vector 3 x y z
| null | null | null | null | Question:
What does the code get ?
Code:
def getVector3(x=0.0, y=0.0, z=0.0):
return Vector3(x, y, z)
|
null | null | null | Where is the named service enabled ?
| def enabled(name, **kwargs):
cmd = '{0} get {1} status'.format(_cmd(), name)
if (not __salt__['cmd.retcode'](cmd)):
flags = _get_flags(**kwargs)
cur_flags = __salt__['cmd.run_stdout']('{0} get {1} flags'.format(_cmd(), name))
if (format(flags) == format(cur_flags)):
return True
if (not flags):
def... | null | null | null | at boot
| codeqa | def enabled name **kwargs cmd '{ 0 }get{ 1 }status' format cmd name if not salt ['cmd retcode'] cmd flags get flags **kwargs cur flags salt ['cmd run stdout'] '{ 0 }get{ 1 }flags' format cmd name if format flags format cur flags return Trueif not flags def flags salt ['cmd run stdout'] '{ 0 }getdef{ 1 }flags' format cm... | null | null | null | null | Question:
Where is the named service enabled ?
Code:
def enabled(name, **kwargs):
cmd = '{0} get {1} status'.format(_cmd(), name)
if (not __salt__['cmd.retcode'](cmd)):
flags = _get_flags(**kwargs)
cur_flags = __salt__['cmd.run_stdout']('{0} get {1} flags'.format(_cmd(), name))
if (format(flags) == fo... |
null | null | null | What is enabled at boot ?
| def enabled(name, **kwargs):
cmd = '{0} get {1} status'.format(_cmd(), name)
if (not __salt__['cmd.retcode'](cmd)):
flags = _get_flags(**kwargs)
cur_flags = __salt__['cmd.run_stdout']('{0} get {1} flags'.format(_cmd(), name))
if (format(flags) == format(cur_flags)):
return True
if (not flags):
def... | null | null | null | the named service
| codeqa | def enabled name **kwargs cmd '{ 0 }get{ 1 }status' format cmd name if not salt ['cmd retcode'] cmd flags get flags **kwargs cur flags salt ['cmd run stdout'] '{ 0 }get{ 1 }flags' format cmd name if format flags format cur flags return Trueif not flags def flags salt ['cmd run stdout'] '{ 0 }getdef{ 1 }flags' format cm... | null | null | null | null | Question:
What is enabled at boot ?
Code:
def enabled(name, **kwargs):
cmd = '{0} get {1} status'.format(_cmd(), name)
if (not __salt__['cmd.retcode'](cmd)):
flags = _get_flags(**kwargs)
cur_flags = __salt__['cmd.run_stdout']('{0} get {1} flags'.format(_cmd(), name))
if (format(flags) == format(cur_fl... |
null | null | null | What does the code add to nova ?
| def flavor_create(name, flavor_id=0, ram=0, disk=0, vcpus=1, profile=None):
conn = _auth(profile)
return conn.flavor_create(name, flavor_id, ram, disk, vcpus)
| null | null | null | a flavor
| codeqa | def flavor create name flavor id 0 ram 0 disk 0 vcpus 1 profile None conn auth profile return conn flavor create name flavor id ram disk vcpus
| null | null | null | null | Question:
What does the code add to nova ?
Code:
def flavor_create(name, flavor_id=0, ram=0, disk=0, vcpus=1, profile=None):
conn = _auth(profile)
return conn.flavor_create(name, flavor_id, ram, disk, vcpus)
|
null | null | null | What should be placed in the path example where ?
| def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if __salt__['win_path.exists'](name):
ret['changes']['removed'] = name
else:
r... | null | null | null | the directory
| codeqa | def absent name ret {'name' name 'result' True 'changes' {} 'comment' ''}local Path os environ['PATH'] split os pathsep if name in local Path local Path remove name os environ['PATH'] os pathsep join local Path if salt ['win path exists'] name ret['changes']['removed'] nameelse ret['comment'] '{ 0 }isnotinthe PATH' for... | null | null | null | null | Question:
What should be placed in the path example where ?
Code:
def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if __salt__['... |
null | null | null | Where should the directory be placed in the path example ?
| def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if __salt__['win_path.exists'](name):
ret['changes']['removed'] = name
else:
r... | null | null | null | where
| codeqa | def absent name ret {'name' name 'result' True 'changes' {} 'comment' ''}local Path os environ['PATH'] split os pathsep if name in local Path local Path remove name os environ['PATH'] os pathsep join local Path if salt ['win path exists'] name ret['changes']['removed'] nameelse ret['comment'] '{ 0 }isnotinthe PATH' for... | null | null | null | null | Question:
Where should the directory be placed in the path example ?
Code:
def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if _... |
null | null | null | What does the code remove from the system path index ?
| def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if __salt__['win_path.exists'](name):
ret['changes']['removed'] = name
else:
r... | null | null | null | the directory
| codeqa | def absent name ret {'name' name 'result' True 'changes' {} 'comment' ''}local Path os environ['PATH'] split os pathsep if name in local Path local Path remove name os environ['PATH'] os pathsep join local Path if salt ['win path exists'] name ret['changes']['removed'] nameelse ret['comment'] '{ 0 }isnotinthe PATH' for... | null | null | null | null | Question:
What does the code remove from the system path index ?
Code:
def absent(name):
ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''}
localPath = os.environ['PATH'].split(os.pathsep)
if (name in localPath):
localPath.remove(name)
os.environ['PATH'] = os.pathsep.join(localPath)
if __sal... |
null | null | null | What starts the argument list of a function call ?
| def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) and (text in '([') and (start != prev_end) and (prev_type == ... | null | null | null | the open parenthesis
| codeqa | def whitespace before parameters logical line tokens prev type tokens[ 0 ][ 0 ]prev text tokens[ 0 ][ 1 ]prev end tokens[ 0 ][ 3 ]for index in range 1 len tokens token type text start end line tokens[index]if token type tokenize OP and text in ' [' and start prev end and prev type tokenize NAME and index < 2 or tokens[... | null | null | null | null | Question:
What starts the argument list of a function call ?
Code:
def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tok... |
null | null | null | Where do extraneous whitespace avoid ?
| def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) and (text in '([') and (start != prev_end) and (prev_type == ... | null | null | null | in the following situations
| codeqa | def whitespace before parameters logical line tokens prev type tokens[ 0 ][ 0 ]prev text tokens[ 0 ][ 1 ]prev end tokens[ 0 ][ 3 ]for index in range 1 len tokens token type text start end line tokens[index]if token type tokenize OP and text in ' [' and start prev end and prev type tokenize NAME and index < 2 or tokens[... | null | null | null | null | Question:
Where do extraneous whitespace avoid ?
Code:
def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) an... |
null | null | null | What avoids in the following situations ?
| def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) and (text in '([') and (start != prev_end) and (prev_type == ... | null | null | null | extraneous whitespace
| codeqa | def whitespace before parameters logical line tokens prev type tokens[ 0 ][ 0 ]prev text tokens[ 0 ][ 1 ]prev end tokens[ 0 ][ 3 ]for index in range 1 len tokens token type text start end line tokens[index]if token type tokenize OP and text in ' [' and start prev end and prev type tokenize NAME and index < 2 or tokens[... | null | null | null | null | Question:
What avoids in the following situations ?
Code:
def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP)... |
null | null | null | What does the open parenthesis start ?
| def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) and (text in '([') and (start != prev_end) and (prev_type == ... | null | null | null | the argument list of a function call
| codeqa | def whitespace before parameters logical line tokens prev type tokens[ 0 ][ 0 ]prev text tokens[ 0 ][ 1 ]prev end tokens[ 0 ][ 3 ]for index in range 1 len tokens token type text start end line tokens[index]if token type tokenize OP and text in ' [' and start prev end and prev type tokenize NAME and index < 2 or tokens[... | null | null | null | null | Question:
What does the open parenthesis start ?
Code:
def whitespace_before_parameters(logical_line, tokens):
prev_type = tokens[0][0]
prev_text = tokens[0][1]
prev_end = tokens[0][3]
for index in range(1, len(tokens)):
(token_type, text, start, end, line) = tokens[index]
if ((token_type == tokenize.OP) an... |
null | null | null | How do of a distance matrix assemble from component vectors ?
| def parallel_beta_diversity_process_run_results_f(f):
for line in f:
fields = line.strip().split(' DCTB ')
dm_components = fields[:(-1)]
output_fp = fields[(-1)]
dm = assemble_distance_matrix(map(open, dm_components))
output_f = open(output_fp, 'w')
output_f.write(dm)
output_f.close()
return True
| null | null | null | re
| codeqa | def parallel beta diversity process run results f f for line in f fields line strip split ' DCTB ' dm components fields[ -1 ]output fp fields[ -1 ]dm assemble distance matrix map open dm components output f open output fp 'w' output f write dm output f close return True
| null | null | null | null | Question:
How do of a distance matrix assemble from component vectors ?
Code:
def parallel_beta_diversity_process_run_results_f(f):
for line in f:
fields = line.strip().split(' DCTB ')
dm_components = fields[:(-1)]
output_fp = fields[(-1)]
dm = assemble_distance_matrix(map(open, dm_components))
output_f ... |
null | null | null | What does that present ?
| @ssl_required
@anonymous_csrf
@mobile_template('users/{mobile/}pw_reset_confirm.html')
def password_reset_confirm(request, template, uidb36=None, token=None):
try:
uid_int = base36_to_int(uidb36)
except ValueError:
raise Http404
user = get_object_or_404(User, id=uid_int)
context = {}
if default_token_generator... | null | null | null | a form for entering a new password
| codeqa | @ssl required@anonymous csrf@mobile template 'users/{mobile/}pw reset confirm html' def password reset confirm request template uidb 36 None token None try uid int base 36 to int uidb 36 except Value Error raise Http 404 user get object or 404 User id uid int context {}if default token generator check token user token ... | null | null | null | null | Question:
What does that present ?
Code:
@ssl_required
@anonymous_csrf
@mobile_template('users/{mobile/}pw_reset_confirm.html')
def password_reset_confirm(request, template, uidb36=None, token=None):
try:
uid_int = base36_to_int(uidb36)
except ValueError:
raise Http404
user = get_object_or_404(User, id=uid_i... |
null | null | null | What does the code add ?
| def addXIntersections(loop, xIntersections, y):
for pointIndex in xrange(len(loop)):
pointFirst = loop[pointIndex]
pointSecond = loop[((pointIndex + 1) % len(loop))]
xIntersection = getXIntersectionIfExists(pointFirst, pointSecond, y)
if (xIntersection != None):
xIntersections.append(xIntersection)
| null | null | null | the x intersections for a loop
| codeqa | def add X Intersections loop x Intersections y for point Index in xrange len loop point First loop[point Index]point Second loop[ point Index + 1 % len loop ]x Intersection get X Intersection If Exists point First point Second y if x Intersection None x Intersections append x Intersection
| null | null | null | null | Question:
What does the code add ?
Code:
def addXIntersections(loop, xIntersections, y):
for pointIndex in xrange(len(loop)):
pointFirst = loop[pointIndex]
pointSecond = loop[((pointIndex + 1) % len(loop))]
xIntersection = getXIntersectionIfExists(pointFirst, pointSecond, y)
if (xIntersection != None):
... |
null | null | null | What does the code take ?
| def _make_array(val, copy=False):
val = np.array(val, copy=copy, subok=True)
if (not ((val.dtype == np.float64) or (val.dtype.kind in u'OSUa'))):
val = np.asanyarray(val, dtype=np.float64)
return val
| null | null | null | val
| codeqa | def make array val copy False val np array val copy copy subok True if not val dtype np float 64 or val dtype kind in u'OS Ua' val np asanyarray val dtype np float 64 return val
| null | null | null | null | Question:
What does the code take ?
Code:
def _make_array(val, copy=False):
val = np.array(val, copy=copy, subok=True)
if (not ((val.dtype == np.float64) or (val.dtype.kind in u'OSUa'))):
val = np.asanyarray(val, dtype=np.float64)
return val
|
null | null | null | What does the code download ?
| def pull_raw(url, name, verify=False):
return _pull_image('raw', url, name, verify=verify)
| null | null | null | a
| codeqa | def pull raw url name verify False return pull image 'raw' url name verify verify
| null | null | null | null | Question:
What does the code download ?
Code:
def pull_raw(url, name, verify=False):
return _pull_image('raw', url, name, verify=verify)
|
null | null | null | How did the code weight ?
| def getNormalWeighted(begin, center, end):
return (center - begin).cross((end - center))
| null | null | null | normal
| codeqa | def get Normal Weighted begin center end return center - begin cross end - center
| null | null | null | null | Question:
How did the code weight ?
Code:
def getNormalWeighted(begin, center, end):
return (center - begin).cross((end - center))
|
null | null | null | What does the code make ?
| def xkcd_palette(colors):
palette = [xkcd_rgb[name] for name in colors]
return color_palette(palette, len(palette))
| null | null | null | a palette with color names from the xkcd color survey
| codeqa | def xkcd palette colors palette [xkcd rgb[name] for name in colors]return color palette palette len palette
| null | null | null | null | Question:
What does the code make ?
Code:
def xkcd_palette(colors):
palette = [xkcd_rgb[name] for name in colors]
return color_palette(palette, len(palette))
|
null | null | null | What does the code outline ?
| def getCraftedText(fileName, text='', repository=None):
return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository)
| null | null | null | the file or text
| codeqa | def get Crafted Text file Name text '' repository None return get Crafted Text From Text archive get Text If Empty file Name text repository
| null | null | null | null | Question:
What does the code outline ?
Code:
def getCraftedText(fileName, text='', repository=None):
return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), repository)
|
null | null | null | What does the code run in a somewhat controlled environment ?
| def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _setup_distribution
_setup_stop_after = stop_after
save_argv = sys.argv
g = {'__f... | null | null | null | a setup script
| codeqa | def run setup script name script args None stop after 'run' if stop after not in 'init' 'config' 'commandline' 'run' raise Value Error "invalidvaluefor'stop after' %r" % stop after global setup stop after setup distribution setup stop after stop aftersave argv sys argvg {' file ' script name}l {}try try sys argv[ 0 ] s... | null | null | null | null | Question:
What does the code run in a somewhat controlled environment ?
Code:
def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _s... |
null | null | null | By how much did environment control ?
| def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _setup_distribution
_setup_stop_after = stop_after
save_argv = sys.argv
g = {'__f... | null | null | null | somewhat
| codeqa | def run setup script name script args None stop after 'run' if stop after not in 'init' 'config' 'commandline' 'run' raise Value Error "invalidvaluefor'stop after' %r" % stop after global setup stop after setup distribution setup stop after stop aftersave argv sys argvg {' file ' script name}l {}try try sys argv[ 0 ] s... | null | null | null | null | Question:
By how much did environment control ?
Code:
def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _setup_distribution
_setu... |
null | null | null | Where does the code run a setup script ?
| def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _setup_distribution
_setup_stop_after = stop_after
save_argv = sys.argv
g = {'__f... | null | null | null | in a somewhat controlled environment
| codeqa | def run setup script name script args None stop after 'run' if stop after not in 'init' 'config' 'commandline' 'run' raise Value Error "invalidvaluefor'stop after' %r" % stop after global setup stop after setup distribution setup stop after stop aftersave argv sys argvg {' file ' script name}l {}try try sys argv[ 0 ] s... | null | null | null | null | Question:
Where does the code run a setup script ?
Code:
def run_setup(script_name, script_args=None, stop_after='run'):
if (stop_after not in ('init', 'config', 'commandline', 'run')):
raise ValueError(("invalid value for 'stop_after': %r" % (stop_after,)))
global _setup_stop_after, _setup_distribution
_s... |
null | null | null | What is yielding keys and values ?
| def iter_multi_items(mapping):
if isinstance(mapping, MultiDict):
for item in iteritems(mapping, multi=True):
(yield item)
elif isinstance(mapping, dict):
for (key, value) in iteritems(mapping):
if isinstance(value, (tuple, list)):
for value in value:
(yield (key, value))
else:
(yield (key, ... | null | null | null | a mapping
| codeqa | def iter multi items mapping if isinstance mapping Multi Dict for item in iteritems mapping multi True yield item elif isinstance mapping dict for key value in iteritems mapping if isinstance value tuple list for value in value yield key value else yield key value else for item in mapping yield item
| null | null | null | null | Question:
What is yielding keys and values ?
Code:
def iter_multi_items(mapping):
if isinstance(mapping, MultiDict):
for item in iteritems(mapping, multi=True):
(yield item)
elif isinstance(mapping, dict):
for (key, value) in iteritems(mapping):
if isinstance(value, (tuple, list)):
for value in valu... |
null | null | null | Till when does the most basic call work if applied to a method ?
| def test_basic_call_on_method_coroutine():
class API(object, ):
@hug.call()
@asyncio.coroutine
def hello_world(self=None):
return 'Hello World!'
api_instance = API()
assert api_instance.hello_world.interface.http
assert (loop.run_until_complete(api_instance.hello_world()) == 'Hello World!')
assert (hug.... | null | null | null | still
| codeqa | def test basic call on method coroutine class API object @hug call @asyncio coroutinedef hello world self None return ' Hello World 'api instance API assert api instance hello world interface httpassert loop run until complete api instance hello world ' Hello World ' assert hug test get api '/hello world' data ' Hello ... | null | null | null | null | Question:
Till when does the most basic call work if applied to a method ?
Code:
def test_basic_call_on_method_coroutine():
class API(object, ):
@hug.call()
@asyncio.coroutine
def hello_world(self=None):
return 'Hello World!'
api_instance = API()
assert api_instance.hello_world.interface.http
assert (... |
null | null | null | What spawns a new interactive python shell ?
| def make_shell(init_func=None, banner=None, use_ipython=True):
if (banner is None):
banner = 'Interactive Werkzeug Shell'
if (init_func is None):
init_func = dict
def action(ipython=use_ipython):
'Start a new interactive python session.'
namespace = init_func()
if ipython:
try:
try:
from... | null | null | null | an action callback
| codeqa | def make shell init func None banner None use ipython True if banner is None banner ' Interactive Werkzeug Shell'if init func is None init func dictdef action ipython use ipython ' Startanewinteractivepythonsession 'namespace init func if ipython try try from I Python frontend terminal embed import Interactive Shell Em... | null | null | null | null | Question:
What spawns a new interactive python shell ?
Code:
def make_shell(init_func=None, banner=None, use_ipython=True):
if (banner is None):
banner = 'Interactive Werkzeug Shell'
if (init_func is None):
init_func = dict
def action(ipython=use_ipython):
'Start a new interactive python session.'
... |
null | null | null | What does an action callback spawn ?
| def make_shell(init_func=None, banner=None, use_ipython=True):
if (banner is None):
banner = 'Interactive Werkzeug Shell'
if (init_func is None):
init_func = dict
def action(ipython=use_ipython):
'Start a new interactive python session.'
namespace = init_func()
if ipython:
try:
try:
from... | null | null | null | a new interactive python shell
| codeqa | def make shell init func None banner None use ipython True if banner is None banner ' Interactive Werkzeug Shell'if init func is None init func dictdef action ipython use ipython ' Startanewinteractivepythonsession 'namespace init func if ipython try try from I Python frontend terminal embed import Interactive Shell Em... | null | null | null | null | Question:
What does an action callback spawn ?
Code:
def make_shell(init_func=None, banner=None, use_ipython=True):
if (banner is None):
banner = 'Interactive Werkzeug Shell'
if (init_func is None):
init_func = dict
def action(ipython=use_ipython):
'Start a new interactive python session.'
namespa... |
null | null | null | What does the code send to the admins ?
| def mail_admins(subject, message, fail_silently=False):
send_mail((settings.EMAIL_SUBJECT_PREFIX + subject), message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], fail_silently)
| null | null | null | a message
| codeqa | def mail admins subject message fail silently False send mail settings EMAIL SUBJECT PREFIX + subject message settings SERVER EMAIL [a[ 1 ] for a in settings ADMINS] fail silently
| null | null | null | null | Question:
What does the code send to the admins ?
Code:
def mail_admins(subject, message, fail_silently=False):
send_mail((settings.EMAIL_SUBJECT_PREFIX + subject), message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS], fail_silently)
|
null | null | null | How do the topologies sort ?
| def _sort_possible_cpu_topologies(possible, wanttopology):
scores = collections.defaultdict(list)
for topology in possible:
score = _score_cpu_topology(topology, wanttopology)
scores[score].append(topology)
desired = []
desired.extend(scores[3])
desired.extend(scores[2])
desired.extend(scores[1])
desired.ext... | null | null | null | in order of preference
| codeqa | def sort possible cpu topologies possible wanttopology scores collections defaultdict list for topology in possible score score cpu topology topology wanttopology scores[score] append topology desired []desired extend scores[ 3 ] desired extend scores[ 2 ] desired extend scores[ 1 ] desired extend scores[ 0 ] return de... | null | null | null | null | Question:
How do the topologies sort ?
Code:
def _sort_possible_cpu_topologies(possible, wanttopology):
scores = collections.defaultdict(list)
for topology in possible:
score = _score_cpu_topology(topology, wanttopology)
scores[score].append(topology)
desired = []
desired.extend(scores[3])
desired.extend(s... |
null | null | null | How do a file transfer ?
| def ftp_put_command(connection, local_path, remote_dir):
try:
ftp = ftplib.FTP(host=connection.host, user=connection.username, passwd=connection.password)
ftp.cwd(remote_dir)
name = os.path.split(local_path)[1]
f = open(local_path, 'rb')
ftp.storbinary(('STOR ' + name), f)
f.close()
ftp.close()
except ... | null | null | null | via ftp
| codeqa | def ftp put command connection local path remote dir try ftp ftplib FTP host connection host user connection username passwd connection password ftp cwd remote dir name os path split local path [1 ]f open local path 'rb' ftp storbinary 'STOR' + name f f close ftp close except Exception LOG error ' Filetransferto Power ... | null | null | null | null | Question:
How do a file transfer ?
Code:
def ftp_put_command(connection, local_path, remote_dir):
try:
ftp = ftplib.FTP(host=connection.host, user=connection.username, passwd=connection.password)
ftp.cwd(remote_dir)
name = os.path.split(local_path)[1]
f = open(local_path, 'rb')
ftp.storbinary(('STOR ' +... |
null | null | null | How do formatter class register ?
| def register_as(name, formatter_class):
if (not isinstance(name, six.string_types)):
warnings.warn(('Use parameter ordering: name, formatter_class (for: %s)' % formatter_class))
_formatter_class = name
name = formatter_class
formatter_class = _formatter_class
if isinstance(formatter_class, six.string_ty... | null | null | null | with given name
| codeqa | def register as name formatter class if not isinstance name six string types warnings warn ' Useparameterordering name formatter class for %s ' % formatter class formatter class namename formatter classformatter class formatter classif isinstance formatter class six string types scoped formatter class name formatter cl... | null | null | null | null | Question:
How do formatter class register ?
Code:
def register_as(name, formatter_class):
if (not isinstance(name, six.string_types)):
warnings.warn(('Use parameter ordering: name, formatter_class (for: %s)' % formatter_class))
_formatter_class = name
name = formatter_class
formatter_class = _formatt... |
null | null | null | What should the last line have ?
| def missing_newline(physical_line):
if (physical_line.rstrip() == physical_line):
return (len(physical_line), 'W292 no newline at end of file')
| null | null | null | a newline
| codeqa | def missing newline physical line if physical line rstrip physical line return len physical line 'W 292 nonewlineatendoffile'
| null | null | null | null | Question:
What should the last line have ?
Code:
def missing_newline(physical_line):
if (physical_line.rstrip() == physical_line):
return (len(physical_line), 'W292 no newline at end of file')
|
null | null | null | What should have a newline ?
| def missing_newline(physical_line):
if (physical_line.rstrip() == physical_line):
return (len(physical_line), 'W292 no newline at end of file')
| null | null | null | the last line
| codeqa | def missing newline physical line if physical line rstrip physical line return len physical line 'W 292 nonewlineatendoffile'
| null | null | null | null | Question:
What should have a newline ?
Code:
def missing_newline(physical_line):
if (physical_line.rstrip() == physical_line):
return (len(physical_line), 'W292 no newline at end of file')
|
null | null | null | How does the code get instance type ?
| def flavor_get_by_name(context, name):
return IMPL.flavor_get_by_name(context, name)
| null | null | null | by name
| codeqa | def flavor get by name context name return IMPL flavor get by name context name
| null | null | null | null | Question:
How does the code get instance type ?
Code:
def flavor_get_by_name(context, name):
return IMPL.flavor_get_by_name(context, name)
|
null | null | null | What does the code get by name ?
| def flavor_get_by_name(context, name):
return IMPL.flavor_get_by_name(context, name)
| null | null | null | instance type
| codeqa | def flavor get by name context name return IMPL flavor get by name context name
| null | null | null | null | Question:
What does the code get by name ?
Code:
def flavor_get_by_name(context, name):
return IMPL.flavor_get_by_name(context, name)
|
null | null | null | What does the code create ?
| @given(u'a new working directory')
def step_a_new_working_directory(context):
command_util.ensure_context_attribute_exists(context, 'workdir', None)
command_util.ensure_workdir_exists(context)
shutil.rmtree(context.workdir, ignore_errors=True)
command_util.ensure_workdir_exists(context)
| null | null | null | a new
| codeqa | @given u'anewworkingdirectory' def step a new working directory context command util ensure context attribute exists context 'workdir' None command util ensure workdir exists context shutil rmtree context workdir ignore errors True command util ensure workdir exists context
| null | null | null | null | Question:
What does the code create ?
Code:
@given(u'a new working directory')
def step_a_new_working_directory(context):
command_util.ensure_context_attribute_exists(context, 'workdir', None)
command_util.ensure_workdir_exists(context)
shutil.rmtree(context.workdir, ignore_errors=True)
command_util.ensure_w... |
null | null | null | What does the code get ?
| def getFloatDefaultByDictionary(defaultFloat, dictionary, key):
evaluatedFloat = None
if (key in dictionary):
evaluatedFloat = getFloatFromValue(dictionary[key])
if (evaluatedFloat == None):
return defaultFloat
return evaluatedFloat
| null | null | null | the value as a float
| codeqa | def get Float Default By Dictionary default Float dictionary key evaluated Float Noneif key in dictionary evaluated Float get Float From Value dictionary[key] if evaluated Float None return default Floatreturn evaluated Float
| null | null | null | null | Question:
What does the code get ?
Code:
def getFloatDefaultByDictionary(defaultFloat, dictionary, key):
evaluatedFloat = None
if (key in dictionary):
evaluatedFloat = getFloatFromValue(dictionary[key])
if (evaluatedFloat == None):
return defaultFloat
return evaluatedFloat
|
null | null | null | What does the code get from name ?
| def getfqdn(name=''):
name = name.strip()
if ((not name) or (name == '0.0.0.0')):
name = gethostname()
try:
(hostname, aliases, ipaddrs) = gethostbyaddr(name)
except error:
pass
else:
aliases.insert(0, hostname)
for name in aliases:
if isinstance(name, bytes):
if ('.' in name):
break
elif ... | null | null | null | fully qualified domain name
| codeqa | def getfqdn name '' name name strip if not name or name '0 0 0 0' name gethostname try hostname aliases ipaddrs gethostbyaddr name except error passelse aliases insert 0 hostname for name in aliases if isinstance name bytes if ' ' in name breakelif ' ' in name breakelse name hostnamereturn name
| null | null | null | null | Question:
What does the code get from name ?
Code:
def getfqdn(name=''):
name = name.strip()
if ((not name) or (name == '0.0.0.0')):
name = gethostname()
try:
(hostname, aliases, ipaddrs) = gethostbyaddr(name)
except error:
pass
else:
aliases.insert(0, hostname)
for name in aliases:
if isinstance(... |
null | null | null | What does the code repair ?
| def db_check(name, table=None, **connection_args):
ret = []
if (table is None):
tables = db_tables(name, **connection_args)
for table in tables:
log.info("Checking table '{0}' in db '{1}'..".format(name, table))
ret.append(__check_table(name, table, **connection_args))
else:
log.info("Checking tabl... | null | null | null | the full database or just a given table
| codeqa | def db check name table None **connection args ret []if table is None tables db tables name **connection args for table in tables log info " Checkingtable'{ 0 }'indb'{ 1 }' " format name table ret append check table name table **connection args else log info " Checkingtable'{ 0 }'indb'{ 1 }' " format name table ret che... | null | null | null | null | Question:
What does the code repair ?
Code:
def db_check(name, table=None, **connection_args):
ret = []
if (table is None):
tables = db_tables(name, **connection_args)
for table in tables:
log.info("Checking table '{0}' in db '{1}'..".format(name, table))
ret.append(__check_table(name, table, **con... |
null | null | null | What do files have ?
| def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath, words):
filesWithFileTypesRecursively.append... | null | null | null | a given file type
| codeqa | def get Files With File Types Without Words Recursively file Types words [] file In Directory '' files With File Types Recursively []for file Path in get File Paths Recursively file In Directory for file Type in file Types if is File With File Type Without Words file Type file Path words files With File Types Recursive... | null | null | null | null | Question:
What do files have ?
Code:
def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath, words):... |
null | null | null | What does the code get which have a given file type recursively ?
| def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath, words):
filesWithFileTypesRecursively.append... | null | null | null | files
| codeqa | def get Files With File Types Without Words Recursively file Types words [] file In Directory '' files With File Types Recursively []for file Path in get File Paths Recursively file In Directory for file Type in file Types if is File With File Type Without Words file Type file Path words files With File Types Recursive... | null | null | null | null | Question:
What does the code get which have a given file type recursively ?
Code:
def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFil... |
null | null | null | How does the code get files which have a given file type ?
| def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath, words):
filesWithFileTypesRecursively.append... | null | null | null | recursively
| codeqa | def get Files With File Types Without Words Recursively file Types words [] file In Directory '' files With File Types Recursively []for file Path in get File Paths Recursively file In Directory for file Type in file Types if is File With File Type Without Words file Type file Path words files With File Types Recursive... | null | null | null | null | Question:
How does the code get files which have a given file type ?
Code:
def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWi... |
null | null | null | What have a given file type ?
| def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath, words):
filesWithFileTypesRecursively.append... | null | null | null | files
| codeqa | def get Files With File Types Without Words Recursively file Types words [] file In Directory '' files With File Types Recursively []for file Path in get File Paths Recursively file In Directory for file Type in file Types if is File With File Type Without Words file Type file Path words files With File Types Recursive... | null | null | null | null | Question:
What have a given file type ?
Code:
def getFilesWithFileTypesWithoutWordsRecursively(fileTypes, words=[], fileInDirectory=''):
filesWithFileTypesRecursively = []
for filePath in getFilePathsRecursively(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, filePath... |
null | null | null | How did page set ?
| @treeio_login_required
@module_admin_required()
def setup(request, response_format='html'):
modules = Module.objects.all()
for module in modules:
if (module.name in ('treeio.projects', 'treeio.sales', 'treeio.services')):
module.major = True
else:
module.major = False
context = {'modules': modules}
return... | null | null | null | quick
| codeqa | @treeio login required@module admin required def setup request response format 'html' modules Module objects all for module in modules if module name in 'treeio projects' 'treeio sales' 'treeio services' module major Trueelse module major Falsecontext {'modules' modules}return render to response 'core/administration/se... | null | null | null | null | Question:
How did page set ?
Code:
@treeio_login_required
@module_admin_required()
def setup(request, response_format='html'):
modules = Module.objects.all()
for module in modules:
if (module.name in ('treeio.projects', 'treeio.sales', 'treeio.services')):
module.major = True
else:
module.major = False
... |
null | null | null | Where does the code open the given response ?
| def open_in_browser(response, _openfunc=webbrowser.open):
if (not isinstance(response, HtmlResponse)):
raise TypeError(('Unsupported response type: %s' % response.__class__.__name__))
body = response.body
if ('<base' not in body):
body = body.replace('<head>', ('<head><base href="%s">' % response.url))
(fd,... | null | null | null | in a local web browser
| codeqa | def open in browser response openfunc webbrowser open if not isinstance response Html Response raise Type Error ' Unsupportedresponsetype %s' % response class name body response bodyif '<base' not in body body body replace '<head>' '<head><basehref "%s">' % response url fd fname tempfile mkstemp ' html' os write fd bod... | null | null | null | null | Question:
Where does the code open the given response ?
Code:
def open_in_browser(response, _openfunc=webbrowser.open):
if (not isinstance(response, HtmlResponse)):
raise TypeError(('Unsupported response type: %s' % response.__class__.__name__))
body = response.body
if ('<base' not in body):
body = body.r... |
null | null | null | What does the code open in a local web browser ?
| def open_in_browser(response, _openfunc=webbrowser.open):
if (not isinstance(response, HtmlResponse)):
raise TypeError(('Unsupported response type: %s' % response.__class__.__name__))
body = response.body
if ('<base' not in body):
body = body.replace('<head>', ('<head><base href="%s">' % response.url))
(fd,... | null | null | null | the given response
| codeqa | def open in browser response openfunc webbrowser open if not isinstance response Html Response raise Type Error ' Unsupportedresponsetype %s' % response class name body response bodyif '<base' not in body body body replace '<head>' '<head><basehref "%s">' % response url fd fname tempfile mkstemp ' html' os write fd bod... | null | null | null | null | Question:
What does the code open in a local web browser ?
Code:
def open_in_browser(response, _openfunc=webbrowser.open):
if (not isinstance(response, HtmlResponse)):
raise TypeError(('Unsupported response type: %s' % response.__class__.__name__))
body = response.body
if ('<base' not in body):
body = bod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.