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 written in a string ?
| def bin2long(text, endian):
assert (endian in (LITTLE_ENDIAN, BIG_ENDIAN))
bits = [(ord(character) - ord('0')) for character in text if (character in '01')]
if (endian is not BIG_ENDIAN):
bits = bits[::(-1)]
size = len(bits)
assert (0 < size)
value = 0
for bit in bits:
value *= 2
value += bit
return value... | null | null | null | binary number
| codeqa | def bin 2 long text endian assert endian in LITTLE ENDIAN BIG ENDIAN bits [ ord character - ord '0 ' for character in text if character in '01 ' ]if endian is not BIG ENDIAN bits bits[ -1 ]size len bits assert 0 < size value 0for bit in bits value * 2value + bitreturn value
| null | null | null | null | Question:
What written in a string ?
Code:
def bin2long(text, endian):
assert (endian in (LITTLE_ENDIAN, BIG_ENDIAN))
bits = [(ord(character) - ord('0')) for character in text if (character in '01')]
if (endian is not BIG_ENDIAN):
bits = bits[::(-1)]
size = len(bits)
assert (0 < size)
value = 0
for bit in ... |
null | null | null | What does the code rotate ?
| def rotatePoints(elementNode, points, prefix):
derivation = RotateDerivation(elementNode, prefix)
if (derivation.rotateTetragrid == None):
print 'Warning, rotateTetragrid was None in rotate so nothing will be done for:'
print elementNode
return
matrix.transformVector3sByMatrix(derivation.rotateTetra... | null | null | null | the points
| codeqa | def rotate Points element Node points prefix derivation Rotate Derivation element Node prefix if derivation rotate Tetragrid None print ' Warning rotate Tetragridwas Noneinrotatesonothingwillbedonefor 'print element Nodereturnmatrix transform Vector 3 s By Matrix derivation rotate Tetragrid points
| null | null | null | null | Question:
What does the code rotate ?
Code:
def rotatePoints(elementNode, points, prefix):
derivation = RotateDerivation(elementNode, prefix)
if (derivation.rotateTetragrid == None):
print 'Warning, rotateTetragrid was None in rotate so nothing will be done for:'
print elementNode
return
matrix.... |
null | null | null | What rotated x left ?
| def RotL_64(x, N):
return (np.left_shift(x, (N & 63), dtype=np.uint64) | np.right_shift(x, ((64 - N) & 63), dtype=np.uint64))
| null | null | null | by n
| codeqa | def Rot L 64 x N return np left shift x N & 63 dtype np uint 64 np right shift x 64 - N & 63 dtype np uint 64
| null | null | null | null | Question:
What rotated x left ?
Code:
def RotL_64(x, N):
return (np.left_shift(x, (N & 63), dtype=np.uint64) | np.right_shift(x, ((64 - N) & 63), dtype=np.uint64))
|
null | null | null | What does the code create ?
| def generate_new_element(items, prefix, numeric=False):
while True:
if numeric:
candidate = (prefix + generate_random_numeric(8))
else:
candidate = (prefix + generate_random_alphanumeric(8))
if (candidate not in items):
return candidate
| null | null | null | a random string with prefix
| codeqa | def generate new element items prefix numeric False while True if numeric candidate prefix + generate random numeric 8 else candidate prefix + generate random alphanumeric 8 if candidate not in items return candidate
| null | null | null | null | Question:
What does the code create ?
Code:
def generate_new_element(items, prefix, numeric=False):
while True:
if numeric:
candidate = (prefix + generate_random_numeric(8))
else:
candidate = (prefix + generate_random_alphanumeric(8))
if (candidate not in items):
return candidate
|
null | null | null | How do the current host name return ?
| def gethostname():
return os.environ.get('HTTP_HOST', 'www.appspot.com')
| null | null | null | string
| codeqa | def gethostname return os environ get 'HTTP HOST' 'www appspot com'
| null | null | null | null | Question:
How do the current host name return ?
Code:
def gethostname():
return os.environ.get('HTTP_HOST', 'www.appspot.com')
|
null | null | null | What does the code get ?
| def _get_spec(tree_base, spec, template, saltenv='base'):
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](spec, dest, saltenv=saltenv)
| null | null | null | the spec file
| codeqa | def get spec tree base spec template saltenv 'base' spec tgt os path basename spec dest os path join tree base 'SPECS' spec tgt return salt ['cp get url'] spec dest saltenv saltenv
| null | null | null | null | Question:
What does the code get ?
Code:
def _get_spec(tree_base, spec, template, saltenv='base'):
spec_tgt = os.path.basename(spec)
dest = os.path.join(tree_base, 'SPECS', spec_tgt)
return __salt__['cp.get_url'](spec, dest, saltenv=saltenv)
|
null | null | null | Where do annotations exist only ?
| @pytest.mark.skipif('sys.version_info[0] < 3')
def test_simple_annotations():
source = dedent(" def annot(a:3):\n return a\n\n annot('')")
assert ([d.name for d in jedi.Script(source).goto_definitions()] == ['str'])
source = dedent("\n def annot_ret(a:3) -> 3:\n return a\n\n a... | null | null | null | in python 3
| codeqa | @pytest mark skipif 'sys version info[ 0 ]< 3 ' def test simple annotations source dedent "defannot a 3 \nreturna\n\nannot '' " assert [d name for d in jedi Script source goto definitions ] ['str'] source dedent "\ndefannot ret a 3 -> 3 \nreturna\n\nannot ret '' " assert [d name for d in jedi Script source goto definit... | null | null | null | null | Question:
Where do annotations exist only ?
Code:
@pytest.mark.skipif('sys.version_info[0] < 3')
def test_simple_annotations():
source = dedent(" def annot(a:3):\n return a\n\n annot('')")
assert ([d.name for d in jedi.Script(source).goto_definitions()] == ['str'])
source = dedent("\n def... |
null | null | null | What loads a docker from path ?
| def __load_project(path):
try:
project = get_project(path)
except Exception as inst:
return __handle_except(inst)
return project
| null | null | null | a docker
| codeqa | def load project path try project get project path except Exception as inst return handle except inst return project
| null | null | null | null | Question:
What loads a docker from path ?
Code:
def __load_project(path):
try:
project = get_project(path)
except Exception as inst:
return __handle_except(inst)
return project
|
null | null | null | What do a docker load from path ?
| def __load_project(path):
try:
project = get_project(path)
except Exception as inst:
return __handle_except(inst)
return project
| null | null | null | a docker
| codeqa | def load project path try project get project path except Exception as inst return handle except inst return project
| null | null | null | null | Question:
What do a docker load from path ?
Code:
def __load_project(path):
try:
project = get_project(path)
except Exception as inst:
return __handle_except(inst)
return project
|
null | null | null | What does the code get ?
| def getReceivers(sender=Any, signal=Any):
try:
return connections[id(sender)][signal]
except KeyError:
return []
| null | null | null | list of receivers from global tables
| codeqa | def get Receivers sender Any signal Any try return connections[id sender ][signal]except Key Error return []
| null | null | null | null | Question:
What does the code get ?
Code:
def getReceivers(sender=Any, signal=Any):
try:
return connections[id(sender)][signal]
except KeyError:
return []
|
null | null | null | What does the code make ?
| @builtin(u'Upper-case text', upper, apply_func_to_match_groups)
def replace_uppercase(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
return apply_func_to_match_groups(match, upper)
| null | null | null | matched text upper case
| codeqa | @builtin u' Upper-casetext' upper apply func to match groups def replace uppercase match number file name metadata dictionaries data functions *args **kwargs return apply func to match groups match upper
| null | null | null | null | Question:
What does the code make ?
Code:
@builtin(u'Upper-case text', upper, apply_func_to_match_groups)
def replace_uppercase(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
return apply_func_to_match_groups(match, upper)
|
null | null | null | What does the code create ?
| def new_figure_manager(num, *args, **kwargs):
DEBUG_MSG('new_figure_manager()', 3, None)
backend_wx._create_wx_app()
FigureClass = kwargs.pop('FigureClass', Figure)
fig = FigureClass(*args, **kwargs)
frame = FigureFrameWxAgg(num, fig)
figmgr = frame.get_figure_manager()
if matplotlib.is_interactive():
figmgr.f... | null | null | null | a new figure manager instance
| codeqa | def new figure manager num *args **kwargs DEBUG MSG 'new figure manager ' 3 None backend wx create wx app Figure Class kwargs pop ' Figure Class' Figure fig Figure Class *args **kwargs frame Figure Frame Wx Agg num fig figmgr frame get figure manager if matplotlib is interactive figmgr frame Show return figmgr
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager(num, *args, **kwargs):
DEBUG_MSG('new_figure_manager()', 3, None)
backend_wx._create_wx_app()
FigureClass = kwargs.pop('FigureClass', Figure)
fig = FigureClass(*args, **kwargs)
frame = FigureFrameWxAgg(num, fig)
figmgr = frame.get_figure_manag... |
null | null | null | How do a purge ?
| def purge_url(path):
if settings.DEBUG:
return
api_key = getattr(settings, 'FASTLY_API_KEY', None)
if api_key:
response = requests.request('PURGE', 'https://www.python.org{}'.format(path), headers={'Fastly-Key': api_key})
return response
return None
| null | null | null | fastly
| codeqa | def purge url path if settings DEBUG returnapi key getattr settings 'FASTLY API KEY' None if api key response requests request 'PURGE' 'https //www python org{}' format path headers {' Fastly- Key' api key} return responsereturn None
| null | null | null | null | Question:
How do a purge ?
Code:
def purge_url(path):
if settings.DEBUG:
return
api_key = getattr(settings, 'FASTLY_API_KEY', None)
if api_key:
response = requests.request('PURGE', 'https://www.python.org{}'.format(path), headers={'Fastly-Key': api_key})
return response
return None
|
null | null | null | How do a new parallel backend factory register ?
| def register_parallel_backend(name, factory, make_default=False):
BACKENDS[name] = factory
if make_default:
global DEFAULT_BACKEND
DEFAULT_BACKEND = name
| null | null | null | code
| codeqa | def register parallel backend name factory make default False BACKENDS[name] factoryif make default global DEFAULT BACKENDDEFAULT BACKEND name
| null | null | null | null | Question:
How do a new parallel backend factory register ?
Code:
def register_parallel_backend(name, factory, make_default=False):
BACKENDS[name] = factory
if make_default:
global DEFAULT_BACKEND
DEFAULT_BACKEND = name
|
null | null | null | When do the line number of the list content increment ?
| def add_line_increment(lines, lineModified, diference, atLineStart=False):
def _inner_increment(line):
if (((not atLineStart) and (line <= lineModified)) or (lineModified == (line + diference))):
return line
return (line + diference)
return list(map(_inner_increment, lines))
| null | null | null | when needed
| codeqa | def add line increment lines line Modified diference at Line Start False def inner increment line if not at Line Start and line < line Modified or line Modified line + diference return linereturn line + diference return list map inner increment lines
| null | null | null | null | Question:
When do the line number of the list content increment ?
Code:
def add_line_increment(lines, lineModified, diference, atLineStart=False):
def _inner_increment(line):
if (((not atLineStart) and (line <= lineModified)) or (lineModified == (line + diference))):
return line
return (line + diference)
r... |
null | null | null | What parses the model data to compress extra fields ?
| @set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
| null | null | null | us
| codeqa | @set databasedef create item **kwargs if item return Item create **parse model data item
| null | null | null | null | Question:
What parses the model data to compress extra fields ?
Code:
@set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
|
null | null | null | What do us parse to compress extra fields ?
| @set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
| null | null | null | the model data
| codeqa | @set databasedef create item **kwargs if item return Item create **parse model data item
| null | null | null | null | Question:
What do us parse to compress extra fields ?
Code:
@set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
|
null | null | null | For what purpose do us parse the model data ?
| @set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
| null | null | null | to compress extra fields
| codeqa | @set databasedef create item **kwargs if item return Item create **parse model data item
| null | null | null | null | Question:
For what purpose do us parse the model data ?
Code:
@set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
|
null | null | null | What does us specify ?
| @set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
| null | null | null | a database
| codeqa | @set databasedef create item **kwargs if item return Item create **parse model data item
| null | null | null | null | Question:
What does us specify ?
Code:
@set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
|
null | null | null | What do us compress ?
| @set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
| null | null | null | extra fields
| codeqa | @set databasedef create item **kwargs if item return Item create **parse model data item
| null | null | null | null | Question:
What do us compress ?
Code:
@set_database
def create(item, **kwargs):
if item:
return Item.create(**parse_model_data(item))
|
null | null | null | Where is the code running ?
| def _in_gce_environment():
if (SETTINGS.env_name is not None):
return (SETTINGS.env_name == 'GCE_PRODUCTION')
if ((NO_GCE_CHECK != 'True') and _detect_gce_environment()):
SETTINGS.env_name = 'GCE_PRODUCTION'
return True
return False
| null | null | null | in the compute engine environment
| codeqa | def in gce environment if SETTINGS env name is not None return SETTINGS env name 'GCE PRODUCTION' if NO GCE CHECK ' True' and detect gce environment SETTINGS env name 'GCE PRODUCTION'return Truereturn False
| null | null | null | null | Question:
Where is the code running ?
Code:
def _in_gce_environment():
if (SETTINGS.env_name is not None):
return (SETTINGS.env_name == 'GCE_PRODUCTION')
if ((NO_GCE_CHECK != 'True') and _detect_gce_environment()):
SETTINGS.env_name = 'GCE_PRODUCTION'
return True
return False
|
null | null | null | For what purpose does any value convert to a string ?
| def render_value_in_context(value, context):
value = template_localtime(value, use_tz=context.use_tz)
value = localize(value, use_l10n=context.use_l10n)
value = force_text(value)
if ((context.autoescape and (not isinstance(value, SafeData))) or isinstance(value, EscapeData)):
return escape(value)
else:
return ... | null | null | null | to become part of a rendered template
| codeqa | def render value in context value context value template localtime value use tz context use tz value localize value use l10 n context use l10 n value force text value if context autoescape and not isinstance value Safe Data or isinstance value Escape Data return escape value else return value
| null | null | null | null | Question:
For what purpose does any value convert to a string ?
Code:
def render_value_in_context(value, context):
value = template_localtime(value, use_tz=context.use_tz)
value = localize(value, use_l10n=context.use_l10n)
value = force_text(value)
if ((context.autoescape and (not isinstance(value, SafeData))) ... |
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 does google alert ?
| def ping_google(sitemap_url=None, ping_url=PING_URL):
if (sitemap_url is None):
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.index')
except urlresolvers.NoReverseMatch:
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.sitemap')
except urlresolvers.NoReve... | null | null | null | that the sitemap for the current site has been updated
| codeqa | def ping google sitemap url None ping url PING URL if sitemap url is None try sitemap url urlresolvers reverse 'django contrib sitemaps views index' except urlresolvers No Reverse Match try sitemap url urlresolvers reverse 'django contrib sitemaps views sitemap' except urlresolvers No Reverse Match passif sitemap url i... | null | null | null | null | Question:
What does google alert ?
Code:
def ping_google(sitemap_url=None, ping_url=PING_URL):
if (sitemap_url is None):
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.index')
except urlresolvers.NoReverseMatch:
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.... |
null | null | null | What alerts that the sitemap for the current site has been updated ?
| def ping_google(sitemap_url=None, ping_url=PING_URL):
if (sitemap_url is None):
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.index')
except urlresolvers.NoReverseMatch:
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.sitemap')
except urlresolvers.NoReve... | null | null | null | google
| codeqa | def ping google sitemap url None ping url PING URL if sitemap url is None try sitemap url urlresolvers reverse 'django contrib sitemaps views index' except urlresolvers No Reverse Match try sitemap url urlresolvers reverse 'django contrib sitemaps views sitemap' except urlresolvers No Reverse Match passif sitemap url i... | null | null | null | null | Question:
What alerts that the sitemap for the current site has been updated ?
Code:
def ping_google(sitemap_url=None, ping_url=PING_URL):
if (sitemap_url is None):
try:
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.index')
except urlresolvers.NoReverseMatch:
try:
sitemap_url = ur... |
null | null | null | What does the code initialize ?
| def initializeModule(libc):
for function in ('inotify_add_watch', 'inotify_init', 'inotify_rm_watch'):
if (getattr(libc, function, None) is None):
raise ImportError('libc6 2.4 or higher needed')
libc.inotify_init.argtypes = []
libc.inotify_init.restype = ctypes.c_int
libc.inotify_rm_watch.argtypes = [ctype... | null | null | null | the module
| codeqa | def initialize Module libc for function in 'inotify add watch' 'inotify init' 'inotify rm watch' if getattr libc function None is None raise Import Error 'libc 62 4orhigherneeded' libc inotify init argtypes []libc inotify init restype ctypes c intlibc inotify rm watch argtypes [ctypes c int ctypes c int]libc inotify rm... | null | null | null | null | Question:
What does the code initialize ?
Code:
def initializeModule(libc):
for function in ('inotify_add_watch', 'inotify_init', 'inotify_rm_watch'):
if (getattr(libc, function, None) is None):
raise ImportError('libc6 2.4 or higher needed')
libc.inotify_init.argtypes = []
libc.inotify_init.restype = c... |
null | null | null | For what purpose did all folders need ?
| def rename_ep_file(cur_path, new_path, old_path_length=0):
if ((old_path_length == 0) or (old_path_length > len(cur_path))):
(cur_file_name, cur_file_ext) = ek(os.path.splitext, cur_path)
else:
cur_file_ext = cur_path[old_path_length:]
cur_file_name = cur_path[:old_path_length]
if (cur_file_ext[1:] in SUBTITLE... | null | null | null | to move a file to its new location
| codeqa | def rename ep file cur path new path old path length 0 if old path length 0 or old path length > len cur path cur file name cur file ext ek os path splitext cur path else cur file ext cur path[old path length ]cur file name cur path[ old path length]if cur file ext[ 1 ] in SUBTITLE EXTENSIONS sublang ek os path splitex... | null | null | null | null | Question:
For what purpose did all folders need ?
Code:
def rename_ep_file(cur_path, new_path, old_path_length=0):
if ((old_path_length == 0) or (old_path_length > len(cur_path))):
(cur_file_name, cur_file_ext) = ek(os.path.splitext, cur_path)
else:
cur_file_ext = cur_path[old_path_length:]
cur_file_name = ... |
null | null | null | What specified on the command line ?
| def GetCommandLineFiles(command_line_file_list, recursive, exclude):
return _FindPythonFiles(command_line_file_list, recursive, exclude)
| null | null | null | files
| codeqa | def Get Command Line Files command line file list recursive exclude return Find Python Files command line file list recursive exclude
| null | null | null | null | Question:
What specified on the command line ?
Code:
def GetCommandLineFiles(command_line_file_list, recursive, exclude):
return _FindPythonFiles(command_line_file_list, recursive, exclude)
|
null | null | null | Where did files specify ?
| def GetCommandLineFiles(command_line_file_list, recursive, exclude):
return _FindPythonFiles(command_line_file_list, recursive, exclude)
| null | null | null | on the command line
| codeqa | def Get Command Line Files command line file list recursive exclude return Find Python Files command line file list recursive exclude
| null | null | null | null | Question:
Where did files specify ?
Code:
def GetCommandLineFiles(command_line_file_list, recursive, exclude):
return _FindPythonFiles(command_line_file_list, recursive, exclude)
|
null | null | null | How do string s represent ?
| def toBase64(s):
return binascii.b2a_base64(s)[:(-1)]
| null | null | null | as base64
| codeqa | def to Base 64 s return binascii b2 a base 64 s [ -1 ]
| null | null | null | null | Question:
How do string s represent ?
Code:
def toBase64(s):
return binascii.b2a_base64(s)[:(-1)]
|
null | null | null | What does the code update ?
| def update(context, namespace_name, id, values, session):
namespace_api.get(context, namespace_name, session)
metadata_tag = _get(context, id, session)
metadef_utils.drop_protected_attrs(models.MetadefTag, values)
try:
metadata_tag.update(values.copy())
metadata_tag.save(session=session)
except db_exc.DBDuplic... | null | null | null | an tag
| codeqa | def update context namespace name id values session namespace api get context namespace name session metadata tag get context id session metadef utils drop protected attrs models Metadef Tag values try metadata tag update values copy metadata tag save session session except db exc DB Duplicate Entry LOG debug ' Invalid... | null | null | null | null | Question:
What does the code update ?
Code:
def update(context, namespace_name, id, values, session):
namespace_api.get(context, namespace_name, session)
metadata_tag = _get(context, id, session)
metadef_utils.drop_protected_attrs(models.MetadefTag, values)
try:
metadata_tag.update(values.copy())
metadata_t... |
null | null | null | When should imports be on separate lines ?
| def imports_on_separate_lines(logical_line):
line = logical_line
if line.startswith('import '):
found = line.find(',')
if (found > (-1)):
return (found, 'E401 multiple imports on one line')
| null | null | null | usually
| codeqa | def imports on separate lines logical line line logical lineif line startswith 'import' found line find ' ' if found > -1 return found 'E 401 multipleimportsononeline'
| null | null | null | null | Question:
When should imports be on separate lines ?
Code:
def imports_on_separate_lines(logical_line):
line = logical_line
if line.startswith('import '):
found = line.find(',')
if (found > (-1)):
return (found, 'E401 multiple imports on one line')
|
null | null | null | What does the code ensure ?
| def test_retry_on_normal_error(b, collect):
blob_name = 'test-blob-name'
k = storage.Blob(blob_name, b)
collect.inject(Exception('Normal error'))
d = gs_deleter.Deleter()
d.delete(k)
while (len(collect.aborted_blobs) < 2):
gevent.sleep(0.1)
assert (not collect.deleted_blobs)
collect.inject(None)
d.close()
... | null | null | null | retries are processed for most errors
| codeqa | def test retry on normal error b collect blob name 'test-blob-name'k storage Blob blob name b collect inject Exception ' Normalerror' d gs deleter Deleter d delete k while len collect aborted blobs < 2 gevent sleep 0 1 assert not collect deleted blobs collect inject None d close assert collect deleted blobs [blob name]... | null | null | null | null | Question:
What does the code ensure ?
Code:
def test_retry_on_normal_error(b, collect):
blob_name = 'test-blob-name'
k = storage.Blob(blob_name, b)
collect.inject(Exception('Normal error'))
d = gs_deleter.Deleter()
d.delete(k)
while (len(collect.aborted_blobs) < 2):
gevent.sleep(0.1)
assert (not collect.d... |
null | null | null | What requires that a user be logged in to access a handler ?
| def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not user):
return self.redirect(users.create_login_url(self.r... | null | null | null | a decorator
| codeqa | def login required handler method def check login self *args **kwargs if self request method 'GET' self abort 400 detail ' Thelogin requireddecoratorcanonlybeusedfor GE Trequests ' user users get current user if not user return self redirect users create login url self request url else handler method self *args **kwarg... | null | null | null | null | Question:
What requires that a user be logged in to access a handler ?
Code:
def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_curr... |
null | null | null | In which direction be a user logged to access a handler ?
| def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not user):
return self.redirect(users.create_login_url(self.r... | null | null | null | in
| codeqa | def login required handler method def check login self *args **kwargs if self request method 'GET' self abort 400 detail ' Thelogin requireddecoratorcanonlybeusedfor GE Trequests ' user users get current user if not user return self redirect users create login url self request url else handler method self *args **kwarg... | null | null | null | null | Question:
In which direction be a user logged to access a handler ?
Code:
def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current... |
null | null | null | For what purpose be a user logged in ?
| def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not user):
return self.redirect(users.create_login_url(self.r... | null | null | null | to access a handler
| codeqa | def login required handler method def check login self *args **kwargs if self request method 'GET' self abort 400 detail ' Thelogin requireddecoratorcanonlybeusedfor GE Trequests ' user users get current user if not user return self redirect users create login url self request url else handler method self *args **kwarg... | null | null | null | null | Question:
For what purpose be a user logged in ?
Code:
def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not u... |
null | null | null | What did a user access ?
| def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not user):
return self.redirect(users.create_login_url(self.r... | null | null | null | a handler
| codeqa | def login required handler method def check login self *args **kwargs if self request method 'GET' self abort 400 detail ' Thelogin requireddecoratorcanonlybeusedfor GE Trequests ' user users get current user if not user return self redirect users create login url self request url else handler method self *args **kwarg... | null | null | null | null | Question:
What did a user access ?
Code:
def login_required(handler_method):
def check_login(self, *args, **kwargs):
if (self.request.method != 'GET'):
self.abort(400, detail='The login_required decorator can only be used for GET requests.')
user = users.get_current_user()
if (not user):
retur... |
null | null | null | What does the code add ?
| def info(request, message, extra_tags='', fail_silently=False):
add_message(request, constants.INFO, message, extra_tags=extra_tags, fail_silently=fail_silently)
| null | null | null | a message with the info level
| codeqa | def info request message extra tags '' fail silently False add message request constants INFO message extra tags extra tags fail silently fail silently
| null | null | null | null | Question:
What does the code add ?
Code:
def info(request, message, extra_tags='', fail_silently=False):
add_message(request, constants.INFO, message, extra_tags=extra_tags, fail_silently=fail_silently)
|
null | null | null | What returns over a series of lists of length size from iterable ?
| def group(seq, size):
def take(seq, n):
for i in xrange(n):
(yield seq.next())
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
x = list(take(seq, size))
if x:
(yield x)
else:
break
| null | null | null | an iterator
| codeqa | def group seq size def take seq n for i in xrange n yield seq next if not hasattr seq 'next' seq iter seq while True x list take seq size if x yield x else break
| null | null | null | null | Question:
What returns over a series of lists of length size from iterable ?
Code:
def group(seq, size):
def take(seq, n):
for i in xrange(n):
(yield seq.next())
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
x = list(take(seq, size))
if x:
(yield x)
else:
break
|
null | null | null | Where does an iterator return ?
| def group(seq, size):
def take(seq, n):
for i in xrange(n):
(yield seq.next())
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
x = list(take(seq, size))
if x:
(yield x)
else:
break
| null | null | null | over a series of lists of length size from iterable
| codeqa | def group seq size def take seq n for i in xrange n yield seq next if not hasattr seq 'next' seq iter seq while True x list take seq size if x yield x else break
| null | null | null | null | Question:
Where does an iterator return ?
Code:
def group(seq, size):
def take(seq, n):
for i in xrange(n):
(yield seq.next())
if (not hasattr(seq, 'next')):
seq = iter(seq)
while True:
x = list(take(seq, size))
if x:
(yield x)
else:
break
|
null | null | null | What do a simple dialogue allow ?
| def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file(s) to open'), allowed=None):
if (allowed is None):
allowed = 'PsychoPy Data (*.psydat)|*.psydat|txt (*.txt,*.dlm,*.csv)|*.txt;*.dlm;*.csv|pickled files (*.pickle, *.pkl)|*.pickle|shelved files (*.shelf)|*.shelf|All files (*.*... | null | null | null | read access to the file system
| codeqa | def file Open Dlg try File Path '' try File Name '' prompt translate ' Selectfile s toopen' allowed None if allowed is None allowed ' Psycho Py Data * psydat * psydat txt * txt * dlm * csv * txt * dlm * csv pickledfiles * pickle * pkl * pickle shelvedfiles * shelf * shelf Allfiles * * * *'global appapp ensure Wx App dl... | null | null | null | null | Question:
What do a simple dialogue allow ?
Code:
def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file(s) to open'), allowed=None):
if (allowed is None):
allowed = 'PsychoPy Data (*.psydat)|*.psydat|txt (*.txt,*.dlm,*.csv)|*.txt;*.dlm;*.csv|pickled files (*.pickle, *.pkl)|*.pic... |
null | null | null | What is allowing read access to the file system ?
| def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file(s) to open'), allowed=None):
if (allowed is None):
allowed = 'PsychoPy Data (*.psydat)|*.psydat|txt (*.txt,*.dlm,*.csv)|*.txt;*.dlm;*.csv|pickled files (*.pickle, *.pkl)|*.pickle|shelved files (*.shelf)|*.shelf|All files (*.*... | null | null | null | a simple dialogue
| codeqa | def file Open Dlg try File Path '' try File Name '' prompt translate ' Selectfile s toopen' allowed None if allowed is None allowed ' Psycho Py Data * psydat * psydat txt * txt * dlm * csv * txt * dlm * csv pickledfiles * pickle * pkl * pickle shelvedfiles * shelf * shelf Allfiles * * * *'global appapp ensure Wx App dl... | null | null | null | null | Question:
What is allowing read access to the file system ?
Code:
def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file(s) to open'), allowed=None):
if (allowed is None):
allowed = 'PsychoPy Data (*.psydat)|*.psydat|txt (*.txt,*.dlm,*.csv)|*.txt;*.dlm;*.csv|pickled files (*.pickl... |
null | null | null | How do all files in the show command list ?
| @pytest.mark.network
def test_show_with_all_files(script):
script.pip('install', 'initools==0.2')
result = script.pip('show', '--files', 'initools')
lines = result.stdout.splitlines()
assert ('Cannot locate installed-files.txt' not in lines[6]), lines[6]
assert re.search('Files:\\n( .+\\n)+', result.stdout)
| null | null | null | test
| codeqa | @pytest mark networkdef test show with all files script script pip 'install' 'initools 0 2' result script pip 'show' '--files' 'initools' lines result stdout splitlines assert ' Cannotlocateinstalled-files txt' not in lines[ 6 ] lines[ 6 ]assert re search ' Files \\n +\\n +' result stdout
| null | null | null | null | Question:
How do all files in the show command list ?
Code:
@pytest.mark.network
def test_show_with_all_files(script):
script.pip('install', 'initools==0.2')
result = script.pip('show', '--files', 'initools')
lines = result.stdout.splitlines()
assert ('Cannot locate installed-files.txt' not in lines[6]), line... |
null | null | null | By how much do timestamp conflict ?
| def timestampID(db, table):
t = intTime(1000)
while db.scalar(('select id from %s where id = ?' % table), t):
t += 1
return t
| null | null | null | non
| codeqa | def timestamp ID db table t int Time 1000 while db scalar 'selectidfrom%swhereid ?' % table t t + 1return t
| null | null | null | null | Question:
By how much do timestamp conflict ?
Code:
def timestampID(db, table):
t = intTime(1000)
while db.scalar(('select id from %s where id = ?' % table), t):
t += 1
return t
|
null | null | null | What does this method return to a low - level base cipher ?
| def _create_base_cipher(dict_parameters):
use_aesni = dict_parameters.pop('use_aesni', True)
try:
key = dict_parameters.pop('key')
except KeyError:
raise TypeError("Missing 'key' parameter")
expect_byte_string(key)
if (len(key) not in key_size):
raise ValueError(('Incorrect AES key length (%d bytes)' ... | null | null | null | a handle
| codeqa | def create base cipher dict parameters use aesni dict parameters pop 'use aesni' True try key dict parameters pop 'key' except Key Error raise Type Error " Missing'key'parameter" expect byte string key if len key not in key size raise Value Error ' Incorrect AE Skeylength %dbytes ' % len key if use aesni and raw aesni ... | null | null | null | null | Question:
What does this method return to a low - level base cipher ?
Code:
def _create_base_cipher(dict_parameters):
use_aesni = dict_parameters.pop('use_aesni', True)
try:
key = dict_parameters.pop('key')
except KeyError:
raise TypeError("Missing 'key' parameter")
expect_byte_string(key)
if (len(key) n... |
null | null | null | What checks state ?
| def _checkState(manager):
manager.checkState()
| null | null | null | a relaying manager
| codeqa | def check State manager manager check State
| null | null | null | null | Question:
What checks state ?
Code:
def _checkState(manager):
manager.checkState()
|
null | null | null | What do a relaying manager check ?
| def _checkState(manager):
manager.checkState()
| null | null | null | state
| codeqa | def check State manager manager check State
| null | null | null | null | Question:
What do a relaying manager check ?
Code:
def _checkState(manager):
manager.checkState()
|
null | null | null | What does the code prompt to check state ?
| def _checkState(manager):
manager.checkState()
| null | null | null | a relaying manager
| codeqa | def check State manager manager check State
| null | null | null | null | Question:
What does the code prompt to check state ?
Code:
def _checkState(manager):
manager.checkState()
|
null | null | null | What does the code prompt a relaying manager ?
| def _checkState(manager):
manager.checkState()
| null | null | null | to check state
| codeqa | def check State manager manager check State
| null | null | null | null | Question:
What does the code prompt a relaying manager ?
Code:
def _checkState(manager):
manager.checkState()
|
null | null | null | What does the code get ?
| def GetRegisteredNamedPath(name):
keyStr = (BuildDefaultPythonKey() + '\\PythonPath')
if name:
keyStr = ((keyStr + '\\') + name)
try:
return win32api.RegQueryValue(GetRootKey(), keyStr)
except win32api.error as (code, fn, details):
import winerror
if (code != winerror.ERROR_FILE_NOT_FOUND):
raise win32ap... | null | null | null | a registered named path
| codeqa | def Get Registered Named Path name key Str Build Default Python Key + '\\ Python Path' if name key Str key Str + '\\' + name try return win 32 api Reg Query Value Get Root Key key Str except win 32 api error as code fn details import winerrorif code winerror ERROR FILE NOT FOUND raise win 32 api error code fn details r... | null | null | null | null | Question:
What does the code get ?
Code:
def GetRegisteredNamedPath(name):
keyStr = (BuildDefaultPythonKey() + '\\PythonPath')
if name:
keyStr = ((keyStr + '\\') + name)
try:
return win32api.RegQueryValue(GetRootKey(), keyStr)
except win32api.error as (code, fn, details):
import winerror
if (code != win... |
null | null | null | What does the code get ?
| def getVoronoiLoopByPoints(inside, loop, outsides):
for outside in outsides:
loop = getVoronoiLoopByPoint(inside, loop, outside)
return loop
| null | null | null | voronoi loop enclosing the inside
| codeqa | def get Voronoi Loop By Points inside loop outsides for outside in outsides loop get Voronoi Loop By Point inside loop outside return loop
| null | null | null | null | Question:
What does the code get ?
Code:
def getVoronoiLoopByPoints(inside, loop, outsides):
for outside in outsides:
loop = getVoronoiLoopByPoint(inside, loop, outside)
return loop
|
null | null | null | When did plugin order prefer ?
| def plugin_order():
p = {}
for func in plugin_store:
p[func] = [plugin_name for (plugin_name, f) in plugin_store[func]]
return p
| null | null | null | currently
| codeqa | def plugin order p {}for func in plugin store p[func] [plugin name for plugin name f in plugin store[func]]return p
| null | null | null | null | Question:
When did plugin order prefer ?
Code:
def plugin_order():
p = {}
for func in plugin_store:
p[func] = [plugin_name for (plugin_name, f) in plugin_store[func]]
return p
|
null | null | null | What does the code update ?
| def list_update(t):
slug = raw_input(light_magenta('Your list that you want to update: ', rl=True))
name = raw_input(light_magenta('Update name (leave blank to unchange): ', rl=True))
mode = raw_input(light_magenta('Update mode (public/private): ', rl=True))
description = raw_input(light_magenta('Up... | null | null | null | a list
| codeqa | def list update t slug raw input light magenta ' Yourlistthatyouwanttoupdate ' rl True name raw input light magenta ' Updatename leaveblanktounchange ' rl True mode raw input light magenta ' Updatemode public/private ' rl True description raw input light magenta ' Updatedescription ' rl True try if name t lists update ... | null | null | null | null | Question:
What does the code update ?
Code:
def list_update(t):
slug = raw_input(light_magenta('Your list that you want to update: ', rl=True))
name = raw_input(light_magenta('Update name (leave blank to unchange): ', rl=True))
mode = raw_input(light_magenta('Update mode (public/private): ', rl=T... |
null | null | null | How does an input variable reshape ?
| def reshape(x, shape):
return Reshape(shape)(x)
| null | null | null | without copy
| codeqa | def reshape x shape return Reshape shape x
| null | null | null | null | Question:
How does an input variable reshape ?
Code:
def reshape(x, shape):
return Reshape(shape)(x)
|
null | null | null | What accepts an object unless it is a : class : pyramid ?
| def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
| null | null | null | function
| codeqa | def undefer v if isinstance v Deferred v v resolve return v
| null | null | null | null | Question:
What accepts an object unless it is a : class : pyramid ?
Code:
def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
|
null | null | null | What returns it unless it is a : class : pyramid ?
| def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
| null | null | null | function
| codeqa | def undefer v if isinstance v Deferred v v resolve return v
| null | null | null | null | Question:
What returns it unless it is a : class : pyramid ?
Code:
def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
|
null | null | null | What does function accept unless it is a : class : pyramid ?
| def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
| null | null | null | an object
| codeqa | def undefer v if isinstance v Deferred v v resolve return v
| null | null | null | null | Question:
What does function accept unless it is a : class : pyramid ?
Code:
def undefer(v):
if isinstance(v, Deferred):
v = v.resolve()
return v
|
null | null | null | What does the code compute ?
| def inverse_sine_transform(F, k, x, **hints):
return InverseSineTransform(F, k, x).doit(**hints)
| null | null | null | the unitary
| codeqa | def inverse sine transform F k x **hints return Inverse Sine Transform F k x doit **hints
| null | null | null | null | Question:
What does the code compute ?
Code:
def inverse_sine_transform(F, k, x, **hints):
return InverseSineTransform(F, k, x).doit(**hints)
|
null | null | null | What does the code add to a registered service ?
| def DNSServiceAddRecord(sdRef, flags=0, rrtype=_NO_DEFAULT, rdata=_NO_DEFAULT, ttl=0):
_NO_DEFAULT.check(rrtype)
_NO_DEFAULT.check(rdata)
(rdlen, rdata) = _string_to_length_and_void_p(rdata)
_global_lock.acquire()
try:
RecordRef = _DNSServiceAddRecord(sdRef, flags, rrtype, rdlen, rdata, ttl)
finally:
_global_... | null | null | null | a record
| codeqa | def DNS Service Add Record sd Ref flags 0 rrtype NO DEFAULT rdata NO DEFAULT ttl 0 NO DEFAULT check rrtype NO DEFAULT check rdata rdlen rdata string to length and void p rdata global lock acquire try Record Ref DNS Service Add Record sd Ref flags rrtype rdlen rdata ttl finally global lock release sd Ref add record ref ... | null | null | null | null | Question:
What does the code add to a registered service ?
Code:
def DNSServiceAddRecord(sdRef, flags=0, rrtype=_NO_DEFAULT, rdata=_NO_DEFAULT, ttl=0):
_NO_DEFAULT.check(rrtype)
_NO_DEFAULT.check(rdata)
(rdlen, rdata) = _string_to_length_and_void_p(rdata)
_global_lock.acquire()
try:
RecordRef = _DNSServiceAd... |
null | null | null | How does it decode ?
| def get_script_name(environ, charset='utf-8', errors='replace'):
path = wsgi_get_bytes(environ.get('SCRIPT_NAME', ''))
return to_unicode(path, charset, errors, allow_none_charset=True)
| null | null | null | properly
| codeqa | def get script name environ charset 'utf- 8 ' errors 'replace' path wsgi get bytes environ get 'SCRIPT NAME' '' return to unicode path charset errors allow none charset True
| null | null | null | null | Question:
How does it decode ?
Code:
def get_script_name(environ, charset='utf-8', errors='replace'):
path = wsgi_get_bytes(environ.get('SCRIPT_NAME', ''))
return to_unicode(path, charset, errors, allow_none_charset=True)
|
null | null | null | What can a decorator be used ?
| def deprecated(comment=None):
def _deprecated(func):
def newFunc(*args, **kwargs):
message = ('Call to deprecated function %s' % func.__name__)
if comment:
message += (': ' + comment)
warn(message, category=DeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
newFunc.__name__ = func.... | null | null | null | to mark functions as deprecated
| codeqa | def deprecated comment None def deprecated func def new Func *args **kwargs message ' Calltodeprecatedfunction%s' % func name if comment message + ' ' + comment warn message category Deprecation Warning stacklevel 2 return func *args **kwargs new Func name func name new Func doc func doc new Func dict update func dict ... | null | null | null | null | Question:
What can a decorator be used ?
Code:
def deprecated(comment=None):
def _deprecated(func):
def newFunc(*args, **kwargs):
message = ('Call to deprecated function %s' % func.__name__)
if comment:
message += (': ' + comment)
warn(message, category=DeprecationWarning, stacklevel=2)
retu... |
null | null | null | What can be used to mark functions as deprecated ?
| def deprecated(comment=None):
def _deprecated(func):
def newFunc(*args, **kwargs):
message = ('Call to deprecated function %s' % func.__name__)
if comment:
message += (': ' + comment)
warn(message, category=DeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
newFunc.__name__ = func.... | null | null | null | a decorator
| codeqa | def deprecated comment None def deprecated func def new Func *args **kwargs message ' Calltodeprecatedfunction%s' % func name if comment message + ' ' + comment warn message category Deprecation Warning stacklevel 2 return func *args **kwargs new Func name func name new Func doc func doc new Func dict update func dict ... | null | null | null | null | Question:
What can be used to mark functions as deprecated ?
Code:
def deprecated(comment=None):
def _deprecated(func):
def newFunc(*args, **kwargs):
message = ('Call to deprecated function %s' % func.__name__)
if comment:
message += (': ' + comment)
warn(message, category=DeprecationWarning, s... |
null | null | null | What does the code return ?
| def decrypt_string(s, key=''):
key += ' '
s = base64.urlsafe_b64decode(s)
a = []
for i in xrange(len(s)):
try:
a.append(chr((ord(s[i]) - (ord(key[(i % len(key))]) % 256))))
except:
raise DecryptionError()
s = ''.join(a)
s = decode_utf8(s)
return s
| null | null | null | the given string
| codeqa | def decrypt string s key '' key + ''s base 64 urlsafe b64 decode s a []for i in xrange len s try a append chr ord s[i] - ord key[ i % len key ] % 256 except raise Decryption Error s '' join a s decode utf 8 s return s
| null | null | null | null | Question:
What does the code return ?
Code:
def decrypt_string(s, key=''):
key += ' '
s = base64.urlsafe_b64decode(s)
a = []
for i in xrange(len(s)):
try:
a.append(chr((ord(s[i]) - (ord(key[(i % len(key))]) % 256))))
except:
raise DecryptionError()
s = ''.join(a)
s = decode_utf8(s)
return s
|
null | null | null | How does frequency shift to apply to delay - normalized filter such that -3 db point is at 1 rad / sec find ?
| def _norm_factor(p, k):
p = asarray(p, dtype=complex)
def G(w):
'\n Gain of filter\n '
return abs((k / prod(((1j * w) - p))))
def cutoff(w):
'\n When gain = -3 dB, return 0\n '
return (G(w) - (1 / np.sqrt(2)))
return optimize.newton(cutoff, 1.5)
| null | null | null | numerically
| codeqa | def norm factor p k p asarray p dtype complex def G w '\n Gainoffilter\n'return abs k / prod 1j * w - p def cutoff w '\n Whengain -3 d B return 0 \n'return G w - 1 / np sqrt 2 return optimize newton cutoff 1 5
| null | null | null | null | Question:
How does frequency shift to apply to delay - normalized filter such that -3 db point is at 1 rad / sec find ?
Code:
def _norm_factor(p, k):
p = asarray(p, dtype=complex)
def G(w):
'\n Gain of filter\n '
return abs((k / prod(((1j * w) - p))))
def cutoff(w):
'\n When gain... |
null | null | null | What do none convert ?
| def None2NULL(o, d):
return NULL
| null | null | null | to null
| codeqa | def None 2 NULL o d return NULL
| null | null | null | null | Question:
What do none convert ?
Code:
def None2NULL(o, d):
return NULL
|
null | null | null | What converts to null ?
| def None2NULL(o, d):
return NULL
| null | null | null | none
| codeqa | def None 2 NULL o d return NULL
| null | null | null | null | Question:
What converts to null ?
Code:
def None2NULL(o, d):
return NULL
|
null | null | null | What created on the local disk ?
| def create_local_srs():
for host_ref in _db_content['host'].keys():
create_sr(name_label='Local storage', type='lvm', other_config={'i18n-original-value-name_label': 'Local storage', 'i18n-key': 'local-storage'}, physical_size=40000, physical_utilisation=20000, virtual_allocation=10000, host_ref=host_ref)
create... | null | null | null | the one
| codeqa | def create local srs for host ref in db content['host'] keys create sr name label ' Localstorage' type 'lvm' other config {'i 18 n-original-value-name label' ' Localstorage' 'i 18 n-key' 'local-storage'} physical size 40000 physical utilisation 20000 virtual allocation 10000 host ref host ref create sr name label ' Loc... | null | null | null | null | Question:
What created on the local disk ?
Code:
def create_local_srs():
for host_ref in _db_content['host'].keys():
create_sr(name_label='Local storage', type='lvm', other_config={'i18n-original-value-name_label': 'Local storage', 'i18n-key': 'local-storage'}, physical_size=40000, physical_utilisation=20000, ... |
null | null | null | What does the code generate ?
| def enum(enum_type='enum', base_classes=None, methods=None, **attrs):
def __init__(instance, *args, **kwargs):
raise RuntimeError(('%s types can not be initialized.' % enum_type))
if (base_classes is None):
base_classes = ()
if (methods is None):
methods = {}
base_classes = (base_classes + (object,))
fo... | null | null | null | a enumeration with the given attributes
| codeqa | def enum enum type 'enum' base classes None methods None **attrs def init instance *args **kwargs raise Runtime Error '%stypescannotbeinitialized ' % enum type if base classes is None base classes if methods is None methods {}base classes base classes + object for k v in methods items methods[k] classmethod v attrs['en... | null | null | null | null | Question:
What does the code generate ?
Code:
def enum(enum_type='enum', base_classes=None, methods=None, **attrs):
def __init__(instance, *args, **kwargs):
raise RuntimeError(('%s types can not be initialized.' % enum_type))
if (base_classes is None):
base_classes = ()
if (methods is None):
methods =... |
null | null | null | What matches the supplied certificate ?
| def assert_fingerprint(cert, fingerprint):
hashfunc_map = {16: md5, 20: sha1, 32: sha256}
fingerprint = fingerprint.replace(':', '').lower()
(digest_length, odd) = divmod(len(fingerprint), 2)
if (odd or (digest_length not in hashfunc_map)):
raise SSLError('Fingerprint is of invalid length.')
fingerprint_byte... | null | null | null | given fingerprint
| codeqa | def assert fingerprint cert fingerprint hashfunc map {16 md 5 20 sha 1 32 sha 256 }fingerprint fingerprint replace ' ' '' lower digest length odd divmod len fingerprint 2 if odd or digest length not in hashfunc map raise SSL Error ' Fingerprintisofinvalidlength ' fingerprint bytes unhexlify fingerprint encode hashfunc ... | null | null | null | null | Question:
What matches the supplied certificate ?
Code:
def assert_fingerprint(cert, fingerprint):
hashfunc_map = {16: md5, 20: sha1, 32: sha256}
fingerprint = fingerprint.replace(':', '').lower()
(digest_length, odd) = divmod(len(fingerprint), 2)
if (odd or (digest_length not in hashfunc_map)):
raise SSLErro... |
null | null | null | What does the code delete from database ?
| def serialize_delete(collection, item):
__connect()
collection = mongodb[collection.collection_type()]
collection.remove({'name': item.name})
| null | null | null | a collection item
| codeqa | def serialize delete collection item connect collection mongodb[collection collection type ]collection remove {'name' item name}
| null | null | null | null | Question:
What does the code delete from database ?
Code:
def serialize_delete(collection, item):
__connect()
collection = mongodb[collection.collection_type()]
collection.remove({'name': item.name})
|
null | null | null | What does the code deserialize into a python data structure ?
| def deserialize(stream_or_string, **options):
try:
if (not isinstance(stream_or_string, (bytes, string_types))):
return json.load(stream_or_string, **options)
if isinstance(stream_or_string, bytes):
stream_or_string = stream_or_string.decode('utf-8')
return json.loads(stream_or_string)
except Exception as... | null | null | null | any string or stream like object
| codeqa | def deserialize stream or string **options try if not isinstance stream or string bytes string types return json load stream or string **options if isinstance stream or string bytes stream or string stream or string decode 'utf- 8 ' return json loads stream or string except Exception as error raise Deserialization Erro... | null | null | null | null | Question:
What does the code deserialize into a python data structure ?
Code:
def deserialize(stream_or_string, **options):
try:
if (not isinstance(stream_or_string, (bytes, string_types))):
return json.load(stream_or_string, **options)
if isinstance(stream_or_string, bytes):
stream_or_string = stream_or... |
null | null | null | What does the code get ?
| def getRemovedFloatByKeys(defaultFloat, elementNode, keys, prefix):
for key in keys:
defaultFloat = getRemovedFloat(defaultFloat, elementNode, key, prefix)
return defaultFloat
| null | null | null | the float by the keys and the prefix
| codeqa | def get Removed Float By Keys default Float element Node keys prefix for key in keys default Float get Removed Float default Float element Node key prefix return default Float
| null | null | null | null | Question:
What does the code get ?
Code:
def getRemovedFloatByKeys(defaultFloat, elementNode, keys, prefix):
for key in keys:
defaultFloat = getRemovedFloat(defaultFloat, elementNode, key, prefix)
return defaultFloat
|
null | null | null | How do pixels add to the pixel table ?
| def addPixelToPixelTableWithSteepness(isSteep, pixelDictionary, value, x, y):
if isSteep:
pixelDictionary[(y, x)] = value
else:
pixelDictionary[(x, y)] = value
| null | null | null | with steepness
| codeqa | def add Pixel To Pixel Table With Steepness is Steep pixel Dictionary value x y if is Steep pixel Dictionary[ y x ] valueelse pixel Dictionary[ x y ] value
| null | null | null | null | Question:
How do pixels add to the pixel table ?
Code:
def addPixelToPixelTableWithSteepness(isSteep, pixelDictionary, value, x, y):
if isSteep:
pixelDictionary[(y, x)] = value
else:
pixelDictionary[(x, y)] = value
|
null | null | null | What performs on the tree ?
| def ParseAndSimplify(query):
node = Parse(query).tree
try:
node = SimplifyNode(node)
ValidateNode(node)
except QueryTreeException as e:
msg = ("%s in query '%s'" % (e.message, query))
raise QueryException(msg)
return node
| null | null | null | all necessary transformations
| codeqa | def Parse And Simplify query node Parse query treetry node Simplify Node node Validate Node node except Query Tree Exception as e msg "%sinquery'%s'" % e message query raise Query Exception msg return node
| null | null | null | null | Question:
What performs on the tree ?
Code:
def ParseAndSimplify(query):
node = Parse(query).tree
try:
node = SimplifyNode(node)
ValidateNode(node)
except QueryTreeException as e:
msg = ("%s in query '%s'" % (e.message, query))
raise QueryException(msg)
return node
|
null | null | null | Where does all necessary transformations perform ?
| def ParseAndSimplify(query):
node = Parse(query).tree
try:
node = SimplifyNode(node)
ValidateNode(node)
except QueryTreeException as e:
msg = ("%s in query '%s'" % (e.message, query))
raise QueryException(msg)
return node
| null | null | null | on the tree
| codeqa | def Parse And Simplify query node Parse query treetry node Simplify Node node Validate Node node except Query Tree Exception as e msg "%sinquery'%s'" % e message query raise Query Exception msg return node
| null | null | null | null | Question:
Where does all necessary transformations perform ?
Code:
def ParseAndSimplify(query):
node = Parse(query).tree
try:
node = SimplifyNode(node)
ValidateNode(node)
except QueryTreeException as e:
msg = ("%s in query '%s'" % (e.message, query))
raise QueryException(msg)
return node
|
null | null | null | What does the code restart ?
| def reload_(name, jail=None):
cmd = '{0} {1} onereload'.format(_cmd(jail), name)
return (not __salt__['cmd.retcode'](cmd, python_shell=False))
| null | null | null | the named service
| codeqa | def reload name jail None cmd '{ 0 }{ 1 }onereload' format cmd jail name return not salt ['cmd retcode'] cmd python shell False
| null | null | null | null | Question:
What does the code restart ?
Code:
def reload_(name, jail=None):
cmd = '{0} {1} onereload'.format(_cmd(jail), name)
return (not __salt__['cmd.retcode'](cmd, python_shell=False))
|
null | null | null | What does the code get ?
| def instance_get_all_by_host_and_node(context, host, node, columns_to_join=None):
return IMPL.instance_get_all_by_host_and_node(context, host, node, columns_to_join=columns_to_join)
| null | null | null | all instances belonging to a node
| codeqa | def instance get all by host and node context host node columns to join None return IMPL instance get all by host and node context host node columns to join columns to join
| null | null | null | null | Question:
What does the code get ?
Code:
def instance_get_all_by_host_and_node(context, host, node, columns_to_join=None):
return IMPL.instance_get_all_by_host_and_node(context, host, node, columns_to_join=columns_to_join)
|
null | null | null | What did the code dispatch ?
| def dispatch_stat(result, name, key, conf):
if (result is None):
collectd.warning(('mesos-master plugin: Value not found for %s' % name))
return
estype = key.type
value = result
log_verbose(conf['verboseLogging'], ('Sending value[%s]: %s=%s for instance:%s' % (estype, name, value, conf['instance'])))
... | null | null | null | a value
| codeqa | def dispatch stat result name key conf if result is None collectd warning 'mesos-masterplugin Valuenotfoundfor%s' % name returnestype key typevalue resultlog verbose conf['verbose Logging'] ' Sendingvalue[%s] %s %sforinstance %s' % estype name value conf['instance'] val collectd Values plugin 'mesos-master' val type es... | null | null | null | null | Question:
What did the code dispatch ?
Code:
def dispatch_stat(result, name, key, conf):
if (result is None):
collectd.warning(('mesos-master plugin: Value not found for %s' % name))
return
estype = key.type
value = result
log_verbose(conf['verboseLogging'], ('Sending value[%s]: %s=%s for instance... |
null | null | null | What did the code read ?
| def dispatch_stat(result, name, key, conf):
if (result is None):
collectd.warning(('mesos-master plugin: Value not found for %s' % name))
return
estype = key.type
value = result
log_verbose(conf['verboseLogging'], ('Sending value[%s]: %s=%s for instance:%s' % (estype, name, value, conf['instance'])))
... | null | null | null | a key from info response data
| codeqa | def dispatch stat result name key conf if result is None collectd warning 'mesos-masterplugin Valuenotfoundfor%s' % name returnestype key typevalue resultlog verbose conf['verbose Logging'] ' Sendingvalue[%s] %s %sforinstance %s' % estype name value conf['instance'] val collectd Values plugin 'mesos-master' val type es... | null | null | null | null | Question:
What did the code read ?
Code:
def dispatch_stat(result, name, key, conf):
if (result is None):
collectd.warning(('mesos-master plugin: Value not found for %s' % name))
return
estype = key.type
value = result
log_verbose(conf['verboseLogging'], ('Sending value[%s]: %s=%s for instance:%s'... |
null | null | null | What published in python cookbook ?
| def debug_on_error(type, value, tb):
traceback.print_exc(type, value, tb)
print
pdb.pm()
| null | null | null | heller
| codeqa | def debug on error type value tb traceback print exc type value tb printpdb pm
| null | null | null | null | Question:
What published in python cookbook ?
Code:
def debug_on_error(type, value, tb):
traceback.print_exc(type, value, tb)
print
pdb.pm()
|
null | null | null | How does the code find a room ?
| def find_room(name, api_url=None, api_key=None, api_version=None):
rooms = list_rooms(api_url=api_url, api_key=api_key, api_version=api_version)
if rooms:
for x in range(0, len(rooms)):
if (rooms[x]['name'] == name):
return rooms[x]
return False
| null | null | null | by name
| codeqa | def find room name api url None api key None api version None rooms list rooms api url api url api key api key api version api version if rooms for x in range 0 len rooms if rooms[x]['name'] name return rooms[x]return False
| null | null | null | null | Question:
How does the code find a room ?
Code:
def find_room(name, api_url=None, api_key=None, api_version=None):
rooms = list_rooms(api_url=api_url, api_key=api_key, api_version=api_version)
if rooms:
for x in range(0, len(rooms)):
if (rooms[x]['name'] == name):
return rooms[x]
return False
|
null | null | null | What does the code find by name ?
| def find_room(name, api_url=None, api_key=None, api_version=None):
rooms = list_rooms(api_url=api_url, api_key=api_key, api_version=api_version)
if rooms:
for x in range(0, len(rooms)):
if (rooms[x]['name'] == name):
return rooms[x]
return False
| null | null | null | a room
| codeqa | def find room name api url None api key None api version None rooms list rooms api url api url api key api key api version api version if rooms for x in range 0 len rooms if rooms[x]['name'] name return rooms[x]return False
| null | null | null | null | Question:
What does the code find by name ?
Code:
def find_room(name, api_url=None, api_key=None, api_version=None):
rooms = list_rooms(api_url=api_url, api_key=api_key, api_version=api_version)
if rooms:
for x in range(0, len(rooms)):
if (rooms[x]['name'] == name):
return rooms[x]
return False
|
null | null | null | How do tree walk ?
| def walk(top, func, arg):
warnings.warnpy3k('In 3.x, os.path.walk is removed in favor of os.walk.')
try:
names = os.listdir(top)
except os.error:
return
func(arg, top, names)
for name in names:
name = join(top, name)
if (isdir(name) and (not islink(name))):
walk(name, func, arg)
| null | null | null | with callback function
| codeqa | def walk top func arg warnings warnpy 3 k ' In 3 x os path walkisremovedinfavorofos walk ' try names os listdir top except os error returnfunc arg top names for name in names name join top name if isdir name and not islink name walk name func arg
| null | null | null | null | Question:
How do tree walk ?
Code:
def walk(top, func, arg):
warnings.warnpy3k('In 3.x, os.path.walk is removed in favor of os.walk.')
try:
names = os.listdir(top)
except os.error:
return
func(arg, top, names)
for name in names:
name = join(top, name)
if (isdir(name) and (not islink(name))):
... |
null | null | null | How did the response return ?
| def assert_ok_response(response):
nose.tools.assert_true(200, response.status_code)
return response
| null | null | null | successfully
| codeqa | def assert ok response response nose tools assert true 200 response status code return response
| null | null | null | null | Question:
How did the response return ?
Code:
def assert_ok_response(response):
nose.tools.assert_true(200, response.status_code)
return response
|
null | null | null | How did decorator orient ?
| def engine(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
runner = None
def handle_exception(typ, value, tb):
if (runner is not None):
return runner.handle_exception(typ, value, tb)
return False
with ExceptionStackContext(handle_exception) as deactivate:
try:
result = func(*args, *... | null | null | null | callback
| codeqa | def engine func @functools wraps func def wrapper *args **kwargs runner Nonedef handle exception typ value tb if runner is not None return runner handle exception typ value tb return Falsewith Exception Stack Context handle exception as deactivate try result func *args **kwargs except Return Stop Iteration as e result ... | null | null | null | null | Question:
How did decorator orient ?
Code:
def engine(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
runner = None
def handle_exception(typ, value, tb):
if (runner is not None):
return runner.handle_exception(typ, value, tb)
return False
with ExceptionStackContext(handle_exception) as... |
null | null | null | What represents an ipv6 address ?
| def isIPv6Address(addr):
return isIPAddress(addr, AF_INET6)
| null | null | null | the given string
| codeqa | def is I Pv 6 Address addr return is IP Address addr AF INET 6
| null | null | null | null | Question:
What represents an ipv6 address ?
Code:
def isIPv6Address(addr):
return isIPAddress(addr, AF_INET6)
|
null | null | null | What does the code get for the majority of the overhanging extrusion perimeter ?
| def getBridgeDirection(belowLoops, layerLoops, radius):
if (len(belowLoops) < 1):
return None
belowOutsetLoops = intercircle.getInsetLoopsFromLoops(belowLoops, (- radius))
bridgeRotation = complex()
for loop in layerLoops:
for (pointIndex, point) in enumerate(loop):
previousIndex = (((pointIndex + len(loop))... | null | null | null | span direction
| codeqa | def get Bridge Direction below Loops layer Loops radius if len below Loops < 1 return Nonebelow Outset Loops intercircle get Inset Loops From Loops below Loops - radius bridge Rotation complex for loop in layer Loops for point Index point in enumerate loop previous Index point Index + len loop - 1 % len loop bridge Rot... | null | null | null | null | Question:
What does the code get for the majority of the overhanging extrusion perimeter ?
Code:
def getBridgeDirection(belowLoops, layerLoops, radius):
if (len(belowLoops) < 1):
return None
belowOutsetLoops = intercircle.getInsetLoopsFromLoops(belowLoops, (- radius))
bridgeRotation = complex()
for loop in la... |
null | null | null | What did the code remove from any associated map ?
| def post_delete_layer(instance, sender, **kwargs):
from geonode.maps.models import MapLayer
if instance.typename:
logger.debug('Going to delete associated maplayers for [%s]', instance.typename.encode('utf-8'))
MapLayer.objects.filter(name=instance.typename, ows_url=instance.ows_url).delete()
if instance.i... | null | null | null | the layer
| codeqa | def post delete layer instance sender **kwargs from geonode maps models import Map Layerif instance typename logger debug ' Goingtodeleteassociatedmaplayersfor[%s]' instance typename encode 'utf- 8 ' Map Layer objects filter name instance typename ows url instance ows url delete if instance is remote returnif instance ... | null | null | null | null | Question:
What did the code remove from any associated map ?
Code:
def post_delete_layer(instance, sender, **kwargs):
from geonode.maps.models import MapLayer
if instance.typename:
logger.debug('Going to delete associated maplayers for [%s]', instance.typename.encode('utf-8'))
MapLayer.objects.filter(na... |
null | null | null | What raises an exception when ?
| @with_setup(step_runner_environ)
def test_count_raised_exceptions_as_failing_steps():
try:
f = Feature.from_string(FEATURE8)
feature_result = f.run()
scenario_result = feature_result.scenario_results[0]
assert_equals(len(scenario_result.steps_failed), 1)
finally:
registry.clear()
| null | null | null | a step definition
| codeqa | @with setup step runner environ def test count raised exceptions as failing steps try f Feature from string FEATURE 8 feature result f run scenario result feature result scenario results[ 0 ]assert equals len scenario result steps failed 1 finally registry clear
| null | null | null | null | Question:
What raises an exception when ?
Code:
@with_setup(step_runner_environ)
def test_count_raised_exceptions_as_failing_steps():
try:
f = Feature.from_string(FEATURE8)
feature_result = f.run()
scenario_result = feature_result.scenario_results[0]
assert_equals(len(scenario_result.steps_failed), 1)
fin... |
null | null | null | What does a step definition raise when ?
| @with_setup(step_runner_environ)
def test_count_raised_exceptions_as_failing_steps():
try:
f = Feature.from_string(FEATURE8)
feature_result = f.run()
scenario_result = feature_result.scenario_results[0]
assert_equals(len(scenario_result.steps_failed), 1)
finally:
registry.clear()
| null | null | null | an exception
| codeqa | @with setup step runner environ def test count raised exceptions as failing steps try f Feature from string FEATURE 8 feature result f run scenario result feature result scenario results[ 0 ]assert equals len scenario result steps failed 1 finally registry clear
| null | null | null | null | Question:
What does a step definition raise when ?
Code:
@with_setup(step_runner_environ)
def test_count_raised_exceptions_as_failing_steps():
try:
f = Feature.from_string(FEATURE8)
feature_result = f.run()
scenario_result = feature_result.scenario_results[0]
assert_equals(len(scenario_result.steps_failed)... |
null | null | null | What did the code put into recovering state if value is true ?
| def set_maintenance(member, value):
c = pymongo.MongoClient(member)
c.admin.command('replSetMaintenance', value)
start = time.time()
while (value != (member in get_recovering())):
assert ((time.time() - start) <= 10), ('Member %s never switched state' % member)
time.sleep(0.25)
| null | null | null | a member
| codeqa | def set maintenance member value c pymongo Mongo Client member c admin command 'repl Set Maintenance' value start time time while value member in get recovering assert time time - start < 10 ' Member%sneverswitchedstate' % member time sleep 0 25
| null | null | null | null | Question:
What did the code put into recovering state if value is true ?
Code:
def set_maintenance(member, value):
c = pymongo.MongoClient(member)
c.admin.command('replSetMaintenance', value)
start = time.time()
while (value != (member in get_recovering())):
assert ((time.time() - start) <= 10), ('Member %s ... |
null | null | null | What does the code move to a folder ?
| def move(src, dstdir):
finder = _getfinder()
if (type(src) == type([])):
src_fss = []
for s in src:
src_fss.append(Carbon.File.FSSpec(s))
else:
src_fss = Carbon.File.FSSpec(src)
dst_fss = Carbon.File.FSSpec(dstdir)
return finder.move(src_fss, to=dst_fss)
| null | null | null | a file
| codeqa | def move src dstdir finder getfinder if type src type [] src fss []for s in src src fss append Carbon File FS Spec s else src fss Carbon File FS Spec src dst fss Carbon File FS Spec dstdir return finder move src fss to dst fss
| null | null | null | null | Question:
What does the code move to a folder ?
Code:
def move(src, dstdir):
finder = _getfinder()
if (type(src) == type([])):
src_fss = []
for s in src:
src_fss.append(Carbon.File.FSSpec(s))
else:
src_fss = Carbon.File.FSSpec(src)
dst_fss = Carbon.File.FSSpec(dstdir)
return finder.move(src_fss, to=ds... |
null | null | null | Where are what items documented ?
| def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
| null | null | null | in source/ *
| codeqa | def get documented filenames documented {}for filename in filenames f open filename u'r' lines f read splitlines documented update get documented in lines lines filename filename f close return documented
| null | null | null | null | Question:
Where are what items documented ?
Code:
def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
|
null | null | null | What does the code find ?
| def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
| null | null | null | what items are documented in source/ *
| codeqa | def get documented filenames documented {}for filename in filenames f open filename u'r' lines f read splitlines documented update get documented in lines lines filename filename f close return documented
| null | null | null | null | Question:
What does the code find ?
Code:
def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
|
null | null | null | What are documented in source/ * ?
| def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
| null | null | null | what items
| codeqa | def get documented filenames documented {}for filename in filenames f open filename u'r' lines f read splitlines documented update get documented in lines lines filename filename f close return documented
| null | null | null | null | Question:
What are documented in source/ * ?
Code:
def get_documented(filenames):
documented = {}
for filename in filenames:
f = open(filename, u'r')
lines = f.read().splitlines()
documented.update(get_documented_in_lines(lines, filename=filename))
f.close()
return documented
|
null | null | null | What does the code get ?
| def precedence(state):
try:
return PRECEDENCE_LOOKUP[state]
except KeyError:
return NONE_PRECEDENCE
| null | null | null | the precedence index for state
| codeqa | def precedence state try return PRECEDENCE LOOKUP[state]except Key Error return NONE PRECEDENCE
| null | null | null | null | Question:
What does the code get ?
Code:
def precedence(state):
try:
return PRECEDENCE_LOOKUP[state]
except KeyError:
return NONE_PRECEDENCE
|
null | null | null | What runs prefetches on all instances ?
| def prefetch_one_level(instances, prefetcher, attname):
(rel_qs, rel_obj_attr, instance_attr, single, cache_name) = prefetcher.get_prefetch_queryset(instances)
additional_prl = getattr(rel_qs, '_prefetch_related_lookups', [])
if additional_prl:
rel_qs._prefetch_related_lookups = []
all_related_objects = list(rel_... | null | null | null | helper function for prefetch_related_objects
| codeqa | def prefetch one level instances prefetcher attname rel qs rel obj attr instance attr single cache name prefetcher get prefetch queryset instances additional prl getattr rel qs ' prefetch related lookups' [] if additional prl rel qs prefetch related lookups []all related objects list rel qs rel obj cache {}for rel obj ... | null | null | null | null | Question:
What runs prefetches on all instances ?
Code:
def prefetch_one_level(instances, prefetcher, attname):
(rel_qs, rel_obj_attr, instance_attr, single, cache_name) = prefetcher.get_prefetch_queryset(instances)
additional_prl = getattr(rel_qs, '_prefetch_related_lookups', [])
if additional_prl:
rel_qs._pr... |
null | null | null | How do the readout return ?
| def _kb_readout(request, readout_slug, readouts, locale=None, mode=None, product=None):
if (readout_slug not in readouts):
raise Http404
return readouts[readout_slug](request, locale=locale, mode=mode, product=product)
| null | null | null | with the given slug
| codeqa | def kb readout request readout slug readouts locale None mode None product None if readout slug not in readouts raise Http 404 return readouts[readout slug] request locale locale mode mode product product
| null | null | null | null | Question:
How do the readout return ?
Code:
def _kb_readout(request, readout_slug, readouts, locale=None, mode=None, product=None):
if (readout_slug not in readouts):
raise Http404
return readouts[readout_slug](request, locale=locale, mode=mode, product=product)
|
null | null | null | How do the readout instantiate ?
| def _kb_readout(request, readout_slug, readouts, locale=None, mode=None, product=None):
if (readout_slug not in readouts):
raise Http404
return readouts[readout_slug](request, locale=locale, mode=mode, product=product)
| null | null | null | with the given slug
| codeqa | def kb readout request readout slug readouts locale None mode None product None if readout slug not in readouts raise Http 404 return readouts[readout slug] request locale locale mode mode product product
| null | null | null | null | Question:
How do the readout instantiate ?
Code:
def _kb_readout(request, readout_slug, readouts, locale=None, mode=None, product=None):
if (readout_slug not in readouts):
raise Http404
return readouts[readout_slug](request, locale=locale, mode=mode, product=product)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.