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 did the code shut ?
| def close_remote_debugger(rpcclt):
close_subprocess_debugger(rpcclt)
rpcclt.unregister(gui_adap_oid)
| null | null | null | subprocess debugger
| codeqa | def close remote debugger rpcclt close subprocess debugger rpcclt rpcclt unregister gui adap oid
| null | null | null | null | Question:
What did the code shut ?
Code:
def close_remote_debugger(rpcclt):
close_subprocess_debugger(rpcclt)
rpcclt.unregister(gui_adap_oid)
|
null | null | null | What does the code add to the queue ?
| def set(bot, update, args, job_queue, chat_data):
chat_id = update.message.chat_id
try:
due = int(args[0])
if (due < 0):
update.message.reply_text('Sorry we can not go back to future!')
return
job = Job(alarm, due, repeat=False, context=chat_id)
chat_data['job'] = job
job_queue.put(job)
updat... | null | null | null | a job
| codeqa | def set bot update args job queue chat data chat id update message chat idtry due int args[ 0 ] if due < 0 update message reply text ' Sorrywecannotgobacktofuture ' returnjob Job alarm due repeat False context chat id chat data['job'] jobjob queue put job update message reply text ' Timersuccessfullyset ' except Index ... | null | null | null | null | Question:
What does the code add to the queue ?
Code:
def set(bot, update, args, job_queue, chat_data):
chat_id = update.message.chat_id
try:
due = int(args[0])
if (due < 0):
update.message.reply_text('Sorry we can not go back to future!')
return
job = Job(alarm, due, repeat=False, context=chat... |
null | null | null | What is listed in assistive access ?
| def enabled(app_id):
for a in _get_assistive_access():
if ((app_id == a[0]) and (a[1] == '1')):
return True
return False
| null | null | null | a bundle i d or command
| codeqa | def enabled app id for a in get assistive access if app id a[ 0 ] and a[ 1 ] '1 ' return Truereturn False
| null | null | null | null | Question:
What is listed in assistive access ?
Code:
def enabled(app_id):
for a in _get_assistive_access():
if ((app_id == a[0]) and (a[1] == '1')):
return True
return False
|
null | null | null | Where is a bundle i d or command listed ?
| def enabled(app_id):
for a in _get_assistive_access():
if ((app_id == a[0]) and (a[1] == '1')):
return True
return False
| null | null | null | in assistive access
| codeqa | def enabled app id for a in get assistive access if app id a[ 0 ] and a[ 1 ] '1 ' return Truereturn False
| null | null | null | null | Question:
Where is a bundle i d or command listed ?
Code:
def enabled(app_id):
for a in _get_assistive_access():
if ((app_id == a[0]) and (a[1] == '1')):
return True
return False
|
null | null | null | What returns a single ?
| def flatten(x):
return list(iflatten(x))
| null | null | null | list
| codeqa | def flatten x return list iflatten x
| null | null | null | null | Question:
What returns a single ?
Code:
def flatten(x):
return list(iflatten(x))
|
null | null | null | What do list return ?
| def flatten(x):
return list(iflatten(x))
| null | null | null | a single
| codeqa | def flatten x return list iflatten x
| null | null | null | null | Question:
What do list return ?
Code:
def flatten(x):
return list(iflatten(x))
|
null | null | null | What does the code return ?
| @keep_lazy(str, SafeText)
def escape(text):
return mark_safe(force_text(text).replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", '''))
| null | null | null | the given text with ampersands
| codeqa | @keep lazy str Safe Text def escape text return mark safe force text text replace '&' '& ' replace '<' '< ' replace '>' '> ' replace '"' '" ' replace "'" '&# 39 '
| null | null | null | null | Question:
What does the code return ?
Code:
@keep_lazy(str, SafeText)
def escape(text):
return mark_safe(force_text(text).replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace("'", '''))
|
null | null | null | How does this function convert a date to a month number ?
| def floored_twelfth_of_a_360_day_year(date):
timetuple = date.timetuple()
year = timetuple.tm_year
day_of_year = timetuple.tm_yday
month0 = floor(((day_of_year / 360) * 12))
return ((((year - start_year) * 12) + month0) - start_month_0_indexed)
| null | null | null | by flooring
| codeqa | def floored twelfth of a 360 day year date timetuple date timetuple year timetuple tm yearday of year timetuple tm ydaymonth 0 floor day of year / 360 * 12 return year - start year * 12 + month 0 - start month 0 indexed
| null | null | null | null | Question:
How does this function convert a date to a month number ?
Code:
def floored_twelfth_of_a_360_day_year(date):
timetuple = date.timetuple()
year = timetuple.tm_year
day_of_year = timetuple.tm_yday
month0 = floor(((day_of_year / 360) * 12))
return ((((year - start_year) * 12) + month0) - start_month_0_i... |
null | null | null | What does this function convert to a month number by flooring ?
| def floored_twelfth_of_a_360_day_year(date):
timetuple = date.timetuple()
year = timetuple.tm_year
day_of_year = timetuple.tm_yday
month0 = floor(((day_of_year / 360) * 12))
return ((((year - start_year) * 12) + month0) - start_month_0_indexed)
| null | null | null | a date
| codeqa | def floored twelfth of a 360 day year date timetuple date timetuple year timetuple tm yearday of year timetuple tm ydaymonth 0 floor day of year / 360 * 12 return year - start year * 12 + month 0 - start month 0 indexed
| null | null | null | null | Question:
What does this function convert to a month number by flooring ?
Code:
def floored_twelfth_of_a_360_day_year(date):
timetuple = date.timetuple()
year = timetuple.tm_year
day_of_year = timetuple.tm_yday
month0 = floor(((day_of_year / 360) * 12))
return ((((year - start_year) * 12) + month0) - start_mon... |
null | null | null | How did components connect ?
| @not_implemented_for('undirected')
def number_weakly_connected_components(G):
return len(list(weakly_connected_components(G)))
| null | null | null | weakly
| codeqa | @not implemented for 'undirected' def number weakly connected components G return len list weakly connected components G
| null | null | null | null | Question:
How did components connect ?
Code:
@not_implemented_for('undirected')
def number_weakly_connected_components(G):
return len(list(weakly_connected_components(G)))
|
null | null | null | What does the code get ?
| def get_installed_version(dist_name):
req = pkg_resources.Requirement.parse(dist_name)
working_set = pkg_resources.WorkingSet()
dist = working_set.find(req)
return (dist.version if dist else None)
| null | null | null | the installed version of dist_name avoiding pkg_resources cache
| codeqa | def get installed version dist name req pkg resources Requirement parse dist name working set pkg resources Working Set dist working set find req return dist version if dist else None
| null | null | null | null | Question:
What does the code get ?
Code:
def get_installed_version(dist_name):
req = pkg_resources.Requirement.parse(dist_name)
working_set = pkg_resources.WorkingSet()
dist = working_set.find(req)
return (dist.version if dist else None)
|
null | null | null | What does a decorator mark as deprecated ?
| def deprecated(version, replacement=None):
def deprecationDecorator(function):
'\n Decorator that marks C{function} as deprecated.\n '
warningString = getDeprecationWarningString(function, version, None, replacement)
@wraps(function)
def deprecatedFunction(*args, **kwargs):
warn(warning... | null | null | null | callables
| codeqa | def deprecated version replacement None def deprecation Decorator function '\n Decoratorthatmarks C{function}asdeprecated \n'warning String get Deprecation Warning String function version None replacement @wraps function def deprecated Function *args **kwargs warn warning String Deprecation Warning stacklevel 2 return ... | null | null | null | null | Question:
What does a decorator mark as deprecated ?
Code:
def deprecated(version, replacement=None):
def deprecationDecorator(function):
'\n Decorator that marks C{function} as deprecated.\n '
warningString = getDeprecationWarningString(function, version, None, replacement)
@wraps(funct... |
null | null | null | What does the code traverse ?
| def subdocuments(fields_chain, resource, document):
if (len(fields_chain) == 0):
(yield document)
elif (isinstance(document, dict) and (fields_chain[0] in document)):
subdocument = document[fields_chain[0]]
docs = (subdocument if isinstance(subdocument, list) else [subdocument])
try:
resource = field_defin... | null | null | null | the given document
| codeqa | def subdocuments fields chain resource document if len fields chain 0 yield document elif isinstance document dict and fields chain[ 0 ] in document subdocument document[fields chain[ 0 ]]docs subdocument if isinstance subdocument list else [subdocument] try resource field definition resource fields chain[ 0 ] ['data r... | null | null | null | null | Question:
What does the code traverse ?
Code:
def subdocuments(fields_chain, resource, document):
if (len(fields_chain) == 0):
(yield document)
elif (isinstance(document, dict) and (fields_chain[0] in document)):
subdocument = document[fields_chain[0]]
docs = (subdocument if isinstance(subdocument, list) el... |
null | null | null | What does the code build ?
| def read_file(*parts):
with codecs.open(os.path.join(HERE, *parts), 'rb', 'ascii') as f:
return f.read()
| null | null | null | an absolute path
| codeqa | def read file *parts with codecs open os path join HERE *parts 'rb' 'ascii' as f return f read
| null | null | null | null | Question:
What does the code build ?
Code:
def read_file(*parts):
with codecs.open(os.path.join(HERE, *parts), 'rb', 'ascii') as f:
return f.read()
|
null | null | null | What does the code return ?
| def read_file(*parts):
with codecs.open(os.path.join(HERE, *parts), 'rb', 'ascii') as f:
return f.read()
| null | null | null | the contents of the resulting file
| codeqa | def read file *parts with codecs open os path join HERE *parts 'rb' 'ascii' as f return f read
| null | null | null | null | Question:
What does the code return ?
Code:
def read_file(*parts):
with codecs.open(os.path.join(HERE, *parts), 'rb', 'ascii') as f:
return f.read()
|
null | null | null | How do a port number return from a service name and protocol name ?
| def getservbyname(servicename, protocolname=None):
return _ResolveService(servicename, protocolname)[1]
| null | null | null | integer
| codeqa | def getservbyname servicename protocolname None return Resolve Service servicename protocolname [1 ]
| null | null | null | null | Question:
How do a port number return from a service name and protocol name ?
Code:
def getservbyname(servicename, protocolname=None):
return _ResolveService(servicename, protocolname)[1]
|
null | null | null | How do a python object serialize ?
| def unpack(packedData):
return json.loads(bz2.decompress(packedData))
| null | null | null | de
| codeqa | def unpack packed Data return json loads bz 2 decompress packed Data
| null | null | null | null | Question:
How do a python object serialize ?
Code:
def unpack(packedData):
return json.loads(bz2.decompress(packedData))
|
null | null | null | What does a copy of response support ?
| def seek_wrapped_response(response):
if (not hasattr(response, 'seek')):
wrapper_class = get_seek_wrapper_class(response)
response = wrapper_class(response)
assert hasattr(response, 'get_data')
return response
| null | null | null | seekable response interface
| codeqa | def seek wrapped response response if not hasattr response 'seek' wrapper class get seek wrapper class response response wrapper class response assert hasattr response 'get data' return response
| null | null | null | null | Question:
What does a copy of response support ?
Code:
def seek_wrapped_response(response):
if (not hasattr(response, 'seek')):
wrapper_class = get_seek_wrapper_class(response)
response = wrapper_class(response)
assert hasattr(response, 'get_data')
return response
|
null | null | null | What does the code get ?
| def getRotatedComplexes(planeAngle, points):
rotatedComplexes = []
for point in points:
rotatedComplexes.append((planeAngle * point))
return rotatedComplexes
| null | null | null | points rotated by the plane angle
| codeqa | def get Rotated Complexes plane Angle points rotated Complexes []for point in points rotated Complexes append plane Angle * point return rotated Complexes
| null | null | null | null | Question:
What does the code get ?
Code:
def getRotatedComplexes(planeAngle, points):
rotatedComplexes = []
for point in points:
rotatedComplexes.append((planeAngle * point))
return rotatedComplexes
|
null | null | null | What does context manager acquire ?
| @contextmanager
def lock_file(filename, timeout=10, append=False, unlink=True):
flags = (os.O_CREAT | os.O_RDWR)
if append:
flags |= os.O_APPEND
mode = 'a+'
else:
mode = 'r+'
while True:
fd = os.open(filename, flags)
file_obj = os.fdopen(fd, mode)
try:
with swift.common.exceptions.LockTimeout(timeout... | null | null | null | a lock on a file
| codeqa | @contextmanagerdef lock file filename timeout 10 append False unlink True flags os O CREAT os O RDWR if append flags os O APPEN Dmode 'a+'else mode 'r+'while True fd os open filename flags file obj os fdopen fd mode try with swift common exceptions Lock Timeout timeout filename while True try fcntl flock fd fcntl LOCK ... | null | null | null | null | Question:
What does context manager acquire ?
Code:
@contextmanager
def lock_file(filename, timeout=10, append=False, unlink=True):
flags = (os.O_CREAT | os.O_RDWR)
if append:
flags |= os.O_APPEND
mode = 'a+'
else:
mode = 'r+'
while True:
fd = os.open(filename, flags)
file_obj = os.fdopen(fd, mode)
... |
null | null | null | What acquires a lock on a file ?
| @contextmanager
def lock_file(filename, timeout=10, append=False, unlink=True):
flags = (os.O_CREAT | os.O_RDWR)
if append:
flags |= os.O_APPEND
mode = 'a+'
else:
mode = 'r+'
while True:
fd = os.open(filename, flags)
file_obj = os.fdopen(fd, mode)
try:
with swift.common.exceptions.LockTimeout(timeout... | null | null | null | context manager
| codeqa | @contextmanagerdef lock file filename timeout 10 append False unlink True flags os O CREAT os O RDWR if append flags os O APPEN Dmode 'a+'else mode 'r+'while True fd os open filename flags file obj os fdopen fd mode try with swift common exceptions Lock Timeout timeout filename while True try fcntl flock fd fcntl LOCK ... | null | null | null | null | Question:
What acquires a lock on a file ?
Code:
@contextmanager
def lock_file(filename, timeout=10, append=False, unlink=True):
flags = (os.O_CREAT | os.O_RDWR)
if append:
flags |= os.O_APPEND
mode = 'a+'
else:
mode = 'r+'
while True:
fd = os.open(filename, flags)
file_obj = os.fdopen(fd, mode)
try... |
null | null | null | What disables a source ?
| def disable_source(name):
return _change_source_state(name, 'disable')
| null | null | null | chocolatey
| codeqa | def disable source name return change source state name 'disable'
| null | null | null | null | Question:
What disables a source ?
Code:
def disable_source(name):
return _change_source_state(name, 'disable')
|
null | null | null | What downloaded it last ?
| def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise ValueError
header_mtime = mktime_tz(header_date)
h... | null | null | null | the user
| codeqa | def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match u'^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header date parsedate tz matches group 1 if header date is None raise Value Errorheader mtime mktime tz header date header len matches group 3 if header len and i... | null | null | null | null | Question:
What downloaded it last ?
Code:
def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise ValueErr... |
null | null | null | When did something modify ?
| def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise ValueError
header_mtime = mktime_tz(header_date)
h... | null | null | null | since the user last downloaded it
| codeqa | def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match u'^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header date parsedate tz matches group 1 if header date is None raise Value Errorheader mtime mktime tz header date header len matches group 3 if header len and i... | null | null | null | null | Question:
When did something modify ?
Code:
def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise ValueE... |
null | null | null | When did the user download it ?
| def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise ValueError
header_mtime = mktime_tz(header_date)
h... | null | null | null | last
| codeqa | def was modified since header None mtime 0 size 0 try if header is None raise Value Errormatches re match u'^ [^ ]+ length [0 - 9 ]+ ?$' header re IGNORECASE header date parsedate tz matches group 1 if header date is None raise Value Errorheader mtime mktime tz header date header len matches group 3 if header len and i... | null | null | null | null | Question:
When did the user download it ?
Code:
def was_modified_since(header=None, mtime=0, size=0):
try:
if (header is None):
raise ValueError
matches = re.match(u'^([^;]+)(; length=([0-9]+))?$', header, re.IGNORECASE)
header_date = parsedate_tz(matches.group(1))
if (header_date is None):
raise Va... |
null | null | null | What does the code get ?
| def getNewRepository():
return ReversalRepository()
| null | null | null | the repository constructor
| codeqa | def get New Repository return Reversal Repository
| null | null | null | null | Question:
What does the code get ?
Code:
def getNewRepository():
return ReversalRepository()
|
null | null | null | What does the code find ?
| def primarykeys(conn, table):
rows = query(conn, "\n SELECT COLS.COLUMN_NAME\n FROM USER_CONSTRAINTS CONS, ALL_CONS_COLUMNS COLS\n WHERE COLS.TABLE_NAME = :t\n AND CONS.CONSTRAINT_TYPE = 'P'\n AND CONS.OWNER = COLS.OWNER\n AND CONS.CONSTRAINT_N... | null | null | null | primary keys
| codeqa | def primarykeys conn table rows query conn "\n SELECTCOLS COLUMN NAME\n FROMUSER CONSTRAINTSCONS ALL CONS COLUMNSCOLS\n WHERECOLS TABLE NAME t\n ANDCONS CONSTRAINT TYPE 'P'\n ANDCONS OWNER COLS OWNER\n ANDCONS CONSTRAINT NAME COLS CONSTRAINT NAME\n" table return [row['COLUMN NAME'] for row in rows]
| null | null | null | null | Question:
What does the code find ?
Code:
def primarykeys(conn, table):
rows = query(conn, "\n SELECT COLS.COLUMN_NAME\n FROM USER_CONSTRAINTS CONS, ALL_CONS_COLUMNS COLS\n WHERE COLS.TABLE_NAME = :t\n AND CONS.CONSTRAINT_TYPE = 'P'\n AND CONS.OWNER = C... |
null | null | null | What does the code truncate after a certain number of letters argument ?
| def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
| null | null | null | a string
| codeqa | def truncateletters value arg from django extensions utils text import truncate letterstry length int arg except Value Error return valuereturn truncate letters value length
| null | null | null | null | Question:
What does the code truncate after a certain number of letters argument ?
Code:
def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
|
null | null | null | When does the code truncate a string ?
| def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
| null | null | null | after a certain number of letters argument
| codeqa | def truncateletters value arg from django extensions utils text import truncate letterstry length int arg except Value Error return valuereturn truncate letters value length
| null | null | null | null | Question:
When does the code truncate a string ?
Code:
def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
|
null | null | null | When do letters truncate ?
| def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
| null | null | null | after
| codeqa | def truncateletters value arg from django extensions utils text import truncate letterstry length int arg except Value Error return valuereturn truncate letters value length
| null | null | null | null | Question:
When do letters truncate ?
Code:
def truncateletters(value, arg):
from django_extensions.utils.text import truncate_letters
try:
length = int(arg)
except ValueError:
return value
return truncate_letters(value, length)
|
null | null | null | What does the decorated function raise ?
| def raises_Invalid(function):
def call_and_assert(*args, **kwargs):
nose.tools.assert_raises(df.Invalid, function, *args, **kwargs)
return call_and_assert
| null | null | null | dictization_functions
| codeqa | def raises Invalid function def call and assert *args **kwargs nose tools assert raises df Invalid function *args **kwargs return call and assert
| null | null | null | null | Question:
What does the decorated function raise ?
Code:
def raises_Invalid(function):
def call_and_assert(*args, **kwargs):
nose.tools.assert_raises(df.Invalid, function, *args, **kwargs)
return call_and_assert
|
null | null | null | What does the code skip unless the condition is true ?
| def skipUnless(condition, reason):
if (not condition):
return skip(reason)
return _id
| null | null | null | a test
| codeqa | def skip Unless condition reason if not condition return skip reason return id
| null | null | null | null | Question:
What does the code skip unless the condition is true ?
Code:
def skipUnless(condition, reason):
if (not condition):
return skip(reason)
return _id
|
null | null | null | What does the code get ?
| def regions(**kw_params):
return get_regions('ec2', connection_cls=EC2Connection)
| null | null | null | all available regions for the ec2 service
| codeqa | def regions **kw params return get regions 'ec 2 ' connection cls EC 2 Connection
| null | null | null | null | Question:
What does the code get ?
Code:
def regions(**kw_params):
return get_regions('ec2', connection_cls=EC2Connection)
|
null | null | null | What does which perform ?
| def basic_auth(realm, checkpassword, debug=False):
if ('"' in realm):
raise ValueError('Realm cannot contain the " (quote) character.')
request = cherrypy.serving.request
auth_header = request.headers.get('authorization')
if (auth_header is not None):
with cherrypy.HTTPError.handle((ValueError, binascii.E... | null | null | null | http basic access authentication
| codeqa | def basic auth realm checkpassword debug False if '"' in realm raise Value Error ' Realmcannotcontainthe" quote character ' request cherrypy serving requestauth header request headers get 'authorization' if auth header is not None with cherrypy HTTP Error handle Value Error binascii Error 400 ' Bad Request' scheme para... | null | null | null | null | Question:
What does which perform ?
Code:
def basic_auth(realm, checkpassword, debug=False):
if ('"' in realm):
raise ValueError('Realm cannot contain the " (quote) character.')
request = cherrypy.serving.request
auth_header = request.headers.get('authorization')
if (auth_header is not None):
with che... |
null | null | null | How do command for existing command help ?
| def test_help_command_should_exit_status_ok_when_command_exists(script):
result = script.pip('help', 'freeze')
assert (result.returncode == SUCCESS)
| null | null | null | test
| codeqa | def test help command should exit status ok when command exists script result script pip 'help' 'freeze' assert result returncode SUCCESS
| null | null | null | null | Question:
How do command for existing command help ?
Code:
def test_help_command_should_exit_status_ok_when_command_exists(script):
result = script.pip('help', 'freeze')
assert (result.returncode == SUCCESS)
|
null | null | null | Where is the image visible ?
| def is_image_visible(context, image, status=None):
if context.is_admin:
return True
if (image['owner'] is None):
return True
if image['is_public']:
return True
if (context.owner is not None):
if (context.owner == image['owner']):
return True
if (status == 'all'):
status = None
members = image_memb... | null | null | null | in this context
| codeqa | def is image visible context image status None if context is admin return Trueif image['owner'] is None return Trueif image['is public'] return Trueif context owner is not None if context owner image['owner'] return Trueif status 'all' status Nonemembers image member find context image id image['id'] member context own... | null | null | null | null | Question:
Where is the image visible ?
Code:
def is_image_visible(context, image, status=None):
if context.is_admin:
return True
if (image['owner'] is None):
return True
if image['is_public']:
return True
if (context.owner is not None):
if (context.owner == image['owner']):
return True
if (status =... |
null | null | null | What is visible in this context ?
| def is_image_visible(context, image, status=None):
if context.is_admin:
return True
if (image['owner'] is None):
return True
if image['is_public']:
return True
if (context.owner is not None):
if (context.owner == image['owner']):
return True
if (status == 'all'):
status = None
members = image_memb... | null | null | null | the image
| codeqa | def is image visible context image status None if context is admin return Trueif image['owner'] is None return Trueif image['is public'] return Trueif context owner is not None if context owner image['owner'] return Trueif status 'all' status Nonemembers image member find context image id image['id'] member context own... | null | null | null | null | Question:
What is visible in this context ?
Code:
def is_image_visible(context, image, status=None):
if context.is_admin:
return True
if (image['owner'] is None):
return True
if image['is_public']:
return True
if (context.owner is not None):
if (context.owner == image['owner']):
return True
if (sta... |
null | null | null | What does the code get ?
| def get_file(fileorpath):
if hasattr(fileorpath, 'path'):
return private_storage.open(fileorpath.path)
if hasattr(fileorpath, 'name'):
return fileorpath
raise ValueError('not a file or upload')
| null | null | null | a file - like object
| codeqa | def get file fileorpath if hasattr fileorpath 'path' return private storage open fileorpath path if hasattr fileorpath 'name' return fileorpathraise Value Error 'notafileorupload'
| null | null | null | null | Question:
What does the code get ?
Code:
def get_file(fileorpath):
if hasattr(fileorpath, 'path'):
return private_storage.open(fileorpath.path)
if hasattr(fileorpath, 'name'):
return fileorpath
raise ValueError('not a file or upload')
|
null | null | null | What does the code generate ?
| def random_distribution(size=vocabulary_size):
b = np.random.uniform(0.0, 1.0, size=[1, size])
return (b / np.sum(b, 1)[:, None])
| null | null | null | a random column of probabilities
| codeqa | def random distribution size vocabulary size b np random uniform 0 0 1 0 size [1 size] return b / np sum b 1 [ None]
| null | null | null | null | Question:
What does the code generate ?
Code:
def random_distribution(size=vocabulary_size):
b = np.random.uniform(0.0, 1.0, size=[1, size])
return (b / np.sum(b, 1)[:, None])
|
null | null | null | How does none return ?
| def in6_ptoc(addr):
try:
d = struct.unpack('!IIII', inet_pton(socket.AF_INET6, addr))
except:
return None
res = 0
m = [(2 ** 96), (2 ** 64), (2 ** 32), 1]
for i in xrange(4):
res += (d[i] * m[i])
rem = res
res = []
while rem:
res.append(_rfc1924map[(rem % 85)])
rem = (rem / 85)
res.reverse()
return ... | null | null | null | on error
| codeqa | def in 6 ptoc addr try d struct unpack ' IIII' inet pton socket AF INET 6 addr except return Noneres 0m [ 2 ** 96 2 ** 64 2 ** 32 1]for i in xrange 4 res + d[i] * m[i] rem resres []while rem res append rfc 1924 map[ rem % 85 ] rem rem / 85 res reverse return '' join res
| null | null | null | null | Question:
How does none return ?
Code:
def in6_ptoc(addr):
try:
d = struct.unpack('!IIII', inet_pton(socket.AF_INET6, addr))
except:
return None
res = 0
m = [(2 ** 96), (2 ** 64), (2 ** 32), 1]
for i in xrange(4):
res += (d[i] * m[i])
rem = res
res = []
while rem:
res.append(_rfc1924map[(rem % 85)])... |
null | null | null | What does the code get ?
| def get(context, name, session):
try:
query = session.query(models.MetadefResourceType).filter_by(name=name)
resource_type = query.one()
except sa_orm.exc.NoResultFound:
LOG.debug('No metadata definition resource-type found with name %s', name)
raise exc.MetadefResourceTypeNotFound(resource_type_name=n... | null | null | null | a resource type
| codeqa | def get context name session try query session query models Metadef Resource Type filter by name name resource type query one except sa orm exc No Result Found LOG debug ' Nometadatadefinitionresource-typefoundwithname%s' name raise exc Metadef Resource Type Not Found resource type name name return resource type to dic... | null | null | null | null | Question:
What does the code get ?
Code:
def get(context, name, session):
try:
query = session.query(models.MetadefResourceType).filter_by(name=name)
resource_type = query.one()
except sa_orm.exc.NoResultFound:
LOG.debug('No metadata definition resource-type found with name %s', name)
raise exc.Met... |
null | null | null | Where does a decorator define methods ?
| def python_2_unicode_compatible(klass):
if PY2:
if ('__str__' not in klass.__dict__):
raise ValueError(("@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__()." % klass.__name__))
klass.__unicode__ = klass.__str__
klass.__str__ = (lambda self: self.__unicode__().en... | null | null | null | under python 2
| codeqa | def python 2 unicode compatible klass if PY 2 if ' str ' not in klass dict raise Value Error "@python 2 unicode compatiblecannotbeappliedto%sbecauseitdoesn'tdefine str " % klass name klass unicode klass str klass str lambda self self unicode encode 'utf- 8 ' return klass
| null | null | null | null | Question:
Where does a decorator define methods ?
Code:
def python_2_unicode_compatible(klass):
if PY2:
if ('__str__' not in klass.__dict__):
raise ValueError(("@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__()." % klass.__name__))
klass.__unicode__ = klass._... |
null | null | null | What defines methods under python 2 ?
| def python_2_unicode_compatible(klass):
if PY2:
if ('__str__' not in klass.__dict__):
raise ValueError(("@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__()." % klass.__name__))
klass.__unicode__ = klass.__str__
klass.__str__ = (lambda self: self.__unicode__().en... | null | null | null | a decorator
| codeqa | def python 2 unicode compatible klass if PY 2 if ' str ' not in klass dict raise Value Error "@python 2 unicode compatiblecannotbeappliedto%sbecauseitdoesn'tdefine str " % klass name klass unicode klass str klass str lambda self self unicode encode 'utf- 8 ' return klass
| null | null | null | null | Question:
What defines methods under python 2 ?
Code:
def python_2_unicode_compatible(klass):
if PY2:
if ('__str__' not in klass.__dict__):
raise ValueError(("@python_2_unicode_compatible cannot be applied to %s because it doesn't define __str__()." % klass.__name__))
klass.__unicode__ = klass.__s... |
null | null | null | What does the code add to the output ?
| def addValueToOutput(depth, keyInput, output, value):
depthStart = (' ' * depth)
output.write(('%s%s:' % (depthStart, keyInput)))
if (value.__class__ == dict):
output.write('\n')
keys = value.keys()
keys.sort()
for key in keys:
addValueToOutput((depth + 1), key, output, value[key])
return
if (value._... | null | null | null | value
| codeqa | def add Value To Output depth key Input output value depth Start '' * depth output write '%s%s ' % depth Start key Input if value class dict output write '\n' keys value keys keys sort for key in keys add Value To Output depth + 1 key output value[key] returnif value class list output write '\n' for element Index eleme... | null | null | null | null | Question:
What does the code add to the output ?
Code:
def addValueToOutput(depth, keyInput, output, value):
depthStart = (' ' * depth)
output.write(('%s%s:' % (depthStart, keyInput)))
if (value.__class__ == dict):
output.write('\n')
keys = value.keys()
keys.sort()
for key in keys:
addValueToOutput(... |
null | null | null | What does the code get ?
| def backup_get_all_by_project(context, project_id):
return IMPL.backup_get_all_by_project(context, project_id)
| null | null | null | all backups belonging to a project
| codeqa | def backup get all by project context project id return IMPL backup get all by project context project id
| null | null | null | null | Question:
What does the code get ?
Code:
def backup_get_all_by_project(context, project_id):
return IMPL.backup_get_all_by_project(context, project_id)
|
null | null | null | What does the code get from attribute dictionary ?
| def getGeometryOutput(derivation, elementNode):
if (derivation == None):
derivation = ExtrudeDerivation(elementNode)
if (len(euclidean.getConcatenatedList(derivation.target)) == 0):
print 'Warning, in extrude there are no paths.'
print elementNode.attributes
return None
return getGeometryOutputByLoops(... | null | null | null | triangle mesh
| codeqa | def get Geometry Output derivation element Node if derivation None derivation Extrude Derivation element Node if len euclidean get Concatenated List derivation target 0 print ' Warning inextrudetherearenopaths 'print element Node attributesreturn Nonereturn get Geometry Output By Loops derivation derivation target
| null | null | null | null | Question:
What does the code get from attribute dictionary ?
Code:
def getGeometryOutput(derivation, elementNode):
if (derivation == None):
derivation = ExtrudeDerivation(elementNode)
if (len(euclidean.getConcatenatedList(derivation.target)) == 0):
print 'Warning, in extrude there are no paths.'
print... |
null | null | null | When is an error raised ?
| def test_allknn_sample_wt_fit():
allknn = AllKNN(random_state=RND_SEED)
assert_raises(RuntimeError, allknn.sample, X, Y)
| null | null | null | when sample is called before fitting
| codeqa | def test allknn sample wt fit allknn All KNN random state RND SEED assert raises Runtime Error allknn sample X Y
| null | null | null | null | Question:
When is an error raised ?
Code:
def test_allknn_sample_wt_fit():
allknn = AllKNN(random_state=RND_SEED)
assert_raises(RuntimeError, allknn.sample, X, Y)
|
null | null | null | Where does the code run a shell command ?
| def run(command, log_command_filter=identity):
return Effect(Run(command=command, log_command_filter=log_command_filter))
| null | null | null | on a remote host
| codeqa | def run command log command filter identity return Effect Run command command log command filter log command filter
| null | null | null | null | Question:
Where does the code run a shell command ?
Code:
def run(command, log_command_filter=identity):
return Effect(Run(command=command, log_command_filter=log_command_filter))
|
null | null | null | What does the code run on a remote host ?
| def run(command, log_command_filter=identity):
return Effect(Run(command=command, log_command_filter=log_command_filter))
| null | null | null | a shell command
| codeqa | def run command log command filter identity return Effect Run command command log command filter log command filter
| null | null | null | null | Question:
What does the code run on a remote host ?
Code:
def run(command, log_command_filter=identity):
return Effect(Run(command=command, log_command_filter=log_command_filter))
|
null | null | null | How were byte strings were output ?
| @pytest.mark.parametrize('fast_writer', [True, False])
def test_byte_string_output(fast_writer):
t = table.Table([['Hello', 'World']], dtype=['S10'])
out = StringIO()
ascii.write(t, out, fast_writer=fast_writer)
assert (out.getvalue().splitlines() == ['col0', 'Hello', 'World'])
| null | null | null | with a leading b on py3
| codeqa | @pytest mark parametrize 'fast writer' [ True False] def test byte string output fast writer t table Table [[' Hello' ' World']] dtype ['S 10 '] out String IO ascii write t out fast writer fast writer assert out getvalue splitlines ['col 0 ' ' Hello' ' World']
| null | null | null | null | Question:
How were byte strings were output ?
Code:
@pytest.mark.parametrize('fast_writer', [True, False])
def test_byte_string_output(fast_writer):
t = table.Table([['Hello', 'World']], dtype=['S10'])
out = StringIO()
ascii.write(t, out, fast_writer=fast_writer)
assert (out.getvalue().splitlines() == ['col0', ... |
null | null | null | What has the given * name * ?
| def import_by_name(name, prefixes=[None]):
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
else:
prefixed_name = name
(obj, parent, modname) = _import_by_name(prefixed_name)
return (prefixed_name, obj, parent, modname)
except ImportError:
tried.ap... | null | null | null | a python object
| codeqa | def import by name name prefixes [ None] tried []for prefix in prefixes try if prefix prefixed name ' ' join [prefix name] else prefixed name name obj parent modname import by name prefixed name return prefixed name obj parent modname except Import Error tried append prefixed name raise Import Error 'nomodulenamed%s' %... | null | null | null | null | Question:
What has the given * name * ?
Code:
def import_by_name(name, prefixes=[None]):
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
else:
prefixed_name = name
(obj, parent, modname) = _import_by_name(prefixed_name)
return (prefixed_name, obj, ... |
null | null | null | What does a python object have ?
| def import_by_name(name, prefixes=[None]):
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
else:
prefixed_name = name
(obj, parent, modname) = _import_by_name(prefixed_name)
return (prefixed_name, obj, parent, modname)
except ImportError:
tried.ap... | null | null | null | the given * name *
| codeqa | def import by name name prefixes [ None] tried []for prefix in prefixes try if prefix prefixed name ' ' join [prefix name] else prefixed name name obj parent modname import by name prefixed name return prefixed name obj parent modname except Import Error tried append prefixed name raise Import Error 'nomodulenamed%s' %... | null | null | null | null | Question:
What does a python object have ?
Code:
def import_by_name(name, prefixes=[None]):
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
else:
prefixed_name = name
(obj, parent, modname) = _import_by_name(prefixed_name)
return (prefixed_name, ob... |
null | null | null | What d the code convert to a glance i d ?
| @memoize
def id_to_glance_id(context, image_id):
return objects.S3ImageMapping.get_by_id(context, image_id).uuid
| null | null | null | an internal i d
| codeqa | @memoizedef id to glance id context image id return objects S3 Image Mapping get by id context image id uuid
| null | null | null | null | Question:
What d the code convert to a glance i d ?
Code:
@memoize
def id_to_glance_id(context, image_id):
return objects.S3ImageMapping.get_by_id(context, image_id).uuid
|
null | null | null | In which direction did the handle pass ?
| def is_callable(handle):
return isinstance(handle, collections.Callable)
| null | null | null | in
| codeqa | def is callable handle return isinstance handle collections Callable
| null | null | null | null | Question:
In which direction did the handle pass ?
Code:
def is_callable(handle):
return isinstance(handle, collections.Callable)
|
null | null | null | What do drivers raise ?
| def catch_notimplementederror(f):
def wrapped_func(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except NotImplementedError:
frame = traceback.extract_tb(sys.exc_info()[2])[(-1)]
LOG.error(('%(driver)s does not implement %(method)s required for test %(test)s' % {'driver': type(self.... | null | null | null | notimplementederror
| codeqa | def catch notimplementederror f def wrapped func self *args **kwargs try return f self *args **kwargs except Not Implemented Error frame traceback extract tb sys exc info [2 ] [ -1 ]LOG error '% driver sdoesnotimplement% method srequiredfortest% test s' % {'driver' type self connection 'method' frame[ 2 ] 'test' f name... | null | null | null | null | Question:
What do drivers raise ?
Code:
def catch_notimplementederror(f):
def wrapped_func(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except NotImplementedError:
frame = traceback.extract_tb(sys.exc_info()[2])[(-1)]
LOG.error(('%(driver)s does not implement %(method)s required ... |
null | null | null | What does a driver raise ?
| def catch_notimplementederror(f):
def wrapped_func(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except NotImplementedError:
frame = traceback.extract_tb(sys.exc_info()[2])[(-1)]
LOG.error(('%(driver)s does not implement %(method)s required for test %(test)s' % {'driver': type(self.... | null | null | null | notimplementederror
| codeqa | def catch notimplementederror f def wrapped func self *args **kwargs try return f self *args **kwargs except Not Implemented Error frame traceback extract tb sys exc info [2 ] [ -1 ]LOG error '% driver sdoesnotimplement% method srequiredfortest% test s' % {'driver' type self connection 'method' frame[ 2 ] 'test' f name... | null | null | null | null | Question:
What does a driver raise ?
Code:
def catch_notimplementederror(f):
def wrapped_func(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except NotImplementedError:
frame = traceback.extract_tb(sys.exc_info()[2])[(-1)]
LOG.error(('%(driver)s does not implement %(method)s require... |
null | null | null | How do the penalty return just ?
| def test_high_order_autoencoder_init():
corruptor = BinomialCorruptor(corruption_level=0.5)
model = HigherOrderContractiveAutoencoder(corruptor=corruptor, num_corruptions=2, nvis=5, nhid=7, act_enc='sigmoid', act_dec='sigmoid')
X = tensor.matrix()
data = np.random.randn(10, 5).astype(config.floatX)
ff = theano.fun... | null | null | null | without error
| codeqa | def test high order autoencoder init corruptor Binomial Corruptor corruption level 0 5 model Higher Order Contractive Autoencoder corruptor corruptor num corruptions 2 nvis 5 nhid 7 act enc 'sigmoid' act dec 'sigmoid' X tensor matrix data np random randn 10 5 astype config float X ff theano function [X] model higher or... | null | null | null | null | Question:
How do the penalty return just ?
Code:
def test_high_order_autoencoder_init():
corruptor = BinomialCorruptor(corruption_level=0.5)
model = HigherOrderContractiveAutoencoder(corruptor=corruptor, num_corruptions=2, nvis=5, nhid=7, act_enc='sigmoid', act_dec='sigmoid')
X = tensor.matrix()
data = np.rando... |
null | null | null | When does it be at its newest version if --force - reinstall is supplied ?
| @pytest.mark.network
def test_upgrade_force_reinstall_newest(script):
result = script.pip('install', 'INITools')
assert ((script.site_packages / 'initools') in result.files_created), sorted(result.files_created.keys())
result2 = script.pip('install', '--upgrade', '--force-reinstall', 'INITools')
assert result2.file... | null | null | null | already
| codeqa | @pytest mark networkdef test upgrade force reinstall newest script result script pip 'install' 'INI Tools' assert script site packages / 'initools' in result files created sorted result files created keys result 2 script pip 'install' '--upgrade' '--force-reinstall' 'INI Tools' assert result 2 files updated 'upgradeto ... | null | null | null | null | Question:
When does it be at its newest version if --force - reinstall is supplied ?
Code:
@pytest.mark.network
def test_upgrade_force_reinstall_newest(script):
result = script.pip('install', 'INITools')
assert ((script.site_packages / 'initools') in result.files_created), sorted(result.files_created.keys())
res... |
null | null | null | What is containing a zip file ?
| def splitZip(path):
components = os.path.normpath(path).split(os.sep)
for (index, component) in enumerate(components):
if component.endswith('.zip'):
zipPath = os.sep.join(components[0:(index + 1)])
archivePath = ''.join([(x + '/') for x in components[(index + 1):]])
return (zipPath, archivePath)
else:
... | null | null | null | a path
| codeqa | def split Zip path components os path normpath path split os sep for index component in enumerate components if component endswith ' zip' zip Path os sep join components[ 0 index + 1 ] archive Path '' join [ x + '/' for x in components[ index + 1 ]] return zip Path archive Path else return path None
| null | null | null | null | Question:
What is containing a zip file ?
Code:
def splitZip(path):
components = os.path.normpath(path).split(os.sep)
for (index, component) in enumerate(components):
if component.endswith('.zip'):
zipPath = os.sep.join(components[0:(index + 1)])
archivePath = ''.join([(x + '/') for x in components[(index... |
null | null | null | In which direction does a path containing a zip file split ?
| def splitZip(path):
components = os.path.normpath(path).split(os.sep)
for (index, component) in enumerate(components):
if component.endswith('.zip'):
zipPath = os.sep.join(components[0:(index + 1)])
archivePath = ''.join([(x + '/') for x in components[(index + 1):]])
return (zipPath, archivePath)
else:
... | null | null | null | into
| codeqa | def split Zip path components os path normpath path split os sep for index component in enumerate components if component endswith ' zip' zip Path os sep join components[ 0 index + 1 ] archive Path '' join [ x + '/' for x in components[ index + 1 ]] return zip Path archive Path else return path None
| null | null | null | null | Question:
In which direction does a path containing a zip file split ?
Code:
def splitZip(path):
components = os.path.normpath(path).split(os.sep)
for (index, component) in enumerate(components):
if component.endswith('.zip'):
zipPath = os.sep.join(components[0:(index + 1)])
archivePath = ''.join([(x + '/... |
null | null | null | What does the code convert into a failure document for publishing ?
| def _convert_exception(exception):
return {'errmsg': str(exception), 'errtype': exception.__class__.__name__}
| null | null | null | an exception
| codeqa | def convert exception exception return {'errmsg' str exception 'errtype' exception class name }
| null | null | null | null | Question:
What does the code convert into a failure document for publishing ?
Code:
def _convert_exception(exception):
return {'errmsg': str(exception), 'errtype': exception.__class__.__name__}
|
null | null | null | When do the backend setup ?
| @pytest.fixture(scope='module', params=['gpu'])
def backend_gpu(request):
be = get_backend(request)
def cleanup():
be = request.getfixturevalue('backend_gpu')
del be
request.addfinalizer(cleanup)
return be
| null | null | null | before running a test
| codeqa | @pytest fixture scope 'module' params ['gpu'] def backend gpu request be get backend request def cleanup be request getfixturevalue 'backend gpu' del berequest addfinalizer cleanup return be
| null | null | null | null | Question:
When do the backend setup ?
Code:
@pytest.fixture(scope='module', params=['gpu'])
def backend_gpu(request):
be = get_backend(request)
def cleanup():
be = request.getfixturevalue('backend_gpu')
del be
request.addfinalizer(cleanup)
return be
|
null | null | null | How does the code sort them ?
| def sort(seq):
if (len(seq) == 1):
return seq
random.seed()
while (not is_sorted(seq)):
if (len(seq) == 2):
i = 0
j = 1
else:
i = random.randint(0, (len(seq) - 2))
j = random.randint(i, (len(seq) - 1))
(seq[i], seq[j]) = (seq[j], seq[i])
return seq
| null | null | null | in ascending order
| codeqa | def sort seq if len seq 1 return seqrandom seed while not is sorted seq if len seq 2 i 0j 1else i random randint 0 len seq - 2 j random randint i len seq - 1 seq[i] seq[j] seq[j] seq[i] return seq
| null | null | null | null | Question:
How does the code sort them ?
Code:
def sort(seq):
if (len(seq) == 1):
return seq
random.seed()
while (not is_sorted(seq)):
if (len(seq) == 2):
i = 0
j = 1
else:
i = random.randint(0, (len(seq) - 2))
j = random.randint(i, (len(seq) - 1))
(seq[i], seq[j]) = (seq[j], seq[i])
return s... |
null | null | null | What does the code take ?
| def sort(seq):
if (len(seq) == 1):
return seq
random.seed()
while (not is_sorted(seq)):
if (len(seq) == 2):
i = 0
j = 1
else:
i = random.randint(0, (len(seq) - 2))
j = random.randint(i, (len(seq) - 1))
(seq[i], seq[j]) = (seq[j], seq[i])
return seq
| null | null | null | a list of integers
| codeqa | def sort seq if len seq 1 return seqrandom seed while not is sorted seq if len seq 2 i 0j 1else i random randint 0 len seq - 2 j random randint i len seq - 1 seq[i] seq[j] seq[j] seq[i] return seq
| null | null | null | null | Question:
What does the code take ?
Code:
def sort(seq):
if (len(seq) == 1):
return seq
random.seed()
while (not is_sorted(seq)):
if (len(seq) == 2):
i = 0
j = 1
else:
i = random.randint(0, (len(seq) - 2))
j = random.randint(i, (len(seq) - 1))
(seq[i], seq[j]) = (seq[j], seq[i])
return seq
|
null | null | null | What does the code compute ?
| @docstring.dedent_interpd
def psd(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
(Pxx, freqs) = csd(x=x, y=None, NFFT=NFFT, Fs=Fs, detrend=detrend, window=window, noverlap=noverlap, pad_to=pad_to, sides=sides, scale_by_freq=scale_by_freq)
return (Pxx.rea... | null | null | null | the power spectral density
| codeqa | @docstring dedent interpddef psd x NFFT None Fs None detrend None window None noverlap None pad to None sides None scale by freq None Pxx freqs csd x x y None NFFT NFFT Fs Fs detrend detrend window window noverlap noverlap pad to pad to sides sides scale by freq scale by freq return Pxx real freqs
| null | null | null | null | Question:
What does the code compute ?
Code:
@docstring.dedent_interpd
def psd(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None):
(Pxx, freqs) = csd(x=x, y=None, NFFT=NFFT, Fs=Fs, detrend=detrend, window=window, noverlap=noverlap, pad_to=pad_to, sides=sid... |
null | null | null | What does the code update ?
| @route(bp, '/<store_id>', methods=['PUT'])
def update(store_id):
form = UpdateStoreForm()
if form.validate_on_submit():
return _stores.update(_stores.get_or_404(store_id), **request.json)
raise OverholtFormError(form.errors)
| null | null | null | a store
| codeqa | @route bp '/<store id>' methods ['PUT'] def update store id form Update Store Form if form validate on submit return stores update stores get or 404 store id **request json raise Overholt Form Error form errors
| null | null | null | null | Question:
What does the code update ?
Code:
@route(bp, '/<store_id>', methods=['PUT'])
def update(store_id):
form = UpdateStoreForm()
if form.validate_on_submit():
return _stores.update(_stores.get_or_404(store_id), **request.json)
raise OverholtFormError(form.errors)
|
null | null | null | What does decorator call ?
| def silent_permalink(func):
from django.core.urlresolvers import reverse
def inner(*args, **kwargs):
bits = func(*args, **kwargs)
try:
return reverse(bits[0], None, *bits[1:3])
except:
return "javascript:alert('Configure this page URL in the urls.py file');"
return inner
| null | null | null | urlresolvers
| codeqa | def silent permalink func from django core urlresolvers import reversedef inner *args **kwargs bits func *args **kwargs try return reverse bits[ 0 ] None *bits[ 1 3] except return "javascript alert ' Configurethispage UR Lintheurls pyfile' "return inner
| null | null | null | null | Question:
What does decorator call ?
Code:
def silent_permalink(func):
from django.core.urlresolvers import reverse
def inner(*args, **kwargs):
bits = func(*args, **kwargs)
try:
return reverse(bits[0], None, *bits[1:3])
except:
return "javascript:alert('Configure this page URL in the urls.py fi... |
null | null | null | What does the code execute on a superset of its results ?
| def _ExecuteQuery(results, query, filters, orders, index_list):
orders = _GuessOrders(filters, orders)
dsquery = _MakeQuery(query, filters, orders)
if query.property_name_size():
results = _CreateIndexOnlyQueryResults(results, set((order.property() for order in orders)))
return ListCursor(query, dsquery, orders, ... | null | null | null | the query
| codeqa | def Execute Query results query filters orders index list orders Guess Orders filters orders dsquery Make Query query filters orders if query property name size results Create Index Only Query Results results set order property for order in orders return List Cursor query dsquery orders index list datastore query apply... | null | null | null | null | Question:
What does the code execute on a superset of its results ?
Code:
def _ExecuteQuery(results, query, filters, orders, index_list):
orders = _GuessOrders(filters, orders)
dsquery = _MakeQuery(query, filters, orders)
if query.property_name_size():
results = _CreateIndexOnlyQueryResults(results, set((order... |
null | null | null | What defines method under python 2 ?
| def repr_wrapper(klass):
if six.PY2:
if ('__repr__' not in klass.__dict__):
raise ValueError(("@repr_wrapper cannot be applied to %s because it doesn't define __repr__()." % klass.__name__))
klass._repr = klass.__repr__
klass.__repr__ = (lambda self: encodeutils.safe_encode(self._repr()))
return kl... | null | null | null | a decorator
| codeqa | def repr wrapper klass if six PY 2 if ' repr ' not in klass dict raise Value Error "@repr wrappercannotbeappliedto%sbecauseitdoesn'tdefine repr " % klass name klass repr klass repr klass repr lambda self encodeutils safe encode self repr return klass
| null | null | null | null | Question:
What defines method under python 2 ?
Code:
def repr_wrapper(klass):
if six.PY2:
if ('__repr__' not in klass.__dict__):
raise ValueError(("@repr_wrapper cannot be applied to %s because it doesn't define __repr__()." % klass.__name__))
klass._repr = klass.__repr__
klass.__repr__ = (lambd... |
null | null | null | Where does a decorator define method ?
| def repr_wrapper(klass):
if six.PY2:
if ('__repr__' not in klass.__dict__):
raise ValueError(("@repr_wrapper cannot be applied to %s because it doesn't define __repr__()." % klass.__name__))
klass._repr = klass.__repr__
klass.__repr__ = (lambda self: encodeutils.safe_encode(self._repr()))
return kl... | null | null | null | under python 2
| codeqa | def repr wrapper klass if six PY 2 if ' repr ' not in klass dict raise Value Error "@repr wrappercannotbeappliedto%sbecauseitdoesn'tdefine repr " % klass name klass repr klass repr klass repr lambda self encodeutils safe encode self repr return klass
| null | null | null | null | Question:
Where does a decorator define method ?
Code:
def repr_wrapper(klass):
if six.PY2:
if ('__repr__' not in klass.__dict__):
raise ValueError(("@repr_wrapper cannot be applied to %s because it doesn't define __repr__()." % klass.__name__))
klass._repr = klass.__repr__
klass.__repr__ = (lam... |
null | null | null | When are characters represented ?
| def search_list(list_provided):
for i in range((len(list_provided) - 1)):
if ((not (list_provided[i] in list_provided[(i + 1):])) and (not (list_provided[i] in list_provided[:i]))):
'If the same number is not present before or after in the list then\n return the number'
return str(li... | null | null | null | only once
| codeqa | def search list list provided for i in range len list provided - 1 if not list provided[i] in list provided[ i + 1 ] and not list provided[i] in list provided[ i] ' Ifthesamenumberisnotpresentbeforeorafterinthelistthen\nreturnthenumber'return str list provided[i] break
| null | null | null | null | Question:
When are characters represented ?
Code:
def search_list(list_provided):
for i in range((len(list_provided) - 1)):
if ((not (list_provided[i] in list_provided[(i + 1):])) and (not (list_provided[i] in list_provided[:i]))):
'If the same number is not present before or after in the list th... |
null | null | null | What does the code get ?
| def get_comment_permalink(comment, anchor_pattern=None):
if anchor_pattern:
return comment.get_absolute_url(anchor_pattern)
return comment.get_absolute_url()
| null | null | null | the permalink for a comment
| codeqa | def get comment permalink comment anchor pattern None if anchor pattern return comment get absolute url anchor pattern return comment get absolute url
| null | null | null | null | Question:
What does the code get ?
Code:
def get_comment_permalink(comment, anchor_pattern=None):
if anchor_pattern:
return comment.get_absolute_url(anchor_pattern)
return comment.get_absolute_url()
|
null | null | null | What strips string ?
| def full_strip(string):
string = _stripper_double_spaces.sub(' ', string)
string = _stripper_double_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
string = _stripper_space_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
return string.strip(' ')
| null | null | null | string
| codeqa | def full strip string string stripper double spaces sub '' string string stripper double ellipsis sub consts CHAR ELLIPSIS string string stripper space ellipsis sub consts CHAR ELLIPSIS string return string strip ''
| null | null | null | null | Question:
What strips string ?
Code:
def full_strip(string):
string = _stripper_double_spaces.sub(' ', string)
string = _stripper_double_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
string = _stripper_space_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
return string.strip(' ')
|
null | null | null | What do string strip ?
| def full_strip(string):
string = _stripper_double_spaces.sub(' ', string)
string = _stripper_double_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
string = _stripper_space_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
return string.strip(' ')
| null | null | null | string
| codeqa | def full strip string string stripper double spaces sub '' string string stripper double ellipsis sub consts CHAR ELLIPSIS string string stripper space ellipsis sub consts CHAR ELLIPSIS string return string strip ''
| null | null | null | null | Question:
What do string strip ?
Code:
def full_strip(string):
string = _stripper_double_spaces.sub(' ', string)
string = _stripper_double_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
string = _stripper_space_ellipsis.sub(consts.CHAR_ELLIPSIS, string)
return string.strip(' ')
|
null | null | null | What does the code add to an application i d if necessary ?
| def AppIdWithDefaultPartition(app_id, default_partition):
if (not default_partition):
return app_id
if ('~' in app_id):
return app_id
return ((default_partition + '~') + app_id)
| null | null | null | a partition
| codeqa | def App Id With Default Partition app id default partition if not default partition return app idif '~' in app id return app idreturn default partition + '~' + app id
| null | null | null | null | Question:
What does the code add to an application i d if necessary ?
Code:
def AppIdWithDefaultPartition(app_id, default_partition):
if (not default_partition):
return app_id
if ('~' in app_id):
return app_id
return ((default_partition + '~') + app_id)
|
null | null | null | What does the code get ?
| def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
if (len(loop) < 3):
return [loop]
derivation = SegmentDerivation(elementNode, prefix)
if (derivation.path == getSegmentPathDefault()):
return [loop]
path = getXNormalizedVector3Path(derivation.path)
if euclidean.getIsWiddershinsByVector3(lo... | null | null | null | segment loop
| codeqa | def get Manipulated Paths close element Node loop prefix side Length if len loop < 3 return [loop]derivation Segment Derivation element Node prefix if derivation path get Segment Path Default return [loop]path get X Normalized Vector 3 Path derivation path if euclidean get Is Widdershins By Vector 3 loop path path[ -1 ... | null | null | null | null | Question:
What does the code get ?
Code:
def getManipulatedPaths(close, elementNode, loop, prefix, sideLength):
if (len(loop) < 3):
return [loop]
derivation = SegmentDerivation(elementNode, prefix)
if (derivation.path == getSegmentPathDefault()):
return [loop]
path = getXNormalizedVector3Path(derivation.pat... |
null | null | null | What splits into a title ?
| def split_title_year(title):
if (not title):
return
if (not re.search(u'\\d{4}', title)):
return (title, None)
match = re.search(u'(.*?)\\(?(\\d{4})?\\)?$', title)
title = match.group(1).strip()
if match.group(2):
year = int(match.group(2))
else:
year = None
return (title, year)
| null | null | null | title containing a year
| codeqa | def split title year title if not title returnif not re search u'\\d{ 4 }' title return title None match re search u' *? \\ ? \\d{ 4 } ?\\ ?$' title title match group 1 strip if match group 2 year int match group 2 else year Nonereturn title year
| null | null | null | null | Question:
What splits into a title ?
Code:
def split_title_year(title):
if (not title):
return
if (not re.search(u'\\d{4}', title)):
return (title, None)
match = re.search(u'(.*?)\\(?(\\d{4})?\\)?$', title)
title = match.group(1).strip()
if match.group(2):
year = int(match.group(2))
else:
year = None
... |
null | null | null | When is an error raised ?
| def test_nearmiss_wrong_version():
version = 1000
nm3 = NearMiss(version=version, random_state=RND_SEED)
assert_raises(ValueError, nm3.fit_sample, X, Y)
| null | null | null | when the version is unknown
| codeqa | def test nearmiss wrong version version 1000 nm 3 Near Miss version version random state RND SEED assert raises Value Error nm 3 fit sample X Y
| null | null | null | null | Question:
When is an error raised ?
Code:
def test_nearmiss_wrong_version():
version = 1000
nm3 = NearMiss(version=version, random_state=RND_SEED)
assert_raises(ValueError, nm3.fit_sample, X, Y)
|
null | null | null | For what purpose does decorator add headers to a response ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
| null | null | null | so that it will never be cached
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wrapped view func
| null | null | null | null | Question:
For what purpose does decorator add headers to a response ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
|
null | null | null | What adds headers to a response so that it will never be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
| null | null | null | decorator
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wrapped view func
| null | null | null | null | Question:
What adds headers to a response so that it will never be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
|
null | null | null | When will it be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
| null | null | null | never
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wrapped view func
| null | null | null | null | Question:
When will it be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
|
null | null | null | What does decorator add to a response so that it will never be cached ?
| def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
| null | null | null | headers
| codeqa | def never cache view func def wrapped view func request *args **kwargs response view func request *args **kwargs add never cache headers response return responsereturn wrapped view func
| null | null | null | null | Question:
What does decorator add to a response so that it will never be cached ?
Code:
def never_cache(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
add_never_cache_headers(response)
return response
return _wrapped_view_func
|
null | null | null | What does this return ?
| def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_homes = [(('APPDATA',), None), (('USERPROFILE',), app_data), (('HOMEDRIVE', 'HOM... | null | null | null | the python_egg_cache environment variable
| codeqa | def pkg resources get default cache egg cache compat getenv 'PYTHON EGG CACHE' if egg cache is not None return egg cacheif os name 'nt' return os path expanduser '~/ python-eggs' app data ' Application Data'app homes [ 'APPDATA' None 'USERPROFILE' app data 'HOMEDRIVE' 'HOMEPATH' app data 'HOMEPATH' app data 'HOME' None... | null | null | null | null | Question:
What does this return ?
Code:
def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_homes = [(('APPDATA',), None), (('US... |
null | null | null | What returns the python_egg_cache environment variable ?
| def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_homes = [(('APPDATA',), None), (('USERPROFILE',), app_data), (('HOMEDRIVE', 'HOM... | null | null | null | this
| codeqa | def pkg resources get default cache egg cache compat getenv 'PYTHON EGG CACHE' if egg cache is not None return egg cacheif os name 'nt' return os path expanduser '~/ python-eggs' app data ' Application Data'app homes [ 'APPDATA' None 'USERPROFILE' app data 'HOMEDRIVE' 'HOMEPATH' app data 'HOMEPATH' app data 'HOME' None... | null | null | null | null | Question:
What returns the python_egg_cache environment variable ?
Code:
def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_hom... |
null | null | null | What does the code determine ?
| def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_homes = [(('APPDATA',), None), (('USERPROFILE',), app_data), (('HOMEDRIVE', 'HOM... | null | null | null | the default cache location
| codeqa | def pkg resources get default cache egg cache compat getenv 'PYTHON EGG CACHE' if egg cache is not None return egg cacheif os name 'nt' return os path expanduser '~/ python-eggs' app data ' Application Data'app homes [ 'APPDATA' None 'USERPROFILE' app data 'HOMEDRIVE' 'HOMEPATH' app data 'HOMEPATH' app data 'HOME' None... | null | null | null | null | Question:
What does the code determine ?
Code:
def pkg_resources_get_default_cache():
egg_cache = compat.getenv('PYTHON_EGG_CACHE')
if (egg_cache is not None):
return egg_cache
if (os.name != 'nt'):
return os.path.expanduser('~/.python-eggs')
app_data = 'Application Data'
app_homes = [(('APPDATA',), None)... |
null | null | null | What does the code append to the list of the virtual ancestors ?
| def append(a, vancestors):
add = True
for (j, va) in enumerate(vancestors):
if issubclass(va, a):
add = False
break
if issubclass(a, va):
vancestors[j] = a
add = False
if add:
vancestors.append(a)
| null | null | null | a
| codeqa | def append a vancestors add Truefor j va in enumerate vancestors if issubclass va a add Falsebreakif issubclass a va vancestors[j] aadd Falseif add vancestors append a
| null | null | null | null | Question:
What does the code append to the list of the virtual ancestors ?
Code:
def append(a, vancestors):
add = True
for (j, va) in enumerate(vancestors):
if issubclass(va, a):
add = False
break
if issubclass(a, va):
vancestors[j] = a
add = False
if add:
vancestors.append(a)
|
null | null | null | What does the code remove from the request ?
| def logout(request):
user = getattr(request, 'user', None)
if (hasattr(user, 'is_authenticated') and (not user.is_authenticated())):
user = None
user_logged_out.send(sender=user.__class__, request=request, user=user)
language = request.session.get('django_language')
request.session.flush()
if (language is not N... | null | null | null | the authenticated users i d
| codeqa | def logout request user getattr request 'user' None if hasattr user 'is authenticated' and not user is authenticated user Noneuser logged out send sender user class request request user user language request session get 'django language' request session flush if language is not None request session['django language'] l... | null | null | null | null | Question:
What does the code remove from the request ?
Code:
def logout(request):
user = getattr(request, 'user', None)
if (hasattr(user, 'is_authenticated') and (not user.is_authenticated())):
user = None
user_logged_out.send(sender=user.__class__, request=request, user=user)
language = request.session.get('... |
null | null | null | What does the code flush ?
| def logout(request):
user = getattr(request, 'user', None)
if (hasattr(user, 'is_authenticated') and (not user.is_authenticated())):
user = None
user_logged_out.send(sender=user.__class__, request=request, user=user)
language = request.session.get('django_language')
request.session.flush()
if (language is not N... | null | null | null | their session data
| codeqa | def logout request user getattr request 'user' None if hasattr user 'is authenticated' and not user is authenticated user Noneuser logged out send sender user class request request user user language request session get 'django language' request session flush if language is not None request session['django language'] l... | null | null | null | null | Question:
What does the code flush ?
Code:
def logout(request):
user = getattr(request, 'user', None)
if (hasattr(user, 'is_authenticated') and (not user.is_authenticated())):
user = None
user_logged_out.send(sender=user.__class__, request=request, user=user)
language = request.session.get('django_language')
... |
null | null | null | For what purpose does any value convert to a string ?
| def render_value_in_context(value, context):
value = template_localtime(value, use_tz=context.use_tz)
value = localize(value, use_l10n=context.use_l10n)
value = force_text(value)
if ((context.autoescape and (not isinstance(value, SafeData))) or isinstance(value, EscapeData)):
return escape(value)
else:
return ... | null | null | null | to become part of a rendered template
| codeqa | def render value in context value context value template localtime value use tz context use tz value localize value use l10 n context use l10 n value force text value if context autoescape and not isinstance value Safe Data or isinstance value Escape Data return escape value else return value
| null | null | null | null | Question:
For what purpose does any value convert to a string ?
Code:
def render_value_in_context(value, context):
value = template_localtime(value, use_tz=context.use_tz)
value = localize(value, use_l10n=context.use_l10n)
value = force_text(value)
if ((context.autoescape and (not isinstance(value, SafeData))) ... |
null | null | null | What does the code get from attribute dictionary ?
| def getGeometryOutput(elementNode):
derivation = VoronoiDerivation(elementNode)
complexPath = euclidean.getConcatenatedList(euclidean.getComplexPaths(derivation.target))
geometryOutput = []
topRight = derivation.inradius
squareLoop = euclidean.getSquareLoopWiddershins((- topRight), topRight)
loopComplexes = []
f... | null | null | null | vector3 vertexes
| codeqa | def get Geometry Output element Node derivation Voronoi Derivation element Node complex Path euclidean get Concatenated List euclidean get Complex Paths derivation target geometry Output []top Right derivation inradiussquare Loop euclidean get Square Loop Widdershins - top Right top Right loop Complexes []for point Ind... | null | null | null | null | Question:
What does the code get from attribute dictionary ?
Code:
def getGeometryOutput(elementNode):
derivation = VoronoiDerivation(elementNode)
complexPath = euclidean.getConcatenatedList(euclidean.getComplexPaths(derivation.target))
geometryOutput = []
topRight = derivation.inradius
squareLoop = euclidean.... |
null | null | null | What does the code return ?
| def get_valid_filename(s):
s = s.strip().replace(' ', '_')
return re.sub('[^-A-Za-z0-9_.]', '', s)
| null | null | null | the given string converted to a string that can be used for a clean filename
| codeqa | def get valid filename s s s strip replace '' ' ' return re sub '[^-A- Za-z 0 - 9 ]' '' s
| null | null | null | null | Question:
What does the code return ?
Code:
def get_valid_filename(s):
s = s.strip().replace(' ', '_')
return re.sub('[^-A-Za-z0-9_.]', '', s)
|
null | null | null | What does the code send ?
| def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25, reactor=reactor, username=None, password=None, requireAuthentication=False, requireTransportSecurity=False):
if (not hasattr(msg, 'read')):
msg = StringIO(str(msg))
def cancel(d):
'\n Cancel the L{twisted.mail.smtp.sendmail... | null | null | null | an email
| codeqa | def sendmail smtphost from addr to addrs msg sender Domain Name None port 25 reactor reactor username None password None require Authentication False require Transport Security False if not hasattr msg 'read' msg String IO str msg def cancel d '\n Cancelthe L{twisted mail smtp sendmail}call tellthefactorynotto\nretryan... | null | null | null | null | Question:
What does the code send ?
Code:
def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25, reactor=reactor, username=None, password=None, requireAuthentication=False, requireTransportSecurity=False):
if (not hasattr(msg, 'read')):
msg = StringIO(str(msg))
def cancel(d):
'\n ... |
null | null | null | What does the code delete ?
| def DeleteOldFeedItems(client, feed_item_ids, feed):
if (not feed_item_ids):
return
feed_item_service = client.GetService('FeedItemService', 'v201609')
operations = [{'operator': 'REMOVE', 'operand': {'feedId': feed['id'], 'feedItemId': feed_item_id}} for feed_item_id in feed_item_ids]
feed_item_service.mutate(op... | null | null | null | the old feed items for which extension settings have been created
| codeqa | def Delete Old Feed Items client feed item ids feed if not feed item ids returnfeed item service client Get Service ' Feed Item Service' 'v 201609 ' operations [{'operator' 'REMOVE' 'operand' {'feed Id' feed['id'] 'feed Item Id' feed item id}} for feed item id in feed item ids]feed item service mutate operations
| null | null | null | null | Question:
What does the code delete ?
Code:
def DeleteOldFeedItems(client, feed_item_ids, feed):
if (not feed_item_ids):
return
feed_item_service = client.GetService('FeedItemService', 'v201609')
operations = [{'operator': 'REMOVE', 'operand': {'feedId': feed['id'], 'feedItemId': feed_item_id}} for feed_item_i... |
null | null | null | How do the source directory copy to the destination ?
| def recursive_copy(source, dest):
for (root, _, files) in os.walk(source):
path_from_source = root.replace(source, '').lstrip('/')
target_directory = os.path.join(dest, path_from_source)
if (not os.path.exists(target_directory)):
os.makedirs(target_directory)
for name in files:
file_path_from_source = os... | null | null | null | recursively
| codeqa | def recursive copy source dest for root files in os walk source path from source root replace source '' lstrip '/' target directory os path join dest path from source if not os path exists target directory os makedirs target directory for name in files file path from source os path join source path from source name tar... | null | null | null | null | Question:
How do the source directory copy to the destination ?
Code:
def recursive_copy(source, dest):
for (root, _, files) in os.walk(source):
path_from_source = root.replace(source, '').lstrip('/')
target_directory = os.path.join(dest, path_from_source)
if (not os.path.exists(target_directory)):
os.mak... |
null | null | null | What is used to speed up the searching ?
| def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
pass
return 0
| null | null | null | special words using
| codeqa | def count special lines word filename invert False try cmd ['grep' '-c' '-E']if invert cmd append '-v' cmd extend [word filename] out subprocess Popen cmd stdout subprocess PIPE return int out communicate [0 ] split [0 ] except passreturn 0
| null | null | null | null | Question:
What is used to speed up the searching ?
Code:
def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
exce... |
null | null | null | What do special words use ?
| def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
pass
return 0
| null | null | null | the grep tool grep
| codeqa | def count special lines word filename invert False try cmd ['grep' '-c' '-E']if invert cmd append '-v' cmd extend [word filename] out subprocess Popen cmd stdout subprocess PIPE return int out communicate [0 ] split [0 ] except passreturn 0
| null | null | null | null | Question:
What do special words use ?
Code:
def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
pass
r... |
null | null | null | How does the code search for special words ?
| def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
pass
return 0
| null | null | null | using the grep tool grep
| codeqa | def count special lines word filename invert False try cmd ['grep' '-c' '-E']if invert cmd append '-v' cmd extend [word filename] out subprocess Popen cmd stdout subprocess PIPE return int out communicate [0 ] split [0 ] except passreturn 0
| null | null | null | null | Question:
How does the code search for special words ?
Code:
def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
... |
null | null | null | What is using the grep tool grep ?
| def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
pass
return 0
| null | null | null | special words
| codeqa | def count special lines word filename invert False try cmd ['grep' '-c' '-E']if invert cmd append '-v' cmd extend [word filename] out subprocess Popen cmd stdout subprocess PIPE return int out communicate [0 ] split [0 ] except passreturn 0
| null | null | null | null | Question:
What is using the grep tool grep ?
Code:
def count_special_lines(word, filename, invert=False):
try:
cmd = ['grep', '-c', '-E']
if invert:
cmd.append('-v')
cmd.extend([word, filename])
out = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return int(out.communicate()[0].split()[0])
except:
... |
null | null | null | What do a string contain ?
| def literal_eval(node_or_string):
_safe_names = {'None': None, 'True': True, 'False': False}
if isinstance(node_or_string, basestring):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, Expression):
node_or_string = node_or_string.body
def _convert(node):
if isinstance(node, St... | null | null | null | a python expression
| codeqa | def literal eval node or string safe names {' None' None ' True' True ' False' False}if isinstance node or string basestring node or string parse node or string mode 'eval' if isinstance node or string Expression node or string node or string bodydef convert node if isinstance node Str return node selif isinstance node... | null | null | null | null | Question:
What do a string contain ?
Code:
def literal_eval(node_or_string):
_safe_names = {'None': None, 'True': True, 'False': False}
if isinstance(node_or_string, basestring):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, Expression):
node_or_string = node_or_string.bod... |
null | null | null | How do an expression node or a string containing a python expression evaluate ?
| def literal_eval(node_or_string):
_safe_names = {'None': None, 'True': True, 'False': False}
if isinstance(node_or_string, basestring):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, Expression):
node_or_string = node_or_string.body
def _convert(node):
if isinstance(node, St... | null | null | null | safely
| codeqa | def literal eval node or string safe names {' None' None ' True' True ' False' False}if isinstance node or string basestring node or string parse node or string mode 'eval' if isinstance node or string Expression node or string node or string bodydef convert node if isinstance node Str return node selif isinstance node... | null | null | null | null | Question:
How do an expression node or a string containing a python expression evaluate ?
Code:
def literal_eval(node_or_string):
_safe_names = {'None': None, 'True': True, 'False': False}
if isinstance(node_or_string, basestring):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.