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 grab if acquired ?
| @gen.engine
def _Start(callback):
client = db_client.DBClient.Instance()
job = Job(client, 'client_logs')
if options.options.require_lock:
got_lock = (yield gen.Task(job.AcquireLock))
if (got_lock == False):
logging.warning('Failed to acquire job lock: exiting.')
callback()
return
try:
(yield ge... | null | null | null | the job lock
| codeqa | @gen enginedef Start callback client db client DB Client Instance job Job client 'client logs' if options options require lock got lock yield gen Task job Acquire Lock if got lock False logging warning ' Failedtoacquirejoblock exiting ' callback returntry yield gen Task Run Once finally yield gen Task job Release Lock ... | null | null | null | null | Question:
What does the code grab if acquired ?
Code:
@gen.engine
def _Start(callback):
client = db_client.DBClient.Instance()
job = Job(client, 'client_logs')
if options.options.require_lock:
got_lock = (yield gen.Task(job.AcquireLock))
if (got_lock == False):
logging.warning('Failed to acquire job l... |
null | null | null | What does the code call if acquired ?
| @gen.engine
def _Start(callback):
client = db_client.DBClient.Instance()
job = Job(client, 'client_logs')
if options.options.require_lock:
got_lock = (yield gen.Task(job.AcquireLock))
if (got_lock == False):
logging.warning('Failed to acquire job lock: exiting.')
callback()
return
try:
(yield ge... | null | null | null | runonce
| codeqa | @gen enginedef Start callback client db client DB Client Instance job Job client 'client logs' if options options require lock got lock yield gen Task job Acquire Lock if got lock False logging warning ' Failedtoacquirejoblock exiting ' callback returntry yield gen Task Run Once finally yield gen Task job Release Lock ... | null | null | null | null | Question:
What does the code call if acquired ?
Code:
@gen.engine
def _Start(callback):
client = db_client.DBClient.Instance()
job = Job(client, 'client_logs')
if options.options.require_lock:
got_lock = (yield gen.Task(job.AcquireLock))
if (got_lock == False):
logging.warning('Failed to acquire job l... |
null | null | null | How does the code sort them ?
| def sort(seq):
lower_bound = (-1)
upper_bound = (len(seq) - 1)
swapped = True
while swapped:
swapped = False
lower_bound += 1
for i in range(lower_bound, upper_bound):
if (seq[i] > seq[(i + 1)]):
(seq[i], seq[(i + 1)]) = (seq[(i + 1)], seq[i])
swapped = True
if (not swapped):
break
swapped =... | null | null | null | in ascending order
| codeqa | def sort seq lower bound -1 upper bound len seq - 1 swapped Truewhile swapped swapped Falselower bound + 1for i in range lower bound upper bound if seq[i] > seq[ i + 1 ] seq[i] seq[ i + 1 ] seq[ i + 1 ] seq[i] swapped Trueif not swapped breakswapped Falseupper bound - 1for i in range upper bound lower bound -1 if seq[i... | null | null | null | null | Question:
How does the code sort them ?
Code:
def sort(seq):
lower_bound = (-1)
upper_bound = (len(seq) - 1)
swapped = True
while swapped:
swapped = False
lower_bound += 1
for i in range(lower_bound, upper_bound):
if (seq[i] > seq[(i + 1)]):
(seq[i], seq[(i + 1)]) = (seq[(i + 1)], seq[i])
swapp... |
null | null | null | What does the code take ?
| def sort(seq):
lower_bound = (-1)
upper_bound = (len(seq) - 1)
swapped = True
while swapped:
swapped = False
lower_bound += 1
for i in range(lower_bound, upper_bound):
if (seq[i] > seq[(i + 1)]):
(seq[i], seq[(i + 1)]) = (seq[(i + 1)], seq[i])
swapped = True
if (not swapped):
break
swapped =... | null | null | null | a list of integers
| codeqa | def sort seq lower bound -1 upper bound len seq - 1 swapped Truewhile swapped swapped Falselower bound + 1for i in range lower bound upper bound if seq[i] > seq[ i + 1 ] seq[i] seq[ i + 1 ] seq[ i + 1 ] seq[i] swapped Trueif not swapped breakswapped Falseupper bound - 1for i in range upper bound lower bound -1 if seq[i... | null | null | null | null | Question:
What does the code take ?
Code:
def sort(seq):
lower_bound = (-1)
upper_bound = (len(seq) - 1)
swapped = True
while swapped:
swapped = False
lower_bound += 1
for i in range(lower_bound, upper_bound):
if (seq[i] > seq[(i + 1)]):
(seq[i], seq[(i + 1)]) = (seq[(i + 1)], seq[i])
swapped =... |
null | null | null | What does the code create ?
| def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
legacy_table = sql.Table('endpoint', meta, autoload=True)
legacy_table.rename('endpoint_v2')
sql.Table('service', meta, autoload=True)
new_table = sql.Table('endpoint_v3', meta, sql.Column('id', sql.String(64), primary_key=True), sql.Co... | null | null | null | api - version specific endpoint tables
| codeqa | def upgrade migrate engine meta sql Meta Data meta bind migrate enginelegacy table sql Table 'endpoint' meta autoload True legacy table rename 'endpoint v2 ' sql Table 'service' meta autoload True new table sql Table 'endpoint v3 ' meta sql Column 'id' sql String 64 primary key True sql Column 'legacy endpoint id' sql ... | null | null | null | null | Question:
What does the code create ?
Code:
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
legacy_table = sql.Table('endpoint', meta, autoload=True)
legacy_table.rename('endpoint_v2')
sql.Table('service', meta, autoload=True)
new_table = sql.Table('endpoint_v3', meta, sql.Column... |
null | null | null | What does the code delete ?
| def delete_network(context, net_id):
session = context.session
with session.begin(subtransactions=True):
net = session.query(BrocadeNetwork).filter_by(id=net_id).first()
if (net is not None):
session.delete(net)
| null | null | null | a brocade specific network / port - profiles
| codeqa | def delete network context net id session context sessionwith session begin subtransactions True net session query Brocade Network filter by id net id first if net is not None session delete net
| null | null | null | null | Question:
What does the code delete ?
Code:
def delete_network(context, net_id):
session = context.session
with session.begin(subtransactions=True):
net = session.query(BrocadeNetwork).filter_by(id=net_id).first()
if (net is not None):
session.delete(net)
|
null | null | null | How have all updates been downloaded ?
| def list_downloads():
outfiles = []
for (root, subFolder, files) in os.walk('/Library/Updates'):
for f in files:
outfiles.append(os.path.join(root, f))
dist_files = []
for f in outfiles:
if f.endswith('.dist'):
dist_files.append(f)
ret = []
for update in _get_available():
for f in dist_files:
with ... | null | null | null | locally
| codeqa | def list downloads outfiles []for root sub Folder files in os walk '/ Library/ Updates' for f in files outfiles append os path join root f dist files []for f in outfiles if f endswith ' dist' dist files append f ret []for update in get available for f in dist files with salt utils fopen f as fhr if update rsplit '-' 1 ... | null | null | null | null | Question:
How have all updates been downloaded ?
Code:
def list_downloads():
outfiles = []
for (root, subFolder, files) in os.walk('/Library/Updates'):
for f in files:
outfiles.append(os.path.join(root, f))
dist_files = []
for f in outfiles:
if f.endswith('.dist'):
dist_files.append(f)
ret = []
for ... |
null | null | null | What do user - callable function create ?
| def mkdtemp(suffix='', prefix=template, dir=None):
if (dir is None):
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, ((prefix + name) + suffix))
try:
_os.mkdir(file, 448)
return file
except OSError as e:
if (e.errno == _er... | null | null | null | a unique temporary directory
| codeqa | def mkdtemp suffix '' prefix template dir None if dir is None dir gettempdir names get candidate names for seq in xrange TMP MAX name names next file os path join dir prefix + name + suffix try os mkdir file 448 return fileexcept OS Error as e if e errno errno EEXIST continueif os name 'nt' and e errno errno EACCES and... | null | null | null | null | Question:
What do user - callable function create ?
Code:
def mkdtemp(suffix='', prefix=template, dir=None):
if (dir is None):
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, ((prefix + name) + suffix))
try:
_os.mkdir(file, 44... |
null | null | null | What creates a unique temporary directory ?
| def mkdtemp(suffix='', prefix=template, dir=None):
if (dir is None):
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, ((prefix + name) + suffix))
try:
_os.mkdir(file, 448)
return file
except OSError as e:
if (e.errno == _er... | null | null | null | user - callable function
| codeqa | def mkdtemp suffix '' prefix template dir None if dir is None dir gettempdir names get candidate names for seq in xrange TMP MAX name names next file os path join dir prefix + name + suffix try os mkdir file 448 return fileexcept OS Error as e if e errno errno EEXIST continueif os name 'nt' and e errno errno EACCES and... | null | null | null | null | Question:
What creates a unique temporary directory ?
Code:
def mkdtemp(suffix='', prefix=template, dir=None):
if (dir is None):
dir = gettempdir()
names = _get_candidate_names()
for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, ((prefix + name) + suffix))
try:
_os.mkdir(file, ... |
null | null | null | What does the code create ?
| def create_env():
searchpath = list(settings.JINJA2_TEMPLATE_DIRS)
return Environment(loader=FileSystemLoader(searchpath), auto_reload=settings.TEMPLATE_DEBUG, cache_size=getattr(settings, 'JINJA2_CACHE_SIZE', 50), extensions=getattr(settings, 'JINJA2_EXTENSIONS', ()))
| null | null | null | a new jinja2 environment
| codeqa | def create env searchpath list settings JINJA 2 TEMPLATE DIRS return Environment loader File System Loader searchpath auto reload settings TEMPLATE DEBUG cache size getattr settings 'JINJA 2 CACHE SIZE' 50 extensions getattr settings 'JINJA 2 EXTENSIONS'
| null | null | null | null | Question:
What does the code create ?
Code:
def create_env():
searchpath = list(settings.JINJA2_TEMPLATE_DIRS)
return Environment(loader=FileSystemLoader(searchpath), auto_reload=settings.TEMPLATE_DEBUG, cache_size=getattr(settings, 'JINJA2_CACHE_SIZE', 50), extensions=getattr(settings, 'JINJA2_EXTENSIONS', ()))
|
null | null | null | Where do packets receive ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | at layer 2
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
Where do packets receive ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | What receives at layer 2 ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | packets
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
What receives at layer 2 ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | What sends at layer 2 ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | packets
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
What sends at layer 2 ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | Where do packets send ?
| @conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
| null | null | null | at layer 2
| codeqa | @conf commands registerdef srp 1 *args **kargs if not kargs has key 'timeout' kargs['timeout'] -1 a b srp *args **kargs if len a > 0 return a[ 0 ][ 1 ]else return None
| null | null | null | null | Question:
Where do packets send ?
Code:
@conf.commands.register
def srp1(*args, **kargs):
if (not kargs.has_key('timeout')):
kargs['timeout'] = (-1)
(a, b) = srp(*args, **kargs)
if (len(a) > 0):
return a[0][1]
else:
return None
|
null | null | null | In which direction has the purchase gone ?
| def check_purchase(paykey):
with statsd.timer('paypal.payment.details'):
try:
response = _call((settings.PAYPAL_PAY_URL + 'PaymentDetails'), {'payKey': paykey})
except PaypalError:
paypal_log.error('Payment details error', exc_info=True)
return False
return response['status']
| null | null | null | through
| codeqa | def check purchase paykey with statsd timer 'paypal payment details' try response call settings PAYPAL PAY URL + ' Payment Details' {'pay Key' paykey} except Paypal Error paypal log error ' Paymentdetailserror' exc info True return Falsereturn response['status']
| null | null | null | null | Question:
In which direction has the purchase gone ?
Code:
def check_purchase(paykey):
with statsd.timer('paypal.payment.details'):
try:
response = _call((settings.PAYPAL_PAY_URL + 'PaymentDetails'), {'payKey': paykey})
except PaypalError:
paypal_log.error('Payment details error', exc_info=True)
ret... |
null | null | null | What do a simple dialogue allow ?
| def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file to open'), allowed=None):
global qtapp
qtapp = ensureQtApp()
if (allowed is None):
allowed = 'All files (*.*);;PsychoPy Data (*.psydat);;txt (*.txt *.dlm *.csv);;pickled files (*.pickle *.pkl);;shelved files (*.shelf)'
f... | null | null | null | read access to the file system
| codeqa | def file Open Dlg try File Path '' try File Name '' prompt translate ' Selectfiletoopen' allowed None global qtappqtapp ensure Qt App if allowed is None allowed ' Allfiles * * Psycho Py Data * psydat txt * txt* dlm* csv pickledfiles * pickle* pkl shelvedfiles * shelf 'fdir os path join try File Path try File Name files... | null | null | null | null | Question:
What do a simple dialogue allow ?
Code:
def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file to open'), allowed=None):
global qtapp
qtapp = ensureQtApp()
if (allowed is None):
allowed = 'All files (*.*);;PsychoPy Data (*.psydat);;txt (*.txt *.dlm *.csv);;pickled f... |
null | null | null | What is allowing read access to the file system ?
| def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file to open'), allowed=None):
global qtapp
qtapp = ensureQtApp()
if (allowed is None):
allowed = 'All files (*.*);;PsychoPy Data (*.psydat);;txt (*.txt *.dlm *.csv);;pickled files (*.pickle *.pkl);;shelved files (*.shelf)'
f... | null | null | null | a simple dialogue
| codeqa | def file Open Dlg try File Path '' try File Name '' prompt translate ' Selectfiletoopen' allowed None global qtappqtapp ensure Qt App if allowed is None allowed ' Allfiles * * Psycho Py Data * psydat txt * txt* dlm* csv pickledfiles * pickle* pkl shelvedfiles * shelf 'fdir os path join try File Path try File Name files... | null | null | null | null | Question:
What is allowing read access to the file system ?
Code:
def fileOpenDlg(tryFilePath='', tryFileName='', prompt=_translate('Select file to open'), allowed=None):
global qtapp
qtapp = ensureQtApp()
if (allowed is None):
allowed = 'All files (*.*);;PsychoPy Data (*.psydat);;txt (*.txt *.dlm *.... |
null | null | null | How do an object return ?
| def get_obj(content, vimtype, name):
obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)
for c in container.view:
if name:
if (c.name == name):
obj = c
break
else:
obj = c
break
container.Destroy()
return obj
| null | null | null | by name
| codeqa | def get obj content vimtype name obj Nonecontainer content view Manager Create Container View content root Folder vimtype True for c in container view if name if c name name obj cbreakelse obj cbreakcontainer Destroy return obj
| null | null | null | null | Question:
How do an object return ?
Code:
def get_obj(content, vimtype, name):
obj = None
container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)
for c in container.view:
if name:
if (c.name == name):
obj = c
break
else:
obj = c
break
container.Destroy()
retu... |
null | null | null | What does the code get by start and end angle ?
| def getComplexPolygonByStartEnd(endAngle, radius, sides, startAngle=0.0):
if (endAngle == startAngle):
return getComplexPolygon(complex(), radius, sides, startAngle)
angleExtent = (endAngle - startAngle)
sideAngle = ((2.0 * math.pi) / float(sides))
sides = math.ceil(abs((angleExtent / sideAngle)))
sideAngle = (a... | null | null | null | the complex polygon
| codeqa | def get Complex Polygon By Start End end Angle radius sides start Angle 0 0 if end Angle start Angle return get Complex Polygon complex radius sides start Angle angle Extent end Angle - start Angle side Angle 2 0 * math pi / float sides sides math ceil abs angle Extent / side Angle side Angle angle Extent / float sides... | null | null | null | null | Question:
What does the code get by start and end angle ?
Code:
def getComplexPolygonByStartEnd(endAngle, radius, sides, startAngle=0.0):
if (endAngle == startAngle):
return getComplexPolygon(complex(), radius, sides, startAngle)
angleExtent = (endAngle - startAngle)
sideAngle = ((2.0 * math.pi) / float(sides)... |
null | null | null | How does the code get the complex polygon ?
| def getComplexPolygonByStartEnd(endAngle, radius, sides, startAngle=0.0):
if (endAngle == startAngle):
return getComplexPolygon(complex(), radius, sides, startAngle)
angleExtent = (endAngle - startAngle)
sideAngle = ((2.0 * math.pi) / float(sides))
sides = math.ceil(abs((angleExtent / sideAngle)))
sideAngle = (a... | null | null | null | by start and end angle
| codeqa | def get Complex Polygon By Start End end Angle radius sides start Angle 0 0 if end Angle start Angle return get Complex Polygon complex radius sides start Angle angle Extent end Angle - start Angle side Angle 2 0 * math pi / float sides sides math ceil abs angle Extent / side Angle side Angle angle Extent / float sides... | null | null | null | null | Question:
How does the code get the complex polygon ?
Code:
def getComplexPolygonByStartEnd(endAngle, radius, sides, startAngle=0.0):
if (endAngle == startAngle):
return getComplexPolygon(complex(), radius, sides, startAngle)
angleExtent = (endAngle - startAngle)
sideAngle = ((2.0 * math.pi) / float(sides))
s... |
null | null | null | When do the line number of the dict content increment ?
| def add_line_increment_for_dict(data, lineModified, diference, atLineStart=False):
def _inner_increment(line):
if (((not atLineStart) and (line <= lineModified)) or (lineModified == (line + diference))):
return line
newLine = (line + diference)
summary = data.pop(line)
data[newLine] = summary
return newLi... | null | null | null | when needed
| codeqa | def add line increment for dict data 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 linenew Line line + diference summary data pop line data[new Line] summaryreturn new Linelist map inner increment list data key... | null | null | null | null | Question:
When do the line number of the dict content increment ?
Code:
def add_line_increment_for_dict(data, lineModified, diference, atLineStart=False):
def _inner_increment(line):
if (((not atLineStart) and (line <= lineModified)) or (lineModified == (line + diference))):
return line
newLine = (line + di... |
null | null | null | For what purpose do attempts reset ?
| def submit_reset_problem_attempts_for_all_students(request, usage_key):
modulestore().get_item(usage_key)
task_type = 'reset_problem_attempts'
task_class = reset_problem_attempts
(task_input, task_key) = encode_problem_and_student_input(usage_key)
return submit_task(request, task_type, task_class, usage_key.course... | null | null | null | for a problem
| codeqa | def submit reset problem attempts for all students request usage key modulestore get item usage key task type 'reset problem attempts'task class reset problem attempts task input task key encode problem and student input usage key return submit task request task type task class usage key course key task input task key
| null | null | null | null | Question:
For what purpose do attempts reset ?
Code:
def submit_reset_problem_attempts_for_all_students(request, usage_key):
modulestore().get_item(usage_key)
task_type = 'reset_problem_attempts'
task_class = reset_problem_attempts
(task_input, task_key) = encode_problem_and_student_input(usage_key)
return sub... |
null | null | null | For what purpose does the code update the glance metadata ?
| def volume_glance_metadata_create(context, volume_id, key, value):
return IMPL.volume_glance_metadata_create(context, volume_id, key, value)
| null | null | null | for the specified volume
| codeqa | def volume glance metadata create context volume id key value return IMPL volume glance metadata create context volume id key value
| null | null | null | null | Question:
For what purpose does the code update the glance metadata ?
Code:
def volume_glance_metadata_create(context, volume_id, key, value):
return IMPL.volume_glance_metadata_create(context, volume_id, key, value)
|
null | null | null | What does the code update for the specified volume ?
| def volume_glance_metadata_create(context, volume_id, key, value):
return IMPL.volume_glance_metadata_create(context, volume_id, key, value)
| null | null | null | the glance metadata
| codeqa | def volume glance metadata create context volume id key value return IMPL volume glance metadata create context volume id key value
| null | null | null | null | Question:
What does the code update for the specified volume ?
Code:
def volume_glance_metadata_create(context, volume_id, key, value):
return IMPL.volume_glance_metadata_create(context, volume_id, key, value)
|
null | null | null | What does the code do ?
| def basicConfig(**kwargs):
_acquireLock()
try:
if (len(root.handlers) == 0):
filename = kwargs.get('filename')
if filename:
mode = kwargs.get('filemode', 'a')
hdlr = FileHandler(filename, mode)
else:
stream = kwargs.get('stream')
hdlr = StreamHandler(stream)
fs = kwargs.get('format', BAS... | null | null | null | basic configuration for the logging system
| codeqa | def basic Config **kwargs acquire Lock try if len root handlers 0 filename kwargs get 'filename' if filename mode kwargs get 'filemode' 'a' hdlr File Handler filename mode else stream kwargs get 'stream' hdlr Stream Handler stream fs kwargs get 'format' BASIC FORMAT dfs kwargs get 'datefmt' None fmt Formatter fs dfs hd... | null | null | null | null | Question:
What does the code do ?
Code:
def basicConfig(**kwargs):
_acquireLock()
try:
if (len(root.handlers) == 0):
filename = kwargs.get('filename')
if filename:
mode = kwargs.get('filemode', 'a')
hdlr = FileHandler(filename, mode)
else:
stream = kwargs.get('stream')
hdlr = StreamHand... |
null | null | null | What does the code handle ?
| def on_reply_save(sender, instance, **kwargs):
reply = instance
year = reply.created.year
user = reply.user
if (not user):
return
from kitsune.customercare.tasks import maybe_award_badge
maybe_award_badge.delay(AOA_BADGE, year, user)
| null | null | null | the reply save signal
| codeqa | def on reply save sender instance **kwargs reply instanceyear reply created yearuser reply userif not user returnfrom kitsune customercare tasks import maybe award badgemaybe award badge delay AOA BADGE year user
| null | null | null | null | Question:
What does the code handle ?
Code:
def on_reply_save(sender, instance, **kwargs):
reply = instance
year = reply.created.year
user = reply.user
if (not user):
return
from kitsune.customercare.tasks import maybe_award_badge
maybe_award_badge.delay(AOA_BADGE, year, user)
|
null | null | null | What does the code create ?
| def create_channel(client_id, duration_minutes=None):
client_id = _ValidateClientId(client_id)
if (not (duration_minutes is None)):
if (not isinstance(duration_minutes, (int, long))):
raise InvalidChannelTokenDurationError('Argument duration_minutes must be integral')
elif (duration_minutes < 1):
raise ... | null | null | null | a channel
| codeqa | def create channel client id duration minutes None client id Validate Client Id client id if not duration minutes is None if not isinstance duration minutes int long raise Invalid Channel Token Duration Error ' Argumentduration minutesmustbeintegral' elif duration minutes < 1 raise Invalid Channel Token Duration Error ... | null | null | null | null | Question:
What does the code create ?
Code:
def create_channel(client_id, duration_minutes=None):
client_id = _ValidateClientId(client_id)
if (not (duration_minutes is None)):
if (not isinstance(duration_minutes, (int, long))):
raise InvalidChannelTokenDurationError('Argument duration_minutes must be int... |
null | null | null | How does them return ?
| def get_instructions(xmltree):
instructions = xmltree.find('instructions')
if (instructions is not None):
instructions.tag = 'div'
xmltree.remove(instructions)
return etree.tostring(instructions, encoding='unicode')
return None
| null | null | null | as a string
| codeqa | def get instructions xmltree instructions xmltree find 'instructions' if instructions is not None instructions tag 'div'xmltree remove instructions return etree tostring instructions encoding 'unicode' return None
| null | null | null | null | Question:
How does them return ?
Code:
def get_instructions(xmltree):
instructions = xmltree.find('instructions')
if (instructions is not None):
instructions.tag = 'div'
xmltree.remove(instructions)
return etree.tostring(instructions, encoding='unicode')
return None
|
null | null | null | When does an aware convert ?
| def localtime(value=None, timezone=None):
if (value is None):
value = now()
if (timezone is None):
timezone = get_current_timezone()
if is_naive(value):
raise ValueError('localtime() cannot be applied to a naive datetime')
value = value.astimezone(timezone)
if hasattr(timezone, 'normalize'):
value =... | null | null | null | datetime
| codeqa | def localtime value None timezone None if value is None value now if timezone is None timezone get current timezone if is naive value raise Value Error 'localtime cannotbeappliedtoanaivedatetime' value value astimezone timezone if hasattr timezone 'normalize' value timezone normalize value return value
| null | null | null | null | Question:
When does an aware convert ?
Code:
def localtime(value=None, timezone=None):
if (value is None):
value = now()
if (timezone is None):
timezone = get_current_timezone()
if is_naive(value):
raise ValueError('localtime() cannot be applied to a naive datetime')
value = value.astimezone(timezo... |
null | null | null | What does the code start ?
| def start_map(name, handler_spec, reader_spec, mapper_parameters, shard_count=_DEFAULT_SHARD_COUNT, output_writer_spec=None, mapreduce_parameters=None, base_path=None, queue_name=None, eta=None, countdown=None, hooks_class_name=None, _app=None, transactional=False, transactional_parent=None):
if (not shard_count):
s... | null | null | null | a new
| codeqa | def start map name handler spec reader spec mapper parameters shard count DEFAULT SHARD COUNT output writer spec None mapreduce parameters None base path None queue name None eta None countdown None hooks class name None app None transactional False transactional parent None if not shard count shard count DEFAULT SHARD... | null | null | null | null | Question:
What does the code start ?
Code:
def start_map(name, handler_spec, reader_spec, mapper_parameters, shard_count=_DEFAULT_SHARD_COUNT, output_writer_spec=None, mapreduce_parameters=None, base_path=None, queue_name=None, eta=None, countdown=None, hooks_class_name=None, _app=None, transactional=False, transac... |
null | null | null | What does the code retrieve by name ?
| def get_role(keystone, name):
roles = [x for x in keystone.roles.list() if (x.name == name)]
count = len(roles)
if (count == 0):
raise KeyError(('No keystone roles with name %s' % name))
elif (count > 1):
raise ValueError(('%d roles with name %s' % (count, name)))
else:
return roles[0]
| null | null | null | a role
| codeqa | def get role keystone name roles [x for x in keystone roles list if x name name ]count len roles if count 0 raise Key Error ' Nokeystoneroleswithname%s' % name elif count > 1 raise Value Error '%droleswithname%s' % count name else return roles[ 0 ]
| null | null | null | null | Question:
What does the code retrieve by name ?
Code:
def get_role(keystone, name):
roles = [x for x in keystone.roles.list() if (x.name == name)]
count = len(roles)
if (count == 0):
raise KeyError(('No keystone roles with name %s' % name))
elif (count > 1):
raise ValueError(('%d roles with name %s... |
null | null | null | How does the code retrieve a role ?
| def get_role(keystone, name):
roles = [x for x in keystone.roles.list() if (x.name == name)]
count = len(roles)
if (count == 0):
raise KeyError(('No keystone roles with name %s' % name))
elif (count > 1):
raise ValueError(('%d roles with name %s' % (count, name)))
else:
return roles[0]
| null | null | null | by name
| codeqa | def get role keystone name roles [x for x in keystone roles list if x name name ]count len roles if count 0 raise Key Error ' Nokeystoneroleswithname%s' % name elif count > 1 raise Value Error '%droleswithname%s' % count name else return roles[ 0 ]
| null | null | null | null | Question:
How does the code retrieve a role ?
Code:
def get_role(keystone, name):
roles = [x for x in keystone.roles.list() if (x.name == name)]
count = len(roles)
if (count == 0):
raise KeyError(('No keystone roles with name %s' % name))
elif (count > 1):
raise ValueError(('%d roles with name %s' ... |
null | null | null | For what purpose do buffer cache drop ?
| def drop_buffer_cache(fd, offset, length):
global _posix_fadvise
if (_posix_fadvise is None):
_posix_fadvise = load_libc_function('posix_fadvise64')
ret = _posix_fadvise(fd, ctypes.c_uint64(offset), ctypes.c_uint64(length), 4)
if (ret != 0):
logging.warning('posix_fadvise64(%(fd)s, %(offset)s, %(length)s, 4)... | null | null | null | for the given range of the given file
| codeqa | def drop buffer cache fd offset length global posix fadviseif posix fadvise is None posix fadvise load libc function 'posix fadvise 64 ' ret posix fadvise fd ctypes c uint 64 offset ctypes c uint 64 length 4 if ret 0 logging warning 'posix fadvise 64 % fd s % offset s % length s 4 ->% ret s' {'fd' fd 'offset' offset 'l... | null | null | null | null | Question:
For what purpose do buffer cache drop ?
Code:
def drop_buffer_cache(fd, offset, length):
global _posix_fadvise
if (_posix_fadvise is None):
_posix_fadvise = load_libc_function('posix_fadvise64')
ret = _posix_fadvise(fd, ctypes.c_uint64(offset), ctypes.c_uint64(length), 4)
if (ret != 0):
logging.wa... |
null | null | null | What does the code remove ?
| def remove(theme_name, v=False):
theme_name = theme_name.replace(u'/', u'')
target = os.path.join(_THEMES_PATH, theme_name)
if (theme_name in _BUILTIN_THEMES):
err((theme_name + u' is a builtin theme.\nYou cannot remove a builtin theme with this script, remove it by hand if you want.'))
elif os... | null | null | null | a theme
| codeqa | def remove theme name v False theme name theme name replace u'/' u'' target os path join THEMES PATH theme name if theme name in BUILTIN THEMES err theme name + u'isabuiltintheme \n Youcannotremoveabuiltinthemewiththisscript removeitbyhandifyouwant ' elif os path islink target if v print u' Removinglink`' + target + u"... | null | null | null | null | Question:
What does the code remove ?
Code:
def remove(theme_name, v=False):
theme_name = theme_name.replace(u'/', u'')
target = os.path.join(_THEMES_PATH, theme_name)
if (theme_name in _BUILTIN_THEMES):
err((theme_name + u' is a builtin theme.\nYou cannot remove a builtin theme with this script, ... |
null | null | null | What does the code remove ?
| def uninstall(packages, options=None):
manager = MANAGER
if (options is None):
options = []
elif isinstance(options, str):
options = [options]
if (not isinstance(packages, basestring)):
packages = ' '.join(packages)
options = ' '.join(options)
run_as_root(('%(manager)s %(options)s remove %(packages)s' ... | null | null | null | one or more packages
| codeqa | def uninstall packages options None manager MANAGE Rif options is None options []elif isinstance options str options [options]if not isinstance packages basestring packages '' join packages options '' join options run as root '% manager s% options sremove% packages s' % locals
| null | null | null | null | Question:
What does the code remove ?
Code:
def uninstall(packages, options=None):
manager = MANAGER
if (options is None):
options = []
elif isinstance(options, str):
options = [options]
if (not isinstance(packages, basestring)):
packages = ' '.join(packages)
options = ' '.join(options)
run_as_root(('... |
null | null | null | What does the code remove ?
| def remove(app_id):
cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "DELETE from access where client=\'{0}\'"'.format(app_id)
call = __salt__['cmd.run_all'](cmd, output_loglevel='debug', python_shell=False)
if (call['retcode'] != 0):
comment = ''
if ('stderr' in call):
comment += cal... | null | null | null | a bundle i d or command
| codeqa | def remove app id cmd 'sqlite 3 "/ Library/ Application Support/com apple TCC/TCC db""DELET Efromaccesswhereclient \'{ 0 }\'"' format app id call salt ['cmd run all'] cmd output loglevel 'debug' python shell False if call['retcode'] 0 comment ''if 'stderr' in call comment + call['stderr']if 'stdout' in call comment + c... | null | null | null | null | Question:
What does the code remove ?
Code:
def remove(app_id):
cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "DELETE from access where client=\'{0}\'"'.format(app_id)
call = __salt__['cmd.run_all'](cmd, output_loglevel='debug', python_shell=False)
if (call['retcode'] != 0):
comment... |
null | null | null | What does the code add ?
| def add_type(type, ext, strict=True):
init()
return add_type(type, ext, strict)
| null | null | null | a mapping between a type and an extension
| codeqa | def add type type ext strict True init return add type type ext strict
| null | null | null | null | Question:
What does the code add ?
Code:
def add_type(type, ext, strict=True):
init()
return add_type(type, ext, strict)
|
null | null | null | In which direction does the code send insert ?
| @when(u'we insert into table')
def step_insert_into_table(context):
context.cli.sendline(u"insert into a(x) values('xxx');")
| null | null | null | into table
| codeqa | @when u'weinsertintotable' def step insert into table context context cli sendline u"insertintoa x values 'xxx' "
| null | null | null | null | Question:
In which direction does the code send insert ?
Code:
@when(u'we insert into table')
def step_insert_into_table(context):
context.cli.sendline(u"insert into a(x) values('xxx');")
|
null | null | null | How do two caller lists combine ?
| def add_callers(target, source):
new_callers = {}
for (func, caller) in target.iteritems():
new_callers[func] = caller
for (func, caller) in source.iteritems():
if (func in new_callers):
new_callers[func] = tuple([(i[0] + i[1]) for i in zip(caller, new_callers[func])])
else:
new_callers[func] = caller
r... | null | null | null | in a single list
| codeqa | def add callers target source new callers {}for func caller in target iteritems new callers[func] callerfor func caller in source iteritems if func in new callers new callers[func] tuple [ i[ 0 ] + i[ 1 ] for i in zip caller new callers[func] ] else new callers[func] callerreturn new callers
| null | null | null | null | Question:
How do two caller lists combine ?
Code:
def add_callers(target, source):
new_callers = {}
for (func, caller) in target.iteritems():
new_callers[func] = caller
for (func, caller) in source.iteritems():
if (func in new_callers):
new_callers[func] = tuple([(i[0] + i[1]) for i in zip(caller, new_cal... |
null | null | null | How does of a regression result ?
| def cov_cluster_2groups(results, group, group2=None, use_correction=True):
if (group2 is None):
if ((group.ndim != 2) or (group.shape[1] != 2)):
raise ValueError(('if group2 is not given, then groups needs to be ' + 'an array with two columns'))
group0 = group[:, 0]
group1 = group[:, 1]
else:
... | null | null | null | instance
| codeqa | def cov cluster 2groups results group group 2 None use correction True if group 2 is None if group ndim 2 or group shape[ 1 ] 2 raise Value Error 'ifgroup 2 isnotgiven thengroupsneedstobe' + 'anarraywithtwocolumns' group 0 group[ 0]group 1 group[ 1]else group 0 groupgroup 1 group 2 group group 0 group 1 cov 0 cov clust... | null | null | null | null | Question:
How does of a regression result ?
Code:
def cov_cluster_2groups(results, group, group2=None, use_correction=True):
if (group2 is None):
if ((group.ndim != 2) or (group.shape[1] != 2)):
raise ValueError(('if group2 is not given, then groups needs to be ' + 'an array with two columns'))
... |
null | null | null | What does the code remove ?
| def uninstall(packages, options=None):
manager = MANAGER
options = (options or [])
options = ' '.join(options)
if (not isinstance(packages, basestring)):
packages = ' '.join(packages)
cmd = ('%(manager)s --unmerge %(options)s %(packages)s' % locals())
run_as_root(cmd, pty=False)
| null | null | null | one or more portage packages
| codeqa | def uninstall packages options None manager MANAGE Roptions options or [] options '' join options if not isinstance packages basestring packages '' join packages cmd '% manager s--unmerge% options s% packages s' % locals run as root cmd pty False
| null | null | null | null | Question:
What does the code remove ?
Code:
def uninstall(packages, options=None):
manager = MANAGER
options = (options or [])
options = ' '.join(options)
if (not isinstance(packages, basestring)):
packages = ' '.join(packages)
cmd = ('%(manager)s --unmerge %(options)s %(packages)s' % locals())
run_as_... |
null | null | null | When does the code add to ?
| def append_gentoo_mirrors(value):
return append_var('GENTOO_MIRRORS', value)
| null | null | null | in the make
| codeqa | def append gentoo mirrors value return append var 'GENTOO MIRRORS' value
| null | null | null | null | Question:
When does the code add to ?
Code:
def append_gentoo_mirrors(value):
return append_var('GENTOO_MIRRORS', value)
|
null | null | null | When are the values of the array are positive ?
| def semilinear(x):
try:
shape = x.shape
x.flatten()
x = x.tolist()
except AttributeError:
shape = (1, len(x))
def f(val):
if (val < 0):
return safeExp(val)
else:
return (val + 1.0)
return array(list(map(f, x))).reshape(shape)
| null | null | null | always
| codeqa | def semilinear x try shape x shapex flatten x x tolist except Attribute Error shape 1 len x def f val if val < 0 return safe Exp val else return val + 1 0 return array list map f x reshape shape
| null | null | null | null | Question:
When are the values of the array are positive ?
Code:
def semilinear(x):
try:
shape = x.shape
x.flatten()
x = x.tolist()
except AttributeError:
shape = (1, len(x))
def f(val):
if (val < 0):
return safeExp(val)
else:
return (val + 1.0)
return array(list(map(f, x))).reshape(shape)
|
null | null | null | What does this function ensure ?
| def semilinear(x):
try:
shape = x.shape
x.flatten()
x = x.tolist()
except AttributeError:
shape = (1, len(x))
def f(val):
if (val < 0):
return safeExp(val)
else:
return (val + 1.0)
return array(list(map(f, x))).reshape(shape)
| null | null | null | that the values of the array are always positive
| codeqa | def semilinear x try shape x shapex flatten x x tolist except Attribute Error shape 1 len x def f val if val < 0 return safe Exp val else return val + 1 0 return array list map f x reshape shape
| null | null | null | null | Question:
What does this function ensure ?
Code:
def semilinear(x):
try:
shape = x.shape
x.flatten()
x = x.tolist()
except AttributeError:
shape = (1, len(x))
def f(val):
if (val < 0):
return safeExp(val)
else:
return (val + 1.0)
return array(list(map(f, x))).reshape(shape)
|
null | null | null | What did the code split into separate lists ?
| def split_by_position(linked_promotions, context):
for linked_promotion in linked_promotions:
promotion = linked_promotion.content_object
if (not promotion):
continue
key = ('promotions_%s' % linked_promotion.position.lower())
if (key not in context):
context[key] = []
context[key].append(promotion)
| null | null | null | the list of promotions
| codeqa | def split by position linked promotions context for linked promotion in linked promotions promotion linked promotion content objectif not promotion continuekey 'promotions %s' % linked promotion position lower if key not in context context[key] []context[key] append promotion
| null | null | null | null | Question:
What did the code split into separate lists ?
Code:
def split_by_position(linked_promotions, context):
for linked_promotion in linked_promotions:
promotion = linked_promotion.content_object
if (not promotion):
continue
key = ('promotions_%s' % linked_promotion.position.lower())
if (key not in ... |
null | null | null | What does the code add to a dict of installed packages ?
| def add_pkg(pkgs, name, pkgver):
try:
pkgs.setdefault(name, []).append(pkgver)
except AttributeError as exc:
log.exception(exc)
| null | null | null | a package
| codeqa | def add pkg pkgs name pkgver try pkgs setdefault name [] append pkgver except Attribute Error as exc log exception exc
| null | null | null | null | Question:
What does the code add to a dict of installed packages ?
Code:
def add_pkg(pkgs, name, pkgver):
try:
pkgs.setdefault(name, []).append(pkgver)
except AttributeError as exc:
log.exception(exc)
|
null | null | null | By how much do arrays overlap ?
| def test_slices_partial_overlap():
temp = overlap_slices((5,), (3,), (0,))
assert (temp == ((slice(0, 2, None),), (slice(1, 3, None),)))
temp = overlap_slices((5,), (3,), (0,), mode=u'partial')
assert (temp == ((slice(0, 2, None),), (slice(1, 3, None),)))
for pos in [0, 4]:
with pytest.raises(PartialOverlapError... | null | null | null | partially
| codeqa | def test slices partial overlap temp overlap slices 5 3 0 assert temp slice 0 2 None slice 1 3 None temp overlap slices 5 3 0 mode u'partial' assert temp slice 0 2 None slice 1 3 None for pos in [0 4] with pytest raises Partial Overlap Error as e temp overlap slices 5 3 pos mode u'strict' assert u' Arraysoverlaponlypar... | null | null | null | null | Question:
By how much do arrays overlap ?
Code:
def test_slices_partial_overlap():
temp = overlap_slices((5,), (3,), (0,))
assert (temp == ((slice(0, 2, None),), (slice(1, 3, None),)))
temp = overlap_slices((5,), (3,), (0,), mode=u'partial')
assert (temp == ((slice(0, 2, None),), (slice(1, 3, None),)))
for pos... |
null | null | null | What does the code return ?
| def status(name, sig=None):
if sig:
return bool(__salt__['status.pid'](sig))
cmd = ['service', name, 'status']
if _service_is_upstart(name):
return ('start/running' in __salt__['cmd.run'](cmd, python_shell=False, ignore_retcode=True))
return (not bool(__salt__['cmd.retcode'](cmd, python_shell=False, quite=True)... | null | null | null | the status for a service
| codeqa | def status name sig None if sig return bool salt ['status pid'] sig cmd ['service' name 'status']if service is upstart name return 'start/running' in salt ['cmd run'] cmd python shell False ignore retcode True return not bool salt ['cmd retcode'] cmd python shell False quite True
| null | null | null | null | Question:
What does the code return ?
Code:
def status(name, sig=None):
if sig:
return bool(__salt__['status.pid'](sig))
cmd = ['service', name, 'status']
if _service_is_upstart(name):
return ('start/running' in __salt__['cmd.run'](cmd, python_shell=False, ignore_retcode=True))
return (not bool(__salt__['cm... |
null | null | null | What does the code run ?
| @bdd.given(bdd.parsers.parse('I run {command}'))
def run_command_given(quteproc, command):
quteproc.send_cmd(command)
| null | null | null | a qutebrowser command
| codeqa | @bdd given bdd parsers parse ' Irun{command}' def run command given quteproc command quteproc send cmd command
| null | null | null | null | Question:
What does the code run ?
Code:
@bdd.given(bdd.parsers.parse('I run {command}'))
def run_command_given(quteproc, command):
quteproc.send_cmd(command)
|
null | null | null | For what purpose does the code add headers to a response ?
| def add_never_cache_headers(response):
patch_response_headers(response, cache_timeout=(-1))
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
| null | null | null | to indicate that a page should never be cached
| codeqa | def add never cache headers response patch response headers response cache timeout -1 patch cache control response no cache True no store True must revalidate True
| null | null | null | null | Question:
For what purpose does the code add headers to a response ?
Code:
def add_never_cache_headers(response):
patch_response_headers(response, cache_timeout=(-1))
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
|
null | null | null | What does the code add to a response to indicate that a page should never be cached ?
| def add_never_cache_headers(response):
patch_response_headers(response, cache_timeout=(-1))
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
| null | null | null | headers
| codeqa | def add never cache headers response patch response headers response cache timeout -1 patch cache control response no cache True no store True must revalidate True
| null | null | null | null | Question:
What does the code add to a response to indicate that a page should never be cached ?
Code:
def add_never_cache_headers(response):
patch_response_headers(response, cache_timeout=(-1))
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
|
null | null | null | What does the code create ?
| def _get_output_filename(dataset_dir, split_name):
return ('%s/mnist_%s.tfrecord' % (dataset_dir, split_name))
| null | null | null | the output filename
| codeqa | def get output filename dataset dir split name return '%s/mnist %s tfrecord' % dataset dir split name
| null | null | null | null | Question:
What does the code create ?
Code:
def _get_output_filename(dataset_dir, split_name):
return ('%s/mnist_%s.tfrecord' % (dataset_dir, split_name))
|
null | null | null | What does the code get ?
| def get_group_members(group_name, region=None, key=None, keyid=None, profile=None):
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
marker = None
truncated = True
users = []
while truncated:
info = conn.get_group(group_name, marker=marker, max_items=1000)
if (not info):
r... | null | null | null | group information
| codeqa | def get group members group name region None key None keyid None profile None conn get conn region region key key keyid keyid profile profile try marker Nonetruncated Trueusers []while truncated info conn get group group name marker marker max items 1000 if not info return Falsetruncated bool info['get group response']... | null | null | null | null | Question:
What does the code get ?
Code:
def get_group_members(group_name, region=None, key=None, keyid=None, profile=None):
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
marker = None
truncated = True
users = []
while truncated:
info = conn.get_group(group_name, marker=ma... |
null | null | null | Where do the highest index return ?
| def rfind(s, *args):
return s.rfind(*args)
| null | null | null | in s where substring sub is found
| codeqa | def rfind s *args return s rfind *args
| null | null | null | null | Question:
Where do the highest index return ?
Code:
def rfind(s, *args):
return s.rfind(*args)
|
null | null | null | Where is substring sub found ?
| def rfind(s, *args):
return s.rfind(*args)
| null | null | null | in s
| codeqa | def rfind s *args return s rfind *args
| null | null | null | null | Question:
Where is substring sub found ?
Code:
def rfind(s, *args):
return s.rfind(*args)
|
null | null | null | What is found in s ?
| def rfind(s, *args):
return s.rfind(*args)
| null | null | null | substring sub
| codeqa | def rfind s *args return s rfind *args
| null | null | null | null | Question:
What is found in s ?
Code:
def rfind(s, *args):
return s.rfind(*args)
|
null | null | null | What returns in s where substring sub is found ?
| def rfind(s, *args):
return s.rfind(*args)
| null | null | null | the highest index
| codeqa | def rfind s *args return s rfind *args
| null | null | null | null | Question:
What returns in s where substring sub is found ?
Code:
def rfind(s, *args):
return s.rfind(*args)
|
null | null | null | What does the code find ?
| def find_difference(string1, string2):
assert ((len(string1) + 1) == len(string2))
char_array = list(string2)
for char in string1:
ind = char_array.index(char)
char_array.pop(ind)
return char_array[0]
| null | null | null | the differing character between strings
| codeqa | def find difference string 1 string 2 assert len string 1 + 1 len string 2 char array list string 2 for char in string 1 ind char array index char char array pop ind return char array[ 0 ]
| null | null | null | null | Question:
What does the code find ?
Code:
def find_difference(string1, string2):
assert ((len(string1) + 1) == len(string2))
char_array = list(string2)
for char in string1:
ind = char_array.index(char)
char_array.pop(ind)
return char_array[0]
|
null | null | null | What does the code verify ?
| def verify(cert, signature, data, digest):
data = _text_to_bytes_and_warn('data', data)
digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest))
if (digest_obj == _ffi.NULL):
raise ValueError('No such digest method')
pkey = _lib.X509_get_pubkey(cert._x509)
if (pkey == _ffi.NULL):
_raise_current_error()
... | null | null | null | a signature
| codeqa | def verify cert signature data digest data text to bytes and warn 'data' data digest obj lib EVP get digestbyname byte string digest if digest obj ffi NULL raise Value Error ' Nosuchdigestmethod' pkey lib X509 get pubkey cert x509 if pkey ffi NULL raise current error pkey ffi gc pkey lib EVP PKEY free md ctx ffi new 'E... | null | null | null | null | Question:
What does the code verify ?
Code:
def verify(cert, signature, data, digest):
data = _text_to_bytes_and_warn('data', data)
digest_obj = _lib.EVP_get_digestbyname(_byte_string(digest))
if (digest_obj == _ffi.NULL):
raise ValueError('No such digest method')
pkey = _lib.X509_get_pubkey(cert._x509)
i... |
null | null | null | The code testing equivalent of which organization ?
| def gen_test(func=None, timeout=None):
if (timeout is None):
timeout = get_async_test_timeout()
def wrap(f):
f = gen.coroutine(f)
@functools.wraps(f)
def wrapper(self):
return self.io_loop.run_sync(functools.partial(f, self), timeout=timeout)
return wrapper
if (func is not None):
return wrap(func)
el... | null | null | null | @gen
| codeqa | def gen test func None timeout None if timeout is None timeout get async test timeout def wrap f f gen coroutine f @functools wraps f def wrapper self return self io loop run sync functools partial f self timeout timeout return wrapperif func is not None return wrap func else return wrap
| null | null | null | null | Question:
The code testing equivalent of which organization ?
Code:
def gen_test(func=None, timeout=None):
if (timeout is None):
timeout = get_async_test_timeout()
def wrap(f):
f = gen.coroutine(f)
@functools.wraps(f)
def wrapper(self):
return self.io_loop.run_sync(functools.partial(f, self), timeout=t... |
null | null | null | When did header modify ?
| def lastmodified(date_obj):
web.header('Last-Modified', net.httpdate(date_obj))
| null | null | null | last
| codeqa | def lastmodified date obj web header ' Last- Modified' net httpdate date obj
| null | null | null | null | Question:
When did header modify ?
Code:
def lastmodified(date_obj):
web.header('Last-Modified', net.httpdate(date_obj))
|
null | null | null | How do the temporary directory path join ?
| @pytest.fixture()
def p(tmpdir, *args):
return partial(os.path.join, tmpdir)
| null | null | null | with the provided arguments
| codeqa | @pytest fixture def p tmpdir *args return partial os path join tmpdir
| null | null | null | null | Question:
How do the temporary directory path join ?
Code:
@pytest.fixture()
def p(tmpdir, *args):
return partial(os.path.join, tmpdir)
|
null | null | null | What did the code set for programmatic use with file - like i / o ?
| def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=False):
... | null | null | null | a publisher
| codeqa | def publish file source None source path None destination None destination path None reader None reader name 'standalone' parser None parser name 'restructuredtext' writer None writer name 'pseudoxml' settings None settings spec None settings overrides None config section None enable exit status False output pub publis... | null | null | null | null | Question:
What did the code set for programmatic use with file - like i / o ?
Code:
def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settin... |
null | null | null | For what purpose did the code run a publisher ?
| def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=False):
... | null | null | null | for programmatic use with file - like i / o
| codeqa | def publish file source None source path None destination None destination path None reader None reader name 'standalone' parser None parser name 'restructuredtext' writer None writer name 'pseudoxml' settings None settings spec None settings overrides None config section None enable exit status False output pub publis... | null | null | null | null | Question:
For what purpose did the code run a publisher ?
Code:
def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settin... |
null | null | null | For what purpose did the code set a publisher ?
| def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=False):
... | null | null | null | for programmatic use with file - like i / o
| codeqa | def publish file source None source path None destination None destination path None reader None reader name 'standalone' parser None parser name 'restructuredtext' writer None writer name 'pseudoxml' settings None settings spec None settings overrides None config section None enable exit status False output pub publis... | null | null | null | null | Question:
For what purpose did the code set a publisher ?
Code:
def publish_file(source=None, source_path=None, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settin... |
null | null | null | How do f * * mod x**n compute ?
| def dmp_revert(f, g, u, K):
if (not u):
return dup_revert(f, g, K)
else:
raise MultivariatePolynomialError(f, g)
| null | null | null | using newton iteration
| codeqa | def dmp revert f g u K if not u return dup revert f g K else raise Multivariate Polynomial Error f g
| null | null | null | null | Question:
How do f * * mod x**n compute ?
Code:
def dmp_revert(f, g, u, K):
if (not u):
return dup_revert(f, g, K)
else:
raise MultivariatePolynomialError(f, g)
|
null | null | null | What does the code get from the table ?
| def virtual_interface_get_all(context):
return IMPL.virtual_interface_get_all(context)
| null | null | null | all virtual interfaces
| codeqa | def virtual interface get all context return IMPL virtual interface get all context
| null | null | null | null | Question:
What does the code get from the table ?
Code:
def virtual_interface_get_all(context):
return IMPL.virtual_interface_get_all(context)
|
null | null | null | How do a file or directory move to another location ?
| def move(src, dst):
real_dst = dst
if os.path.isdir(dst):
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error, ("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
except OSError:
if os.path.isdir(src):
if _destinsrc(src, dst):
rai... | null | null | null | recursively
| codeqa | def move src dst real dst dstif os path isdir dst real dst os path join dst basename src if os path exists real dst raise Error " Destinationpath'%s'alreadyexists" % real dst try os rename src real dst except OS Error if os path isdir src if destinsrc src dst raise Error " Cannotmoveadirectory'%s'intoitself'%s' " % src... | null | null | null | null | Question:
How do a file or directory move to another location ?
Code:
def move(src, dst):
real_dst = dst
if os.path.isdir(dst):
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error, ("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
ex... |
null | null | null | What does the code take ?
| def shuffle(seq):
seed()
for i in reversed(range(len(seq))):
j = randint(0, i)
(seq[i], seq[j]) = (seq[j], seq[i])
return seq
| null | null | null | a list of integers
| codeqa | def shuffle seq seed for i in reversed range len seq j randint 0 i seq[i] seq[j] seq[j] seq[i] return seq
| null | null | null | null | Question:
What does the code take ?
Code:
def shuffle(seq):
seed()
for i in reversed(range(len(seq))):
j = randint(0, i)
(seq[i], seq[j]) = (seq[j], seq[i])
return seq
|
null | null | null | What does the code generate ?
| def _generateModel0(numCategories):
initProb = numpy.zeros(numCategories)
initProb[0] = 0.5
initProb[4] = 0.5
firstOrder = dict()
for catIdx in range(numCategories):
key = str([catIdx])
probs = (numpy.ones(numCategories) / numCategories)
if ((catIdx == 0) or (catIdx == 4)):
probs.fill(0)
probs[1] = 1.0... | null | null | null | the initial
| codeqa | def generate Model 0 num Categories init Prob numpy zeros num Categories init Prob[ 0 ] 0 5init Prob[ 4 ] 0 5first Order dict for cat Idx in range num Categories key str [cat Idx] probs numpy ones num Categories / num Categories if cat Idx 0 or cat Idx 4 probs fill 0 probs[ 1 ] 1 0first Order[key] probssecond Order dic... | null | null | null | null | Question:
What does the code generate ?
Code:
def _generateModel0(numCategories):
initProb = numpy.zeros(numCategories)
initProb[0] = 0.5
initProb[4] = 0.5
firstOrder = dict()
for catIdx in range(numCategories):
key = str([catIdx])
probs = (numpy.ones(numCategories) / numCategories)
if ((catIdx == 0) or ... |
null | null | null | How does the code regroup a list of alike objects ?
| @register.tag
def regroup(parser, token):
firstbits = token.contents.split(None, 3)
if (len(firstbits) != 4):
raise TemplateSyntaxError("'regroup' tag takes five arguments")
target = parser.compile_filter(firstbits[1])
if (firstbits[2] != 'by'):
raise TemplateSyntaxError("second argument to 'regroup' ta... | null | null | null | by a common attribute
| codeqa | @register tagdef regroup parser token firstbits token contents split None 3 if len firstbits 4 raise Template Syntax Error "'regroup'tagtakesfivearguments" target parser compile filter firstbits[ 1 ] if firstbits[ 2 ] 'by' raise Template Syntax Error "secondargumentto'regroup'tagmustbe'by'" lastbits reversed firstbits[... | null | null | null | null | Question:
How does the code regroup a list of alike objects ?
Code:
@register.tag
def regroup(parser, token):
firstbits = token.contents.split(None, 3)
if (len(firstbits) != 4):
raise TemplateSyntaxError("'regroup' tag takes five arguments")
target = parser.compile_filter(firstbits[1])
if (firstbits[2] !=... |
null | null | null | What does the code regroup by a common attribute ?
| @register.tag
def regroup(parser, token):
firstbits = token.contents.split(None, 3)
if (len(firstbits) != 4):
raise TemplateSyntaxError("'regroup' tag takes five arguments")
target = parser.compile_filter(firstbits[1])
if (firstbits[2] != 'by'):
raise TemplateSyntaxError("second argument to 'regroup' ta... | null | null | null | a list of alike objects
| codeqa | @register tagdef regroup parser token firstbits token contents split None 3 if len firstbits 4 raise Template Syntax Error "'regroup'tagtakesfivearguments" target parser compile filter firstbits[ 1 ] if firstbits[ 2 ] 'by' raise Template Syntax Error "secondargumentto'regroup'tagmustbe'by'" lastbits reversed firstbits[... | null | null | null | null | Question:
What does the code regroup by a common attribute ?
Code:
@register.tag
def regroup(parser, token):
firstbits = token.contents.split(None, 3)
if (len(firstbits) != 4):
raise TemplateSyntaxError("'regroup' tag takes five arguments")
target = parser.compile_filter(firstbits[1])
if (firstbits[2] != ... |
null | null | null | What does the code assert ?
| def startswith_(a, fragment, msg=None):
assert a.startswith(fragment), (msg or ('%r does not start with %r' % (a, fragment)))
| null | null | null | a
| codeqa | def startswith a fragment msg None assert a startswith fragment msg or '%rdoesnotstartwith%r' % a fragment
| null | null | null | null | Question:
What does the code assert ?
Code:
def startswith_(a, fragment, msg=None):
assert a.startswith(fragment), (msg or ('%r does not start with %r' % (a, fragment)))
|
null | null | null | What does the code add ?
| def addPathIndexSecondSegment(gridPixel, pathIndexTable, pixelTable, segmentSecondPixel):
for yStep in xrange(gridPixel[1], (segmentSecondPixel[1] + 1)):
if getKeyIsInPixelTableAddValue((gridPixel[0], yStep), pathIndexTable, pixelTable):
return
| null | null | null | the path index of the closest segment found toward the second segment
| codeqa | def add Path Index Second Segment grid Pixel path Index Table pixel Table segment Second Pixel for y Step in xrange grid Pixel[ 1 ] segment Second Pixel[ 1 ] + 1 if get Key Is In Pixel Table Add Value grid Pixel[ 0 ] y Step path Index Table pixel Table return
| null | null | null | null | Question:
What does the code add ?
Code:
def addPathIndexSecondSegment(gridPixel, pathIndexTable, pixelTable, segmentSecondPixel):
for yStep in xrange(gridPixel[1], (segmentSecondPixel[1] + 1)):
if getKeyIsInPixelTableAddValue((gridPixel[0], yStep), pathIndexTable, pixelTable):
return
|
null | null | null | What is existing in graph_reference ?
| def attribute_path_to_object_names(attribute_container_path):
object_names = ['figure']
if ('layout' in attribute_container_path):
for path_part in attribute_container_path:
if (path_part in OBJECTS):
object_names.append(path_part)
if (path_part in ARRAYS):
object_names.append(path_part)
object_na... | null | null | null | a path
| codeqa | def attribute path to object names attribute container path object names ['figure']if 'layout' in attribute container path for path part in attribute container path if path part in OBJECTS object names append path part if path part in ARRAYS object names append path part object names append path part[ -1 ] elif 'layout... | null | null | null | null | Question:
What is existing in graph_reference ?
Code:
def attribute_path_to_object_names(attribute_container_path):
object_names = ['figure']
if ('layout' in attribute_container_path):
for path_part in attribute_container_path:
if (path_part in OBJECTS):
object_names.append(path_part)
if (path_part in... |
null | null | null | What does the code execute ?
| def _exec_template(callable_, context, args=None, kwargs=None):
template = context._with_template
if ((template is not None) and (template.format_exceptions or template.error_handler)):
error = None
try:
callable_(context, *args, **kwargs)
except Exception as e:
_render_error(template, context, e)
excep... | null | null | null | a rendering callable given the callable
| codeqa | def exec template callable context args None kwargs None template context with templateif template is not None and template format exceptions or template error handler error Nonetry callable context *args **kwargs except Exception as e render error template context e except e sys exc info [0 ] render error template con... | null | null | null | null | Question:
What does the code execute ?
Code:
def _exec_template(callable_, context, args=None, kwargs=None):
template = context._with_template
if ((template is not None) and (template.format_exceptions or template.error_handler)):
error = None
try:
callable_(context, *args, **kwargs)
except Exception as ... |
null | null | null | What does the code extract from a want line ?
| def extract_want_line_capabilities(text):
split_text = text.rstrip().split(' ')
if (len(split_text) < 3):
return (text, [])
return (' '.join(split_text[:2]), split_text[2:])
| null | null | null | a capabilities list
| codeqa | def extract want line capabilities text split text text rstrip split '' if len split text < 3 return text [] return '' join split text[ 2] split text[ 2 ]
| null | null | null | null | Question:
What does the code extract from a want line ?
Code:
def extract_want_line_capabilities(text):
split_text = text.rstrip().split(' ')
if (len(split_text) < 3):
return (text, [])
return (' '.join(split_text[:2]), split_text[2:])
|
null | null | null | What does the code create ?
| def new_figure_manager_given_figure(num, figure):
canvas = FigureCanvasCairo(figure)
manager = FigureManagerBase(canvas, num)
return manager
| null | null | null | a new figure manager instance for the given figure
| codeqa | def new figure manager given figure num figure canvas Figure Canvas Cairo figure manager Figure Manager Base canvas num return manager
| null | null | null | null | Question:
What does the code create ?
Code:
def new_figure_manager_given_figure(num, figure):
canvas = FigureCanvasCairo(figure)
manager = FigureManagerBase(canvas, num)
return manager
|
null | null | null | What does the code remove from connections ?
| def _removeReceiver(receiver):
if (not sendersBack):
return False
backKey = id(receiver)
for senderkey in sendersBack.get(backKey, ()):
try:
signals = connections[senderkey].keys()
except KeyError as err:
pass
else:
for signal in signals:
try:
receivers = connections[senderkey][signal]
... | null | null | null | receiver
| codeqa | def remove Receiver receiver if not senders Back return Falseback Key id receiver for senderkey in senders Back get back Key try signals connections[senderkey] keys except Key Error as err passelse for signal in signals try receivers connections[senderkey][signal]except Key Error passelse try receivers remove receiver ... | null | null | null | null | Question:
What does the code remove from connections ?
Code:
def _removeReceiver(receiver):
if (not sendersBack):
return False
backKey = id(receiver)
for senderkey in sendersBack.get(backKey, ()):
try:
signals = connections[senderkey].keys()
except KeyError as err:
pass
else:
for signal in signa... |
null | null | null | What does the code draw ?
| def draw_box(point1, point2, color=colors.lightgreen, border=None, colour=None, **kwargs):
(x1, y1) = point1
(x2, y2) = point2
if (colour is not None):
color = colour
del colour
(strokecolor, color) = _stroke_and_fill_colors(color, border)
(x1, y1, x2, y2) = (min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2))... | null | null | null | a box
| codeqa | def draw box point 1 point 2 color colors lightgreen border None colour None **kwargs x1 y1 point 1 x2 y2 point 2 if colour is not None color colourdel colour strokecolor color stroke and fill colors color border x1 y1 x2 y2 min x1 x2 min y1 y2 max x1 x2 max y1 y2 return Polygon [x 1 y1 x2 y1 x2 y2 x1 y2 ] stroke Color... | null | null | null | null | Question:
What does the code draw ?
Code:
def draw_box(point1, point2, color=colors.lightgreen, border=None, colour=None, **kwargs):
(x1, y1) = point1
(x2, y2) = point2
if (colour is not None):
color = colour
del colour
(strokecolor, color) = _stroke_and_fill_colors(color, border)
(x1, y1, x2, y2) = (min(x... |
null | null | null | What does the code redirect back to the page they were viewing or to a specified endpoint ?
| def redirect_or_next(endpoint, **kwargs):
return redirect((request.args.get('next') or endpoint), **kwargs)
| null | null | null | the user
| codeqa | def redirect or next endpoint **kwargs return redirect request args get 'next' or endpoint **kwargs
| null | null | null | null | Question:
What does the code redirect back to the page they were viewing or to a specified endpoint ?
Code:
def redirect_or_next(endpoint, **kwargs):
return redirect((request.args.get('next') or endpoint), **kwargs)
|
null | null | null | How do commands operate ?
| def _do_query(lib, query, album, also_items=True):
if album:
albums = list(lib.albums(query))
items = []
if also_items:
for al in albums:
items += al.items()
else:
albums = []
items = list(lib.items(query))
if (album and (not albums)):
raise ui.UserError(u'No matching albums found.')
elif ((no... | null | null | null | on matched items
| codeqa | def do query lib query album also items True if album albums list lib albums query items []if also items for al in albums items + al items else albums []items list lib items query if album and not albums raise ui User Error u' Nomatchingalbumsfound ' elif not album and not items raise ui User Error u' Nomatchingitemsfo... | null | null | null | null | Question:
How do commands operate ?
Code:
def _do_query(lib, query, album, also_items=True):
if album:
albums = list(lib.albums(query))
items = []
if also_items:
for al in albums:
items += al.items()
else:
albums = []
items = list(lib.items(query))
if (album and (not albums)):
raise ui.UserErr... |
null | null | null | What plays the current clip backwards ?
| @requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
| null | null | null | a clip
| codeqa | @requires duration@apply to mask@apply to audiodef time mirror self return self fl time lambda t self duration - t keep duration True
| null | null | null | null | Question:
What plays the current clip backwards ?
Code:
@requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
|
null | null | null | What does a clip play backwards ?
| @requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
| null | null | null | the current clip
| codeqa | @requires duration@apply to mask@apply to audiodef time mirror self return self fl time lambda t self duration - t keep duration True
| null | null | null | null | Question:
What does a clip play backwards ?
Code:
@requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
|
null | null | null | How does a clip play the current clip ?
| @requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
| null | null | null | backwards
| codeqa | @requires duration@apply to mask@apply to audiodef time mirror self return self fl time lambda t self duration - t keep duration True
| null | null | null | null | Question:
How does a clip play the current clip ?
Code:
@requires_duration
@apply_to_mask
@apply_to_audio
def time_mirror(self):
return self.fl_time((lambda t: (self.duration - t)), keep_duration=True)
|
null | null | null | What does the code send ?
| def patch(url, data=None, **kwargs):
return request('patch', url, data=data, **kwargs)
| null | null | null | a patch request
| codeqa | def patch url data None **kwargs return request 'patch' url data data **kwargs
| null | null | null | null | Question:
What does the code send ?
Code:
def patch(url, data=None, **kwargs):
return request('patch', url, data=data, **kwargs)
|
null | null | null | What does this be ?
| @file_view_token
@non_atomic_requests
def serve(request, viewer, key):
files = viewer.get_files()
obj = files.get(key)
if (not obj):
log.error((u"Couldn't find %s in %s (%d entries) for file %s" % (key, files.keys()[:10], len(files.keys()), viewer.file.id)))
raise http.Http404
return HttpResponseSendFi... | null | null | null | to serve files off of st
| codeqa | @file view token@non atomic requestsdef serve request viewer key files viewer get files obj files get key if not obj log error u" Couldn'tfind%sin%s %dentries forfile%s" % key files keys [ 10 ] len files keys viewer file id raise http Http 404 return Http Response Send File request obj['full'] content type obj['mimetyp... | null | null | null | null | Question:
What does this be ?
Code:
@file_view_token
@non_atomic_requests
def serve(request, viewer, key):
files = viewer.get_files()
obj = files.get(key)
if (not obj):
log.error((u"Couldn't find %s in %s (%d entries) for file %s" % (key, files.keys()[:10], len(files.keys()), viewer.file.id)))
raise... |
null | null | null | What is to serve files off of st ?
| @file_view_token
@non_atomic_requests
def serve(request, viewer, key):
files = viewer.get_files()
obj = files.get(key)
if (not obj):
log.error((u"Couldn't find %s in %s (%d entries) for file %s" % (key, files.keys()[:10], len(files.keys()), viewer.file.id)))
raise http.Http404
return HttpResponseSendFi... | null | null | null | this
| codeqa | @file view token@non atomic requestsdef serve request viewer key files viewer get files obj files get key if not obj log error u" Couldn'tfind%sin%s %dentries forfile%s" % key files keys [ 10 ] len files keys viewer file id raise http Http 404 return Http Response Send File request obj['full'] content type obj['mimetyp... | null | null | null | null | Question:
What is to serve files off of st ?
Code:
@file_view_token
@non_atomic_requests
def serve(request, viewer, key):
files = viewer.get_files()
obj = files.get(key)
if (not obj):
log.error((u"Couldn't find %s in %s (%d entries) for file %s" % (key, files.keys()[:10], len(files.keys()), viewer.fil... |
null | null | null | What does the code initialize ?
| def initialize(module):
global HOUSE
debug(('Received module start for: %s' % module.__name__))
if (not ('service' in HOUSE)):
HOUSE['service'] = {}
tmp_mod = module()
if (not tmp_mod.skip_opts):
response = handle_opts(tmp_mod)
else:
response = True
if response:
if hasattr(tmp_mod, 'initialize_bg'):
... | null | null | null | a module
| codeqa | def initialize module global HOUS Edebug ' Receivedmodulestartfor %s' % module name if not 'service' in HOUSE HOUSE['service'] {}tmp mod module if not tmp mod skip opts response handle opts tmp mod else response Trueif response if hasattr tmp mod 'initialize bg' tmp tmp mod initialize bg else tmp tmp mod initialize els... | null | null | null | null | Question:
What does the code initialize ?
Code:
def initialize(module):
global HOUSE
debug(('Received module start for: %s' % module.__name__))
if (not ('service' in HOUSE)):
HOUSE['service'] = {}
tmp_mod = module()
if (not tmp_mod.skip_opts):
response = handle_opts(tmp_mod)
else:
response = True
i... |
null | null | null | What does the code make ?
| def makeSQLTests(base, suffix, globals):
connectors = [PySQLite2Connector, SQLite3Connector, PyPgSQLConnector, PsycopgConnector, MySQLConnector, FirebirdConnector]
tests = {}
for connclass in connectors:
name = (connclass.TEST_PREFIX + suffix)
class testcase(connclass, base, unittest.TestCase, ):
__module__ =... | null | null | null | a test case for every db connector which can connect
| codeqa | def make SQL Tests base suffix globals connectors [ Py SQ Lite 2 Connector SQ Lite 3 Connector Py Pg SQL Connector Psycopg Connector My SQL Connector Firebird Connector]tests {}for connclass in connectors name connclass TEST PREFIX + suffix class testcase connclass base unittest Test Case module connclass module testca... | null | null | null | null | Question:
What does the code make ?
Code:
def makeSQLTests(base, suffix, globals):
connectors = [PySQLite2Connector, SQLite3Connector, PyPgSQLConnector, PsycopgConnector, MySQLConnector, FirebirdConnector]
tests = {}
for connclass in connectors:
name = (connclass.TEST_PREFIX + suffix)
class testcase(connclas... |
null | null | null | What is run outside a transaction ?
| @datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
if (not allow_existing):
raise datastore_err... | null | null | null | a decorator that insures a function
| codeqa | @datastore rpc positional 1 def Non Transactional func None allow existing True if func is not None return Non Transactional func def outer wrapper func def inner wrapper *args **kwds if not Is In Transaction return func *args **kwds if not allow existing raise datastore errors Bad Request Error ' Functioncannotbecalle... | null | null | null | null | Question:
What is run outside a transaction ?
Code:
@datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **k... |
null | null | null | What insures a function ?
| @datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
if (not allow_existing):
raise datastore_err... | null | null | null | a decorator
| codeqa | @datastore rpc positional 1 def Non Transactional func None allow existing True if func is not None return Non Transactional func def outer wrapper func def inner wrapper *args **kwds if not Is In Transaction return func *args **kwds if not allow existing raise datastore errors Bad Request Error ' Functioncannotbecalle... | null | null | null | null | Question:
What insures a function ?
Code:
@datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
if... |
null | null | null | Where is a decorator that insures a function run ?
| @datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
if (not allow_existing):
raise datastore_err... | null | null | null | outside a transaction
| codeqa | @datastore rpc positional 1 def Non Transactional func None allow existing True if func is not None return Non Transactional func def outer wrapper func def inner wrapper *args **kwds if not Is In Transaction return func *args **kwds if not allow existing raise datastore errors Bad Request Error ' Functioncannotbecalle... | null | null | null | null | Question:
Where is a decorator that insures a function run ?
Code:
@datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return ... |
null | null | null | What does a decorator insure ?
| @datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
if (not allow_existing):
raise datastore_err... | null | null | null | a function
| codeqa | @datastore rpc positional 1 def Non Transactional func None allow existing True if func is not None return Non Transactional func def outer wrapper func def inner wrapper *args **kwds if not Is In Transaction return func *args **kwds if not allow existing raise datastore errors Bad Request Error ' Functioncannotbecalle... | null | null | null | null | Question:
What does a decorator insure ?
Code:
@datastore_rpc._positional(1)
def NonTransactional(_func=None, allow_existing=True):
if (_func is not None):
return NonTransactional()(_func)
def outer_wrapper(func):
def inner_wrapper(*args, **kwds):
if (not IsInTransaction()):
return func(*args, **kwds)
... |
null | null | null | What has been reached on a node ?
| def wait_until(name, state, timeout=300):
start_time = time.time()
node = show_instance(name, call='action')
while True:
if (node['state'] == state):
return True
time.sleep(1)
if ((time.time() - start_time) > timeout):
return False
node = show_instance(name, call='action')
| null | null | null | a specific state
| codeqa | def wait until name state timeout 300 start time time time node show instance name call 'action' while True if node['state'] state return Truetime sleep 1 if time time - start time > timeout return Falsenode show instance name call 'action'
| null | null | null | null | Question:
What has been reached on a node ?
Code:
def wait_until(name, state, timeout=300):
start_time = time.time()
node = show_instance(name, call='action')
while True:
if (node['state'] == state):
return True
time.sleep(1)
if ((time.time() - start_time) > timeout):
return False
node = show_insta... |
null | null | null | Where has a specific state been reached ?
| def wait_until(name, state, timeout=300):
start_time = time.time()
node = show_instance(name, call='action')
while True:
if (node['state'] == state):
return True
time.sleep(1)
if ((time.time() - start_time) > timeout):
return False
node = show_instance(name, call='action')
| null | null | null | on a node
| codeqa | def wait until name state timeout 300 start time time time node show instance name call 'action' while True if node['state'] state return Truetime sleep 1 if time time - start time > timeout return Falsenode show instance name call 'action'
| null | null | null | null | Question:
Where has a specific state been reached ?
Code:
def wait_until(name, state, timeout=300):
start_time = time.time()
node = show_instance(name, call='action')
while True:
if (node['state'] == state):
return True
time.sleep(1)
if ((time.time() - start_time) > timeout):
return False
node = sh... |
null | null | null | How does the code join one or more path components to the base path component ?
| def safe_join(base, *paths):
base = force_text(base)
paths = [force_text(p) for p in paths]
final_path = abspathu(join(base, *paths))
base_path = abspathu(base)
if ((not normcase(final_path).startswith(normcase((base_path + sep)))) and (normcase(final_path) != normcase(base_path)) and (dirname(normcase(base_path))... | null | null | null | intelligently
| codeqa | def safe join base *paths base force text base paths [force text p for p in paths]final path abspathu join base *paths base path abspathu base if not normcase final path startswith normcase base path + sep and normcase final path normcase base path and dirname normcase base path normcase base path raise Value Error ' T... | null | null | null | null | Question:
How does the code join one or more path components to the base path component ?
Code:
def safe_join(base, *paths):
base = force_text(base)
paths = [force_text(p) for p in paths]
final_path = abspathu(join(base, *paths))
base_path = abspathu(base)
if ((not normcase(final_path).startswith(normcase((bas... |
null | null | null | What does the code join to the base path component intelligently ?
| def safe_join(base, *paths):
base = force_text(base)
paths = [force_text(p) for p in paths]
final_path = abspathu(join(base, *paths))
base_path = abspathu(base)
if ((not normcase(final_path).startswith(normcase((base_path + sep)))) and (normcase(final_path) != normcase(base_path)) and (dirname(normcase(base_path))... | null | null | null | one or more path components
| codeqa | def safe join base *paths base force text base paths [force text p for p in paths]final path abspathu join base *paths base path abspathu base if not normcase final path startswith normcase base path + sep and normcase final path normcase base path and dirname normcase base path normcase base path raise Value Error ' T... | null | null | null | null | Question:
What does the code join to the base path component intelligently ?
Code:
def safe_join(base, *paths):
base = force_text(base)
paths = [force_text(p) for p in paths]
final_path = abspathu(join(base, *paths))
base_path = abspathu(base)
if ((not normcase(final_path).startswith(normcase((base_path + sep)... |
null | null | null | What creates the stop command for an application which is uniquely identified by a port number ?
| def create_python27_stop_cmd(port):
stop_cmd = '/usr/bin/python2 {0}/scripts/stop_service.py dev_appserver.py {1}'.format(constants.APPSCALE_HOME, port)
return stop_cmd
| null | null | null | this
| codeqa | def create python 27 stop cmd port stop cmd '/usr/bin/python 2 { 0 }/scripts/stop service pydev appserver py{ 1 }' format constants APPSCALE HOME port return stop cmd
| null | null | null | null | Question:
What creates the stop command for an application which is uniquely identified by a port number ?
Code:
def create_python27_stop_cmd(port):
stop_cmd = '/usr/bin/python2 {0}/scripts/stop_service.py dev_appserver.py {1}'.format(constants.APPSCALE_HOME, port)
return stop_cmd
|
null | null | null | How is by a port number identified an application ?
| def create_python27_stop_cmd(port):
stop_cmd = '/usr/bin/python2 {0}/scripts/stop_service.py dev_appserver.py {1}'.format(constants.APPSCALE_HOME, port)
return stop_cmd
| null | null | null | uniquely
| codeqa | def create python 27 stop cmd port stop cmd '/usr/bin/python 2 { 0 }/scripts/stop service pydev appserver py{ 1 }' format constants APPSCALE HOME port return stop cmd
| null | null | null | null | Question:
How is by a port number identified an application ?
Code:
def create_python27_stop_cmd(port):
stop_cmd = '/usr/bin/python2 {0}/scripts/stop_service.py dev_appserver.py {1}'.format(constants.APPSCALE_HOME, port)
return stop_cmd
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.