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 require ?
| def login_required(func, login_url=None, redirect=REDIRECT_FIELD_NAME, only_active=True):
if only_active:
redirect_func = (lambda u: (not (u.is_authenticated() and u.is_active)))
else:
redirect_func = (lambda u: (not u.is_authenticated()))
redirect_url_func = (lambda : login_url)
return user_access_decorator(re... | null | null | null | that the user is logged in
| codeqa | def login required func login url None redirect REDIRECT FIELD NAME only active True if only active redirect func lambda u not u is authenticated and u is active else redirect func lambda u not u is authenticated redirect url func lambda login url return user access decorator redirect func redirect field redirect redir... | null | null | null | null | Question:
What does the code require ?
Code:
def login_required(func, login_url=None, redirect=REDIRECT_FIELD_NAME, only_active=True):
if only_active:
redirect_func = (lambda u: (not (u.is_authenticated() and u.is_active)))
else:
redirect_func = (lambda u: (not u.is_authenticated()))
redirect_url_func = (lam... |
null | null | null | What used to decode a request entity ?
| def decode(encoding=None, default_encoding='utf-8'):
body = cherrypy.request.body
if (encoding is not None):
if (not isinstance(encoding, list)):
encoding = [encoding]
body.attempt_charsets = encoding
elif default_encoding:
if (not isinstance(default_encoding, list)):
default_encoding = [default_encoding... | null | null | null | charsets
| codeqa | def decode encoding None default encoding 'utf- 8 ' body cherrypy request bodyif encoding is not None if not isinstance encoding list encoding [encoding]body attempt charsets encodingelif default encoding if not isinstance default encoding list default encoding [default encoding]body attempt charsets body attempt chars... | null | null | null | null | Question:
What used to decode a request entity ?
Code:
def decode(encoding=None, default_encoding='utf-8'):
body = cherrypy.request.body
if (encoding is not None):
if (not isinstance(encoding, list)):
encoding = [encoding]
body.attempt_charsets = encoding
elif default_encoding:
if (not isinstance(defaul... |
null | null | null | What does the code get if it exists from the object ?
| def getFromObjectOrXMLElement(xmlElement):
xmlElementMatrix = None
if (xmlElement.object != None):
xmlElementMatrix = xmlElement.object.matrix4X4
else:
xmlElementMatrix = Matrix()
return xmlElementMatrix.getFromXMLElement('matrix.', xmlElement)
| null | null | null | matrix
| codeqa | def get From Object Or XML Element xml Element xml Element Matrix Noneif xml Element object None xml Element Matrix xml Element object matrix 4 X 4 else xml Element Matrix Matrix return xml Element Matrix get From XML Element 'matrix ' xml Element
| null | null | null | null | Question:
What does the code get if it exists from the object ?
Code:
def getFromObjectOrXMLElement(xmlElement):
xmlElementMatrix = None
if (xmlElement.object != None):
xmlElementMatrix = xmlElement.object.matrix4X4
else:
xmlElementMatrix = Matrix()
return xmlElementMatrix.getFromXMLElement('matrix.', xmlEl... |
null | null | null | In which direction does the code get matrix if it exists ?
| def getFromObjectOrXMLElement(xmlElement):
xmlElementMatrix = None
if (xmlElement.object != None):
xmlElementMatrix = xmlElement.object.matrix4X4
else:
xmlElementMatrix = Matrix()
return xmlElementMatrix.getFromXMLElement('matrix.', xmlElement)
| null | null | null | from the object
| codeqa | def get From Object Or XML Element xml Element xml Element Matrix Noneif xml Element object None xml Element Matrix xml Element object matrix 4 X 4 else xml Element Matrix Matrix return xml Element Matrix get From XML Element 'matrix ' xml Element
| null | null | null | null | Question:
In which direction does the code get matrix if it exists ?
Code:
def getFromObjectOrXMLElement(xmlElement):
xmlElementMatrix = None
if (xmlElement.object != None):
xmlElementMatrix = xmlElement.object.matrix4X4
else:
xmlElementMatrix = Matrix()
return xmlElementMatrix.getFromXMLElement('matrix.', ... |
null | null | null | What does the code add ?
| def addCircleIntersectionLoop(circleIntersectionLoop, circleIntersections):
firstCircleIntersection = circleIntersectionLoop[0]
circleIntersectionAhead = firstCircleIntersection
for circleIntersectionIndex in xrange((len(circleIntersections) + 1)):
circleIntersectionAhead = circleIntersectionAhead.getCircleInterse... | null | null | null | a circle intersection loop
| codeqa | def add Circle Intersection Loop circle Intersection Loop circle Intersections first Circle Intersection circle Intersection Loop[ 0 ]circle Intersection Ahead first Circle Intersectionfor circle Intersection Index in xrange len circle Intersections + 1 circle Intersection Ahead circle Intersection Ahead get Circle Int... | null | null | null | null | Question:
What does the code add ?
Code:
def addCircleIntersectionLoop(circleIntersectionLoop, circleIntersections):
firstCircleIntersection = circleIntersectionLoop[0]
circleIntersectionAhead = firstCircleIntersection
for circleIntersectionIndex in xrange((len(circleIntersections) + 1)):
circleIntersectionAhe... |
null | null | null | Where do what s ?
| def _potential_before(i, input_string):
return (((i - 2) >= 0) and (input_string[i] == input_string[(i - 2)]) and (input_string[(i - 1)] not in seps))
| null | null | null | before it
| codeqa | def potential before i input string return i - 2 > 0 and input string[i] input string[ i - 2 ] and input string[ i - 1 ] not in seps
| null | null | null | null | Question:
Where do what s ?
Code:
def _potential_before(i, input_string):
return (((i - 2) >= 0) and (input_string[i] == input_string[(i - 2)]) and (input_string[(i - 1)] not in seps))
|
null | null | null | How does the code get security group models for a project ?
| def _security_group_get_by_names(context, session, project_id, group_names):
query = _security_group_get_query(context, session=session, read_deleted='no', join_rules=False).filter_by(project_id=project_id).filter(models.SecurityGroup.name.in_(group_names))
sg_models = query.all()
if (len(sg_models) == len(group_nam... | null | null | null | by a list of names
| codeqa | def security group get by names context session project id group names query security group get query context session session read deleted 'no' join rules False filter by project id project id filter models Security Group name in group names sg models query all if len sg models len group names return sg modelsgroup nam... | null | null | null | null | Question:
How does the code get security group models for a project ?
Code:
def _security_group_get_by_names(context, session, project_id, group_names):
query = _security_group_get_query(context, session=session, read_deleted='no', join_rules=False).filter_by(project_id=project_id).filter(models.SecurityGroup.name... |
null | null | null | What does the code get by a list of names ?
| def _security_group_get_by_names(context, session, project_id, group_names):
query = _security_group_get_query(context, session=session, read_deleted='no', join_rules=False).filter_by(project_id=project_id).filter(models.SecurityGroup.name.in_(group_names))
sg_models = query.all()
if (len(sg_models) == len(group_nam... | null | null | null | security group models for a project
| codeqa | def security group get by names context session project id group names query security group get query context session session read deleted 'no' join rules False filter by project id project id filter models Security Group name in group names sg models query all if len sg models len group names return sg modelsgroup nam... | null | null | null | null | Question:
What does the code get by a list of names ?
Code:
def _security_group_get_by_names(context, session, project_id, group_names):
query = _security_group_get_query(context, session=session, read_deleted='no', join_rules=False).filter_by(project_id=project_id).filter(models.SecurityGroup.name.in_(group_names... |
null | null | null | What does the code remove from semaphore ?
| def unlock(name, zk_hosts=None, identifier=None, max_concurrency=1, ephemeral_lease=False):
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
if __opts__['test']:
ret['result'] = None
ret['comment'] = 'Released lock if it is here'
return ret
if (identifier is None):
identifier = __grai... | null | null | null | lease
| codeqa | def unlock name zk hosts None identifier None max concurrency 1 ephemeral lease False ret {'name' name 'changes' {} 'result' False 'comment' ''}if opts ['test'] ret['result'] Noneret['comment'] ' Releasedlockifitishere'return retif identifier is None identifier grains ['id']unlocked salt ['zk concurrency unlock'] name ... | null | null | null | null | Question:
What does the code remove from semaphore ?
Code:
def unlock(name, zk_hosts=None, identifier=None, max_concurrency=1, ephemeral_lease=False):
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
if __opts__['test']:
ret['result'] = None
ret['comment'] = 'Released lock if it is her... |
null | null | null | How do string escape ?
| def _pre_yarn_history_unescape(s):
return _PRE_YARN_HISTORY_ESCAPE_RE.sub('\\1', s)
| null | null | null | un
| codeqa | def pre yarn history unescape s return PRE YARN HISTORY ESCAPE RE sub '\\ 1 ' s
| null | null | null | null | Question:
How do string escape ?
Code:
def _pre_yarn_history_unescape(s):
return _PRE_YARN_HISTORY_ESCAPE_RE.sub('\\1', s)
|
null | null | null | What do we get from * ?
| def mult(a, b):
try:
return (a * b)
except TypeError:
return (to_decimal(a) * to_decimal(b))
| null | null | null | typeerror
| codeqa | def mult a b try return a * b except Type Error return to decimal a * to decimal b
| null | null | null | null | Question:
What do we get from * ?
Code:
def mult(a, b):
try:
return (a * b)
except TypeError:
return (to_decimal(a) * to_decimal(b))
|
null | null | null | What saves an event ?
| @instrumented_task(name='sentry.tasks.store.save_event', queue='events.save_event')
def save_event(cache_key=None, data=None, start_time=None, **kwargs):
from sentry.event_manager import EventManager
if cache_key:
data = default_cache.get(cache_key)
if (data is None):
metrics.incr('events.failed', tags={'reason'... | null | null | null | to the database
| codeqa | @instrumented task name 'sentry tasks store save event' queue 'events save event' def save event cache key None data None start time None **kwargs from sentry event manager import Event Managerif cache key data default cache get cache key if data is None metrics incr 'events failed' tags {'reason' 'cache' 'stage' 'post... | null | null | null | null | Question:
What saves an event ?
Code:
@instrumented_task(name='sentry.tasks.store.save_event', queue='events.save_event')
def save_event(cache_key=None, data=None, start_time=None, **kwargs):
from sentry.event_manager import EventManager
if cache_key:
data = default_cache.get(cache_key)
if (data is None):
me... |
null | null | null | What has an authenticated user ?
| def user_has_cart_context_processor(request):
def should_display_shopping_cart():
'\n Returns a boolean if the user has an items in a cart whereby the shopping cart should be\n displayed to the logged in user\n '
return (request.user.is_authenticated() and is_shopping_... | null | null | null | request
| codeqa | def user has cart context processor request def should display shopping cart '\n Returnsabooleaniftheuserhasanitemsinacartwherebytheshoppingcartshouldbe\ndisplayedtotheloggedinuser\n'return request user is authenticated and is shopping cart enabled and Order does user have cart request user and Order user cart has item... | null | null | null | null | Question:
What has an authenticated user ?
Code:
def user_has_cart_context_processor(request):
def should_display_shopping_cart():
'\n Returns a boolean if the user has an items in a cart whereby the shopping cart should be\n displayed to the logged in user\n '
ret... |
null | null | null | What does request have ?
| def user_has_cart_context_processor(request):
def should_display_shopping_cart():
'\n Returns a boolean if the user has an items in a cart whereby the shopping cart should be\n displayed to the logged in user\n '
return (request.user.is_authenticated() and is_shopping_... | null | null | null | an authenticated user
| codeqa | def user has cart context processor request def should display shopping cart '\n Returnsabooleaniftheuserhasanitemsinacartwherebytheshoppingcartshouldbe\ndisplayedtotheloggedinuser\n'return request user is authenticated and is shopping cart enabled and Order does user have cart request user and Order user cart has item... | null | null | null | null | Question:
What does request have ?
Code:
def user_has_cart_context_processor(request):
def should_display_shopping_cart():
'\n Returns a boolean if the user has an items in a cart whereby the shopping cart should be\n displayed to the logged in user\n '
return (req... |
null | null | null | What does the code add to the watch list ?
| def watch(filename):
_watched_files.add(filename)
| null | null | null | a file
| codeqa | def watch filename watched files add filename
| null | null | null | null | Question:
What does the code add to the watch list ?
Code:
def watch(filename):
_watched_files.add(filename)
|
null | null | null | What does context manager acquire ?
| @contextmanager
def lock_path(directory, timeout=10, timeout_class=None):
if (timeout_class is None):
timeout_class = swift.common.exceptions.LockTimeout
mkdirs(directory)
lockpath = ('%s/.lock' % directory)
fd = os.open(lockpath, (os.O_WRONLY | os.O_CREAT))
sleep_time = 0.01
slower_sleep_time = max((timeout * ... | null | null | null | a lock on a directory
| codeqa | @contextmanagerdef lock path directory timeout 10 timeout class None if timeout class is None timeout class swift common exceptions Lock Timeoutmkdirs directory lockpath '%s/ lock' % directory fd os open lockpath os O WRONLY os O CREAT sleep time 0 01 slower sleep time max timeout * 0 01 sleep time slowdown at timeout ... | null | null | null | null | Question:
What does context manager acquire ?
Code:
@contextmanager
def lock_path(directory, timeout=10, timeout_class=None):
if (timeout_class is None):
timeout_class = swift.common.exceptions.LockTimeout
mkdirs(directory)
lockpath = ('%s/.lock' % directory)
fd = os.open(lockpath, (os.O_WRONLY | os.O_CREAT))... |
null | null | null | What acquires a lock on a directory ?
| @contextmanager
def lock_path(directory, timeout=10, timeout_class=None):
if (timeout_class is None):
timeout_class = swift.common.exceptions.LockTimeout
mkdirs(directory)
lockpath = ('%s/.lock' % directory)
fd = os.open(lockpath, (os.O_WRONLY | os.O_CREAT))
sleep_time = 0.01
slower_sleep_time = max((timeout * ... | null | null | null | context manager
| codeqa | @contextmanagerdef lock path directory timeout 10 timeout class None if timeout class is None timeout class swift common exceptions Lock Timeoutmkdirs directory lockpath '%s/ lock' % directory fd os open lockpath os O WRONLY os O CREAT sleep time 0 01 slower sleep time max timeout * 0 01 sleep time slowdown at timeout ... | null | null | null | null | Question:
What acquires a lock on a directory ?
Code:
@contextmanager
def lock_path(directory, timeout=10, timeout_class=None):
if (timeout_class is None):
timeout_class = swift.common.exceptions.LockTimeout
mkdirs(directory)
lockpath = ('%s/.lock' % directory)
fd = os.open(lockpath, (os.O_WRONLY | os.O_CREAT... |
null | null | null | What does the code make ?
| def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
namespace = msg.get('namespace', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
return ite... | null | null | null | a call that returns multiple times
| codeqa | def multicall conf context topic msg timeout None check serialize msg method msg get 'method' if not method returnargs msg get 'args' {} version msg get 'version' None namespace msg get 'namespace' None try consumer CONSUMERS[topic][ 0 ]except Key Error Index Error return iter [ None] else return consumer call context ... | null | null | null | null | Question:
What does the code make ?
Code:
def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
namespace = msg.get('namespace', None)
try:
consumer = CONSUMERS[topic][0... |
null | null | null | When does a call return ?
| def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
namespace = msg.get('namespace', None)
try:
consumer = CONSUMERS[topic][0]
except (KeyError, IndexError):
return ite... | null | null | null | multiple times
| codeqa | def multicall conf context topic msg timeout None check serialize msg method msg get 'method' if not method returnargs msg get 'args' {} version msg get 'version' None namespace msg get 'namespace' None try consumer CONSUMERS[topic][ 0 ]except Key Error Index Error return iter [ None] else return consumer call context ... | null | null | null | null | Question:
When does a call return ?
Code:
def multicall(conf, context, topic, msg, timeout=None):
check_serialize(msg)
method = msg.get('method')
if (not method):
return
args = msg.get('args', {})
version = msg.get('version', None)
namespace = msg.get('namespace', None)
try:
consumer = CONSUMERS[topic][0... |
null | null | null | Where does arrays join ?
| def concatenate(tup, axis=0):
ndim = None
shape = None
for a in tup:
if (not isinstance(a, cupy.ndarray)):
raise TypeError('Only cupy arrays can be concatenated')
if (a.ndim == 0):
raise TypeError('zero-dimensional arrays cannot be concatenated')
if (ndim is None):
ndim = a.ndim
shape = li... | null | null | null | along an axis
| codeqa | def concatenate tup axis 0 ndim Noneshape Nonefor a in tup if not isinstance a cupy ndarray raise Type Error ' Onlycupyarrayscanbeconcatenated' if a ndim 0 raise Type Error 'zero-dimensionalarrayscannotbeconcatenated' if ndim is None ndim a ndimshape list a shape axis get positive axis a ndim axis continueif a ndim ndi... | null | null | null | null | Question:
Where does arrays join ?
Code:
def concatenate(tup, axis=0):
ndim = None
shape = None
for a in tup:
if (not isinstance(a, cupy.ndarray)):
raise TypeError('Only cupy arrays can be concatenated')
if (a.ndim == 0):
raise TypeError('zero-dimensional arrays cannot be concatenated')
if (... |
null | null | null | What joins along an axis ?
| def concatenate(tup, axis=0):
ndim = None
shape = None
for a in tup:
if (not isinstance(a, cupy.ndarray)):
raise TypeError('Only cupy arrays can be concatenated')
if (a.ndim == 0):
raise TypeError('zero-dimensional arrays cannot be concatenated')
if (ndim is None):
ndim = a.ndim
shape = li... | null | null | null | arrays
| codeqa | def concatenate tup axis 0 ndim Noneshape Nonefor a in tup if not isinstance a cupy ndarray raise Type Error ' Onlycupyarrayscanbeconcatenated' if a ndim 0 raise Type Error 'zero-dimensionalarrayscannotbeconcatenated' if ndim is None ndim a ndimshape list a shape axis get positive axis a ndim axis continueif a ndim ndi... | null | null | null | null | Question:
What joins along an axis ?
Code:
def concatenate(tup, axis=0):
ndim = None
shape = None
for a in tup:
if (not isinstance(a, cupy.ndarray)):
raise TypeError('Only cupy arrays can be concatenated')
if (a.ndim == 0):
raise TypeError('zero-dimensional arrays cannot be concatenated')
if... |
null | null | null | How do paths convert to 3d segments ?
| def paths_to_3d_segments_with_codes(paths, zs=0, zdir=u'z'):
if (not iterable(zs)):
zs = (np.ones(len(paths)) * zs)
segments = []
codes_list = []
for (path, pathz) in zip(paths, zs):
(segs, codes) = path_to_3d_segment_with_codes(path, pathz, zdir)
segments.append(segs)
codes_list.append(codes)
return (segm... | null | null | null | with path codes
| codeqa | def paths to 3d segments with codes paths zs 0 zdir u'z' if not iterable zs zs np ones len paths * zs segments []codes list []for path pathz in zip paths zs segs codes path to 3d segment with codes path pathz zdir segments append segs codes list append codes return segments codes list
| null | null | null | null | Question:
How do paths convert to 3d segments ?
Code:
def paths_to_3d_segments_with_codes(paths, zs=0, zdir=u'z'):
if (not iterable(zs)):
zs = (np.ones(len(paths)) * zs)
segments = []
codes_list = []
for (path, pathz) in zip(paths, zs):
(segs, codes) = path_to_3d_segment_with_codes(path, pathz, zdir)
segm... |
null | null | null | What did the code set ?
| @deprecated
def setattr_default(obj, name, value):
if (not hasattr(obj, name)):
setattr(obj, name, value)
| null | null | null | attribute value
| codeqa | @deprecateddef setattr default obj name value if not hasattr obj name setattr obj name value
| null | null | null | null | Question:
What did the code set ?
Code:
@deprecated
def setattr_default(obj, name, value):
if (not hasattr(obj, name)):
setattr(obj, name, value)
|
null | null | null | What does the code create ?
| def new_figure_manager_given_figure(num, figure):
canvas = FigureCanvasWebAggCore(figure)
manager = FigureManagerWebAgg(canvas, num)
return manager
| null | null | null | a new figure manager instance for the given figure
| codeqa | def new figure manager given figure num figure canvas Figure Canvas Web Agg Core figure manager Figure Manager Web Agg canvas num return manager
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager_given_figure(num, figure):
canvas = FigureCanvasWebAggCore(figure)
manager = FigureManagerWebAgg(canvas, num)
return manager
|
null | null | null | What did the code set ?
| def set_mindays(name, mindays):
pre_info = info(name)
if (mindays == pre_info['min']):
return True
cmd = 'chage -m {0} {1}'.format(mindays, name)
__salt__['cmd.run'](cmd, python_shell=False)
post_info = info(name)
if (post_info['min'] != pre_info['min']):
return (post_info['min'] == mindays)
return False
| null | null | null | the minimum number of days between password changes
| codeqa | def set mindays name mindays pre info info name if mindays pre info['min'] return Truecmd 'chage-m{ 0 }{ 1 }' format mindays name salt ['cmd run'] cmd python shell False post info info name if post info['min'] pre info['min'] return post info['min'] mindays return False
| null | null | null | null | Question:
What did the code set ?
Code:
def set_mindays(name, mindays):
pre_info = info(name)
if (mindays == pre_info['min']):
return True
cmd = 'chage -m {0} {1}'.format(mindays, name)
__salt__['cmd.run'](cmd, python_shell=False)
post_info = info(name)
if (post_info['min'] != pre_info['min']):
return ... |
null | null | null | How did to correctly interpret plural forms require ?
| def test(condition, true, false):
if condition:
return true
else:
return false
| null | null | null | false
| codeqa | def test condition true false if condition return trueelse return false
| null | null | null | null | Question:
How did to correctly interpret plural forms require ?
Code:
def test(condition, true, false):
if condition:
return true
else:
return false
|
null | null | null | How did plural forms interpret ?
| def test(condition, true, false):
if condition:
return true
else:
return false
| null | null | null | correctly
| codeqa | def test condition true false if condition return trueelse return false
| null | null | null | null | Question:
How did plural forms interpret ?
Code:
def test(condition, true, false):
if condition:
return true
else:
return false
|
null | null | null | What will import modules whose names start with test _ ?
| def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
py_ext = '.py'
for (dirpath, dirnames, filenames) in os.walk(basepath):
for dirname in list(dirnames):
if (dirname[0] == '.'):
dirnames.remove(dirname)
if (is_package(dirpath) and filenames):
pkg_name = dirpath[(len(basepath) + len(... | null | null | null | this
| codeqa | def get tests modules basepath this dir path gui True packages None py ext ' py'for dirpath dirnames filenames in os walk basepath for dirname in list dirnames if dirname[ 0 ] ' ' dirnames remove dirname if is package dirpath and filenames pkg name dirpath[ len basepath + len os sep ] replace '/' ' ' if packages and pk... | null | null | null | null | Question:
What will import modules whose names start with test _ ?
Code:
def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
py_ext = '.py'
for (dirpath, dirnames, filenames) in os.walk(basepath):
for dirname in list(dirnames):
if (dirname[0] == '.'):
dirnames.remove(dirname)
if (is... |
null | null | null | What will this import ?
| def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
py_ext = '.py'
for (dirpath, dirnames, filenames) in os.walk(basepath):
for dirname in list(dirnames):
if (dirname[0] == '.'):
dirnames.remove(dirname)
if (is_package(dirpath) and filenames):
pkg_name = dirpath[(len(basepath) + len(... | null | null | null | modules whose names start with test _
| codeqa | def get tests modules basepath this dir path gui True packages None py ext ' py'for dirpath dirnames filenames in os walk basepath for dirname in list dirnames if dirname[ 0 ] ' ' dirnames remove dirname if is package dirpath and filenames pkg name dirpath[ len basepath + len os sep ] replace '/' ' ' if packages and pk... | null | null | null | null | Question:
What will this import ?
Code:
def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
py_ext = '.py'
for (dirpath, dirnames, filenames) in os.walk(basepath):
for dirname in list(dirnames):
if (dirname[0] == '.'):
dirnames.remove(dirname)
if (is_package(dirpath) and filenames):... |
null | null | null | What did the generator specific info feed ?
| def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependencies_adjusted = True
toplevel = params['options'].toplevel_dir
... | null | null | null | to input
| codeqa | def Calculate Generator Input Info params generator flags params get 'generator flags' {} if generator flags get 'adjust static libraries' False global generator wants static library dependencies adjustedgenerator wants static library dependencies adjusted Truetoplevel params['options'] toplevel dirgenerator dir os pat... | null | null | null | null | Question:
What did the generator specific info feed ?
Code:
def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependen... |
null | null | null | What does the code calculate ?
| def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependencies_adjusted = True
toplevel = params['options'].toplevel_dir
... | null | null | null | the generator specific info that gets fed to input
| codeqa | def Calculate Generator Input Info params generator flags params get 'generator flags' {} if generator flags get 'adjust static libraries' False global generator wants static library dependencies adjustedgenerator wants static library dependencies adjusted Truetoplevel params['options'] toplevel dirgenerator dir os pat... | null | null | null | null | Question:
What does the code calculate ?
Code:
def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependencies_adjusted... |
null | null | null | What fed to input ?
| def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependencies_adjusted = True
toplevel = params['options'].toplevel_dir
... | null | null | null | the generator specific info
| codeqa | def Calculate Generator Input Info params generator flags params get 'generator flags' {} if generator flags get 'adjust static libraries' False global generator wants static library dependencies adjustedgenerator wants static library dependencies adjusted Truetoplevel params['options'] toplevel dirgenerator dir os pat... | null | null | null | null | Question:
What fed to input ?
Code:
def CalculateGeneratorInputInfo(params):
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator_wants_static_library_dependencies_adjusted = True
to... |
null | null | null | How did output generate ?
| def test_number_aware_alphabetical_key():
l = ['0', 'mystr_1', 'mystr_10', 'mystr_2', 'mystr_1_a', 'mystr']
l.sort(key=number_aware_alphabetical_key)
print(l)
assert (l == ['0', 'mystr', 'mystr_1', 'mystr_1_a', 'mystr_2', 'mystr_10'])
| null | null | null | manually
| codeqa | def test number aware alphabetical key l [' 0 ' 'mystr 1' 'mystr 10 ' 'mystr 2' 'mystr 1 a' 'mystr']l sort key number aware alphabetical key print l assert l [' 0 ' 'mystr' 'mystr 1' 'mystr 1 a' 'mystr 2' 'mystr 10 ']
| null | null | null | null | Question:
How did output generate ?
Code:
def test_number_aware_alphabetical_key():
l = ['0', 'mystr_1', 'mystr_10', 'mystr_2', 'mystr_1_a', 'mystr']
l.sort(key=number_aware_alphabetical_key)
print(l)
assert (l == ['0', 'mystr', 'mystr_1', 'mystr_1_a', 'mystr_2', 'mystr_10'])
|
null | null | null | What does the code challenge ?
| def digestAuth(realm, algorithm=MD5, nonce=None, qop=AUTH):
global SUPPORTED_ALGORITHM, DIGEST_AUTH_ENCODERS, SUPPORTED_QOP
assert (algorithm in SUPPORTED_ALGORITHM)
assert (qop in SUPPORTED_QOP)
if (nonce is None):
nonce = calculateNonce(realm, algorithm)
return ('Digest realm="%s", nonce="%s", algorithm="%s... | null | null | null | the client
| codeqa | def digest Auth realm algorithm MD 5 nonce None qop AUTH global SUPPORTED ALGORITHM DIGEST AUTH ENCODERS SUPPORTED QO Passert algorithm in SUPPORTED ALGORITHM assert qop in SUPPORTED QOP if nonce is None nonce calculate Nonce realm algorithm return ' Digestrealm "%s" nonce "%s" algorithm "%s" qop "%s"' % realm nonce al... | null | null | null | null | Question:
What does the code challenge ?
Code:
def digestAuth(realm, algorithm=MD5, nonce=None, qop=AUTH):
global SUPPORTED_ALGORITHM, DIGEST_AUTH_ENCODERS, SUPPORTED_QOP
assert (algorithm in SUPPORTED_ALGORITHM)
assert (qop in SUPPORTED_QOP)
if (nonce is None):
nonce = calculateNonce(realm, algorithm)
retur... |
null | null | null | When does higher scored passages sort ?
| def SCORE(fragment):
return None
| null | null | null | first
| codeqa | def SCORE fragment return None
| null | null | null | null | Question:
When does higher scored passages sort ?
Code:
def SCORE(fragment):
return None
|
null | null | null | What does an individual do when considered one at a time in random order ?
| def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)))
random.shuffle(cases)
while ((len(cases) > 0) and (len(candidates) > 1)):
if (fit_wei... | null | null | null | the best
| codeqa | def sel Epsilon Lexicase individuals k epsilon selected individuals []for i in range k fit weights individuals[ 0 ] fitness weightscandidates individualscases list range len individuals[ 0 ] fitness values random shuffle cases while len cases > 0 and len candidates > 1 if fit weights[cases[ 0 ]] > 0 best val for case m... | null | null | null | null | Question:
What does an individual do when considered one at a time in random order ?
Code:
def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)... |
null | null | null | What does the best when considered one at a time in random order ?
| def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)))
random.shuffle(cases)
while ((len(cases) > 0) and (len(candidates) > 1)):
if (fit_wei... | null | null | null | an individual
| codeqa | def sel Epsilon Lexicase individuals k epsilon selected individuals []for i in range k fit weights individuals[ 0 ] fitness weightscandidates individualscases list range len individuals[ 0 ] fitness values random shuffle cases while len cases > 0 and len candidates > 1 if fit weights[cases[ 0 ]] > 0 best val for case m... | null | null | null | null | Question:
What does the best when considered one at a time in random order ?
Code:
def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)))
ran... |
null | null | null | When does an individual do the best ?
| def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)))
random.shuffle(cases)
while ((len(cases) > 0) and (len(candidates) > 1)):
if (fit_wei... | null | null | null | when considered one at a time in random order
| codeqa | def sel Epsilon Lexicase individuals k epsilon selected individuals []for i in range k fit weights individuals[ 0 ] fitness weightscandidates individualscases list range len individuals[ 0 ] fitness values random shuffle cases while len cases > 0 and len candidates > 1 if fit weights[cases[ 0 ]] > 0 best val for case m... | null | null | null | null | Question:
When does an individual do the best ?
Code:
def selEpsilonLexicase(individuals, k, epsilon):
selected_individuals = []
for i in range(k):
fit_weights = individuals[0].fitness.weights
candidates = individuals
cases = list(range(len(individuals[0].fitness.values)))
random.shuffle(cases)
while ((... |
null | null | null | What does the code get ?
| def getNewDerivation(elementNode):
return VoronoiDerivation(elementNode)
| null | null | null | new derivation
| codeqa | def get New Derivation element Node return Voronoi Derivation element Node
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewDerivation(elementNode):
return VoronoiDerivation(elementNode)
|
null | null | null | How do a client endpoint construct ?
| def clientFromString(reactor, description):
(args, kwargs) = _parse(description)
aname = args.pop(0)
name = aname.upper()
for plugin in getPlugins(IStreamClientEndpointStringParser):
if (plugin.prefix.upper() == name):
return plugin.parseStreamClient(*args, **kwargs)
if (name not in _clientParsers):
raise V... | null | null | null | from a description string
| codeqa | def client From String reactor description args kwargs parse description aname args pop 0 name aname upper for plugin in get Plugins I Stream Client Endpoint String Parser if plugin prefix upper name return plugin parse Stream Client *args **kwargs if name not in client Parsers raise Value Error ' Unknownendpointtype %... | null | null | null | null | Question:
How do a client endpoint construct ?
Code:
def clientFromString(reactor, description):
(args, kwargs) = _parse(description)
aname = args.pop(0)
name = aname.upper()
for plugin in getPlugins(IStreamClientEndpointStringParser):
if (plugin.prefix.upper() == name):
return plugin.parseStreamClient(*ar... |
null | null | null | What returns a decorator ?
| def user_access_decorator(redirect_func, redirect_url_func, deny_func=None, redirect_field=REDIRECT_FIELD_NAME):
def decorator(view_fn):
def _wrapped_view(request, *args, **kwargs):
if redirect_func(request.user):
redirect_url = (redirect_url_func() or reverse('account_login'))
if redirect_field:
pat... | null | null | null | helper function
| codeqa | def user access decorator redirect func redirect url func deny func None redirect field REDIRECT FIELD NAME def decorator view fn def wrapped view request *args **kwargs if redirect func request user redirect url redirect url func or reverse 'account login' if redirect field path urlquote request get full path redirect... | null | null | null | null | Question:
What returns a decorator ?
Code:
def user_access_decorator(redirect_func, redirect_url_func, deny_func=None, redirect_field=REDIRECT_FIELD_NAME):
def decorator(view_fn):
def _wrapped_view(request, *args, **kwargs):
if redirect_func(request.user):
redirect_url = (redirect_url_func() or reverse('a... |
null | null | null | What does helper function return ?
| def user_access_decorator(redirect_func, redirect_url_func, deny_func=None, redirect_field=REDIRECT_FIELD_NAME):
def decorator(view_fn):
def _wrapped_view(request, *args, **kwargs):
if redirect_func(request.user):
redirect_url = (redirect_url_func() or reverse('account_login'))
if redirect_field:
pat... | null | null | null | a decorator
| codeqa | def user access decorator redirect func redirect url func deny func None redirect field REDIRECT FIELD NAME def decorator view fn def wrapped view request *args **kwargs if redirect func request user redirect url redirect url func or reverse 'account login' if redirect field path urlquote request get full path redirect... | null | null | null | null | Question:
What does helper function return ?
Code:
def user_access_decorator(redirect_func, redirect_url_func, deny_func=None, redirect_field=REDIRECT_FIELD_NAME):
def decorator(view_fn):
def _wrapped_view(request, *args, **kwargs):
if redirect_func(request.user):
redirect_url = (redirect_url_func() or re... |
null | null | null | What returns in all available environments ?
| def list_roots():
ret = {}
for saltenv in __opts__['file_roots']:
ret[saltenv] = []
ret[saltenv].append(list_env(saltenv))
return ret
| null | null | null | all of the files names
| codeqa | def list roots ret {}for saltenv in opts ['file roots'] ret[saltenv] []ret[saltenv] append list env saltenv return ret
| null | null | null | null | Question:
What returns in all available environments ?
Code:
def list_roots():
ret = {}
for saltenv in __opts__['file_roots']:
ret[saltenv] = []
ret[saltenv].append(list_env(saltenv))
return ret
|
null | null | null | What does the code remove from all classes ?
| def clear_mappers():
mapperlib._CONFIGURE_MUTEX.acquire()
try:
while _mapper_registry:
try:
(mapper, b) = _mapper_registry.popitem()
mapper.dispose()
except KeyError:
pass
finally:
mapperlib._CONFIGURE_MUTEX.release()
| null | null | null | all mappers
| codeqa | def clear mappers mapperlib CONFIGURE MUTEX acquire try while mapper registry try mapper b mapper registry popitem mapper dispose except Key Error passfinally mapperlib CONFIGURE MUTEX release
| null | null | null | null | Question:
What does the code remove from all classes ?
Code:
def clear_mappers():
mapperlib._CONFIGURE_MUTEX.acquire()
try:
while _mapper_registry:
try:
(mapper, b) = _mapper_registry.popitem()
mapper.dispose()
except KeyError:
pass
finally:
mapperlib._CONFIGURE_MUTEX.release()
|
null | null | null | When does the code get line geometry output ?
| def getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement):
stepsFloor = int(math.floor(abs(steps)))
for stepIndex in xrange(1, stepsFloor):
loop.append((loop[(stepIndex - 1)] + stepVector))
loop.append(end)
return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
| null | null | null | by the end
| codeqa | def get Geometry Output By Step end loop steps step Vector xml Element steps Floor int math floor abs steps for step Index in xrange 1 steps Floor loop append loop[ step Index - 1 ] + step Vector loop append end return lineation get Geometry Output By Loop lineation Side Loop loop xml Element
| null | null | null | null | Question:
When does the code get line geometry output ?
Code:
def getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement):
stepsFloor = int(math.floor(abs(steps)))
for stepIndex in xrange(1, stepsFloor):
loop.append((loop[(stepIndex - 1)] + stepVector))
loop.append(end)
return lineation.getGeometryO... |
null | null | null | What does the code get by the end ?
| def getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement):
stepsFloor = int(math.floor(abs(steps)))
for stepIndex in xrange(1, stepsFloor):
loop.append((loop[(stepIndex - 1)] + stepVector))
loop.append(end)
return lineation.getGeometryOutputByLoop(lineation.SideLoop(loop), xmlElement)
| null | null | null | line geometry output
| codeqa | def get Geometry Output By Step end loop steps step Vector xml Element steps Floor int math floor abs steps for step Index in xrange 1 steps Floor loop append loop[ step Index - 1 ] + step Vector loop append end return lineation get Geometry Output By Loop lineation Side Loop loop xml Element
| null | null | null | null | Question:
What does the code get by the end ?
Code:
def getGeometryOutputByStep(end, loop, steps, stepVector, xmlElement):
stepsFloor = int(math.floor(abs(steps)))
for stepIndex in xrange(1, stepsFloor):
loop.append((loop[(stepIndex - 1)] + stepVector))
loop.append(end)
return lineation.getGeometryOutputByLoo... |
null | null | null | What does the code install ?
| def InstallModule(conf_module_name, params, options, log=(lambda *args: None)):
if (not hasattr(sys, 'frozen')):
conf_module_name = os.path.abspath(conf_module_name)
if (not os.path.isfile(conf_module_name)):
raise ConfigurationError(('%s does not exist' % (conf_module_name,)))
loader_dll = GetLoaderModuleN... | null | null | null | the extension
| codeqa | def Install Module conf module name params options log lambda *args None if not hasattr sys 'frozen' conf module name os path abspath conf module name if not os path isfile conf module name raise Configuration Error '%sdoesnotexist' % conf module name loader dll Get Loader Module Name conf module name Patch Params Modu... | null | null | null | null | Question:
What does the code install ?
Code:
def InstallModule(conf_module_name, params, options, log=(lambda *args: None)):
if (not hasattr(sys, 'frozen')):
conf_module_name = os.path.abspath(conf_module_name)
if (not os.path.isfile(conf_module_name)):
raise ConfigurationError(('%s does not exist' % (co... |
null | null | null | What does the code restore ?
| def _restore_service(service):
_apply_service(service, SonosDevice.restore)
| null | null | null | a snapshot
| codeqa | def restore service service apply service service Sonos Device restore
| null | null | null | null | Question:
What does the code restore ?
Code:
def _restore_service(service):
_apply_service(service, SonosDevice.restore)
|
null | null | null | How do the current network settings grab ?
| def network():
_xml = '<RIBCL VERSION="2.0">\n <LOGIN USER_LOGIN="adminname" PASSWORD="password">\n <RIB_INFO MODE="read">\n <GET_NETWORK_SETTINGS/>\n </RIB_INFO>\n </LOGIN>\n </RIBCL>'
return __execute_cmd('Netw... | null | null | null | cli example
| codeqa | def network xml '<RIBCLVERSION "2 0">\n<LOGINUSER LOGIN "adminname"PASSWORD "password">\n<RIB INFOMODE "read">\n<GET NETWORK SETTINGS/>\n</RIB INFO>\n</LOGIN>\n</RIBCL>'return execute cmd ' Network Settings' xml
| null | null | null | null | Question:
How do the current network settings grab ?
Code:
def network():
_xml = '<RIBCL VERSION="2.0">\n <LOGIN USER_LOGIN="adminname" PASSWORD="password">\n <RIB_INFO MODE="read">\n <GET_NETWORK_SETTINGS/>\n </RIB_INFO>\n ... |
null | null | null | What does the code disable ?
| def disable(service):
action('disable', service)
| null | null | null | a service
| codeqa | def disable service action 'disable' service
| null | null | null | null | Question:
What does the code disable ?
Code:
def disable(service):
action('disable', service)
|
null | null | null | What does the code get ?
| def getenv():
sep = (';' if (os.name == 'nt') else ':')
env = os.environ.copy()
sys.path.insert(0, GAMEDIR)
env['PYTHONPATH'] = sep.join(sys.path)
return env
| null | null | null | current environment
| codeqa | def getenv sep ' ' if os name 'nt' else ' ' env os environ copy sys path insert 0 GAMEDIR env['PYTHONPATH'] sep join sys path return env
| null | null | null | null | Question:
What does the code get ?
Code:
def getenv():
sep = (';' if (os.name == 'nt') else ':')
env = os.environ.copy()
sys.path.insert(0, GAMEDIR)
env['PYTHONPATH'] = sep.join(sys.path)
return env
|
null | null | null | What does the code get ?
| def getNewMouseTool():
return ViewpointMove()
| null | null | null | a new mouse tool
| codeqa | def get New Mouse Tool return Viewpoint Move
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewMouseTool():
return ViewpointMove()
|
null | null | null | What does the code open for reading ?
| def open_resource(name):
if (resource_stream is not None):
return resource_stream(__name__, ('zoneinfo/' + name))
else:
name_parts = name.lstrip('/').split('/')
for part in name_parts:
if ((part == os.path.pardir) or (os.path.sep in part)):
raise ValueError(('Bad path segment: %r' % part))
filename ... | null | null | null | a resource
| codeqa | def open resource name if resource stream is not None return resource stream name 'zoneinfo/' + name else name parts name lstrip '/' split '/' for part in name parts if part os path pardir or os path sep in part raise Value Error ' Badpathsegment %r' % part filename os path join os path dirname file 'zoneinfo' *name pa... | null | null | null | null | Question:
What does the code open for reading ?
Code:
def open_resource(name):
if (resource_stream is not None):
return resource_stream(__name__, ('zoneinfo/' + name))
else:
name_parts = name.lstrip('/').split('/')
for part in name_parts:
if ((part == os.path.pardir) or (os.path.sep in part)):
raise ... |
null | null | null | For what purpose does the code open a resource ?
| def open_resource(name):
if (resource_stream is not None):
return resource_stream(__name__, ('zoneinfo/' + name))
else:
name_parts = name.lstrip('/').split('/')
for part in name_parts:
if ((part == os.path.pardir) or (os.path.sep in part)):
raise ValueError(('Bad path segment: %r' % part))
filename ... | null | null | null | for reading
| codeqa | def open resource name if resource stream is not None return resource stream name 'zoneinfo/' + name else name parts name lstrip '/' split '/' for part in name parts if part os path pardir or os path sep in part raise Value Error ' Badpathsegment %r' % part filename os path join os path dirname file 'zoneinfo' *name pa... | null | null | null | null | Question:
For what purpose does the code open a resource ?
Code:
def open_resource(name):
if (resource_stream is not None):
return resource_stream(__name__, ('zoneinfo/' + name))
else:
name_parts = name.lstrip('/').split('/')
for part in name_parts:
if ((part == os.path.pardir) or (os.path.sep in part)):... |
null | null | null | What does the code extend ?
| @task.task(ignore_result=True)
def extend_access_token(profile, access_token):
results = profile._extend_access_token(access_token)
return results
| null | null | null | the access token
| codeqa | @task task ignore result True def extend access token profile access token results profile extend access token access token return results
| null | null | null | null | Question:
What does the code extend ?
Code:
@task.task(ignore_result=True)
def extend_access_token(profile, access_token):
results = profile._extend_access_token(access_token)
return results
|
null | null | null | What does the code get ?
| def getNewRepository():
return skeinforge_analyze.AnalyzeRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return skeinforge analyze Analyze Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return skeinforge_analyze.AnalyzeRepository()
|
null | null | null | How do user details update ?
| def user_details(strategy, details, user=None, *args, **kwargs):
if user:
changed = False
protected = (('username', 'id', 'pk', 'email') + tuple(strategy.setting('PROTECTED_USER_FIELDS', [])))
for (name, value) in details.items():
if (not hasattr(user, name)):
continue
current_value = getattr(user, nam... | null | null | null | using data from provider
| codeqa | def user details strategy details user None *args **kwargs if user changed Falseprotected 'username' 'id' 'pk' 'email' + tuple strategy setting 'PROTECTED USER FIELDS' [] for name value in details items if not hasattr user name continuecurrent value getattr user name None if not current value or name not in protected c... | null | null | null | null | Question:
How do user details update ?
Code:
def user_details(strategy, details, user=None, *args, **kwargs):
if user:
changed = False
protected = (('username', 'id', 'pk', 'email') + tuple(strategy.setting('PROTECTED_USER_FIELDS', [])))
for (name, value) in details.items():
if (not hasattr(user, name)):
... |
null | null | null | How is the stream factory used ?
| def default_stream_factory(total_content_length, filename, content_type, content_length=None):
if (total_content_length > (1024 * 500)):
return TemporaryFile('wb+')
return BytesIO()
| null | null | null | per default
| codeqa | def default stream factory total content length filename content type content length None if total content length > 1024 * 500 return Temporary File 'wb+' return Bytes IO
| null | null | null | null | Question:
How is the stream factory used ?
Code:
def default_stream_factory(total_content_length, filename, content_type, content_length=None):
if (total_content_length > (1024 * 500)):
return TemporaryFile('wb+')
return BytesIO()
|
null | null | null | What did the code remove from values dictionary using the models _ _ protected_attributes _ _ field ?
| def drop_protected_attrs(model_class, values):
for attr in model_class.__protected_attributes__:
if (attr in values):
del values[attr]
| null | null | null | protected attributes
| codeqa | def drop protected attrs model class values for attr in model class protected attributes if attr in values del values[attr]
| null | null | null | null | Question:
What did the code remove from values dictionary using the models _ _ protected_attributes _ _ field ?
Code:
def drop_protected_attrs(model_class, values):
for attr in model_class.__protected_attributes__:
if (attr in values):
del values[attr]
|
null | null | null | How did the code remove protected attributes from values dictionary ?
| def drop_protected_attrs(model_class, values):
for attr in model_class.__protected_attributes__:
if (attr in values):
del values[attr]
| null | null | null | using the models _ _ protected_attributes _ _ field
| codeqa | def drop protected attrs model class values for attr in model class protected attributes if attr in values del values[attr]
| null | null | null | null | Question:
How did the code remove protected attributes from values dictionary ?
Code:
def drop_protected_attrs(model_class, values):
for attr in model_class.__protected_attributes__:
if (attr in values):
del values[attr]
|
null | null | null | Where do files get ?
| def get_path_dir_files(dirName, nzbName, proc_type):
path = u''
dirs = []
files = []
if (((dirName == sickbeard.TV_DOWNLOAD_DIR) and (not nzbName)) or (proc_type == u'manual')):
for (path, dirs, files) in ek(os.walk, dirName):
break
else:
(path, dirs) = ek(os.path.split, dirName)
if ((not ((nzbName is Non... | null | null | null | in a path
| codeqa | def get path dir files dir Name nzb Name proc type path u''dirs []files []if dir Name sickbeard TV DOWNLOAD DIR and not nzb Name or proc type u'manual' for path dirs files in ek os walk dir Name breakelse path dirs ek os path split dir Name if not nzb Name is None or nzb Name endswith u' nzb' and ek os path isfile ek o... | null | null | null | null | Question:
Where do files get ?
Code:
def get_path_dir_files(dirName, nzbName, proc_type):
path = u''
dirs = []
files = []
if (((dirName == sickbeard.TV_DOWNLOAD_DIR) and (not nzbName)) or (proc_type == u'manual')):
for (path, dirs, files) in ek(os.walk, dirName):
break
else:
(path, dirs) = ek(os.path.sp... |
null | null | null | What gets in a path ?
| def get_path_dir_files(dirName, nzbName, proc_type):
path = u''
dirs = []
files = []
if (((dirName == sickbeard.TV_DOWNLOAD_DIR) and (not nzbName)) or (proc_type == u'manual')):
for (path, dirs, files) in ek(os.walk, dirName):
break
else:
(path, dirs) = ek(os.path.split, dirName)
if ((not ((nzbName is Non... | null | null | null | files
| codeqa | def get path dir files dir Name nzb Name proc type path u''dirs []files []if dir Name sickbeard TV DOWNLOAD DIR and not nzb Name or proc type u'manual' for path dirs files in ek os walk dir Name breakelse path dirs ek os path split dir Name if not nzb Name is None or nzb Name endswith u' nzb' and ek os path isfile ek o... | null | null | null | null | Question:
What gets in a path ?
Code:
def get_path_dir_files(dirName, nzbName, proc_type):
path = u''
dirs = []
files = []
if (((dirName == sickbeard.TV_DOWNLOAD_DIR) and (not nzbName)) or (proc_type == u'manual')):
for (path, dirs, files) in ek(os.walk, dirName):
break
else:
(path, dirs) = ek(os.path.s... |
null | null | null | What does the code get by flavor ?
| @require_admin_context
def instance_type_access_get_by_flavor_id(context, flavor_id):
instance_type_ref = _instance_type_get_query(context).filter_by(flavorid=flavor_id).first()
return [r for r in instance_type_ref.projects]
| null | null | null | flavor access list
| codeqa | @require admin contextdef instance type access get by flavor id context flavor id instance type ref instance type get query context filter by flavorid flavor id first return [r for r in instance type ref projects]
| null | null | null | null | Question:
What does the code get by flavor ?
Code:
@require_admin_context
def instance_type_access_get_by_flavor_id(context, flavor_id):
instance_type_ref = _instance_type_get_query(context).filter_by(flavorid=flavor_id).first()
return [r for r in instance_type_ref.projects]
|
null | null | null | How does the code get flavor access list ?
| @require_admin_context
def instance_type_access_get_by_flavor_id(context, flavor_id):
instance_type_ref = _instance_type_get_query(context).filter_by(flavorid=flavor_id).first()
return [r for r in instance_type_ref.projects]
| null | null | null | by flavor
| codeqa | @require admin contextdef instance type access get by flavor id context flavor id instance type ref instance type get query context filter by flavorid flavor id first return [r for r in instance type ref projects]
| null | null | null | null | Question:
How does the code get flavor access list ?
Code:
@require_admin_context
def instance_type_access_get_by_flavor_id(context, flavor_id):
instance_type_ref = _instance_type_get_query(context).filter_by(flavorid=flavor_id).first()
return [r for r in instance_type_ref.projects]
|
null | null | null | What does the code find ?
| def sproot(tck, mest=10):
(t, c, k) = tck
if (k != 3):
raise ValueError('sproot works only for cubic (k=3) splines')
try:
c[0][0]
parametric = True
except:
parametric = False
if parametric:
return list(map((lambda c, t=t, k=k, mest=mest: sproot([t, c, k], mest)), c))
else:
if (len(t) < 8):
ra... | null | null | null | the roots of a cubic b - spline
| codeqa | def sproot tck mest 10 t c k tckif k 3 raise Value Error 'sprootworksonlyforcubic k 3 splines' try c[ 0 ][ 0 ]parametric Trueexcept parametric Falseif parametric return list map lambda c t t k k mest mest sproot [t c k] mest c else if len t < 8 raise Type Error ' Thenumberofknots%d> 8' % len t z ier fitpack sproot t c ... | null | null | null | null | Question:
What does the code find ?
Code:
def sproot(tck, mest=10):
(t, c, k) = tck
if (k != 3):
raise ValueError('sproot works only for cubic (k=3) splines')
try:
c[0][0]
parametric = True
except:
parametric = False
if parametric:
return list(map((lambda c, t=t, k=k, mest=mest: sproot([t, c, k... |
null | null | null | What does the code move ?
| def movmean(x, windowsize=3, lag='lagged'):
return movmoment(x, 1, windowsize=windowsize, lag=lag)
| null | null | null | window
| codeqa | def movmean x windowsize 3 lag 'lagged' return movmoment x 1 windowsize windowsize lag lag
| null | null | null | null | Question:
What does the code move ?
Code:
def movmean(x, windowsize=3, lag='lagged'):
return movmoment(x, 1, windowsize=windowsize, lag=lag)
|
null | null | null | What does the code give ?
| def provide_fake_entries(group):
return _FAKE_ENTRIES.get(group, [])
| null | null | null | a set of fake entries for known groups
| codeqa | def provide fake entries group return FAKE ENTRIES get group []
| null | null | null | null | Question:
What does the code give ?
Code:
def provide_fake_entries(group):
return _FAKE_ENTRIES.get(group, [])
|
null | null | null | When does the code truncate a string ?
| def truncate(content, length=100, suffix='...'):
if (len(content) <= length):
return content
else:
return (content[:length].rsplit(' ', 1)[0] + suffix)
| null | null | null | after a certain number of characters
| codeqa | def truncate content length 100 suffix ' ' if len content < length return contentelse return content[ length] rsplit '' 1 [0 ] + suffix
| null | null | null | null | Question:
When does the code truncate a string ?
Code:
def truncate(content, length=100, suffix='...'):
if (len(content) <= length):
return content
else:
return (content[:length].rsplit(' ', 1)[0] + suffix)
|
null | null | null | What does the code truncate after a certain number of characters ?
| def truncate(content, length=100, suffix='...'):
if (len(content) <= length):
return content
else:
return (content[:length].rsplit(' ', 1)[0] + suffix)
| null | null | null | a string
| codeqa | def truncate content length 100 suffix ' ' if len content < length return contentelse return content[ length] rsplit '' 1 [0 ] + suffix
| null | null | null | null | Question:
What does the code truncate after a certain number of characters ?
Code:
def truncate(content, length=100, suffix='...'):
if (len(content) <= length):
return content
else:
return (content[:length].rsplit(' ', 1)[0] + suffix)
|
null | null | null | Who d compute to a specified rank ?
| def iddr_id(A, k):
A = np.asfortranarray(A)
(idx, rnorms) = _id.iddr_id(A, k)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (idx, proj)
| null | null | null | i d of a real matrix
| codeqa | def iddr id A k A np asfortranarray A idx rnorms id iddr id A k n A shape[ 1 ]proj A T ravel [ k * n - k ] reshape k n - k order 'F' return idx proj
| null | null | null | null | Question:
Who d compute to a specified rank ?
Code:
def iddr_id(A, k):
A = np.asfortranarray(A)
(idx, rnorms) = _id.iddr_id(A, k)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (idx, proj)
|
null | null | null | What d i d of a real matrix compute ?
| def iddr_id(A, k):
A = np.asfortranarray(A)
(idx, rnorms) = _id.iddr_id(A, k)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (idx, proj)
| null | null | null | to a specified rank
| codeqa | def iddr id A k A np asfortranarray A idx rnorms id iddr id A k n A shape[ 1 ]proj A T ravel [ k * n - k ] reshape k n - k order 'F' return idx proj
| null | null | null | null | Question:
What d i d of a real matrix compute ?
Code:
def iddr_id(A, k):
A = np.asfortranarray(A)
(idx, rnorms) = _id.iddr_id(A, k)
n = A.shape[1]
proj = A.T.ravel()[:(k * (n - k))].reshape((k, (n - k)), order='F')
return (idx, proj)
|
null | null | null | Where does the code run a callback ?
| @utils.positional(1)
def transaction_async(callback, **ctx_options):
from . import tasklets
return tasklets.get_context().transaction(callback, **ctx_options)
| null | null | null | in a transaction
| codeqa | @utils positional 1 def transaction async callback **ctx options from import taskletsreturn tasklets get context transaction callback **ctx options
| null | null | null | null | Question:
Where does the code run a callback ?
Code:
@utils.positional(1)
def transaction_async(callback, **ctx_options):
from . import tasklets
return tasklets.get_context().transaction(callback, **ctx_options)
|
null | null | null | What does the code run in a transaction ?
| @utils.positional(1)
def transaction_async(callback, **ctx_options):
from . import tasklets
return tasklets.get_context().transaction(callback, **ctx_options)
| null | null | null | a callback
| codeqa | @utils positional 1 def transaction async callback **ctx options from import taskletsreturn tasklets get context transaction callback **ctx options
| null | null | null | null | Question:
What does the code run in a transaction ?
Code:
@utils.positional(1)
def transaction_async(callback, **ctx_options):
from . import tasklets
return tasklets.get_context().transaction(callback, **ctx_options)
|
null | null | null | What does the code get ?
| def _getAccessibleAttribute(attributeName, dictionaryObject):
if (attributeName in globalNativeFunctionSet):
return getattr(dictionaryObject, attributeName, None)
if (attributeName in globalGetAccessibleAttributeSet):
stringAttribute = DictionaryAttribute(dictionaryObject)
return getattr(stringAttribute, attrib... | null | null | null | the accessible attribute
| codeqa | def get Accessible Attribute attribute Name dictionary Object if attribute Name in global Native Function Set return getattr dictionary Object attribute Name None if attribute Name in global Get Accessible Attribute Set string Attribute Dictionary Attribute dictionary Object return getattr string Attribute attribute Na... | null | null | null | null | Question:
What does the code get ?
Code:
def _getAccessibleAttribute(attributeName, dictionaryObject):
if (attributeName in globalNativeFunctionSet):
return getattr(dictionaryObject, attributeName, None)
if (attributeName in globalGetAccessibleAttributeSet):
stringAttribute = DictionaryAttribute(dictionaryObj... |
null | null | null | What does the code convert to boolean ?
| def to_bool(value):
if (value is None):
return None
if isinstance(value, bool):
return value
elif isinstance(value, str):
if (value == 'no'):
return False
elif (value == 'yes'):
return True
| null | null | null | a value
| codeqa | def to bool value if value is None return Noneif isinstance value bool return valueelif isinstance value str if value 'no' return Falseelif value 'yes' return True
| null | null | null | null | Question:
What does the code convert to boolean ?
Code:
def to_bool(value):
if (value is None):
return None
if isinstance(value, bool):
return value
elif isinstance(value, str):
if (value == 'no'):
return False
elif (value == 'yes'):
return True
|
null | null | null | What requires it ?
| def auth_field_and_value(resource):
if ('|resource' in request.endpoint):
public_method_list_to_check = 'public_methods'
else:
public_method_list_to_check = 'public_item_methods'
resource_dict = app.config['DOMAIN'][resource]
auth = resource_auth(resource)
request_auth_value = (auth.get_request_auth_value() if... | null | null | null | the resource
| codeqa | def auth field and value resource if ' resource' in request endpoint public method list to check 'public methods'else public method list to check 'public item methods'resource dict app config['DOMAIN'][resource]auth resource auth resource request auth value auth get request auth value if auth else None auth field resou... | null | null | null | null | Question:
What requires it ?
Code:
def auth_field_and_value(resource):
if ('|resource' in request.endpoint):
public_method_list_to_check = 'public_methods'
else:
public_method_list_to_check = 'public_item_methods'
resource_dict = app.config['DOMAIN'][resource]
auth = resource_auth(resource)
request_auth_va... |
null | null | null | What does the code return ?
| def release():
return uname()[2]
| null | null | null | the systems release
| codeqa | def release return uname [2 ]
| null | null | null | null | Question:
What does the code return ?
Code:
def release():
return uname()[2]
|
null | null | null | which organization exposed to read whether there are updates available for any of the installed user plugins ?
| def get_plugin_updates_available(raise_error=False):
if (not has_external_plugins()):
return None
display_plugins = read_available_plugins(raise_error=raise_error)
if display_plugins:
update_plugins = filter(filter_upgradeable_plugins, display_plugins)
if (len(update_plugins) > 0):
return update_plugins
re... | null | null | null | api
| codeqa | def get plugin updates available raise error False if not has external plugins return Nonedisplay plugins read available plugins raise error raise error if display plugins update plugins filter filter upgradeable plugins display plugins if len update plugins > 0 return update pluginsreturn None
| null | null | null | null | Question:
which organization exposed to read whether there are updates available for any of the installed user plugins ?
Code:
def get_plugin_updates_available(raise_error=False):
if (not has_external_plugins()):
return None
display_plugins = read_available_plugins(raise_error=raise_error)
if display_plugins:... |
null | null | null | What did the code read forward ?
| def read_forward_solution_eeg(*args, **kwargs):
fwd = read_forward_solution(*args, **kwargs)
fwd = pick_types_forward(fwd, meg=False, eeg=True)
return fwd
| null | null | null | eeg
| codeqa | def read forward solution eeg *args **kwargs fwd read forward solution *args **kwargs fwd pick types forward fwd meg False eeg True return fwd
| null | null | null | null | Question:
What did the code read forward ?
Code:
def read_forward_solution_eeg(*args, **kwargs):
fwd = read_forward_solution(*args, **kwargs)
fwd = pick_types_forward(fwd, meg=False, eeg=True)
return fwd
|
null | null | null | What does the code find ?
| def primarykeys(conn, table):
rows = query(conn, "\n SELECT information_schema.constraint_column_usage.column_name\n FROM information_schema.table_constraints\n NATURAL JOIN information_schema.constraint_column_usage\n WHERE information_schema.table_constraints.table_name=%s\n ... | null | null | null | primary keys
| codeqa | def primarykeys conn table rows query conn "\n SELEC Tinformation schema constraint column usage column name\n FRO Minformation schema table constraints\n NATURALJOI Ninformation schema constraint column usage\n WHER Einformation schema table constraints table name %s\n AN Dinformation schema table constraints constrai... | null | null | null | null | Question:
What does the code find ?
Code:
def primarykeys(conn, table):
rows = query(conn, "\n SELECT information_schema.constraint_column_usage.column_name\n FROM information_schema.table_constraints\n NATURAL JOIN information_schema.constraint_column_usage\n WHERE information... |
null | null | null | What have decorator declare ?
| def delay_denial(func):
func.delay_denial = True
return func
| null | null | null | which methods should have any swift
| codeqa | def delay denial func func delay denial Truereturn func
| null | null | null | null | Question:
What have decorator declare ?
Code:
def delay_denial(func):
func.delay_denial = True
return func
|
null | null | null | What should have any swift ?
| def delay_denial(func):
func.delay_denial = True
return func
| null | null | null | which methods
| codeqa | def delay denial func func delay denial Truereturn func
| null | null | null | null | Question:
What should have any swift ?
Code:
def delay_denial(func):
func.delay_denial = True
return func
|
null | null | null | What does test the full stack ?
| def test_future_altaz():
from ...utils.exceptions import AstropyWarning
from ..builtin_frames import utils
if hasattr(utils, u'__warningregistry__'):
utils.__warningregistry__.clear()
with catch_warnings() as found_warnings:
location = EarthLocation(lat=(0 * u.deg), lon=(0 * u.deg))
t = Time(u'J2161')
SkyCo... | null | null | null | this
| codeqa | def test future altaz from utils exceptions import Astropy Warningfrom builtin frames import utilsif hasattr utils u' warningregistry ' utils warningregistry clear with catch warnings as found warnings location Earth Location lat 0 * u deg lon 0 * u deg t Time u'J 2161 ' Sky Coord 1 * u deg 2 * u deg transform to Alt A... | null | null | null | null | Question:
What does test the full stack ?
Code:
def test_future_altaz():
from ...utils.exceptions import AstropyWarning
from ..builtin_frames import utils
if hasattr(utils, u'__warningregistry__'):
utils.__warningregistry__.clear()
with catch_warnings() as found_warnings:
location = EarthLocation(lat=(0 * u... |
null | null | null | What does this test ?
| def test_future_altaz():
from ...utils.exceptions import AstropyWarning
from ..builtin_frames import utils
if hasattr(utils, u'__warningregistry__'):
utils.__warningregistry__.clear()
with catch_warnings() as found_warnings:
location = EarthLocation(lat=(0 * u.deg), lon=(0 * u.deg))
t = Time(u'J2161')
SkyCo... | null | null | null | the full stack
| codeqa | def test future altaz from utils exceptions import Astropy Warningfrom builtin frames import utilsif hasattr utils u' warningregistry ' utils warningregistry clear with catch warnings as found warnings location Earth Location lat 0 * u deg lon 0 * u deg t Time u'J 2161 ' Sky Coord 1 * u deg 2 * u deg transform to Alt A... | null | null | null | null | Question:
What does this test ?
Code:
def test_future_altaz():
from ...utils.exceptions import AstropyWarning
from ..builtin_frames import utils
if hasattr(utils, u'__warningregistry__'):
utils.__warningregistry__.clear()
with catch_warnings() as found_warnings:
location = EarthLocation(lat=(0 * u.deg), lon... |
null | null | null | Where do aspect ratios x scales enumerate ?
| def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scales) for i in range(ratio_anchors.shape[0])])
return anchors
| null | null | null | wrt a reference window
| codeqa | def generate anchors base size 16 ratios [0 5 1 2] scales 2 ** np arange 3 6 base anchor np array [1 1 base size base size] - 1 ratio anchors ratio enum base anchor ratios anchors np vstack [ scale enum ratio anchors[i ] scales for i in range ratio anchors shape[ 0 ] ] return anchors
| null | null | null | null | Question:
Where do aspect ratios x scales enumerate ?
Code:
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scal... |
null | null | null | How do anchor windows generate ?
| def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scales) for i in range(ratio_anchors.shape[0])])
return anchors
| null | null | null | by enumerating aspect ratios x scales wrt a reference window
| codeqa | def generate anchors base size 16 ratios [0 5 1 2] scales 2 ** np arange 3 6 base anchor np array [1 1 base size base size] - 1 ratio anchors ratio enum base anchor ratios anchors np vstack [ scale enum ratio anchors[i ] scales for i in range ratio anchors shape[ 0 ] ] return anchors
| null | null | null | null | Question:
How do anchor windows generate ?
Code:
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scales) for i i... |
null | null | null | What is enumerating wrt a reference window ?
| def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scales) for i in range(ratio_anchors.shape[0])])
return anchors
| null | null | null | aspect ratios x scales
| codeqa | def generate anchors base size 16 ratios [0 5 1 2] scales 2 ** np arange 3 6 base anchor np array [1 1 base size base size] - 1 ratio anchors ratio enum base anchor ratios anchors np vstack [ scale enum ratio anchors[i ] scales for i in range ratio anchors shape[ 0 ] ] return anchors
| null | null | null | null | Question:
What is enumerating wrt a reference window ?
Code:
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=(2 ** np.arange(3, 6))):
base_anchor = (np.array([1, 1, base_size, base_size]) - 1)
ratio_anchors = _ratio_enum(base_anchor, ratios)
anchors = np.vstack([_scale_enum(ratio_anchors[i, :], sca... |
null | null | null | How did a dictionary key ?
| def readmailcapfile(fp):
caps = {}
while 1:
line = fp.readline()
if (not line):
break
if ((line[0] == '#') or (line.strip() == '')):
continue
nextline = line
while (nextline[(-2):] == '\\\n'):
nextline = fp.readline()
if (not nextline):
nextline = '\n'
line = (line[:(-2)] + nextline)
(k... | null | null | null | by mime type
| codeqa | def readmailcapfile fp caps {}while 1 line fp readline if not line breakif line[ 0 ] '#' or line strip '' continuenextline linewhile nextline[ -2 ] '\\\n' nextline fp readline if not nextline nextline '\n'line line[ -2 ] + nextline key fields parseline line if not key and fields continuetypes key split '/' for j in ran... | null | null | null | null | Question:
How did a dictionary key ?
Code:
def readmailcapfile(fp):
caps = {}
while 1:
line = fp.readline()
if (not line):
break
if ((line[0] == '#') or (line.strip() == '')):
continue
nextline = line
while (nextline[(-2):] == '\\\n'):
nextline = fp.readline()
if (not nextline):
nextline... |
null | null | null | What did the code return ?
| def readmailcapfile(fp):
caps = {}
while 1:
line = fp.readline()
if (not line):
break
if ((line[0] == '#') or (line.strip() == '')):
continue
nextline = line
while (nextline[(-2):] == '\\\n'):
nextline = fp.readline()
if (not nextline):
nextline = '\n'
line = (line[:(-2)] + nextline)
(k... | null | null | null | a dictionary keyed by mime type
| codeqa | def readmailcapfile fp caps {}while 1 line fp readline if not line breakif line[ 0 ] '#' or line strip '' continuenextline linewhile nextline[ -2 ] '\\\n' nextline fp readline if not nextline nextline '\n'line line[ -2 ] + nextline key fields parseline line if not key and fields continuetypes key split '/' for j in ran... | null | null | null | null | Question:
What did the code return ?
Code:
def readmailcapfile(fp):
caps = {}
while 1:
line = fp.readline()
if (not line):
break
if ((line[0] == '#') or (line.strip() == '')):
continue
nextline = line
while (nextline[(-2):] == '\\\n'):
nextline = fp.readline()
if (not nextline):
nextline... |
null | null | null | What does the code get by side loop ?
| def getGeometryOutputByLoop(elementNode, sideLoop):
sideLoop.rotate(elementNode)
return getGeometryOutputByManipulation(elementNode, sideLoop)
| null | null | null | geometry output
| codeqa | def get Geometry Output By Loop element Node side Loop side Loop rotate element Node return get Geometry Output By Manipulation element Node side Loop
| null | null | null | null | Question:
What does the code get by side loop ?
Code:
def getGeometryOutputByLoop(elementNode, sideLoop):
sideLoop.rotate(elementNode)
return getGeometryOutputByManipulation(elementNode, sideLoop)
|
null | null | null | How does the code get geometry output ?
| def getGeometryOutputByLoop(elementNode, sideLoop):
sideLoop.rotate(elementNode)
return getGeometryOutputByManipulation(elementNode, sideLoop)
| null | null | null | by side loop
| codeqa | def get Geometry Output By Loop element Node side Loop side Loop rotate element Node return get Geometry Output By Manipulation element Node side Loop
| null | null | null | null | Question:
How does the code get geometry output ?
Code:
def getGeometryOutputByLoop(elementNode, sideLoop):
sideLoop.rotate(elementNode)
return getGeometryOutputByManipulation(elementNode, sideLoop)
|
null | null | null | What did the code give ?
| def get_user_id(user):
return user.user_id()
| null | null | null | an user object
| codeqa | def get user id user return user user id
| null | null | null | null | Question:
What did the code give ?
Code:
def get_user_id(user):
return user.user_id()
|
null | null | null | How do column letters find ?
| def _get_column_letter(col_idx):
if (not (1 <= col_idx <= 18278)):
raise ValueError('Invalid column index {0}'.format(col_idx))
letters = []
while (col_idx > 0):
(col_idx, remainder) = divmod(col_idx, 26)
if (remainder == 0):
remainder = 26
col_idx -= 1
letters.append(chr((remainder + 64)))
return ... | null | null | null | in reverse order
| codeqa | def get column letter col idx if not 1 < col idx < 18278 raise Value Error ' Invalidcolumnindex{ 0 }' format col idx letters []while col idx > 0 col idx remainder divmod col idx 26 if remainder 0 remainder 26 col idx - 1letters append chr remainder + 64 return '' join reversed letters
| null | null | null | null | Question:
How do column letters find ?
Code:
def _get_column_letter(col_idx):
if (not (1 <= col_idx <= 18278)):
raise ValueError('Invalid column index {0}'.format(col_idx))
letters = []
while (col_idx > 0):
(col_idx, remainder) = divmod(col_idx, 26)
if (remainder == 0):
remainder = 26
col_idx -= 1... |
null | null | null | What does the code convert into a column letter ?
| def _get_column_letter(col_idx):
if (not (1 <= col_idx <= 18278)):
raise ValueError('Invalid column index {0}'.format(col_idx))
letters = []
while (col_idx > 0):
(col_idx, remainder) = divmod(col_idx, 26)
if (remainder == 0):
remainder = 26
col_idx -= 1
letters.append(chr((remainder + 64)))
return ... | null | null | null | a column number
| codeqa | def get column letter col idx if not 1 < col idx < 18278 raise Value Error ' Invalidcolumnindex{ 0 }' format col idx letters []while col idx > 0 col idx remainder divmod col idx 26 if remainder 0 remainder 26 col idx - 1letters append chr remainder + 64 return '' join reversed letters
| null | null | null | null | Question:
What does the code convert into a column letter ?
Code:
def _get_column_letter(col_idx):
if (not (1 <= col_idx <= 18278)):
raise ValueError('Invalid column index {0}'.format(col_idx))
letters = []
while (col_idx > 0):
(col_idx, remainder) = divmod(col_idx, 26)
if (remainder == 0):
remainder... |
null | null | null | What do none throw only if a manually specified log file is invalid ?
| def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = True
else:
filename = os.path.join(os.path.dirname(digits.__file__), 'digits.log')
if (filen... | null | null | null | an exception
| codeqa | def load logfile filename throw error Falseif 'DIGITS MODE TEST' in os environ filename Noneelif 'DIGITS LOGFILE FILENAME' in os environ filename os environ['DIGITS LOGFILE FILENAME']throw error Trueelse filename os path join os path dirname digits file 'digits log' if filename is not None try filename os path abspath ... | null | null | null | null | Question:
What do none throw only if a manually specified log file is invalid ?
Code:
def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = True
... |
null | null | null | How did log file specify ?
| def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = True
else:
filename = os.path.join(os.path.dirname(digits.__file__), 'digits.log')
if (filen... | null | null | null | manually
| codeqa | def load logfile filename throw error Falseif 'DIGITS MODE TEST' in os environ filename Noneelif 'DIGITS LOGFILE FILENAME' in os environ filename os environ['DIGITS LOGFILE FILENAME']throw error Trueelse filename os path join os path dirname digits file 'digits log' if filename is not None try filename os path abspath ... | null | null | null | null | Question:
How did log file specify ?
Code:
def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = True
else:
filename = os.path.join(os.path.dir... |
null | null | null | What throws an exception only if a manually specified log file is invalid ?
| def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = True
else:
filename = os.path.join(os.path.dirname(digits.__file__), 'digits.log')
if (filen... | null | null | null | none
| codeqa | def load logfile filename throw error Falseif 'DIGITS MODE TEST' in os environ filename Noneelif 'DIGITS LOGFILE FILENAME' in os environ filename os environ['DIGITS LOGFILE FILENAME']throw error Trueelse filename os path join os path dirname digits file 'digits log' if filename is not None try filename os path abspath ... | null | null | null | null | Question:
What throws an exception only if a manually specified log file is invalid ?
Code:
def load_logfile_filename():
throw_error = False
if ('DIGITS_MODE_TEST' in os.environ):
filename = None
elif ('DIGITS_LOGFILE_FILENAME' in os.environ):
filename = os.environ['DIGITS_LOGFILE_FILENAME']
throw_error = ... |
null | null | null | How do instances fill with manually - joined metadata ?
| def _instances_fill_metadata(context, instances, manual_joins=None):
uuids = [inst['uuid'] for inst in instances]
if (manual_joins is None):
manual_joins = ['metadata', 'system_metadata']
meta = collections.defaultdict(list)
if ('metadata' in manual_joins):
for row in _instance_metadata_get_multi(context, uuids... | null | null | null | selectively
| codeqa | def instances fill metadata context instances manual joins None uuids [inst['uuid'] for inst in instances]if manual joins is None manual joins ['metadata' 'system metadata']meta collections defaultdict list if 'metadata' in manual joins for row in instance metadata get multi context uuids meta[row['instance uuid']] app... | null | null | null | null | Question:
How do instances fill with manually - joined metadata ?
Code:
def _instances_fill_metadata(context, instances, manual_joins=None):
uuids = [inst['uuid'] for inst in instances]
if (manual_joins is None):
manual_joins = ['metadata', 'system_metadata']
meta = collections.defaultdict(list)
if ('metadata... |
null | null | null | What does the code update ?
| def _cache_lockfuncs():
global _LOCKFUNCS
_LOCKFUNCS = {}
for modulepath in settings.LOCK_FUNC_MODULES:
_LOCKFUNCS.update(utils.callables_from_module(modulepath))
| null | null | null | the cache
| codeqa | def cache lockfuncs global LOCKFUNCS LOCKFUNCS {}for modulepath in settings LOCK FUNC MODULES LOCKFUNCS update utils callables from module modulepath
| null | null | null | null | Question:
What does the code update ?
Code:
def _cache_lockfuncs():
global _LOCKFUNCS
_LOCKFUNCS = {}
for modulepath in settings.LOCK_FUNC_MODULES:
_LOCKFUNCS.update(utils.callables_from_module(modulepath))
|
null | null | null | What does the code get ?
| def _get_objects(obj_type):
lst_objs = FakeRetrieveResult()
for key in _db_content[obj_type]:
lst_objs.add_object(_db_content[obj_type][key])
return lst_objs
| null | null | null | objects of the type
| codeqa | def get objects obj type lst objs Fake Retrieve Result for key in db content[obj type] lst objs add object db content[obj type][key] return lst objs
| null | null | null | null | Question:
What does the code get ?
Code:
def _get_objects(obj_type):
lst_objs = FakeRetrieveResult()
for key in _db_content[obj_type]:
lst_objs.add_object(_db_content[obj_type][key])
return lst_objs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.