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
For what purpose does all the threads fetch ?
def get_threads(exploration_id): thread_models = feedback_models.FeedbackThreadModel.get_threads(exploration_id) return [_get_thread_from_model(model) for model in thread_models]
null
null
null
for the given exploration i d
codeqa
def get threads exploration id thread models feedback models Feedback Thread Model get threads exploration id return [ get thread from model model for model in thread models]
null
null
null
null
Question: For what purpose does all the threads fetch ? Code: def get_threads(exploration_id): thread_models = feedback_models.FeedbackThreadModel.get_threads(exploration_id) return [_get_thread_from_model(model) for model in thread_models]
null
null
null
Does the code stop a scheduled task ?
def stop(name, location='\\'): if (name not in list_tasks(location)): return '{0} not found in {1}'.format(name, location) pythoncom.CoInitialize() task_service = win32com.client.Dispatch('Schedule.Service') task_service.Connect() task_folder = task_service.GetFolder(location) task = task_folder.GetTask(name) try: task.Stop(0) return True except pythoncom.com_error as error: return False
null
null
null
Yes
codeqa
def stop name location '\\' if name not in list tasks location return '{ 0 }notfoundin{ 1 }' format name location pythoncom Co Initialize task service win 32 com client Dispatch ' Schedule Service' task service Connect task folder task service Get Folder location task task folder Get Task name try task Stop 0 return Trueexcept pythoncom com error as error return False
null
null
null
null
Question: Does the code stop a scheduled task ? Code: def stop(name, location='\\'): if (name not in list_tasks(location)): return '{0} not found in {1}'.format(name, location) pythoncom.CoInitialize() task_service = win32com.client.Dispatch('Schedule.Service') task_service.Connect() task_folder = task_service.GetFolder(location) task = task_folder.GetTask(name) try: task.Stop(0) return True except pythoncom.com_error as error: return False
null
null
null
What does the code stop ?
def stop(name, location='\\'): if (name not in list_tasks(location)): return '{0} not found in {1}'.format(name, location) pythoncom.CoInitialize() task_service = win32com.client.Dispatch('Schedule.Service') task_service.Connect() task_folder = task_service.GetFolder(location) task = task_folder.GetTask(name) try: task.Stop(0) return True except pythoncom.com_error as error: return False
null
null
null
a scheduled task
codeqa
def stop name location '\\' if name not in list tasks location return '{ 0 }notfoundin{ 1 }' format name location pythoncom Co Initialize task service win 32 com client Dispatch ' Schedule Service' task service Connect task folder task service Get Folder location task task folder Get Task name try task Stop 0 return Trueexcept pythoncom com error as error return False
null
null
null
null
Question: What does the code stop ? Code: def stop(name, location='\\'): if (name not in list_tasks(location)): return '{0} not found in {1}'.format(name, location) pythoncom.CoInitialize() task_service = win32com.client.Dispatch('Schedule.Service') task_service.Connect() task_folder = task_service.GetFolder(location) task = task_folder.GetTask(name) try: task.Stop(0) return True except pythoncom.com_error as error: return False
null
null
null
How does the code evaluate a score ?
def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
by cross - validation
codeqa
def cross val score estimator X y None groups None scoring None cv None n jobs 1 verbose 0 fit params None pre dispatch '2 *n jobs' X y groups indexable X y groups cv check cv cv y classifier is classifier estimator scorer check scoring estimator scoring scoring parallel Parallel n jobs n jobs verbose verbose pre dispatch pre dispatch scores parallel delayed fit and score clone estimator X y scorer train test verbose None fit params for train test in cv split X y groups return np array scores [ 0]
null
null
null
null
Question: How does the code evaluate a score ? Code: def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
What does the code evaluate by cross - validation ?
def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
a score
codeqa
def cross val score estimator X y None groups None scoring None cv None n jobs 1 verbose 0 fit params None pre dispatch '2 *n jobs' X y groups indexable X y groups cv check cv cv y classifier is classifier estimator scorer check scoring estimator scoring scoring parallel Parallel n jobs n jobs verbose verbose pre dispatch pre dispatch scores parallel delayed fit and score clone estimator X y scorer train test verbose None fit params for train test in cv split X y groups return np array scores [ 0]
null
null
null
null
Question: What does the code evaluate by cross - validation ? Code: def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
Does the code evaluate a score by cross - validation ?
def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
Yes
codeqa
def cross val score estimator X y None groups None scoring None cv None n jobs 1 verbose 0 fit params None pre dispatch '2 *n jobs' X y groups indexable X y groups cv check cv cv y classifier is classifier estimator scorer check scoring estimator scoring scoring parallel Parallel n jobs n jobs verbose verbose pre dispatch pre dispatch scores parallel delayed fit and score clone estimator X y scorer train test verbose None fit params for train test in cv split X y groups return np array scores [ 0]
null
null
null
null
Question: Does the code evaluate a score by cross - validation ? Code: def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
What read in the ?
def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
by cross - validation
codeqa
def cross val score estimator X y None groups None scoring None cv None n jobs 1 verbose 0 fit params None pre dispatch '2 *n jobs' X y groups indexable X y groups cv check cv cv y classifier is classifier estimator scorer check scoring estimator scoring scoring parallel Parallel n jobs n jobs verbose verbose pre dispatch pre dispatch scores parallel delayed fit and score clone estimator X y scorer train test verbose None fit params for train test in cv split X y groups return np array scores [ 0]
null
null
null
null
Question: What read in the ? Code: def cross_val_score(estimator, X, y=None, groups=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): (X, y, groups) = indexable(X, y, groups) cv = check_cv(cv, y, classifier=is_classifier(estimator)) scorer = check_scoring(estimator, scoring=scoring) parallel = Parallel(n_jobs=n_jobs, verbose=verbose, pre_dispatch=pre_dispatch) scores = parallel((delayed(_fit_and_score)(clone(estimator), X, y, scorer, train, test, verbose, None, fit_params) for (train, test) in cv.split(X, y, groups))) return np.array(scores)[:, 0]
null
null
null
How do data assign to servers ?
def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
by using first letters
codeqa
def alpha shard word if word[ 0 ] in 'abcdef' return 'server 0 'elif word[ 0 ] in 'ghijklm' return 'server 1 'elif word[ 0 ] in 'nopqrs' return 'server 2 'else return 'server 3 '
null
null
null
null
Question: How do data assign to servers ? Code: def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
What does the code do ?
def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
a poor job of assigning data to servers by using first letters
codeqa
def alpha shard word if word[ 0 ] in 'abcdef' return 'server 0 'elif word[ 0 ] in 'ghijklm' return 'server 1 'elif word[ 0 ] in 'nopqrs' return 'server 2 'else return 'server 3 '
null
null
null
null
Question: What does the code do ? Code: def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
Does the code do a poor job of assigning data to servers by using first letters ?
def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
Yes
codeqa
def alpha shard word if word[ 0 ] in 'abcdef' return 'server 0 'elif word[ 0 ] in 'ghijklm' return 'server 1 'elif word[ 0 ] in 'nopqrs' return 'server 2 'else return 'server 3 '
null
null
null
null
Question: Does the code do a poor job of assigning data to servers by using first letters ? Code: def alpha_shard(word): if (word[0] in 'abcdef'): return 'server0' elif (word[0] in 'ghijklm'): return 'server1' elif (word[0] in 'nopqrs'): return 'server2' else: return 'server3'
null
null
null
Does the code do the inverse of the conversion done by split_header_words ?
def join_header_words(lists): headers = [] for pairs in lists: attr = [] for (k, v) in pairs: if (v is not None): if (not re.search('^\\w+$', v)): v = HEADER_JOIN_ESCAPE_RE.sub('\\\\\\1', v) v = ('"%s"' % v) k = ('%s=%s' % (k, v)) attr.append(k) if attr: headers.append('; '.join(attr)) return ', '.join(headers)
null
null
null
Yes
codeqa
def join header words lists headers []for pairs in lists attr []for k v in pairs if v is not None if not re search '^\\w+$' v v HEADER JOIN ESCAPE RE sub '\\\\\\ 1 ' v v '"%s"' % v k '%s %s' % k v attr append k if attr headers append ' ' join attr return ' ' join headers
null
null
null
null
Question: Does the code do the inverse of the conversion done by split_header_words ? Code: def join_header_words(lists): headers = [] for pairs in lists: attr = [] for (k, v) in pairs: if (v is not None): if (not re.search('^\\w+$', v)): v = HEADER_JOIN_ESCAPE_RE.sub('\\\\\\1', v) v = ('"%s"' % v) k = ('%s=%s' % (k, v)) attr.append(k) if attr: headers.append('; '.join(attr)) return ', '.join(headers)
null
null
null
What does the code do ?
def join_header_words(lists): headers = [] for pairs in lists: attr = [] for (k, v) in pairs: if (v is not None): if (not re.search('^\\w+$', v)): v = HEADER_JOIN_ESCAPE_RE.sub('\\\\\\1', v) v = ('"%s"' % v) k = ('%s=%s' % (k, v)) attr.append(k) if attr: headers.append('; '.join(attr)) return ', '.join(headers)
null
null
null
the inverse of the conversion done by split_header_words
codeqa
def join header words lists headers []for pairs in lists attr []for k v in pairs if v is not None if not re search '^\\w+$' v v HEADER JOIN ESCAPE RE sub '\\\\\\ 1 ' v v '"%s"' % v k '%s %s' % k v attr append k if attr headers append ' ' join attr return ' ' join headers
null
null
null
null
Question: What does the code do ? Code: def join_header_words(lists): headers = [] for pairs in lists: attr = [] for (k, v) in pairs: if (v is not None): if (not re.search('^\\w+$', v)): v = HEADER_JOIN_ESCAPE_RE.sub('\\\\\\1', v) v = ('"%s"' % v) k = ('%s=%s' % (k, v)) attr.append(k) if attr: headers.append('; '.join(attr)) return ', '.join(headers)
null
null
null
Does the code convert a glance i d to an internal i d ?
@memoize def glance_id_to_id(context, glance_id): if (not glance_id): return try: return objects.S3ImageMapping.get_by_uuid(context, glance_id).id except exception.NotFound: s3imap = objects.S3ImageMapping(context, uuid=glance_id) s3imap.create() return s3imap.id
null
null
null
Yes
codeqa
@memoizedef glance id to id context glance id if not glance id returntry return objects S3 Image Mapping get by uuid context glance id idexcept exception Not Found s3 imap objects S3 Image Mapping context uuid glance id s3 imap create return s3 imap id
null
null
null
null
Question: Does the code convert a glance i d to an internal i d ? Code: @memoize def glance_id_to_id(context, glance_id): if (not glance_id): return try: return objects.S3ImageMapping.get_by_uuid(context, glance_id).id except exception.NotFound: s3imap = objects.S3ImageMapping(context, uuid=glance_id) s3imap.create() return s3imap.id
null
null
null
What does the code convert to an internal i d ?
@memoize def glance_id_to_id(context, glance_id): if (not glance_id): return try: return objects.S3ImageMapping.get_by_uuid(context, glance_id).id except exception.NotFound: s3imap = objects.S3ImageMapping(context, uuid=glance_id) s3imap.create() return s3imap.id
null
null
null
a glance i d
codeqa
@memoizedef glance id to id context glance id if not glance id returntry return objects S3 Image Mapping get by uuid context glance id idexcept exception Not Found s3 imap objects S3 Image Mapping context uuid glance id s3 imap create return s3 imap id
null
null
null
null
Question: What does the code convert to an internal i d ? Code: @memoize def glance_id_to_id(context, glance_id): if (not glance_id): return try: return objects.S3ImageMapping.get_by_uuid(context, glance_id).id except exception.NotFound: s3imap = objects.S3ImageMapping(context, uuid=glance_id) s3imap.create() return s3imap.id
null
null
null
Does the code start a new ?
def start_map(name, handler_spec, reader_spec, reader_parameters, shard_count, mapreduce_parameters={}, base_path='/mapreduce', queue_name='default', eta=None, countdown=None, _app=None): mapper_spec = model.MapperSpec(handler_spec, reader_spec, reader_parameters, shard_count) return handlers.StartJobHandler._start_map(name, mapper_spec, mapreduce_parameters, base_path=base_path, queue_name=queue_name, eta=eta, countdown=countdown, _app=_app)
null
null
null
Yes
codeqa
def start map name handler spec reader spec reader parameters shard count mapreduce parameters {} base path '/mapreduce' queue name 'default' eta None countdown None app None mapper spec model Mapper Spec handler spec reader spec reader parameters shard count return handlers Start Job Handler start map name mapper spec mapreduce parameters base path base path queue name queue name eta eta countdown countdown app app
null
null
null
null
Question: Does the code start a new ? Code: def start_map(name, handler_spec, reader_spec, reader_parameters, shard_count, mapreduce_parameters={}, base_path='/mapreduce', queue_name='default', eta=None, countdown=None, _app=None): mapper_spec = model.MapperSpec(handler_spec, reader_spec, reader_parameters, shard_count) return handlers.StartJobHandler._start_map(name, mapper_spec, mapreduce_parameters, base_path=base_path, queue_name=queue_name, eta=eta, countdown=countdown, _app=_app)
null
null
null
What does the code start ?
def start_map(name, handler_spec, reader_spec, reader_parameters, shard_count, mapreduce_parameters={}, base_path='/mapreduce', queue_name='default', eta=None, countdown=None, _app=None): mapper_spec = model.MapperSpec(handler_spec, reader_spec, reader_parameters, shard_count) return handlers.StartJobHandler._start_map(name, mapper_spec, mapreduce_parameters, base_path=base_path, queue_name=queue_name, eta=eta, countdown=countdown, _app=_app)
null
null
null
a new
codeqa
def start map name handler spec reader spec reader parameters shard count mapreduce parameters {} base path '/mapreduce' queue name 'default' eta None countdown None app None mapper spec model Mapper Spec handler spec reader spec reader parameters shard count return handlers Start Job Handler start map name mapper spec mapreduce parameters base path base path queue name queue name eta eta countdown countdown app app
null
null
null
null
Question: What does the code start ? Code: def start_map(name, handler_spec, reader_spec, reader_parameters, shard_count, mapreduce_parameters={}, base_path='/mapreduce', queue_name='default', eta=None, countdown=None, _app=None): mapper_spec = model.MapperSpec(handler_spec, reader_spec, reader_parameters, shard_count) return handlers.StartJobHandler._start_map(name, mapper_spec, mapreduce_parameters, base_path=base_path, queue_name=queue_name, eta=eta, countdown=countdown, _app=_app)
null
null
null
In which direction do settings read ?
def getReadRepository(repository): text = archive.getFileText(archive.getProfilesPath(getProfileBaseName(repository)), False) if (text == ''): if (repository.baseNameSynonym != None): text = archive.getFileText(archive.getProfilesPath(getProfileName(repository.baseNameSynonym, repository)), False) if (text == ''): print ('The default %s will be written in the .skeinforge folder in the home directory.' % repository.title.lower()) text = archive.getFileText(getProfilesDirectoryInAboveDirectory(getProfileBaseName(repository)), False) if (text != ''): readSettingsFromText(repository, text) writeSettings(repository) temporaryApplyOverrides(repository) return repository readSettingsFromText(repository, text) temporaryApplyOverrides(repository) return repository
null
null
null
from a file
codeqa
def get Read Repository repository text archive get File Text archive get Profiles Path get Profile Base Name repository False if text '' if repository base Name Synonym None text archive get File Text archive get Profiles Path get Profile Name repository base Name Synonym repository False if text '' print ' Thedefault%swillbewritteninthe skeinforgefolderinthehomedirectory ' % repository title lower text archive get File Text get Profiles Directory In Above Directory get Profile Base Name repository False if text '' read Settings From Text repository text write Settings repository temporary Apply Overrides repository return repositoryread Settings From Text repository text temporary Apply Overrides repository return repository
null
null
null
null
Question: In which direction do settings read ? Code: def getReadRepository(repository): text = archive.getFileText(archive.getProfilesPath(getProfileBaseName(repository)), False) if (text == ''): if (repository.baseNameSynonym != None): text = archive.getFileText(archive.getProfilesPath(getProfileName(repository.baseNameSynonym, repository)), False) if (text == ''): print ('The default %s will be written in the .skeinforge folder in the home directory.' % repository.title.lower()) text = archive.getFileText(getProfilesDirectoryInAboveDirectory(getProfileBaseName(repository)), False) if (text != ''): readSettingsFromText(repository, text) writeSettings(repository) temporaryApplyOverrides(repository) return repository readSettingsFromText(repository, text) temporaryApplyOverrides(repository) return repository
null
null
null
What can the system bind ?
def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
an ipv6 address
codeqa
def has ipv 6 host sock Nonehas ipv 6 Falseif socket has ipv 6 try sock socket socket socket AF INET 6 sock bind host 0 has ipv 6 Trueexcept passif sock sock close return has ipv 6
null
null
null
null
Question: What can the system bind ? Code: def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
Can the system bind an ipv6 address ?
def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
Yes
codeqa
def has ipv 6 host sock Nonehas ipv 6 Falseif socket has ipv 6 try sock socket socket socket AF INET 6 sock bind host 0 has ipv 6 Trueexcept passif sock sock close return has ipv 6
null
null
null
null
Question: Can the system bind an ipv6 address ? Code: def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
What can bind an ipv6 address ?
def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
the system
codeqa
def has ipv 6 host sock Nonehas ipv 6 Falseif socket has ipv 6 try sock socket socket socket AF INET 6 sock bind host 0 has ipv 6 Trueexcept passif sock sock close return has ipv 6
null
null
null
null
Question: What can bind an ipv6 address ? Code: def _has_ipv6(host): sock = None has_ipv6 = False if socket.has_ipv6: try: sock = socket.socket(socket.AF_INET6) sock.bind((host, 0)) has_ipv6 = True except: pass if sock: sock.close() return has_ipv6
null
null
null
How are fields created ?
def dehydrate_rating(rating_class): rating = rating_class() if (rating.label is None): rating.label = (str(rating.age) or slugify_iarc_name(rating)) if (rating.name is None): if (rating.age == 0): rating.name = unicode(NAME_GENERAL) else: rating.name = (unicode(NAME_LAZY) % rating.age) rating.name = unicode(rating.name) return rating
null
null
null
easily
codeqa
def dehydrate rating rating class rating rating class if rating label is None rating label str rating age or slugify iarc name rating if rating name is None if rating age 0 rating name unicode NAME GENERAL else rating name unicode NAME LAZY % rating age rating name unicode rating name return rating
null
null
null
null
Question: How are fields created ? Code: def dehydrate_rating(rating_class): rating = rating_class() if (rating.label is None): rating.label = (str(rating.age) or slugify_iarc_name(rating)) if (rating.name is None): if (rating.age == 0): rating.name = unicode(NAME_GENERAL) else: rating.name = (unicode(NAME_LAZY) % rating.age) rating.name = unicode(rating.name) return rating
null
null
null
Did we look a list of things ?
def is_iterable(obj): return ((hasattr(obj, '__iter__') and (not isinstance(obj, str))) or isinstance(obj, GeneratorType))
null
null
null
Yes
codeqa
def is iterable obj return hasattr obj ' iter ' and not isinstance obj str or isinstance obj Generator Type
null
null
null
null
Question: Did we look a list of things ? Code: def is_iterable(obj): return ((hasattr(obj, '__iter__') and (not isinstance(obj, str))) or isinstance(obj, GeneratorType))
null
null
null
What did we look ?
def is_iterable(obj): return ((hasattr(obj, '__iter__') and (not isinstance(obj, str))) or isinstance(obj, GeneratorType))
null
null
null
a list of things
codeqa
def is iterable obj return hasattr obj ' iter ' and not isinstance obj str or isinstance obj Generator Type
null
null
null
null
Question: What did we look ? Code: def is_iterable(obj): return ((hasattr(obj, '__iter__') and (not isinstance(obj, str))) or isinstance(obj, GeneratorType))
null
null
null
What does the code ensure ?
def compare(name, first, second, bfr): o = bfr[first.begin:first.end].lower() c = bfr[second.begin:second.end].lower() match = False if ((o in S840D_HMI_CLASSES) and (c == '//end')): match = True elif (c == ('end_' + o)): match = True return match
null
null
null
correct open is paired with correct close
codeqa
def compare name first second bfr o bfr[first begin first end] lower c bfr[second begin second end] lower match Falseif o in S840 D HMI CLASSES and c '//end' match Trueelif c 'end ' + o match Truereturn match
null
null
null
null
Question: What does the code ensure ? Code: def compare(name, first, second, bfr): o = bfr[first.begin:first.end].lower() c = bfr[second.begin:second.end].lower() match = False if ((o in S840D_HMI_CLASSES) and (c == '//end')): match = True elif (c == ('end_' + o)): match = True return match
null
null
null
Does the code ensure ?
def compare(name, first, second, bfr): o = bfr[first.begin:first.end].lower() c = bfr[second.begin:second.end].lower() match = False if ((o in S840D_HMI_CLASSES) and (c == '//end')): match = True elif (c == ('end_' + o)): match = True return match
null
null
null
Yes
codeqa
def compare name first second bfr o bfr[first begin first end] lower c bfr[second begin second end] lower match Falseif o in S840 D HMI CLASSES and c '//end' match Trueelif c 'end ' + o match Truereturn match
null
null
null
null
Question: Does the code ensure ? Code: def compare(name, first, second, bfr): o = bfr[first.begin:first.end].lower() c = bfr[second.begin:second.end].lower() match = False if ((o in S840D_HMI_CLASSES) and (c == '//end')): match = True elif (c == ('end_' + o)): match = True return match
null
null
null
For what purpose do the locale data load ?
def load(name, merge_inherited=True): _cache_lock.acquire() try: data = _cache.get(name) if (not data): if ((name == 'root') or (not merge_inherited)): data = {} else: from babel.core import get_global parent = get_global('parent_exceptions').get(name) if (not parent): parts = name.split('_') if (len(parts) == 1): parent = 'root' else: parent = '_'.join(parts[:(-1)]) data = load(parent).copy() filename = os.path.join(_dirname, ('%s.dat' % name)) with open(filename, 'rb') as fileobj: if ((name != 'root') and merge_inherited): merge(data, pickle.load(fileobj)) else: data = pickle.load(fileobj) _cache[name] = data return data finally: _cache_lock.release()
null
null
null
for the given locale
codeqa
def load name merge inherited True cache lock acquire try data cache get name if not data if name 'root' or not merge inherited data {}else from babel core import get globalparent get global 'parent exceptions' get name if not parent parts name split ' ' if len parts 1 parent 'root'else parent ' ' join parts[ -1 ] data load parent copy filename os path join dirname '%s dat' % name with open filename 'rb' as fileobj if name 'root' and merge inherited merge data pickle load fileobj else data pickle load fileobj cache[name] datareturn datafinally cache lock release
null
null
null
null
Question: For what purpose do the locale data load ? Code: def load(name, merge_inherited=True): _cache_lock.acquire() try: data = _cache.get(name) if (not data): if ((name == 'root') or (not merge_inherited)): data = {} else: from babel.core import get_global parent = get_global('parent_exceptions').get(name) if (not parent): parts = name.split('_') if (len(parts) == 1): parent = 'root' else: parent = '_'.join(parts[:(-1)]) data = load(parent).copy() filename = os.path.join(_dirname, ('%s.dat' % name)) with open(filename, 'rb') as fileobj: if ((name != 'root') and merge_inherited): merge(data, pickle.load(fileobj)) else: data = pickle.load(fileobj) _cache[name] = data return data finally: _cache_lock.release()
null
null
null
Does the code return an object of the correct type ?
def IPAddress(address, version=None): if version: if (version == 4): return IPv4Address(address) elif (version == 6): return IPv6Address(address) try: return IPv4Address(address) except (IPv4IpValidationError, IPv6NetmaskValidationError): pass try: return IPv6Address(address) except (IPv6ValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 address' % address))
null
null
null
Yes
codeqa
def IP Address address version None if version if version 4 return I Pv 4 Address address elif version 6 return I Pv 6 Address address try return I Pv 4 Address address except I Pv 4 Ip Validation Error I Pv 6 Netmask Validation Error passtry return I Pv 6 Address address except I Pv 6 Validation Error I Pv 6 Netmask Validation Error passraise Value Error '%rdoesnotappeartobean I Pv 4 or I Pv 6 address' % address
null
null
null
null
Question: Does the code return an object of the correct type ? Code: def IPAddress(address, version=None): if version: if (version == 4): return IPv4Address(address) elif (version == 6): return IPv6Address(address) try: return IPv4Address(address) except (IPv4IpValidationError, IPv6NetmaskValidationError): pass try: return IPv6Address(address) except (IPv6ValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 address' % address))
null
null
null
What does the code return ?
def IPAddress(address, version=None): if version: if (version == 4): return IPv4Address(address) elif (version == 6): return IPv6Address(address) try: return IPv4Address(address) except (IPv4IpValidationError, IPv6NetmaskValidationError): pass try: return IPv6Address(address) except (IPv6ValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 address' % address))
null
null
null
an object of the correct type
codeqa
def IP Address address version None if version if version 4 return I Pv 4 Address address elif version 6 return I Pv 6 Address address try return I Pv 4 Address address except I Pv 4 Ip Validation Error I Pv 6 Netmask Validation Error passtry return I Pv 6 Address address except I Pv 6 Validation Error I Pv 6 Netmask Validation Error passraise Value Error '%rdoesnotappeartobean I Pv 4 or I Pv 6 address' % address
null
null
null
null
Question: What does the code return ? Code: def IPAddress(address, version=None): if version: if (version == 4): return IPv4Address(address) elif (version == 6): return IPv6Address(address) try: return IPv4Address(address) except (IPv4IpValidationError, IPv6NetmaskValidationError): pass try: return IPv6Address(address) except (IPv6ValidationError, IPv6NetmaskValidationError): pass raise ValueError(('%r does not appear to be an IPv4 or IPv6 address' % address))
null
null
null
For what purpose be the target set ?
def set_(name, target, module_parameter=None, action_parameter=None): ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} old_target = __salt__['eselect.get_current_target'](name, module_parameter=module_parameter, action_parameter=action_parameter) if (target == old_target): ret['comment'] = "Target '{0}' is already set on '{1}' module.".format(target, name) elif (target not in __salt__['eselect.get_target_list'](name, action_parameter=action_parameter)): ret['comment'] = "Target '{0}' is not available for '{1}' module.".format(target, name) ret['result'] = False elif __opts__['test']: ret['comment'] = "Target '{0}' will be set on '{1}' module.".format(target, name) ret['result'] = None else: result = __salt__['eselect.set_target'](name, target, module_parameter=module_parameter, action_parameter=action_parameter) if result: ret['changes'][name] = {'old': old_target, 'new': target} ret['comment'] = "Target '{0}' set on '{1}' module.".format(target, name) else: ret['comment'] = "Target '{0}' failed to be set on '{1}' module.".format(target, name) ret['result'] = False return ret
null
null
null
for this module
codeqa
def set name target module parameter None action parameter None ret {'changes' {} 'comment' '' 'name' name 'result' True}old target salt ['eselect get current target'] name module parameter module parameter action parameter action parameter if target old target ret['comment'] " Target'{ 0 }'isalreadyseton'{ 1 }'module " format target name elif target not in salt ['eselect get target list'] name action parameter action parameter ret['comment'] " Target'{ 0 }'isnotavailablefor'{ 1 }'module " format target name ret['result'] Falseelif opts ['test'] ret['comment'] " Target'{ 0 }'willbeseton'{ 1 }'module " format target name ret['result'] Noneelse result salt ['eselect set target'] name target module parameter module parameter action parameter action parameter if result ret['changes'][name] {'old' old target 'new' target}ret['comment'] " Target'{ 0 }'seton'{ 1 }'module " format target name else ret['comment'] " Target'{ 0 }'failedtobeseton'{ 1 }'module " format target name ret['result'] Falsereturn ret
null
null
null
null
Question: For what purpose be the target set ? Code: def set_(name, target, module_parameter=None, action_parameter=None): ret = {'changes': {}, 'comment': '', 'name': name, 'result': True} old_target = __salt__['eselect.get_current_target'](name, module_parameter=module_parameter, action_parameter=action_parameter) if (target == old_target): ret['comment'] = "Target '{0}' is already set on '{1}' module.".format(target, name) elif (target not in __salt__['eselect.get_target_list'](name, action_parameter=action_parameter)): ret['comment'] = "Target '{0}' is not available for '{1}' module.".format(target, name) ret['result'] = False elif __opts__['test']: ret['comment'] = "Target '{0}' will be set on '{1}' module.".format(target, name) ret['result'] = None else: result = __salt__['eselect.set_target'](name, target, module_parameter=module_parameter, action_parameter=action_parameter) if result: ret['changes'][name] = {'old': old_target, 'new': target} ret['comment'] = "Target '{0}' set on '{1}' module.".format(target, name) else: ret['comment'] = "Target '{0}' failed to be set on '{1}' module.".format(target, name) ret['result'] = False return ret
null
null
null
How does a list of requests convert to responses ?
def map(requests, stream=False, size=None, exception_handler=None, gtimeout=None): requests = list(requests) pool = (Pool(size) if size else None) jobs = [send(r, pool, stream=stream) for r in requests] gevent.joinall(jobs, timeout=gtimeout) ret = [] for request in requests: if (request.response is not None): ret.append(request.response) elif (exception_handler and hasattr(request, 'exception')): ret.append(exception_handler(request, request.exception)) else: ret.append(None) return ret
null
null
null
concurrently
codeqa
def map requests stream False size None exception handler None gtimeout None requests list requests pool Pool size if size else None jobs [send r pool stream stream for r in requests]gevent joinall jobs timeout gtimeout ret []for request in requests if request response is not None ret append request response elif exception handler and hasattr request 'exception' ret append exception handler request request exception else ret append None return ret
null
null
null
null
Question: How does a list of requests convert to responses ? Code: def map(requests, stream=False, size=None, exception_handler=None, gtimeout=None): requests = list(requests) pool = (Pool(size) if size else None) jobs = [send(r, pool, stream=stream) for r in requests] gevent.joinall(jobs, timeout=gtimeout) ret = [] for request in requests: if (request.response is not None): ret.append(request.response) elif (exception_handler and hasattr(request, 'exception')): ret.append(exception_handler(request, request.exception)) else: ret.append(None) return ret
null
null
null
Does the code delete an item or items from a queue ?
def delete(queue, items, backend='sqlite'): queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.delete'.format(backend) if (cmd not in queue_funcs): raise SaltInvocationError('Function "{0}" is not available'.format(cmd)) ret = queue_funcs[cmd](items=items, queue=queue) return ret
null
null
null
Yes
codeqa
def delete queue items backend 'sqlite' queue funcs salt loader queues opts cmd '{ 0 } delete' format backend if cmd not in queue funcs raise Salt Invocation Error ' Function"{ 0 }"isnotavailable' format cmd ret queue funcs[cmd] items items queue queue return ret
null
null
null
null
Question: Does the code delete an item or items from a queue ? Code: def delete(queue, items, backend='sqlite'): queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.delete'.format(backend) if (cmd not in queue_funcs): raise SaltInvocationError('Function "{0}" is not available'.format(cmd)) ret = queue_funcs[cmd](items=items, queue=queue) return ret
null
null
null
What does the code delete from a queue ?
def delete(queue, items, backend='sqlite'): queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.delete'.format(backend) if (cmd not in queue_funcs): raise SaltInvocationError('Function "{0}" is not available'.format(cmd)) ret = queue_funcs[cmd](items=items, queue=queue) return ret
null
null
null
an item or items
codeqa
def delete queue items backend 'sqlite' queue funcs salt loader queues opts cmd '{ 0 } delete' format backend if cmd not in queue funcs raise Salt Invocation Error ' Function"{ 0 }"isnotavailable' format cmd ret queue funcs[cmd] items items queue queue return ret
null
null
null
null
Question: What does the code delete from a queue ? Code: def delete(queue, items, backend='sqlite'): queue_funcs = salt.loader.queues(__opts__) cmd = '{0}.delete'.format(backend) if (cmd not in queue_funcs): raise SaltInvocationError('Function "{0}" is not available'.format(cmd)) ret = queue_funcs[cmd](items=items, queue=queue) return ret
null
null
null
Does the code expect a list of tuples ?
def unbox_usecase2(x): res = 0 for v in x: res += len(v) return res
null
null
null
Yes
codeqa
def unbox usecase 2 x res 0for v in x res + len v return res
null
null
null
null
Question: Does the code expect a list of tuples ? Code: def unbox_usecase2(x): res = 0 for v in x: res += len(v) return res
null
null
null
What does the code expect ?
def unbox_usecase2(x): res = 0 for v in x: res += len(v) return res
null
null
null
a list of tuples
codeqa
def unbox usecase 2 x res 0for v in x res + len v return res
null
null
null
null
Question: What does the code expect ? Code: def unbox_usecase2(x): res = 0 for v in x: res += len(v) return res
null
null
null
What does the code get ?
def regions(**kw_params): return get_regions('ec2', connection_cls=VPCConnection)
null
null
null
all available regions for the ec2 service
codeqa
def regions **kw params return get regions 'ec 2 ' connection cls VPC Connection
null
null
null
null
Question: What does the code get ? Code: def regions(**kw_params): return get_regions('ec2', connection_cls=VPCConnection)
null
null
null
Does the code get all available regions for the ec2 service ?
def regions(**kw_params): return get_regions('ec2', connection_cls=VPCConnection)
null
null
null
Yes
codeqa
def regions **kw params return get regions 'ec 2 ' connection cls VPC Connection
null
null
null
null
Question: Does the code get all available regions for the ec2 service ? Code: def regions(**kw_params): return get_regions('ec2', connection_cls=VPCConnection)
null
null
null
Are results for any argument tuple stored in cache ?
def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
Yes
codeqa
def memoize func cache num args def wrapper *args mem args args[ num args]if mem args in cache return cache[mem args]result func *args cache[mem args] resultreturn resultreturn wraps func wrapper
null
null
null
null
Question: Are results for any argument tuple stored in cache ? Code: def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
What are stored in cache ?
def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
results for any argument tuple
codeqa
def memoize func cache num args def wrapper *args mem args args[ num args]if mem args in cache return cache[mem args]result func *args cache[mem args] resultreturn resultreturn wraps func wrapper
null
null
null
null
Question: What are stored in cache ? Code: def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
Where are results for any argument tuple stored ?
def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
in cache
codeqa
def memoize func cache num args def wrapper *args mem args args[ num args]if mem args in cache return cache[mem args]result func *args cache[mem args] resultreturn resultreturn wraps func wrapper
null
null
null
null
Question: Where are results for any argument tuple stored ? Code: def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
For what purpose do a function wrap ?
def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
so that results for any argument tuple are stored in cache
codeqa
def memoize func cache num args def wrapper *args mem args args[ num args]if mem args in cache return cache[mem args]result func *args cache[mem args] resultreturn resultreturn wraps func wrapper
null
null
null
null
Question: For what purpose do a function wrap ? Code: def memoize(func, cache, num_args): def wrapper(*args): mem_args = args[:num_args] if (mem_args in cache): return cache[mem_args] result = func(*args) cache[mem_args] = result return result return wraps(func)(wrapper)
null
null
null
Does the code get phrases from a module ?
def get_phrases_from_module(module): return (module.WORDS if hasattr(module, 'WORDS') else [])
null
null
null
Yes
codeqa
def get phrases from module module return module WORDS if hasattr module 'WORDS' else []
null
null
null
null
Question: Does the code get phrases from a module ? Code: def get_phrases_from_module(module): return (module.WORDS if hasattr(module, 'WORDS') else [])
null
null
null
What does the code get from a module ?
def get_phrases_from_module(module): return (module.WORDS if hasattr(module, 'WORDS') else [])
null
null
null
phrases
codeqa
def get phrases from module module return module WORDS if hasattr module 'WORDS' else []
null
null
null
null
Question: What does the code get from a module ? Code: def get_phrases_from_module(module): return (module.WORDS if hasattr(module, 'WORDS') else [])
null
null
null
Does the code check the given path ?
def checkPath(filename, reporter=None): if (reporter is None): reporter = modReporter._makeDefaultReporter() try: with open(filename, 'rb') as f: codestr = f.read() if (sys.version_info < (2, 7)): codestr += '\n' except UnicodeError: reporter.unexpectedError(filename, 'problem decoding source') return 1 except IOError: msg = sys.exc_info()[1] reporter.unexpectedError(filename, msg.args[1]) return 1 return check(codestr, filename, reporter)
null
null
null
Yes
codeqa
def check Path filename reporter None if reporter is None reporter mod Reporter make Default Reporter try with open filename 'rb' as f codestr f read if sys version info < 2 7 codestr + '\n'except Unicode Error reporter unexpected Error filename 'problemdecodingsource' return 1except IO Error msg sys exc info [1 ]reporter unexpected Error filename msg args[ 1 ] return 1return check codestr filename reporter
null
null
null
null
Question: Does the code check the given path ? Code: def checkPath(filename, reporter=None): if (reporter is None): reporter = modReporter._makeDefaultReporter() try: with open(filename, 'rb') as f: codestr = f.read() if (sys.version_info < (2, 7)): codestr += '\n' except UnicodeError: reporter.unexpectedError(filename, 'problem decoding source') return 1 except IOError: msg = sys.exc_info()[1] reporter.unexpectedError(filename, msg.args[1]) return 1 return check(codestr, filename, reporter)
null
null
null
What does the code check ?
def checkPath(filename, reporter=None): if (reporter is None): reporter = modReporter._makeDefaultReporter() try: with open(filename, 'rb') as f: codestr = f.read() if (sys.version_info < (2, 7)): codestr += '\n' except UnicodeError: reporter.unexpectedError(filename, 'problem decoding source') return 1 except IOError: msg = sys.exc_info()[1] reporter.unexpectedError(filename, msg.args[1]) return 1 return check(codestr, filename, reporter)
null
null
null
the given path
codeqa
def check Path filename reporter None if reporter is None reporter mod Reporter make Default Reporter try with open filename 'rb' as f codestr f read if sys version info < 2 7 codestr + '\n'except Unicode Error reporter unexpected Error filename 'problemdecodingsource' return 1except IO Error msg sys exc info [1 ]reporter unexpected Error filename msg args[ 1 ] return 1return check codestr filename reporter
null
null
null
null
Question: What does the code check ? Code: def checkPath(filename, reporter=None): if (reporter is None): reporter = modReporter._makeDefaultReporter() try: with open(filename, 'rb') as f: codestr = f.read() if (sys.version_info < (2, 7)): codestr += '\n' except UnicodeError: reporter.unexpectedError(filename, 'problem decoding source') return 1 except IOError: msg = sys.exc_info()[1] reporter.unexpectedError(filename, msg.args[1]) return 1 return check(codestr, filename, reporter)
null
null
null
How do the output of the controller cache ?
@cache(request.env.path_info, time_expire=5, cache_model=cache.ram) def cache_controller_in_ram(): t = time.ctime() return dict(time=t, link=A('click to reload', _href=URL(r=request)))
null
null
null
in ram
codeqa
@cache request env path info time expire 5 cache model cache ram def cache controller in ram t time ctime return dict time t link A 'clicktoreload' href URL r request
null
null
null
null
Question: How do the output of the controller cache ? Code: @cache(request.env.path_info, time_expire=5, cache_model=cache.ram) def cache_controller_in_ram(): t = time.ctime() return dict(time=t, link=A('click to reload', _href=URL(r=request)))
null
null
null
Does the code start the specified jail or all ?
def start(jail=''): cmd = 'service jail onestart {0}'.format(jail) return (not __salt__['cmd.retcode'](cmd))
null
null
null
Yes
codeqa
def start jail '' cmd 'servicejailonestart{ 0 }' format jail return not salt ['cmd retcode'] cmd
null
null
null
null
Question: Does the code start the specified jail or all ? Code: def start(jail=''): cmd = 'service jail onestart {0}'.format(jail) return (not __salt__['cmd.retcode'](cmd))
null
null
null
What does the code start ?
def start(jail=''): cmd = 'service jail onestart {0}'.format(jail) return (not __salt__['cmd.retcode'](cmd))
null
null
null
the specified jail or all
codeqa
def start jail '' cmd 'servicejailonestart{ 0 }' format jail return not salt ['cmd retcode'] cmd
null
null
null
null
Question: What does the code start ? Code: def start(jail=''): cmd = 'service jail onestart {0}'.format(jail) return (not __salt__['cmd.retcode'](cmd))
null
null
null
Does the code manage the communication between this process and the worker processes ?
def _queue_manangement_worker(executor_reference, processes, pending_work_items, work_ids_queue, call_queue, result_queue, shutdown_process_event): while True: _add_call_item_to_queue(pending_work_items, work_ids_queue, call_queue) try: result_item = result_queue.get(block=True, timeout=0.1) except queue.Empty: executor = executor_reference() if (_shutdown or (executor is None) or executor._shutdown_thread): if (not pending_work_items): shutdown_process_event.set() for p in processes: p.join() return del executor else: work_item = pending_work_items[result_item.work_id] del pending_work_items[result_item.work_id] if result_item.exception: work_item.future.set_exception(result_item.exception) else: work_item.future.set_result(result_item.result)
null
null
null
Yes
codeqa
def queue manangement worker executor reference processes pending work items work ids queue call queue result queue shutdown process event while True add call item to queue pending work items work ids queue call queue try result item result queue get block True timeout 0 1 except queue Empty executor executor reference if shutdown or executor is None or executor shutdown thread if not pending work items shutdown process event set for p in processes p join returndel executorelse work item pending work items[result item work id]del pending work items[result item work id]if result item exception work item future set exception result item exception else work item future set result result item result
null
null
null
null
Question: Does the code manage the communication between this process and the worker processes ? Code: def _queue_manangement_worker(executor_reference, processes, pending_work_items, work_ids_queue, call_queue, result_queue, shutdown_process_event): while True: _add_call_item_to_queue(pending_work_items, work_ids_queue, call_queue) try: result_item = result_queue.get(block=True, timeout=0.1) except queue.Empty: executor = executor_reference() if (_shutdown or (executor is None) or executor._shutdown_thread): if (not pending_work_items): shutdown_process_event.set() for p in processes: p.join() return del executor else: work_item = pending_work_items[result_item.work_id] del pending_work_items[result_item.work_id] if result_item.exception: work_item.future.set_exception(result_item.exception) else: work_item.future.set_result(result_item.result)
null
null
null
What does the code manage ?
def _queue_manangement_worker(executor_reference, processes, pending_work_items, work_ids_queue, call_queue, result_queue, shutdown_process_event): while True: _add_call_item_to_queue(pending_work_items, work_ids_queue, call_queue) try: result_item = result_queue.get(block=True, timeout=0.1) except queue.Empty: executor = executor_reference() if (_shutdown or (executor is None) or executor._shutdown_thread): if (not pending_work_items): shutdown_process_event.set() for p in processes: p.join() return del executor else: work_item = pending_work_items[result_item.work_id] del pending_work_items[result_item.work_id] if result_item.exception: work_item.future.set_exception(result_item.exception) else: work_item.future.set_result(result_item.result)
null
null
null
the communication between this process and the worker processes
codeqa
def queue manangement worker executor reference processes pending work items work ids queue call queue result queue shutdown process event while True add call item to queue pending work items work ids queue call queue try result item result queue get block True timeout 0 1 except queue Empty executor executor reference if shutdown or executor is None or executor shutdown thread if not pending work items shutdown process event set for p in processes p join returndel executorelse work item pending work items[result item work id]del pending work items[result item work id]if result item exception work item future set exception result item exception else work item future set result result item result
null
null
null
null
Question: What does the code manage ? Code: def _queue_manangement_worker(executor_reference, processes, pending_work_items, work_ids_queue, call_queue, result_queue, shutdown_process_event): while True: _add_call_item_to_queue(pending_work_items, work_ids_queue, call_queue) try: result_item = result_queue.get(block=True, timeout=0.1) except queue.Empty: executor = executor_reference() if (_shutdown or (executor is None) or executor._shutdown_thread): if (not pending_work_items): shutdown_process_event.set() for p in processes: p.join() return del executor else: work_item = pending_work_items[result_item.work_id] del pending_work_items[result_item.work_id] if result_item.exception: work_item.future.set_exception(result_item.exception) else: work_item.future.set_result(result_item.result)
null
null
null
Does the code run the command after it has exited ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
Yes
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: Does the code run the command after it has exited ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
What does the code return after it has exited ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
its output
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: What does the code return after it has exited ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
What does the code run after it has exited ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
the command
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: What does the code run after it has exited ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
When does the code run the command ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
after it has exited
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: When does the code run the command ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
Does the code return its output after it has exited ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
Yes
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: Does the code return its output after it has exited ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
When does the code return its output ?
def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
after it has exited
codeqa
def command output cmd shell False proc subprocess Popen cmd stdout subprocess PIPE stderr subprocess PIPE close fds platform system ' Windows' shell shell stdout stderr proc communicate if proc returncode raise subprocess Called Process Error returncode proc returncode cmd '' join cmd return stdout
null
null
null
null
Question: When does the code return its output ? Code: def command_output(cmd, shell=False): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(platform.system() != 'Windows'), shell=shell) (stdout, stderr) = proc.communicate() if proc.returncode: raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=' '.join(cmd)) return stdout
null
null
null
Does the code shuffle a sequence ?
@register.filter def shuffle(sequence): random.shuffle(sequence) return sequence
null
null
null
Yes
codeqa
@register filterdef shuffle sequence random shuffle sequence return sequence
null
null
null
null
Question: Does the code shuffle a sequence ? Code: @register.filter def shuffle(sequence): random.shuffle(sequence) return sequence
null
null
null
What does the code shuffle ?
@register.filter def shuffle(sequence): random.shuffle(sequence) return sequence
null
null
null
a sequence
codeqa
@register filterdef shuffle sequence random shuffle sequence return sequence
null
null
null
null
Question: What does the code shuffle ? Code: @register.filter def shuffle(sequence): random.shuffle(sequence) return sequence
null
null
null
What do return image array show ?
def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
the differences between im1 and im2
codeqa
def make Diff Image im 1 im 2 ds im 1 shapees im 2 shapediff np empty max ds[ 0 ] es[ 0 ] max ds[ 1 ] es[ 1 ] 4 dtype int diff[ 3] 128 diff[ 3] 255 diff[ ds[ 0 ] ds[ 1 ] min ds[ 2 ] 3 ] + im 1 [ 3]diff[ es[ 0 ] es[ 1 ] min es[ 2 ] 3 ] - im 2 [ 3]diff np clip diff 0 255 astype np ubyte return diff
null
null
null
null
Question: What do return image array show ? Code: def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
Do return image array show the differences between im1 and im2 ?
def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
Yes
codeqa
def make Diff Image im 1 im 2 ds im 1 shapees im 2 shapediff np empty max ds[ 0 ] es[ 0 ] max ds[ 1 ] es[ 1 ] 4 dtype int diff[ 3] 128 diff[ 3] 255 diff[ ds[ 0 ] ds[ 1 ] min ds[ 2 ] 3 ] + im 1 [ 3]diff[ es[ 0 ] es[ 1 ] min es[ 2 ] 3 ] - im 2 [ 3]diff np clip diff 0 255 astype np ubyte return diff
null
null
null
null
Question: Do return image array show the differences between im1 and im2 ? Code: def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
What is showing the differences between im1 and im2 ?
def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
return image array
codeqa
def make Diff Image im 1 im 2 ds im 1 shapees im 2 shapediff np empty max ds[ 0 ] es[ 0 ] max ds[ 1 ] es[ 1 ] 4 dtype int diff[ 3] 128 diff[ 3] 255 diff[ ds[ 0 ] ds[ 1 ] min ds[ 2 ] 3 ] + im 1 [ 3]diff[ es[ 0 ] es[ 1 ] min es[ 2 ] 3 ] - im 2 [ 3]diff np clip diff 0 255 astype np ubyte return diff
null
null
null
null
Question: What is showing the differences between im1 and im2 ? Code: def makeDiffImage(im1, im2): ds = im1.shape es = im2.shape diff = np.empty((max(ds[0], es[0]), max(ds[1], es[1]), 4), dtype=int) diff[..., :3] = 128 diff[..., 3] = 255 diff[:ds[0], :ds[1], :min(ds[2], 3)] += im1[..., :3] diff[:es[0], :es[1], :min(es[2], 3)] -= im2[..., :3] diff = np.clip(diff, 0, 255).astype(np.ubyte) return diff
null
null
null
Will this cache the contents of a template fragment for a given amount of time ?
@register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
Yes
codeqa
@register tag 'cache' def do cache parser token nodelist parser parse 'endcache' parser delete first token tokens token contents split if len tokens < 3 raise Template Syntax Error u"'%r'tagrequiresatleast 2 arguments " % tokens[ 0 ] return Cache Node nodelist tokens[ 1 ] tokens[ 2 ] tokens[ 3 ]
null
null
null
null
Question: Will this cache the contents of a template fragment for a given amount of time ? Code: @register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
What will cache the contents of a template fragment for a given amount of time ?
@register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
this
codeqa
@register tag 'cache' def do cache parser token nodelist parser parse 'endcache' parser delete first token tokens token contents split if len tokens < 3 raise Template Syntax Error u"'%r'tagrequiresatleast 2 arguments " % tokens[ 0 ] return Cache Node nodelist tokens[ 1 ] tokens[ 2 ] tokens[ 3 ]
null
null
null
null
Question: What will cache the contents of a template fragment for a given amount of time ? Code: @register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
What will this cache for a given amount of time ?
@register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
the contents of a template fragment
codeqa
@register tag 'cache' def do cache parser token nodelist parser parse 'endcache' parser delete first token tokens token contents split if len tokens < 3 raise Template Syntax Error u"'%r'tagrequiresatleast 2 arguments " % tokens[ 0 ] return Cache Node nodelist tokens[ 1 ] tokens[ 2 ] tokens[ 3 ]
null
null
null
null
Question: What will this cache for a given amount of time ? Code: @register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
When will this cache the contents of a template fragment ?
@register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
for a given amount of time
codeqa
@register tag 'cache' def do cache parser token nodelist parser parse 'endcache' parser delete first token tokens token contents split if len tokens < 3 raise Template Syntax Error u"'%r'tagrequiresatleast 2 arguments " % tokens[ 0 ] return Cache Node nodelist tokens[ 1 ] tokens[ 2 ] tokens[ 3 ]
null
null
null
null
Question: When will this cache the contents of a template fragment ? Code: @register.tag('cache') def do_cache(parser, token): nodelist = parser.parse(('endcache',)) parser.delete_first_token() tokens = token.contents.split() if (len(tokens) < 3): raise TemplateSyntaxError((u"'%r' tag requires at least 2 arguments." % tokens[0])) return CacheNode(nodelist, tokens[1], tokens[2], tokens[3:])
null
null
null
Should distinct be used to query the given lookup path ?
def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
Yes
codeqa
def lookup needs distinct opts lookup path field name lookup path split u' ' 1 [0 ]field opts get field by name field name [0 ]if hasattr field u'rel' and isinstance field rel models Many To Many Rel or isinstance field models related Related Object and not field field unique return Truereturn False
null
null
null
null
Question: Should distinct be used to query the given lookup path ? Code: def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
What should be used to query the given lookup path ?
def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
distinct
codeqa
def lookup needs distinct opts lookup path field name lookup path split u' ' 1 [0 ]field opts get field by name field name [0 ]if hasattr field u'rel' and isinstance field rel models Many To Many Rel or isinstance field models related Related Object and not field field unique return Truereturn False
null
null
null
null
Question: What should be used to query the given lookup path ? Code: def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
What should distinct be used ?
def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
to query the given lookup path
codeqa
def lookup needs distinct opts lookup path field name lookup path split u' ' 1 [0 ]field opts get field by name field name [0 ]if hasattr field u'rel' and isinstance field rel models Many To Many Rel or isinstance field models related Related Object and not field field unique return Truereturn False
null
null
null
null
Question: What should distinct be used ? Code: def lookup_needs_distinct(opts, lookup_path): field_name = lookup_path.split(u'__', 1)[0] field = opts.get_field_by_name(field_name)[0] if ((hasattr(field, u'rel') and isinstance(field.rel, models.ManyToManyRel)) or (isinstance(field, models.related.RelatedObject) and (not field.field.unique))): return True return False
null
null
null
Does this function return a python object ?
def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
Yes
codeqa
def str 2 pyval string try return ast literal eval string except Value Error Syntax Error return PYVALS get string string
null
null
null
null
Question: Does this function return a python object ? Code: def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
What does this function return ?
def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
a python object
codeqa
def str 2 pyval string try return ast literal eval string except Value Error Syntax Error return PYVALS get string string
null
null
null
null
Question: What does this function return ? Code: def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
What does this function take ?
def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
a string
codeqa
def str 2 pyval string try return ast literal eval string except Value Error Syntax Error return PYVALS get string string
null
null
null
null
Question: What does this function take ? Code: def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
Does this function take a string ?
def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
Yes
codeqa
def str 2 pyval string try return ast literal eval string except Value Error Syntax Error return PYVALS get string string
null
null
null
null
Question: Does this function take a string ? Code: def str2pyval(string): try: return ast.literal_eval(string) except (ValueError, SyntaxError): return _PYVALS.get(string, string)
null
null
null
When did page display ?
def page_msg(page=0): if isinstance(g.content, PaginatedContent): page_count = g.content.numPages() else: page_count = math.ceil((g.result_count / getxy().max_results)) if (page_count > 1): pagemsg = '{}{}/{}{}' return pagemsg.format(('<' if (page > 0) else '['), ('%s%s%s' % (c.y, (page + 1), c.w)), page_count, ('>' if ((page + 1) < page_count) else ']')) return None
null
null
null
currently
codeqa
def page msg page 0 if isinstance g content Paginated Content page count g content num Pages else page count math ceil g result count / getxy max results if page count > 1 pagemsg '{}{}/{}{}'return pagemsg format '<' if page > 0 else '[' '%s%s%s' % c y page + 1 c w page count '>' if page + 1 < page count else ']' return None
null
null
null
null
Question: When did page display ? Code: def page_msg(page=0): if isinstance(g.content, PaginatedContent): page_count = g.content.numPages() else: page_count = math.ceil((g.result_count / getxy().max_results)) if (page_count > 1): pagemsg = '{}{}/{}{}' return pagemsg.format(('<' if (page > 0) else '['), ('%s%s%s' % (c.y, (page + 1), c.w)), page_count, ('>' if ((page + 1) < page_count) else ']')) return None
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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
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 s' % {'driver' type self connection 'method' frame[ 2 ]} wrapped func name f name wrapped func doc f doc return wrapped func
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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
null
null
null
Do a particular call make ?
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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
null
null
null
Yes
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 s' % {'driver' type self connection 'method' frame[ 2 ]} wrapped func name f name wrapped func doc f doc return wrapped func
null
null
null
null
Question: Do a particular call make ? 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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
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 s' % {'driver' type self connection 'method' frame[ 2 ]} wrapped func name f name wrapped func doc f doc return wrapped func
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' % {'driver': type(self.connection), 'method': frame[2]})) wrapped_func.__name__ = f.__name__ wrapped_func.__doc__ = f.__doc__ return wrapped_func
null
null
null
What does the code find ?
def GetWSAActionOutput(operation): attr = operation.output.action if (attr is not None): return attr targetNamespace = operation.getPortType().getTargetNamespace() ptName = operation.getPortType().name msgName = operation.output.name if (not msgName): msgName = (operation.name + 'Response') if targetNamespace.endswith('/'): return ('%s%s/%s' % (targetNamespace, ptName, msgName)) return ('%s/%s/%s' % (targetNamespace, ptName, msgName))
null
null
null
wsa
codeqa
def Get WSA Action Output operation attr operation output actionif attr is not None return attrtarget Namespace operation get Port Type get Target Namespace pt Name operation get Port Type namemsg Name operation output nameif not msg Name msg Name operation name + ' Response' if target Namespace endswith '/' return '%s%s/%s' % target Namespace pt Name msg Name return '%s/%s/%s' % target Namespace pt Name msg Name
null
null
null
null
Question: What does the code find ? Code: def GetWSAActionOutput(operation): attr = operation.output.action if (attr is not None): return attr targetNamespace = operation.getPortType().getTargetNamespace() ptName = operation.getPortType().name msgName = operation.output.name if (not msgName): msgName = (operation.name + 'Response') if targetNamespace.endswith('/'): return ('%s%s/%s' % (targetNamespace, ptName, msgName)) return ('%s/%s/%s' % (targetNamespace, ptName, msgName))
null
null
null
When did workers need ?
def adjust_workers(num_flows, num_cpus, worker_sockets, log_fh=None): qiime_config = load_qiime_config() min_per_core = int(qiime_config['denoiser_min_per_core']) if (num_flows < ((num_cpus - 1) * min_per_core)): if log_fh: log_fh.write('Adjusting number of workers:\n') log_fh.write(('flows: %d cpus:%d\n' % (num_flows, num_cpus))) per_core = max(min_per_core, ((num_flows / num_cpus) + 1)) for i in range(num_cpus): if ((i * per_core) > num_flows): worker_sock = worker_sockets.pop() worker_sock.close() num_cpus = (num_cpus - 1) if log_fh: log_fh.write(('released worker %d\n' % i)) if log_fh: log_fh.write(('New number of cpus:%d\n' % num_cpus)) if ((num_cpus == 0) or (num_cpus != len(worker_sockets))): raise ValueError('Adjust_workers screwed up!') return num_cpus
null
null
null
no longer
codeqa
def adjust workers num flows num cpus worker sockets log fh None qiime config load qiime config min per core int qiime config['denoiser min per core'] if num flows < num cpus - 1 * min per core if log fh log fh write ' Adjustingnumberofworkers \n' log fh write 'flows %dcpus %d\n' % num flows num cpus per core max min per core num flows / num cpus + 1 for i in range num cpus if i * per core > num flows worker sock worker sockets pop worker sock close num cpus num cpus - 1 if log fh log fh write 'releasedworker%d\n' % i if log fh log fh write ' Newnumberofcpus %d\n' % num cpus if num cpus 0 or num cpus len worker sockets raise Value Error ' Adjust workersscrewedup ' return num cpus
null
null
null
null
Question: When did workers need ? Code: def adjust_workers(num_flows, num_cpus, worker_sockets, log_fh=None): qiime_config = load_qiime_config() min_per_core = int(qiime_config['denoiser_min_per_core']) if (num_flows < ((num_cpus - 1) * min_per_core)): if log_fh: log_fh.write('Adjusting number of workers:\n') log_fh.write(('flows: %d cpus:%d\n' % (num_flows, num_cpus))) per_core = max(min_per_core, ((num_flows / num_cpus) + 1)) for i in range(num_cpus): if ((i * per_core) > num_flows): worker_sock = worker_sockets.pop() worker_sock.close() num_cpus = (num_cpus - 1) if log_fh: log_fh.write(('released worker %d\n' % i)) if log_fh: log_fh.write(('New number of cpus:%d\n' % num_cpus)) if ((num_cpus == 0) or (num_cpus != len(worker_sockets))): raise ValueError('Adjust_workers screwed up!') return num_cpus
null
null
null
Does the code send a message to the socket ?
def send(session_id, message): try: socket = CLIENTS[session_id][1] except KeyError: raise NoSocket(('There is no socket with the session ID: ' + session_id)) socket.send(message)
null
null
null
Yes
codeqa
def send session id message try socket CLIENTS[session id][ 1 ]except Key Error raise No Socket ' Thereisnosocketwiththesession ID ' + session id socket send message
null
null
null
null
Question: Does the code send a message to the socket ? Code: def send(session_id, message): try: socket = CLIENTS[session_id][1] except KeyError: raise NoSocket(('There is no socket with the session ID: ' + session_id)) socket.send(message)
null
null
null
What does the code send to the socket ?
def send(session_id, message): try: socket = CLIENTS[session_id][1] except KeyError: raise NoSocket(('There is no socket with the session ID: ' + session_id)) socket.send(message)
null
null
null
a message
codeqa
def send session id message try socket CLIENTS[session id][ 1 ]except Key Error raise No Socket ' Thereisnosocketwiththesession ID ' + session id socket send message
null
null
null
null
Question: What does the code send to the socket ? Code: def send(session_id, message): try: socket = CLIENTS[session_id][1] except KeyError: raise NoSocket(('There is no socket with the session ID: ' + session_id)) socket.send(message)
null
null
null
Does the code retrieve a data file from the standard locations for the package ?
def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
Yes
codeqa
def get pkg data fileobj data name package None encoding None cache True datafn find pkg data path data name package package if os path isdir datafn raise IO Error u" Triedtoaccessadatafilethat'sactuallyapackagedatadirectory" elif os path isfile datafn return get readable fileobj datafn encoding encoding else return get readable fileobj conf dataurl + datafn encoding encoding cache cache
null
null
null
null
Question: Does the code retrieve a data file from the standard locations for the package ? Code: def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
What does the code retrieve from the standard locations for the package ?
def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
a data file
codeqa
def get pkg data fileobj data name package None encoding None cache True datafn find pkg data path data name package package if os path isdir datafn raise IO Error u" Triedtoaccessadatafilethat'sactuallyapackagedatadirectory" elif os path isfile datafn return get readable fileobj datafn encoding encoding else return get readable fileobj conf dataurl + datafn encoding encoding cache cache
null
null
null
null
Question: What does the code retrieve from the standard locations for the package ? Code: def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
Does the code provide the file as a file - like object that reads bytes ?
def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
Yes
codeqa
def get pkg data fileobj data name package None encoding None cache True datafn find pkg data path data name package package if os path isdir datafn raise IO Error u" Triedtoaccessadatafilethat'sactuallyapackagedatadirectory" elif os path isfile datafn return get readable fileobj datafn encoding encoding else return get readable fileobj conf dataurl + datafn encoding encoding cache cache
null
null
null
null
Question: Does the code provide the file as a file - like object that reads bytes ? Code: def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
What does the code provide as a file - like object that reads bytes ?
def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
the file
codeqa
def get pkg data fileobj data name package None encoding None cache True datafn find pkg data path data name package package if os path isdir datafn raise IO Error u" Triedtoaccessadatafilethat'sactuallyapackagedatadirectory" elif os path isfile datafn return get readable fileobj datafn encoding encoding else return get readable fileobj conf dataurl + datafn encoding encoding cache cache
null
null
null
null
Question: What does the code provide as a file - like object that reads bytes ? Code: def get_pkg_data_fileobj(data_name, package=None, encoding=None, cache=True): datafn = _find_pkg_data_path(data_name, package=package) if os.path.isdir(datafn): raise IOError(u"Tried to access a data file that's actually a package data directory") elif os.path.isfile(datafn): return get_readable_fileobj(datafn, encoding=encoding) else: return get_readable_fileobj((conf.dataurl + datafn), encoding=encoding, cache=cache)
null
null
null
Does the code ensure ?
def absent(name, profile='grafana'): ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if isinstance(profile, six.string_types): profile = __salt__['config.option'](profile) url = 'db/{0}'.format(name) existing_dashboard = _get(url, profile) if existing_dashboard: if __opts__['test']: ret['result'] = None ret['comment'] = 'Dashboard {0} is set to be deleted.'.format(name) return ret _delete(url, profile) ret['comment'] = 'Dashboard {0} deleted.'.format(name) ret['changes']['new'] = 'Dashboard {0} deleted.'.format(name) return ret ret['comment'] = 'Dashboard absent' return ret
null
null
null
Yes
codeqa
def absent name profile 'grafana' ret {'name' name 'result' True 'comment' '' 'changes' {}}if isinstance profile six string types profile salt ['config option'] profile url 'db/{ 0 }' format name existing dashboard get url profile if existing dashboard if opts ['test'] ret['result'] Noneret['comment'] ' Dashboard{ 0 }issettobedeleted ' format name return ret delete url profile ret['comment'] ' Dashboard{ 0 }deleted ' format name ret['changes']['new'] ' Dashboard{ 0 }deleted ' format name return retret['comment'] ' Dashboardabsent'return ret
null
null
null
null
Question: Does the code ensure ? Code: def absent(name, profile='grafana'): ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} if isinstance(profile, six.string_types): profile = __salt__['config.option'](profile) url = 'db/{0}'.format(name) existing_dashboard = _get(url, profile) if existing_dashboard: if __opts__['test']: ret['result'] = None ret['comment'] = 'Dashboard {0} is set to be deleted.'.format(name) return ret _delete(url, profile) ret['comment'] = 'Dashboard {0} deleted.'.format(name) ret['changes']['new'] = 'Dashboard {0} deleted.'.format(name) return ret ret['comment'] = 'Dashboard absent' return ret
null
null
null
What does an array have ?
def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
none
codeqa
def add dummy padding x depth boundary for k v in boundary items if v 'none' d depth[k]empty shape list x shape empty shape[k] dempty chunks list x chunks empty chunks[k] d empty wrap empty empty shape chunks empty chunks dtype x dtype out chunks list x chunks ax chunks list out chunks[k] ax chunks[ 0 ] + dax chunks[ -1 ] + dout chunks[k] ax chunksx concatenate [empty x empty] axis k x x rechunk out chunks return x
null
null
null
null
Question: What does an array have ? Code: def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
What has none ?
def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
an array
codeqa
def add dummy padding x depth boundary for k v in boundary items if v 'none' d depth[k]empty shape list x shape empty shape[k] dempty chunks list x chunks empty chunks[k] d empty wrap empty empty shape chunks empty chunks dtype x dtype out chunks list x chunks ax chunks list out chunks[k] ax chunks[ 0 ] + dax chunks[ -1 ] + dout chunks[k] ax chunksx concatenate [empty x empty] axis k x x rechunk out chunks return x
null
null
null
null
Question: What has none ? Code: def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
Does an array have none ?
def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
Yes
codeqa
def add dummy padding x depth boundary for k v in boundary items if v 'none' d depth[k]empty shape list x shape empty shape[k] dempty chunks list x chunks empty chunks[k] d empty wrap empty empty shape chunks empty chunks dtype x dtype out chunks list x chunks ax chunks list out chunks[k] ax chunks[ 0 ] + dax chunks[ -1 ] + dout chunks[k] ax chunksx concatenate [empty x empty] axis k x x rechunk out chunks return x
null
null
null
null
Question: Does an array have none ? Code: def add_dummy_padding(x, depth, boundary): for (k, v) in boundary.items(): if (v == 'none'): d = depth[k] empty_shape = list(x.shape) empty_shape[k] = d empty_chunks = list(x.chunks) empty_chunks[k] = (d,) empty = wrap.empty(empty_shape, chunks=empty_chunks, dtype=x.dtype) out_chunks = list(x.chunks) ax_chunks = list(out_chunks[k]) ax_chunks[0] += d ax_chunks[(-1)] += d out_chunks[k] = ax_chunks x = concatenate([empty, x, empty], axis=k) x = x.rechunk(out_chunks) return x
null
null
null
What does the code get from the string ?
def getIntFromFloatString(value): floatString = str(value).strip() if (floatString == ''): return None dotIndex = floatString.find('.') if (dotIndex < 0): return int(value) return int(round(float(floatString)))
null
null
null
the int
codeqa
def get Int From Float String value float String str value strip if float String '' return Nonedot Index float String find ' ' if dot Index < 0 return int value return int round float float String
null
null
null
null
Question: What does the code get from the string ? Code: def getIntFromFloatString(value): floatString = str(value).strip() if (floatString == ''): return None dotIndex = floatString.find('.') if (dotIndex < 0): return int(value) return int(round(float(floatString)))
null
null
null
Does the code get the int from the string ?
def getIntFromFloatString(value): floatString = str(value).strip() if (floatString == ''): return None dotIndex = floatString.find('.') if (dotIndex < 0): return int(value) return int(round(float(floatString)))
null
null
null
Yes
codeqa
def get Int From Float String value float String str value strip if float String '' return Nonedot Index float String find ' ' if dot Index < 0 return int value return int round float float String
null
null
null
null
Question: Does the code get the int from the string ? Code: def getIntFromFloatString(value): floatString = str(value).strip() if (floatString == ''): return None dotIndex = floatString.find('.') if (dotIndex < 0): return int(value) return int(round(float(floatString)))
null
null
null
What does the code run in a thread ?
def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
a function
codeqa
def defer To Thread f *args **kwargs from twisted internet import reactorreturn defer To Thread Pool reactor reactor get Thread Pool f *args **kwargs
null
null
null
null
Question: What does the code run in a thread ? Code: def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
Does the code run a function in a thread ?
def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
Yes
codeqa
def defer To Thread f *args **kwargs from twisted internet import reactorreturn defer To Thread Pool reactor reactor get Thread Pool f *args **kwargs
null
null
null
null
Question: Does the code run a function in a thread ? Code: def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
What does the code return as a deferred ?
def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
the result
codeqa
def defer To Thread f *args **kwargs from twisted internet import reactorreturn defer To Thread Pool reactor reactor get Thread Pool f *args **kwargs
null
null
null
null
Question: What does the code return as a deferred ? Code: def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
Where does the code run a function ?
def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
in a thread
codeqa
def defer To Thread f *args **kwargs from twisted internet import reactorreturn defer To Thread Pool reactor reactor get Thread Pool f *args **kwargs
null
null
null
null
Question: Where does the code run a function ? Code: def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
Does the code return the result as a deferred ?
def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
Yes
codeqa
def defer To Thread f *args **kwargs from twisted internet import reactorreturn defer To Thread Pool reactor reactor get Thread Pool f *args **kwargs
null
null
null
null
Question: Does the code return the result as a deferred ? Code: def deferToThread(f, *args, **kwargs): from twisted.internet import reactor return deferToThreadPool(reactor, reactor.getThreadPool(), f, *args, **kwargs)
null
null
null
What has configuration files to work on ?
def has_man_pages(build): return bool(build.distribution.man_pages)
null
null
null
the distribution
codeqa
def has man pages build return bool build distribution man pages
null
null
null
null
Question: What has configuration files to work on ? Code: def has_man_pages(build): return bool(build.distribution.man_pages)
null
null
null
How are permissions set ?
def validate_permissions_for_doctype(doctype, for_remove=False): doctype = frappe.get_doc(u'DocType', doctype) if (frappe.conf.developer_mode and (not frappe.flags.in_test)): doctype.save() else: validate_permissions(doctype, for_remove) for perm in doctype.get(u'permissions'): perm.db_update()
null
null
null
correctly
codeqa
def validate permissions for doctype doctype for remove False doctype frappe get doc u' Doc Type' doctype if frappe conf developer mode and not frappe flags in test doctype save else validate permissions doctype for remove for perm in doctype get u'permissions' perm db update
null
null
null
null
Question: How are permissions set ? Code: def validate_permissions_for_doctype(doctype, for_remove=False): doctype = frappe.get_doc(u'DocType', doctype) if (frappe.conf.developer_mode and (not frappe.flags.in_test)): doctype.save() else: validate_permissions(doctype, for_remove) for perm in doctype.get(u'permissions'): perm.db_update()
null
null
null
What does the code add to vector3rackprofiles ?
def addRackHoles(derivation, vector3RackProfiles, xmlElement): if (len(derivation.gearHolePaths) > 0): vector3RackProfiles += derivation.gearHolePaths return if (derivation.rackHoleRadius <= 0.0): return addRackHole(derivation, vector3RackProfiles, 0.0, xmlElement) rackHoleMargin = (derivation.rackHoleRadius + derivation.rackHoleRadius) rackHoleSteps = int(math.ceil(((derivation.rackDemilength - rackHoleMargin) / derivation.rackHoleStep))) for rackHoleIndex in xrange(1, rackHoleSteps): x = (float(rackHoleIndex) * derivation.rackHoleStep) addRackHole(derivation, vector3RackProfiles, (- x), xmlElement) addRackHole(derivation, vector3RackProfiles, x, xmlElement)
null
null
null
rack holes
codeqa
def add Rack Holes derivation vector 3 Rack Profiles xml Element if len derivation gear Hole Paths > 0 vector 3 Rack Profiles + derivation gear Hole Pathsreturnif derivation rack Hole Radius < 0 0 returnadd Rack Hole derivation vector 3 Rack Profiles 0 0 xml Element rack Hole Margin derivation rack Hole Radius + derivation rack Hole Radius rack Hole Steps int math ceil derivation rack Demilength - rack Hole Margin / derivation rack Hole Step for rack Hole Index in xrange 1 rack Hole Steps x float rack Hole Index * derivation rack Hole Step add Rack Hole derivation vector 3 Rack Profiles - x xml Element add Rack Hole derivation vector 3 Rack Profiles x xml Element
null
null
null
null
Question: What does the code add to vector3rackprofiles ? Code: def addRackHoles(derivation, vector3RackProfiles, xmlElement): if (len(derivation.gearHolePaths) > 0): vector3RackProfiles += derivation.gearHolePaths return if (derivation.rackHoleRadius <= 0.0): return addRackHole(derivation, vector3RackProfiles, 0.0, xmlElement) rackHoleMargin = (derivation.rackHoleRadius + derivation.rackHoleRadius) rackHoleSteps = int(math.ceil(((derivation.rackDemilength - rackHoleMargin) / derivation.rackHoleStep))) for rackHoleIndex in xrange(1, rackHoleSteps): x = (float(rackHoleIndex) * derivation.rackHoleStep) addRackHole(derivation, vector3RackProfiles, (- x), xmlElement) addRackHole(derivation, vector3RackProfiles, x, xmlElement)
null
null
null
Does the code add rack holes to vector3rackprofiles ?
def addRackHoles(derivation, vector3RackProfiles, xmlElement): if (len(derivation.gearHolePaths) > 0): vector3RackProfiles += derivation.gearHolePaths return if (derivation.rackHoleRadius <= 0.0): return addRackHole(derivation, vector3RackProfiles, 0.0, xmlElement) rackHoleMargin = (derivation.rackHoleRadius + derivation.rackHoleRadius) rackHoleSteps = int(math.ceil(((derivation.rackDemilength - rackHoleMargin) / derivation.rackHoleStep))) for rackHoleIndex in xrange(1, rackHoleSteps): x = (float(rackHoleIndex) * derivation.rackHoleStep) addRackHole(derivation, vector3RackProfiles, (- x), xmlElement) addRackHole(derivation, vector3RackProfiles, x, xmlElement)
null
null
null
Yes
codeqa
def add Rack Holes derivation vector 3 Rack Profiles xml Element if len derivation gear Hole Paths > 0 vector 3 Rack Profiles + derivation gear Hole Pathsreturnif derivation rack Hole Radius < 0 0 returnadd Rack Hole derivation vector 3 Rack Profiles 0 0 xml Element rack Hole Margin derivation rack Hole Radius + derivation rack Hole Radius rack Hole Steps int math ceil derivation rack Demilength - rack Hole Margin / derivation rack Hole Step for rack Hole Index in xrange 1 rack Hole Steps x float rack Hole Index * derivation rack Hole Step add Rack Hole derivation vector 3 Rack Profiles - x xml Element add Rack Hole derivation vector 3 Rack Profiles x xml Element
null
null
null
null
Question: Does the code add rack holes to vector3rackprofiles ? Code: def addRackHoles(derivation, vector3RackProfiles, xmlElement): if (len(derivation.gearHolePaths) > 0): vector3RackProfiles += derivation.gearHolePaths return if (derivation.rackHoleRadius <= 0.0): return addRackHole(derivation, vector3RackProfiles, 0.0, xmlElement) rackHoleMargin = (derivation.rackHoleRadius + derivation.rackHoleRadius) rackHoleSteps = int(math.ceil(((derivation.rackDemilength - rackHoleMargin) / derivation.rackHoleStep))) for rackHoleIndex in xrange(1, rackHoleSteps): x = (float(rackHoleIndex) * derivation.rackHoleStep) addRackHole(derivation, vector3RackProfiles, (- x), xmlElement) addRackHole(derivation, vector3RackProfiles, x, xmlElement)
null
null
null
How did timezone provide timezone ?
def test_aware_datetime_explicit_tz(): new_datetime = aware_datetime(2016, 1, 2, 21, 52, 25, tz=pytz.utc) assert timezone.is_aware(new_datetime) assert (new_datetime.tzinfo.zone == pytz.utc.zone)
null
null
null
explicitly
codeqa
def test aware datetime explicit tz new datetime aware datetime 2016 1 2 21 52 25 tz pytz utc assert timezone is aware new datetime assert new datetime tzinfo zone pytz utc zone
null
null
null
null
Question: How did timezone provide timezone ? Code: def test_aware_datetime_explicit_tz(): new_datetime = aware_datetime(2016, 1, 2, 21, 52, 25, tz=pytz.utc) assert timezone.is_aware(new_datetime) assert (new_datetime.tzinfo.zone == pytz.utc.zone)
null
null
null
How is the supplied module related to encodings ?
def IsEncodingsModule(module_name): if ((module_name in ('codecs', 'encodings')) or module_name.startswith('encodings.')): return True return False
null
null
null
in any way
codeqa
def Is Encodings Module module name if module name in 'codecs' 'encodings' or module name startswith 'encodings ' return Truereturn False
null
null
null
null
Question: How is the supplied module related to encodings ? Code: def IsEncodingsModule(module_name): if ((module_name in ('codecs', 'encodings')) or module_name.startswith('encodings.')): return True return False