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 fileobj setup py bytes finally dist close | 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_py_bytes finally dist close | 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 fileobj setup py bytes finally dist close | 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_py_bytes finally dist close | 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 fileobj setup py bytes finally dist close | 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_py_bytes finally dist close | 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 dir'] os mkdir config['logs dir'] config['domains'] Nonereturn argparse Namespace **config | 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_dir'] os mkdir config['logs_dir'] config['domains'] Nonereturn argparse Namespace **config | 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 dir'] os mkdir config['logs dir'] config['domains'] Nonereturn argparse Namespace **config | 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_dir'] os mkdir config['logs_dir'] config['domains'] Nonereturn argparse Namespace **config | 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 dir'] os mkdir config['logs dir'] config['domains'] Nonereturn argparse Namespace **config | 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_dir'] os mkdir config['logs_dir'] config['domains'] Nonereturn argparse Namespace **config | 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/' {'display name' str i } assert po data status code 200 category ids append json loads po data data ['id'] data {'label ids' category ids}resp api client put data '/messages/{}' format gen message public id data assert resp status code 200 associated mcs db session query Message Category filter Message Category message id gen message id all assert len associated mcs 10 db session delete gen message db session commit assert db session query Message Category filter Message Category message id gen message id all [] | 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/' {'display_name' str i } assert po_data status_code 200 category_ids append json loads po_data data ['id'] data {'label_ids' category_ids}resp api_client put_data '/messages/{}' format gen_message public_id data assert resp status_code 200 associated_mcs db session query MessageCategory filter MessageCategory message_id gen_message id all assert len associated_mcs 10 db session delete gen_message db session commit assert db session query MessageCategory filter MessageCategory message_id gen_message id all [] | 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/' {'display name' str i } assert po data status code 200 category ids append json loads po data data ['id'] data {'label ids' category ids}resp api client put data '/messages/{}' format gen message public id data assert resp status code 200 associated mcs db session query Message Category filter Message Category message id gen message id all assert len associated mcs 10 db session delete gen message db session commit assert db session query Message Category filter Message Category message id gen message id all [] | 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/' {'display_name' str i } assert po_data status_code 200 category_ids append json loads po_data data ['id'] data {'label_ids' category_ids}resp api_client put_data '/messages/{}' format gen_message public_id data assert resp status_code 200 associated_mcs db session query MessageCategory filter MessageCategory message_id gen_message id all assert len associated_mcs 10 db session delete gen_message db session commit assert db session query MessageCategory filter MessageCategory message_id gen_message id all [] | 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/' {'display name' str i } assert po data status code 200 category ids append json loads po data data ['id'] data {'label ids' category ids}resp api client put data '/messages/{}' format gen message public id data assert resp status code 200 associated mcs db session query Message Category filter Message Category message id gen message id all assert len associated mcs 10 db session delete gen message db session commit assert db session query Message Category filter Message Category message id gen message id all [] | 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/' {'display_name' str i } assert po_data status_code 200 category_ids append json loads po_data data ['id'] data {'label_ids' category_ids}resp api_client put_data '/messages/{}' format gen_message public_id data assert resp status_code 200 associated_mcs db session query MessageCategory filter MessageCategory message_id gen_message id all assert len associated_mcs 10 db session delete gen_message db session commit assert db session query MessageCategory filter MessageCategory message_id gen_message id all [] | 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 Servertocheckquerystatus ' return handle state | 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 _ 'FailedtocontactServertocheckquerystatus ' return handle state | 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 Servertocheckquerystatus ' return handle state | 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 _ 'FailedtocontactServertocheckquerystatus ' return handle state | 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 \n'kwargs['account type'] 'HOSTED OR GOOGLE'kwargs['save cookies'] Trueif throttle class rpc server throttle class throttle *args **kwargs else rpc server Throttled Http Rpc Server throttle *args **kwargs return rpc serverreturn Make Rpc Server | def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type'] 'HOSTED_OR_GOOGLE'kwargs['save_cookies'] Trueif throttle_class rpc_server throttle_class throttle *args **kwargs else rpc_server ThrottledHttpRpcServer throttle *args **kwargs return rpc_serverreturn MakeRpcServer | 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 \n'kwargs['account type'] 'HOSTED OR GOOGLE'kwargs['save cookies'] Trueif throttle class rpc server throttle class throttle *args **kwargs else rpc server Throttled Http Rpc Server throttle *args **kwargs return rpc serverreturn Make Rpc Server | def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type'] 'HOSTED_OR_GOOGLE'kwargs['save_cookies'] Trueif throttle_class rpc_server throttle_class throttle *args **kwargs else rpc_server ThrottledHttpRpcServer throttle *args **kwargs return rpc_serverreturn MakeRpcServer | 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 \n'kwargs['account type'] 'HOSTED OR GOOGLE'kwargs['save cookies'] Trueif throttle class rpc server throttle class throttle *args **kwargs else rpc server Throttled Http Rpc Server throttle *args **kwargs return rpc serverreturn Make Rpc Server | def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type'] 'HOSTED_OR_GOOGLE'kwargs['save_cookies'] Trueif throttle_class rpc_server throttle_class throttle *args **kwargs else rpc_server ThrottledHttpRpcServer throttle *args **kwargs return rpc_serverreturn MakeRpcServer | 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 \n'kwargs['account type'] 'HOSTED OR GOOGLE'kwargs['save cookies'] Trueif throttle class rpc server throttle class throttle *args **kwargs else rpc server Throttled Http Rpc Server throttle *args **kwargs return rpc serverreturn Make Rpc Server | def ThrottledHttpRpcServerFactory throttle throttle_class None def MakeRpcServer *args **kwargs 'FactorytoproduceaThrottledHttpRpcServer \n\nArgs \nargs PositionalargstopasstoThrottledHttpRpcServer \nkwargs KeywordargstopasstoThrottledHttpRpcServer \n\nReturns \nAThrottledHttpRpcServerinstance \n'kwargs['account_type'] 'HOSTED_OR_GOOGLE'kwargs['save_cookies'] Trueif throttle_class rpc_server throttle_class throttle *args **kwargs else rpc_server ThrottledHttpRpcServer throttle *args **kwargs return rpc_serverreturn MakeRpcServer | 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 linenumbers parse format form string IO seek 0 if form None return parse send CSS Style external 1 string IO read else return None string IO read | 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 parse format form stringIO seek 0 if form None return parse _sendCSSStyle external 1 stringIO read else return None stringIO read | 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 linenumbers parse format form string IO seek 0 if form None return parse send CSS Style external 1 string IO read else return None string IO read | 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 parse format form stringIO seek 0 if form None return parse _sendCSSStyle external 1 stringIO read else return None stringIO read | 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 linenumbers parse format form string IO seek 0 if form None return parse send CSS Style external 1 string IO read else return None string IO read | 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 parse format form stringIO seek 0 if form None return parse _sendCSSStyle external 1 stringIO read else return None stringIO read | 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 return render to response 'debug/run python form html' c | @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 render_to_response 'debug/run_python_form html' c | 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 return render to response 'debug/run python form html' c | @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 render_to_response 'debug/run_python_form html' c | 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 return render to response 'debug/run python form html' c | @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 render_to_response 'debug/run_python_form html' c | 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 return render to response 'debug/run python form html' c | @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 render_to_response 'debug/run_python_form html' c | 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 return render to response 'debug/run python form html' c | @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 render_to_response 'debug/run_python_form html' c | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver No Answer passtry name name parent except dns name No Parent raise No Root SOA | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver NoAnswer passtry name name parent except dns name NoParent raise NoRootSOA | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver No Answer passtry name name parent except dns name No Parent raise No Root SOA | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver NoAnswer passtry name name parent except dns name NoParent raise NoRootSOA | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver No Answer passtry name name parent except dns name No Parent raise No Root SOA | 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 answer rrset name name return nameexcept dns resolver NXDOMAIN dns resolver NoAnswer passtry name name parent except dns name NoParent raise NoRootSOA | 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 oauth O Auth Request from consumer and token oauth input params Get Consumer http url request token url parameters parameters oauth request sign request oauth input params Get Signature Method oauth input params Get Consumer None return atom url parse url oauth request to url | 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 OAuthRequest from_consumer_and_token oauth_input_params GetConsumer http_url request_token_url parameters parameters oauth_request sign_request oauth_input_params GetSignatureMethod oauth_input_params GetConsumer None return atom url parse_url oauth_request to_url | 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 oauth O Auth Request from consumer and token oauth input params Get Consumer http url request token url parameters parameters oauth request sign request oauth input params Get Signature Method oauth input params Get Consumer None return atom url parse url oauth request to url | 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 OAuthRequest from_consumer_and_token oauth_input_params GetConsumer http_url request_token_url parameters parameters oauth_request sign_request oauth_input_params GetSignatureMethod oauth_input_params GetConsumer None return atom url parse_url oauth_request to_url | 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 oauth O Auth Request from consumer and token oauth input params Get Consumer http url request token url parameters parameters oauth request sign request oauth input params Get Signature Method oauth input params Get Consumer None return atom url parse url oauth request to url | 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 OAuthRequest from_consumer_and_token oauth_input_params GetConsumer http_url request_token_url parameters parameters oauth_request sign_request oauth_input_params GetSignatureMethod oauth_input_params GetConsumer None return atom url parse_url oauth_request to_url | 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 oauth O Auth Request from consumer and token oauth input params Get Consumer http url request token url parameters parameters oauth request sign request oauth input params Get Signature Method oauth input params Get Consumer None return atom url parse url oauth request to url | 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 OAuthRequest from_consumer_and_token oauth_input_params GetConsumer http_url request_token_url parameters parameters oauth_request sign_request oauth_input_params GetSignatureMethod oauth_input_params GetConsumer None return atom url parse_url oauth_request to_url | 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 Answers s3 db survey get All Answers For Question In Seriesanswers get Answers question id series id analysis Tool s3 db survey analysis type[q type] question id answers qstn Name analysis Tool qstn Widget question nameimage analysis Tool draw Chart series id output 'png' return image | 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 survey_getAllAnswersForQuestionInSeriesanswers getAnswers question_id series_id analysisTool s3db survey_analysis_type[q_type] question_id answers qstnName analysisTool qstnWidget question nameimage analysisTool drawChart series_id output 'png' return image | 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 Answers s3 db survey get All Answers For Question In Seriesanswers get Answers question id series id analysis Tool s3 db survey analysis type[q type] question id answers qstn Name analysis Tool qstn Widget question nameimage analysis Tool draw Chart series id output 'png' return image | 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 survey_getAllAnswersForQuestionInSeriesanswers getAnswers question_id series_id analysisTool s3db survey_analysis_type[q_type] question_id answers qstnName analysisTool qstnWidget question nameimage analysisTool drawChart series_id output 'png' return image | 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 Answers s3 db survey get All Answers For Question In Seriesanswers get Answers question id series id analysis Tool s3 db survey analysis type[q type] question id answers qstn Name analysis Tool qstn Widget question nameimage analysis Tool draw Chart series id output 'png' return image | 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 survey_getAllAnswersForQuestionInSeriesanswers getAnswers question_id series_id analysisTool s3db survey_analysis_type[q_type] question_id answers qstnName analysisTool qstnWidget question nameimage analysisTool drawChart series_id output 'png' return image | 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 Answers s3 db survey get All Answers For Question In Seriesanswers get Answers question id series id analysis Tool s3 db survey analysis type[q type] question id answers qstn Name analysis Tool qstn Widget question nameimage analysis Tool draw Chart series id output 'png' return image | 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 survey_getAllAnswersForQuestionInSeriesanswers getAnswers question_id series_id analysisTool s3db survey_analysis_type[q_type] question_id answers qstnName analysisTool qstnWidget question nameimage analysisTool drawChart series_id output 'png' return image | 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 Answers s3 db survey get All Answers For Question In Seriesanswers get Answers question id series id analysis Tool s3 db survey analysis type[q type] question id answers qstn Name analysis Tool qstn Widget question nameimage analysis Tool draw Chart series id output 'png' return image | 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 survey_getAllAnswersForQuestionInSeriesanswers getAnswers question_id series_id analysisTool s3db survey_analysis_type[q_type] question_id answers qstnName analysisTool qstnWidget question nameimage analysisTool drawChart series_id output 'png' return image | 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 'hac' cov hac * nobs / float nobs - k params elif use correction in ['c' 'clu' 'cluster'] n groups len groupidx cov hac * n groups / n groups - 1 0 cov hac * nobs - 1 0 / float nobs - k params return cov hac | 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 'hac' cov_hac * nobs / float nobs - k_params elif use_correction in ['c' 'clu' 'cluster'] n_groups len groupidx cov_hac * n_groups / n_groups - 1 0 cov_hac * nobs - 1 0 / float nobs - k_params return cov_hac | 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 'hac' cov hac * nobs / float nobs - k params elif use correction in ['c' 'clu' 'cluster'] n groups len groupidx cov hac * n groups / n groups - 1 0 cov hac * nobs - 1 0 / float nobs - k params return cov hac | 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 'hac' cov_hac * nobs / float nobs - k_params elif use_correction in ['c' 'clu' 'cluster'] n_groups len groupidx cov_hac * n_groups / n_groups - 1 0 cov_hac * nobs - 1 0 / float nobs - k_params return cov_hac | 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 } else ret append {'path' six text type path 'saltenv' six text type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text type path 'saltenv' six text type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text type path 'saltenv' six text type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text type path 'saltenv' six text type saltenv 'content' u'bin'} yield ret | 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 } else ret append {'path' six text_type path 'saltenv' six text_type saltenv 'content' u'bin'} yield ret | 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 parameter fstnext parameter fst max run fst + parameter fst / 2 return next parameter fst max run fst min run 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 parameter_fstnext_parameter_fst max_run_fst + parameter_fst / 2 return next_parameter_fst max_run_fst min_run_fst | 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 parameter fstnext parameter fst max run fst + parameter fst / 2 return next parameter fst max run fst min run 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 parameter_fstnext_parameter_fst max_run_fst + parameter_fst / 2 return next_parameter_fst max_run_fst min_run_fst | 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 parameter fstnext parameter fst max run fst + parameter fst / 2 return next parameter fst max run fst min run 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 parameter_fstnext_parameter_fst max_run_fst + parameter_fst / 2 return next_parameter_fst max_run_fst min_run_fst | 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 before Segment Normalized euclidean get Normalized before Point - point dot Product euclidean get Dot Product after Segment Normalized before Segment Normalized if dot Product < 0 99 return point Indexif dot Product < dot Product Minimum dot Product Minimum dot Productwidest Point Index point Indexreturn widest Point Index | 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 beforeSegmentNormalized euclidean getNormalized beforePoint - point dotProduct euclidean getDotProduct afterSegmentNormalized beforeSegmentNormalized if dotProduct < 0 99 return pointIndexif dotProduct < dotProductMinimum dotProductMinimum dotProductwidestPointIndex pointIndexreturn widestPointIndex | 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 before Segment Normalized euclidean get Normalized before Point - point dot Product euclidean get Dot Product after Segment Normalized before Segment Normalized if dot Product < 0 99 return point Indexif dot Product < dot Product Minimum dot Product Minimum dot Productwidest Point Index point Indexreturn widest Point Index | 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 beforeSegmentNormalized euclidean getNormalized beforePoint - point dotProduct euclidean getDotProduct afterSegmentNormalized beforeSegmentNormalized if dotProduct < 0 99 return pointIndexif dotProduct < dotProductMinimum dotProductMinimum dotProductwidestPointIndex pointIndexreturn widestPointIndex | 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 before Segment Normalized euclidean get Normalized before Point - point dot Product euclidean get Dot Product after Segment Normalized before Segment Normalized if dot Product < 0 99 return point Indexif dot Product < dot Product Minimum dot Product Minimum dot Productwidest Point Index point Indexreturn widest Point Index | 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 beforeSegmentNormalized euclidean getNormalized beforePoint - point dotProduct euclidean getDotProduct afterSegmentNormalized beforeSegmentNormalized if dotProduct < 0 99 return pointIndexif dotProduct < dotProductMinimum dotProductMinimum dotProductwidestPointIndex pointIndexreturn widestPointIndex | 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 before Segment Normalized euclidean get Normalized before Point - point dot Product euclidean get Dot Product after Segment Normalized before Segment Normalized if dot Product < 0 99 return point Indexif dot Product < dot Product Minimum dot Product Minimum dot Productwidest Point Index point Indexreturn widest Point Index | 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 beforeSegmentNormalized euclidean getNormalized beforePoint - point dotProduct euclidean getDotProduct afterSegmentNormalized beforeSegmentNormalized if dotProduct < 0 99 return pointIndexif dotProduct < dotProductMinimum dotProductMinimum dotProductwidestPointIndex pointIndexreturn widestPointIndex | 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 before Segment Normalized euclidean get Normalized before Point - point dot Product euclidean get Dot Product after Segment Normalized before Segment Normalized if dot Product < 0 99 return point Indexif dot Product < dot Product Minimum dot Product Minimum dot Productwidest Point Index point Indexreturn widest Point Index | 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 beforeSegmentNormalized euclidean getNormalized beforePoint - point dotProduct euclidean getDotProduct afterSegmentNormalized beforeSegmentNormalized if dotProduct < 0 99 return pointIndexif dotProduct < dotProductMinimum dotProductMinimum dotProductwidestPointIndex pointIndexreturn widestPointIndex | 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 queryset | 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 queryset | 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 queryset | 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 queryset | 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{ 0 }align-check{ 1 }{ 2 }' format device part type partition out salt ['cmd run'] cmd splitlines return out | 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}align-check{1}{2}' format device part_type partition out __salt__['cmd run'] cmd splitlines return out | 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{ 0 }align-check{ 1 }{ 2 }' format device part type partition out salt ['cmd run'] cmd splitlines return out | 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}align-check{1}{2}' format device part_type partition out __salt__['cmd run'] cmd splitlines return out | 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{ 0 }align-check{ 1 }{ 2 }' format device part type partition out salt ['cmd run'] cmd splitlines return out | 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}align-check{1}{2}' format device part_type partition out __salt__['cmd run'] cmd splitlines return out | 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' 'alg' 'RS 256 '} to sign '{} {}' format header payload return '{} {}' format to sign base 64 b64 encode app identity sign blob to sign [1 ] | 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' 'RS256'} to_sign '{} {}' format header payload return '{} {}' format to_sign base64 b64encode app_identity sign_blob to_sign [1] | 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' 'alg' 'RS 256 '} to sign '{} {}' format header payload return '{} {}' format to sign base 64 b64 encode app identity sign blob to sign [1 ] | 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' 'RS256'} to_sign '{} {}' format header payload return '{} {}' format to_sign base64 b64encode app_identity sign_blob to_sign [1] | 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 size] freq Countselse new Counts freq Countselse new Counts numpy zeros num Entries dtype 'int 32 ' for v in values new Counts[v] + 1return new Counts | 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 newCounts freqCountselse newCounts numpy zeros numEntries dtype 'int32' for v in values newCounts[v] + 1return newCounts | 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 size] freq Countselse new Counts freq Countselse new Counts numpy zeros num Entries dtype 'int 32 ' for v in values new Counts[v] + 1return new Counts | 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 newCounts freqCountselse newCounts numpy zeros numEntries dtype 'int32' for v in values newCounts[v] + 1return newCounts | 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 register 'insert bigger b add' insert bigger b add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode Debug Mode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert bigger b add' in exc message e returnassert False | 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 register 'insert_bigger_b_add' insert_bigger_b_add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode DebugMode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert_bigger_b_add' in exc_message e returnassert False | 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 register 'insert bigger b add' insert bigger b add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode Debug Mode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert bigger b add' in exc message e returnassert False | 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 register 'insert_bigger_b_add' insert_bigger_b_add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode DebugMode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert_bigger_b_add' in exc_message e returnassert False | 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 register 'insert bigger b add' insert bigger b add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode Debug Mode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert bigger b add' in exc message e returnassert False | 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 register 'insert_bigger_b_add' insert_bigger_b_add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode DebugMode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert_bigger_b_add' in exc_message e returnassert False | 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 register 'insert bigger b add' insert bigger b add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode Debug Mode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert bigger b add' in exc message e returnassert False | 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 register 'insert_bigger_b_add' insert_bigger_b_add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode DebugMode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert_bigger_b_add' in exc_message e returnassert False | 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 register 'insert bigger b add' insert bigger b add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode Debug Mode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert bigger b add' in exc message e returnassert False | 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 register 'insert_bigger_b_add' insert_bigger_b_add 'all' opt edb query '+all' a theano tensor dvector b theano tensor dvector f theano function [a b] a + b mode debugmode DebugMode optimizer opt try f [1 0 2 0 3 0] [2 3 4] except Exception as e assert 'insert_bigger_b_add' in exc_message e returnassert False | 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 query class query Field Query q query Any Field Query pattern model cls search fields query class if negate return query Not Query q else return qelif negate return query Not Query query class pattern else return query class pattern key key lower q query class key lower pattern key in model cls fields if negate return query Not Query q return q | 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 issubclass query_class query FieldQuery q query AnyFieldQuery pattern model_cls _search_fields query_class if negate return query NotQuery q else return qelif negate return query NotQuery query_class pattern else return query_class pattern key key lower q query_class key lower pattern key in model_cls _fields if negate return query NotQuery q return q | 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 query class query Field Query q query Any Field Query pattern model cls search fields query class if negate return query Not Query q else return qelif negate return query Not Query query class pattern else return query class pattern key key lower q query class key lower pattern key in model cls fields if negate return query Not Query q return q | 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 issubclass query_class query FieldQuery q query AnyFieldQuery pattern model_cls _search_fields query_class if negate return query NotQuery q else return qelif negate return query NotQuery query_class pattern else return query_class pattern key key lower q query_class key lower pattern key in model_cls _fields if negate return query NotQuery q return q | 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 + 1 terminal write chr 120 terminal cursor Forward width - 2 terminal write chr 120 terminal cursor Position 0 top + height - 1 terminal write chr 109 terminal write chr 113 * width - 2 terminal write chr 106 terminal select Character Set insults CS US insults G0 | 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 terminal write chr 120 terminal cursorForward width - 2 terminal write chr 120 terminal cursorPosition 0 top + height - 1 terminal write chr 109 terminal write chr 113 * width - 2 terminal write chr 106 terminal selectCharacterSet insults CS_US insults G0 | 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 + 1 terminal write chr 120 terminal cursor Forward width - 2 terminal write chr 120 terminal cursor Position 0 top + height - 1 terminal write chr 109 terminal write chr 113 * width - 2 terminal write chr 106 terminal select Character Set insults CS US insults G0 | 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 terminal write chr 120 terminal cursorForward width - 2 terminal write chr 120 terminal cursorPosition 0 top + height - 1 terminal write chr 109 terminal write chr 113 * width - 2 terminal write chr 106 terminal selectCharacterSet insults CS_US insults G0 | 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 ] terminate return Trueelse log warning ' Refusingtoterminatemultipleinstancesatonce' return False | 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] terminate return Trueelse log warning 'Refusingtoterminatemultipleinstancesatonce' return False | 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 ] terminate return Trueelse log warning ' Refusingtoterminatemultipleinstancesatonce' return False | 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] terminate return Trueelse log warning 'Refusingtoterminatemultipleinstancesatonce' return False | 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 ' Unabletomakecontainerrootdirectory{ 0 } {1 }' format name exc | 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 'Unabletomakecontainerrootdirectory{0} {1}' format name exc | 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 ' Unabletomakecontainerrootdirectory{ 0 } {1 }' format name exc | 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 'Unabletomakecontainerrootdirectory{0} {1}' format name exc | 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 lambda u v d weight u v d + scale u v def dist path v paths {v [v]} dijkstra G v new weight paths paths return pathsreturn {v dist path v for v in G} | 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 lambda u v d weight u v d + scale u v def dist_path v paths {v [v]}_dijkstra G v new_weight paths paths return pathsreturn {v dist_path v for v in G} | 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 lambda u v d weight u v d + scale u v def dist path v paths {v [v]} dijkstra G v new weight paths paths return pathsreturn {v dist path v for v in G} | 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 lambda u v d weight u v d + scale u v def dist_path v paths {v [v]}_dijkstra G v new_weight paths paths return pathsreturn {v dist_path v for v in G} | 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 lambda u v d weight u v d + scale u v def dist path v paths {v [v]} dijkstra G v new weight paths paths return pathsreturn {v dist path v for v in G} | 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 lambda u v d weight u v d + scale u v def dist_path v paths {v [v]}_dijkstra G v new_weight paths paths return pathsreturn {v dist_path v for v in G} | 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 valueif possible values is None return spec valueif spec value in possible values LOG debug ' Returningspecvalue%s' spec value return spec value LOG debug ' Invalidspecvalue %sspecified ' 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_valueif possible_values is None return spec_valueif spec_value in possible_values LOG debug 'Returningspecvalue%s' spec_value return spec_valueLOG debug 'Invalidspecvalue %sspecified ' spec_value | 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 valueif possible values is None return spec valueif spec value in possible values LOG debug ' Returningspecvalue%s' spec value return spec value LOG debug ' Invalidspecvalue %sspecified ' 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_valueif possible_values is None return spec_valueif spec_value in possible_values LOG debug 'Returningspecvalue%s' spec_value return spec_valueLOG debug 'Invalidspecvalue %sspecified ' spec_value | 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 data append data return col headers comments rarefaction fns rarefaction data | 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 append data return col_headers comments rarefaction_fns rarefaction_data | 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 ' 'exploit/windows/browser/ms 13 080 cdisplaypointer' '7 ' 'exploit/windows/browser/ie setmousecapture uaf' '8 ' 'exploit/multi/browser/java jre 17 jmxbean 2' '9 ' 'exploit/multi/browser/java jre 17 jmxbean' '10 ' 'exploit/windows/browser/ms 13 009 ie slayoutrun uaf' '11 ' 'exploit/windows/browser/ie cbutton uaf' '12 ' 'exploit/multi/browser/java jre 17 exec' '13 ' 'exploit/windows/browser/ie execcommand uaf' '14 ' 'exploit/multi/browser/java atomicreferencearray' '15 ' 'exploit/multi/browser/java verifier field access' '16 ' 'exploit/windows/browser/ms 12 037 same id' '17 ' 'exploit/windows/browser/msxml get definition code exec' '18 ' 'exploit/windows/browser/adobe flash rtmp' '19 ' 'exploit/windows/browser/adobe flash mp 4 cprt' '20 ' 'exploit/windows/browser/ms 12 004 midi' '21 ' 'multi/browser/java rhino\nsettarget 1 ' '22 ' 'windows/browser/ms 11 050 mshtml cobjectelement' '23 ' 'windows/browser/adobe flashplayer flash 10 o' '24 ' 'windows/browser/cisco anyconnect exec' '25 ' 'windows/browser/ms 11 003 ie css import' '26 ' 'windows/browser/wmi admintools' '27 ' 'windows/browser/ms 10 090 ie css clip' '28 ' 'windows/browser/java codebase trust' '29 ' 'windows/browser/java docbase bof' '30 ' 'windows/browser/webdav dll hijacker' '31 ' 'windows/browser/adobe flashplayer avm' '32 ' 'windows/browser/adobe shockwave rcsl corruption' '33 ' 'windows/browser/adobe cooltype sing' '34 ' 'windows/browser/apple quicktime marshaled punk' '35 ' 'windows/browser/ms 10 042 helpctr xss cmd exec' '36 ' 'windows/browser/ms 10 018 ie behaviors' '37 ' 'windows/browser/ms 10 002 aurora' '38 ' 'windows/browser/ms 10 018 ie tabular activex' '39 ' 'windows/browser/ms 09 002 memory corruption' '40 ' 'windows/browser/ms 09 072 style object' '41 ' 'windows/browser/ie iscomponentinstalled' '42 ' 'windows/browser/ms 08 078 xml corruption' '43 ' 'windows/browser/ie unsafe scripting' '44 ' 'multi/browser/firefox escape retval' '45 ' 'windows/browser/mozilla mchannel' '46 ' 'auxiliary/server/browser autopwn'} get exploit 'ERROR' | 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/windows/browser/ms13_080_cdisplaypointer' '7' 'exploit/windows/browser/ie_setmousecapture_uaf' '8' 'exploit/multi/browser/java_jre17_jmxbean_2' '9' 'exploit/multi/browser/java_jre17_jmxbean' '10' 'exploit/windows/browser/ms13_009_ie_slayoutrun_uaf' '11' 'exploit/windows/browser/ie_cbutton_uaf' '12' 'exploit/multi/browser/java_jre17_exec' '13' 'exploit/windows/browser/ie_execcommand_uaf' '14' 'exploit/multi/browser/java_atomicreferencearray' '15' 'exploit/multi/browser/java_verifier_field_access' '16' 'exploit/windows/browser/ms12_037_same_id' '17' 'exploit/windows/browser/msxml_get_definition_code_exec' '18' 'exploit/windows/browser/adobe_flash_rtmp' '19' 'exploit/windows/browser/adobe_flash_mp4_cprt' '20' 'exploit/windows/browser/ms12_004_midi' '21' 'multi/browser/java_rhino\nsettarget1' '22' 'windows/browser/ms11_050_mshtml_cobjectelement' '23' 'windows/browser/adobe_flashplayer_flash10o' '24' 'windows/browser/cisco_anyconnect_exec' '25' 'windows/browser/ms11_003_ie_css_import' '26' 'windows/browser/wmi_admintools' '27' 'windows/browser/ms10_090_ie_css_clip' '28' 'windows/browser/java_codebase_trust' '29' 'windows/browser/java_docbase_bof' '30' 'windows/browser/webdav_dll_hijacker' '31' 'windows/browser/adobe_flashplayer_avm' '32' 'windows/browser/adobe_shockwave_rcsl_corruption' '33' 'windows/browser/adobe_cooltype_sing' '34' 'windows/browser/apple_quicktime_marshaled_punk' '35' 'windows/browser/ms10_042_helpctr_xss_cmd_exec' '36' 'windows/browser/ms10_018_ie_behaviors' '37' 'windows/browser/ms10_002_aurora' '38' 'windows/browser/ms10_018_ie_tabular_activex' '39' 'windows/browser/ms09_002_memory_corruption' '40' 'windows/browser/ms09_072_style_object' '41' 'windows/browser/ie_iscomponentinstalled' '42' 'windows/browser/ms08_078_xml_corruption' '43' 'windows/browser/ie_unsafe_scripting' '44' 'multi/browser/firefox_escape_retval' '45' 'windows/browser/mozilla_mchannel' '46' 'auxiliary/server/browser_autopwn'} get exploit 'ERROR' | 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 ' 'exploit/windows/browser/ms 13 080 cdisplaypointer' '7 ' 'exploit/windows/browser/ie setmousecapture uaf' '8 ' 'exploit/multi/browser/java jre 17 jmxbean 2' '9 ' 'exploit/multi/browser/java jre 17 jmxbean' '10 ' 'exploit/windows/browser/ms 13 009 ie slayoutrun uaf' '11 ' 'exploit/windows/browser/ie cbutton uaf' '12 ' 'exploit/multi/browser/java jre 17 exec' '13 ' 'exploit/windows/browser/ie execcommand uaf' '14 ' 'exploit/multi/browser/java atomicreferencearray' '15 ' 'exploit/multi/browser/java verifier field access' '16 ' 'exploit/windows/browser/ms 12 037 same id' '17 ' 'exploit/windows/browser/msxml get definition code exec' '18 ' 'exploit/windows/browser/adobe flash rtmp' '19 ' 'exploit/windows/browser/adobe flash mp 4 cprt' '20 ' 'exploit/windows/browser/ms 12 004 midi' '21 ' 'multi/browser/java rhino\nsettarget 1 ' '22 ' 'windows/browser/ms 11 050 mshtml cobjectelement' '23 ' 'windows/browser/adobe flashplayer flash 10 o' '24 ' 'windows/browser/cisco anyconnect exec' '25 ' 'windows/browser/ms 11 003 ie css import' '26 ' 'windows/browser/wmi admintools' '27 ' 'windows/browser/ms 10 090 ie css clip' '28 ' 'windows/browser/java codebase trust' '29 ' 'windows/browser/java docbase bof' '30 ' 'windows/browser/webdav dll hijacker' '31 ' 'windows/browser/adobe flashplayer avm' '32 ' 'windows/browser/adobe shockwave rcsl corruption' '33 ' 'windows/browser/adobe cooltype sing' '34 ' 'windows/browser/apple quicktime marshaled punk' '35 ' 'windows/browser/ms 10 042 helpctr xss cmd exec' '36 ' 'windows/browser/ms 10 018 ie behaviors' '37 ' 'windows/browser/ms 10 002 aurora' '38 ' 'windows/browser/ms 10 018 ie tabular activex' '39 ' 'windows/browser/ms 09 002 memory corruption' '40 ' 'windows/browser/ms 09 072 style object' '41 ' 'windows/browser/ie iscomponentinstalled' '42 ' 'windows/browser/ms 08 078 xml corruption' '43 ' 'windows/browser/ie unsafe scripting' '44 ' 'multi/browser/firefox escape retval' '45 ' 'windows/browser/mozilla mchannel' '46 ' 'auxiliary/server/browser autopwn'} get exploit 'ERROR' | 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/windows/browser/ms13_080_cdisplaypointer' '7' 'exploit/windows/browser/ie_setmousecapture_uaf' '8' 'exploit/multi/browser/java_jre17_jmxbean_2' '9' 'exploit/multi/browser/java_jre17_jmxbean' '10' 'exploit/windows/browser/ms13_009_ie_slayoutrun_uaf' '11' 'exploit/windows/browser/ie_cbutton_uaf' '12' 'exploit/multi/browser/java_jre17_exec' '13' 'exploit/windows/browser/ie_execcommand_uaf' '14' 'exploit/multi/browser/java_atomicreferencearray' '15' 'exploit/multi/browser/java_verifier_field_access' '16' 'exploit/windows/browser/ms12_037_same_id' '17' 'exploit/windows/browser/msxml_get_definition_code_exec' '18' 'exploit/windows/browser/adobe_flash_rtmp' '19' 'exploit/windows/browser/adobe_flash_mp4_cprt' '20' 'exploit/windows/browser/ms12_004_midi' '21' 'multi/browser/java_rhino\nsettarget1' '22' 'windows/browser/ms11_050_mshtml_cobjectelement' '23' 'windows/browser/adobe_flashplayer_flash10o' '24' 'windows/browser/cisco_anyconnect_exec' '25' 'windows/browser/ms11_003_ie_css_import' '26' 'windows/browser/wmi_admintools' '27' 'windows/browser/ms10_090_ie_css_clip' '28' 'windows/browser/java_codebase_trust' '29' 'windows/browser/java_docbase_bof' '30' 'windows/browser/webdav_dll_hijacker' '31' 'windows/browser/adobe_flashplayer_avm' '32' 'windows/browser/adobe_shockwave_rcsl_corruption' '33' 'windows/browser/adobe_cooltype_sing' '34' 'windows/browser/apple_quicktime_marshaled_punk' '35' 'windows/browser/ms10_042_helpctr_xss_cmd_exec' '36' 'windows/browser/ms10_018_ie_behaviors' '37' 'windows/browser/ms10_002_aurora' '38' 'windows/browser/ms10_018_ie_tabular_activex' '39' 'windows/browser/ms09_002_memory_corruption' '40' 'windows/browser/ms09_072_style_object' '41' 'windows/browser/ie_iscomponentinstalled' '42' 'windows/browser/ms08_078_xml_corruption' '43' 'windows/browser/ie_unsafe_scripting' '44' 'multi/browser/firefox_escape_retval' '45' 'windows/browser/mozilla_mchannel' '46' 'auxiliary/server/browser_autopwn'} get exploit 'ERROR' | 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 ret | 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 ret | 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 ret | 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 ret | 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 out append unpack data[i i + n ] word size return list map int out | @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 append unpack data[i i + n ] word_size return list map int out | 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 out append unpack data[i i + n ] word size return list map int out | @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 append unpack data[i i + n ] word_size return list map int out | 74 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3