id
stringlengths
11
16
language
stringclasses
2 values
question
stringlengths
13
844
answer
stringlengths
1
900
code
stringlengths
162
27.4k
code_original
stringlengths
162
26k
code_word_count
int64
51
5.96k
python-test-3
python
Does the code create a simple sdist tarball at dist_path ?
Yes
def make trivial sdist dist path setup py setup py file tarfile Tar Info name 'setup py' try Mem File Bytes I Oexcept Attribute Error Mem File String I Osetup py bytes Mem File setup py encode 'utf- 8 ' setup py file size len setup py bytes getvalue dist tarfile open dist path 'w gz' try dist addfile setup py file file...
def make_trivial_sdist dist_path setup_py setup_py_file tarfile TarInfo name 'setup py' try MemFile BytesIOexcept AttributeError MemFile StringIOsetup_py_bytes MemFile setup_py encode 'utf-8' setup_py_file size len setup_py_bytes getvalue dist tarfile open dist_path 'w gz' try dist addfile setup_py_file fileobj setup_p...
69
python-test-4
python
How does the code create a simple sdist tarball ?
at dist_path
def make trivial sdist dist path setup py setup py file tarfile Tar Info name 'setup py' try Mem File Bytes I Oexcept Attribute Error Mem File String I Osetup py bytes Mem File setup py encode 'utf- 8 ' setup py file size len setup py bytes getvalue dist tarfile open dist path 'w gz' try dist addfile setup py file file...
def make_trivial_sdist dist_path setup_py setup_py_file tarfile TarInfo name 'setup py' try MemFile BytesIOexcept AttributeError MemFile StringIOsetup_py_bytes MemFile setup_py encode 'utf-8' setup_py_file size len setup_py_bytes getvalue dist tarfile open dist_path 'w gz' try dist addfile setup_py_file fileobj setup_p...
69
python-test-5
python
What does the code create at dist_path ?
a simple sdist tarball
def make trivial sdist dist path setup py setup py file tarfile Tar Info name 'setup py' try Mem File Bytes I Oexcept Attribute Error Mem File String I Osetup py bytes Mem File setup py encode 'utf- 8 ' setup py file size len setup py bytes getvalue dist tarfile open dist path 'w gz' try dist addfile setup py file file...
def make_trivial_sdist dist_path setup_py setup_py_file tarfile TarInfo name 'setup py' try MemFile BytesIOexcept AttributeError MemFile StringIOsetup_py_bytes MemFile setup_py encode 'utf-8' setup_py_file size len setup_py_bytes getvalue dist tarfile open dist_path 'w gz' try dist addfile setup_py_file fileobj setup_p...
69
python-test-6
python
Where does le dirs set ?
in parent_dir
def create le config parent dir config copy deepcopy constants CLI DEFAULTS le dir os path join parent dir 'certbot' config['config dir'] os path join le dir 'config' config['work dir'] os path join le dir 'work' config['logs dir'] os path join le dir 'logs dir' os makedirs config['config dir'] os mkdir config['work di...
def create_le_config parent_dir config copy deepcopy constants CLI_DEFAULTS le_dir os path join parent_dir 'certbot' config['config_dir'] os path join le_dir 'config' config['work_dir'] os path join le_dir 'work' config['logs_dir'] os path join le_dir 'logs_dir' os makedirs config['config_dir'] os mkdir config['work_di...
62
python-test-7
python
Does le dirs set in parent_dir ?
Yes
def create le config parent dir config copy deepcopy constants CLI DEFAULTS le dir os path join parent dir 'certbot' config['config dir'] os path join le dir 'config' config['work dir'] os path join le dir 'work' config['logs dir'] os path join le dir 'logs dir' os makedirs config['config dir'] os mkdir config['work di...
def create_le_config parent_dir config copy deepcopy constants CLI_DEFAULTS le_dir os path join parent_dir 'certbot' config['config_dir'] os path join le_dir 'config' config['work_dir'] os path join le_dir 'work' config['logs_dir'] os path join le_dir 'logs_dir' os makedirs config['config_dir'] os mkdir config['work_di...
62
python-test-8
python
What sets in parent_dir ?
le dirs
def create le config parent dir config copy deepcopy constants CLI DEFAULTS le dir os path join parent dir 'certbot' config['config dir'] os path join le dir 'config' config['work dir'] os path join le dir 'work' config['logs dir'] os path join le dir 'logs dir' os makedirs config['config dir'] os mkdir config['work di...
def create_le_config parent_dir config copy deepcopy constants CLI_DEFAULTS le_dir os path join parent_dir 'certbot' config['config_dir'] os path join le_dir 'config' config['work_dir'] os path join le_dir 'work' config['logs_dir'] os path join le_dir 'logs_dir' os makedirs config['config_dir'] os mkdir config['work_di...
62
python-test-11
python
Does the code remove an user from an object like ?
Yes
def remove like obj user obj type apps get model 'contenttypes' ' Content Type' objects get for model obj with atomic qs Like objects filter content type obj type object id obj id user user if not qs exists returnlike qs first project like projectqs delete if project is not None project refresh totals
def remove_like obj user obj_type apps get_model 'contenttypes' 'ContentType' objects get_for_model obj with atomic qs Like objects filter content_type obj_type object_id obj id user user if not qs exists returnlike qs first project like projectqs delete if project is not None project refresh_totals
54
python-test-12
python
How does the code remove an user from an object ?
like
def remove like obj user obj type apps get model 'contenttypes' ' Content Type' objects get for model obj with atomic qs Like objects filter content type obj type object id obj id user user if not qs exists returnlike qs first project like projectqs delete if project is not None project refresh totals
def remove_like obj user obj_type apps get_model 'contenttypes' 'ContentType' objects get_for_model obj with atomic qs Like objects filter content_type obj_type object_id obj id user user if not qs exists returnlike qs first project like projectqs delete if project is not None project refresh_totals
54
python-test-13
python
What does the code ensure ?
that all associated messagecategories are deleted when a message is deleted
def test message delete db gmail account api client new api client db gmail account namespace generic thread add fake thread db session gmail account namespace id gen message add fake message db session gmail account namespace id generic thread category ids []for i in xrange 10 po data api client post data '/labels/' {...
def test_message_delete db gmail_account api_client new_api_client db gmail_account namespace generic_thread add_fake_thread db session gmail_account namespace id gen_message add_fake_message db session gmail_account namespace id generic_thread category_ids []for i in xrange 10 po_data api_client post_data '/labels/' {...
140
python-test-14
python
When are all associated messagecategories deleted ?
when a message is deleted
def test message delete db gmail account api client new api client db gmail account namespace generic thread add fake thread db session gmail account namespace id gen message add fake message db session gmail account namespace id generic thread category ids []for i in xrange 10 po data api client post data '/labels/' {...
def test_message_delete db gmail_account api_client new_api_client db gmail_account namespace generic_thread add_fake_thread db session gmail_account namespace id gen_message add_fake_message db session gmail_account namespace id generic_thread category_ids []for i in xrange 10 po_data api_client post_data '/labels/' {...
140
python-test-15
python
Does the code ensure ?
Yes
def test message delete db gmail account api client new api client db gmail account namespace generic thread add fake thread db session gmail account namespace id gen message add fake message db session gmail account namespace id generic thread category ids []for i in xrange 10 po data api client post data '/labels/' {...
def test_message_delete db gmail_account api_client new_api_client db gmail_account namespace generic_thread add_fake_thread db session gmail_account namespace id gen_message add_fake_message db session gmail_account namespace id generic_thread category_ids []for i in xrange 10 po_data api_client post_data '/labels/' {...
140
python-test-22
python
What handles exceptions ?
front - end wrapper
def get query handle and state query history handle query history get handle if handle is None raise Popup Exception ' Failedtoretrievequerystatefromthe Query Server ' state dbms get query history owner query history get query server config get state handle if state is None raise Popup Exception ' Failedtocontact Serve...
def _get_query_handle_and_state query_history handle query_history get_handle if handle is None raise PopupException _ 'FailedtoretrievequerystatefromtheQueryServer ' state dbms get query_history owner query_history get_query_server_config get_state handle if state is None raise PopupException _ 'FailedtocontactServert...
54
python-test-23
python
Do front - end wrapper handle exceptions ?
Yes
def get query handle and state query history handle query history get handle if handle is None raise Popup Exception ' Failedtoretrievequerystatefromthe Query Server ' state dbms get query history owner query history get query server config get state handle if state is None raise Popup Exception ' Failedtocontact Serve...
def _get_query_handle_and_state query_history handle query_history get_handle if handle is None raise PopupException _ 'FailedtoretrievequerystatefromtheQueryServer ' state dbms get query_history owner query_history get_query_server_config get_state handle if state is None raise PopupException _ 'FailedtocontactServert...
54
python-test-24
python
Does the code create a factory to produce throttledhttprpcserver for a given throttle ?
Yes
def Throttled Http Rpc Server Factory throttle throttle class None def Make Rpc Server *args **kwargs ' Factorytoproducea Throttled Http Rpc Server \n\n Args \nargs Positionalargstopassto Throttled Http Rpc Server \nkwargs Keywordargstopassto Throttled Http Rpc Server \n\n Returns \n A Throttled Http Rpc Serverinstance...
def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type']...
76
python-test-25
python
What does the code create ?
a factory to produce throttledhttprpcserver for a given throttle
def Throttled Http Rpc Server Factory throttle throttle class None def Make Rpc Server *args **kwargs ' Factorytoproducea Throttled Http Rpc Server \n\n Args \nargs Positionalargstopassto Throttled Http Rpc Server \nkwargs Keywordargstopassto Throttled Http Rpc Server \n\n Returns \n A Throttled Http Rpc Serverinstance...
def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type']...
76
python-test-26
python
Do a factory produce throttledhttprpcserver ?
Yes
def Throttled Http Rpc Server Factory throttle throttle class None def Make Rpc Server *args **kwargs ' Factorytoproducea Throttled Http Rpc Server \n\n Args \nargs Positionalargstopassto Throttled Http Rpc Server \nkwargs Keywordargstopassto Throttled Http Rpc Server \n\n Returns \n A Throttled Http Rpc Serverinstance...
def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type']...
76
python-test-27
python
What do a factory produce ?
throttledhttprpcserver
def Throttled Http Rpc Server Factory throttle throttle class None def Make Rpc Server *args **kwargs ' Factorytoproducea Throttled Http Rpc Server \n\n Args \nargs Positionalargstopassto Throttled Http Rpc Server \nkwargs Keywordargstopassto Throttled Http Rpc Server \n\n Returns \n A Throttled Http Rpc Serverinstance...
def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type']...
76
python-test-39
python
What does a code string convert ?
to colorized css / html
def str 2 css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'string IO String IO String IO parse Parser sourcestring colors colors title title out string IO markup markup header header footer footer linenumbers linenumber...
def str2css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'stringIO StringIO StringIO parse Parser sourcestring colors colors title title out stringIO markup markup header header footer footer linenumbers linenumbers pars...
77
python-test-40
python
Does a code string convert to colorized css / html ?
Yes
def str 2 css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'string IO String IO String IO parse Parser sourcestring colors colors title title out string IO markup markup header header footer footer linenumbers linenumber...
def str2css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'stringIO StringIO StringIO parse Parser sourcestring colors colors title title out stringIO markup markup header header footer footer linenumbers linenumbers pars...
77
python-test-41
python
What converts to colorized css / html ?
a code string
def str 2 css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'string IO String IO String IO parse Parser sourcestring colors colors title title out string IO markup markup header header footer footer linenumbers linenumber...
def str2css sourcestring colors None title '' markup 'css' header None footer None linenumbers 0 form None if markup lower not in ['css' 'xhtml'] markup 'css'stringIO StringIO StringIO parse Parser sourcestring colors colors title title out stringIO markup markup header header footer footer linenumbers linenumbers pars...
77
python-test-44
python
What is testing on a production server ?
the python sandbox
@login required@ensure csrf cookiedef run python request if not request user is staff raise Http 404 c {}c['code'] ''c['results'] Noneif request method 'POST' py code c['code'] request POST get 'code' g {}try safe exec py code g except Exception c['results'] traceback format exc else c['results'] pprint pformat g retur...
@login_required@ensure_csrf_cookiedef run_python request if not request user is_staff raise Http404c {}c['code'] ''c['results'] Noneif request method 'POST' py_code c['code'] request POST get 'code' g {}try safe_exec py_code g except Exception c['results'] traceback format_exc else c['results'] pprint pformat g return ...
57
python-test-45
python
Do a page allow testing the python sandbox on a production server ?
Yes
@login required@ensure csrf cookiedef run python request if not request user is staff raise Http 404 c {}c['code'] ''c['results'] Noneif request method 'POST' py code c['code'] request POST get 'code' g {}try safe exec py code g except Exception c['results'] traceback format exc else c['results'] pprint pformat g retur...
@login_required@ensure_csrf_cookiedef run_python request if not request user is_staff raise Http404c {}c['code'] ''c['results'] Noneif request method 'POST' py_code c['code'] request POST get 'code' g {}try safe_exec py_code g except Exception c['results'] traceback format_exc else c['results'] pprint pformat g return ...
57
python-test-46
python
What do a page allow ?
testing the python sandbox on a production server
@login required@ensure csrf cookiedef run python request if not request user is staff raise Http 404 c {}c['code'] ''c['results'] Noneif request method 'POST' py code c['code'] request POST get 'code' g {}try safe exec py code g except Exception c['results'] traceback format exc else c['results'] pprint pformat g retur...
@login_required@ensure_csrf_cookiedef run_python request if not request user is_staff raise Http404c {}c['code'] ''c['results'] Noneif request method 'POST' py_code c['code'] request POST get 'code' g {}try safe_exec py_code g except Exception c['results'] traceback format_exc else c['results'] pprint pformat g return ...
57
python-test-47
python
Do the python sandbox test on a production server ?
Yes
@login required@ensure csrf cookiedef run python request if not request user is staff raise Http 404 c {}c['code'] ''c['results'] Noneif request method 'POST' py code c['code'] request POST get 'code' g {}try safe exec py code g except Exception c['results'] traceback format exc else c['results'] pprint pformat g retur...
@login_required@ensure_csrf_cookiedef run_python request if not request user is_staff raise Http404c {}c['code'] ''c['results'] Noneif request method 'POST' py_code c['code'] request POST get 'code' g {}try safe_exec py_code g except Exception c['results'] traceback format_exc else c['results'] pprint pformat g return ...
57
python-test-48
python
Where do the python sandbox test ?
on a production server
@login required@ensure csrf cookiedef run python request if not request user is staff raise Http 404 c {}c['code'] ''c['results'] Noneif request method 'POST' py code c['code'] request POST get 'code' g {}try safe exec py code g except Exception c['results'] traceback format exc else c['results'] pprint pformat g retur...
@login_required@ensure_csrf_cookiedef run_python request if not request user is_staff raise Http404c {}c['code'] ''c['results'] Noneif request method 'POST' py_code c['code'] request POST get 'code' g {}try safe_exec py_code g except Exception c['results'] traceback format_exc else c['results'] pprint pformat g return ...
57
python-test-81
python
Does the code find the name of the zone which contains the specified name ?
Yes
def zone for name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from text name dns name root if resolver is None resolver get default resolver if not name is absolute raise Not Absolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if ans...
def zone_for_name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from_text name dns name root if resolver is None resolver get_default_resolver if not name is_absolute raise NotAbsolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if answ...
83
python-test-82
python
What does the code find ?
the name of the zone which contains the specified name
def zone for name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from text name dns name root if resolver is None resolver get default resolver if not name is absolute raise Not Absolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if ans...
def zone_for_name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from_text name dns name root if resolver is None resolver get_default_resolver if not name is_absolute raise NotAbsolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if answ...
83
python-test-83
python
Does the zone contain the specified name ?
Yes
def zone for name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from text name dns name root if resolver is None resolver get default resolver if not name is absolute raise Not Absolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if ans...
def zone_for_name name rdclass dns rdataclass IN tcp False resolver None if isinstance name str unicode name dns name from_text name dns name root if resolver is None resolver get_default_resolver if not name is_absolute raise NotAbsolute name while 1 try answer resolver query name dns rdatatype SOA rdclass tcp if answ...
83
python-test-84
python
Do user provide an initial weights matrix when ?
Yes
def test infomax weights ini X np random random 3 100 weights np array [[ 1 2 3] [4 5 6] [7 8 9]] dtype np float 64 w1 infomax X max iter 0 weights weights extended True w2 infomax X max iter 0 weights weights extended False assert almost equal w1 weights assert almost equal w2 weights
def test_infomax_weights_ini X np random random 3 100 weights np array [[1 2 3] [4 5 6] [7 8 9]] dtype np float64 w1 infomax X max_iter 0 weights weights extended True w2 infomax X max_iter 0 weights weights extended False assert_almost_equal w1 weights assert_almost_equal w2 weights
58
python-test-85
python
What do user provide when ?
an initial weights matrix
def test infomax weights ini X np random random 3 100 weights np array [[ 1 2 3] [4 5 6] [7 8 9]] dtype np float 64 w1 infomax X max iter 0 weights weights extended True w2 infomax X max iter 0 weights weights extended False assert almost equal w1 weights assert almost equal w2 weights
def test_infomax_weights_ini X np random random 3 100 weights np array [[1 2 3] [4 5 6] [7 8 9]] dtype np float64 w1 infomax X max_iter 0 weights weights extended True w2 infomax X max_iter 0 weights weights extended False assert_almost_equal w1 weights assert_almost_equal w2 weights
58
python-test-86
python
When do the infomax algorithm test ?
when user provides an initial weights matrix
def test infomax weights ini X np random random 3 100 weights np array [[ 1 2 3] [4 5 6] [7 8 9]] dtype np float 64 w1 infomax X max iter 0 weights weights extended True w2 infomax X max iter 0 weights weights extended False assert almost equal w1 weights assert almost equal w2 weights
def test_infomax_weights_ini X np random random 3 100 weights np array [[1 2 3] [4 5 6] [7 8 9]] dtype np float64 w1 infomax X max_iter 0 weights weights extended True w2 infomax X max_iter 0 weights weights extended False assert_almost_equal w1 weights assert_almost_equal w2 weights
58
python-test-87
python
What does the code generate ?
a url at which a request for oauth request token is to be sent
def Generate O Auth Request Token Url oauth input params scopes request token url 'https //www google com/accounts/O Auth Get Request Token' extra parameters None scopes string '' join [str scope for scope in scopes] parameters {'scope' scopes string}if extra parameters parameters update extra parameters oauth request ...
def GenerateOAuthRequestTokenUrl oauth_input_params scopes request_token_url 'https //www google com/accounts/OAuthGetRequestToken' extra_parameters None scopes_string '' join [str scope for scope in scopes] parameters {'scope' scopes_string}if extra_parameters parameters update extra_parameters oauth_request oauth OAu...
92
python-test-88
python
What be sent a url ?
a request for oauth request token
def Generate O Auth Request Token Url oauth input params scopes request token url 'https //www google com/accounts/O Auth Get Request Token' extra parameters None scopes string '' join [str scope for scope in scopes] parameters {'scope' scopes string}if extra parameters parameters update extra parameters oauth request ...
def GenerateOAuthRequestTokenUrl oauth_input_params scopes request_token_url 'https //www google com/accounts/OAuthGetRequestToken' extra_parameters None scopes_string '' join [str scope for scope in scopes] parameters {'scope' scopes_string}if extra_parameters parameters update extra_parameters oauth_request oauth OAu...
92
python-test-89
python
Does the code generate a url at which a request for oauth request token is to be sent ?
Yes
def Generate O Auth Request Token Url oauth input params scopes request token url 'https //www google com/accounts/O Auth Get Request Token' extra parameters None scopes string '' join [str scope for scope in scopes] parameters {'scope' scopes string}if extra parameters parameters update extra parameters oauth request ...
def GenerateOAuthRequestTokenUrl oauth_input_params scopes request_token_url 'https //www google com/accounts/OAuthGetRequestToken' extra_parameters None scopes_string '' join [str scope for scope in scopes] parameters {'scope' scopes_string}if extra_parameters parameters update extra_parameters oauth_request oauth OAu...
92
python-test-90
python
Be a request for oauth request token sent a url ?
Yes
def Generate O Auth Request Token Url oauth input params scopes request token url 'https //www google com/accounts/O Auth Get Request Token' extra parameters None scopes string '' join [str scope for scope in scopes] parameters {'scope' scopes string}if extra parameters parameters update extra parameters oauth request ...
def GenerateOAuthRequestTokenUrl oauth_input_params scopes request_token_url 'https //www google com/accounts/OAuthGetRequestToken' extra_parameters None scopes_string '' join [str scope for scope in scopes] parameters {'scope' scopes_string}if extra_parameters parameters update extra_parameters oauth_request oauth OAu...
92
python-test-91
python
Where does the user display all the data from the selected question ?
in a simple chart
def completed chart series id get vars get 'series id' if not series id return ' Programming Error Series I Dmissing'question id get vars get 'question id' if not question id return ' Programming Error Question I Dmissing'q type get vars get 'type' if not q type return ' Programming Error Question Typemissing'get Answe...
def completed_chart series_id get_vars get 'series_id' if not series_id return 'ProgrammingError SeriesIDmissing'question_id get_vars get 'question_id' if not question_id return 'ProgrammingError QuestionIDmissing'q_type get_vars get 'type' if not q_type return 'ProgrammingError QuestionTypemissing'getAnswers s3db surv...
99
python-test-92
python
Does the user display all the data from the selected question in a simple chart ?
Yes
def completed chart series id get vars get 'series id' if not series id return ' Programming Error Series I Dmissing'question id get vars get 'question id' if not question id return ' Programming Error Question I Dmissing'q type get vars get 'type' if not q type return ' Programming Error Question Typemissing'get Answe...
def completed_chart series_id get_vars get 'series_id' if not series_id return 'ProgrammingError SeriesIDmissing'question_id get_vars get 'question_id' if not question_id return 'ProgrammingError QuestionIDmissing'q_type get_vars get 'type' if not q_type return 'ProgrammingError QuestionTypemissing'getAnswers s3db surv...
99
python-test-93
python
What does the code allow ?
the user to display all the data from the selected question in a simple chart
def completed chart series id get vars get 'series id' if not series id return ' Programming Error Series I Dmissing'question id get vars get 'question id' if not question id return ' Programming Error Question I Dmissing'q type get vars get 'type' if not q type return ' Programming Error Question Typemissing'get Answe...
def completed_chart series_id get_vars get 'series_id' if not series_id return 'ProgrammingError SeriesIDmissing'question_id get_vars get 'question_id' if not question_id return 'ProgrammingError QuestionIDmissing'q_type get_vars get 'type' if not q_type return 'ProgrammingError QuestionTypemissing'getAnswers s3db surv...
99
python-test-94
python
Does the code allow the user to display all the data from the selected question in a simple chart ?
Yes
def completed chart series id get vars get 'series id' if not series id return ' Programming Error Series I Dmissing'question id get vars get 'question id' if not question id return ' Programming Error Question I Dmissing'q type get vars get 'type' if not q type return ' Programming Error Question Typemissing'get Answe...
def completed_chart series_id get_vars get 'series_id' if not series_id return 'ProgrammingError SeriesIDmissing'question_id get_vars get 'question_id' if not question_id return 'ProgrammingError QuestionIDmissing'q_type get_vars get 'type' if not q_type return 'ProgrammingError QuestionTypemissing'getAnswers s3db surv...
99
python-test-95
python
What does the user display in a simple chart ?
all the data from the selected question
def completed chart series id get vars get 'series id' if not series id return ' Programming Error Series I Dmissing'question id get vars get 'question id' if not question id return ' Programming Error Question I Dmissing'q type get vars get 'type' if not q type return ' Programming Error Question Typemissing'get Answe...
def completed_chart series_id get_vars get 'series_id' if not series_id return 'ProgrammingError SeriesIDmissing'question_id get_vars get 'question_id' if not question_id return 'ProgrammingError QuestionIDmissing'q_type get_vars get 'type' if not q_type return 'ProgrammingError QuestionTypemissing'getAnswers s3db surv...
99
python-test-102
python
What do we have ?
a panel of time series with consecutive
def cov nw panel results nlags groupidx weights func weights bartlett use correction 'hac' if nlags 0 weights [1 0]else weights weights func nlags xu hessian inv get sandwich arrays results S hac S nw panel xu weights groupidx cov hac HCCM 2 hessian inv S hac if use correction nobs k params xu shapeif use correction 'h...
def cov_nw_panel results nlags groupidx weights_func weights_bartlett use_correction 'hac' if nlags 0 weights [1 0]else weights weights_func nlags xu hessian_inv _get_sandwich_arrays results S_hac S_nw_panel xu weights groupidx cov_hac _HCCM2 hessian_inv S_hac if use_correction nobs k_params xu shapeif use_correction '...
106
python-test-103
python
Do we have a panel of time series with consecutive ?
Yes
def cov nw panel results nlags groupidx weights func weights bartlett use correction 'hac' if nlags 0 weights [1 0]else weights weights func nlags xu hessian inv get sandwich arrays results S hac S nw panel xu weights groupidx cov hac HCCM 2 hessian inv S hac if use correction nobs k params xu shapeif use correction 'h...
def cov_nw_panel results nlags groupidx weights_func weights_bartlett use_correction 'hac' if nlags 0 weights [1 0]else weights weights_func nlags xu hessian_inv _get_sandwich_arrays results S_hac S_nw_panel xu weights groupidx cov_hac _HCCM2 hessian_inv S_hac if use_correction nobs k_params xu shapeif use_correction '...
106
python-test-104
python
What does the code walk looking for files and marking their content type ?
a dir path
def iter dir dir saltenv ret []for fn in os listdir dir path os path join dir fn if os path isdir path yield iter dir path saltenv elif os path isfile path with salt utils fopen path as fp if salt utils istextfile fp ret append {'path' six text type path 'saltenv' six text type saltenv 'content' six text type fp read }...
def _iter_dir dir_ saltenv ret []for fn_ in os listdir dir_ path os path join dir_ fn_ if os path isdir path yield _iter_dir path saltenv elif os path isfile path with salt utils fopen path as fp_ if salt utils istextfile fp_ ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' six text_type ...
81
python-test-105
python
Does the code walk a dir path looking for files and marking their content type ?
Yes
def iter dir dir saltenv ret []for fn in os listdir dir path os path join dir fn if os path isdir path yield iter dir path saltenv elif os path isfile path with salt utils fopen path as fp if salt utils istextfile fp ret append {'path' six text type path 'saltenv' six text type saltenv 'content' six text type fp read }...
def _iter_dir dir_ saltenv ret []for fn_ in os listdir dir_ path os path join dir_ fn_ if os path isdir path yield _iter_dir path saltenv elif os path isfile path with salt utils fopen path as fp_ if salt utils istextfile fp_ ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' six text_type ...
81
python-test-106
python
Does the code mark their content type ?
Yes
def iter dir dir saltenv ret []for fn in os listdir dir path os path join dir fn if os path isdir path yield iter dir path saltenv elif os path isfile path with salt utils fopen path as fp if salt utils istextfile fp ret append {'path' six text type path 'saltenv' six text type saltenv 'content' six text type fp read }...
def _iter_dir dir_ saltenv ret []for fn_ in os listdir dir_ path os path join dir_ fn_ if os path isdir path yield _iter_dir path saltenv elif os path isfile path with salt utils fopen path as fp_ if salt utils istextfile fp_ ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' six text_type ...
81
python-test-107
python
What does the code mark ?
their content type
def iter dir dir saltenv ret []for fn in os listdir dir path os path join dir fn if os path isdir path yield iter dir path saltenv elif os path isfile path with salt utils fopen path as fp if salt utils istextfile fp ret append {'path' six text type path 'saltenv' six text type saltenv 'content' six text type fp read }...
def _iter_dir dir_ saltenv ret []for fn_ in os listdir dir_ path os path join dir_ fn_ if os path isdir path yield _iter_dir path saltenv elif os path isfile path with salt utils fopen path as fp_ if salt utils istextfile fp_ ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' six text_type ...
81
python-test-108
python
How does a new clip return a new clip ?
with a mask for transparency
def mask color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl image flim mask ismask Truenewclip clip set mask mask return newclip
def mask_color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl_image flim mask ismask Truenewclip clip set_mask mask return newclip
67
python-test-109
python
Does a new clip return a new clip with a mask for transparency ?
Yes
def mask color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl image flim mask ismask Truenewclip clip set mask mask return newclip
def mask_color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl_image flim mask ismask Truenewclip clip set_mask mask return newclip
67
python-test-110
python
Does the original clip be of the given color where ?
Yes
def mask color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl image flim mask ismask Truenewclip clip set mask mask return newclip
def mask_color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl_image flim mask ismask Truenewclip clip set_mask mask return newclip
67
python-test-111
python
What is of the given color where ?
the original clip
def mask color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl image flim mask ismask Truenewclip clip set mask mask return newclip
def mask_color clip color [0 0 0] thr 0 s 1 hill lambda x 1 0 * x 0 if thr 0 else x ** s / thr ** s + x ** s color np array color flim lambda im hill np sqrt im - color ** 2 sum axis 2 mask clip fl_image flim mask ismask Truenewclip clip set_mask mask return newclip
67
python-test-116
python
Does the code calculate the next fst attempt in order to approximate a desired fst ?
Yes
def approximate fst desired fst simulated fst parameter fst max run fst 1 min run fst 0 limit 0 005 if abs simulated fst - desired fst < limit return parameter fst max run fst min run fst if simulated fst > desired fst max run fst parameter fstnext parameter fst min run fst + parameter fst / 2 else min run fst paramete...
def approximate_fst desired_fst simulated_fst parameter_fst max_run_fst 1 min_run_fst 0 limit 0 005 if abs simulated_fst - desired_fst < limit return parameter_fst max_run_fst min_run_fst if simulated_fst > desired_fst max_run_fst parameter_fstnext_parameter_fst min_run_fst + parameter_fst / 2 else min_run_fst paramete...
85
python-test-117
python
What does the code calculate in order to approximate a desired fst ?
the next fst attempt
def approximate fst desired fst simulated fst parameter fst max run fst 1 min run fst 0 limit 0 005 if abs simulated fst - desired fst < limit return parameter fst max run fst min run fst if simulated fst > desired fst max run fst parameter fstnext parameter fst min run fst + parameter fst / 2 else min run fst paramete...
def approximate_fst desired_fst simulated_fst parameter_fst max_run_fst 1 min_run_fst 0 limit 0 005 if abs simulated_fst - desired_fst < limit return parameter_fst max_run_fst min_run_fst if simulated_fst > desired_fst max_run_fst parameter_fstnext_parameter_fst min_run_fst + parameter_fst / 2 else min_run_fst paramete...
85
python-test-118
python
For what purpose does the code calculate the next fst attempt ?
in order to approximate a desired fst
def approximate fst desired fst simulated fst parameter fst max run fst 1 min run fst 0 limit 0 005 if abs simulated fst - desired fst < limit return parameter fst max run fst min run fst if simulated fst > desired fst max run fst parameter fstnext parameter fst min run fst + parameter fst / 2 else min run fst paramete...
def approximate_fst desired_fst simulated_fst parameter_fst max_run_fst 1 min_run_fst 0 limit 0 005 if abs simulated_fst - desired_fst < limit return parameter_fst max_run_fst min_run_fst if simulated_fst > desired_fst max_run_fst parameter_fstnext_parameter_fst min_run_fst + parameter_fst / 2 else min_run_fst paramete...
85
python-test-119
python
What does the code generate ?
the main lobe of a blackman - harris window x : bin positions to compute returns y : main lobe os spectrum of a blackman - harris window
def gen Bh Lobe x N 512 f x * np pi * 2 / N df 2 * np pi / N y np zeros x size consts [0 35875 0 48829 0 14128 0 01168 ]for m in range 0 4 y + consts[m] / 2 * sinc f - df * m N + sinc f + df * m N y y / N / consts[ 0 ] return y
def genBhLobe x N 512f x * np pi * 2 / N df 2 * np pi / N y np zeros x size consts [0 35875 0 48829 0 14128 0 01168]for m in range 0 4 y + consts[m] / 2 * sinc f - df * m N + sinc f + df * m N y y / N / consts[0] return y
74
python-test-120
python
Does the code generate the main lobe of a blackman - harris window x : bin positions to compute returns y : main lobe os spectrum of a blackman - harris window ?
Yes
def gen Bh Lobe x N 512 f x * np pi * 2 / N df 2 * np pi / N y np zeros x size consts [0 35875 0 48829 0 14128 0 01168 ]for m in range 0 4 y + consts[m] / 2 * sinc f - df * m N + sinc f + df * m N y y / N / consts[ 0 ] return y
def genBhLobe x N 512f x * np pi * 2 / N df 2 * np pi / N y np zeros x size consts [0 35875 0 48829 0 14128 0 01168]for m in range 0 4 y + consts[m] / 2 * sinc f - df * m N + sinc f + df * m N y y / N / consts[0] return y
74
python-test-135
python
Does the code get a point index which has a wide enough angle ?
Yes
def get Wide Angle Point Index loop dot Product Minimum 9999999 9widest Point Index 0for point Index in xrange len loop point loop[ point Index % len loop ]after Point loop[ point Index + 1 % len loop ]before Point loop[ point Index - 1 % len loop ]after Segment Normalized euclidean get Normalized after Point - point b...
def getWideAnglePointIndex loop dotProductMinimum 9999999 9widestPointIndex 0for pointIndex in xrange len loop point loop[ pointIndex % len loop ]afterPoint loop[ pointIndex + 1 % len loop ]beforePoint loop[ pointIndex - 1 % len loop ]afterSegmentNormalized euclidean getNormalized afterPoint - point beforeSegmentNormal...
107
python-test-136
python
What does a point index have ?
a wide enough angle
def get Wide Angle Point Index loop dot Product Minimum 9999999 9widest Point Index 0for point Index in xrange len loop point loop[ point Index % len loop ]after Point loop[ point Index + 1 % len loop ]before Point loop[ point Index - 1 % len loop ]after Segment Normalized euclidean get Normalized after Point - point b...
def getWideAnglePointIndex loop dotProductMinimum 9999999 9widestPointIndex 0for pointIndex in xrange len loop point loop[ pointIndex % len loop ]afterPoint loop[ pointIndex + 1 % len loop ]beforePoint loop[ pointIndex - 1 % len loop ]afterSegmentNormalized euclidean getNormalized afterPoint - point beforeSegmentNormal...
107
python-test-137
python
What has a wide enough angle ?
a point index
def get Wide Angle Point Index loop dot Product Minimum 9999999 9widest Point Index 0for point Index in xrange len loop point loop[ point Index % len loop ]after Point loop[ point Index + 1 % len loop ]before Point loop[ point Index - 1 % len loop ]after Segment Normalized euclidean get Normalized after Point - point b...
def getWideAnglePointIndex loop dotProductMinimum 9999999 9widestPointIndex 0for pointIndex in xrange len loop point loop[ pointIndex % len loop ]afterPoint loop[ pointIndex + 1 % len loop ]beforePoint loop[ pointIndex - 1 % len loop ]afterSegmentNormalized euclidean getNormalized afterPoint - point beforeSegmentNormal...
107
python-test-138
python
What does the code get ?
a point index which has a wide enough angle
def get Wide Angle Point Index loop dot Product Minimum 9999999 9widest Point Index 0for point Index in xrange len loop point loop[ point Index % len loop ]after Point loop[ point Index + 1 % len loop ]before Point loop[ point Index - 1 % len loop ]after Segment Normalized euclidean get Normalized after Point - point b...
def getWideAnglePointIndex loop dotProductMinimum 9999999 9widestPointIndex 0for pointIndex in xrange len loop point loop[ pointIndex % len loop ]afterPoint loop[ pointIndex + 1 % len loop ]beforePoint loop[ pointIndex - 1 % len loop ]afterSegmentNormalized euclidean getNormalized afterPoint - point beforeSegmentNormal...
107
python-test-139
python
Does a point index have a wide enough angle ?
Yes
def get Wide Angle Point Index loop dot Product Minimum 9999999 9widest Point Index 0for point Index in xrange len loop point loop[ point Index % len loop ]after Point loop[ point Index + 1 % len loop ]before Point loop[ point Index - 1 % len loop ]after Segment Normalized euclidean get Normalized after Point - point b...
def getWideAnglePointIndex loop dotProductMinimum 9999999 9widestPointIndex 0for pointIndex in xrange len loop point loop[ pointIndex % len loop ]afterPoint loop[ pointIndex + 1 % len loop ]beforePoint loop[ pointIndex - 1 % len loop ]afterSegmentNormalized euclidean getNormalized afterPoint - point beforeSegmentNormal...
107
python-test-140
python
Does the code attach a json points representation to each object of the queryset ?
Yes
def attach points queryset as field 'points attr' model queryset modelsql '\n SELEC Tjson agg \nrow to json projects points \n ORDERB Yprojects points order\n \n FRO Mprojects points\n WHER Eprojects points project id {tbl} id\n'sql sql format tbl model meta db table queryset queryset extra select {as field sql} return...
def attach_points queryset as_field 'points_attr' model queryset modelsql '\nSELECTjson_agg \nrow_to_json projects_points \nORDERBYprojects_points order\n \nFROMprojects_points\nWHEREprojects_points project_id {tbl} id\n'sql sql format tbl model _meta db_table queryset queryset extra select {as_field sql} return querys...
52
python-test-141
python
What does the code attach to each object of the queryset ?
a json points representation
def attach points queryset as field 'points attr' model queryset modelsql '\n SELEC Tjson agg \nrow to json projects points \n ORDERB Yprojects points order\n \n FRO Mprojects points\n WHER Eprojects points project id {tbl} id\n'sql sql format tbl model meta db table queryset queryset extra select {as field sql} return...
def attach_points queryset as_field 'points_attr' model queryset modelsql '\nSELECTjson_agg \nrow_to_json projects_points \nORDERBYprojects_points order\n \nFROMprojects_points\nWHEREprojects_points project_id {tbl} id\n'sql sql format tbl model _meta db_table queryset queryset extra select {as_field sql} return querys...
52
python-test-144
python
In which direction do entry move to another ?
from one list
def move entry from list from set to list to set i mac get from list if mac is None returnfrom list delete i to list insert END mac mac Eth Addr mac to set add mac from set remove mac if clear tables on change core call Later clear flows
def move_entry from_list from_set to_list to_set i mac get from_list if mac is None returnfrom_list delete i to_list insert END mac mac EthAddr mac to_set add mac from_set remove mac if clear_tables_on_change core callLater clear_flows
51
python-test-145
python
What satisfies the alignment constraint of part_type ?
partition
def align check device part type partition validate device device if part type not in set ['minimal' 'optimal'] raise Command Execution Error ' Invalidpart typepassedtopartition align check' try int partition except Exception raise Command Execution Error ' Invalidpartitionpassedtopartition align check' cmd 'parted-m-s...
def align_check device part_type partition _validate_device device if part_type not in set ['minimal' 'optimal'] raise CommandExecutionError 'Invalidpart_typepassedtopartition align_check' try int partition except Exception raise CommandExecutionError 'Invalidpartitionpassedtopartition align_check' cmd 'parted-m-s{0}al...
61
python-test-146
python
What do partition satisfy ?
the alignment constraint of part_type
def align check device part type partition validate device device if part type not in set ['minimal' 'optimal'] raise Command Execution Error ' Invalidpart typepassedtopartition align check' try int partition except Exception raise Command Execution Error ' Invalidpartitionpassedtopartition align check' cmd 'parted-m-s...
def align_check device part_type partition _validate_device device if part_type not in set ['minimal' 'optimal'] raise CommandExecutionError 'Invalidpart_typepassedtopartition align_check' try int partition except Exception raise CommandExecutionError 'Invalidpartitionpassedtopartition align_check' cmd 'parted-m-s{0}al...
61
python-test-147
python
Do partition satisfy the alignment constraint of part_type ?
Yes
def align check device part type partition validate device device if part type not in set ['minimal' 'optimal'] raise Command Execution Error ' Invalidpart typepassedtopartition align check' try int partition except Exception raise Command Execution Error ' Invalidpartitionpassedtopartition align check' cmd 'parted-m-s...
def align_check device part_type partition _validate_device device if part_type not in set ['minimal' 'optimal'] raise CommandExecutionError 'Invalidpart_typepassedtopartition align_check' try int partition except Exception raise CommandExecutionError 'Invalidpartitionpassedtopartition align_check' cmd 'parted-m-s{0}al...
61
python-test-148
python
What does the code create ?
a secure token for the given i d
def create custom token uid valid minutes 60 client email app identity get service account name now int time time payload base 64 b64 encode json dumps {'iss' client email 'sub' client email 'aud' IDENTITY ENDPOINT 'uid' uid 'iat' now 'exp' now + valid minutes * 60 } header base 64 b64 encode json dumps {'typ' 'JWT' 'a...
def create_custom_token uid valid_minutes 60 client_email app_identity get_service_account_name now int time time payload base64 b64encode json dumps {'iss' client_email 'sub' client_email 'aud' _IDENTITY_ENDPOINT 'uid' uid 'iat' now 'exp' now + valid_minutes * 60 } header base64 b64encode json dumps {'typ' 'JWT' 'alg'...
86
python-test-149
python
Does the code create a secure token for the given i d ?
Yes
def create custom token uid valid minutes 60 client email app identity get service account name now int time time payload base 64 b64 encode json dumps {'iss' client email 'sub' client email 'aud' IDENTITY ENDPOINT 'uid' uid 'iat' now 'exp' now + valid minutes * 60 } header base 64 b64 encode json dumps {'typ' 'JWT' 'a...
def create_custom_token uid valid_minutes 60 client_email app_identity get_service_account_name now int time time payload base64 b64encode json dumps {'iss' client_email 'sub' client_email 'aud' _IDENTITY_ENDPOINT 'uid' uid 'iat' now 'exp' now + valid_minutes * 60 } header base64 b64encode json dumps {'typ' 'JWT' 'alg'...
86
python-test-150
python
What does the code accumulate into the frequency counts freqcounts ?
a list of values values
def accumulate Frequency Counts values freq Counts None values numpy array values num Entries values max + 1 if freq Counts is not None num Entries max num Entries freq Counts size if freq Counts is not None if freq Counts size num Entries new Counts numpy zeros num Entries dtype 'int 32 ' new Counts[ 0 freq Counts siz...
def _accumulateFrequencyCounts values freqCounts None values numpy array values numEntries values max + 1 if freqCounts is not None numEntries max numEntries freqCounts size if freqCounts is not None if freqCounts size numEntries newCounts numpy zeros numEntries dtype 'int32' newCounts[0 freqCounts size] freqCountselse...
86
python-test-151
python
Does the code accumulate a list of values values into the frequency counts freqcounts ?
Yes
def accumulate Frequency Counts values freq Counts None values numpy array values num Entries values max + 1 if freq Counts is not None num Entries max num Entries freq Counts size if freq Counts is not None if freq Counts size num Entries new Counts numpy zeros num Entries dtype 'int 32 ' new Counts[ 0 freq Counts siz...
def _accumulateFrequencyCounts values freqCounts None values numpy array values numEntries values max + 1 if freqCounts is not None numEntries max numEntries freqCounts size if freqCounts is not None if freqCounts size numEntries newCounts numpy zeros numEntries dtype 'int32' newCounts[0 freqCounts size] freqCountselse...
86
python-test-152
python
What replaces the working code with a new apply node ?
this variant of test_badoptimization
def test badoptimization opt err @gof local optimizer [theano tensor add] def insert bigger b add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof Equilibrium DB edb regis...
def test_badoptimization_opt_err @gof local_optimizer [theano tensor add] def insert_bigger_b_add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof EquilibriumDB edb regist...
118
python-test-153
python
Do this variant of test_badoptimization replace the working code with a new apply node ?
Yes
def test badoptimization opt err @gof local optimizer [theano tensor add] def insert bigger b add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof Equilibrium DB edb regis...
def test_badoptimization_opt_err @gof local_optimizer [theano tensor add] def insert_bigger_b_add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof EquilibriumDB edb regist...
118
python-test-154
python
Will a new apply node raise an error ?
Yes
def test badoptimization opt err @gof local optimizer [theano tensor add] def insert bigger b add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof Equilibrium DB edb regis...
def test_badoptimization_opt_err @gof local_optimizer [theano tensor add] def insert_bigger_b_add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof EquilibriumDB edb regist...
118
python-test-155
python
What will raise an error ?
a new apply node
def test badoptimization opt err @gof local optimizer [theano tensor add] def insert bigger b add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof Equilibrium DB edb regis...
def test_badoptimization_opt_err @gof local_optimizer [theano tensor add] def insert_bigger_b_add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof EquilibriumDB edb regist...
118
python-test-156
python
What do this variant of test_badoptimization replace with a new apply node ?
the working code
def test badoptimization opt err @gof local optimizer [theano tensor add] def insert bigger b add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof Equilibrium DB edb regis...
def test_badoptimization_opt_err @gof local_optimizer [theano tensor add] def insert_bigger_b_add node if node op theano tensor add inputs list node inputs if inputs[ -1 ] owner is None inputs[ -1 ] theano tensor concatenate inputs[ -1 ] inputs[ -1 ] return [node op *inputs ]return Falseedb gof EquilibriumDB edb regist...
118
python-test-157
python
Does the code return a : class : query object ?
Yes
def construct query part model cls prefixes query part if not query part return query True Query query classes {}for k t in itertools chain model cls fields items model cls types items query classes[k] t query key pattern query class negate parse query part query part query classes prefixes if key is None if issubclass...
def construct_query_part model_cls prefixes query_part if not query_part return query TrueQuery query_classes {}for k t in itertools chain model_cls _fields items model_cls _types items query_classes[k] t query key pattern query_class negate parse_query_part query_part query_classes prefixes if key is None if issubclas...
119
python-test-158
python
What does the code return ?
a : class : query object
def construct query part model cls prefixes query part if not query part return query True Query query classes {}for k t in itertools chain model cls fields items model cls types items query classes[k] t query key pattern query class negate parse query part query part query classes prefixes if key is None if issubclass...
def construct_query_part model_cls prefixes query_part if not query_part return query TrueQuery query_classes {}for k t in itertools chain model_cls _fields items model_cls _types items query_classes[k] t query key pattern query_class negate parse_query_part query_part query_classes prefixes if key is None if issubclas...
119
python-test-159
python
Does the code draw a rectangle @type position : l{tuple } ?
Yes
def rectangle terminal position dimension top left position width height dimensionterminal select Character Set insults CS DRAWING insults G0 terminal cursor Position top left terminal write chr 108 terminal write chr 113 * width - 2 terminal write chr 107 for n in range height - 2 terminal cursor Position left top + n...
def rectangle terminal position dimension top left position width height dimensionterminal selectCharacterSet insults CS_DRAWING insults G0 terminal cursorPosition top left terminal write chr 108 terminal write chr 113 * width - 2 terminal write chr 107 for n in range height - 2 terminal cursorPosition left top + n + 1...
104
python-test-160
python
What does the code draw ?
a rectangle @type position : l{tuple }
def rectangle terminal position dimension top left position width height dimensionterminal select Character Set insults CS DRAWING insults G0 terminal cursor Position top left terminal write chr 108 terminal write chr 113 * width - 2 terminal write chr 107 for n in range height - 2 terminal cursor Position left top + n...
def rectangle terminal position dimension top left position width height dimensionterminal selectCharacterSet insults CS_DRAWING insults G0 terminal cursorPosition top left terminal write chr 108 terminal write chr 113 * width - 2 terminal write chr 107 for n in range height - 2 terminal cursorPosition left top + n + 1...
104
python-test-161
python
What does the code terminate ?
the instance described by instance_id or name
def terminate instance id None name None region None key None keyid None profile None filters None instances find instances instance id instance id name name region region key key keyid keyid profile profile return objs True filters filters if instances in False None [] return instancesif len instances 1 instances[ 0 ]...
def terminate instance_id None name None region None key None keyid None profile None filters None instances find_instances instance_id instance_id name name region region key key keyid keyid profile profile return_objs True filters filters if instances in False None [] return instancesif len instances 1 instances[0] t...
62
python-test-162
python
Does the code terminate the instance described by instance_id or name ?
Yes
def terminate instance id None name None region None key None keyid None profile None filters None instances find instances instance id instance id name name region region key key keyid keyid profile profile return objs True filters filters if instances in False None [] return instancesif len instances 1 instances[ 0 ]...
def terminate instance_id None name None region None key None keyid None profile None filters None instances find_instances instance_id instance_id name name region region key key keyid keyid profile profile return_objs True filters filters if instances in False None [] return instancesif len instances 1 instances[0] t...
62
python-test-163
python
What does the code make ?
the container root directory
def make container root name path root name if os path exists path context ['retcode'] salt defaults exitcodes SALT BUILD FAI Lraise Command Execution Error ' Container{ 0 }alreadyexists' format name else try os makedirs path return pathexcept OS Error as exc raise Command Execution Error ' Unabletomakecontainerrootdir...
def _make_container_root name path _root name if os path exists path __context__['retcode'] salt defaults exitcodes SALT_BUILD_FAILraise CommandExecutionError 'Container{0}alreadyexists' format name else try os makedirs path return pathexcept OSError as exc raise CommandExecutionError 'Unabletomakecontainerrootdirector...
55
python-test-164
python
Does the code make the container root directory ?
Yes
def make container root name path root name if os path exists path context ['retcode'] salt defaults exitcodes SALT BUILD FAI Lraise Command Execution Error ' Container{ 0 }alreadyexists' format name else try os makedirs path return pathexcept OS Error as exc raise Command Execution Error ' Unabletomakecontainerrootdir...
def _make_container_root name path _root name if os path exists path __context__['retcode'] salt defaults exitcodes SALT_BUILD_FAILraise CommandExecutionError 'Container{0}alreadyexists' format name else try os makedirs path return pathexcept OSError as exc raise CommandExecutionError 'Unabletomakecontainerrootdirector...
55
python-test-167
python
Does johnsons algorithm use to compute shortest paths ?
Yes
def johnson G weight 'weight' if not nx is weighted G weight weight raise nx Network X Error ' Graphisnotweighted ' dist {v 0 for v in G}pred {v [ None] for v in G}weight weight function G weight dist bellman bellman ford G list G weight pred pred dist dist scale lambda u v dist bellman[u] - dist bellman[v] new weight ...
def johnson G weight 'weight' if not nx is_weighted G weight weight raise nx NetworkXError 'Graphisnotweighted ' dist {v 0 for v in G}pred {v [None] for v in G}weight _weight_function G weight dist_bellman _bellman_ford G list G weight pred pred dist dist scale lambda u v dist_bellman[u] - dist_bellman[v] new_weight la...
98
python-test-168
python
What uses to compute shortest paths ?
johnsons algorithm
def johnson G weight 'weight' if not nx is weighted G weight weight raise nx Network X Error ' Graphisnotweighted ' dist {v 0 for v in G}pred {v [ None] for v in G}weight weight function G weight dist bellman bellman ford G list G weight pred pred dist dist scale lambda u v dist bellman[u] - dist bellman[v] new weight ...
def johnson G weight 'weight' if not nx is_weighted G weight weight raise nx NetworkXError 'Graphisnotweighted ' dist {v 0 for v in G}pred {v [None] for v in G}weight _weight_function G weight dist_bellman _bellman_ford G list G weight pred pred dist dist scale lambda u v dist_bellman[u] - dist_bellman[v] new_weight la...
98
python-test-169
python
What does johnsons algorithm use ?
to compute shortest paths
def johnson G weight 'weight' if not nx is weighted G weight weight raise nx Network X Error ' Graphisnotweighted ' dist {v 0 for v in G}pred {v [ None] for v in G}weight weight function G weight dist bellman bellman ford G list G weight pred pred dist dist scale lambda u v dist bellman[u] - dist bellman[v] new weight ...
def johnson G weight 'weight' if not nx is_weighted G weight weight raise nx NetworkXError 'Graphisnotweighted ' dist {v 0 for v in G}pred {v [None] for v in G}weight _weight_function G weight dist_bellman _bellman_ford G list G weight pred pred dist dist scale lambda u v dist_bellman[u] - dist_bellman[v] new_weight la...
98
python-test-179
python
Does the code return a tuple of ?
Yes
def Parse Host Port address host port re re match ' [a-z A-Z 0 - 9 -\\ ]+ [0 - 9 ]{ 1 5} $' address if not host port re raise Type Error 'badhost port %s' % address host host port re group 1 port int host port re group 2 if port > 65536 raise Type Error 'invalidport %d' % port return host port
def ParseHostPort address host_port_re re match ' [a-zA-Z0-9-\\ ]+ [0-9]{1 5} $' address if not host_port_re raise TypeError 'badhost port %s' % address host host_port_re group 1 port int host_port_re group 2 if port > 65536 raise TypeError 'invalidport %d' % port return host port
66
python-test-180
python
Does the code parse the provided address string ?
Yes
def Parse Host Port address host port re re match ' [a-z A-Z 0 - 9 -\\ ]+ [0 - 9 ]{ 1 5} $' address if not host port re raise Type Error 'badhost port %s' % address host host port re group 1 port int host port re group 2 if port > 65536 raise Type Error 'invalidport %d' % port return host port
def ParseHostPort address host_port_re re match ' [a-zA-Z0-9-\\ ]+ [0-9]{1 5} $' address if not host_port_re raise TypeError 'badhost port %s' % address host host_port_re group 1 port int host_port_re group 2 if port > 65536 raise TypeError 'invalidport %d' % port return host port
66
python-test-181
python
What does the code parse ?
the provided address string
def Parse Host Port address host port re re match ' [a-z A-Z 0 - 9 -\\ ]+ [0 - 9 ]{ 1 5} $' address if not host port re raise Type Error 'badhost port %s' % address host host port re group 1 port int host port re group 2 if port > 65536 raise Type Error 'invalidport %d' % port return host port
def ParseHostPort address host_port_re re match ' [a-zA-Z0-9-\\ ]+ [0-9]{1 5} $' address if not host_port_re raise TypeError 'badhost port %s' % address host host_port_re group 1 port int host_port_re group 2 if port > 65536 raise TypeError 'invalidport %d' % port return host port
66
python-test-195
python
Does the code get extra spec value ?
Yes
def get volume type extra spec type id spec key possible values None default value None if not type id return default valuespec key 'vmware %s' % spec key spec value volume types get volume type extra specs type id spec key if not spec value LOG debug ' Returningdefaultspecvalue %s ' default value return default valuei...
def _get_volume_type_extra_spec type_id spec_key possible_values None default_value None if not type_id return default_valuespec_key 'vmware %s' % spec_key spec_value volume_types get_volume_type_extra_specs type_id spec_key if not spec_value LOG debug 'Returningdefaultspecvalue %s ' default_value return default_valuei...
86
python-test-196
python
What does the code get ?
extra spec value
def get volume type extra spec type id spec key possible values None default value None if not type id return default valuespec key 'vmware %s' % spec key spec value volume types get volume type extra specs type id spec key if not spec value LOG debug ' Returningdefaultspecvalue %s ' default value return default valuei...
def _get_volume_type_extra_spec type_id spec_key possible_values None default_value None if not type_id return default_valuespec_key 'vmware %s' % spec_key spec_value volume_types get_volume_type_extra_specs type_id spec_key if not spec_value LOG debug 'Returningdefaultspecvalue %s ' default_value return default_valuei...
86
python-test-206
python
For what purpose do rarefaction files parse ?
specifically for use in make_rarefaction_plots
def parse rarefaction lines col headers []comments []rarefaction data []rarefaction fns []for line in lines if line[ 0 ] '#' comments append line elif line[ 0 ] ' DCTB ' col headers map strip line split ' DCTB ' else rarefaction fn data parse rarefaction record line rarefaction fns append rarefaction fn rarefaction dat...
def parse_rarefaction lines col_headers []comments []rarefaction_data []rarefaction_fns []for line in lines if line[0] '#' comments append line elif line[0] ' DCTB ' col_headers map strip line split ' DCTB ' else rarefaction_fn data parse_rarefaction_record line rarefaction_fns append rarefaction_fn rarefaction_data ap...
64
python-test-209
python
Does the code receive the input given by the user from gen_payload ?
Yes
def ms module exploit return {' 1 ' 'exploit/multi/browser/adobe flash hacking team uaf' '2 ' 'exploit/multi/browser/adobe flash nellymoser bof' '3 ' 'exploit/multi/browser/adobe flash shader drawing fill' '4 ' 'exploit/windows/browser/ms 14 012 textrange' '5 ' 'exploit/windows/browser/ms 14 012 cmarkup uaf' '6 ' 'expl...
def ms_module exploit return {'1' 'exploit/multi/browser/adobe_flash_hacking_team_uaf' '2' 'exploit/multi/browser/adobe_flash_nellymoser_bof' '3' 'exploit/multi/browser/adobe_flash_shader_drawing_fill' '4' 'exploit/windows/browser/ms14_012_textrange' '5' 'exploit/windows/browser/ms14_012_cmarkup_uaf' '6' 'exploit/windo...
287
python-test-210
python
What does the code receive ?
the input given by the user from gen_payload
def ms module exploit return {' 1 ' 'exploit/multi/browser/adobe flash hacking team uaf' '2 ' 'exploit/multi/browser/adobe flash nellymoser bof' '3 ' 'exploit/multi/browser/adobe flash shader drawing fill' '4 ' 'exploit/windows/browser/ms 14 012 textrange' '5 ' 'exploit/windows/browser/ms 14 012 cmarkup uaf' '6 ' 'expl...
def ms_module exploit return {'1' 'exploit/multi/browser/adobe_flash_hacking_team_uaf' '2' 'exploit/multi/browser/adobe_flash_nellymoser_bof' '3' 'exploit/multi/browser/adobe_flash_shader_drawing_fill' '4' 'exploit/windows/browser/ms14_012_textrange' '5' 'exploit/windows/browser/ms14_012_cmarkup_uaf' '6' 'exploit/windo...
287
python-test-214
python
Do uninitialized memory add at the end of the tensor ?
Yes
def expand empty tensor var size if size 0 return tensor varshapes [tensor var shape[x] for x in xrange tensor var ndim ]new shape [ size + shapes[ 0 ] ] + shapes[ 1 ] empty tensor Alloc Empty tensor var dtype *new shape ret tensor set subtensor empty[ shapes[ 0 ]] tensor var ret tag nan guard mode check Falsereturn re...
def expand_empty tensor_var size if size 0 return tensor_varshapes [tensor_var shape[x] for x in xrange tensor_var ndim ]new_shape [ size + shapes[0] ] + shapes[1 ] empty tensor AllocEmpty tensor_var dtype *new_shape ret tensor set_subtensor empty[ shapes[0]] tensor_var ret tag nan_guard_mode_check Falsereturn ret
62
python-test-215
python
What is adding at the end of the tensor ?
uninitialized memory
def expand empty tensor var size if size 0 return tensor varshapes [tensor var shape[x] for x in xrange tensor var ndim ]new shape [ size + shapes[ 0 ] ] + shapes[ 1 ] empty tensor Alloc Empty tensor var dtype *new shape ret tensor set subtensor empty[ shapes[ 0 ]] tensor var ret tag nan guard mode check Falsereturn re...
def expand_empty tensor_var size if size 0 return tensor_varshapes [tensor_var shape[x] for x in xrange tensor_var ndim ]new_shape [ size + shapes[0] ] + shapes[1 ] empty tensor AllocEmpty tensor_var dtype *new_shape ret tensor set_subtensor empty[ shapes[0]] tensor_var ret tag nan_guard_mode_check Falsereturn ret
62
python-test-216
python
How does the shape of a tensor transform from to ?
by adding uninitialized memory at the end of the tensor
def expand empty tensor var size if size 0 return tensor varshapes [tensor var shape[x] for x in xrange tensor var ndim ]new shape [ size + shapes[ 0 ] ] + shapes[ 1 ] empty tensor Alloc Empty tensor var dtype *new shape ret tensor set subtensor empty[ shapes[ 0 ]] tensor var ret tag nan guard mode check Falsereturn re...
def expand_empty tensor_var size if size 0 return tensor_varshapes [tensor_var shape[x] for x in xrange tensor_var ndim ]new_shape [ size + shapes[0] ] + shapes[1 ] empty tensor AllocEmpty tensor_var dtype *new_shape ret tensor set_subtensor empty[ shapes[0]] tensor_var ret tag nan_guard_mode_check Falsereturn ret
62
python-test-217
python
Where do uninitialized memory add ?
at the end of the tensor
def expand empty tensor var size if size 0 return tensor varshapes [tensor var shape[x] for x in xrange tensor var ndim ]new shape [ size + shapes[ 0 ] ] + shapes[ 1 ] empty tensor Alloc Empty tensor var dtype *new shape ret tensor set subtensor empty[ shapes[ 0 ]] tensor var ret tag nan guard mode check Falsereturn re...
def expand_empty tensor_var size if size 0 return tensor_varshapes [tensor_var shape[x] for x in xrange tensor_var ndim ]new_shape [ size + shapes[0] ] + shapes[1 ] empty tensor AllocEmpty tensor_var dtype *new_shape ret tensor set_subtensor empty[ shapes[0]] tensor_var ret tag nan_guard_mode_check Falsereturn ret
62
python-test-221
python
Does unpack - > int list split data into groups of word_size//8 bytes ?
Yes
@ Local Contextdef unpack many data word size None word size word size or context word size endianness context endiannesssign context signif word size 'all' return [unpack data word size ]if word size % 8 0 raise Value Error 'unpack many word sizemustbeamultipleof 8 ' out []n word size // 8 for i in range 0 len data n ...
@LocalContextdef unpack_many data word_size None word_size word_size or context word_size endianness context endiannesssign context signif word_size 'all' return [unpack data word_size ]if word_size % 8 0 raise ValueError 'unpack_many word_sizemustbeamultipleof8' out []n word_size // 8 for i in range 0 len data n out a...
74
python-test-222
python
What splits data into groups of word_size//8 bytes ?
unpack - > int list
@ Local Contextdef unpack many data word size None word size word size or context word size endianness context endiannesssign context signif word size 'all' return [unpack data word size ]if word size % 8 0 raise Value Error 'unpack many word sizemustbeamultipleof 8 ' out []n word size // 8 for i in range 0 len data n ...
@LocalContextdef unpack_many data word_size None word_size word_size or context word_size endianness context endiannesssign context signif word_size 'all' return [unpack data word_size ]if word_size % 8 0 raise ValueError 'unpack_many word_sizemustbeamultipleof8' out []n word_size // 8 for i in range 0 len data n out a...
74