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 create ?
| def with_metaclass(meta, *bases):
class metaclass(meta, ):
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, 'temporary_class', (), {})
| null | null | null | a base class with a metaclass
| codeqa | def with metaclass meta *bases class metaclass meta def new cls name this bases d return meta name bases d return type new metaclass 'temporary class' {}
| null | null | null | null | Question:
What does the code create ?
Code:
def with_metaclass(meta, *bases):
class metaclass(meta, ):
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, 'temporary_class', (), {})
|
null | null | null | What installs the feature ?
| def feature_installed(name, package=None, source=None, limit_access=False, enable_parent=False, image=None, restart=False):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
old = __salt__['dism.installed_features']()
if (name in old):
ret['comment'] = 'The feature {0} is already installed'.f... | null | null | null | package
| codeqa | def feature installed name package None source None limit access False enable parent False image None restart False ret {'name' name 'result' True 'comment' '' 'changes' {}}old salt ['dism installed features'] if name in old ret['comment'] ' Thefeature{ 0 }isalreadyinstalled' format name return retif opts ['test'] ret[... | null | null | null | null | Question:
What installs the feature ?
Code:
def feature_installed(name, package=None, source=None, limit_access=False, enable_parent=False, image=None, restart=False):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
old = __salt__['dism.installed_features']()
if (name in old):
ret['comment']... |
null | null | null | Where do package install ?
| def feature_installed(name, package=None, source=None, limit_access=False, enable_parent=False, image=None, restart=False):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
old = __salt__['dism.installed_features']()
if (name in old):
ret['comment'] = 'The feature {0} is already installed'.f... | null | null | null | the feature
| codeqa | def feature installed name package None source None limit access False enable parent False image None restart False ret {'name' name 'result' True 'comment' '' 'changes' {}}old salt ['dism installed features'] if name in old ret['comment'] ' Thefeature{ 0 }isalreadyinstalled' format name return retif opts ['test'] ret[... | null | null | null | null | Question:
Where do package install ?
Code:
def feature_installed(name, package=None, source=None, limit_access=False, enable_parent=False, image=None, restart=False):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
old = __salt__['dism.installed_features']()
if (name in old):
ret['comment'] ... |
null | null | null | What does the code destroy ?
| def destroy_namespace(conf, namespace, force=False):
try:
root_helper = agent_config.get_root_helper(conf)
ip = ip_lib.IPWrapper(root_helper, namespace)
if force:
kill_dhcp(conf, namespace)
if ip.netns.exists(namespace):
for device in ip.get_devices(exclude_loopback=True):
unplug_device(conf, devi... | null | null | null | a given namespace
| codeqa | def destroy namespace conf namespace force False try root helper agent config get root helper conf ip ip lib IP Wrapper root helper namespace if force kill dhcp conf namespace if ip netns exists namespace for device in ip get devices exclude loopback True unplug device conf device ip garbage collect namespace except Ex... | null | null | null | null | Question:
What does the code destroy ?
Code:
def destroy_namespace(conf, namespace, force=False):
try:
root_helper = agent_config.get_root_helper(conf)
ip = ip_lib.IPWrapper(root_helper, namespace)
if force:
kill_dhcp(conf, namespace)
if ip.netns.exists(namespace):
for device in ip.get_devices(excl... |
null | null | null | What did the code require ?
| def register(linter):
linter.register_checker(SpellingChecker(linter))
| null | null | null | method to auto register this checker
| codeqa | def register linter linter register checker Spelling Checker linter
| null | null | null | null | Question:
What did the code require ?
Code:
def register(linter):
linter.register_checker(SpellingChecker(linter))
|
null | null | null | What did the code cast to another interface ?
| def CastTo(ob, target):
if hasattr(target, 'index'):
if ('CLSID' not in ob.__class__.__dict__):
ob = gencache.EnsureDispatch(ob)
if ('CLSID' not in ob.__class__.__dict__):
raise ValueError('Must be a makepy-able object for this to work')
clsid = ob.CLSID
mod = gencache.GetModuleForCLSID(clsid)
... | null | null | null | a com object
| codeqa | def Cast To ob target if hasattr target 'index' if 'CLSID' not in ob class dict ob gencache Ensure Dispatch ob if 'CLSID' not in ob class dict raise Value Error ' Mustbeamakepy-ableobjectforthistowork' clsid ob CLSI Dmod gencache Get Module For CLSID clsid mod gencache Get Module For Typelib mod CLSID mod LCID mod Majo... | null | null | null | null | Question:
What did the code cast to another interface ?
Code:
def CastTo(ob, target):
if hasattr(target, 'index'):
if ('CLSID' not in ob.__class__.__dict__):
ob = gencache.EnsureDispatch(ob)
if ('CLSID' not in ob.__class__.__dict__):
raise ValueError('Must be a makepy-able object for this to work... |
null | null | null | Where does the code get an iterator object ?
| def simple_conll_corpus_iterator(corpus_file):
l = corpus_file.readline()
while l:
line = l.strip()
if line:
fields = line.split(' ')
ne_tag = fields[(-1)]
word = ' '.join(fields[:(-1)])
(yield (word, ne_tag))
else:
(yield (None, None))
l = corpus_file.readline()
| null | null | null | over the corpus file
| codeqa | def simple conll corpus iterator corpus file l corpus file readline while l line l strip if line fields line split '' ne tag fields[ -1 ]word '' join fields[ -1 ] yield word ne tag else yield None None l corpus file readline
| null | null | null | null | Question:
Where does the code get an iterator object ?
Code:
def simple_conll_corpus_iterator(corpus_file):
l = corpus_file.readline()
while l:
line = l.strip()
if line:
fields = line.split(' ')
ne_tag = fields[(-1)]
word = ' '.join(fields[:(-1)])
(yield (word, ne_tag))
else:
(yield (None, ... |
null | null | null | What does the code get over the corpus file ?
| def simple_conll_corpus_iterator(corpus_file):
l = corpus_file.readline()
while l:
line = l.strip()
if line:
fields = line.split(' ')
ne_tag = fields[(-1)]
word = ' '.join(fields[:(-1)])
(yield (word, ne_tag))
else:
(yield (None, None))
l = corpus_file.readline()
| null | null | null | an iterator object
| codeqa | def simple conll corpus iterator corpus file l corpus file readline while l line l strip if line fields line split '' ne tag fields[ -1 ]word '' join fields[ -1 ] yield word ne tag else yield None None l corpus file readline
| null | null | null | null | Question:
What does the code get over the corpus file ?
Code:
def simple_conll_corpus_iterator(corpus_file):
l = corpus_file.readline()
while l:
line = l.strip()
if line:
fields = line.split(' ')
ne_tag = fields[(-1)]
word = ' '.join(fields[:(-1)])
(yield (word, ne_tag))
else:
(yield (None,... |
null | null | null | How did decorator orient ?
| def engine(func):
func = _make_coroutine_wrapper(func, replace_callback=False)
@functools.wraps(func)
def wrapper(*args, **kwargs):
future = func(*args, **kwargs)
def final_callback(future):
if (future.result() is not None):
raise ReturnValueIgnoredError(('@gen.engine functions cannot return values: ... | null | null | null | callback
| codeqa | def engine func func make coroutine wrapper func replace callback False @functools wraps func def wrapper *args **kwargs future func *args **kwargs def final callback future if future result is not None raise Return Value Ignored Error '@gen enginefunctionscannotreturnvalues %r' % future result future add done callback... | null | null | null | null | Question:
How did decorator orient ?
Code:
def engine(func):
func = _make_coroutine_wrapper(func, replace_callback=False)
@functools.wraps(func)
def wrapper(*args, **kwargs):
future = func(*args, **kwargs)
def final_callback(future):
if (future.result() is not None):
raise ReturnValueIgnoredError(('@g... |
null | null | null | What does the code get ?
| def getframeinfo(frame, context=1):
if istraceback(frame):
lineno = frame.tb_lineno
frame = frame.tb_frame
else:
lineno = frame.f_lineno
if (not isframe(frame)):
raise TypeError('{!r} is not a frame or traceback object'.format(frame))
filename = (getsourcefile(frame) or getfile(frame))
if (context >... | null | null | null | information about a frame or traceback object
| codeqa | def getframeinfo frame context 1 if istraceback frame lineno frame tb linenoframe frame tb frameelse lineno frame f linenoif not isframe frame raise Type Error '{ r}isnotaframeortracebackobject' format frame filename getsourcefile frame or getfile frame if context > 0 start lineno - 1 - context // 2 try lines lnum find... | null | null | null | null | Question:
What does the code get ?
Code:
def getframeinfo(frame, context=1):
if istraceback(frame):
lineno = frame.tb_lineno
frame = frame.tb_frame
else:
lineno = frame.f_lineno
if (not isframe(frame)):
raise TypeError('{!r} is not a frame or traceback object'.format(frame))
filename = (getsource... |
null | null | null | What does the code get ?
| def libvlc_video_get_spu_description(p_mi):
f = (_Cfunctions.get('libvlc_video_get_spu_description', None) or _Cfunction('libvlc_video_get_spu_description', ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer))
return f(p_mi)
| null | null | null | the description of available video subtitles
| codeqa | def libvlc video get spu description p mi f Cfunctions get 'libvlc video get spu description' None or Cfunction 'libvlc video get spu description' 1 None ctypes POINTER Track Description Media Player return f p mi
| null | null | null | null | Question:
What does the code get ?
Code:
def libvlc_video_get_spu_description(p_mi):
f = (_Cfunctions.get('libvlc_video_get_spu_description', None) or _Cfunction('libvlc_video_get_spu_description', ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer))
return f(p_mi)
|
null | null | null | What is using a dict server ?
| def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
| null | null | null | a word
| codeqa | def match host port database strategy word d defer Deferred factory Dict Lookup Factory 'match' database strategy word d from twisted internet import reactorreactor connect TCP host port factory return d
| null | null | null | null | Question:
What is using a dict server ?
Code:
def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
|
null | null | null | How does the code match a word ?
| def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
| null | null | null | using a dict server
| codeqa | def match host port database strategy word d defer Deferred factory Dict Lookup Factory 'match' database strategy word d from twisted internet import reactorreactor connect TCP host port factory return d
| null | null | null | null | Question:
How does the code match a word ?
Code:
def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
|
null | null | null | What does the code match using a dict server ?
| def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
| null | null | null | a word
| codeqa | def match host port database strategy word d defer Deferred factory Dict Lookup Factory 'match' database strategy word d from twisted internet import reactorreactor connect TCP host port factory return d
| null | null | null | null | Question:
What does the code match using a dict server ?
Code:
def match(host, port, database, strategy, word):
d = defer.Deferred()
factory = DictLookupFactory('match', (database, strategy, word), d)
from twisted.internet import reactor
reactor.connectTCP(host, port, factory)
return d
|
null | null | null | What does the code get from the full node list by name ?
| def get_node(name):
nodes = list_nodes()
if (name in nodes):
return nodes[name]
return None
| null | null | null | the node
| codeqa | def get node name nodes list nodes if name in nodes return nodes[name]return None
| null | null | null | null | Question:
What does the code get from the full node list by name ?
Code:
def get_node(name):
nodes = list_nodes()
if (name in nodes):
return nodes[name]
return None
|
null | null | null | How does the code get the node from the full node list ?
| def get_node(name):
nodes = list_nodes()
if (name in nodes):
return nodes[name]
return None
| null | null | null | by name
| codeqa | def get node name nodes list nodes if name in nodes return nodes[name]return None
| null | null | null | null | Question:
How does the code get the node from the full node list ?
Code:
def get_node(name):
nodes = list_nodes()
if (name in nodes):
return nodes[name]
return None
|
null | null | null | What does the code destroy ?
| def destroy_vm(session, instance, vm_ref):
try:
session.VM.destroy(vm_ref)
except session.XenAPI.Failure:
LOG.exception(_LE('Destroy VM failed'))
return
LOG.debug('VM destroyed', instance=instance)
| null | null | null | a vm record
| codeqa | def destroy vm session instance vm ref try session VM destroy vm ref except session Xen API Failure LOG exception LE ' Destroy V Mfailed' return LOG debug 'V Mdestroyed' instance instance
| null | null | null | null | Question:
What does the code destroy ?
Code:
def destroy_vm(session, instance, vm_ref):
try:
session.VM.destroy(vm_ref)
except session.XenAPI.Failure:
LOG.exception(_LE('Destroy VM failed'))
return
LOG.debug('VM destroyed', instance=instance)
|
null | null | null | What does the code clean into something somewhat readable by mere humans ?
| def simplify_regex(pattern):
pattern = named_group_matcher.sub((lambda m: m.group(1)), pattern)
pattern = non_named_group_matcher.sub('<var>', pattern)
pattern = pattern.replace('^', '').replace('$', '').replace('?', '').replace('//', '/').replace('\\', '')
if (not pattern.startswith('/')):
pattern = ('/' + patte... | null | null | null | urlpattern regexes
| codeqa | def simplify regex pattern pattern named group matcher sub lambda m m group 1 pattern pattern non named group matcher sub '<var>' pattern pattern pattern replace '^' '' replace '$' '' replace '?' '' replace '//' '/' replace '\\' '' if not pattern startswith '/' pattern '/' + pattern return pattern
| null | null | null | null | Question:
What does the code clean into something somewhat readable by mere humans ?
Code:
def simplify_regex(pattern):
pattern = named_group_matcher.sub((lambda m: m.group(1)), pattern)
pattern = non_named_group_matcher.sub('<var>', pattern)
pattern = pattern.replace('^', '').replace('$', '').replace('?', '').r... |
null | null | null | What does the code get by manipulation ?
| def getGeometryOutputByManipulation(sideLoop, xmlElement):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(xmlElement)
| null | null | null | geometry output
| codeqa | def get Geometry Output By Manipulation side Loop xml Element side Loop loop euclidean get Loop Without Close Sequential Points side Loop close side Loop loop return side Loop get Manipulation Plugin Loops xml Element
| null | null | null | null | Question:
What does the code get by manipulation ?
Code:
def getGeometryOutputByManipulation(sideLoop, xmlElement):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(xmlElement)
|
null | null | null | How does the code get geometry output ?
| def getGeometryOutputByManipulation(sideLoop, xmlElement):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(xmlElement)
| null | null | null | by manipulation
| codeqa | def get Geometry Output By Manipulation side Loop xml Element side Loop loop euclidean get Loop Without Close Sequential Points side Loop close side Loop loop return side Loop get Manipulation Plugin Loops xml Element
| null | null | null | null | Question:
How does the code get geometry output ?
Code:
def getGeometryOutputByManipulation(sideLoop, xmlElement):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(xmlElement)
|
null | null | null | How do environment variables set ?
| def configure_app(project, config_path, django_settings_module, runner_name):
settings_envvar = (project.upper() + '_SETTINGS')
config_path = os.path.normpath(os.path.abspath(os.path.expanduser(config_path)))
if (not (os.path.exists(config_path) or os.environ.get(settings_envvar, None))):
print((u"Configuration f... | null | null | null | accordingly
| codeqa | def configure app project config path django settings module runner name settings envvar project upper + ' SETTINGS' config path os path normpath os path abspath os path expanduser config path if not os path exists config path or os environ get settings envvar None print u" Configurationfiledoesnotexistat%ror%renvironm... | null | null | null | null | Question:
How do environment variables set ?
Code:
def configure_app(project, config_path, django_settings_module, runner_name):
settings_envvar = (project.upper() + '_SETTINGS')
config_path = os.path.normpath(os.path.abspath(os.path.expanduser(config_path)))
if (not (os.path.exists(config_path) or os.environ.ge... |
null | null | null | What does the code get for the user ?
| def get_override_for_user(user, block, name, default=None):
if (not hasattr(block, '_student_overrides')):
block._student_overrides = {}
overrides = block._student_overrides.get(user.id)
if (overrides is None):
overrides = _get_overrides_for_user(user, block)
block._student_overrides[user.id] = overrides
retu... | null | null | null | the value of the overridden field
| codeqa | def get override for user user block name default None if not hasattr block ' student overrides' block student overrides {}overrides block student overrides get user id if overrides is None overrides get overrides for user user block block student overrides[user id] overridesreturn overrides get name default
| null | null | null | null | Question:
What does the code get for the user ?
Code:
def get_override_for_user(user, block, name, default=None):
if (not hasattr(block, '_student_overrides')):
block._student_overrides = {}
overrides = block._student_overrides.get(user.id)
if (overrides is None):
overrides = _get_overrides_for_user(user, bl... |
null | null | null | For what purpose does the code get the value of the overridden field ?
| def get_override_for_user(user, block, name, default=None):
if (not hasattr(block, '_student_overrides')):
block._student_overrides = {}
overrides = block._student_overrides.get(user.id)
if (overrides is None):
overrides = _get_overrides_for_user(user, block)
block._student_overrides[user.id] = overrides
retu... | null | null | null | for the user
| codeqa | def get override for user user block name default None if not hasattr block ' student overrides' block student overrides {}overrides block student overrides get user id if overrides is None overrides get overrides for user user block block student overrides[user id] overridesreturn overrides get name default
| null | null | null | null | Question:
For what purpose does the code get the value of the overridden field ?
Code:
def get_override_for_user(user, block, name, default=None):
if (not hasattr(block, '_student_overrides')):
block._student_overrides = {}
overrides = block._student_overrides.get(user.id)
if (overrides is None):
overrides =... |
null | null | null | What does the code add to a widget ?
| def add_items(widget, items):
for item in items:
if (item is None):
continue
widget.addItem(item)
| null | null | null | items
| codeqa | def add items widget items for item in items if item is None continuewidget add Item item
| null | null | null | null | Question:
What does the code add to a widget ?
Code:
def add_items(widget, items):
for item in items:
if (item is None):
continue
widget.addItem(item)
|
null | null | null | What does the code get by manipulation ?
| def getGeometryOutputByManipulation(elementNode, sideLoop):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(elementNode)
| null | null | null | geometry output
| codeqa | def get Geometry Output By Manipulation element Node side Loop side Loop loop euclidean get Loop Without Close Sequential Points side Loop close side Loop loop return side Loop get Manipulation Plugin Loops element Node
| null | null | null | null | Question:
What does the code get by manipulation ?
Code:
def getGeometryOutputByManipulation(elementNode, sideLoop):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(elementNode)
|
null | null | null | How does the code get geometry output ?
| def getGeometryOutputByManipulation(elementNode, sideLoop):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(elementNode)
| null | null | null | by manipulation
| codeqa | def get Geometry Output By Manipulation element Node side Loop side Loop loop euclidean get Loop Without Close Sequential Points side Loop close side Loop loop return side Loop get Manipulation Plugin Loops element Node
| null | null | null | null | Question:
How does the code get geometry output ?
Code:
def getGeometryOutputByManipulation(elementNode, sideLoop):
sideLoop.loop = euclidean.getLoopWithoutCloseSequentialPoints(sideLoop.close, sideLoop.loop)
return sideLoop.getManipulationPluginLoops(elementNode)
|
null | null | null | What does the code whittle ?
| def getCraftedText(fileName, text='', whittleRepository=None):
return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), whittleRepository)
| null | null | null | the preface file or text
| codeqa | def get Crafted Text file Name text '' whittle Repository None return get Crafted Text From Text archive get Text If Empty file Name text whittle Repository
| null | null | null | null | Question:
What does the code whittle ?
Code:
def getCraftedText(fileName, text='', whittleRepository=None):
return getCraftedTextFromText(archive.getTextIfEmpty(fileName, text), whittleRepository)
|
null | null | null | What does the code get ?
| @environmentfilter
def do_attr(environment, obj, name):
try:
name = str(name)
except UnicodeError:
pass
else:
try:
value = getattr(obj, name)
except AttributeError:
pass
else:
if (environment.sandboxed and (not environment.is_safe_attribute(obj, name, value))):
return environment.unsafe_undefi... | null | null | null | an attribute of an object
| codeqa | @environmentfilterdef do attr environment obj name try name str name except Unicode Error passelse try value getattr obj name except Attribute Error passelse if environment sandboxed and not environment is safe attribute obj name value return environment unsafe undefined obj name return valuereturn environment undefine... | null | null | null | null | Question:
What does the code get ?
Code:
@environmentfilter
def do_attr(environment, obj, name):
try:
name = str(name)
except UnicodeError:
pass
else:
try:
value = getattr(obj, name)
except AttributeError:
pass
else:
if (environment.sandboxed and (not environment.is_safe_attribute(obj, name, v... |
null | null | null | What does the code turn into an image ?
| def makeImage(argdata, c):
size = len(argdata)
img = Image.new('RGB', (size, size), 'black')
pixels = img.load()
for i in range(img.size[0]):
for j in range(img.size[1]):
pixels[(j, i)] = ((255, 255, 255) if (argdata[i][j] == '+') else (0, 0, 0))
img = img.resize(((size * 10), (size * 10)))
img.save(('qrcode... | null | null | null | a code
| codeqa | def make Image argdata c size len argdata img Image new 'RGB' size size 'black' pixels img load for i in range img size[ 0 ] for j in range img size[ 1 ] pixels[ j i ] 255 255 255 if argdata[i][j] '+' else 0 0 0 img img resize size * 10 size * 10 img save 'qrcode%d png' % c return img
| null | null | null | null | Question:
What does the code turn into an image ?
Code:
def makeImage(argdata, c):
size = len(argdata)
img = Image.new('RGB', (size, size), 'black')
pixels = img.load()
for i in range(img.size[0]):
for j in range(img.size[1]):
pixels[(j, i)] = ((255, 255, 255) if (argdata[i][j] == '+') else (0, 0, 0))
img... |
null | null | null | What do a hash use ?
| def hash_opensubtitles(video_path):
bytesize = struct.calcsize('<q')
with open(video_path, 'rb') as f:
filesize = os.path.getsize(video_path)
filehash = filesize
if (filesize < (65536 * 2)):
return
for _ in range((65536 // bytesize)):
filebuffer = f.read(bytesize)
(l_value,) = struct.unpack('<q', fil... | null | null | null | opensubtitles algorithm
| codeqa | def hash opensubtitles video path bytesize struct calcsize '<q' with open video path 'rb' as f filesize os path getsize video path filehash filesizeif filesize < 65536 * 2 returnfor in range 65536 // bytesize filebuffer f read bytesize l value struct unpack '<q' filebuffer filehash + l valuefilehash & 18446744073709551... | null | null | null | null | Question:
What do a hash use ?
Code:
def hash_opensubtitles(video_path):
bytesize = struct.calcsize('<q')
with open(video_path, 'rb') as f:
filesize = os.path.getsize(video_path)
filehash = filesize
if (filesize < (65536 * 2)):
return
for _ in range((65536 // bytesize)):
filebuffer = f.read(bytesize... |
null | null | null | What does the code extend with a list of two - tuples ?
| def add_params_to_qs(query, params):
queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
queryparams.extend(params)
return urlencode(queryparams)
| null | null | null | a query
| codeqa | def add params to qs query params queryparams urlparse parse qsl query keep blank values True queryparams extend params return urlencode queryparams
| null | null | null | null | Question:
What does the code extend with a list of two - tuples ?
Code:
def add_params_to_qs(query, params):
queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
queryparams.extend(params)
return urlencode(queryparams)
|
null | null | null | How do which adapter is in monitor mode detect ?
| def get_monitor_adapter():
tmp = init_app('iwconfig', True)
for line in tmp.split('\n'):
if line.startswith(' '):
continue
elif (len(line.split(' ')[0]) > 1):
if ('Mode:Monitor' in line):
return line.split(' ')[0]
return None
| null | null | null | automatically
| codeqa | def get monitor adapter tmp init app 'iwconfig' True for line in tmp split '\n' if line startswith '' continueelif len line split '' [0 ] > 1 if ' Mode Monitor' in line return line split '' [0 ]return None
| null | null | null | null | Question:
How do which adapter is in monitor mode detect ?
Code:
def get_monitor_adapter():
tmp = init_app('iwconfig', True)
for line in tmp.split('\n'):
if line.startswith(' '):
continue
elif (len(line.split(' ')[0]) > 1):
if ('Mode:Monitor' in line):
return line.split(' ')[0]
return None
|
null | null | null | When did a time value give the code ?
| def to_human_time_from_seconds(seconds):
assert (isinstance(seconds, int) or isinstance(seconds, long) or isinstance(seconds, float))
return _get_human_time(seconds)
| null | null | null | in seconds
| codeqa | def to human time from seconds seconds assert isinstance seconds int or isinstance seconds long or isinstance seconds float return get human time seconds
| null | null | null | null | Question:
When did a time value give the code ?
Code:
def to_human_time_from_seconds(seconds):
assert (isinstance(seconds, int) or isinstance(seconds, long) or isinstance(seconds, float))
return _get_human_time(seconds)
|
null | null | null | What does the code get from a certificate ?
| def get_sans_from_cert(cert, typ=OpenSSL.crypto.FILETYPE_PEM):
return _get_sans_from_cert_or_req(cert, OpenSSL.crypto.load_certificate, typ)
| null | null | null | a list of subject alternative names
| codeqa | def get sans from cert cert typ Open SSL crypto FILETYPE PEM return get sans from cert or req cert Open SSL crypto load certificate typ
| null | null | null | null | Question:
What does the code get from a certificate ?
Code:
def get_sans_from_cert(cert, typ=OpenSSL.crypto.FILETYPE_PEM):
return _get_sans_from_cert_or_req(cert, OpenSSL.crypto.load_certificate, typ)
|
null | null | null | What skips test if module is not importable ?
| def skip_unless_importable(module, msg=None):
try:
__import__(module)
except ImportError:
return pytest.mark.skipif(True, reason=(msg or 'conditional skip'))
else:
return pytest.mark.skipif(False, reason=(msg or 'conditional skip'))
| null | null | null | decorator
| codeqa | def skip unless importable module msg None try import module except Import Error return pytest mark skipif True reason msg or 'conditionalskip' else return pytest mark skipif False reason msg or 'conditionalskip'
| null | null | null | null | Question:
What skips test if module is not importable ?
Code:
def skip_unless_importable(module, msg=None):
try:
__import__(module)
except ImportError:
return pytest.mark.skipif(True, reason=(msg or 'conditional skip'))
else:
return pytest.mark.skipif(False, reason=(msg or 'conditional skip'))
|
null | null | null | What do decorator skip if module is not importable ?
| def skip_unless_importable(module, msg=None):
try:
__import__(module)
except ImportError:
return pytest.mark.skipif(True, reason=(msg or 'conditional skip'))
else:
return pytest.mark.skipif(False, reason=(msg or 'conditional skip'))
| null | null | null | test
| codeqa | def skip unless importable module msg None try import module except Import Error return pytest mark skipif True reason msg or 'conditionalskip' else return pytest mark skipif False reason msg or 'conditionalskip'
| null | null | null | null | Question:
What do decorator skip if module is not importable ?
Code:
def skip_unless_importable(module, msg=None):
try:
__import__(module)
except ImportError:
return pytest.mark.skipif(True, reason=(msg or 'conditional skip'))
else:
return pytest.mark.skipif(False, reason=(msg or 'conditional skip'))
|
null | null | null | What does the code insert into the specified table / chain ?
| def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
if (not chain):
return 'Error: Chain needs to be specified'
if (not position):
return 'Error: Position needs to be specified or use append (-A)'
if (not rule):
return 'Error: Rule needs to be specified'
if (pos... | null | null | null | a rule
| codeqa | def insert table 'filter' chain None position None rule None family 'ipv 4 ' if not chain return ' Error Chainneedstobespecified'if not position return ' Error Positionneedstobespecifiedoruseappend -A 'if not rule return ' Error Ruleneedstobespecified'if position < 0 rules get rules family family size len rules[table][... | null | null | null | null | Question:
What does the code insert into the specified table / chain ?
Code:
def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
if (not chain):
return 'Error: Chain needs to be specified'
if (not position):
return 'Error: Position needs to be specified or use append ... |
null | null | null | What does the code add ?
| def convertXMLElementRenameByPaths(geometryOutput, xmlElement):
xmlElement.className = 'path'
for geometryOutputChild in geometryOutput:
pathElement = xml_simple_reader.XMLElement()
pathElement.setParentAddToChildren(xmlElement)
convertXMLElementRename(geometryOutputChild, pathElement)
| null | null | null | paths
| codeqa | def convert XML Element Rename By Paths geometry Output xml Element xml Element class Name 'path'for geometry Output Child in geometry Output path Element xml simple reader XML Element path Element set Parent Add To Children xml Element convert XML Element Rename geometry Output Child path Element
| null | null | null | null | Question:
What does the code add ?
Code:
def convertXMLElementRenameByPaths(geometryOutput, xmlElement):
xmlElement.className = 'path'
for geometryOutputChild in geometryOutput:
pathElement = xml_simple_reader.XMLElement()
pathElement.setParentAddToChildren(xmlElement)
convertXMLElementRename(geometryOutput... |
null | null | null | What does the code find ?
| def nsmallest(n, iterable, key=None):
if (n == 1):
it = iter(iterable)
head = list(islice(it, 1))
if (not head):
return []
if (key is None):
return [min(chain(head, it))]
return [min(chain(head, it), key=key)]
try:
size = len(iterable)
except (TypeError, AttributeError):
pass
else:
if (n >= si... | null | null | null | the n smallest elements in a dataset
| codeqa | def nsmallest n iterable key None if n 1 it iter iterable head list islice it 1 if not head return []if key is None return [min chain head it ]return [min chain head it key key ]try size len iterable except Type Error Attribute Error passelse if n > size return sorted iterable key key [ n]if key is None it izip iterabl... | null | null | null | null | Question:
What does the code find ?
Code:
def nsmallest(n, iterable, key=None):
if (n == 1):
it = iter(iterable)
head = list(islice(it, 1))
if (not head):
return []
if (key is None):
return [min(chain(head, it))]
return [min(chain(head, it), key=key)]
try:
size = len(iterable)
except (TypeError... |
null | null | null | How does the most common opcode pairs return ?
| def common_pairs(profile):
if (not has_pairs(profile)):
return []
result = [((op1, op2), (opcode.opname[op1], opcode.opname[op2]), count) for (op1, op1profile) in enumerate(profile[:(-1)]) for (op2, count) in enumerate(op1profile) if (count > 0)]
result.sort(key=operator.itemgetter(2), reverse=True)
return result... | null | null | null | in order of descending frequency
| codeqa | def common pairs profile if not has pairs profile return []result [ op 1 op 2 opcode opname[op 1 ] opcode opname[op 2 ] count for op 1 op 1 profile in enumerate profile[ -1 ] for op 2 count in enumerate op 1 profile if count > 0 ]result sort key operator itemgetter 2 reverse True return result
| null | null | null | null | Question:
How does the most common opcode pairs return ?
Code:
def common_pairs(profile):
if (not has_pairs(profile)):
return []
result = [((op1, op2), (opcode.opname[op1], opcode.opname[op2]), count) for (op1, op1profile) in enumerate(profile[:(-1)]) for (op2, count) in enumerate(op1profile) if (count > 0)]
r... |
null | null | null | What set on the page ?
| @world.absorb
def wait_for_mathjax():
world.wait_for_js_variable_truthy('MathJax.isReady')
| null | null | null | mathjax
| codeqa | @world absorbdef wait for mathjax world wait for js variable truthy ' Math Jax is Ready'
| null | null | null | null | Question:
What set on the page ?
Code:
@world.absorb
def wait_for_mathjax():
world.wait_for_js_variable_truthy('MathJax.isReady')
|
null | null | null | What is loaded on the page ?
| @world.absorb
def wait_for_mathjax():
world.wait_for_js_variable_truthy('MathJax.isReady')
| null | null | null | mathjax
| codeqa | @world absorbdef wait for mathjax world wait for js variable truthy ' Math Jax is Ready'
| null | null | null | null | Question:
What is loaded on the page ?
Code:
@world.absorb
def wait_for_mathjax():
world.wait_for_js_variable_truthy('MathJax.isReady')
|
null | null | null | What does the code remove ?
| def remove_operation(feed, activities, trim=True, batch_interface=None):
t = timer()
msg_format = 'running %s.remove_many operation for %s activities batch interface %s'
logger.debug(msg_format, feed, len(activities), batch_interface)
feed.remove_many(activities, trim=trim, batch_interface=batch_interface)
... | null | null | null | the activities from the feed functions used in tasks
| codeqa | def remove operation feed activities trim True batch interface None t timer msg format 'running%s remove manyoperationfor%sactivitiesbatchinterface%s'logger debug msg format feed len activities batch interface feed remove many activities trim trim batch interface batch interface logger debug 'removemanyoperationtook%ss... | null | null | null | null | Question:
What does the code remove ?
Code:
def remove_operation(feed, activities, trim=True, batch_interface=None):
t = timer()
msg_format = 'running %s.remove_many operation for %s activities batch interface %s'
logger.debug(msg_format, feed, len(activities), batch_interface)
feed.remove_many(activiti... |
null | null | null | What be the activities from the feed functions used in tasks need ?
| def remove_operation(feed, activities, trim=True, batch_interface=None):
t = timer()
msg_format = 'running %s.remove_many operation for %s activities batch interface %s'
logger.debug(msg_format, feed, len(activities), batch_interface)
feed.remove_many(activities, trim=trim, batch_interface=batch_interface)
... | null | null | null | to be at the main level of the module
| codeqa | def remove operation feed activities trim True batch interface None t timer msg format 'running%s remove manyoperationfor%sactivitiesbatchinterface%s'logger debug msg format feed len activities batch interface feed remove many activities trim trim batch interface batch interface logger debug 'removemanyoperationtook%ss... | null | null | null | null | Question:
What be the activities from the feed functions used in tasks need ?
Code:
def remove_operation(feed, activities, trim=True, batch_interface=None):
t = timer()
msg_format = 'running %s.remove_many operation for %s activities batch interface %s'
logger.debug(msg_format, feed, len(activities), bat... |
null | null | null | What does the code get ?
| def get_rollback(name):
return _get_client().get_rollback(name)
| null | null | null | the backup of stored a configuration rollback
| codeqa | def get rollback name return get client get rollback name
| null | null | null | null | Question:
What does the code get ?
Code:
def get_rollback(name):
return _get_client().get_rollback(name)
|
null | null | null | What does the code get ?
| def getAreaLoop(loop):
areaLoopDouble = 0.0
for (pointIndex, point) in enumerate(loop):
pointEnd = loop[((pointIndex + 1) % len(loop))]
areaLoopDouble += ((point.real * pointEnd.imag) - (pointEnd.real * point.imag))
return (0.5 * areaLoopDouble)
| null | null | null | the area of a complex polygon
| codeqa | def get Area Loop loop area Loop Double 0 0for point Index point in enumerate loop point End loop[ point Index + 1 % len loop ]area Loop Double + point real * point End imag - point End real * point imag return 0 5 * area Loop Double
| null | null | null | null | Question:
What does the code get ?
Code:
def getAreaLoop(loop):
areaLoopDouble = 0.0
for (pointIndex, point) in enumerate(loop):
pointEnd = loop[((pointIndex + 1) % len(loop))]
areaLoopDouble += ((point.real * pointEnd.imag) - (pointEnd.real * point.imag))
return (0.5 * areaLoopDouble)
|
null | null | null | What does the code delete ?
| def delete(filepath):
remove_acl(filepath)
remove_immutable_attribute(filepath)
if (os.path.isfile(filepath) or os.path.islink(filepath)):
os.remove(filepath)
elif os.path.isdir(filepath):
shutil.rmtree(filepath)
| null | null | null | the given file
| codeqa | def delete filepath remove acl filepath remove immutable attribute filepath if os path isfile filepath or os path islink filepath os remove filepath elif os path isdir filepath shutil rmtree filepath
| null | null | null | null | Question:
What does the code delete ?
Code:
def delete(filepath):
remove_acl(filepath)
remove_immutable_attribute(filepath)
if (os.path.isfile(filepath) or os.path.islink(filepath)):
os.remove(filepath)
elif os.path.isdir(filepath):
shutil.rmtree(filepath)
|
null | null | null | What does the code redraw ?
| def draw():
get_current_fig_manager().canvas.draw()
| null | null | null | the current figure
| codeqa | def draw get current fig manager canvas draw
| null | null | null | null | Question:
What does the code redraw ?
Code:
def draw():
get_current_fig_manager().canvas.draw()
|
null | null | null | What does the code retrieve from the specified volume with the specified name ?
| def _get_volume_tag(volume, name):
if volume.tags:
for tag in volume.tags:
if (tag['Key'] == name):
return tag['Value']
raise TagNotFound(volume.id, name, volume.tags)
| null | null | null | the tag
| codeqa | def get volume tag volume name if volume tags for tag in volume tags if tag[' Key'] name return tag[' Value']raise Tag Not Found volume id name volume tags
| null | null | null | null | Question:
What does the code retrieve from the specified volume with the specified name ?
Code:
def _get_volume_tag(volume, name):
if volume.tags:
for tag in volume.tags:
if (tag['Key'] == name):
return tag['Value']
raise TagNotFound(volume.id, name, volume.tags)
|
null | null | null | How does the code retrieve the tag from the specified volume ?
| def _get_volume_tag(volume, name):
if volume.tags:
for tag in volume.tags:
if (tag['Key'] == name):
return tag['Value']
raise TagNotFound(volume.id, name, volume.tags)
| null | null | null | with the specified name
| codeqa | def get volume tag volume name if volume tags for tag in volume tags if tag[' Key'] name return tag[' Value']raise Tag Not Found volume id name volume tags
| null | null | null | null | Question:
How does the code retrieve the tag from the specified volume ?
Code:
def _get_volume_tag(volume, name):
if volume.tags:
for tag in volume.tags:
if (tag['Key'] == name):
return tag['Value']
raise TagNotFound(volume.id, name, volume.tags)
|
null | null | null | What does the code start ?
| def start_process(name):
run_as_root(('supervisorctl start %(name)s' % locals()))
| null | null | null | a supervisor process
| codeqa | def start process name run as root 'supervisorctlstart% name s' % locals
| null | null | null | null | Question:
What does the code start ?
Code:
def start_process(name):
run_as_root(('supervisorctl start %(name)s' % locals()))
|
null | null | null | How does the code get volume type ?
| def volume_type_get_by_name(context, name):
return IMPL.volume_type_get_by_name(context, name)
| null | null | null | by name
| codeqa | def volume type get by name context name return IMPL volume type get by name context name
| null | null | null | null | Question:
How does the code get volume type ?
Code:
def volume_type_get_by_name(context, name):
return IMPL.volume_type_get_by_name(context, name)
|
null | null | null | What does the code get by name ?
| def volume_type_get_by_name(context, name):
return IMPL.volume_type_get_by_name(context, name)
| null | null | null | volume type
| codeqa | def volume type get by name context name return IMPL volume type get by name context name
| null | null | null | null | Question:
What does the code get by name ?
Code:
def volume_type_get_by_name(context, name):
return IMPL.volume_type_get_by_name(context, name)
|
null | null | null | What does the code convert into a binary string ?
| def _long_to_bin(x, hex_format_string):
return binascii.unhexlify((hex_format_string % x).encode(u'ascii'))
| null | null | null | a long integer
| codeqa | def long to bin x hex format string return binascii unhexlify hex format string % x encode u'ascii'
| null | null | null | null | Question:
What does the code convert into a binary string ?
Code:
def _long_to_bin(x, hex_format_string):
return binascii.unhexlify((hex_format_string % x).encode(u'ascii'))
|
null | null | null | How does the code get paths ?
| def getPathsByKey(defaultPaths, elementNode, key):
if (key not in elementNode.attributes):
return defaultPaths
word = str(elementNode.attributes[key]).strip()
evaluatedLinkValue = getEvaluatedLinkValue(elementNode, word)
if ((evaluatedLinkValue.__class__ == dict) or (evaluatedLinkValue.__class__ == list)):
conv... | null | null | null | by key
| codeqa | def get Paths By Key default Paths element Node key if key not in element Node attributes return default Pathsword str element Node attributes[key] strip evaluated Link Value get Evaluated Link Value element Node word if evaluated Link Value class dict or evaluated Link Value class list convert To Paths evaluated Link ... | null | null | null | null | Question:
How does the code get paths ?
Code:
def getPathsByKey(defaultPaths, elementNode, key):
if (key not in elementNode.attributes):
return defaultPaths
word = str(elementNode.attributes[key]).strip()
evaluatedLinkValue = getEvaluatedLinkValue(elementNode, word)
if ((evaluatedLinkValue.__class__ == dict) ... |
null | null | null | What does the code get by key ?
| def getPathsByKey(defaultPaths, elementNode, key):
if (key not in elementNode.attributes):
return defaultPaths
word = str(elementNode.attributes[key]).strip()
evaluatedLinkValue = getEvaluatedLinkValue(elementNode, word)
if ((evaluatedLinkValue.__class__ == dict) or (evaluatedLinkValue.__class__ == list)):
conv... | null | null | null | paths
| codeqa | def get Paths By Key default Paths element Node key if key not in element Node attributes return default Pathsword str element Node attributes[key] strip evaluated Link Value get Evaluated Link Value element Node word if evaluated Link Value class dict or evaluated Link Value class list convert To Paths evaluated Link ... | null | null | null | null | Question:
What does the code get by key ?
Code:
def getPathsByKey(defaultPaths, elementNode, key):
if (key not in elementNode.attributes):
return defaultPaths
word = str(elementNode.attributes[key]).strip()
evaluatedLinkValue = getEvaluatedLinkValue(elementNode, word)
if ((evaluatedLinkValue.__class__ == dict... |
null | null | null | What does the code make ?
| def plugin():
return SwapQuotes
| null | null | null | plugin available
| codeqa | def plugin return Swap Quotes
| null | null | null | null | Question:
What does the code make ?
Code:
def plugin():
return SwapQuotes
|
null | null | null | What does the code write ?
| def write(data, *args, **kwargs):
format = kwargs.pop(u'format', None)
if (format is None):
path = None
fileobj = None
if len(args):
if isinstance(args[0], PATH_TYPES):
if (HAS_PATHLIB and isinstance(args[0], pathlib.Path)):
args = ((str(args[0]),) + args[1:])
path = args[0]
fileobj = None
... | null | null | null | data
| codeqa | def write data *args **kwargs format kwargs pop u'format' None if format is None path Nonefileobj Noneif len args if isinstance args[ 0 ] PATH TYPES if HAS PATHLIB and isinstance args[ 0 ] pathlib Path args str args[ 0 ] + args[ 1 ] path args[ 0 ]fileobj Noneelif hasattr args[ 0 ] u'read' path Nonefileobj args[ 0 ]form... | null | null | null | null | Question:
What does the code write ?
Code:
def write(data, *args, **kwargs):
format = kwargs.pop(u'format', None)
if (format is None):
path = None
fileobj = None
if len(args):
if isinstance(args[0], PATH_TYPES):
if (HAS_PATHLIB and isinstance(args[0], pathlib.Path)):
args = ((str(args[0]),) + ar... |
null | null | null | What will an example function turn into a flat list ?
| def flatten_errors(cfg, res, levels=None, results=None):
if (levels is None):
levels = []
results = []
if (res == True):
return results
if ((res == False) or isinstance(res, Exception)):
results.append((levels[:], None, res))
if levels:
levels.pop()
return results
for (key, val) in res.items():
if ... | null | null | null | a nested dictionary of results
| codeqa | def flatten errors cfg res levels None results None if levels is None levels []results []if res True return resultsif res False or isinstance res Exception results append levels[ ] None res if levels levels pop return resultsfor key val in res items if val True continueif isinstance cfg get key dict levels append key f... | null | null | null | null | Question:
What will an example function turn into a flat list ?
Code:
def flatten_errors(cfg, res, levels=None, results=None):
if (levels is None):
levels = []
results = []
if (res == True):
return results
if ((res == False) or isinstance(res, Exception)):
results.append((levels[:], None, res))
if leve... |
null | null | null | What will turn a nested dictionary of results into a flat list ?
| def flatten_errors(cfg, res, levels=None, results=None):
if (levels is None):
levels = []
results = []
if (res == True):
return results
if ((res == False) or isinstance(res, Exception)):
results.append((levels[:], None, res))
if levels:
levels.pop()
return results
for (key, val) in res.items():
if ... | null | null | null | an example function
| codeqa | def flatten errors cfg res levels None results None if levels is None levels []results []if res True return resultsif res False or isinstance res Exception results append levels[ ] None res if levels levels pop return resultsfor key val in res items if val True continueif isinstance cfg get key dict levels append key f... | null | null | null | null | Question:
What will turn a nested dictionary of results into a flat list ?
Code:
def flatten_errors(cfg, res, levels=None, results=None):
if (levels is None):
levels = []
results = []
if (res == True):
return results
if ((res == False) or isinstance(res, Exception)):
results.append((levels[:], None, res)... |
null | null | null | What does the code make ?
| def mkdir(filepath):
try:
os.makedirs(filepath)
except OSError:
if (not os.path.isdir(filepath)):
raise
| null | null | null | a directory
| codeqa | def mkdir filepath try os makedirs filepath except OS Error if not os path isdir filepath raise
| null | null | null | null | Question:
What does the code make ?
Code:
def mkdir(filepath):
try:
os.makedirs(filepath)
except OSError:
if (not os.path.isdir(filepath)):
raise
|
null | null | null | What does the code get from the database ?
| def get_component(app, id):
sa_session = app.model.context.current
return sa_session.query(app.model.Component).get(app.security.decode_id(id))
| null | null | null | a component
| codeqa | def get component app id sa session app model context currentreturn sa session query app model Component get app security decode id id
| null | null | null | null | Question:
What does the code get from the database ?
Code:
def get_component(app, id):
sa_session = app.model.context.current
return sa_session.query(app.model.Component).get(app.security.decode_id(id))
|
null | null | null | What does the code execute ?
| def greedy(tree, objective=identity, **kwargs):
optimize = partial(minimize, objective=objective)
return treeapply(tree, {list: optimize, tuple: chain}, **kwargs)
| null | null | null | a strategic tree
| codeqa | def greedy tree objective identity **kwargs optimize partial minimize objective objective return treeapply tree {list optimize tuple chain} **kwargs
| null | null | null | null | Question:
What does the code execute ?
Code:
def greedy(tree, objective=identity, **kwargs):
optimize = partial(minimize, objective=objective)
return treeapply(tree, {list: optimize, tuple: chain}, **kwargs)
|
null | null | null | What does the code populate with the most recent data ?
| @pick_context_manager_writer
def compute_node_create(context, values):
convert_objects_related_datetimes(values)
compute_node_ref = models.ComputeNode()
compute_node_ref.update(values)
compute_node_ref.save(context.session)
return compute_node_ref
| null | null | null | the capacity fields
| codeqa | @pick context manager writerdef compute node create context values convert objects related datetimes values compute node ref models Compute Node compute node ref update values compute node ref save context session return compute node ref
| null | null | null | null | Question:
What does the code populate with the most recent data ?
Code:
@pick_context_manager_writer
def compute_node_create(context, values):
convert_objects_related_datetimes(values)
compute_node_ref = models.ComputeNode()
compute_node_ref.update(values)
compute_node_ref.save(context.session)
return compute_... |
null | null | null | How does the code populate the capacity fields ?
| @pick_context_manager_writer
def compute_node_create(context, values):
convert_objects_related_datetimes(values)
compute_node_ref = models.ComputeNode()
compute_node_ref.update(values)
compute_node_ref.save(context.session)
return compute_node_ref
| null | null | null | with the most recent data
| codeqa | @pick context manager writerdef compute node create context values convert objects related datetimes values compute node ref models Compute Node compute node ref update values compute node ref save context session return compute node ref
| null | null | null | null | Question:
How does the code populate the capacity fields ?
Code:
@pick_context_manager_writer
def compute_node_create(context, values):
convert_objects_related_datetimes(values)
compute_node_ref = models.ComputeNode()
compute_node_ref.update(values)
compute_node_ref.save(context.session)
return compute_node_re... |
null | null | null | What does the code ensure ?
| @py.test.mark.parametrize('item_name', [item.name for item in six._urllib_parse_moved_attributes])
def test_move_items_urllib_parse(item_name):
if ((item_name == 'ParseResult') and (sys.version_info < (2, 5))):
py.test.skip('ParseResult is only found on 2.5+')
if ((item_name in ('parse_qs', 'parse_qsl')) and (... | null | null | null | that everything loads correctly
| codeqa | @py test mark parametrize 'item name' [item name for item in six urllib parse moved attributes] def test move items urllib parse item name if item name ' Parse Result' and sys version info < 2 5 py test skip ' Parse Resultisonlyfoundon 2 5+' if item name in 'parse qs' 'parse qsl' and sys version info < 2 6 py test skip... | null | null | null | null | Question:
What does the code ensure ?
Code:
@py.test.mark.parametrize('item_name', [item.name for item in six._urllib_parse_moved_attributes])
def test_move_items_urllib_parse(item_name):
if ((item_name == 'ParseResult') and (sys.version_info < (2, 5))):
py.test.skip('ParseResult is only found on 2.5+')
if... |
null | null | null | How do everything load ?
| @py.test.mark.parametrize('item_name', [item.name for item in six._urllib_parse_moved_attributes])
def test_move_items_urllib_parse(item_name):
if ((item_name == 'ParseResult') and (sys.version_info < (2, 5))):
py.test.skip('ParseResult is only found on 2.5+')
if ((item_name in ('parse_qs', 'parse_qsl')) and (... | null | null | null | correctly
| codeqa | @py test mark parametrize 'item name' [item name for item in six urllib parse moved attributes] def test move items urllib parse item name if item name ' Parse Result' and sys version info < 2 5 py test skip ' Parse Resultisonlyfoundon 2 5+' if item name in 'parse qs' 'parse qsl' and sys version info < 2 6 py test skip... | null | null | null | null | Question:
How do everything load ?
Code:
@py.test.mark.parametrize('item_name', [item.name for item in six._urllib_parse_moved_attributes])
def test_move_items_urllib_parse(item_name):
if ((item_name == 'ParseResult') and (sys.version_info < (2, 5))):
py.test.skip('ParseResult is only found on 2.5+')
if ((... |
null | null | null | What does the code flush in the specified table ?
| def flush(table='filter', chain='', family='ipv4'):
wait = ('--wait' if _has_option('--wait', family) else '')
cmd = '{0} {1} -t {2} -F {3}'.format(_iptables_cmd(family), wait, table, chain)
out = __salt__['cmd.run'](cmd)
return out
| null | null | null | the chain
| codeqa | def flush table 'filter' chain '' family 'ipv 4 ' wait '--wait' if has option '--wait' family else '' cmd '{ 0 }{ 1 }-t{ 2 }-F{ 3 }' format iptables cmd family wait table chain out salt ['cmd run'] cmd return out
| null | null | null | null | Question:
What does the code flush in the specified table ?
Code:
def flush(table='filter', chain='', family='ipv4'):
wait = ('--wait' if _has_option('--wait', family) else '')
cmd = '{0} {1} -t {2} -F {3}'.format(_iptables_cmd(family), wait, table, chain)
out = __salt__['cmd.run'](cmd)
return out
|
null | null | null | Where does the code flush the chain ?
| def flush(table='filter', chain='', family='ipv4'):
wait = ('--wait' if _has_option('--wait', family) else '')
cmd = '{0} {1} -t {2} -F {3}'.format(_iptables_cmd(family), wait, table, chain)
out = __salt__['cmd.run'](cmd)
return out
| null | null | null | in the specified table
| codeqa | def flush table 'filter' chain '' family 'ipv 4 ' wait '--wait' if has option '--wait' family else '' cmd '{ 0 }{ 1 }-t{ 2 }-F{ 3 }' format iptables cmd family wait table chain out salt ['cmd run'] cmd return out
| null | null | null | null | Question:
Where does the code flush the chain ?
Code:
def flush(table='filter', chain='', family='ipv4'):
wait = ('--wait' if _has_option('--wait', family) else '')
cmd = '{0} {1} -t {2} -F {3}'.format(_iptables_cmd(family), wait, table, chain)
out = __salt__['cmd.run'](cmd)
return out
|
null | null | null | What does the code see ?
| def set_default_subparser(self, name, args=None):
subparser_found = False
for arg in sys.argv[1:]:
if (arg in ['-h', '--help']):
break
else:
for x in self._subparsers._actions:
if (not isinstance(x, argparse._SubParsersAction)):
continue
for sp_name in x._name_parser_map.keys():
if (sp_name in s... | null | null | null | URL
| codeqa | def set default subparser self name args None subparser found Falsefor arg in sys argv[ 1 ] if arg in ['-h' '--help'] breakelse for x in self subparsers actions if not isinstance x argparse Sub Parsers Action continuefor sp name in x name parser map keys if sp name in sys argv[ 1 ] subparser found Trueif not subparser ... | null | null | null | null | Question:
What does the code see ?
Code:
def set_default_subparser(self, name, args=None):
subparser_found = False
for arg in sys.argv[1:]:
if (arg in ['-h', '--help']):
break
else:
for x in self._subparsers._actions:
if (not isinstance(x, argparse._SubParsersAction)):
continue
for sp_name in x.... |
null | null | null | In which direction do in data read ?
| def _fileToMatrix(file_name):
if (1 < 3):
lres = []
for line in open(file_name, 'r').readlines():
if ((len(line) > 0) and (line[0] not in ('%', '#'))):
lres.append(list(map(float, line.split())))
res = lres
else:
fil = open(file_name, 'r')
fil.readline()
lineToRow = (lambda line: list(map(float, li... | null | null | null | from a file
| codeqa | def file To Matrix file name if 1 < 3 lres []for line in open file name 'r' readlines if len line > 0 and line[ 0 ] not in '%' '#' lres append list map float line split res lreselse fil open file name 'r' fil readline line To Row lambda line list map float line split res list map line To Row fil readlines fil close whi... | null | null | null | null | Question:
In which direction do in data read ?
Code:
def _fileToMatrix(file_name):
if (1 < 3):
lres = []
for line in open(file_name, 'r').readlines():
if ((len(line) > 0) and (line[0] not in ('%', '#'))):
lres.append(list(map(float, line.split())))
res = lres
else:
fil = open(file_name, 'r')
fil.... |
null | null | null | Why is email invalid ?
| def invalid_email_reason(email_address, field):
if (email_address is None):
return ('None email address for %s.' % field)
if isinstance(email_address, users.User):
email_address = email_address.email()
if (not isinstance(email_address, basestring)):
return ('Invalid email address type for %s.' % field... | null | null | null | why
| codeqa | def invalid email reason email address field if email address is None return ' Noneemailaddressfor%s ' % field if isinstance email address users User email address email address email if not isinstance email address basestring return ' Invalidemailaddresstypefor%s ' % field stripped address email address strip if not s... | null | null | null | null | Question:
Why is email invalid ?
Code:
def invalid_email_reason(email_address, field):
if (email_address is None):
return ('None email address for %s.' % field)
if isinstance(email_address, users.User):
email_address = email_address.email()
if (not isinstance(email_address, basestring)):
return ('Inval... |
null | null | null | How do command show ?
| def test_missing_argument(script):
result = script.pip('show', expect_error=True)
assert ('ERROR: Please provide a package name or names.' in result.stderr)
| null | null | null | test
| codeqa | def test missing argument script result script pip 'show' expect error True assert 'ERROR Pleaseprovideapackagenameornames ' in result stderr
| null | null | null | null | Question:
How do command show ?
Code:
def test_missing_argument(script):
result = script.pip('show', expect_error=True)
assert ('ERROR: Please provide a package name or names.' in result.stderr)
|
null | null | null | What does the code get from salt ?
| def _get_options(ret=None):
defaults = {'debug_returner_payload': False, 'doc_type': 'default', 'functions_blacklist': [], 'index_date': False, 'master_event_index': 'salt-master-event-cache', 'master_event_doc_type': 'default', 'master_job_cache_index': 'salt-master-job-cache', 'master_job_cache_doc_type': 'default',... | null | null | null | the returner options
| codeqa | def get options ret None defaults {'debug returner payload' False 'doc type' 'default' 'functions blacklist' [] 'index date' False 'master event index' 'salt-master-event-cache' 'master event doc type' 'default' 'master job cache index' 'salt-master-job-cache' 'master job cache doc type' 'default' 'number of shards' 1 ... | null | null | null | null | Question:
What does the code get from salt ?
Code:
def _get_options(ret=None):
defaults = {'debug_returner_payload': False, 'doc_type': 'default', 'functions_blacklist': [], 'index_date': False, 'master_event_index': 'salt-master-event-cache', 'master_event_doc_type': 'default', 'master_job_cache_index': 'salt-mas... |
null | null | null | What does the code delete ?
| @permission_required('kbforums.delete_post')
def delete_post(request, document_slug, thread_id, post_id):
doc = get_document(document_slug, request)
thread = get_object_or_404(Thread, pk=thread_id, document=doc)
post = get_object_or_404(Post, pk=post_id, thread=thread)
if (request.method == 'GET'):
return render(... | null | null | null | a post
| codeqa | @permission required 'kbforums delete post' def delete post request document slug thread id post id doc get document document slug request thread get object or 404 Thread pk thread id document doc post get object or 404 Post pk post id thread thread if request method 'GET' return render request 'kbforums/confirm post d... | null | null | null | null | Question:
What does the code delete ?
Code:
@permission_required('kbforums.delete_post')
def delete_post(request, document_slug, thread_id, post_id):
doc = get_document(document_slug, request)
thread = get_object_or_404(Thread, pk=thread_id, document=doc)
post = get_object_or_404(Post, pk=post_id, thread=thread)... |
null | null | null | When do top five recommended brands return ?
| def recommend_for_brands(brands):
return []
| null | null | null | when given brands to recommend for
| codeqa | def recommend for brands brands return []
| null | null | null | null | Question:
When do top five recommended brands return ?
Code:
def recommend_for_brands(brands):
return []
|
null | null | null | What does the code create ?
| def show_interface(call=None, kwargs=None):
global netconn
if (not netconn):
netconn = get_conn(NetworkManagementClient)
if (kwargs is None):
kwargs = {}
if kwargs.get('group'):
kwargs['resource_group'] = kwargs['group']
if (kwargs.get('resource_group') is None):
kwargs['resource_group'] = config.get_cloud... | null | null | null | a network interface
| codeqa | def show interface call None kwargs None global netconnif not netconn netconn get conn Network Management Client if kwargs is None kwargs {}if kwargs get 'group' kwargs['resource group'] kwargs['group']if kwargs get 'resource group' is None kwargs['resource group'] config get cloud config value 'resource group' {} opts... | null | null | null | null | Question:
What does the code create ?
Code:
def show_interface(call=None, kwargs=None):
global netconn
if (not netconn):
netconn = get_conn(NetworkManagementClient)
if (kwargs is None):
kwargs = {}
if kwargs.get('group'):
kwargs['resource_group'] = kwargs['group']
if (kwargs.get('resource_group') is None... |
null | null | null | What does the code convert to printable representation ?
| def in6_ctop(addr):
if ((len(addr) != 20) or (not reduce((lambda x, y: (x and y)), map((lambda x: (x in _rfc1924map)), addr)))):
return None
i = 0
for c in addr:
j = _rfc1924map.index(c)
i = ((85 * i) + j)
res = []
for j in xrange(4):
res.append(struct.pack('!I', (i % (2 ** 32))))
i = (i / (2 ** 32))
re... | null | null | null | an ipv6 address in compact representation notation
| codeqa | def in 6 ctop addr if len addr 20 or not reduce lambda x y x and y map lambda x x in rfc 1924 map addr return Nonei 0for c in addr j rfc 1924 map index c i 85 * i + j res []for j in xrange 4 res append struct pack ' I' i % 2 ** 32 i i / 2 ** 32 res reverse return inet ntop socket AF INET 6 '' join res
| null | null | null | null | Question:
What does the code convert to printable representation ?
Code:
def in6_ctop(addr):
if ((len(addr) != 20) or (not reduce((lambda x, y: (x and y)), map((lambda x: (x in _rfc1924map)), addr)))):
return None
i = 0
for c in addr:
j = _rfc1924map.index(c)
i = ((85 * i) + j)
res = []
for j in xrange(4... |
null | null | null | How does user prompt for a password ?
| def store_password_in_keyring(credential_id, username, password=None):
try:
import keyring
import keyring.errors
if (password is None):
prompt = 'Please enter password for {0}: '.format(credential_id)
try:
password = getpass.getpass(prompt)
except EOFError:
password = None
if (not passwo... | null | null | null | interactively
| codeqa | def store password in keyring credential id username password None try import keyringimport keyring errorsif password is None prompt ' Pleaseenterpasswordfor{ 0 } ' format credential id try password getpass getpass prompt except EOF Error password Noneif not password raise Runtime Error ' Invalidpasswordprovided ' try ... | null | null | null | null | Question:
How does user prompt for a password ?
Code:
def store_password_in_keyring(credential_id, username, password=None):
try:
import keyring
import keyring.errors
if (password is None):
prompt = 'Please enter password for {0}: '.format(credential_id)
try:
password = getpass.getpass(prompt)... |
null | null | null | What does the code add ?
| @profiler.trace
def add_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None):
manager = keystoneclient(request, admin=True).roles
if (VERSIONS.active < 3):
return manager.add_user_role(user, role, project)
else:
return manager.grant(role, user=user, project=project, group=group,... | null | null | null | a role for a user on a tenant
| codeqa | @profiler tracedef add tenant user role request project None user None role None group None domain None manager keystoneclient request admin True rolesif VERSIONS active < 3 return manager add user role user role project else return manager grant role user user project project group group domain domain
| null | null | null | null | Question:
What does the code add ?
Code:
@profiler.trace
def add_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None):
manager = keystoneclient(request, admin=True).roles
if (VERSIONS.active < 3):
return manager.add_user_role(user, role, project)
else:
return manager.grant(r... |
null | null | null | How do the interactive python interpreter emulate ?
| def interact(banner=None, readfunc=None, local=None):
console = InteractiveConsole(local)
if (readfunc is not None):
console.raw_input = readfunc
else:
try:
import readline
except ImportError:
pass
console.interact(banner)
| null | null | null | closely
| codeqa | def interact banner None readfunc None local None console Interactive Console local if readfunc is not None console raw input readfuncelse try import readlineexcept Import Error passconsole interact banner
| null | null | null | null | Question:
How do the interactive python interpreter emulate ?
Code:
def interact(banner=None, readfunc=None, local=None):
console = InteractiveConsole(local)
if (readfunc is not None):
console.raw_input = readfunc
else:
try:
import readline
except ImportError:
pass
console.interact(banner)
|
null | null | null | What does the code translate to a compiled regular expression ?
| def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
if is_regex:
if isinstance(pattern, str):
return re.compile(pattern)
else:
return pattern
if pattern:
pattern_re = glob_to_re(pattern)
else:
pattern_re = ''
if (prefix is not None):
empty_pattern = glob_to_re('')
prefix_re = glob_t... | null | null | null | a shell - like wildcard pattern
| codeqa | def translate pattern pattern anchor 1 prefix None is regex 0 if is regex if isinstance pattern str return re compile pattern else return patternif pattern pattern re glob to re pattern else pattern re ''if prefix is not None empty pattern glob to re '' prefix re glob to re prefix [ - len empty pattern ]sep os sepif os... | null | null | null | null | Question:
What does the code translate to a compiled regular expression ?
Code:
def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
if is_regex:
if isinstance(pattern, str):
return re.compile(pattern)
else:
return pattern
if pattern:
pattern_re = glob_to_re(pattern)
else:
pattern_re ... |
null | null | null | For what purpose do the locale data load ?
| def load(name, merge_inherited=True):
_cache_lock.acquire()
try:
data = _cache.get(name)
if (not data):
if ((name == 'root') or (not merge_inherited)):
data = {}
else:
parts = name.split('_')
if (len(parts) == 1):
parent = 'root'
else:
parent = '_'.join(parts[:(-1)])
data = loa... | null | null | null | for the given locale
| codeqa | def load name merge inherited True cache lock acquire try data cache get name if not data if name 'root' or not merge inherited data {}else parts name split ' ' if len parts 1 parent 'root'else parent ' ' join parts[ -1 ] data load parent copy filename os path join dirname '%s dat' % name fileobj open filename 'rb' try... | null | null | null | null | Question:
For what purpose do the locale data load ?
Code:
def load(name, merge_inherited=True):
_cache_lock.acquire()
try:
data = _cache.get(name)
if (not data):
if ((name == 'root') or (not merge_inherited)):
data = {}
else:
parts = name.split('_')
if (len(parts) == 1):
parent = 'root... |
null | null | null | What does the code wrap ?
| def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):
return timeout_value
raise
finally:
timeout.cancel()
| null | null | null | a call to * function * with a timeout
| codeqa | def with timeout seconds function *args **kwds timeout value kwds pop 'timeout value' NONE timeout Timeout start new seconds try return function *args **kwds except Timeout as ex if ex is timeout and timeout value is not NONE return timeout valueraisefinally timeout cancel
| null | null | null | null | Question:
What does the code wrap ?
Code:
def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):
return timeo... |
null | null | null | What do the called function fail ?
| def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):
return timeout_value
raise
finally:
timeout.cancel()
| null | null | null | to return before the timeout
| codeqa | def with timeout seconds function *args **kwds timeout value kwds pop 'timeout value' NONE timeout Timeout start new seconds try return function *args **kwds except Timeout as ex if ex is timeout and timeout value is not NONE return timeout valueraisefinally timeout cancel
| null | null | null | null | Question:
What do the called function fail ?
Code:
def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):
ret... |
null | null | null | What fails to return before the timeout ?
| def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):
return timeout_value
raise
finally:
timeout.cancel()
| null | null | null | the called function
| codeqa | def with timeout seconds function *args **kwds timeout value kwds pop 'timeout value' NONE timeout Timeout start new seconds try return function *args **kwds except Timeout as ex if ex is timeout and timeout value is not NONE return timeout valueraisefinally timeout cancel
| null | null | null | null | Question:
What fails to return before the timeout ?
Code:
def with_timeout(seconds, function, *args, **kwds):
timeout_value = kwds.pop('timeout_value', _NONE)
timeout = Timeout.start_new(seconds)
try:
return function(*args, **kwds)
except Timeout as ex:
if ((ex is timeout) and (timeout_value is not _NONE)):... |
null | null | null | In which direction does the code convert it to its numerical equivalent ?
| @register.filter('phone2numeric', is_safe=True)
def phone2numeric_filter(value):
return phone2numeric(value)
| null | null | null | in
| codeqa | @register filter 'phone 2 numeric' is safe True def phone 2 numeric filter value return phone 2 numeric value
| null | null | null | null | Question:
In which direction does the code convert it to its numerical equivalent ?
Code:
@register.filter('phone2numeric', is_safe=True)
def phone2numeric_filter(value):
return phone2numeric(value)
|
null | null | null | What does the code take ?
| @register.filter('phone2numeric', is_safe=True)
def phone2numeric_filter(value):
return phone2numeric(value)
| null | null | null | a phone number
| codeqa | @register filter 'phone 2 numeric' is safe True def phone 2 numeric filter value return phone 2 numeric value
| null | null | null | null | Question:
What does the code take ?
Code:
@register.filter('phone2numeric', is_safe=True)
def phone2numeric_filter(value):
return phone2numeric(value)
|
null | null | null | When did audit log files create ?
| def GetAuditLogFiles(offset, now, token):
oldest_time = ((now - offset) - rdfvalue.Duration(config_lib.CONFIG['Logging.aff4_audit_log_rollover']))
parentdir = aff4.FACTORY.Open('aff4:/audit/logs', token=token)
logs = list(parentdir.ListChildren(age=(oldest_time.AsMicroSecondsFromEpoch(), now.AsMicroSecondsFromEpoch(... | null | null | null | between now - offset and now
| codeqa | def Get Audit Log Files offset now token oldest time now - offset - rdfvalue Duration config lib CONFIG[' Logging aff 4 audit log rollover'] parentdir aff 4 FACTORY Open 'aff 4 /audit/logs' token token logs list parentdir List Children age oldest time As Micro Seconds From Epoch now As Micro Seconds From Epoch if not l... | null | null | null | null | Question:
When did audit log files create ?
Code:
def GetAuditLogFiles(offset, now, token):
oldest_time = ((now - offset) - rdfvalue.Duration(config_lib.CONFIG['Logging.aff4_audit_log_rollover']))
parentdir = aff4.FACTORY.Open('aff4:/audit/logs', token=token)
logs = list(parentdir.ListChildren(age=(oldest_time.A... |
null | null | null | What does the code get ?
| def getBeginGeometryXMLOutput(elementNode=None):
output = getBeginXMLOutput()
attributes = {}
if (elementNode != None):
documentElement = elementNode.getDocumentElement()
attributes = documentElement.attributes
addBeginXMLTag(attributes, 0, 'fabmetheus', output)
return output
| null | null | null | the beginning of the string representation of this boolean geometry object info
| codeqa | def get Begin Geometry XML Output element Node None output get Begin XML Output attributes {}if element Node None document Element element Node get Document Element attributes document Element attributesadd Begin XML Tag attributes 0 'fabmetheus' output return output
| null | null | null | null | Question:
What does the code get ?
Code:
def getBeginGeometryXMLOutput(elementNode=None):
output = getBeginXMLOutput()
attributes = {}
if (elementNode != None):
documentElement = elementNode.getDocumentElement()
attributes = documentElement.attributes
addBeginXMLTag(attributes, 0, 'fabmetheus', output)
ret... |
null | null | null | What does the code get ?
| def equateZ(point, returnValue):
point.z = returnValue
| null | null | null | equation for rectangular z
| codeqa | def equate Z point return Value point z return Value
| null | null | null | null | Question:
What does the code get ?
Code:
def equateZ(point, returnValue):
point.z = returnValue
|
null | null | null | What is a dictionary of all the parameters for the media range the ?
| def parse_mime_type(mime_type):
type = mime_type.split(';')
(type, plist) = (type[0], type[1:])
try:
(type, subtype) = type.split('/', 1)
except ValueError:
(type, subtype) = ((type.strip() or '*'), '*')
else:
type = (type.strip() or '*')
subtype = (subtype.strip() or '*')
params = {}
for param in plist:... | null | null | null | params
| codeqa | def parse mime type mime type type mime type split ' ' type plist type[ 0 ] type[ 1 ] try type subtype type split '/' 1 except Value Error type subtype type strip or '*' '*' else type type strip or '*' subtype subtype strip or '*' params {}for param in plist param param split ' ' 1 if len param 2 key value param[ 0 ] s... | null | null | null | null | Question:
What is a dictionary of all the parameters for the media range the ?
Code:
def parse_mime_type(mime_type):
type = mime_type.split(';')
(type, plist) = (type[0], type[1:])
try:
(type, subtype) = type.split('/', 1)
except ValueError:
(type, subtype) = ((type.strip() or '*'), '*')
else:
type = (ty... |
null | null | null | What does the code delete ?
| def delete_container(url, token, container, http_conn=None, response_dict=None, service_token=None, query_string=None, headers=None):
if http_conn:
(parsed, conn) = http_conn
else:
(parsed, conn) = http_connection(url)
path = ('%s/%s' % (parsed.path, quote(container)))
if headers:
headers = dict(headers)
els... | null | null | null | a container
| codeqa | def delete container url token container http conn None response dict None service token None query string None headers None if http conn parsed conn http connelse parsed conn http connection url path '%s/%s' % parsed path quote container if headers headers dict headers else headers {}headers['X- Auth- Token'] tokenif ... | null | null | null | null | Question:
What does the code delete ?
Code:
def delete_container(url, token, container, http_conn=None, response_dict=None, service_token=None, query_string=None, headers=None):
if http_conn:
(parsed, conn) = http_conn
else:
(parsed, conn) = http_connection(url)
path = ('%s/%s' % (parsed.path, quote(containe... |
null | null | null | What does the code add to volumes ?
| def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
source_volid = Column('source_volid', String(36))
volumes.create_column(source_volid)
volumes.update().values(source_volid=None).execute()
| null | null | null | source volume i d column
| codeqa | def upgrade migrate engine meta Meta Data meta bind migrate enginevolumes Table 'volumes' meta autoload True source volid Column 'source volid' String 36 volumes create column source volid volumes update values source volid None execute
| null | null | null | null | Question:
What does the code add to volumes ?
Code:
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
volumes = Table('volumes', meta, autoload=True)
source_volid = Column('source_volid', String(36))
volumes.create_column(source_volid)
volumes.update().values(source_volid=None).execute... |
null | null | null | What return a literal value simply ?
| def replaceWith(replStr):
def _replFunc(*args):
return [replStr]
return _replFunc
| null | null | null | common parse actions
| codeqa | def replace With repl Str def repl Func *args return [repl Str]return repl Func
| null | null | null | null | Question:
What return a literal value simply ?
Code:
def replaceWith(replStr):
def _replFunc(*args):
return [replStr]
return _replFunc
|
null | null | null | What do common parse actions return simply ?
| def replaceWith(replStr):
def _replFunc(*args):
return [replStr]
return _replFunc
| null | null | null | a literal value
| codeqa | def replace With repl Str def repl Func *args return [repl Str]return repl Func
| null | null | null | null | Question:
What do common parse actions return simply ?
Code:
def replaceWith(replStr):
def _replFunc(*args):
return [replStr]
return _replFunc
|
null | null | null | What does the code add ?
| def addToProfileMenu(menu):
settings.ToolDialog().addPluginToMenu(menu, archive.getUntilDot(archive.getSkeinforgePluginsPath('profile.py')))
menu.add_separator()
directoryPath = skeinforge_profile.getPluginsDirectoryPath()
pluginFileNames = skeinforge_profile.getPluginFileNames()
craftTypeName = skeinforge_profile... | null | null | null | a profile menu
| codeqa | def add To Profile Menu menu settings Tool Dialog add Plugin To Menu menu archive get Until Dot archive get Skeinforge Plugins Path 'profile py' menu add separator directory Path skeinforge profile get Plugins Directory Path plugin File Names skeinforge profile get Plugin File Names craft Type Name skeinforge profile g... | null | null | null | null | Question:
What does the code add ?
Code:
def addToProfileMenu(menu):
settings.ToolDialog().addPluginToMenu(menu, archive.getUntilDot(archive.getSkeinforgePluginsPath('profile.py')))
menu.add_separator()
directoryPath = skeinforge_profile.getPluginsDirectoryPath()
pluginFileNames = skeinforge_profile.getPluginFi... |
null | null | null | What does the code generate ?
| def _gen_tag(low):
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
| null | null | null | the running dict tag string
| codeqa | def gen tag low return '{ 0 [state]} -{ 0 [ id ]} -{ 0 [name]} -{ 0 [fun]}' format low
| null | null | null | null | Question:
What does the code generate ?
Code:
def _gen_tag(low):
return '{0[state]}_|-{0[__id__]}_|-{0[name]}_|-{0[fun]}'.format(low)
|
null | null | null | In which direction can the name be parsed to its original form for both single and multi episodes ?
| def check_valid_naming(pattern=None, multi=None):
if (pattern is None):
pattern = sickbeard.NAMING_PATTERN
logger.log(((u'Checking whether the pattern ' + pattern) + ' is valid for a single episode'), logger.DEBUG)
valid = validate_name(pattern, None)
if (multi is not None):
logger.log(((u'Checking w... | null | null | null | back
| codeqa | def check valid naming pattern None multi None if pattern is None pattern sickbeard NAMING PATTER Nlogger log u' Checkingwhetherthepattern' + pattern + 'isvalidforasingleepisode' logger DEBUG valid validate name pattern None if multi is not None logger log u' Checkingwhetherthepattern' + pattern + 'isvalidforamultiepis... | null | null | null | null | Question:
In which direction can the name be parsed to its original form for both single and multi episodes ?
Code:
def check_valid_naming(pattern=None, multi=None):
if (pattern is None):
pattern = sickbeard.NAMING_PATTERN
logger.log(((u'Checking whether the pattern ' + pattern) + ' is valid for a sing... |
null | null | null | How do product elementwise ?
| def scale(x, y, axis=1):
x_shape = x.shape
y_shape = y.shape
if chainer.is_debug():
assert (x_shape[axis:(axis + len(y_shape))] == y_shape)
y1_shape = tuple(((([1] * axis) + list(y_shape)) + ([1] * ((len(x_shape) - axis) - len(y_shape)))))
y1 = reshape.reshape(y, y1_shape)
y2 = broadcast.broadcast_to(y1, x_shap... | null | null | null | with broadcasting
| codeqa | def scale x y axis 1 x shape x shapey shape y shapeif chainer is debug assert x shape[axis axis + len y shape ] y shape y1 shape tuple [1 ] * axis + list y shape + [1 ] * len x shape - axis - len y shape y1 reshape reshape y y1 shape y2 broadcast broadcast to y1 x shape return x * y2
| null | null | null | null | Question:
How do product elementwise ?
Code:
def scale(x, y, axis=1):
x_shape = x.shape
y_shape = y.shape
if chainer.is_debug():
assert (x_shape[axis:(axis + len(y_shape))] == y_shape)
y1_shape = tuple(((([1] * axis) + list(y_shape)) + ([1] * ((len(x_shape) - axis) - len(y_shape)))))
y1 = reshape.reshape(y, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.