diff --git "a/pallets__flask-4992/docstore.json" "b/pallets__flask-4992/docstore.json" new file mode 100644--- /dev/null +++ "b/pallets__flask-4992/docstore.json" @@ -0,0 +1 @@ +{"docstore/metadata": {"/tmp/repos/swe-bench_pallets__flask/docs/conf.py_packaging.version_latex_documents._master_doc_f_Flask_ve": {"doc_hash": "5bb53cdd96bfe35636f6c9a03396e167a17fadb8b5705ab8985b880f48777c3b"}, "/tmp/repos/swe-bench_pallets__flask/docs/conf.py__Local_Extensions__": {"doc_hash": "0adf9314cacd2c65be7d667ce1a02fd99c9689fa652c243fa213499d332cee7b"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/__init__.py__": {"doc_hash": "cb88fc03ef9286aeb99432ddabd01a26acb68461550b1e30b42402f6e2355cf2"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/views.py_from_flask_import_jsonify_": {"doc_hash": "6588472ea8a151cac0f73703ad377e9d3da5af154f5f7aded3d5499023e3220f"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/conftest.py__": {"doc_hash": "bce44d8dc368828e886f30e9fba4f16e981159ed3ec487b9162e4984ac79869a"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/test_js_example.py_pytest_": {"doc_hash": "6540fa07c750f0063455e1d3f766cde0b5888f98ddacd7b1cec173dd16696852"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/__init__.py_os_": {"doc_hash": "53821352633d158ef4f8ef6957825fdcb8e7c9ad5e3b6726dc8ecec1090f4366"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_functools_load_logged_in_user.if_user_id_is_None_.else_.g.user._": {"doc_hash": "08db85ab40fe3dd0eb11b3a0519f8640919f05010d47da5413e4cf323ef2bff5"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_register_register.return.render_template_auth_reg": {"doc_hash": "c5d12088fd272375d596fe4491eccf5b64be1dbde65595140bb5a5bee2e309fb"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_login_": {"doc_hash": "71e6df14c025284973ad17a1084f0cfbe88ea781a745a92b9961e6c1070320bb"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_from_flask_import_Bluepri_index.return.render_template_blog_ind": {"doc_hash": "872b70f46fdc1de0254ee2b0c149ebfdc3d90d77bd293e471f6d3f4631bccb3f"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_get_post_get_post.return.post": {"doc_hash": "99542b7086b2e130e70963c14fa9eee137e1bceeb987fc9657906db35492f97f"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_create_create.return.render_template_blog_cre": {"doc_hash": "7413f1fd040ef7fa13092711ca970a4415e0972e1d8d4019e2b4a8145e9d691a"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_update_": {"doc_hash": "4acc172998e37d32e18a5f0166965315335ba07726e0d5bc0465b01183a88024"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/db.py_sqlite3_": {"doc_hash": "ac040783c24be63ad56f7ad4a332c580bb6ace2cddf1b6a4895db66714156e7e"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_os_app.os_unlink_db_path_": {"doc_hash": "e0cdacbe20476a0d01d4314f1657c0e0b9053263fabefe8afd5292e7eae60523"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_client_": {"doc_hash": "752db116ac95c42ac7620c8a5a30f1fc1e97172eb33d51a65e1464535d54fb59"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_pytest_test_login_required.assert_response_headers_": {"doc_hash": "482c8f8fdd63b4249e6e3275e9d42eade194e8fa35f064e38963352e697a64ae"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_author_required_test_author_required.assert_b_href_1_update_": {"doc_hash": "052f9137ce6860cc550ce0d423144cc9d1e032678251e30ae860b1f70f1b4037"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_exists_required_": {"doc_hash": "9088e5c7c3974caa3e49865f9bad28c71f3b9c4af90e8f68a810058024ccc575"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_db.py_sqlite3_": {"doc_hash": "ad4fe1a1e80635dd8152516f74c5fe2f87b41ca32415713b948c16e3fa6297a2"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_factory.py__": {"doc_hash": "c0b167ea27950fcd743cab759cafd19e840ec7fcc9f8c06313aa1a2c10691a70"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__main__.py__": {"doc_hash": "33248bfab53cd02570de2cd698e2f01f7282ae6b73c83674101b0ad1bfa54f69"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_functools__make_timedelta.return.timedelta_seconds_value_": {"doc_hash": "6c40d5a77306f375c20917423fe9b8d5749796cae924a947d08567cf402e6818"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask_Flask._The_flask_object_imple": {"doc_hash": "d80b9fa01d3162bdad7e446d66e2aee8a69459dcc0fedcfbd3b214fc10dd4521"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.__init___Flask.__init__.self.cli.name.self_name": {"doc_hash": "ccb6e67da4b576b3a30d63680620c80218a5df8fdbbec008d19fcc636d8cd882"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.logger_Flask.logger.return.create_logger_self_": {"doc_hash": "db9f3ce54db705f364b8b9cda94e499ae8b81ad5ef613d19001ac890bcc6904c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.jinja_env_Flask.got_first_request.return.self__got_first_request": {"doc_hash": "03cf637eb214afc6c192f2391f61472e012bcbead57e896fe4a325deec609a32"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_config_Flask.make_config.return.self_config_class_root_pa": {"doc_hash": "9b0d22a0daf6fe9d21bfba3c9898886bd3c27d2768c1c4479371c48c4d057e1c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.auto_find_instance_path_Flask.auto_find_instance_path.return.os_path_join_prefix_var": {"doc_hash": "ae24159e45194e251853c71220853c820170ed3a26046d9f21520815a965cd36"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.open_instance_resource_Flask.open_instance_resource.return.open_os_path_join_self_in": {"doc_hash": "391bdfe8b6a9578e8ac0956e58dc5757e49c69d1fcba531e545806d02e9ad8a3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_jinja_environment_Flask.create_jinja_environment.return.rv": {"doc_hash": "36dc473d09d5c4b8e9d359db03b342bd59bcd6867197448a4d1837c95f5cee03"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.update_template_context_Flask.update_template_context.context_update_orig_ctx_": {"doc_hash": "d1b4fba672dda1c164aa2cbbcbee5a5a385fffc552f479638b1edc2268f7dd3a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_client_Flask.test_client.return.cls_type_ignore": {"doc_hash": "e6165af087f0387bb01b36f3674863719851f86351233689bd3289fca2fd0d7d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_cli_runner_Flask.test_cli_runner._type_ignore": {"doc_hash": "b3de8730f67b6d6c0e0cd55496daf3e3189954ba3c465d21222c8de20e0eee4f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.register_blueprint_Flask.iter_blueprints.return.self_blueprints_values_": {"doc_hash": "d1736ad477ad45c80be1001af87fd00dc4a12ced4b1b155fdf7fdea42b96c03c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_url_rule_Flask.add_url_rule.if_view_func_is_not_None_.self_view_functions_endpo": {"doc_hash": "7b5e04ab1a3f3c7e8800645c0c2f75fbdfdbeb99774e5a962866d874e0be5bb7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_filter_Flask.add_template_filter.self_jinja_env_filters_na": {"doc_hash": "2e0afaefd5b2841dd21343c1efce4b46b99902f5ceb1f660737e25b4463678a0"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_test_Flask.template_test.return.decorator": {"doc_hash": "4ee92b2f02c8e41d903a5a1a7dc391a81d3141ca1f8730798a0a8a89ef3e2082"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_test_Flask.add_template_test.self_jinja_env_tests_name": {"doc_hash": "f87261c46f3856780ac8ba9a236a3e542eaf4674d5bf5b43047a399e6f5021d1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_global_Flask.template_global.return.decorator": {"doc_hash": "00ef413ce170b0a95e420f3ed8f6c5c2f8d058046fcbd7d7ca358a28a833ec21"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.teardown_appcontext_Flask.teardown_appcontext.return.f": {"doc_hash": "76b095e8d76e029289d5bd52db3d1257afa440cb223d8b0680fd5570004bd72a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.shell_context_processor_Flask._find_error_handler.return.None": {"doc_hash": "554a099e1b2505405cad2dde4c7bd8eb22067f6a96c938b5801ebfd6244cc588"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_http_exception_Flask.handle_http_exception.return.self_ensure_sync_handler_": {"doc_hash": "c7982ca59fbcc301c8d4a9a63e562737b704935a1318eb07dfa2c497cb15cab6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.trap_http_exception_Flask.trap_http_exception.return.False": {"doc_hash": "064fb3090587f969983e555efdb05c2b30894b67b1f6aae96f79b9ce171f09ba"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_user_exception_Flask.handle_user_exception.return.self_ensure_sync_handler_": {"doc_hash": "dbc6d64ea9db3b6a000508efd81dc3570a5c6ab5433aa3b3af429c7ede29d7c8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_exception_Flask.handle_exception.return.self_finalize_request_ser": {"doc_hash": "9c81fc739985560a070eca9f57d58bf7601cc1ab2bdce524b831c42988f41438"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.log_exception_Flask.log_exception.self_logger_error_": {"doc_hash": "fc48f5eb798e72dab995d91306de75180a73fee206fce1ef6d02294f7d6c101b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.raise_routing_exception_Flask.raise_routing_exception.raise_FormDataRoutingRedi": {"doc_hash": "d02752be458c8ed4fb7bc1e57cfcde1d844d4528b6613da33bf278a270e1f8b9"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.dispatch_request_Flask.dispatch_request.return.self_ensure_sync_self_vie": {"doc_hash": "56c5b6ac200657777dd2c6830bf576493ca8755d7227d41a239c42179f7f05a3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.full_dispatch_request_Flask.full_dispatch_request.return.self_finalize_request_rv_": {"doc_hash": "fbd0621d6a182fcf9cb034115c90f786cd09e10201ab5a2761de36c51f2852cc"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.finalize_request_Flask.finalize_request.return.response": {"doc_hash": "a9f34164d7417d4f875ca63bed77a34bf1f31b6ad74c921cc87ccbfcf365abfe"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.async_to_sync_Flask.async_to_sync.return.asgiref_async_to_sync_fun": {"doc_hash": "ddbddb74c3f885b17893a719db837e742795f14d6cb7467e129630bde42c5c4a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response_Flask.make_response._make_sure_the_body_is_a": {"doc_hash": "5c5356c2ceb3141ef928caa1bc1b9b7584cdde8653ba7e324dea595c542f7aa2"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response.if_not_isinstance_rv_sel_Flask.make_response.return.rv": {"doc_hash": "a28d7afe1914487988ee8093aa6451c588ebac9e2f6609c35398201347407c1d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_url_adapter_Flask.create_url_adapter.return.None": {"doc_hash": "1d6de330c338396395be4a054ec2c475cf968691fcb25ab8dd1e308cc1d67fa3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_url_build_error_Flask.handle_url_build_error.raise_error": {"doc_hash": "f873a90eb58e16d08ec1c39dce80fcdc63afd1c6906532d94d55a74809c584c9"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.preprocess_request_Flask.preprocess_request.return.None": {"doc_hash": "c0c2a3f7d9a82262ae6d3eceae7d4b2b2c7752900f8eace3b99f09ee5ca8d2f3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.process_response_Flask.process_response.return.response": {"doc_hash": "2cd8b02c4dae0f0416d4fa9ea6d3709ce8091becda4b2a585117cc30c5fa2761"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_request_Flask.do_teardown_request.request_tearing_down_send": {"doc_hash": "6ab05c5620414826b2381292d7c608f95d0a9f8672630d0fdcb8314381ac6bcf"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_appcontext_Flask.do_teardown_appcontext.appcontext_tearing_down_s": {"doc_hash": "8e89b1ea679d5bad58fa144604054c93b2e3311ece49a576078e829b006663e8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.app_context_Flask.app_context.return.AppContext_self_": {"doc_hash": "8ee3232341777a222c1be21767ced90019ff00bcac46c2c60b6096453d068b5e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.request_context_Flask.request_context.return.RequestContext_self_envi": {"doc_hash": "59ab669b7e8cf706f700e543143ad0b1dfa32639d38d40429e42ffbefaf072c3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_request_context_Flask.test_request_context.try_.finally_.builder_close_": {"doc_hash": "c0521c34a60a58a67a09a88187873cd65b35d01d44b746bf4b2820401aa07b3f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState_BlueprintSetupState.__init__.self_url_defaults_update_": {"doc_hash": "1484440ef3ef6a2a677eacfc1264e6d4fb2e1b0bf4311bf375fc48a4bf212098"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState.add_url_rule_BlueprintSetupState.add_url_rule.self_app_add_url_rule_": {"doc_hash": "101b295748f2bd36f619c58b343475db6ca8907c3892faeff193f19af1e4d0fe"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_filter_Blueprint.app_template_filter.return.decorator": {"doc_hash": "6ef199837606f4760e7a5a822b8c8446546c7e1e76646111d8d78f17830a540b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_filter_Blueprint.add_app_template_filter.self_record_once_register": {"doc_hash": "e34a157e79e4420c1a1fcb17a5ffa7053c6ec5c2759c17b2c4c1193907a304c5"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_test_Blueprint.app_template_test.return.decorator": {"doc_hash": "9b8fb205a02089fc386d8c39000eca47f49ecbfcc7fe861108fd713f29ea2d5b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_test_Blueprint.add_app_template_test.self_record_once_register": {"doc_hash": "edcc9df3a03637778285dcaa0f35a63cffa1b95327e17471a0228bed28e088c2"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_global_Blueprint.app_template_global.return.decorator": {"doc_hash": "f1d9448240216f7ba3b8eceaeb7961a64b4ee8c5205b405c97b9f07c54147b2a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_global_Blueprint.add_app_template_global.self_record_once_register": {"doc_hash": "566b64799b810f1447d8a5a14902cfa2706d0b9e21306e0bfc053d234cf7f6c4"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_best_app_find_best_app.raise_NoAppException_": {"doc_hash": "1d27fd605ebde5bf491af616ee4c83d100772005f20b9d06587c4fdf5ffd1517"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__called_with_wrong_args__called_with_wrong_args.try_.finally_.del_tb": {"doc_hash": "e893b7858dbd147e1885f8dfe974cc8c6723db1f8783e3b17901b511c0471632"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_app_by_string_find_app_by_string.raise_NoAppException_": {"doc_hash": "bf9b2b5d4b67403da24dedc2f115295ece16825a4c7786ec3f6f21edb5cafce2"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_prepare_import_prepare_import.return._join_module_name_1": {"doc_hash": "c86da4f544c6e7a97f4a6939dfb33b7d2f1b53eac5efb11dceec4d51d8541e27"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_get_version_version_option.click_Option_": {"doc_hash": "06ba95635d13e5367aafddc6def18dc9dc0f80e2feb6f33765ad23f9b47d5214"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo_ScriptInfo.__init__.self._loaded_app.None": {"doc_hash": "13941d02ee2eafd8029dac91bf81940979148d6995095169e9f3b7f69228e82b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo.load_app_ScriptInfo.load_app.return.app": {"doc_hash": "f611239b17e5897073bd69beced979e871b961486141fbe4f5da3a4fae351eb2"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_pass_script_info_with_appcontext.return.update_wrapper_decorator_": {"doc_hash": "3e001caafbc941e1d3d19900d4e41a96337d2522e1d540b08036b6b01e83f87e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_AppGroup_AppGroup.group.return.click_Group_group_self_": {"doc_hash": "d866de662835f7b36ea394b0924f99783889a0430534c38a4ab107ac3d2f8664"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.list_commands_FlaskGroup.list_commands.return.sorted_rv_": {"doc_hash": "815ba432cbae7e8c420ddd942643756e5baa8edae1409cd7dc3f71778b813805"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__validate_key_SeparatedPathType.convert.return._super_convert_item_para": {"doc_hash": "b752a5ed063dc5c1d576001fa3c57948611e81d9bc20f4bf6872225cafc73bda"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_run_command.run_simple_": {"doc_hash": "b4f996aba558d92d5071de20c1f85e5899cf5f1a4ac012811e05c3eb8029b84a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_errno_ConfigAttribute.__set__.obj_config_self___name___": {"doc_hash": "da3a1714eaf6017146c9eab40578ce9172f1b64492e034766c5e1226ad027d44"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config_Config.__init__.self.root_path.root_path": {"doc_hash": "7bee3ec95004958a14937c17b5e2bde9d7819390a1c894a465813b4bf9165f89"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_envvar_Config.from_envvar.return.self_from_pyfile_rv_sile": {"doc_hash": "24aac74256991d8f99f24a9567d2c9779429cb59710fc53fa92f8126470a8e6c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_pyfile_Config.from_pyfile.return.True": {"doc_hash": "a248ea96f5e2f60a906e248132e347004992ec8f453fda3810c2aaec9c26cfce"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_object_Config.from_object.for_key_in_dir_obj_.if_key_isupper_.self_key_getattr_obj_": {"doc_hash": "e6069c693475a2aba68dc718ef97292fcad7ee87ee2c436ed5a12e1f186df128"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_file_Config.from_file.return.self_from_mapping_obj_": {"doc_hash": "6d3db5bc482c73ebe1b96490543283822cfd5204ecc7d2bbc9e672c2ca9be14c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_mapping_Config.from_mapping.return.True": {"doc_hash": "533354840d01cc97ac390f32ba39d2d7130a23b969ef5f94e677e1faf715f4d0"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.get_namespace_": {"doc_hash": "c4b9e6042175f9665cb4f07fbfbade9ed6012170d67107801491aefd11933c1c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.pop__AppCtxGlobals.pop.if_default_is__sentinel_.else_.return.self___dict___pop_name_d": {"doc_hash": "653e6a9cb0cdcfad1a9c8c02c8607e57f837b69bc152078e11b7ad9142f93915"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.setdefault__AppCtxGlobals.__repr__.return.object___repr___self_": {"doc_hash": "b489f13f6fd5d3804879449f7cc0b8bf07cc002ab41dd3c9649f0aa7e4b90236"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_after_this_request_after_this_request.return.f": {"doc_hash": "27c4e93161b8a3caa37110aa6a6b389ab304b60768bf7640b7e953d530f58bec"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_copy_current_request_context_copy_current_request_context.return.update_wrapper_wrapper_f": {"doc_hash": "09993a164ef5d34bf23068f351cbd1d078af158efeaa46def913b2c970b92e2b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_app_context_AppContext.push.appcontext_pushed_send_se": {"doc_hash": "166a4534c6d0a8ba737b5f789f859f24a4f245a1cd54ef3ce8d1cfe0abaf7de1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_AppContext.pop_AppContext.__exit__.self_pop_exc_value_": {"doc_hash": "0bcff5f8ce56d25cbdd3ea30638eabc6025148dfd45f874f4540c5b9d4864cc7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.copy_RequestContext.match_request.try_.except_HTTPException_as_e.self.request.routing_exception.e": {"doc_hash": "ef275fcfa0d90d75abead2e505884c69f07fddc56edf8386ff86d56085bdea5e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_attach_enctype_error_multidict_attach_enctype_error_multidict.request.files.__class__.newcls": {"doc_hash": "f4f9f46966e06e0db400fdac70d4fc9685fa911272faa8d93813ba94fa64d68d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py__dump_loader_info__dump_loader_info.for_key_value_in_sorted_.yield_f_key_value_r_": {"doc_hash": "2ad500c10e02c4bcc206dc2172a269c4eeb3bf0effc778af071e11a3038abd3d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_explain_template_loading_attempts_": {"doc_hash": "1432930969db4b83da3514b08f5470f141bab609081391e07afcfdb9330989e1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_load_dotenv_get_load_dotenv.return.val_lower_in_0_fal": {"doc_hash": "abdc86c3189df998c82cec04ea7a77ac952bfd845b27411e874351b929691b01"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context_stream_with_context.try_.except_TypeError_._type_ignore": {"doc_hash": "1cb8b91ede4392649f6c4108a4119cdbaf2baa88c6dad00a7b4d50ab7bf8d772"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context.generator_stream_with_context.return.wrapped_g": {"doc_hash": "33ed5c7915fb25289a941f8fecbdf9899dbe01c63328464c942e3505a528862f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_template_attribute_get_template_attribute.return.getattr_current_app_jinja": {"doc_hash": "f9dc03a29ab209b704c3d36c126a02381e0ed7f44af9e0276a361871714202f6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_flash_flash.message_flashed_send_": {"doc_hash": "a1a913a27652c14e19059f59d41ed1683bf3fc965f621338aa83a3ebb2eca9d3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_file_send_file.return.werkzeug_utils_send_file_": {"doc_hash": "ec99e0e64a068e8f956acebfd3022024ea473923bdf5133657164ee1f8bff1f0"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_from_directory_send_from_directory.return.werkzeug_utils_send_from_": {"doc_hash": "16e5c27442ba7d488bc802edf7ca170ab6bd736f1744014df592e5bc952e7681"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_root_path_get_root_path.return.os_path_dirname_os_path_a": {"doc_hash": "13c33c3b0af087410a79ce6d46ae14d0b62c9fe54d314cae992c38ebd07de1af"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_locked_cached_property_locked_cached_property.__delete__.with_self_lock_.super___delete___obj_": {"doc_hash": "93a1d02eee0aafccff52c457a6153c68c124ce6de9d85aba0ca8c418f491acfa"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_loads_loads.return._json_loads_s_kwargs_": {"doc_hash": "a7f2f9f6b7ccaa859b7133715dc847b67aa0dfa82b0197437360cef6bbac3468"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_load_load.return._json_load_fp_kwargs_": {"doc_hash": "4fee879d032b6dde65ce18b8bde7b45f1e66a71ab37b3b678736441daf86f4bf"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_jsonify_": {"doc_hash": "116a34bbd505b3054a91a29be51e3e83e5904eca9e717184e8027fc7ef0024a7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py___loads": {"doc_hash": "839c3c27e10ccd596e53f6b0d79281d0ea32e59719a25a7f0d2067b55faec34a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_JSONTag_JSONTag.tag.return._self_key_self_to_json_v": {"doc_hash": "19473f98b425f9e868e5b9ccacf438a877163ead04d531ecf56540ae1d43ee6a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagDict_TagDict.to_python.return._key_2_value_key_": {"doc_hash": "197fb5b3e65b79d9c6a988117306de04608638349bf625c12d101c9a61445695"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_PassDict_TagBytes.to_python.return.b64decode_value_": {"doc_hash": "7d96502033fdb29163bbacdf8961fb1a4f80f65a85200f94705d69e10074465c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagMarkup_TagMarkup.to_python.return.Markup_value_": {"doc_hash": "54829644eae08f0cbad27591d9bdb4dd3aa6c0b1b91a22c41fb0370239031fb7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagUUID_TagDateTime.to_python.return.parse_date_value_": {"doc_hash": "3472c3416753c68b84220dbc5a6b6266bc7489ec2ded6a939cdeae693eda2c10"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer_TaggedJSONSerializer.__init__.for_cls_in_self_default_t.self_register_cls_": {"doc_hash": "f22c1ceefcaa3bf8cd09b558994db820296365f075810565fdbb05964c260aff"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.register_TaggedJSONSerializer.register.if_index_is_None_.else_.self_order_insert_index_": {"doc_hash": "464c5cbfdd2295002de5d806ee168eecfe3ac48f9a77d959c462b0672bc61b88"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.tag_": {"doc_hash": "27aa19349b630749ab8016edacc7e5c3a42bcadd876e161d23ba9c51e592e85a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_logging_wsgi_errors_stream.return.request_environ_wsgi_err": {"doc_hash": "a00e3c3845e1e49fa6470dbc197a2064be2c0afb51f18e51fbabd5f7f22609b4"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_has_level_handler_default_handler_setFormat": {"doc_hash": "68bdcc611357ef1ea20a178000e6b743c74fa18e8ac9df2c722aa256752e4cc7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_create_logger_": {"doc_hash": "00c3c0697a963bbf789dfae8ff1583e7c63014fc6b90a9891e326be39a989ece"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__init___Scaffold.__init__.self.url_default_functions.defaultdict_list_": {"doc_hash": "af5f03ef4d262d463c44b53065387a2fd07caac06ca2f171602b97bcc8d684fa"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__repr___Scaffold.static_url_path_6.self._static_url_path.value": {"doc_hash": "8e2e74178a4d580089940028710326715b097d6bdf05c371b1c68fd0e5687dc2"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.send_static_file_Scaffold.send_static_file.return.send_from_directory_": {"doc_hash": "1b9992c84bdb4ab891e4908d8010b97633aa2e9d50f1dd98f67faf949423f4af"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.jinja_loader_Scaffold.jinja_loader.if_self_template_folder_i.else_.return.None": {"doc_hash": "8a8761bc4fe3c994fdc0c3246f0ec5c3ff0ce171ff584a7d7f2e075d7aa8cfd8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.open_resource_Scaffold.open_resource.return.open_os_path_join_self_ro": {"doc_hash": "ea7dc4cac98666fd97c27e9bddf02324b04bd8d6142942a5bf171de13a46de50"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._method_route_Scaffold.patch.return.self__method_route_PATCH": {"doc_hash": "3789782717baf6826c19e58eccad950d4196fdd56c2d101fe1761e68b201e20f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.route_Scaffold.route.return.decorator": {"doc_hash": "11daad22246de6d68a3471043697bf75a83ef7ebc0553bb1cc79528df8a69948"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.add_url_rule_Scaffold.add_url_rule.raise_NotImplementedError": {"doc_hash": "fe8f5e4f8173b26e07614f189cbb045341d08976f633e90f1871d4a9f05ca700"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.endpoint_Scaffold.endpoint.return.decorator": {"doc_hash": "bb754425dc911d00497f170acd019634031a14a54aeeecd3427db7fc867e98e9"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.before_request_Scaffold.before_request.return.f": {"doc_hash": "f458eebe26ce264ed79ed62c960b9b9d53ef240397d95088333f1002d3e524bf"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.after_request_Scaffold.after_request.return.f": {"doc_hash": "81ecc79bac45a87b627f8ee597de50abc166899568e3cb94931b924d3a980f7e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.teardown_request_Scaffold.teardown_request.return.f": {"doc_hash": "bd50aa1acbb49e455ad3ffe29a29307ba1f6d923e980b3f25635d4e3c524824c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.errorhandler_Scaffold.errorhandler.return.decorator": {"doc_hash": "ebc71b5b4e96c830dd352623c317ba97908a6c5ac87f9a1263d23375a224d19c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.register_error_handler_Scaffold.register_error_handler.self_error_handler_spec_N": {"doc_hash": "e9a40a8898a11ce5b6e77cc6edaa6a1f2965cc6b2811902dbe077cc628b37d6e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._get_exc_class_and_code_Scaffold._get_exc_class_and_code.if_issubclass_exc_class_.else_.return.exc_class_None": {"doc_hash": "ac407c45a6fbf3856eb38ad147a5daa151b050adcacbe3f3e1dac7e48ac67627"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__find_package_path__find_package_path.return.package_path": {"doc_hash": "25d0b5a7667bfc7e8e56f5d74353316116b0f92a9afd527b9a75105408650070"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_find_package_": {"doc_hash": "b8558ca3e0747fbf3affdce18b7c6d7a425207f827bc01b3793c7118de64714b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_hashlib_SessionMixin.accessed.True": {"doc_hash": "b964887a5583ef29398ae77b257bdecb2891832364d1e84e1923abe666e88339"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSession_SecureCookieSession.setdefault.return.super_setdefault_key_d": {"doc_hash": "042746abea8bf509b6b04880aee315ad36cfccac0b60062060e6273c7bdb263f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_NullSession_NullSession.del__fail": {"doc_hash": "1c3049d71f2dd09a2c26403de76ad7f48e6d275e2391f99721fd879d89e09e7f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface_SessionInterface.pickle_based.False": {"doc_hash": "18d7e7dc514a019724408c61fd10c6449ca8563ba1136915caf6ce85cf6b474e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.make_null_session_SessionInterface.make_null_session.return.self_null_session_class_": {"doc_hash": "fdf8f44b53d6ea441ec407b694884911ff12e6c1d0667a82a4210a7093bb85c0"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_domain_SessionInterface.get_cookie_domain.return.rv": {"doc_hash": "22f38aa6c5b23d45df0f30a5a7372164198aa2c3122c19726dd29730cf14c539"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_path_SessionInterface.get_expiration_time.return.None": {"doc_hash": "7aec6403bace052835ed74d39ebb3cae9522668725dba7eaece13063f1618021"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.should_set_cookie_SessionInterface.should_set_cookie.return.session_modified_or_": {"doc_hash": "4522ecd7ce63f66be30a6506926b4c3472ba8ed90021f5d7f3896406ce514b6e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.open_session_session_json_serializer.TaggedJSONSerializer_": {"doc_hash": "6c1fc95221f2be18247377a90fbfbbb8ebeb1e48d5902cdf28bdfa71c88a0e47"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface_SecureCookieSessionInterface.get_signing_serializer.return.URLSafeTimedSerializer_": {"doc_hash": "f1498ae08e885d5a9299ec4da4e635458334d300874530758185627ba264501d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.open_session_SecureCookieSessionInterface.open_session.try_.except_BadSignature_.return.self_session_class_": {"doc_hash": "51abab715897f1400516e1103612d49007d2463efbf9dbe1e17b28b55f83fddb"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.save_session_": {"doc_hash": "c2f2c954a1765805396a7171ef317c9261374700f79f0a0ac2b5f10ad6f01348"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/signals.py_t_": {"doc_hash": "b1a99a7ed13648efa333039595a4dda05d8ff1648658130816a24cc77c71a21b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_Environment_Environment.__init__.self.app.app": {"doc_hash": "653d66fc4dbab63a9cabbe60f59143f725f8781a4e96137126d1b9680f1d60b5"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader_DispatchingJinjaLoader.get_source.return.self__get_source_fast_env": {"doc_hash": "73ce26b1f4cf0d30a564019be91b0fd8e1b0e70c51413be98386fc98d8302eed"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_explained_DispatchingJinjaLoader._get_source_explained.raise_TemplateNotFound_te": {"doc_hash": "718ae08467100edb7a7c84d182a57673f4cb5ca69248bfc9853c77e8cc776645"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_fast_DispatchingJinjaLoader.list_templates.return.list_result_": {"doc_hash": "fc27c6916ba01cf7f3c8d7ba7064fe15d502531faecd35e30503a804ff951863"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient_FlaskClient.__init__.self.environ_base._": {"doc_hash": "57b0130816aaf69ecda0470c089d7e4db565ac1141567f4a8f009853eb32ea2c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.session_transaction_FlaskClient.session_transaction.with_app_test_request_con.self_cookie_jar_extract_w": {"doc_hash": "e8701ec53f69c84ac65b9d30f47ea8f9ff2ce3a71f1153e9a557cb4f34ffef9e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskCliRunner_": {"doc_hash": "65a2aca8d778a78410e1fff0629227ab00901a61c62bdabb5e0609884c55cacb"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/typing.py_t_": {"doc_hash": "a6046e15e1f4ff27e2626f0878d6610802f82d582168afb3d613535772f57486"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_t_View.dispatch_request.raise_NotImplementedError": {"doc_hash": "53f562db856ff7ea47ed2459eedef2a0c59ba98ae949148f243bf6fa5b75e9ef"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_View.as_view_View.as_view.return.view": {"doc_hash": "ee4460e03e10053c8a2ed0b188ae018f27f7947a4a8cbf6eb8a91c3ac7f98cf6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_MethodView_": {"doc_hash": "deb8f4c10105e7cf3981eacfdbdd8018e04db8e3ac29f4678d7c057957322969"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Response_": {"doc_hash": "6173059cdd8ad7a26a3464f21a01484dcec947c4589f9bb1e2c37a58da7ad1ce"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_os__standard_os_environ.mp_undo_": {"doc_hash": "2dd33056437bad3b87283561b45877f7fc4b0ede4ad597dac07f579c2c8ef2ae"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py__reset_os_environ_leak_detector.assert_leaks_": {"doc_hash": "040d1aa8af806b0a63cf0106a41df89ce37fe3e8010450f6a0e316938d26519c"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_limit_loader_limit_loader.monkeypatch_setattr_pkgut": {"doc_hash": "11e397cd3486ccadd5e92295ff557c25ec6bebfb300ca6f63fd3bdeff5c845f1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_modules_tmpdir_site_packages.return.rv": {"doc_hash": "bd52ac70f5706ef90905e11031f94edb5e84071ef5038f979f7529611b0859ba"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_install_egg_": {"doc_hash": "b2fa980503d25e03d7b91249633549f3a7feaa93cca030cdd3fc5eb6c4390c92"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_pytest_test_app_tearing_down_with_handled_exception_by_app_handler.assert_cleanup_stuff_": {"doc_hash": "e3030c652a5a452593e4b81b1c9131ec3fcb126db14393119d4c5b876404bf6a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_tearing_down_with_unhandled_exception_test_app_tearing_down_with_unhandled_exception.assert_str_cleanup_stuff_": {"doc_hash": "dc91e8370aa50f5c9750fc57eec8d08d0c49106117844a8a90c67a27fc07bc42"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_ctx_globals_methods_test_custom_app_ctx_globals_class.with_app_app_context_.assert_flask_render_templ": {"doc_hash": "ddb7b472652ece71597b3a5081c8a6ddbcdfbc0bbfbed94c09b47fc642965f8e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_context_refcounts_": {"doc_hash": "51122ceae0f5652926663929f83ee46e3d445ee4372166ac4e0c5b1e5f6ac77c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/__init__.py__": {"doc_hash": "9d703f732ffe1cfb046920695c7ea80181d9d1bf41d209e38fe7ecdfc1dcae1e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/admin/__init__.py__": {"doc_hash": "663c908343e87180de19dcd9b138bbf0ea7dff581e2645579d0c46e27092f365"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/frontend/__init__.py__": {"doc_hash": "4fb3c1850004fd8d31edd526419bc511e80828e1f4563e47d8e05d6c81da988a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/app.py__": {"doc_hash": "f347ca8b470b4e5fd11608030855f814021662cd24eacd49c0d8ce49cb2eb56c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/factory.py__": {"doc_hash": "d9b3b72bccb2b22a1203a54a52f4daaff6637bcf4687fbd1833e7db89ab16d7c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/importerrorapp.py__": {"doc_hash": "36d1c5c65495d66ecb083c1364244bd324a2cd49663fb9d6067574dfbfd925f6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/__init__.py__": {"doc_hash": "481e6f206f9cad50080894467b6606801fd14e263cef7938263f24bf3452c87b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/inner2/flask.py__": {"doc_hash": "abd61e35d7c4ba01202b8c1c18063c2ec0523983c210f1b7fcf542e1f8cb9a25"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/multiapp.py__": {"doc_hash": "41dd7c72995972ecdf310d9623ef8fc47bff6440ea460e1517b3049a93834d27"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/hello.py__": {"doc_hash": "d046dbc8cbb4a431dba1d33a208b958604ef13e2dccc79f444e6536a434abbe9"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/wsgi.py__": {"doc_hash": "76ab6cc1c99f2ca1d40d2f38a8c888dd6db91fd1fb791a75946ccb0fb038467b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/subdomaintestmodule/__init__.py__": {"doc_hash": "9fb0c187acecad02082255aea84e834db5d6e38bb0d24e74139f3097e19ea5c8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_route_test_async_error_handler.assert_response_status_co": {"doc_hash": "091020b10bd601e5348ca5aa0da76de081be4fe60de58b2409f4e8aa89068151"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_before_after_request_": {"doc_hash": "5e9be594ef719fdb1056d1e52cbd7ac171676fd714946c9224d878c95732afb3"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_gc_test_method_route_no_methods.with_pytest_raises_TypeEr.app_get_methods_GE": {"doc_hash": "c93f69aa2a70cf40324c58743818b95050fd3431b8917e7f2992dfdbb7cb484d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_attr_test_provide_automatic_options_attr.assert_sorted_rv_allow_": {"doc_hash": "a698d1ac3f0c08707ba7131dcd99c70fc6da240e242bd38368c5efcbcee1ff2e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_kwarg_test_provide_automatic_options_kwarg.None_10": {"doc_hash": "df69f581a4c0cc50750f5f0cb37cd59b7bc6b87b979d72338fb32b0a00d0bc09"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_mapping_test_url_mapping.assert_random_uuid4_in_rv": {"doc_hash": "dd4f93a6ecc7d7fe8bdfb64343c9b4b19d53f9799a1b7169fb5e09c76a016be5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_werkzeug_routing_test_endpoint_decorator.assert_client_get_foo_b": {"doc_hash": "c0fb4ce1bc411d6b79db26574552033fc1d236f2d3a0f1b35dd66bd6e0394f13"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_test_session.assert_client_get_get_": {"doc_hash": "88d0a98c90193f534765ea475b42c3e6c45d7de0683f31a90dc173f255c88e4c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_test_session_using_server_name_and_port.assert_httponly_in_rv_h": {"doc_hash": "211b16ca9df1c74fb02aa3004de93d7faabbd6112fa342bbcc8d5541e16a45cc"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_port_and_path_test_session_using_server_name_port_and_path.assert_httponly_in_rv_h": {"doc_hash": "1e809caab3cb7513dc01e6f5ef6dc4c4cab7c04688d6c40113e6bd0aad9eca9f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_application_root_test_session_using_application_root.assert_path_bar_in_rv_": {"doc_hash": "1b16a6f299162ebf6a39e80d70069aef653de264f9c625be2de4163ff51b7cee"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_session_settings_test_session_using_session_settings.None_9": {"doc_hash": "217a2f5a94a969ebc6f3d39eae87627156f2fc1f03f7963842259cab82fd3401"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_samesite_attribute_test_session_using_samesite_attribute.assert_samesite_lax_in_": {"doc_hash": "3a65a5895b6ae93c50e1dad01f464917665151e4ef53ab621bca44e72b26773c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_localhost_warning_test_session_ip_warning.assert_cookie_domain_is_": {"doc_hash": "157a23950c0163d3ff8ce059fa1ae94c7d2eacfeebd94dc5c45917f162dc57cc"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_missing_session_test_session_expiration.assert_match_is_None": {"doc_hash": "261cfbef7c9ea12b6ffe029570ea8ea603cba23938ae42d5c2e043fe38835899"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_stored_last_test_session_special_types.dump_session_contents.return._204": {"doc_hash": "e18945f48b1a81b9232ba9547d2e53aafda06b85f6d8dd03b3dd8f46be072582"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_special_types.with_client__test_session_special_types.with_client_.assert_s_di_tag_": {"doc_hash": "1ad5d0856e6e97986ad830d3cb899d2b4bf7eaa6713d3438d31a289749e917b0"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_cookie_setting_test_session_cookie_setting.None_3": {"doc_hash": "3c099162e1f0c4a5f652cddc73b01b7fa8dfd65d253a85b8730c3542736a4b36"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_vary_cookie_test_flashes.assert_list_flask_get_fla": {"doc_hash": "99632159fe21803ab2fc703596617c29666227a45286659a5fc17aadecb7da2e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_extended_flashing_test_extended_flashing.None_7": {"doc_hash": "831648e0f6748af85a928829160494c81058d456e92654bce57ec8450baedef5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_processing_test_request_processing.assert_rv_b_request_af": {"doc_hash": "853fa9ce677d04b2d7c380a288acf658804bfff70475c047ff145c0add5b7e7c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_preprocessing_early_return_test_request_preprocessing_early_return.assert_evts_1_2_": {"doc_hash": "a4c6b188f61dfbf5dc601d4df2544734f7d261c0a2f6191a2396726c2a2d31a7"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_after_request_processing_test_teardown_request_handler_debug_mode.assert_len_called_1": {"doc_hash": "e6e16513306b65e4cd493145e611f93b7ffa7d69e6c3e08147280f57aa40305b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_teardown_request_handler_error_test_teardown_request_handler_error.assert_len_called_2": {"doc_hash": "0e56fdb7c4a191cb5f4262f6a4f8996032c1d872bb78d09482f55d0804d40f1f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_before_after_request_order_test_before_after_request_order.assert_called_1_2_3": {"doc_hash": "5c4fc1403f0f55abbdb25a98dd4cb183e94e859c88850330701ba7a310dcdd06"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_test_error_handling.assert_b_forbidden_rv": {"doc_hash": "878d9f940905d51bf016516f259774e61b17e928f325e10f4e6a837aaf5fb40b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_http_error_subclass_handling_test_http_error_subclass_handling.assert_client_get_3_d": {"doc_hash": "fdc1969a27625f89df3624e94b2fe3233119fd0f561a8f0760f2f0ef5fcb519c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_errorhandler_precedence_test_errorhandler_precedence.assert_rv_data_b_E2_": {"doc_hash": "fe14f349364604c8296e91ea1a7063f7e6eac3ffa3b7045f7e64d95a052e298e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_with_response_instance_test_make_response_with_response_instance.assert_rv_headers_X_Foo_": {"doc_hash": "7ad938481155828a8effe4b5fba1dffca174f050f106d7b451d251bd6f2ab28d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_test_build_error_handler.None_1.assert_flask_url_for_spa": {"doc_hash": "e18503168971c81c83291a3acedb15a381e75d6ff956306ee78ec866e4efaa66"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_reraise_test_static_folder_with_ending_slash.assert_rv_data_b_catch": {"doc_hash": "14ec9ee224503b232f96bdcc8805528e074f4375f8103ce79291061923a475af"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_static_route_with_host_matching_test_request_locals.assert_not_flask_g": {"doc_hash": "bfd923f271b8dbf1aca2feadb85b90acbdac0013d64e788e8f6eb60424aa56f5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_server_name_subdomain_test_server_name_subdomain.assert_rv_data_b_subdo": {"doc_hash": "07fc48843b634cec13f1fa6658e79085ae04e24cf029fe216469e6f015fb610e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_content_length_test_max_content_length.assert_rv_data_b_42_": {"doc_hash": "2e25e341942f48cdc931881aaf617ba42b97263b59c9ecb28f07a9d3dae52f43"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_processors_test_url_processors.assert_client_get_foo_": {"doc_hash": "44c25be41aa90b26bfd8e461e22badc1d6c3e250d880d2744d21802c180b7d4d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_inject_blueprint_url_defaults_test_inject_blueprint_url_defaults.assert_url_expected": {"doc_hash": "c43b082cd7d8eb3c8ad8384d091a3c1d8e592caafb5e3a7c84263bd796328a40"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.assert_client_get_bar_1": {"doc_hash": "ca9e0517df473fce6916985c8e4e5e6671b96ce3cb8f65a63cade444abbc3418"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_get_method_on_g_test_g_iteration_protocol.assert_sorted_flask_g_": {"doc_hash": "e132d2e21b085593cbd64d4e517e7629b4de8bae045e808b256a87b7097da605"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_basic_support_test_subdomain_basic_support.assert_rv_data_b_test_": {"doc_hash": "2e19e1106c01593490c5a724f5c4894bd66d5bf6385474ed09a629000a82d13a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_test_subdomain_matching_with_ports.assert_rv_data_b_index": {"doc_hash": "28e010ec51bd74783ff56d8d2f42c4c40a5af100fa55bbf438b549b5341c74c8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_other_name_test_subdomain_matching_other_name.assert_rv_status_code_": {"doc_hash": "9d99c717dcc1c8fba77d5136bce460d9fac34f73b61113364d146a76afd22917"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_multi_route_rules_test_run_defaults.assert_rv_result_r": {"doc_hash": "1266a5436fd8ec87ba67458746874d6b2d0f62c3a166cc780c4f9e14a9936731"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_server_port_test_run_server_port.assert_rv_result_f_": {"doc_hash": "8674f750351fe4cd8eca5202bdf5ceaa4dff938d309555586ffb6d41f055ef3d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_from_config_test_run_from_config.app_run_host_port_": {"doc_hash": "95c7c9506ff1b15165336f5682c9c14f40bff87bb943591b393724e5f227d1b5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_cookie_size_": {"doc_hash": "72d36cd58b56a69cb654f953d29ac04f9bd057ccc31a7f28280841165b9d1b70"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_specific_user_error_handling_test_blueprint_specific_user_error_handling.assert_client_get_funct": {"doc_hash": "065894a15399af750083bf14a256d2c909ad954b3e4d4ddef6a15f477318c4ef"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_app_error_handling_test_blueprint_app_error_handling.assert_client_get_nope_": {"doc_hash": "0482588268cf7bbd7c8895073a9f3e28eb9f7eb2199603299334a7e6f05d9a2d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_prefix_slash_test_blueprint_prefix_slash.assert_client_get_url_st": {"doc_hash": "9e48ae4dfdf937896a215613e4676190a2bcc781f7ba034dfe13e89ed576572d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_defaults_test_blueprint_url_defaults.assert_client_get_2_bar": {"doc_hash": "181bd551e4c3d893fd3d246fe78ae53dd794016f30727a4f1727f02f76c56098"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_processors_test_blueprint_url_processors.assert_client_get_de_ab": {"doc_hash": "d3c53646ba47209f7fd0d517436f5ee01d60c0821cc83f10f1b4d0052e966461"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_and_static_test_templates_and_static.with_flask_Flask___name__.assert_flask_render_templ": {"doc_hash": "bab1fdf37476929df2c78bf628ff826d8110041b00a53bf1f60d673a6028ba6f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_default_static_max_age_test_default_static_max_age.try_.finally_.app_config_SEND_FILE_MAX": {"doc_hash": "c0de5d719a2035f34e6ef4d7934efbd250fda2590de0b5d3f5e1250208ac333d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.None_4": {"doc_hash": "502e7b2e2027ac75b22b72fac796dc4583ddb29a7d8ce1cd4cb2784d566e4691"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_context_processing_test_context_processing.assert_b_43_in_answer_pa": {"doc_hash": "3a1b3e76fbe6a7bdc90a128705b287be6385bbeabe8d0e32b9203c415b724117"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_global_test_template_global.with_app_app_context_.assert_rv_42_": {"doc_hash": "ea75319bb00455626792e167afea390b34eeef47c57ce3dc5d5c33a984ed4e2b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_request_processing_test_request_processing.assert_evts_before_": {"doc_hash": "dd7b683c0c470a40d2d7284602de7a22b4590f9e2c0d8ac6167fed6fcf018ed0"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_request_processing_test_app_request_processing.None_4": {"doc_hash": "c99e02a852e9e52654883de6e74be7816e8842e981f6376a3825e81659118942"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_url_processors_test_app_url_processors.assert_client_get_de_ab": {"doc_hash": "864031a9af01cc2b6ba4ca3e8914de647bc9b0006483d335a9c2ddf52567bf10"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py__This_file_was_part_of_F_test_cli_name.assert_testapp_cli_name_": {"doc_hash": "89a3a4829a041259c8c9a2b49044c777ead7200c3db825828646dc777b2c4e0f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_find_best_app_test_find_best_app.pytest_raises_TypeError_": {"doc_hash": "e9e8f128202176451282be04c13c034dbe69d54f1829875849af2bb369ffb67b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_suppress_raise_test_get_version.assert_f_Werkzeug_werkze": {"doc_hash": "8b6a14f77ed4058f90cde1d5a41435af2f48eb725d2a96afb867a9ec7fba3955"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_scriptinfo_test_scriptinfo.None_9": {"doc_hash": "836784e40618cce567f01962a95f243ae44e74a4a72d07c541393a12c374e4e7"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes_TestRoutes.test_simple.self_expect_order_aaa_p": {"doc_hash": "894942514e8817106f15424af4d6f4cb069813ece4f7545eb6ee61df318f4261"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes.test_sort_TestRoutes.test_no_routes.assert_No_routes_were_re": {"doc_hash": "796ff92036a05a8786b0c9ede133d5e53a219c609ee04a945082541f129eef85"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_adhoc_test_run_cert_adhoc.None_1.run_command_make_context_": {"doc_hash": "dc38a4032603fa3bc0d0766f5991836b0c6ad925b027f44f5a37242d01d57b3d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_import_test_run_cert_no_ssl.with_pytest_raises_click_.run_command_make_context_": {"doc_hash": "14171f30ac61accac9b4b501c3a943b025c94bbdb4e48f3677b90b8470ad12d4"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_json_test_config_from_file.common_object_test_app_": {"doc_hash": "98a7b2b19183728c432503ea68b0bee1533e64ba5976ce0ae2a0c86e99fd1145"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_envvar_missing_test_config_from_envvar_missing.assert_not_app_config_fro": {"doc_hash": "0428c8d03acd672c2ed23e926d8426ab3e8c128bcc9b636102ac4642043fbf83"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_get_namespace_test_get_namespace.None_15": {"doc_hash": "ce4f728577d2fe0f9bdf05ef49555b2ae5d9360761b1551fa632d44c93928366"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_pyfile_weird_encoding_": {"doc_hash": "d5b674612fcf9a1baf4c8eaa83cf40054d8d9dbce0ef8206702aaf8e7d745db6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_converters.py_from_werkzeug_routing_imp_": {"doc_hash": "e90eeb1431e31b34211889fade6eabcfe60583630787daad7ca30e1b0ad5bd3b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_io_PyBytesIO.__getattr__.return.getattr_self__io_name_": {"doc_hash": "7816100517190029f0e885232d062b43d458732af14a43606738f0de2e91b2b6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestSendfile_TestSendfile.test_send_from_directory.rv_close_": {"doc_hash": "a80162113b7cc433a98cdedde24d28f5dc713aea582c5a476d4dbdae536f51f9"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor_TestUrlFor.test_url_for_with_alternating_schemes.None_2": {"doc_hash": "4e7286f0c0916ed6ebe8bdec87fbcf54a152b36f019f27919694257bfcd973c1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor.test_url_with_method_TestUrlFor.test_url_with_method.None_2": {"doc_hash": "7d031f90c3c24d01f22a44b3e5554988ebafb84430382df754e474192860fdba"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestNoImports_TestNoImports.test_name_with_import_error.try_.except_NotImplementedErro.AssertionError_Flask_imp": {"doc_hash": "f837df861c9bbaa5d40c6f1c7ab6489343e2e89314d130d2117a49cd0ec9fbf5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming_TestStreaming.test_streaming_with_context_as_decorator.assert_rv_data_b_Hello": {"doc_hash": "275980f4502e34cb801e42198227424df41d11ded39527424dc011ad786419e3"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming.test_streaming_with_context_and_custom_close_TestStreaming.test_stream_keeps_session.assert_rv_data_b_flask": {"doc_hash": "dfba64d4f7faa99d51de1298212df1af3bf762fb7709c2dce2b7a46c0a9ea53c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_package_paths_test_uninstalled_package_paths.assert_app_instance_path_": {"doc_hash": "edb090a070f4c8fd1b2954c6fa0c7c4c8f559837ce2776a653e831ead2d469c1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_installed_module_paths_test_installed_package_paths.assert_app_instance_path_": {"doc_hash": "2a61160b2657f30ee8bd1bcf815363ea85f16dc309b9c5e52065320feeb49544"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_prefix_package_paths_": {"doc_hash": "bed4ac61e3f9463d1c2184a4ccc52d4dc7dd976a53555e0115e6361d534d7e52"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_datetime_test_bad_request_debug_message.assert_contains_debug": {"doc_hash": "5536b282a807dc5e07d8735931ad23ebb1d32430051cd8c77b214462f7234898"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_bad_requests_test_json_dump_to_file.assert_rv_test_data": {"doc_hash": "202e86832cf8f808d6321d2407396aaaf0326c3784d80da5459c88e8287d4715"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_basic_types_test_jsonify_basic_types.assert_flask_json_loads_r": {"doc_hash": "cceacbfafa6b1c11fdc455dbe856982601854e1b561b553eadb7bbb9ed593e74"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_dicts_test_jsonify_dicts.for_url_in_kw_dict_.assert_flask_json_loads_r": {"doc_hash": "c2ffbb4ccecf92ab09853f0bb51213e512c8a93d883030d5151ffe1133156002"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_arrays_test_jsonify_arrays.for_url_in_args_unpack_.assert_flask_json_loads_r": {"doc_hash": "c04ba6edfd9d93c020c7d86127bc19cd2a7cb2b3d2b33bbcdf5d2d8ea5fc8e18"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_datetime_FixedOffset.dst.return.datetime_timedelta_": {"doc_hash": "01479283bc244c10b1f20efc9dbefe44dc3111324ec50f55eb7750488fe1c72e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_tojson_filter_test_tojson_filter.assert_rv_": {"doc_hash": "bb8b21dc585aa17e4540ca6f9ca59bace8a2742db04574125489d25d14553afa"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_customization_test_json_customization.assert_rv_data_b_42_": {"doc_hash": "72eb74ab6d31a8cb6981b717e37262121549fe5afadbfa40ec4853e638094fe0"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py__has_encoding_test_modified_url_encoding.assert_rv_get_data_as_tex": {"doc_hash": "382e80b313489f8be606eed908ce2e5409298f589f4a4585ff62e8a0fdde6fd8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_key_sorting_": {"doc_hash": "e63268ab530759e44f3962bf4fae3d049db221b2970396bac1aac20afef6329c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_from_datetime_import_date_test_dump_load_unchanged.assert_s_loads_s_dumps_da": {"doc_hash": "45833d8b0cfa407e9229e71309be44a5f0aef206a540d30839ce1149d14b6661"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_duplicate_tag_test_custom_tag.assert_s_loads_s_dumps_Fo": {"doc_hash": "4da620bc5f204ae545eca0dcbefe35e83d51a5de6161bdb92e5f5bce46415f3b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_tag_interface_": {"doc_hash": "e1be7bd39d3074fb592bee8515556917b92e76e59cb86bbf31f9970c02d9cc12"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_logging_reset_logging.if_logging_plugin_.pytestconfig_pluginmanage": {"doc_hash": "52a73a851e0b5b1f3268413ce9d345dcd64888b5f705ff4cd3cc8af1c7004f61"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_test_logger_": {"doc_hash": "b385e9223a0ac0070c6668cefe6cbc9b69aec6f5b29ed7c1e19669ae02e1397f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_regression.py_flask_": {"doc_hash": "14116bceb8c06de166532933bf371df8a923dfa70e05e2662c5ec92d0045f66a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_proper_test_request_context_test_proper_test_request_context.None_4.pass": {"doc_hash": "ab45882df4989231694c5b1d7a685c76d11ec384460a83ddc21331ab0cc45e91"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_context_binding_test_manual_context_binding.with_pytest_raises_Runtim.index_": {"doc_hash": "526a1401b51bc0a2b551e4f7e81f4b161e6b2242ede034f4f1811bc81b9a4e90"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying_TestGreenletContextCopying.test_greenlet_context_copying.assert_result_42": {"doc_hash": "10c6da4d19ed1cc4eadaf0a7d5ecc1752ea1ee8d84255d8428e7a83df6b81583"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying.test_greenlet_context_copying_api_test_session_error_pops_context.assert_not_flask_current_": {"doc_hash": "f14e216e406aa491664b86911e6a86388fa1e82fd25d8b11b6af77fd576e25b2"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_session_dynamic_cookie_name_test_session_dynamic_cookie_name.None_3": {"doc_hash": "3495b8e1754b7804313a4a64ecafee0a18827d21cb2e547196366af9e30cfd4a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_bad_environ_raises_bad_request_": {"doc_hash": "5b94d1bc4862172895a11272e13aca9cad5a4a3c50854c1f73044afec7f6c779"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_session_interface.py_flask_": {"doc_hash": "afae7a192e645d7571ae6339a178a4af6679f70e50e09d4f9eb4ee103708099b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_pytest_test_template_rendered.try_.finally_.flask_template_rendered_d": {"doc_hash": "2fe98d66e045ade9b7ae7a0fb33a0e4b1c4fd2daf0f88db3c52ca53916f1cc52"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_before_render_template_test_before_render_template.try_.finally_.flask_before_render_templ": {"doc_hash": "6d04f8774eefcc8fa266fced4a5b058be80c948b091dfa1645acd43c90bc09bf"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_signals_test_request_signals.try_.finally_.flask_request_finished_di": {"doc_hash": "b2c8b190f0870947821bdd8de3ed2392d7f07ce7d33018afdf43f0c5cf0d431b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_exception_signal_test_appcontext_signals.try_.finally_.flask_appcontext_popped_d": {"doc_hash": "32b6395bd75b0bb489aad2601488efa9da976dc677a40a56796d82a0d334097f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_flash_signal_test_flash_signal.try_.finally_.flask_message_flashed_dis": {"doc_hash": "ff19cb835641de920fd2a5a411598c3ebd34d771ea93a16b7301239b31e322cf"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_appcontext_tearing_down_signal_": {"doc_hash": "23a249be8adb689a5c194385f5bc57e6d1cfef6552b7caad9fb02b6d54b309f2"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_subclassing.py__": {"doc_hash": "c8581554879b6fa2141af2594d18d4af7b71b90a20a97ddbb74b30c8ded43378"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_logging_test_standard_context.assert_rv_data_split_": {"doc_hash": "e0d43ebce6920e75a07b9f870000d18e2b3a11a70c4b2e1e4fe616cae68077ac"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_test_escaping.assert_lines_": {"doc_hash": "88c6b1681e312326c09faeac83187161642a1b3587ec684c7ed4df4b84e97ed5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_no_escaping_test_no_escaping.assert_lines_": {"doc_hash": "08b6522f3fbf840906b6824d9e69c19d1ef8d1f064c4926a9f83d460cedb3f5a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_without_template_filename_test_add_template_test.None_2": {"doc_hash": "fa44bdc1a86f015d44ac8a11c67111a0fb9ef6003cb8aa975559a391aacf23e1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_test_with_name_test_custom_template_loader.assert_rv_data_b_Hello": {"doc_hash": "bdaba63518f669c9ae9585e4f3f87d8707285bc74271fe7d378bdc783a44bd39"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_iterable_loader_test_iterable_loader.assert_rv_data_b_h1_J": {"doc_hash": "0d8cc2abb1008b2eec15298b285c9406e93583eb23297b606617dc4306b26df0"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_templates_auto_reload_test_templates_auto_reload_debug_run.assert_app_jinja_env_auto": {"doc_hash": "c11ad7b2a95ebdfc12d064ac98d4bdb8af72f364dd0c326c99ddc1c07042f88d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_loader_debugging_": {"doc_hash": "eb926d8c61c33c022e7bad2cda1fd9e4371d295e4e81fdeefcee7ed39c9ba28b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_click_test_environ_base_default.assert_flask_g_user_agent": {"doc_hash": "2933afb58940422b4de29fedb1d9899cd4e78a815984cd46ab1558fdff1a9621"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_environ_base_modified_test_environ_base_modified.None_7": {"doc_hash": "f9af01f588e291ac506fce24ba6ecf999839860a48a899abadacfce0919dbe68"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_open_environ_test_client_open_environ.None_2": {"doc_hash": "05cd75060f864f4e4f25d0583bc5e9672156398257bb89d9f8bfea0896f09f80"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_specify_url_scheme_test_environbuilder_json_dumps.assert_eb_input_stream_re": {"doc_hash": "ece94e515263d2c368b7dc1383d2e1772c943de685e090efe054b2597fbf4f46"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_blueprint_with_subdomain_test_blueprint_with_subdomain.assert_rv_data_b_http_": {"doc_hash": "d3fa742a70b51332bbaca25e004003b86b22ba5d8b5abed37928650eface1bdb"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_redirect_keep_session_test_redirect_keep_session.with_client_.None_5": {"doc_hash": "bab95137199044fe0a00ac66121f42bad501ae7be18a9d309346977d4d54fdc6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_session_transactions_test_session_transaction_needs_cookies.assert_cookies_in_str_e": {"doc_hash": "62815ee616b7bf6b0543cb30c1c4c913b95f56689ee6b013e84c2e459e0192cd"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_test_client_context_binding_test_test_client_context_binding.try_.else_.raise_AssertionError_som": {"doc_hash": "6b5feb3b7e41908263a2a2577767523dda1d718bdeba12fb37231662d12eb014"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_reuse_client_test_full_url_request.with_client_.assert_vodka_in_flask_r": {"doc_hash": "cfe542ec794ffd62748bdc58d492dbd2c14e19283f37c6ecd3a2876bb54025d3"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_json_request_and_response_test_json_request_and_response.with_client_.assert_rv_get_json_j": {"doc_hash": "9043bde5c1e41ddb0b686ccffa6355140d2bb2f49a491bbf381379a7593cba27"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_json_no_app_context_test_client_json_no_app_context.assert_ns_count_1": {"doc_hash": "b260013d99632fb15f3345fa9b7c8b1a34012b0a5152a26b63d092d05dbb076e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_pytest_test_error_handler_no_match.assert_client_get_abort": {"doc_hash": "0c6e6d2b684894a5c804257b567a1663238fd3ac7a01a50191d6e984b5e9c189"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_subclass_test_error_handler_subclass.assert_c_get_child_regi": {"doc_hash": "12c1085d9373fce8de3ee39ea20e442db25f46b18c674cabe682eb3a730c273d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_http_subclass_test_error_handler_http_subclass.None_2": {"doc_hash": "a5513a9530afdeb114d9ee21c735570f7b3ef42a67dd481a73584cdce87722b8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_blueprint_test_error_handler_blueprint.assert_c_get_bp_error_": {"doc_hash": "f2132409fc17bb1fd0f3e4d7f35221426ce02d00ab8edb392a446788b52aed3a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_default_error_handler_test_default_error_handler.assert_c_get_slash_fo": {"doc_hash": "f55c3a45803192606c19e99b3aacb7acb0b08390d31817dc512fa5f591acc467"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers_TestGenericHandlers.report_error.return.f_direct_type_e___name_": {"doc_hash": "521fe15f9a5914441d462f3014a59e8f751bada60164e7ce79a5f84878c5d5d4"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_class_or_code_TestGenericHandlers.test_handle_class_or_code.assert_client_get_raise": {"doc_hash": "a39d6d34449b81b681815f619d62d55f875a04c8849bd356e82d7cee406383bf"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_generic_http_": {"doc_hash": "dc43c3cd5c37b77b06daa589f8423446ae48492bc1f7638a62ab6adda2f6889b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_pytest_test_view_inheritance.assert_sorted_meths_": {"doc_hash": "9d3e5f2b1a9e122740c8b76b71b0343e29d8f7b80e6e3fd8a4ef5f15e467447e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_decorators_test_view_decorators.assert_rv_data_b_Aweso": {"doc_hash": "640bd98aec8da7dcb0f617273cbcbbf386df3b4635e743cc7047358546c15c6b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_provide_automatic_options_attr_test_view_provide_automatic_options_attr.assert_OPTIONS_in_rv_al": {"doc_hash": "48970da340d52be63f5e6b4c177d93d46d867e6b5ce4f4798f787fa60d43e4c8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_implicit_head_test_implicit_head.None_3": {"doc_hash": "fee3b159a0c607628379ee418231a90e9b61b1b8a5c8154c22758a8ed1059877"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_explicit_head_test_endpoint_override.common_test_app_": {"doc_hash": "f84d3076d027df56c7e182fe552e4d808d5f44ceb5a6610b99d8f433f0d6becf"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_methods_var_inheritance_test_methods_var_inheritance.assert_ChildView_methods_": {"doc_hash": "3babfbe9ec527b4ffdf50b78368f7162153d089ad28f30efcbd750363e4874b0"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_multiple_inheritance_test_multiple_inheritance.assert_sorted_GetDeleteVi": {"doc_hash": "87b25bd67770e6e0fd340db9134c2eeb085b03e05fc2795b2eff4aeedf16c39f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_remove_method_from_parent_": {"doc_hash": "1c09ff7d55339ede6a02570d8573292b82d72bdd5618f3db5be825519b2aa63a"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/make_celery.py__": {"doc_hash": "b8a0131f85bc7d2cb7598bc9eea34a58a8b649cb55418414d32658247bf546a2"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/__init__.py_from_celery_import_Celery_": {"doc_hash": "85b38b67565cb9a776ed95b178660ed3e5376be6e253b17cd631f9474e56ec7e"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/tasks.py_time_": {"doc_hash": "80f25403258e0bf49f3cf7279a28b79a4da1668bc290f05abfe11096acde2d3d"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/views.py_from_celery_result_import_": {"doc_hash": "51bfe442264e24002d344699e75709db6eb912a98e92899f06a76c482b06afbe"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_pytest_test_register.with_app_app_context_.assert_": {"doc_hash": "b56cb3ecb9dc2d54c15eb5a631281d0d0c32e918b4121e311ba682e9f7546456"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_test_register_validate_input_": {"doc_hash": "e5bbe652e89daea2a0389315b20be48ab44c0c43646c255f5be31a3862dc711f"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py_from_import_json_as_jso___version__._2_3_0_dev_": {"doc_hash": "6ebf7d40caf25a99b8f3552839cdf1399a3bbee9327b7f328cd4379118e53d1c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py___getattr___": {"doc_hash": "b1b700669c23ff56f1cb25cef705cb958cba477e22fdcdea378170ba74ec2caa"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._The_class_that_is_used_Flask.json_provider_class.DefaultJSONProvider": {"doc_hash": "950aa7637e34a45a45a27628e586482927ccfa4ad8097a093479684cfbc2ef87"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._A_subclass_of_class__Flask.session_interface.SecureCookieSessionInterf": {"doc_hash": "e50c4c69ce170b61df0a5f9de84c83fa461563d0e66ac5c784d089d117d8cc80"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._check_setup_finished_Flask._check_setup_finished.if_self__got_first_reques.raise_AssertionError_": {"doc_hash": "d6f4abd1e140bbe1e8da0bc71042e2dd83364b306f029efc2b0aea060a9ccdff"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.name_Flask.name.return.self_import_name": {"doc_hash": "de4d93222945ea3ba2f0abcf1db91b44d37014aa4b8f87a3be7f2fde77349641"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_aborter_Flask.make_aborter.return.self_aborter_class_": {"doc_hash": "a23ea2ebf726ed72449419e30abf30507edfdea6eef2c7593d0e56859610364c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_global_jinja_loader_Flask.create_global_jinja_loader.return.DispatchingJinjaLoader_se": {"doc_hash": "a0e50248e783dd66506606faf7500ca8b3b4c16ded6feea8679ce9c9a5b1d5e7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.select_jinja_autoescape_Flask.select_jinja_autoescape.return.filename_endswith_html": {"doc_hash": "27a0cc35af540df4f74fd9753e94ea4e8222c30549461c7244fcfcaf47f704ef"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_shell_context_Flask.debug_15.if_self_config_TEMPLATES.self.jinja_env.auto_reload.value": {"doc_hash": "bc386c1ec97d77aaf698d13cc0d57ec4e4c519f986a34e99204e602643b9749b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run_Flask.run._the_flask_run_command": {"doc_hash": "0f81d84950fdead11ded90db4e02e4197dfa580150ae908914a52923e780e35c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run.if_os_environ_get_FLASK__Flask.run.try_.finally_.self._got_first_request.False": {"doc_hash": "069fb3e78e1cd503a32d653e528cd20d7b30556924787fcea04f66c482787bf6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_global_Flask.add_template_global.self_jinja_env_globals_na": {"doc_hash": "e4c9e83405e443261c64056fcfec7aa0cab6c1283d433cb9cb91c0931af05973"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_default_options_response_Flask.ensure_sync.return.func": {"doc_hash": "97bb52d56757333ac187a94d864e9b73f3c666c967154e694170c1f08b91fe16"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for_Flask.url_for.req_ctx._cv_request_get_None_": {"doc_hash": "0195f314aa3aa9ebfa0fd531900e42e676e523080adef9f9c149852ae0892b0b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for.if_req_ctx_is_not_None__Flask.url_for.return.rv": {"doc_hash": "5c4b2aef42d0c502b9d3300d424987279a283685b320944cfb0f30167c7cbae4"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.redirect_Flask.redirect.return._wz_redirect_location_co": {"doc_hash": "5396acf1ffe553946240560492cb9d4be2e87b99b2d4e1446b9b73f766b853f4"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.inject_url_defaults_Flask.inject_url_defaults.for_name_in_names_.if_name_in_self_url_defau.for_func_in_self_url_defa.func_endpoint_values_": {"doc_hash": "98bf69f7e301606f62dfc78646a317cbf6b0d0949c0420875b0899be94eb5825"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.wsgi_app_": {"doc_hash": "1464d1078899e8b5523fe8ed8e85caf586c07e61e2dccca947504f6dc1b01847"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_os_T_url_value_preprocessor.t_TypeVar_": {"doc_hash": "e0c6600db2b92f816141bc6b51947ef573e40845782f7184ecc347e1df4b39da"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint_Blueprint._got_registered_once.False": {"doc_hash": "59d846f6faaa76eb64332c368fa335ccfc46c0559fc1e9c6f9a10cafb935ed0c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.__init___Blueprint.__init__.self._blueprints._": {"doc_hash": "9ea3e2c1d18c1d82e0162740b03b001ad4e607a4539321c3752795b1605f913d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint._check_setup_finished_Blueprint._check_setup_finished.if_self__got_registered_o.raise_AssertionError_": {"doc_hash": "85bafb1917da7ac1efb0b2e72b8ed0730224a17b4c7df0853f9d58a17a73d3bb"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.record_Blueprint.make_setup_state.return.BlueprintSetupState_self_": {"doc_hash": "10ba35195aa8e00d483b629fdbe1ad885e2f34e138a726e45de1250382688304"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_blueprint_Blueprint.register_blueprint.self__blueprints_append_": {"doc_hash": "9a666f3469ed1bb43d9bb94b6bee5aefcebf2849cf3003cd9fc753879ea6b59a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_Blueprint.register.cli_resolved_group.options_get_cli_group_": {"doc_hash": "68a315935b60fc5604341f9aeaa94d9b6333612f415e5d155973f94131f427a7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register.if_self_cli_commands__Blueprint.register.for_blueprint_bp_options.blueprint_register_app_b": {"doc_hash": "a6a56cb2fe9e71aecc2c89cddb4d3730e3e21372839446d1cc0d884abfa439e8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_url_rule_Blueprint.add_url_rule.self_record_": {"doc_hash": "f9e9a3783ce0ab317fe7512476e1f6d44600351d16bcd4126812b119e1f5a45b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.before_app_request_Blueprint.app_context_processor.return.f": {"doc_hash": "5cd86f816adef155a6999f479ba3aadd07900e2f99337c17b921a98739d73430"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_errorhandler_Blueprint.app_errorhandler.return.decorator": {"doc_hash": "a4c0a63771c52153695fe5e1e99bdbf47f1876a41c115d0196fc322bc5a5bfa5"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_url_value_preprocessor_": {"doc_hash": "9ef92696cfbc307faab89db3632a6e085815ef275972edcdfc50dd366c3cf9c0"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_from___future___import_an_NoAppException._Raised_if_an_applicati": {"doc_hash": "e364a8bfb140cde709e35dfda943f46bc5822c0344e3eee6fc0c8db78b9e56e6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_locate_app_locate_app.if_app_name_is_None_.else_.return.find_app_by_string_module": {"doc_hash": "814f9b6a087e958cfacb56b007e9e81f8ebfd7cdf36a2ee79485824988f1bab6"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_app__app_option.click_Option_": {"doc_hash": "50aa7083b980c2f84835a2576e065a376e0c9a2fd9a77ff1e17b616f8e256edc"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_debug__set_debug.return.value": {"doc_hash": "c3335aeb3ea7e59411a8ae6b58ed84c14dc30da18ae950c3612d8f83e8594869"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__debug_option__env_file_option.click_Option_": {"doc_hash": "d114391b2dc2e6a0adf55a6b9d770fd5019359bce08ceb6744fc9f4f7cad6966"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup_FlaskGroup.__init__.self._loaded_plugin_commands.False": {"doc_hash": "320ebcb9095712ba85435def05fed487425190fc21ef15e376a8217b7ae2cd63"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup._load_plugin_commands_FlaskGroup._load_plugin_commands.self._loaded_plugin_commands.True": {"doc_hash": "a1eba0f09242379c65fced2ee382cff310e58b5c3e900b9b2c7cbe2cf689937b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.get_command_FlaskGroup.get_command.return.app_cli_get_command_ctx_": {"doc_hash": "ec2b033260cfcef6de92076d2733bb0897bc0ac6a4883e6fdd8cc70b28481499"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.make_context__path_is_ancestor.return.os_path_join_path_other_": {"doc_hash": "b13cc72ef5eeb70588324ae76312ab6865f726a5c4c481fa9214f90f93441667"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_load_dotenv_load_dotenv._True_if_at_least_one_fi": {"doc_hash": "cda9eb6fc5a70def7cb5315b6922136db9481dacbee11f77db04d1d584ec64cc"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_show_server_banner_CertParamType.convert.None_1.except_click_BadParameter.raise": {"doc_hash": "632a0d209c69e34006b483d434f0106e06ca5f4aa78252f9cd38bac93fc78724"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_params_insert_shell_command.code_interact_banner_bann": {"doc_hash": "abd5471f9cc9199c01ced9e9c7e5568238de4ee1a3abccae15d9abe72f46cc47"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_routes_command_": {"doc_hash": "5b58379f0419118980b732bb8ed3cd8dba625c5e73e5fbe053290bd797800a64"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_prefixed_env_Config.from_prefixed_env.return.True": {"doc_hash": "abd25a4bbc43eb47cad55eca75e5c18a89a46472ac5468b64f5e5a256f399c6e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_contextvars__sentinel.object_": {"doc_hash": "08c32c829d771357046f492fbec6827021b0119683948980617fca537338ce61"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals__AppCtxGlobals.get.return.self___dict___get_name_d": {"doc_hash": "ef7ec226dde89ddc18452476788a0a775a6b783aba9848663bb0a745ce3dc5bb"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_request_context_has_request_context.return._cv_request_get_None_is_": {"doc_hash": "40324d71d2aa0a59cedc8865d9261ea70d665e43feb40ceacb0965c6c0f5e95b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext_RequestContext.__init__.self._cv_tokens._": {"doc_hash": "e72b9dec55759bdfbc5146b1d981f72d9cddfc2bde3ebb36862b7816e1f47ab9"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.push_RequestContext.push.if_self_url_adapter_is_no.self_match_request_": {"doc_hash": "13c02ef7a0513d96a467149fbe20c73744a7dd7a50d2cbe969bb9f829b456356"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.pop_RequestContext.pop.try_.finally_.if_ctx_is_not_self_.raise_AssertionError_": {"doc_hash": "4bc8306c845a153efdbb2554dbf268f010372af01e770298a52c12447b7c1722"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.__enter___": {"doc_hash": "d9a10ed0c59d2d655c5d19a8a9a7a9b40b71b4adfa336b137ee158bf12a56aa7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_t_DebugFilesKeyError.__str__.return.self_msg": {"doc_hash": "d7cd99ac9dc3a716d108bc4d07b4a30df17f5cee82270433a5e3c97ea598cb12"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_FormDataRoutingRedirect_FormDataRoutingRedirect.__init__.super___init___join_": {"doc_hash": "4e90391e942938b09aa99b0f3adcbdf9616643467a94b5635e723e5b5a783420"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py_t__FakeStack.top.return.self_cv_get_None_": {"doc_hash": "ab6b820cc3700e6cecdabc8010f138f9074fbec3c519188712d77c11a811b647"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py__no_app_msg_session.LocalProxy_type_igno": {"doc_hash": "c7ab835f9fec630feb931d250eeaa919e7ee1877edbd7c78b7d51fd237263687"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py___getattr___": {"doc_hash": "d02be6741b0a2147d7a6d1a32a103dd8d8271dc3b37e664f7aed71f930bd5773"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_os_get_debug_flag.return.bool_val_and_val_lower_": {"doc_hash": "995fc5774e813f79201ad65a5c5c47e1fe6c2a64a171004591ac08bccfb8969b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_make_response_make_response._type_ignore": {"doc_hash": "8490121bd3f4e129ecf44f1109bba7652de8d2ce9317a1fcd7623f25db2a2ebe"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_url_for_url_for.return.current_app_url_for_": {"doc_hash": "c7766f802cba18eb84201daa94f9bf4c1e769aa4925ba25bf6bb140666d46e54"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_redirect_redirect.return._wz_redirect_location_co": {"doc_hash": "83ea43eb3e86a792edd5a3666e6c05f4384beda5334b4cde47bf8443422a264b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_abort_abort._wz_abort_code_args_": {"doc_hash": "ae529b639502dffedd44417b94ed7212914c0bcbd0e4b38404e9f74f9cf41057"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_flashed_messages__prepare_send_file_kwargs.return.kwargs": {"doc_hash": "8c815eebd2d8a8ae14c70970c146db9679816dd1495131071c6e123c5367fae3"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_is_ip_": {"doc_hash": "f63fab81779021c4cf4a0f77d8afd2783a106cb1f4c0eb5a5fb3a393e0e4ccce"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_from___future___import_an_dumps.return._json_dumps_obj_kwargs": {"doc_hash": "5894360d39cc8b1d35327c74676d89a42862804305f84d7d94bdf31883d4d75c"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_dump_dump.if_current_app_.else_._json_dump_obj_fp_kwa": {"doc_hash": "082ad3d0da36d86f540db41105c5d68e8a78f1beaafbe879e55a6222d6033ded"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_from___future___import_an_JSONProvider._prepare_response_obj.return.args_or_kwargs": {"doc_hash": "af88734103465eb97ac602a29f3115e3418ff8ca5a1f917e5f22eaabda685950"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_JSONProvider.response__default.raise_TypeError_f_Object_": {"doc_hash": "995fd92762c9bcc79563cdc36ba5cebb48d1148afe3a6e596408767a19018a14"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider_DefaultJSONProvider._The_mimetype_set_in_m": {"doc_hash": "f124cc8c3614c532faee55720f73f7fbbd46cdb314089b4826c63abe3d765953"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.dumps_DefaultJSONProvider.loads.return.json_loads_s_kwargs_": {"doc_hash": "50d87e48eecedc8094767a41cfb91888d8966d205bbfc7ddca992318ec4f02f5"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.response_": {"doc_hash": "c537c8ecde9939a344b9f40ab075e1ca5f45760305349c713f65510bb9177a97"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_importlib.util_setupmethod.return.t_cast_F_update_wrapper_": {"doc_hash": "f4e1dd8d18098e8cec043362e861b355ff4ecc940d00b5ba029663bc6dc14dd8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold_Scaffold._static_url_path.None": {"doc_hash": "fccfd5f45853e4a3bbeb9d3e87392657d79d8df6474f6840982fcbca0db6f644"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.get_send_file_max_age_Scaffold.get_send_file_max_age.return.value": {"doc_hash": "a820fff1ba8fd19cfad3d3ad1cb348549581c2ef02414f68f08f1874f5953441"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.context_processor_Scaffold.context_processor.return.f": {"doc_hash": "5203225b69062fe6428c634f789a5a9323f610e5ea1a686c6b23f885bf8b763a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_value_preprocessor_Scaffold.url_value_preprocessor.return.f": {"doc_hash": "d359e17dc488f1c86449b750da9f28a4b3268911d2f1f6059fe0b203b72daa97"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_defaults_Scaffold.url_defaults.return.f": {"doc_hash": "a1b761c6f3790e0cbf04c69fdd92e90f6e380bcd1445821259f6f4e00524af8d"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__endpoint_from_view_func__path_is_relative_to.try_.except_ValueError_.return.False": {"doc_hash": "10307b6fee9cb3571df219a344d825d2499c1c2701e64913aea1121b67fdf6be"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.is_null_session_SessionInterface.get_cookie_name.return.app_config_SESSION_COOKI": {"doc_hash": "51bcd1dff1540396f4829145e6f2852a438c63bf4570ba555a3886cedf336dab"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_t_if_t_TYPE_CHECKING_pr.Scaffold": {"doc_hash": "5037a1535a64c7b24af00c0a0f95eeefb0f44ca8e646678a74157fcf9e4214b7"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__default_template_ctx_processor__default_template_ctx_processor.return.rv": {"doc_hash": "b8df19c2f148eca12b452f3569a1a07e3837febd29e1eb8601b651099cd24561"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__render_render_template.return._render_app_template_co": {"doc_hash": "a4c32c813a0cb15fea33b597d25a4255c3082d35ab8ce5d474a2a1994fe90e27"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_render_template_string__stream.return.rv": {"doc_hash": "a7619201ce3e8c991d7e321725547d42d65248a82e72758de153c2383652238e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_stream_template.return._stream_app_template_co": {"doc_hash": "509ffd40e64231cd273c4426616e3ca73ee496acd3f8e3e5d067e0f50e47477b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_string_": {"doc_hash": "2119e1c0b0772d50405095c0d84fd6bcaa423e7d4d51159693f2e484c38cb64e"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_t_if_t_TYPE_CHECKING_pr.Flask": {"doc_hash": "25940fe30c3f336cfdafb4e53b54f5df82153a7d4d6b3e0a84de1e5c287500e9"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_EnvironBuilder_EnvironBuilder.json_dumps.return.self_app_json_dumps_obj_": {"doc_hash": "b8a110efb8f6fa548e40df29d542056d352fd0f8d5f0847684ae59435b96033a"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient._copy_environ_FlaskClient._request_from_builder_args.try_.finally_.builder_close_": {"doc_hash": "a0c0cf8912fe5eb31fd676900036e7f940b327e112a3ed86e037cb37c0b1a4a5"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.open_FlaskClient.__exit__.self__context_stack_close": {"doc_hash": "ce85f82e81cf76c6027e80d5152adacb93ff57985b7ebaeb53e14c1acfac2bd8"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_t_Request.endpoint.return.None": {"doc_hash": "f16e60c37a298854e029243ed051a2d349f5c7e1a591a6f9b281a9fc27a4fc1b"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprint_Request.blueprint.return.None": {"doc_hash": "018630e15ba968cd09fd65e821aa44678cde8db474c7ff860e6cd7072c339aea"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprints_Request.on_json_loading_failed.try_.except_BadRequest_as_e_.raise_BadRequest_from_e": {"doc_hash": "b944907dd2f2f1749367ed1e15dc71e1ded96c35cfb561b9e1aa09b488b8bc98"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_asyncio_AsyncMethodView.post.return._POST_": {"doc_hash": "5976867346c673dd6f409e118fcb4d62764b25cc7a6df2ab27521df6441cb5ba"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py__async_app__async_app.return.app": {"doc_hash": "2e09ad28c8cf30c9ca68bf1ee0ec5d7b7cef67afd15c5c468b07c7140b8feb40"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_dispatching_test_disallow_string_for_allowed_methods.with_pytest_raises_TypeEr.app_add_url_rule_met": {"doc_hash": "ca929e3af065215691ed136850717dc5dde4c2c185d8d7f1fc82e95da1685c54"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_processing_test_user_error_handling.assert_client_get_da": {"doc_hash": "20c13675bc0443f08e3f8d7105022dcb46849b44ff49d82843a9e95011c13a70"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trap_bad_request_key_error_test_trap_bad_request_key_error.if_expect_abort_.else_.with_pytest_raises_BadReq.client_get_abort_": {"doc_hash": "eddadb5ff370c1b240713e934da894c3e2035918c8cff223d7d8464eb98f3fb5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trapping_of_all_http_exceptions_test_enctype_debug_helper.assert_This_was_submitte": {"doc_hash": "edace15c2408ebed3ae012da32b8744ab51e468b422a96398df49af6c2c7aaf6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_types_test_response_types.None_25": {"doc_hash": "57b16d806b01e0fa94678119dc9b17df0fad3889fb5124d4e45a646e88060151"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_type_errors_test_response_type_errors.None_4.c_get_bad_wsgi_": {"doc_hash": "090ac8e7597b8bea4e269d3b1f036c42264ab049a0c3689eb1bffcb9f760f832"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_test_make_response.None_11": {"doc_hash": "8293ed33edc6697f1960c7e91f028a82f292b99de9fea59d78012aee82b769cb"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_jsonify_no_prettyprint_test_url_generation.assert_": {"doc_hash": "915d4153c1d47325f0a32de01d6167a36590eb7df08d41159ec87cc700698fe5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_exception_propagation_test_werkzeug_passthrough_errors.app_run_debug_debug_use_": {"doc_hash": "facf09d7607fffa82037de8686bd532b25daafa636883591a559e0041a9abfa5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_nonascii_pathinfo_test_no_setup_after_first_request.assert_setup_method_add": {"doc_hash": "064c646c0a8485c619401cee9024b683f3b354acb5dac2b6697b60525b162bf8"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_routing_redirect_debugging_test_routing_redirect_debugging.assert_canonical_URL_ht": {"doc_hash": "1147feec1d3f6696e7de414a3734d7001c286ea49eb05d529e20e29b0611ec3c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_pytest_test_blueprint_specific_error_handling.assert_client_get_what_": {"doc_hash": "fac6e2641b89f052f3590f1b5277c3534b2767b244fc6c722c3a063005e41187"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_list_test_empty_url_defaults.assert_client_get_page_": {"doc_hash": "5ce81514d72cbbd3632cf541c58d2a385e04f15c47d5946e64c018ec2182676a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_with_dots_test_template_filter_after_route_with_template.assert_rv_data_b_dcba_": {"doc_hash": "44e2110b20ff75dfa94407ac624dc3c7b24ac1abb900b630ae5c761c590ff00b"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_add_template_filter_with_template_test_template_test_with_template.assert_b_Success_in_rv_": {"doc_hash": "33e309db3f2515f73de275a86754656bdcca1fb74a708a61fbbe6a7c08edb341"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_test_after_route_with_template_test_add_template_test_with_name_and_template.assert_b_Success_in_rv_": {"doc_hash": "5e10ef79204ca5c05bcdc725824eba6c97f01dfd6e54c45af1ea3a069245d57f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_blueprint_test_nested_blueprint.None_5": {"doc_hash": "4f68b795f7f8631eac99ff0b3f4f6901a39b6be470c44bb186e35b92cfbc3805"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_callback_order_test_nested_callback_order.assert_client_get_b_d": {"doc_hash": "0992ccf22e5c5118c12b4f8070bcae42b96717f7c14b5f119a01faab569515b2"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_url_prefixes_test_nesting_url_prefixes.assert_response_status_co": {"doc_hash": "5547e6a57360286434c2eab844b48ebba58aaa1a33db2bd6885207a289d9a900"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_subdomains_test_nesting_subdomains.assert_response_status_co": {"doc_hash": "3ba9448b71d1b16ceca0f3ef4e10cf7a1b60738d639050047b89dbdeb7e210a3"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_child_and_parent_subdomain_test_child_and_parent_subdomain.None_2": {"doc_hash": "e418250a21a3d4901650e86d70b227927352d60791bb1086980051a465319e30"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_unique_blueprint_names_test_self_registration.with_pytest_raises_ValueE.bp_register_blueprint_bp_": {"doc_hash": "8867f9d153aade193afced6209e21e2bd187b36152d4fd2d28108dcb7757b0f1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_renaming_": {"doc_hash": "c51ef9415dbad58b5af64ef045ee03b34abcec315e8aae9294490761521d1d06"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_prepare_import_test_prepare_import.assert_sys_path_0_str": {"doc_hash": "c4231cce320f5320f287a949b2f40d4a203161838e2107fd03c45c00a0858489"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_test_locate_app.assert_locate_app_iname_": {"doc_hash": "e2271c6a163727ae278185973660a2ae1414e2d0664751744b72e75a06f77f65"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_raises_test_locate_app_raises.with_pytest_raises_NoAppE.locate_app_iname_aname_": {"doc_hash": "68e6ddec60fc266dcedd764b64932e94217b07347399742290a23c2fae89a1f7"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_app_cli_has_app_context_test_with_appcontext.assert_result_output_": {"doc_hash": "6f3d1a43ac614c979efd7c0b60d6664541175ab406bbea6f083a7156a119bd36"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_appgroup_app_context_test_appgroup_app_context.None_3": {"doc_hash": "22f59e1f62f86e30a1ec9b3cc914e890565aa9ca518b4dcc1127e5c4404ce212"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_app_context_test_flaskgroup_debug.assert_result_output_f": {"doc_hash": "44534fc80194fe088dd0366851d63a9a329a02f126f4205c4c606c9e0eb7e130"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_nested_test_help_echo_exception.assert_Usage_in_result": {"doc_hash": "ff008f79beeb203827761d84d2a7d8f6e5dce3a959b1865ea618c6dde02ab5a9"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_dotenv_not_available_test_load_dotenv.assert_not_load_dotenv_n": {"doc_hash": "47948e06eeb5c7cba1cc6cda53bed89002e84195bb0468b16cee7fc99d88bd13"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_dotenv_path_test_disable_dotenv_from_env.assert_FOO_not_in_os_en": {"doc_hash": "0695548c834c367709a44aa6293cdec23757259daa73847976f33225526a5cf4"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_path_test_run_cert_path.None_1": {"doc_hash": "af91106d94c92059795730adba48437cade89aa4146cf367bbd5fbb1b3776f55"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_cli_blueprints_": {"doc_hash": "8ec6ee94e9da4bb076f23a775b215d4ec9a80d7353d91dfafb9d59240892a4b5"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_test_from_prefixed_env_custom_prefix.assert_app_config_A_": {"doc_hash": "5b920b23e31a8ffdba9f792f9b833f095f96e27b9c3b5779485adb8ac73abf4c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_nested_test_from_prefixed_env_nested.assert_app_config_NEW_": {"doc_hash": "14d13c7c79f383a5c5559960568786ed8862062be91a5fab35f54b5198ca8e6f"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_mapping_test_config_from_mapping.with_pytest_raises_TypeEr.app_config_from_mapping_": {"doc_hash": "438eb0e712a9cd86ec3048678be16dca68da3325391a77df53d9a7725dc07395"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_class_test_config_from_envvar.common_object_test_app_": {"doc_hash": "18249bf02edcb6d767295dcbb7923898814d3f21be712ab25467c625e072be27"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_missing_test_session_lifetime.assert_app_permanent_sess": {"doc_hash": "77a8924d9c0abda0a4afbb2b258f2c5dad2ecfad2605f77399ba2e7c1bcfac74"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_test_redirect_no_app_test_abort_with_app.with_app_app_context_p.flask_abort_900_": {"doc_hash": "36d6e511a6095ff4a3d7528b65932df8f9260726298d68cc4ffd13f9079ffba3"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestHelpers_": {"doc_hash": "31a198a65e181962651e85f53a4fd811cc88c08f71e46de1d12e448ed30ef1e2"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_sys_test_uninstalled_module_paths.assert_app_instance_path_": {"doc_hash": "73a339875edd9daaf3e904638e1a0bc641b30402def7b56b5876e040ac4b5a5d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_namespace_paths_test_uninstalled_namespace_paths.assert_app_instance_path_": {"doc_hash": "37dcad9baa77f4ceaf68e0b9c3a2e10412cb0d93a2b4626cea925d1a7a98d12a"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_aware_datetimes_test_jsonify_aware_datetimes.assert_flask_json_dumps_d": {"doc_hash": "26ca8b95d349f44eaca4df21766f4a83fb7bd9724bec06049349f516ccc44a2d"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_uuid_types_test_jsonify_uuid_types.assert_rv_uuid_test_uu": {"doc_hash": "a1dd0386a8c6c3549560a7bc189d50ca0ec3c60f6f74f761a241709ad7bda5e6"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_decimal_test_json_attr.assert_rv_data_b_3_": {"doc_hash": "dd815c54fb10bd40b232d2d5654d135659647552dde4807cb73ce223483e758c"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_warnings_test_teardown_with_handled_exception.assert_buffer_None_": {"doc_hash": "d850be12a3920a955f1f66d99dc778133ff978d4475652d795a75dd4b595655e"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_subdomain_test_cli_custom_obj.assert_NS_called": {"doc_hash": "0b7988d4e93cc2ac3ac470b2c0be5f01f61b970dcdc77419dd2386752bfbaf63"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_pop_all_preserved_": {"doc_hash": "8295ecf44921d0724c38ad98e063b2b0086fc4ed653ac38a2afe89fedb1ebcc3"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_app_decorators.py_from___future___import_an_": {"doc_hash": "c4466a2c7275f0f701bddbf798465ac6cdeeb43c5757df9c480571a316f477a6"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_error_handler.py_from___future___import_an_": {"doc_hash": "36f98a30bd99c3086db5e7cbc15b59acd6e91937ba632471a8e8be3e2892a8bf"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_route.py_from___future___import_an_": {"doc_hash": "315ce257cf274c70b174404c24b54347378881a7f88dcb086ad63ebfe7e6548d"}}, "docstore/data": {"/tmp/repos/swe-bench_pallets__flask/docs/conf.py_packaging.version_latex_documents._master_doc_f_Flask_ve": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/docs/conf.py_packaging.version_latex_documents._master_doc_f_Flask_ve", "embedding": null, "metadata": {"file_path": "docs/conf.py", "file_name": "conf.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 64, "span_ids": ["impl:30", "impl", "imports"], "tokens": 601}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import packaging.version\nfrom pallets_sphinx_themes import get_version\nfrom pallets_sphinx_themes import ProjectLink\n\n# Project --------------------------------------------------------------\n\nproject = \"Flask\"\ncopyright = \"2010 Pallets\"\nauthor = \"Pallets\"\nrelease, version = get_version(\"Flask\")\n\n# General --------------------------------------------------------------\n\nmaster_doc = \"index\"\nextensions = [\n \"sphinx.ext.autodoc\",\n \"sphinx.ext.intersphinx\",\n \"sphinxcontrib.log_cabinet\",\n \"pallets_sphinx_themes\",\n \"sphinx_issues\",\n \"sphinx_tabs.tabs\",\n]\nautodoc_typehints = \"description\"\nintersphinx_mapping = {\n \"python\": (\"https://docs.python.org/3/\", None),\n \"werkzeug\": (\"https://werkzeug.palletsprojects.com/\", None),\n \"click\": (\"https://click.palletsprojects.com/\", None),\n \"jinja\": (\"https://jinja.palletsprojects.com/\", None),\n \"itsdangerous\": (\"https://itsdangerous.palletsprojects.com/\", None),\n \"sqlalchemy\": (\"https://docs.sqlalchemy.org/\", None),\n \"wtforms\": (\"https://wtforms.readthedocs.io/\", None),\n \"blinker\": (\"https://blinker.readthedocs.io/\", None),\n}\nissues_github_path = \"pallets/flask\"\n\n# HTML -----------------------------------------------------------------\n\nhtml_theme = \"flask\"\nhtml_theme_options = {\"index_sidebar_logo\": False}\nhtml_context = {\n \"project_links\": [\n ProjectLink(\"Donate\", \"https://palletsprojects.com/donate\"),\n ProjectLink(\"PyPI Releases\", \"https://pypi.org/project/Flask/\"),\n ProjectLink(\"Source Code\", \"https://github.com/pallets/flask/\"),\n ProjectLink(\"Issue Tracker\", \"https://github.com/pallets/flask/issues/\"),\n ProjectLink(\"Website\", \"https://palletsprojects.com/p/flask/\"),\n ProjectLink(\"Twitter\", \"https://twitter.com/PalletsTeam\"),\n ProjectLink(\"Chat\", \"https://discord.gg/pallets\"),\n ]\n}\nhtml_sidebars = {\n \"index\": [\"project.html\", \"localtoc.html\", \"searchbox.html\", \"ethicalads.html\"],\n \"**\": [\"localtoc.html\", \"relations.html\", \"searchbox.html\", \"ethicalads.html\"],\n}\nsinglehtml_sidebars = {\"index\": [\"project.html\", \"localtoc.html\", \"ethicalads.html\"]}\nhtml_static_path = [\"_static\"]\nhtml_favicon = \"_static/flask-icon.png\"\nhtml_logo = \"_static/flask-icon.png\"\nhtml_title = f\"Flask Documentation ({version})\"\nhtml_show_sourcelink = False\n\n# LaTeX ----------------------------------------------------------------\n\nlatex_documents = [(master_doc, f\"Flask-{version}.tex\", html_title, author, \"manual\")]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/docs/conf.py__Local_Extensions__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/docs/conf.py__Local_Extensions__", "embedding": null, "metadata": {"file_path": "docs/conf.py", "file_name": "conf.py", "file_type": "text/x-python", "category": "implementation", "start_line": 66, "end_line": 99, "span_ids": ["impl:30", "github_link", "setup"], "tokens": 213}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "# Local Extensions -----------------------------------------------------\n\n\ndef github_link(name, rawtext, text, lineno, inliner, options=None, content=None):\n app = inliner.document.settings.env.app\n release = app.config.release\n base_url = \"https://github.com/pallets/flask/tree/\"\n\n if text.endswith(\">\"):\n words, text = text[:-1].rsplit(\"<\", 1)\n words = words.strip()\n else:\n words = None\n\n if packaging.version.parse(release).is_devrelease:\n url = f\"{base_url}main/{text}\"\n else:\n url = f\"{base_url}{release}/{text}\"\n\n if words is None:\n words = url\n\n from docutils.nodes import reference\n from docutils.parsers.rst.roles import set_classes\n\n options = options or {}\n set_classes(options)\n node = reference(rawtext, words, refuri=url, **options)\n return [node], []\n\n\ndef setup(app):\n app.add_role(\"gh\", github_link)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/__init__.py__", "embedding": null, "metadata": {"file_path": "examples/javascript/js_example/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 6, "span_ids": ["imports:2", "impl", "docstring", "imports"], "tokens": 25}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napp = Flask(__name__)\n\nfrom js_example import views # noqa: E402, F401", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/views.py_from_flask_import_jsonify_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/javascript/js_example/views.py_from_flask_import_jsonify_", "embedding": null, "metadata": {"file_path": "examples/javascript/js_example/views.py", "file_name": "views.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 19, "span_ids": ["add", "imports", "index"], "tokens": 113}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import jsonify\nfrom flask import render_template\nfrom flask import request\n\nfrom js_example import app\n\n\n@app.route(\"/\", defaults={\"js\": \"fetch\"})\n@app.route(\"/\")\ndef index(js):\n return render_template(f\"{js}.html\", js=js)\n\n\n@app.route(\"/add\", methods=[\"POST\"])\ndef add():\n a = request.form.get(\"a\", 0, type=float)\n b = request.form.get(\"b\", 0, type=float)\n return jsonify(result=a + b)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/conftest.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/conftest.py__", "embedding": null, "metadata": {"file_path": "examples/javascript/tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 16, "span_ids": ["fixture_app", "client", "imports"], "tokens": 48}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\n\nfrom js_example import app\n\n\n@pytest.fixture(name=\"app\")\ndef fixture_app():\n app.testing = True\n yield app\n app.testing = False\n\n\n@pytest.fixture\ndef client(app):\n return app.test_client()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/test_js_example.py_pytest_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/javascript/tests/test_js_example.py_pytest_", "embedding": null, "metadata": {"file_path": "examples/javascript/tests/test_js_example.py", "file_name": "test_js_example.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 28, "span_ids": ["test_add", "imports", "test_index"], "tokens": 197}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\nfrom flask import template_rendered\n\n\n@pytest.mark.parametrize(\n (\"path\", \"template_name\"),\n (\n (\"/\", \"xhr.html\"),\n (\"/plain\", \"xhr.html\"),\n (\"/fetch\", \"fetch.html\"),\n (\"/jquery\", \"jquery.html\"),\n ),\n)\ndef test_index(app, client, path, template_name):\n def check(sender, template, context):\n assert template.name == template_name\n\n with template_rendered.connected_to(check, app):\n client.get(path)\n\n\n@pytest.mark.parametrize(\n (\"a\", \"b\", \"result\"), ((2, 3, 5), (2.5, 3, 5.5), (2, None, 2), (2, \"b\", 2))\n)\ndef test_add(client, a, b, result):\n response = client.post(\"/add\", data={\"a\": a, \"b\": b})\n assert response.get_json()[\"result\"] == result", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/__init__.py_os_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/__init__.py_os_", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 51, "span_ids": ["create_app", "imports"], "tokens": 315}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import os\n\nfrom flask import Flask\n\n\ndef create_app(test_config=None):\n \"\"\"Create and configure an instance of the Flask application.\"\"\"\n app = Flask(__name__, instance_relative_config=True)\n app.config.from_mapping(\n # a default secret that should be overridden by instance config\n SECRET_KEY=\"dev\",\n # store the database in the instance folder\n DATABASE=os.path.join(app.instance_path, \"flaskr.sqlite\"),\n )\n\n if test_config is None:\n # load the instance config, if it exists, when not testing\n app.config.from_pyfile(\"config.py\", silent=True)\n else:\n # load the test config if passed in\n app.config.update(test_config)\n\n # ensure the instance folder exists\n try:\n os.makedirs(app.instance_path)\n except OSError:\n pass\n\n @app.route(\"/hello\")\n def hello():\n return \"Hello, World!\"\n\n # register the database commands\n from flaskr import db\n\n db.init_app(app)\n\n # apply the blueprints to the app\n from flaskr import auth, blog\n\n app.register_blueprint(auth.bp)\n app.register_blueprint(blog.bp)\n\n # make url_for('index') == url_for('blog.index')\n # in another app, you might define a separate main index here with\n # app.route, while giving the blog blueprint a url_prefix, but for\n # the tutorial the blog will be the main index\n app.add_url_rule(\"/\", endpoint=\"index\")\n\n return app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_functools_load_logged_in_user.if_user_id_is_None_.else_.g.user._": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_functools_load_logged_in_user.if_user_id_is_None_.else_.g.user._", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/auth.py", "file_name": "auth.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 43, "span_ids": ["load_logged_in_user", "impl", "imports", "login_required"], "tokens": 240}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import functools\n\nfrom flask import Blueprint\nfrom flask import flash\nfrom flask import g\nfrom flask import redirect\nfrom flask import render_template\nfrom flask import request\nfrom flask import session\nfrom flask import url_for\nfrom werkzeug.security import check_password_hash\nfrom werkzeug.security import generate_password_hash\n\nfrom flaskr.db import get_db\n\nbp = Blueprint(\"auth\", __name__, url_prefix=\"/auth\")\n\n\ndef login_required(view):\n \"\"\"View decorator that redirects anonymous users to the login page.\"\"\"\n\n @functools.wraps(view)\n def wrapped_view(**kwargs):\n if g.user is None:\n return redirect(url_for(\"auth.login\"))\n\n return view(**kwargs)\n\n return wrapped_view\n\n\n@bp.before_app_request\ndef load_logged_in_user():\n \"\"\"If a user id is stored in the session, load the user object from\n the database into ``g.user``.\"\"\"\n user_id = session.get(\"user_id\")\n\n if user_id is None:\n g.user = None\n else:\n g.user = (\n get_db().execute(\"SELECT * FROM user WHERE id = ?\", (user_id,)).fetchone()\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_register_register.return.render_template_auth_reg": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_register_register.return.render_template_auth_reg", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/auth.py", "file_name": "auth.py", "file_type": "text/x-python", "category": "implementation", "start_line": 46, "end_line": 81, "span_ids": ["register"], "tokens": 225}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@bp.route(\"/register\", methods=(\"GET\", \"POST\"))\ndef register():\n \"\"\"Register a new user.\n\n Validates that the username is not already taken. Hashes the\n password for security.\n \"\"\"\n if request.method == \"POST\":\n username = request.form[\"username\"]\n password = request.form[\"password\"]\n db = get_db()\n error = None\n\n if not username:\n error = \"Username is required.\"\n elif not password:\n error = \"Password is required.\"\n\n if error is None:\n try:\n db.execute(\n \"INSERT INTO user (username, password) VALUES (?, ?)\",\n (username, generate_password_hash(password)),\n )\n db.commit()\n except db.IntegrityError:\n # The username was already taken, which caused the\n # commit to fail. Show a validation error.\n error = f\"User {username} is already registered.\"\n else:\n # Success, go to the login page.\n return redirect(url_for(\"auth.login\"))\n\n flash(error)\n\n return render_template(\"auth/register.html\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_login_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/auth.py_login_", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/auth.py", "file_name": "auth.py", "file_type": "text/x-python", "category": "implementation", "start_line": 84, "end_line": 117, "span_ids": ["login", "logout"], "tokens": 215}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@bp.route(\"/login\", methods=(\"GET\", \"POST\"))\ndef login():\n \"\"\"Log in a registered user by adding the user id to the session.\"\"\"\n if request.method == \"POST\":\n username = request.form[\"username\"]\n password = request.form[\"password\"]\n db = get_db()\n error = None\n user = db.execute(\n \"SELECT * FROM user WHERE username = ?\", (username,)\n ).fetchone()\n\n if user is None:\n error = \"Incorrect username.\"\n elif not check_password_hash(user[\"password\"], password):\n error = \"Incorrect password.\"\n\n if error is None:\n # store the user id in a new session and return to the index\n session.clear()\n session[\"user_id\"] = user[\"id\"]\n return redirect(url_for(\"index\"))\n\n flash(error)\n\n return render_template(\"auth/login.html\")\n\n\n@bp.route(\"/logout\")\ndef logout():\n \"\"\"Clear the current session, including the stored user id.\"\"\"\n session.clear()\n return redirect(url_for(\"index\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_from_flask_import_Bluepri_index.return.render_template_blog_ind": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_from_flask_import_Bluepri_index.return.render_template_blog_ind", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/blog.py", "file_name": "blog.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 25, "span_ids": ["impl", "imports", "index"], "tokens": 157}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Blueprint\nfrom flask import flash\nfrom flask import g\nfrom flask import redirect\nfrom flask import render_template\nfrom flask import request\nfrom flask import url_for\nfrom werkzeug.exceptions import abort\n\nfrom flaskr.auth import login_required\nfrom flaskr.db import get_db\n\nbp = Blueprint(\"blog\", __name__)\n\n\n@bp.route(\"/\")\ndef index():\n \"\"\"Show all the posts, most recent first.\"\"\"\n db = get_db()\n posts = db.execute(\n \"SELECT p.id, title, body, created, author_id, username\"\n \" FROM post p JOIN user u ON p.author_id = u.id\"\n \" ORDER BY created DESC\"\n ).fetchall()\n return render_template(\"blog/index.html\", posts=posts)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_get_post_get_post.return.post": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_get_post_get_post.return.post", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/blog.py", "file_name": "blog.py", "file_type": "text/x-python", "category": "implementation", "start_line": 28, "end_line": 57, "span_ids": ["get_post"], "tokens": 121}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_post(id, check_author=True):\n post = (\n get_db()\n .execute(\n \"SELECT p.id, title, body, created, author_id, username\"\n \" FROM post p JOIN user u ON p.author_id = u.id\"\n \" WHERE p.id = ?\",\n (id,),\n )\n .fetchone()\n )\n\n if post is None:\n abort(404, f\"Post id {id} doesn't exist.\")\n\n if check_author and post[\"author_id\"] != g.user[\"id\"]:\n abort(403)\n\n return post", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_create_create.return.render_template_blog_cre": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_create_create.return.render_template_blog_cre", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/blog.py", "file_name": "blog.py", "file_type": "text/x-python", "category": "implementation", "start_line": 60, "end_line": 83, "span_ids": ["create"], "tokens": 149}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@bp.route(\"/create\", methods=(\"GET\", \"POST\"))\n@login_required\ndef create():\n \"\"\"Create a new post for the current user.\"\"\"\n if request.method == \"POST\":\n title = request.form[\"title\"]\n body = request.form[\"body\"]\n error = None\n\n if not title:\n error = \"Title is required.\"\n\n if error is not None:\n flash(error)\n else:\n db = get_db()\n db.execute(\n \"INSERT INTO post (title, body, author_id) VALUES (?, ?, ?)\",\n (title, body, g.user[\"id\"]),\n )\n db.commit()\n return redirect(url_for(\"blog.index\"))\n\n return render_template(\"blog/create.html\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_update_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/blog.py_update_", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/blog.py", "file_name": "blog.py", "file_type": "text/x-python", "category": "implementation", "start_line": 86, "end_line": 126, "span_ids": ["update", "delete"], "tokens": 236}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@bp.route(\"//update\", methods=(\"GET\", \"POST\"))\n@login_required\ndef update(id):\n post = get_post(id)\n\n if request.method == \"POST\":\n title = request.form[\"title\"]\n body = request.form[\"body\"]\n error = None\n\n if not title:\n error = \"Title is required.\"\n\n if error is not None:\n flash(error)\n else:\n db = get_db()\n db.execute(\n \"UPDATE post SET title = ?, body = ? WHERE id = ?\", (title, body, id)\n )\n db.commit()\n return redirect(url_for(\"blog.index\"))\n\n return render_template(\"blog/update.html\", post=post)\n\n\n@bp.route(\"//delete\", methods=(\"POST\",))\n@login_required\ndef delete(id):\n \"\"\"Delete a post.\n\n Ensures that the post exists and that the logged in user is the\n author of the post.\n \"\"\"\n get_post(id)\n db = get_db()\n db.execute(\"DELETE FROM post WHERE id = ?\", (id,))\n db.commit()\n return redirect(url_for(\"blog.index\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/db.py_sqlite3_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/flaskr/db.py_sqlite3_", "embedding": null, "metadata": {"file_path": "examples/tutorial/flaskr/db.py", "file_name": "db.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 53, "span_ids": ["init_db_command", "get_db", "init_app", "imports", "close_db", "init_db"], "tokens": 277}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import sqlite3\n\nimport click\nfrom flask import current_app\nfrom flask import g\n\n\ndef get_db():\n \"\"\"Connect to the application's configured database. The connection\n is unique for each request and will be reused if this is called\n again.\n \"\"\"\n if \"db\" not in g:\n g.db = sqlite3.connect(\n current_app.config[\"DATABASE\"], detect_types=sqlite3.PARSE_DECLTYPES\n )\n g.db.row_factory = sqlite3.Row\n\n return g.db\n\n\ndef close_db(e=None):\n \"\"\"If this request connected to the database, close the\n connection.\n \"\"\"\n db = g.pop(\"db\", None)\n\n if db is not None:\n db.close()\n\n\ndef init_db():\n \"\"\"Clear existing data and create new tables.\"\"\"\n db = get_db()\n\n with current_app.open_resource(\"schema.sql\") as f:\n db.executescript(f.read().decode(\"utf8\"))\n\n\n@click.command(\"init-db\")\ndef init_db_command():\n \"\"\"Clear existing data and create new tables.\"\"\"\n init_db()\n click.echo(\"Initialized the database.\")\n\n\ndef init_app(app):\n \"\"\"Register database functions with the Flask app. This is called by\n the application factory.\n \"\"\"\n app.teardown_appcontext(close_db)\n app.cli.add_command(init_db_command)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_os_app.os_unlink_db_path_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_os_app.os_unlink_db_path_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 32, "span_ids": ["impl", "app", "imports"], "tokens": 204}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import os\nimport tempfile\n\nimport pytest\n\nfrom flaskr import create_app\nfrom flaskr.db import get_db\nfrom flaskr.db import init_db\n\n# read in SQL for populating test data\nwith open(os.path.join(os.path.dirname(__file__), \"data.sql\"), \"rb\") as f:\n _data_sql = f.read().decode(\"utf8\")\n\n\n@pytest.fixture\ndef app():\n \"\"\"Create and configure a new app instance for each test.\"\"\"\n # create a temporary file to isolate the database for each test\n db_fd, db_path = tempfile.mkstemp()\n # create the app with common test config\n app = create_app({\"TESTING\": True, \"DATABASE\": db_path})\n\n # create the database and load test data\n with app.app_context():\n init_db()\n get_db().executescript(_data_sql)\n\n yield app\n\n # close and remove the temporary database\n os.close(db_fd)\n os.unlink(db_path)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_client_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/conftest.py_client_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "test", "start_line": 35, "end_line": 63, "span_ids": ["auth", "runner", "AuthActions.logout", "client", "AuthActions.login", "AuthActions"], "tokens": 134}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture\ndef client(app):\n \"\"\"A test client for the app.\"\"\"\n return app.test_client()\n\n\n@pytest.fixture\ndef runner(app):\n \"\"\"A test runner for the app's Click commands.\"\"\"\n return app.test_cli_runner()\n\n\nclass AuthActions:\n def __init__(self, client):\n self._client = client\n\n def login(self, username=\"test\", password=\"test\"):\n return self._client.post(\n \"/auth/login\", data={\"username\": username, \"password\": password}\n )\n\n def logout(self):\n return self._client.get(\"/auth/logout\")\n\n\n@pytest.fixture\ndef auth(client):\n return AuthActions(client)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_pytest_test_login_required.assert_response_headers_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_pytest_test_login_required.assert_response_headers_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_blog.py", "file_name": "test_blog.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 22, "span_ids": ["test_login_required", "imports", "test_index"], "tokens": 154}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\n\nfrom flaskr.db import get_db\n\n\ndef test_index(client, auth):\n response = client.get(\"/\")\n assert b\"Log In\" in response.data\n assert b\"Register\" in response.data\n\n auth.login()\n response = client.get(\"/\")\n assert b\"test title\" in response.data\n assert b\"by test on 2018-01-01\" in response.data\n assert b\"test\\nbody\" in response.data\n assert b'href=\"/1/update\"' in response.data\n\n\n@pytest.mark.parametrize(\"path\", (\"/create\", \"/1/update\", \"/1/delete\"))\ndef test_login_required(client, path):\n response = client.post(path)\n assert response.headers[\"Location\"] == \"/auth/login\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_author_required_test_author_required.assert_b_href_1_update_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_author_required_test_author_required.assert_b_href_1_update_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_blog.py", "file_name": "test_blog.py", "file_type": "text/x-python", "category": "test", "start_line": 25, "end_line": 37, "span_ids": ["test_author_required"], "tokens": 114}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_author_required(app, client, auth):\n with app.app_context():\n db = get_db()\n db.execute(\"UPDATE post SET author_id = 2 WHERE id = 1\")\n db.commit()\n\n auth.login()\n # current user can't modify other user's post\n assert client.post(\"/1/update\").status_code == 403\n assert client.post(\"/1/delete\").status_code == 403\n # current user doesn't see edit link\n assert b'href=\"/1/update\"' not in client.get(\"/\").data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_exists_required_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_blog.py_test_exists_required_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_blog.py", "file_name": "test_blog.py", "file_type": "text/x-python", "category": "test", "start_line": 40, "end_line": 84, "span_ids": ["test_create", "test_exists_required", "test_update", "test_delete", "test_create_update_validate"], "tokens": 333}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"path\", (\"/2/update\", \"/2/delete\"))\ndef test_exists_required(client, auth, path):\n auth.login()\n assert client.post(path).status_code == 404\n\n\ndef test_create(client, auth, app):\n auth.login()\n assert client.get(\"/create\").status_code == 200\n client.post(\"/create\", data={\"title\": \"created\", \"body\": \"\"})\n\n with app.app_context():\n db = get_db()\n count = db.execute(\"SELECT COUNT(id) FROM post\").fetchone()[0]\n assert count == 2\n\n\ndef test_update(client, auth, app):\n auth.login()\n assert client.get(\"/1/update\").status_code == 200\n client.post(\"/1/update\", data={\"title\": \"updated\", \"body\": \"\"})\n\n with app.app_context():\n db = get_db()\n post = db.execute(\"SELECT * FROM post WHERE id = 1\").fetchone()\n assert post[\"title\"] == \"updated\"\n\n\n@pytest.mark.parametrize(\"path\", (\"/create\", \"/1/update\"))\ndef test_create_update_validate(client, auth, path):\n auth.login()\n response = client.post(path, data={\"title\": \"\", \"body\": \"\"})\n assert b\"Title is required.\" in response.data\n\n\ndef test_delete(client, auth, app):\n auth.login()\n response = client.post(\"/1/delete\")\n assert response.headers[\"Location\"] == \"/\"\n\n with app.app_context():\n db = get_db()\n post = db.execute(\"SELECT * FROM post WHERE id = 1\").fetchone()\n assert post is None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_db.py_sqlite3_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_db.py_sqlite3_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_db.py", "file_name": "test_db.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 30, "span_ids": ["test_get_close_db", "test_init_db_command", "test_init_db_command.Recorder", "imports", "test_init_db_command.Recorder:2"], "tokens": 145}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import sqlite3\n\nimport pytest\n\nfrom flaskr.db import get_db\n\n\ndef test_get_close_db(app):\n with app.app_context():\n db = get_db()\n assert db is get_db()\n\n with pytest.raises(sqlite3.ProgrammingError) as e:\n db.execute(\"SELECT 1\")\n\n assert \"closed\" in str(e.value)\n\n\ndef test_init_db_command(runner, monkeypatch):\n class Recorder:\n called = False\n\n def fake_init_db():\n Recorder.called = True\n\n monkeypatch.setattr(\"flaskr.db.init_db\", fake_init_db)\n result = runner.invoke(args=[\"init-db\"])\n assert \"Initialized\" in result.output\n assert Recorder.called", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_factory.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_factory.py__", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_factory.py", "file_name": "test_factory.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 13, "span_ids": ["test_hello", "test_config", "imports"], "tokens": 65}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flaskr import create_app\n\n\ndef test_config():\n \"\"\"Test create_app without passing test config.\"\"\"\n assert not create_app().testing\n assert create_app({\"TESTING\": True}).testing\n\n\ndef test_hello(client):\n response = client.get(\"/hello\")\n assert response.data == b\"Hello, World!\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__main__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/__main__.py__", "embedding": null, "metadata": {"file_path": "src/flask/__main__.py", "file_name": "__main__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 4, "span_ids": ["impl", "imports"], "tokens": 8}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from .cli import main\n\nmain()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_functools__make_timedelta.return.timedelta_seconds_value_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_functools__make_timedelta.return.timedelta_seconds_value_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 102, "span_ids": ["_make_timedelta", "impl", "impl:2", "imports", "imports:32", "imports:66", "impl:3"], "tokens": 759}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import functools\nimport inspect\nimport logging\nimport os\nimport sys\nimport typing as t\nimport weakref\nfrom collections.abc import Iterator as _abc_Iterator\nfrom datetime import timedelta\nfrom itertools import chain\nfrom types import TracebackType\n\nimport click\nfrom werkzeug.datastructures import Headers\nfrom werkzeug.datastructures import ImmutableDict\nfrom werkzeug.exceptions import Aborter\nfrom werkzeug.exceptions import BadRequest\nfrom werkzeug.exceptions import BadRequestKeyError\nfrom werkzeug.exceptions import HTTPException\nfrom werkzeug.exceptions import InternalServerError\nfrom werkzeug.routing import BuildError\nfrom werkzeug.routing import Map\nfrom werkzeug.routing import MapAdapter\nfrom werkzeug.routing import RequestRedirect\nfrom werkzeug.routing import RoutingException\nfrom werkzeug.routing import Rule\nfrom werkzeug.serving import is_running_from_reloader\nfrom werkzeug.urls import url_quote\nfrom werkzeug.utils import cached_property\nfrom werkzeug.utils import redirect as _wz_redirect\nfrom werkzeug.wrappers import Response as BaseResponse\n\nfrom . import cli\nfrom . import typing as ft\nfrom .config import Config\nfrom .config import ConfigAttribute\nfrom .ctx import _AppCtxGlobals\nfrom .ctx import AppContext\nfrom .ctx import RequestContext\nfrom .globals import _cv_app\nfrom .globals import _cv_request\nfrom .globals import g\nfrom .globals import request\nfrom .globals import request_ctx\nfrom .globals import session\nfrom .helpers import _split_blueprint_path\nfrom .helpers import get_debug_flag\nfrom .helpers import get_flashed_messages\nfrom .helpers import get_load_dotenv\nfrom .json.provider import DefaultJSONProvider\nfrom .json.provider import JSONProvider\nfrom .logging import create_logger\nfrom .scaffold import _endpoint_from_view_func\nfrom .scaffold import _sentinel\nfrom .scaffold import find_package\nfrom .scaffold import Scaffold\nfrom .scaffold import setupmethod\nfrom .sessions import SecureCookieSessionInterface\nfrom .sessions import SessionInterface\nfrom .signals import appcontext_tearing_down\nfrom .signals import got_request_exception\nfrom .signals import request_finished\nfrom .signals import request_started\nfrom .signals import request_tearing_down\nfrom .templating import DispatchingJinjaLoader\nfrom .templating import Environment\nfrom .wrappers import Request\nfrom .wrappers import Response\n\nif t.TYPE_CHECKING: # pragma: no cover\n import typing_extensions as te\n from .blueprints import Blueprint\n from .testing import FlaskClient\n from .testing import FlaskCliRunner\n\nT_shell_context_processor = t.TypeVar(\n \"T_shell_context_processor\", bound=ft.ShellContextProcessorCallable\n)\nT_teardown = t.TypeVar(\"T_teardown\", bound=ft.TeardownCallable)\nT_template_filter = t.TypeVar(\"T_template_filter\", bound=ft.TemplateFilterCallable)\nT_template_global = t.TypeVar(\"T_template_global\", bound=ft.TemplateGlobalCallable)\nT_template_test = t.TypeVar(\"T_template_test\", bound=ft.TemplateTestCallable)\n\nif sys.version_info >= (3, 8):\n iscoroutinefunction = inspect.iscoroutinefunction\nelse:\n\n def iscoroutinefunction(func: t.Any) -> bool:\n while inspect.ismethod(func):\n func = func.__func__\n\n while isinstance(func, functools.partial):\n func = func.func\n\n return inspect.iscoroutinefunction(func)\n\n\ndef _make_timedelta(value: t.Union[timedelta, int, None]) -> t.Optional[timedelta]:\n if value is None or isinstance(value, timedelta):\n return value\n\n return timedelta(seconds=value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask_Flask._The_flask_object_imple": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask_Flask._The_flask_object_imple", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 101, "end_line": 196, "span_ids": ["Flask"], "tokens": 1013}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n \"\"\"The flask object implements a WSGI application and acts as the central\n object. It is passed the name of the module or package of the\n application. Once it is created it will act as a central registry for\n the view functions, the URL rules, template configuration and much more.\n\n The name of the package is used to resolve resources from inside the\n package or the folder the module is contained in depending on if the\n package parameter resolves to an actual python package (a folder with\n an :file:`__init__.py` file inside) or a standard module (just a ``.py`` file).\n\n For more information about resource loading, see :func:`open_resource`.\n\n Usually you create a :class:`Flask` instance in your main module or\n in the :file:`__init__.py` file of your package like this::\n\n from flask import Flask\n app = Flask(__name__)\n\n .. admonition:: About the First Parameter\n\n The idea of the first parameter is to give Flask an idea of what\n belongs to your application. This name is used to find resources\n on the filesystem, can be used by extensions to improve debugging\n information and a lot more.\n\n So it's important what you provide there. If you are using a single\n module, `__name__` is always the correct value. If you however are\n using a package, it's usually recommended to hardcode the name of\n your package there.\n\n For example if your application is defined in :file:`yourapplication/app.py`\n you should create it with one of the two versions below::\n\n app = Flask('yourapplication')\n app = Flask(__name__.split('.')[0])\n\n Why is that? The application will work even with `__name__`, thanks\n to how resources are looked up. However it will make debugging more\n painful. Certain extensions can make assumptions based on the\n import name of your application. For example the Flask-SQLAlchemy\n extension will look for the code in your application that triggered\n an SQL query in debug mode. If the import name is not properly set\n up, that debugging information is lost. (For example it would only\n pick up SQL queries in `yourapplication.app` and not\n `yourapplication.views.frontend`)\n\n .. versionadded:: 0.7\n The `static_url_path`, `static_folder`, and `template_folder`\n parameters were added.\n\n .. versionadded:: 0.8\n The `instance_path` and `instance_relative_config` parameters were\n added.\n\n .. versionadded:: 0.11\n The `root_path` parameter was added.\n\n .. versionadded:: 1.0\n The ``host_matching`` and ``static_host`` parameters were added.\n\n .. versionadded:: 1.0\n The ``subdomain_matching`` parameter was added. Subdomain\n matching needs to be enabled manually now. Setting\n :data:`SERVER_NAME` does not implicitly enable it.\n\n :param import_name: the name of the application package\n :param static_url_path: can be used to specify a different path for the\n static files on the web. Defaults to the name\n of the `static_folder` folder.\n :param static_folder: The folder with static files that is served at\n ``static_url_path``. Relative to the application ``root_path``\n or an absolute path. Defaults to ``'static'``.\n :param static_host: the host to use when adding the static route.\n Defaults to None. Required when using ``host_matching=True``\n with a ``static_folder`` configured.\n :param host_matching: set ``url_map.host_matching`` attribute.\n Defaults to False.\n :param subdomain_matching: consider the subdomain relative to\n :data:`SERVER_NAME` when matching routes. Defaults to False.\n :param template_folder: the folder that contains the templates that should\n be used by the application. Defaults to\n ``'templates'`` folder in the root path of the\n application.\n :param instance_path: An alternative instance path for the application.\n By default the folder ``'instance'`` next to the\n package or module is assumed to be the instance\n path.\n :param instance_relative_config: if set to ``True`` relative filenames\n for loading the config are assumed to\n be relative to the instance path instead\n of the application root.\n :param root_path: The path to the root of the application files.\n This should only be set manually when it can't be detected\n automatically, such as for namespace packages.\n \"\"\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.__init___Flask.__init__.self.cli.name.self_name": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.__init___Flask.__init__.self.cli.name.self_name", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 367, "end_line": 520, "span_ids": ["Flask"], "tokens": 1441}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def __init__(\n self,\n import_name: str,\n static_url_path: t.Optional[str] = None,\n static_folder: t.Optional[t.Union[str, os.PathLike]] = \"static\",\n static_host: t.Optional[str] = None,\n host_matching: bool = False,\n subdomain_matching: bool = False,\n template_folder: t.Optional[t.Union[str, os.PathLike]] = \"templates\",\n instance_path: t.Optional[str] = None,\n instance_relative_config: bool = False,\n root_path: t.Optional[str] = None,\n ):\n super().__init__(\n import_name=import_name,\n static_folder=static_folder,\n static_url_path=static_url_path,\n template_folder=template_folder,\n root_path=root_path,\n )\n\n if instance_path is None:\n instance_path = self.auto_find_instance_path()\n elif not os.path.isabs(instance_path):\n raise ValueError(\n \"If an instance path is provided it must be absolute.\"\n \" A relative path was given instead.\"\n )\n\n #: Holds the path to the instance folder.\n #:\n #: .. versionadded:: 0.8\n self.instance_path = instance_path\n\n #: The configuration dictionary as :class:`Config`. This behaves\n #: exactly like a regular dictionary but supports additional methods\n #: to load a config from files.\n self.config = self.make_config(instance_relative_config)\n\n #: An instance of :attr:`aborter_class` created by\n #: :meth:`make_aborter`. This is called by :func:`flask.abort`\n #: to raise HTTP errors, and can be called directly as well.\n #:\n #: .. versionadded:: 2.2\n #: Moved from ``flask.abort``, which calls this object.\n self.aborter = self.make_aborter()\n\n self.json: JSONProvider = self.json_provider_class(self)\n \"\"\"Provides access to JSON methods. Functions in ``flask.json``\n will call methods on this provider when the application context\n is active. Used for handling JSON requests and responses.\n\n An instance of :attr:`json_provider_class`. Can be customized by\n changing that attribute on a subclass, or by assigning to this\n attribute afterwards.\n\n The default, :class:`~flask.json.provider.DefaultJSONProvider`,\n uses Python's built-in :mod:`json` library. A different provider\n can use a different JSON library.\n\n .. versionadded:: 2.2\n \"\"\"\n\n #: A list of functions that are called by\n #: :meth:`handle_url_build_error` when :meth:`.url_for` raises a\n #: :exc:`~werkzeug.routing.BuildError`. Each function is called\n #: with ``error``, ``endpoint`` and ``values``. If a function\n #: returns ``None`` or raises a ``BuildError``, it is skipped.\n #: Otherwise, its return value is returned by ``url_for``.\n #:\n #: .. versionadded:: 0.9\n self.url_build_error_handlers: t.List[\n t.Callable[[Exception, str, t.Dict[str, t.Any]], str]\n ] = []\n\n #: A list of functions that are called when the application context\n #: is destroyed. Since the application context is also torn down\n #: if the request ends this is the place to store code that disconnects\n #: from databases.\n #:\n #: .. versionadded:: 0.9\n self.teardown_appcontext_funcs: t.List[ft.TeardownCallable] = []\n\n #: A list of shell context processor functions that should be run\n #: when a shell context is created.\n #:\n #: .. versionadded:: 0.11\n self.shell_context_processors: t.List[ft.ShellContextProcessorCallable] = []\n\n #: Maps registered blueprint names to blueprint objects. The\n #: dict retains the order the blueprints were registered in.\n #: Blueprints can be registered multiple times, this dict does\n #: not track how often they were attached.\n #:\n #: .. versionadded:: 0.7\n self.blueprints: t.Dict[str, \"Blueprint\"] = {}\n\n #: a place where extensions can store application specific state. For\n #: example this is where an extension could store database engines and\n #: similar things.\n #:\n #: The key must match the name of the extension module. For example in\n #: case of a \"Flask-Foo\" extension in `flask_foo`, the key would be\n #: ``'foo'``.\n #:\n #: .. versionadded:: 0.7\n self.extensions: dict = {}\n\n #: The :class:`~werkzeug.routing.Map` for this instance. You can use\n #: this to change the routing converters after the class was created\n #: but before any routes are connected. Example::\n #:\n #: from werkzeug.routing import BaseConverter\n #:\n #: class ListConverter(BaseConverter):\n #: def to_python(self, value):\n #: return value.split(',')\n #: def to_url(self, values):\n #: return ','.join(super(ListConverter, self).to_url(value)\n #: for value in values)\n #:\n #: app = Flask(__name__)\n #: app.url_map.converters['list'] = ListConverter\n self.url_map = self.url_map_class()\n\n self.url_map.host_matching = host_matching\n self.subdomain_matching = subdomain_matching\n\n # tracks internally if the application already handled at least one\n # request.\n self._got_first_request = False\n\n # Add a static route using the provided static_url_path, static_host,\n # and static_folder if there is a configured static_folder.\n # Note we do this without checking if static_folder exists.\n # For one, it might be created while the server is running (e.g. during\n # development). Also, Google App Engine stores static files somewhere\n if self.has_static_folder:\n assert (\n bool(static_host) == host_matching\n ), \"Invalid static_host/host_matching combination\"\n # Use a weakref to avoid creating a reference cycle between the app\n # and the view function (see #3761).\n self_ref = weakref.ref(self)\n self.add_url_rule(\n f\"{self.static_url_path}/\",\n endpoint=\"static\",\n host=static_host,\n view_func=lambda **kw: self_ref().send_static_file(**kw), # type: ignore # noqa: B950\n )\n\n # Set the name of the Click group in case someone wants to add\n # the app's commands to another CLI tool.\n self.cli.name = self.name", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.logger_Flask.logger.return.create_logger_self_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.logger_Flask.logger.return.create_logger_self_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 551, "end_line": 576, "span_ids": ["Flask.logger"], "tokens": 251}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @cached_property\n def logger(self) -> logging.Logger:\n \"\"\"A standard Python :class:`~logging.Logger` for the app, with\n the same name as :attr:`name`.\n\n In debug mode, the logger's :attr:`~logging.Logger.level` will\n be set to :data:`~logging.DEBUG`.\n\n If there are no handlers configured, a default handler will be\n added. See :doc:`/logging` for more information.\n\n .. versionchanged:: 1.1.0\n The logger takes the same name as :attr:`name` rather than\n hard-coding ``\"flask.app\"``.\n\n .. versionchanged:: 1.0.0\n Behavior was simplified. The logger is always named\n ``\"flask.app\"``. The level is only set during configuration,\n it doesn't check ``app.debug`` each time. Only one format is\n used, not different ones depending on ``app.debug``. No\n handlers are removed, and a handler is only added if no\n handlers are already configured.\n\n .. versionadded:: 0.3\n \"\"\"\n return create_logger(self)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.jinja_env_Flask.got_first_request.return.self__got_first_request": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.jinja_env_Flask.got_first_request.return.self__got_first_request", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 578, "end_line": 605, "span_ids": ["Flask.jinja_env", "Flask.got_first_request"], "tokens": 188}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @cached_property\n def jinja_env(self) -> Environment:\n \"\"\"The Jinja environment used to load templates.\n\n The environment is created the first time this property is\n accessed. Changing :attr:`jinja_options` after that will have no\n effect.\n \"\"\"\n return self.create_jinja_environment()\n\n @property\n def got_first_request(self) -> bool:\n \"\"\"This attribute is set to ``True`` if the application started\n handling the first request.\n\n .. deprecated:: 2.3\n Will be removed in Flask 2.4.\n\n .. versionadded:: 0.8\n \"\"\"\n import warnings\n\n warnings.warn(\n \"'got_first_request' is deprecated and will be removed in Flask 2.4.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return self._got_first_request", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_config_Flask.make_config.return.self_config_class_root_pa": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_config_Flask.make_config.return.self_config_class_root_pa", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 607, "end_line": 621, "span_ids": ["Flask.make_config"], "tokens": 144}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_config(self, instance_relative: bool = False) -> Config:\n \"\"\"Used to create the config attribute by the Flask constructor.\n The `instance_relative` parameter is passed in from the constructor\n of Flask (there named `instance_relative_config`) and indicates if\n the config should be relative to the instance path or the root path\n of the application.\n\n .. versionadded:: 0.8\n \"\"\"\n root_path = self.root_path\n if instance_relative:\n root_path = self.instance_path\n defaults = dict(self.default_config)\n defaults[\"DEBUG\"] = get_debug_flag()\n return self.config_class(root_path, defaults)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.auto_find_instance_path_Flask.auto_find_instance_path.return.os_path_join_prefix_var": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.auto_find_instance_path_Flask.auto_find_instance_path.return.os_path_join_prefix_var", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 632, "end_line": 643, "span_ids": ["Flask.auto_find_instance_path"], "tokens": 125}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def auto_find_instance_path(self) -> str:\n \"\"\"Tries to locate the instance path if it was not provided to the\n constructor of the application class. It will basically calculate\n the path to a folder named ``instance`` next to your main file or\n the package.\n\n .. versionadded:: 0.8\n \"\"\"\n prefix, package_path = find_package(self.import_name)\n if prefix is None:\n return os.path.join(package_path, \"instance\")\n return os.path.join(prefix, \"var\", f\"{self.name}-instance\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.open_instance_resource_Flask.open_instance_resource.return.open_os_path_join_self_in": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.open_instance_resource_Flask.open_instance_resource.return.open_os_path_join_self_in", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 645, "end_line": 655, "span_ids": ["Flask.open_instance_resource"], "tokens": 130}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def open_instance_resource(self, resource: str, mode: str = \"rb\") -> t.IO[t.AnyStr]:\n \"\"\"Opens a resource from the application's instance folder\n (:attr:`instance_path`). Otherwise works like\n :meth:`open_resource`. Instance resources can also be opened for\n writing.\n\n :param resource: the name of the resource. To access resources within\n subfolders use forward slashes as separator.\n :param mode: resource file opening mode, default is 'rb'.\n \"\"\"\n return open(os.path.join(self.instance_path, resource), mode)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_jinja_environment_Flask.create_jinja_environment.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_jinja_environment_Flask.create_jinja_environment.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 660, "end_line": 698, "span_ids": ["Flask.create_jinja_environment"], "tokens": 304}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def create_jinja_environment(self) -> Environment:\n \"\"\"Create the Jinja environment based on :attr:`jinja_options`\n and the various Jinja-related methods of the app. Changing\n :attr:`jinja_options` after this will have no effect. Also adds\n Flask-related globals and filters to the environment.\n\n .. versionchanged:: 0.11\n ``Environment.auto_reload`` set in accordance with\n ``TEMPLATES_AUTO_RELOAD`` configuration option.\n\n .. versionadded:: 0.5\n \"\"\"\n options = dict(self.jinja_options)\n\n if \"autoescape\" not in options:\n options[\"autoescape\"] = self.select_jinja_autoescape\n\n if \"auto_reload\" not in options:\n auto_reload = self.config[\"TEMPLATES_AUTO_RELOAD\"]\n\n if auto_reload is None:\n auto_reload = self.debug\n\n options[\"auto_reload\"] = auto_reload\n\n rv = self.jinja_environment(self, **options)\n rv.globals.update(\n url_for=self.url_for,\n get_flashed_messages=get_flashed_messages,\n config=self.config,\n # request, session and g are normally added with the\n # context processor for efficiency reasons but for imported\n # templates we also want the proxies in there.\n request=request,\n session=session,\n g=g,\n )\n rv.policies[\"json.dumps_function\"] = self.json.dumps\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.update_template_context_Flask.update_template_context.context_update_orig_ctx_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.update_template_context_Flask.update_template_context.context_update_orig_ctx_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 726, "end_line": 752, "span_ids": ["Flask.update_template_context"], "tokens": 236}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def update_template_context(self, context: dict) -> None:\n \"\"\"Update the template context with some commonly used variables.\n This injects request, session, config and g into the template\n context as well as everything template context processors want\n to inject. Note that the as of Flask 0.6, the original values\n in the context will not be overridden if a context processor\n decides to return a value with the same key.\n\n :param context: the context as a dictionary that is updated in place\n to add extra variables.\n \"\"\"\n names: t.Iterable[t.Optional[str]] = (None,)\n\n # A template may be rendered outside a request context.\n if request:\n names = chain(names, reversed(request.blueprints))\n\n # The values passed to render_template take precedence. Keep a\n # copy to re-apply after all context functions.\n orig_ctx = context.copy()\n\n for name in names:\n if name in self.template_context_processors:\n for func in self.template_context_processors[name]:\n context.update(func())\n\n context.update(orig_ctx)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_client_Flask.test_client.return.cls_type_ignore": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_client_Flask.test_client.return.cls_type_ignore", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 909, "end_line": 965, "span_ids": ["Flask.test_client"], "tokens": 540}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def test_client(self, use_cookies: bool = True, **kwargs: t.Any) -> \"FlaskClient\":\n \"\"\"Creates a test client for this application. For information\n about unit testing head over to :doc:`/testing`.\n\n Note that if you are testing for assertions or exceptions in your\n application code, you must set ``app.testing = True`` in order for the\n exceptions to propagate to the test client. Otherwise, the exception\n will be handled by the application (not visible to the test client) and\n the only indication of an AssertionError or other exception will be a\n 500 status code response to the test client. See the :attr:`testing`\n attribute. For example::\n\n app.testing = True\n client = app.test_client()\n\n The test client can be used in a ``with`` block to defer the closing down\n of the context until the end of the ``with`` block. This is useful if\n you want to access the context locals for testing::\n\n with app.test_client() as c:\n rv = c.get('/?vodka=42')\n assert request.args['vodka'] == '42'\n\n Additionally, you may pass optional keyword arguments that will then\n be passed to the application's :attr:`test_client_class` constructor.\n For example::\n\n from flask.testing import FlaskClient\n\n class CustomClient(FlaskClient):\n def __init__(self, *args, **kwargs):\n self._authentication = kwargs.pop(\"authentication\")\n super(CustomClient,self).__init__( *args, **kwargs)\n\n app.test_client_class = CustomClient\n client = app.test_client(authentication='Basic ....')\n\n See :class:`~flask.testing.FlaskClient` for more information.\n\n .. versionchanged:: 0.4\n added support for ``with`` block usage for the client.\n\n .. versionadded:: 0.7\n The `use_cookies` parameter was added as well as the ability\n to override the client to be used by setting the\n :attr:`test_client_class` attribute.\n\n .. versionchanged:: 0.11\n Added `**kwargs` to support passing additional keyword arguments to\n the constructor of :attr:`test_client_class`.\n \"\"\"\n cls = self.test_client_class\n if cls is None:\n from .testing import FlaskClient as cls\n return cls( # type: ignore\n self, self.response_class, use_cookies=use_cookies, **kwargs\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_cli_runner_Flask.test_cli_runner._type_ignore": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_cli_runner_Flask.test_cli_runner._type_ignore", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 967, "end_line": 982, "span_ids": ["Flask.test_cli_runner"], "tokens": 136}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def test_cli_runner(self, **kwargs: t.Any) -> \"FlaskCliRunner\":\n \"\"\"Create a CLI runner for testing CLI commands.\n See :ref:`testing-cli`.\n\n Returns an instance of :attr:`test_cli_runner_class`, by default\n :class:`~flask.testing.FlaskCliRunner`. The Flask app object is\n passed as the first argument.\n\n .. versionadded:: 1.0\n \"\"\"\n cls = self.test_cli_runner_class\n\n if cls is None:\n from .testing import FlaskCliRunner as cls\n\n return cls(self, **kwargs) # type: ignore", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.register_blueprint_Flask.iter_blueprints.return.self_blueprints_values_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.register_blueprint_Flask.iter_blueprints.return.self_blueprints_values_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 984, "end_line": 1017, "span_ids": ["Flask.iter_blueprints", "Flask.register_blueprint"], "tokens": 324}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def register_blueprint(self, blueprint: \"Blueprint\", **options: t.Any) -> None:\n \"\"\"Register a :class:`~flask.Blueprint` on the application. Keyword\n arguments passed to this method will override the defaults set on the\n blueprint.\n\n Calls the blueprint's :meth:`~flask.Blueprint.register` method after\n recording the blueprint in the application's :attr:`blueprints`.\n\n :param blueprint: The blueprint to register.\n :param url_prefix: Blueprint routes will be prefixed with this.\n :param subdomain: Blueprint routes will match on this subdomain.\n :param url_defaults: Blueprint routes will use these default values for\n view arguments.\n :param options: Additional keyword arguments are passed to\n :class:`~flask.blueprints.BlueprintSetupState`. They can be\n accessed in :meth:`~flask.Blueprint.record` callbacks.\n\n .. versionchanged:: 2.0.1\n The ``name`` option can be used to change the (pre-dotted)\n name the blueprint is registered with. This allows the same\n blueprint to be registered multiple times with unique names\n for ``url_for``.\n\n .. versionadded:: 0.7\n \"\"\"\n blueprint.register(self, options)\n\n def iter_blueprints(self) -> t.ValuesView[\"Blueprint\"]:\n \"\"\"Iterates over all blueprints by the order they were registered.\n\n .. versionadded:: 0.11\n \"\"\"\n return self.blueprints.values()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_url_rule_Flask.add_url_rule.if_view_func_is_not_None_.self_view_functions_endpo": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_url_rule_Flask.add_url_rule.if_view_func_is_not_None_.self_view_functions_endpo", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1019, "end_line": 1076, "span_ids": ["Flask.add_url_rule"], "tokens": 486}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def add_url_rule(\n self,\n rule: str,\n endpoint: t.Optional[str] = None,\n view_func: t.Optional[ft.RouteCallable] = None,\n provide_automatic_options: t.Optional[bool] = None,\n **options: t.Any,\n ) -> None:\n if endpoint is None:\n endpoint = _endpoint_from_view_func(view_func) # type: ignore\n options[\"endpoint\"] = endpoint\n methods = options.pop(\"methods\", None)\n\n # if the methods are not given and the view_func object knows its\n # methods we can use that instead. If neither exists, we go with\n # a tuple of only ``GET`` as default.\n if methods is None:\n methods = getattr(view_func, \"methods\", None) or (\"GET\",)\n if isinstance(methods, str):\n raise TypeError(\n \"Allowed methods must be a list of strings, for\"\n ' example: @app.route(..., methods=[\"POST\"])'\n )\n methods = {item.upper() for item in methods}\n\n # Methods that should always be added\n required_methods = set(getattr(view_func, \"required_methods\", ()))\n\n # starting with Flask 0.8 the view_func object can disable and\n # force-enable the automatic options handling.\n if provide_automatic_options is None:\n provide_automatic_options = getattr(\n view_func, \"provide_automatic_options\", None\n )\n\n if provide_automatic_options is None:\n if \"OPTIONS\" not in methods:\n provide_automatic_options = True\n required_methods.add(\"OPTIONS\")\n else:\n provide_automatic_options = False\n\n # Add the required methods now.\n methods |= required_methods\n\n rule = self.url_rule_class(rule, methods=methods, **options)\n rule.provide_automatic_options = provide_automatic_options # type: ignore\n\n self.url_map.add(rule)\n if view_func is not None:\n old_func = self.view_functions.get(endpoint)\n if old_func is not None and old_func != view_func:\n raise AssertionError(\n \"View function mapping is overwriting an existing\"\n f\" endpoint function: {endpoint}\"\n )\n self.view_functions[endpoint] = view_func", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_filter_Flask.add_template_filter.self_jinja_env_filters_na": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_filter_Flask.add_template_filter.self_jinja_env_filters_na", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1078, "end_line": 1110, "span_ids": ["Flask.template_filter", "Flask.add_template_filter"], "tokens": 247}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def template_filter(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_filter], T_template_filter]:\n \"\"\"A decorator that is used to register custom template filter.\n You can specify a name for the filter, otherwise the function\n name will be used. Example::\n\n @app.template_filter()\n def reverse(s):\n return s[::-1]\n\n :param name: the optional name of the filter, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_filter) -> T_template_filter:\n self.add_template_filter(f, name=name)\n return f\n\n return decorator\n\n @setupmethod\n def add_template_filter(\n self, f: ft.TemplateFilterCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a custom template filter. Works exactly like the\n :meth:`template_filter` decorator.\n\n :param name: the optional name of the filter, otherwise the\n function name will be used.\n \"\"\"\n self.jinja_env.filters[name or f.__name__] = f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_test_Flask.template_test.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_test_Flask.template_test.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1112, "end_line": 1139, "span_ids": ["Flask.template_test"], "tokens": 201}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def template_test(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_test], T_template_test]:\n \"\"\"A decorator that is used to register custom template test.\n You can specify a name for the test, otherwise the function\n name will be used. Example::\n\n @app.template_test()\n def is_prime(n):\n if n == 2:\n return True\n for i in range(2, int(math.ceil(math.sqrt(n))) + 1):\n if n % i == 0:\n return False\n return True\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the test, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_test) -> T_template_test:\n self.add_template_test(f, name=name)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_test_Flask.add_template_test.self_jinja_env_tests_name": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_test_Flask.add_template_test.self_jinja_env_tests_name", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1141, "end_line": 1153, "span_ids": ["Flask.add_template_test"], "tokens": 112}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def add_template_test(\n self, f: ft.TemplateTestCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a custom template test. Works exactly like the\n :meth:`template_test` decorator.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the test, otherwise the\n function name will be used.\n \"\"\"\n self.jinja_env.tests[name or f.__name__] = f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_global_Flask.template_global.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.template_global_Flask.template_global.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1155, "end_line": 1177, "span_ids": ["Flask.template_global"], "tokens": 164}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def template_global(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_global], T_template_global]:\n \"\"\"A decorator that is used to register a custom template global function.\n You can specify a name for the global function, otherwise the function\n name will be used. Example::\n\n @app.template_global()\n def double(n):\n return 2 * n\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the global function, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_global) -> T_template_global:\n self.add_template_global(f, name=name)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.teardown_appcontext_Flask.teardown_appcontext.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.teardown_appcontext_Flask.teardown_appcontext.return.f", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1193, "end_line": 1225, "span_ids": ["Flask.teardown_appcontext"], "tokens": 281}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def teardown_appcontext(self, f: T_teardown) -> T_teardown:\n \"\"\"Registers a function to be called when the application\n context is popped. The application context is typically popped\n after the request context for each request, at the end of CLI\n commands, or after a manually pushed context ends.\n\n .. code-block:: python\n\n with app.app_context():\n ...\n\n When the ``with`` block exits (or ``ctx.pop()`` is called), the\n teardown functions are called just before the app context is\n made inactive. Since a request context typically also manages an\n application context it would also be called when you pop a\n request context.\n\n When a teardown function was called because of an unhandled\n exception it will be passed an error object. If an\n :meth:`errorhandler` is registered, it will handle the exception\n and the teardown will not receive it.\n\n Teardown functions must avoid raising exceptions. If they\n execute code that might fail they must surround that code with a\n ``try``/``except`` block and log any errors.\n\n The return values of teardown functions are ignored.\n\n .. versionadded:: 0.9\n \"\"\"\n self.teardown_appcontext_funcs.append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.shell_context_processor_Flask._find_error_handler.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.shell_context_processor_Flask._find_error_handler.return.None", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1227, "end_line": 1259, "span_ids": ["Flask.shell_context_processor", "Flask._find_error_handler"], "tokens": 253}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def shell_context_processor(\n self, f: T_shell_context_processor\n ) -> T_shell_context_processor:\n \"\"\"Registers a shell context processor function.\n\n .. versionadded:: 0.11\n \"\"\"\n self.shell_context_processors.append(f)\n return f\n\n def _find_error_handler(self, e: Exception) -> t.Optional[ft.ErrorHandlerCallable]:\n \"\"\"Return a registered error handler for an exception in this order:\n blueprint handler for a specific code, app handler for a specific code,\n blueprint handler for an exception class, app handler for an exception\n class, or ``None`` if a suitable handler is not found.\n \"\"\"\n exc_class, code = self._get_exc_class_and_code(type(e))\n names = (*request.blueprints, None)\n\n for c in (code, None) if code is not None else (None,):\n for name in names:\n handler_map = self.error_handler_spec[name][c]\n\n if not handler_map:\n continue\n\n for cls in exc_class.__mro__:\n handler = handler_map.get(cls)\n\n if handler is not None:\n return handler\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_http_exception_Flask.handle_http_exception.return.self_ensure_sync_handler_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_http_exception_Flask.handle_http_exception.return.self_ensure_sync_handler_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1261, "end_line": 1294, "span_ids": ["Flask.handle_http_exception"], "tokens": 277}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def handle_http_exception(\n self, e: HTTPException\n ) -> t.Union[HTTPException, ft.ResponseReturnValue]:\n \"\"\"Handles an HTTP exception. By default this will invoke the\n registered error handlers and fall back to returning the\n exception as response.\n\n .. versionchanged:: 1.0.3\n ``RoutingException``, used internally for actions such as\n slash redirects during routing, is not passed to error\n handlers.\n\n .. versionchanged:: 1.0\n Exceptions are looked up by code *and* by MRO, so\n ``HTTPException`` subclasses can be handled with a catch-all\n handler for the base ``HTTPException``.\n\n .. versionadded:: 0.3\n \"\"\"\n # Proxy exceptions don't have error codes. We want to always return\n # those unchanged as errors\n if e.code is None:\n return e\n\n # RoutingExceptions are used internally to trigger routing\n # actions, such as slash redirects raising RequestRedirect. They\n # are not raised or handled in user code.\n if isinstance(e, RoutingException):\n return e\n\n handler = self._find_error_handler(e)\n if handler is None:\n return e\n return self.ensure_sync(handler)(e)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.trap_http_exception_Flask.trap_http_exception.return.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.trap_http_exception_Flask.trap_http_exception.return.False", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1312, "end_line": 1345, "span_ids": ["Flask.trap_http_exception"], "tokens": 277}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def trap_http_exception(self, e: Exception) -> bool:\n \"\"\"Checks if an HTTP exception should be trapped or not. By default\n this will return ``False`` for all exceptions except for a bad request\n key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to ``True``. It\n also returns ``True`` if ``TRAP_HTTP_EXCEPTIONS`` is set to ``True``.\n\n This is called for all HTTP exceptions raised by a view function.\n If it returns ``True`` for any exception the error handler for this\n exception is not called and it shows up as regular exception in the\n traceback. This is helpful for debugging implicitly raised HTTP\n exceptions.\n\n .. versionchanged:: 1.0\n Bad request errors are not trapped by default in debug mode.\n\n .. versionadded:: 0.8\n \"\"\"\n if self.config[\"TRAP_HTTP_EXCEPTIONS\"]:\n return True\n\n trap_bad_request = self.config[\"TRAP_BAD_REQUEST_ERRORS\"]\n\n # if unset, trap key errors in debug mode\n if (\n trap_bad_request is None\n and self.debug\n and isinstance(e, BadRequestKeyError)\n ):\n return True\n\n if trap_bad_request:\n return isinstance(e, BadRequest)\n\n return False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_user_exception_Flask.handle_user_exception.return.self_ensure_sync_handler_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_user_exception_Flask.handle_user_exception.return.self_ensure_sync_handler_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1331, "end_line": 1361, "span_ids": ["Flask.handle_user_exception"], "tokens": 242}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def handle_user_exception(\n self, e: Exception\n ) -> t.Union[HTTPException, ft.ResponseReturnValue]:\n \"\"\"This method is called whenever an exception occurs that\n should be handled. A special case is :class:`~werkzeug\n .exceptions.HTTPException` which is forwarded to the\n :meth:`handle_http_exception` method. This function will either\n return a response value or reraise the exception with the same\n traceback.\n\n .. versionchanged:: 1.0\n Key errors raised from request data like ``form`` show the\n bad key in debug mode rather than a generic bad request\n message.\n\n .. versionadded:: 0.7\n \"\"\"\n if isinstance(e, BadRequestKeyError) and (\n self.debug or self.config[\"TRAP_BAD_REQUEST_ERRORS\"]\n ):\n e.show_exception = True\n\n if isinstance(e, HTTPException) and not self.trap_http_exception(e):\n return self.handle_http_exception(e)\n\n handler = self._find_error_handler(e)\n\n if handler is None:\n raise\n\n return self.ensure_sync(handler)(e)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_exception_Flask.handle_exception.return.self_finalize_request_ser": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_exception_Flask.handle_exception.return.self_finalize_request_ser", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1363, "end_line": 1414, "span_ids": ["Flask.handle_exception"], "tokens": 439}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def handle_exception(self, e: Exception) -> Response:\n \"\"\"Handle an exception that did not have an error handler\n associated with it, or that was raised from an error handler.\n This always causes a 500 ``InternalServerError``.\n\n Always sends the :data:`got_request_exception` signal.\n\n If :data:`PROPAGATE_EXCEPTIONS` is ``True``, such as in debug\n mode, the error will be re-raised so that the debugger can\n display it. Otherwise, the original exception is logged, and\n an :exc:`~werkzeug.exceptions.InternalServerError` is returned.\n\n If an error handler is registered for ``InternalServerError`` or\n ``500``, it will be used. For consistency, the handler will\n always receive the ``InternalServerError``. The original\n unhandled exception is available as ``e.original_exception``.\n\n .. versionchanged:: 1.1.0\n Always passes the ``InternalServerError`` instance to the\n handler, setting ``original_exception`` to the unhandled\n error.\n\n .. versionchanged:: 1.1.0\n ``after_request`` functions and other finalization is done\n even for the default 500 response when there is no handler.\n\n .. versionadded:: 0.3\n \"\"\"\n exc_info = sys.exc_info()\n got_request_exception.send(self, exception=e)\n propagate = self.config[\"PROPAGATE_EXCEPTIONS\"]\n\n if propagate is None:\n propagate = self.testing or self.debug\n\n if propagate:\n # Re-raise if called with an active exception, otherwise\n # raise the passed in exception.\n if exc_info[1] is e:\n raise\n\n raise e\n\n self.log_exception(exc_info)\n server_error: t.Union[InternalServerError, ft.ResponseReturnValue]\n server_error = InternalServerError(original_exception=e)\n handler = self._find_error_handler(server_error)\n\n if handler is not None:\n server_error = self.ensure_sync(handler)(server_error)\n\n return self.finalize_request(server_error, from_error_handler=True)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.log_exception_Flask.log_exception.self_logger_error_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.log_exception_Flask.log_exception.self_logger_error_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1428, "end_line": 1443, "span_ids": ["Flask.log_exception"], "tokens": 138}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def log_exception(\n self,\n exc_info: t.Union[\n t.Tuple[type, BaseException, TracebackType], t.Tuple[None, None, None]\n ],\n ) -> None:\n \"\"\"Logs an exception. This is called by :meth:`handle_exception`\n if debugging is disabled and right before the handler is called.\n The default implementation logs the exception as error on the\n :attr:`logger`.\n\n .. versionadded:: 0.8\n \"\"\"\n self.logger.error(\n f\"Exception on {request.path} [{request.method}]\", exc_info=exc_info\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.raise_routing_exception_Flask.raise_routing_exception.raise_FormDataRoutingRedi": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.raise_routing_exception_Flask.raise_routing_exception.raise_FormDataRoutingRedi", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1433, "end_line": 1459, "span_ids": ["Flask.raise_routing_exception"], "tokens": 199}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def raise_routing_exception(self, request: Request) -> \"te.NoReturn\":\n \"\"\"Intercept routing exceptions and possibly do something else.\n\n In debug mode, intercept a routing redirect and replace it with\n an error if the body will be discarded.\n\n With modern Werkzeug this shouldn't occur, since it now uses a\n 308 status which tells the browser to resend the method and\n body.\n\n .. versionchanged:: 2.1\n Don't intercept 307 and 308 redirects.\n\n :meta private:\n :internal:\n \"\"\"\n if (\n not self.debug\n or not isinstance(request.routing_exception, RequestRedirect)\n or request.routing_exception.code in {307, 308}\n or request.method in {\"GET\", \"HEAD\", \"OPTIONS\"}\n ):\n raise request.routing_exception # type: ignore\n\n from .debughelpers import FormDataRoutingRedirect\n\n raise FormDataRoutingRedirect(request)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.dispatch_request_Flask.dispatch_request.return.self_ensure_sync_self_vie": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.dispatch_request_Flask.dispatch_request.return.self_ensure_sync_self_vie", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1461, "end_line": 1484, "span_ids": ["Flask.dispatch_request"], "tokens": 262}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def dispatch_request(self) -> ft.ResponseReturnValue:\n \"\"\"Does the request dispatching. Matches the URL and returns the\n return value of the view or error handler. This does not have to\n be a response object. In order to convert the return value to a\n proper response object, call :func:`make_response`.\n\n .. versionchanged:: 0.7\n This no longer does the exception handling, this code was\n moved to the new :meth:`full_dispatch_request`.\n \"\"\"\n req = request_ctx.request\n if req.routing_exception is not None:\n self.raise_routing_exception(req)\n rule: Rule = req.url_rule # type: ignore[assignment]\n # if we provide automatic options for this URL and the\n # request came with the OPTIONS method, reply automatically\n if (\n getattr(rule, \"provide_automatic_options\", False)\n and req.method == \"OPTIONS\"\n ):\n return self.make_default_options_response()\n # otherwise dispatch to the handler for that endpoint\n view_args: t.Dict[str, t.Any] = req.view_args # type: ignore[assignment]\n return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.full_dispatch_request_Flask.full_dispatch_request.return.self_finalize_request_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.full_dispatch_request_Flask.full_dispatch_request.return.self_finalize_request_rv_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1486, "end_line": 1502, "span_ids": ["Flask.full_dispatch_request"], "tokens": 120}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def full_dispatch_request(self) -> Response:\n \"\"\"Dispatches the request and on top of that performs request\n pre and postprocessing as well as HTTP exception catching and\n error handling.\n\n .. versionadded:: 0.7\n \"\"\"\n self._got_first_request = True\n\n try:\n request_started.send(self)\n rv = self.preprocess_request()\n if rv is None:\n rv = self.dispatch_request()\n except Exception as e:\n rv = self.handle_user_exception(e)\n return self.finalize_request(rv)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.finalize_request_Flask.finalize_request.return.response": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.finalize_request_Flask.finalize_request.return.response", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1504, "end_line": 1531, "span_ids": ["Flask.finalize_request"], "tokens": 218}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def finalize_request(\n self,\n rv: t.Union[ft.ResponseReturnValue, HTTPException],\n from_error_handler: bool = False,\n ) -> Response:\n \"\"\"Given the return value from a view function this finalizes\n the request by converting it into a response and invoking the\n postprocessing functions. This is invoked for both normal\n request dispatching as well as error handlers.\n\n Because this means that it might be called as a result of a\n failure a special safe mode is available which can be enabled\n with the `from_error_handler` flag. If enabled, failures in\n response processing will be logged and otherwise ignored.\n\n :internal:\n \"\"\"\n response = self.make_response(rv)\n try:\n response = self.process_response(response)\n request_finished.send(self, response=response)\n except Exception:\n if not from_error_handler:\n raise\n self.logger.exception(\n \"Request finalizing failed with an error while handling an error\"\n )\n return response", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.async_to_sync_Flask.async_to_sync.return.asgiref_async_to_sync_fun": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.async_to_sync_Flask.async_to_sync.return.asgiref_async_to_sync_fun", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1570, "end_line": 1591, "span_ids": ["Flask.async_to_sync"], "tokens": 164}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def async_to_sync(\n self, func: t.Callable[..., t.Coroutine]\n ) -> t.Callable[..., t.Any]:\n \"\"\"Return a sync function that will run the coroutine function.\n\n .. code-block:: python\n\n result = app.async_to_sync(func)(*args, **kwargs)\n\n Override this method to change how the app converts async code\n to be synchronously callable.\n\n .. versionadded:: 2.0\n \"\"\"\n try:\n from asgiref.sync import async_to_sync as asgiref_async_to_sync\n except ImportError:\n raise RuntimeError(\n \"Install Flask with the 'async' extra in order to use async views.\"\n ) from None\n\n return asgiref_async_to_sync(func)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response_Flask.make_response._make_sure_the_body_is_a": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response_Flask.make_response._make_sure_the_body_is_a", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1731, "end_line": 1819, "span_ids": ["Flask.make_response"], "tokens": 725}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_response(self, rv: ft.ResponseReturnValue) -> Response:\n \"\"\"Convert the return value from a view function to an instance of\n :attr:`response_class`.\n\n :param rv: the return value from the view function. The view function\n must return a response. Returning ``None``, or the view ending\n without returning, is not allowed. The following types are allowed\n for ``view_rv``:\n\n ``str``\n A response object is created with the string encoded to UTF-8\n as the body.\n\n ``bytes``\n A response object is created with the bytes as the body.\n\n ``dict``\n A dictionary that will be jsonify'd before being returned.\n\n ``list``\n A list that will be jsonify'd before being returned.\n\n ``generator`` or ``iterator``\n A generator that returns ``str`` or ``bytes`` to be\n streamed as the response.\n\n ``tuple``\n Either ``(body, status, headers)``, ``(body, status)``, or\n ``(body, headers)``, where ``body`` is any of the other types\n allowed here, ``status`` is a string or an integer, and\n ``headers`` is a dictionary or a list of ``(key, value)``\n tuples. If ``body`` is a :attr:`response_class` instance,\n ``status`` overwrites the exiting value and ``headers`` are\n extended.\n\n :attr:`response_class`\n The object is returned unchanged.\n\n other :class:`~werkzeug.wrappers.Response` class\n The object is coerced to :attr:`response_class`.\n\n :func:`callable`\n The function is called as a WSGI application. The result is\n used to create a response object.\n\n .. versionchanged:: 2.2\n A generator will be converted to a streaming response.\n A list will be converted to a JSON response.\n\n .. versionchanged:: 1.1\n A dict will be converted to a JSON response.\n\n .. versionchanged:: 0.9\n Previously a tuple was interpreted as the arguments for the\n response object.\n \"\"\"\n\n status = headers = None\n\n # unpack tuple returns\n if isinstance(rv, tuple):\n len_rv = len(rv)\n\n # a 3-tuple is unpacked directly\n if len_rv == 3:\n rv, status, headers = rv # type: ignore[misc]\n # decide if a 2-tuple has status or headers\n elif len_rv == 2:\n if isinstance(rv[1], (Headers, dict, tuple, list)):\n rv, headers = rv\n else:\n rv, status = rv # type: ignore[assignment,misc]\n # other sized tuples are not allowed\n else:\n raise TypeError(\n \"The view function did not return a valid response tuple.\"\n \" The tuple must have the form (body, status, headers),\"\n \" (body, status), or (body, headers).\"\n )\n\n # the body must not be None\n if rv is None:\n raise TypeError(\n f\"The view function for {request.endpoint!r} did not\"\n \" return a valid response. The function either returned\"\n \" None or ended without a return statement.\"\n )\n\n # make sure the body is an instance of the response class\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response.if_not_isinstance_rv_sel_Flask.make_response.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_response.if_not_isinstance_rv_sel_Flask.make_response.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1820, "end_line": 1869, "span_ids": ["Flask.make_response"], "tokens": 452}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_response(self, rv: ft.ResponseReturnValue) -> Response:\n # ... other code\n if not isinstance(rv, self.response_class):\n if isinstance(rv, (str, bytes, bytearray)) or isinstance(rv, _abc_Iterator):\n # let the response class set the status and headers instead of\n # waiting to do it manually, so that the class can handle any\n # special logic\n rv = self.response_class(\n rv,\n status=status,\n headers=headers, # type: ignore[arg-type]\n )\n status = headers = None\n elif isinstance(rv, (dict, list)):\n rv = self.json.response(rv)\n elif isinstance(rv, BaseResponse) or callable(rv):\n # evaluate a WSGI callable, or coerce a different response\n # class to the correct type\n try:\n rv = self.response_class.force_type(\n rv, request.environ # type: ignore[arg-type]\n )\n except TypeError as e:\n raise TypeError(\n f\"{e}\\nThe view function did not return a valid\"\n \" response. The return type must be a string,\"\n \" dict, list, tuple with headers or status,\"\n \" Response instance, or WSGI callable, but it\"\n f\" was a {type(rv).__name__}.\"\n ).with_traceback(sys.exc_info()[2]) from None\n else:\n raise TypeError(\n \"The view function did not return a valid\"\n \" response. The return type must be a string,\"\n \" dict, list, tuple with headers or status,\"\n \" Response instance, or WSGI callable, but it was a\"\n f\" {type(rv).__name__}.\"\n )\n\n rv = t.cast(Response, rv)\n # prefer the status if it was provided\n if status is not None:\n if isinstance(status, (str, bytes, bytearray)):\n rv.status = status\n else:\n rv.status_code = status\n\n # extend existing headers with provided headers\n if headers:\n rv.headers.update(headers) # type: ignore[arg-type]\n\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_url_adapter_Flask.create_url_adapter.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_url_adapter_Flask.create_url_adapter.return.None", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1735, "end_line": 1775, "span_ids": ["Flask.create_url_adapter"], "tokens": 338}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def create_url_adapter(\n self, request: t.Optional[Request]\n ) -> t.Optional[MapAdapter]:\n \"\"\"Creates a URL adapter for the given request. The URL adapter\n is created at a point where the request context is not yet set\n up so the request is passed explicitly.\n\n .. versionadded:: 0.6\n\n .. versionchanged:: 0.9\n This can now also be called without a request object when the\n URL adapter is created for the application context.\n\n .. versionchanged:: 1.0\n :data:`SERVER_NAME` no longer implicitly enables subdomain\n matching. Use :attr:`subdomain_matching` instead.\n \"\"\"\n if request is not None:\n # If subdomain matching is disabled (the default), use the\n # default subdomain in all cases. This should be the default\n # in Werkzeug but it currently does not have that feature.\n if not self.subdomain_matching:\n subdomain = self.url_map.default_subdomain or None\n else:\n subdomain = None\n\n return self.url_map.bind_to_environ(\n request.environ,\n server_name=self.config[\"SERVER_NAME\"],\n subdomain=subdomain,\n )\n # We need at the very least the server name to be set for this\n # to work.\n if self.config[\"SERVER_NAME\"] is not None:\n return self.url_map.bind(\n self.config[\"SERVER_NAME\"],\n script_name=self.config[\"APPLICATION_ROOT\"],\n url_scheme=self.config[\"PREFERRED_URL_SCHEME\"],\n )\n\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_url_build_error_Flask.handle_url_build_error.raise_error": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.handle_url_build_error_Flask.handle_url_build_error.raise_error", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1934, "end_line": 1966, "span_ids": ["Flask.handle_url_build_error"], "tokens": 292}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def handle_url_build_error(\n self, error: BuildError, endpoint: str, values: t.Dict[str, t.Any]\n ) -> str:\n \"\"\"Called by :meth:`.url_for` if a\n :exc:`~werkzeug.routing.BuildError` was raised. If this returns\n a value, it will be returned by ``url_for``, otherwise the error\n will be re-raised.\n\n Each function in :attr:`url_build_error_handlers` is called with\n ``error``, ``endpoint`` and ``values``. If a function returns\n ``None`` or raises a ``BuildError``, it is skipped. Otherwise,\n its return value is returned by ``url_for``.\n\n :param error: The active ``BuildError`` being handled.\n :param endpoint: The endpoint being built.\n :param values: The keyword arguments passed to ``url_for``.\n \"\"\"\n for handler in self.url_build_error_handlers:\n try:\n rv = handler(error, endpoint, values)\n except BuildError as e:\n # make error available outside except block\n error = e\n else:\n if rv is not None:\n return rv\n\n # Re-raise if called with an active exception, otherwise raise\n # the passed in exception.\n if error is sys.exc_info()[1]:\n raise\n\n raise error", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.preprocess_request_Flask.preprocess_request.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.preprocess_request_Flask.preprocess_request.return.None", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1968, "end_line": 1993, "span_ids": ["Flask.preprocess_request"], "tokens": 217}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def preprocess_request(self) -> t.Optional[ft.ResponseReturnValue]:\n \"\"\"Called before the request is dispatched. Calls\n :attr:`url_value_preprocessors` registered with the app and the\n current blueprint (if any). Then calls :attr:`before_request_funcs`\n registered with the app and the blueprint.\n\n If any :meth:`before_request` handler returns a non-None value, the\n value is handled as if it was the return value from the view, and\n further request handling is stopped.\n \"\"\"\n names = (None, *reversed(request.blueprints))\n\n for name in names:\n if name in self.url_value_preprocessors:\n for url_func in self.url_value_preprocessors[name]:\n url_func(request.endpoint, request.view_args)\n\n for name in names:\n if name in self.before_request_funcs:\n for before_func in self.before_request_funcs[name]:\n rv = self.ensure_sync(before_func)()\n\n if rv is not None:\n return rv\n\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.process_response_Flask.process_response.return.response": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.process_response_Flask.process_response.return.response", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1995, "end_line": 2021, "span_ids": ["Flask.process_response"], "tokens": 248}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def process_response(self, response: Response) -> Response:\n \"\"\"Can be overridden in order to modify the response object\n before it's sent to the WSGI server. By default this will\n call all the :meth:`after_request` decorated functions.\n\n .. versionchanged:: 0.5\n As of Flask 0.5 the functions registered for after request\n execution are called in reverse order of registration.\n\n :param response: a :attr:`response_class` object.\n :return: a new response object or the same, has to be an\n instance of :attr:`response_class`.\n \"\"\"\n ctx = request_ctx._get_current_object() # type: ignore[attr-defined]\n\n for func in ctx._after_request_functions:\n response = self.ensure_sync(func)(response)\n\n for name in chain(request.blueprints, (None,)):\n if name in self.after_request_funcs:\n for func in reversed(self.after_request_funcs[name]):\n response = self.ensure_sync(func)(response)\n\n if not self.session_interface.is_null_session(ctx.session):\n self.session_interface.save_session(self, ctx.session, response)\n\n return response", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_request_Flask.do_teardown_request.request_tearing_down_send": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_request_Flask.do_teardown_request.request_tearing_down_send", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 2023, "end_line": 2054, "span_ids": ["Flask.do_teardown_request"], "tokens": 278}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def do_teardown_request(\n self, exc: t.Optional[BaseException] = _sentinel # type: ignore\n ) -> None:\n \"\"\"Called after the request is dispatched and the response is\n returned, right before the request context is popped.\n\n This calls all functions decorated with\n :meth:`teardown_request`, and :meth:`Blueprint.teardown_request`\n if a blueprint handled the request. Finally, the\n :data:`request_tearing_down` signal is sent.\n\n This is called by\n :meth:`RequestContext.pop() `,\n which may be delayed during testing to maintain access to\n resources.\n\n :param exc: An unhandled exception raised while dispatching the\n request. Detected from the current exception information if\n not passed. Passed to each teardown function.\n\n .. versionchanged:: 0.9\n Added the ``exc`` argument.\n \"\"\"\n if exc is _sentinel:\n exc = sys.exc_info()[1]\n\n for name in chain(request.blueprints, (None,)):\n if name in self.teardown_request_funcs:\n for func in reversed(self.teardown_request_funcs[name]):\n self.ensure_sync(func)(exc)\n\n request_tearing_down.send(self, exc=exc)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_appcontext_Flask.do_teardown_appcontext.appcontext_tearing_down_s": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.do_teardown_appcontext_Flask.do_teardown_appcontext.appcontext_tearing_down_s", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 2056, "end_line": 2079, "span_ids": ["Flask.do_teardown_appcontext"], "tokens": 196}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def do_teardown_appcontext(\n self, exc: t.Optional[BaseException] = _sentinel # type: ignore\n ) -> None:\n \"\"\"Called right before the application context is popped.\n\n When handling a request, the application context is popped\n after the request context. See :meth:`do_teardown_request`.\n\n This calls all functions decorated with\n :meth:`teardown_appcontext`. Then the\n :data:`appcontext_tearing_down` signal is sent.\n\n This is called by\n :meth:`AppContext.pop() `.\n\n .. versionadded:: 0.9\n \"\"\"\n if exc is _sentinel:\n exc = sys.exc_info()[1]\n\n for func in reversed(self.teardown_appcontext_funcs):\n self.ensure_sync(func)(exc)\n\n appcontext_tearing_down.send(self, exc=exc)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.app_context_Flask.app_context.return.AppContext_self_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.app_context_Flask.app_context.return.AppContext_self_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1929, "end_line": 1948, "span_ids": ["Flask.app_context"], "tokens": 148}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def app_context(self) -> AppContext:\n \"\"\"Create an :class:`~flask.ctx.AppContext`. Use as a ``with``\n block to push the context, which will make :data:`current_app`\n point at this application.\n\n An application context is automatically pushed by\n :meth:`RequestContext.push() `\n when handling a request, and when running a CLI command. Use\n this to manually create a context outside of these situations.\n\n ::\n\n with app.app_context():\n init_db()\n\n See :doc:`/appcontext`.\n\n .. versionadded:: 0.9\n \"\"\"\n return AppContext(self)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.request_context_Flask.request_context.return.RequestContext_self_envi": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.request_context_Flask.request_context.return.RequestContext_self_envi", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1950, "end_line": 1964, "span_ids": ["Flask.request_context"], "tokens": 151}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def request_context(self, environ: dict) -> RequestContext:\n \"\"\"Create a :class:`~flask.ctx.RequestContext` representing a\n WSGI environment. Use a ``with`` block to push the context,\n which will make :data:`request` point at this request.\n\n See :doc:`/reqcontext`.\n\n Typically you should not call this from your own code. A request\n context is automatically pushed by the :meth:`wsgi_app` when\n handling a request. Use :meth:`test_request_context` to create\n an environment and context instead of this method.\n\n :param environ: a WSGI environment\n \"\"\"\n return RequestContext(self, environ)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_request_context_Flask.test_request_context.try_.finally_.builder_close_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.test_request_context_Flask.test_request_context.try_.finally_.builder_close_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 2118, "end_line": 2172, "span_ids": ["Flask.test_request_context"], "tokens": 497}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def test_request_context(self, *args: t.Any, **kwargs: t.Any) -> RequestContext:\n \"\"\"Create a :class:`~flask.ctx.RequestContext` for a WSGI\n environment created from the given values. This is mostly useful\n during testing, where you may want to run a function that uses\n request data without dispatching a full request.\n\n See :doc:`/reqcontext`.\n\n Use a ``with`` block to push the context, which will make\n :data:`request` point at the request for the created\n environment. ::\n\n with app.test_request_context(...):\n generate_report()\n\n When using the shell, it may be easier to push and pop the\n context manually to avoid indentation. ::\n\n ctx = app.test_request_context(...)\n ctx.push()\n ...\n ctx.pop()\n\n Takes the same arguments as Werkzeug's\n :class:`~werkzeug.test.EnvironBuilder`, with some defaults from\n the application. See the linked Werkzeug docs for most of the\n available arguments. Flask-specific behavior is listed here.\n\n :param path: URL path being requested.\n :param base_url: Base URL where the app is being served, which\n ``path`` is relative to. If not given, built from\n :data:`PREFERRED_URL_SCHEME`, ``subdomain``,\n :data:`SERVER_NAME`, and :data:`APPLICATION_ROOT`.\n :param subdomain: Subdomain name to append to\n :data:`SERVER_NAME`.\n :param url_scheme: Scheme to use instead of\n :data:`PREFERRED_URL_SCHEME`.\n :param data: The request body, either as a string or a dict of\n form keys and values.\n :param json: If given, this is serialized as JSON and passed as\n ``data``. Also defaults ``content_type`` to\n ``application/json``.\n :param args: other positional arguments passed to\n :class:`~werkzeug.test.EnvironBuilder`.\n :param kwargs: other keyword arguments passed to\n :class:`~werkzeug.test.EnvironBuilder`.\n \"\"\"\n from .testing import EnvironBuilder\n\n builder = EnvironBuilder(self, *args, **kwargs)\n\n try:\n return self.request_context(builder.get_environ())\n finally:\n builder.close()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState_BlueprintSetupState.__init__.self_url_defaults_update_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState_BlueprintSetupState.__init__.self_url_defaults_update_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 32, "end_line": 83, "span_ids": ["BlueprintSetupState"], "tokens": 412}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class BlueprintSetupState:\n \"\"\"Temporary holder object for registering a blueprint with the\n application. An instance of this class is created by the\n :meth:`~flask.Blueprint.make_setup_state` method and later passed\n to all register callback functions.\n \"\"\"\n\n def __init__(\n self,\n blueprint: \"Blueprint\",\n app: \"Flask\",\n options: t.Any,\n first_registration: bool,\n ) -> None:\n #: a reference to the current application\n self.app = app\n\n #: a reference to the blueprint that created this setup state.\n self.blueprint = blueprint\n\n #: a dictionary with all options that were passed to the\n #: :meth:`~flask.Flask.register_blueprint` method.\n self.options = options\n\n #: as blueprints can be registered multiple times with the\n #: application and not everything wants to be registered\n #: multiple times on it, this attribute can be used to figure\n #: out if the blueprint was registered in the past already.\n self.first_registration = first_registration\n\n subdomain = self.options.get(\"subdomain\")\n if subdomain is None:\n subdomain = self.blueprint.subdomain\n\n #: The subdomain that the blueprint should be active for, ``None``\n #: otherwise.\n self.subdomain = subdomain\n\n url_prefix = self.options.get(\"url_prefix\")\n if url_prefix is None:\n url_prefix = self.blueprint.url_prefix\n #: The prefix that should be used for all URLs defined on the\n #: blueprint.\n self.url_prefix = url_prefix\n\n self.name = self.options.get(\"name\", blueprint.name)\n self.name_prefix = self.options.get(\"name_prefix\", \"\")\n\n #: A dictionary with URL defaults that is added to each and every\n #: URL that was defined with the blueprint.\n self.url_defaults = dict(self.blueprint.url_values_defaults)\n self.url_defaults.update(self.options.get(\"url_defaults\", ()))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState.add_url_rule_BlueprintSetupState.add_url_rule.self_app_add_url_rule_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_BlueprintSetupState.add_url_rule_BlueprintSetupState.add_url_rule.self_app_add_url_rule_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 85, "end_line": 114, "span_ids": ["BlueprintSetupState.add_url_rule"], "tokens": 235}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class BlueprintSetupState:\n\n def add_url_rule(\n self,\n rule: str,\n endpoint: t.Optional[str] = None,\n view_func: t.Optional[t.Callable] = None,\n **options: t.Any,\n ) -> None:\n \"\"\"A helper method to register a rule (and optionally a view function)\n to the application. The endpoint is automatically prefixed with the\n blueprint's name.\n \"\"\"\n if self.url_prefix is not None:\n if rule:\n rule = \"/\".join((self.url_prefix.rstrip(\"/\"), rule.lstrip(\"/\")))\n else:\n rule = self.url_prefix\n options.setdefault(\"subdomain\", self.subdomain)\n if endpoint is None:\n endpoint = _endpoint_from_view_func(view_func) # type: ignore\n defaults = self.url_defaults\n if \"defaults\" in options:\n defaults = dict(defaults, **options.pop(\"defaults\"))\n\n self.app.add_url_rule(\n rule,\n f\"{self.name_prefix}.{self.name}.{endpoint}\".lstrip(\".\"),\n view_func,\n defaults=defaults,\n **options,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_filter_Blueprint.app_template_filter.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_filter_Blueprint.app_template_filter.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 435, "end_line": 450, "span_ids": ["Blueprint.app_template_filter"], "tokens": 128}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def app_template_filter(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_filter], T_template_filter]:\n \"\"\"Register a template filter, available in any template rendered by the\n application. Equivalent to :meth:`.Flask.template_filter`.\n\n :param name: the optional name of the filter, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_filter) -> T_template_filter:\n self.add_app_template_filter(f, name=name)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_filter_Blueprint.add_app_template_filter.self_record_once_register": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_filter_Blueprint.add_app_template_filter.self_record_once_register", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 452, "end_line": 467, "span_ids": ["Blueprint.add_app_template_filter"], "tokens": 146}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def add_app_template_filter(\n self, f: ft.TemplateFilterCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a template filter, available in any template rendered by the\n application. Works like the :meth:`app_template_filter` decorator. Equivalent to\n :meth:`.Flask.add_template_filter`.\n\n :param name: the optional name of the filter, otherwise the\n function name will be used.\n \"\"\"\n\n def register_template(state: BlueprintSetupState) -> None:\n state.app.jinja_env.filters[name or f.__name__] = f\n\n self.record_once(register_template)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_test_Blueprint.app_template_test.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_test_Blueprint.app_template_test.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 469, "end_line": 486, "span_ids": ["Blueprint.app_template_test"], "tokens": 138}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def app_template_test(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_test], T_template_test]:\n \"\"\"Register a template test, available in any template rendered by the\n application. Equivalent to :meth:`.Flask.template_test`.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the test, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_test) -> T_template_test:\n self.add_app_template_test(f, name=name)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_test_Blueprint.add_app_template_test.self_record_once_register": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_test_Blueprint.add_app_template_test.self_record_once_register", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 488, "end_line": 505, "span_ids": ["Blueprint.add_app_template_test"], "tokens": 156}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def add_app_template_test(\n self, f: ft.TemplateTestCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a template test, available in any template rendered by the\n application. Works like the :meth:`app_template_test` decorator. Equivalent to\n :meth:`.Flask.add_template_test`.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the test, otherwise the\n function name will be used.\n \"\"\"\n\n def register_template(state: BlueprintSetupState) -> None:\n state.app.jinja_env.tests[name or f.__name__] = f\n\n self.record_once(register_template)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_global_Blueprint.app_template_global.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_template_global_Blueprint.app_template_global.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 507, "end_line": 524, "span_ids": ["Blueprint.app_template_global"], "tokens": 138}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def app_template_global(\n self, name: t.Optional[str] = None\n ) -> t.Callable[[T_template_global], T_template_global]:\n \"\"\"Register a template global, available in any template rendered by the\n application. Equivalent to :meth:`.Flask.template_global`.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the global, otherwise the\n function name will be used.\n \"\"\"\n\n def decorator(f: T_template_global) -> T_template_global:\n self.add_app_template_global(f, name=name)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_global_Blueprint.add_app_template_global.self_record_once_register": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_app_template_global_Blueprint.add_app_template_global.self_record_once_register", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 526, "end_line": 543, "span_ids": ["Blueprint.add_app_template_global"], "tokens": 157}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def add_app_template_global(\n self, f: ft.TemplateGlobalCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a template global, available in any template rendered by the\n application. Works like the :meth:`app_template_global` decorator. Equivalent to\n :meth:`.Flask.add_template_global`.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the global, otherwise the\n function name will be used.\n \"\"\"\n\n def register_template(state: BlueprintSetupState) -> None:\n state.app.jinja_env.globals[name or f.__name__] = f\n\n self.record_once(register_template)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_best_app_find_best_app.raise_NoAppException_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_best_app_find_best_app.raise_NoAppException_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 32, "end_line": 82, "span_ids": ["find_best_app"], "tokens": 370}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def find_best_app(module):\n \"\"\"Given a module instance this tries to find the best possible\n application in the module or raises an exception.\n \"\"\"\n from . import Flask\n\n # Search for the most common names first.\n for attr_name in (\"app\", \"application\"):\n app = getattr(module, attr_name, None)\n\n if isinstance(app, Flask):\n return app\n\n # Otherwise find the only object that is a Flask instance.\n matches = [v for v in module.__dict__.values() if isinstance(v, Flask)]\n\n if len(matches) == 1:\n return matches[0]\n elif len(matches) > 1:\n raise NoAppException(\n \"Detected multiple Flask applications in module\"\n f\" '{module.__name__}'. Use '{module.__name__}:name'\"\n \" to specify the correct one.\"\n )\n\n # Search for app factory functions.\n for attr_name in (\"create_app\", \"make_app\"):\n app_factory = getattr(module, attr_name, None)\n\n if inspect.isfunction(app_factory):\n try:\n app = app_factory()\n\n if isinstance(app, Flask):\n return app\n except TypeError as e:\n if not _called_with_wrong_args(app_factory):\n raise\n\n raise NoAppException(\n f\"Detected factory '{attr_name}' in module '{module.__name__}',\"\n \" but could not call it without arguments. Use\"\n f\" '{module.__name__}:{attr_name}(args)'\"\n \" to specify arguments.\"\n ) from e\n\n raise NoAppException(\n \"Failed to find Flask application or factory in module\"\n f\" '{module.__name__}'. Use '{module.__name__}:name'\"\n \" to specify one.\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__called_with_wrong_args__called_with_wrong_args.try_.finally_.del_tb": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__called_with_wrong_args__called_with_wrong_args.try_.finally_.del_tb", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 122, "end_line": 145, "span_ids": ["_called_with_wrong_args"], "tokens": 162}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _called_with_wrong_args(f):\n \"\"\"Check whether calling a function raised a ``TypeError`` because\n the call failed or because something in the factory raised the\n error.\n\n :param f: The function that was called.\n :return: ``True`` if the call failed.\n \"\"\"\n tb = sys.exc_info()[2]\n\n try:\n while tb is not None:\n if tb.tb_frame.f_code is f.__code__:\n # In the function, it was called successfully.\n return False\n\n tb = tb.tb_next\n\n # Didn't reach the function.\n return True\n finally:\n # Delete tb to break a circular reference.\n # https://docs.python.org/2/library/sys.html#sys.exc_info\n del tb", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_app_by_string_find_app_by_string.raise_NoAppException_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_find_app_by_string_find_app_by_string.raise_NoAppException_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 111, "end_line": 184, "span_ids": ["find_app_by_string"], "tokens": 562}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def find_app_by_string(module, app_name):\n \"\"\"Check if the given string is a variable name or a function. Call\n a function to get the app instance, or return the variable directly.\n \"\"\"\n from . import Flask\n\n # Parse app_name as a single expression to determine if it's a valid\n # attribute name or function call.\n try:\n expr = ast.parse(app_name.strip(), mode=\"eval\").body\n except SyntaxError:\n raise NoAppException(\n f\"Failed to parse {app_name!r} as an attribute name or function call.\"\n ) from None\n\n if isinstance(expr, ast.Name):\n name = expr.id\n args = []\n kwargs = {}\n elif isinstance(expr, ast.Call):\n # Ensure the function name is an attribute name only.\n if not isinstance(expr.func, ast.Name):\n raise NoAppException(\n f\"Function reference must be a simple name: {app_name!r}.\"\n )\n\n name = expr.func.id\n\n # Parse the positional and keyword arguments as literals.\n try:\n args = [ast.literal_eval(arg) for arg in expr.args]\n kwargs = {kw.arg: ast.literal_eval(kw.value) for kw in expr.keywords}\n except ValueError:\n # literal_eval gives cryptic error messages, show a generic\n # message with the full expression instead.\n raise NoAppException(\n f\"Failed to parse arguments as literal values: {app_name!r}.\"\n ) from None\n else:\n raise NoAppException(\n f\"Failed to parse {app_name!r} as an attribute name or function call.\"\n )\n\n try:\n attr = getattr(module, name)\n except AttributeError as e:\n raise NoAppException(\n f\"Failed to find attribute {name!r} in {module.__name__!r}.\"\n ) from e\n\n # If the attribute is a function, call it with any args and kwargs\n # to get the real application.\n if inspect.isfunction(attr):\n try:\n app = attr(*args, **kwargs)\n except TypeError as e:\n if not _called_with_wrong_args(attr):\n raise\n\n raise NoAppException(\n f\"The factory {app_name!r} in module\"\n f\" {module.__name__!r} could not be called with the\"\n \" specified arguments.\"\n ) from e\n else:\n app = attr\n\n if isinstance(app, Flask):\n return app\n\n raise NoAppException(\n \"A valid Flask application was not obtained from\"\n f\" '{module.__name__}:{app_name}'.\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_prepare_import_prepare_import.return._join_module_name_1": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_prepare_import_prepare_import.return._join_module_name_1", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 223, "end_line": 249, "span_ids": ["prepare_import"], "tokens": 177}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def prepare_import(path):\n \"\"\"Given a filename this will try to calculate the python path, add it\n to the search path and return the actual module name that is expected.\n \"\"\"\n path = os.path.realpath(path)\n\n fname, ext = os.path.splitext(path)\n if ext == \".py\":\n path = fname\n\n if os.path.basename(path) == \"__init__\":\n path = os.path.dirname(path)\n\n module_name = []\n\n # move up until outside package structure (no __init__.py)\n while True:\n path, name = os.path.split(path)\n module_name.append(name)\n\n if not os.path.exists(os.path.join(path, \"__init__.py\")):\n break\n\n if sys.path[0] != path:\n sys.path.insert(0, path)\n\n return \".\".join(module_name[::-1])", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_get_version_version_option.click_Option_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_get_version_version_option.click_Option_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 240, "end_line": 263, "span_ids": ["impl:2", "get_version"], "tokens": 129}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_version(ctx, param, value):\n if not value or ctx.resilient_parsing:\n return\n\n import werkzeug\n from . import __version__\n\n click.echo(\n f\"Python {platform.python_version()}\\n\"\n f\"Flask {__version__}\\n\"\n f\"Werkzeug {werkzeug.__version__}\",\n color=ctx.color,\n )\n ctx.exit()\n\n\nversion_option = click.Option(\n [\"--version\"],\n help=\"Show the Flask version.\",\n expose_value=False,\n callback=get_version,\n is_flag=True,\n is_eager=True,\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo_ScriptInfo.__init__.self._loaded_app.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo_ScriptInfo.__init__.self._loaded_app.None", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 266, "end_line": 290, "span_ids": ["ScriptInfo"], "tokens": 246}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class ScriptInfo:\n \"\"\"Helper object to deal with Flask applications. This is usually not\n necessary to interface with as it's used internally in the dispatching\n to click. In future versions of Flask this object will most likely play\n a bigger role. Typically it's created automatically by the\n :class:`FlaskGroup` but you can also manually create it and pass it\n onwards as click object.\n \"\"\"\n\n def __init__(\n self,\n app_import_path: str | None = None,\n create_app: t.Callable[..., Flask] | None = None,\n set_debug_flag: bool = True,\n ) -> None:\n #: Optionally the import path for the Flask application.\n self.app_import_path = app_import_path\n #: Optionally a function that is passed the script info to create\n #: the instance of the application.\n self.create_app = create_app\n #: A dictionary with arbitrary data that can be associated with\n #: this script info.\n self.data: t.Dict[t.Any, t.Any] = {}\n self.set_debug_flag = set_debug_flag\n self._loaded_app: Flask | None = None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo.load_app_ScriptInfo.load_app.return.app": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_ScriptInfo.load_app_ScriptInfo.load_app.return.app", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 292, "end_line": 331, "span_ids": ["ScriptInfo.load_app"], "tokens": 310}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class ScriptInfo:\n\n def load_app(self) -> Flask:\n \"\"\"Loads the Flask app (if not yet loaded) and returns it. Calling\n this multiple times will just result in the already loaded app to\n be returned.\n \"\"\"\n if self._loaded_app is not None:\n return self._loaded_app\n\n if self.create_app is not None:\n app = self.create_app()\n else:\n if self.app_import_path:\n path, name = (\n re.split(r\":(?![\\\\/])\", self.app_import_path, 1) + [None]\n )[:2]\n import_name = prepare_import(path)\n app = locate_app(import_name, name)\n else:\n for path in (\"wsgi.py\", \"app.py\"):\n import_name = prepare_import(path)\n app = locate_app(import_name, None, raise_if_not_found=False)\n\n if app:\n break\n\n if not app:\n raise NoAppException(\n \"Could not locate a Flask application. Use the\"\n \" 'flask --app' option, 'FLASK_APP' environment\"\n \" variable, or a 'wsgi.py' or 'app.py' file in the\"\n \" current directory.\"\n )\n\n if self.set_debug_flag:\n # Update the app's debug flag through the descriptor so that\n # other values repopulate as well.\n app.debug = get_debug_flag()\n\n self._loaded_app = app\n return app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_pass_script_info_with_appcontext.return.update_wrapper_decorator_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_pass_script_info_with_appcontext.return.update_wrapper_decorator_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 334, "end_line": 359, "span_ids": ["with_appcontext", "impl:4"], "tokens": 203}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "pass_script_info = click.make_pass_decorator(ScriptInfo, ensure=True)\n\n\ndef with_appcontext(f):\n \"\"\"Wraps a callback so that it's guaranteed to be executed with the\n script's application context.\n\n Custom commands (and their options) registered under ``app.cli`` or\n ``blueprint.cli`` will always have an app context available, this\n decorator is not required in that case.\n\n .. versionchanged:: 2.2\n The app context is active for subcommands as well as the\n decorated callback. The app context is always available to\n ``app.cli`` command and parameter callbacks.\n \"\"\"\n\n @click.pass_context\n def decorator(__ctx, *args, **kwargs):\n if not current_app:\n app = __ctx.ensure_object(ScriptInfo).load_app()\n __ctx.with_resource(app.app_context())\n\n return __ctx.invoke(f, *args, **kwargs)\n\n return update_wrapper(decorator, f)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_AppGroup_AppGroup.group.return.click_Group_group_self_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_AppGroup_AppGroup.group.return.click_Group_group_self_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 445, "end_line": 473, "span_ids": ["AppGroup.command", "AppGroup", "AppGroup.group"], "tokens": 255}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class AppGroup(click.Group):\n \"\"\"This works similar to a regular click :class:`~click.Group` but it\n changes the behavior of the :meth:`command` decorator so that it\n automatically wraps the functions in :func:`with_appcontext`.\n\n Not to be confused with :class:`FlaskGroup`.\n \"\"\"\n\n def command(self, *args, **kwargs):\n \"\"\"This works exactly like the method of the same name on a regular\n :class:`click.Group` but it wraps callbacks in :func:`with_appcontext`\n unless it's disabled by passing ``with_appcontext=False``.\n \"\"\"\n wrap_for_ctx = kwargs.pop(\"with_appcontext\", True)\n\n def decorator(f):\n if wrap_for_ctx:\n f = with_appcontext(f)\n return click.Group.command(self, *args, **kwargs)(f)\n\n return decorator\n\n def group(self, *args, **kwargs):\n \"\"\"This works exactly like the method of the same name on a regular\n :class:`click.Group` but it defaults the group class to\n :class:`AppGroup`.\n \"\"\"\n kwargs.setdefault(\"cls\", AppGroup)\n return click.Group.group(self, *args, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.list_commands_FlaskGroup.list_commands.return.sorted_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.list_commands_FlaskGroup.list_commands.return.sorted_rv_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 556, "end_line": 575, "span_ids": ["FlaskGroup.list_commands"], "tokens": 192}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskGroup(AppGroup):\n\n def list_commands(self, ctx):\n self._load_plugin_commands()\n # Start with the built-in and plugin commands.\n rv = set(super().list_commands(ctx))\n info = ctx.ensure_object(ScriptInfo)\n\n # Add commands provided by the app, showing an error and\n # continuing if the app couldn't be loaded.\n try:\n rv.update(info.load_app().cli.list_commands(ctx))\n except NoAppException as e:\n # When an app couldn't be loaded, show the error message\n # without the traceback.\n click.secho(f\"Error: {e.format_message()}\\n\", err=True, fg=\"red\")\n except Exception:\n # When any other errors occurred during loading, show the\n # full traceback.\n click.secho(f\"{traceback.format_exc()}\\n\", err=True, fg=\"red\")\n\n return sorted(rv)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__validate_key_SeparatedPathType.convert.return._super_convert_item_para": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__validate_key_SeparatedPathType.convert.return._super_convert_item_para", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 775, "end_line": 821, "span_ids": ["_validate_key", "SeparatedPathType", "SeparatedPathType.convert"], "tokens": 355}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _validate_key(ctx, param, value):\n \"\"\"The ``--key`` option must be specified when ``--cert`` is a file.\n Modifies the ``cert`` param to be a ``(cert, key)`` pair if needed.\n \"\"\"\n cert = ctx.params.get(\"cert\")\n is_adhoc = cert == \"adhoc\"\n\n try:\n import ssl\n except ImportError:\n is_context = False\n else:\n is_context = isinstance(cert, ssl.SSLContext)\n\n if value is not None:\n if is_adhoc:\n raise click.BadParameter(\n 'When \"--cert\" is \"adhoc\", \"--key\" is not used.', ctx, param\n )\n\n if is_context:\n raise click.BadParameter(\n 'When \"--cert\" is an SSLContext object, \"--key is not used.', ctx, param\n )\n\n if not cert:\n raise click.BadParameter('\"--cert\" must also be specified.', ctx, param)\n\n ctx.params[\"cert\"] = cert, value\n\n else:\n if cert and not (is_adhoc or is_context):\n raise click.BadParameter('Required when using \"--cert\".', ctx, param)\n\n return value\n\n\nclass SeparatedPathType(click.Path):\n \"\"\"Click option type that accepts a list of values separated by the\n OS's path separator (``:``, ``;`` on Windows). Each value is\n validated as a :class:`click.Path` type.\n \"\"\"\n\n def convert(self, value, param, ctx):\n items = self.split_envvar_value(value)\n super_convert = super().convert\n return [super_convert(item, param, ctx) for item in items]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_run_command.run_simple_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_run_command.run_simple_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 824, "end_line": 933, "span_ids": ["run_command"], "tokens": 664}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@click.command(\"run\", short_help=\"Run a development server.\")\n@click.option(\"--host\", \"-h\", default=\"127.0.0.1\", help=\"The interface to bind to.\")\n@click.option(\"--port\", \"-p\", default=5000, help=\"The port to bind to.\")\n@click.option(\n \"--cert\",\n type=CertParamType(),\n help=\"Specify a certificate file to use HTTPS.\",\n is_eager=True,\n)\n@click.option(\n \"--key\",\n type=click.Path(exists=True, dir_okay=False, resolve_path=True),\n callback=_validate_key,\n expose_value=False,\n help=\"The key file to use when specifying a certificate.\",\n)\n@click.option(\n \"--reload/--no-reload\",\n default=None,\n help=\"Enable or disable the reloader. By default the reloader \"\n \"is active if debug is enabled.\",\n)\n@click.option(\n \"--debugger/--no-debugger\",\n default=None,\n help=\"Enable or disable the debugger. By default the debugger \"\n \"is active if debug is enabled.\",\n)\n@click.option(\n \"--with-threads/--without-threads\",\n default=True,\n help=\"Enable or disable multithreading.\",\n)\n@click.option(\n \"--extra-files\",\n default=None,\n type=SeparatedPathType(),\n help=(\n \"Extra files that trigger a reload on change. Multiple paths\"\n f\" are separated by {os.path.pathsep!r}.\"\n ),\n)\n@click.option(\n \"--exclude-patterns\",\n default=None,\n type=SeparatedPathType(),\n help=(\n \"Files matching these fnmatch patterns will not trigger a reload\"\n \" on change. Multiple patterns are separated by\"\n f\" {os.path.pathsep!r}.\"\n ),\n)\n@pass_script_info\ndef run_command(\n info,\n host,\n port,\n reload,\n debugger,\n with_threads,\n cert,\n extra_files,\n exclude_patterns,\n):\n \"\"\"Run a local development server.\n\n This server is for development purposes only. It does not provide\n the stability, security, or performance of production WSGI servers.\n\n The reloader and debugger are enabled by default with the '--debug'\n option.\n \"\"\"\n try:\n app = info.load_app()\n except Exception as e:\n if is_running_from_reloader():\n # When reloading, print out the error immediately, but raise\n # it later so the debugger or server can handle it.\n traceback.print_exc()\n err = e\n\n def app(environ, start_response):\n raise err from None\n\n else:\n # When not reloading, raise the error immediately so the\n # command fails.\n raise e from None\n\n debug = get_debug_flag()\n\n if reload is None:\n reload = debug\n\n if debugger is None:\n debugger = debug\n\n show_server_banner(debug, info.app_import_path)\n\n run_simple(\n host,\n port,\n app,\n use_reloader=reload,\n use_debugger=debugger,\n threaded=with_threads,\n ssl_context=cert,\n extra_files=extra_files,\n exclude_patterns=exclude_patterns,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_errno_ConfigAttribute.__set__.obj_config_self___name___": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_errno_ConfigAttribute.__set__.obj_config_self___name___", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 26, "span_ids": ["ConfigAttribute.__set__", "ConfigAttribute", "imports", "ConfigAttribute.__get__"], "tokens": 175}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import errno\nimport json\nimport os\nimport types\nimport typing as t\n\nfrom werkzeug.utils import import_string\n\n\nclass ConfigAttribute:\n \"\"\"Makes an attribute forward to the config\"\"\"\n\n def __init__(self, name: str, get_converter: t.Optional[t.Callable] = None) -> None:\n self.__name__ = name\n self.get_converter = get_converter\n\n def __get__(self, obj: t.Any, owner: t.Any = None) -> t.Any:\n if obj is None:\n return self\n rv = obj.config[self.__name__]\n if self.get_converter is not None:\n rv = self.get_converter(rv)\n return rv\n\n def __set__(self, obj: t.Any, value: t.Any) -> None:\n obj.config[self.__name__] = value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config_Config.__init__.self.root_path.root_path": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config_Config.__init__.self.root_path.root_path", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 29, "end_line": 75, "span_ids": ["Config"], "tokens": 406}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n \"\"\"Works exactly like a dict but provides ways to fill it from files\n or special dictionaries. There are two common patterns to populate the\n config.\n\n Either you can fill the config from a config file::\n\n app.config.from_pyfile('yourconfig.cfg')\n\n Or alternatively you can define the configuration options in the\n module that calls :meth:`from_object` or provide an import path to\n a module that should be loaded. It is also possible to tell it to\n use the same module and with that provide the configuration values\n just before the call::\n\n DEBUG = True\n SECRET_KEY = 'development key'\n app.config.from_object(__name__)\n\n In both cases (loading from any Python file or loading from modules),\n only uppercase keys are added to the config. This makes it possible to use\n lowercase values in the config file for temporary values that are not added\n to the config or to define the config keys in the same file that implements\n the application.\n\n Probably the most interesting way to load configurations is from an\n environment variable pointing to a file::\n\n app.config.from_envvar('YOURAPPLICATION_SETTINGS')\n\n In this case before launching the application you have to set this\n environment variable to the file you want to use. On Linux and OS X\n use the export statement::\n\n export YOURAPPLICATION_SETTINGS='/path/to/config/file'\n\n On windows use `set` instead.\n\n :param root_path: path to which files are read relative from. When the\n config object is created by the application, this is\n the application's :attr:`~flask.Flask.root_path`.\n :param defaults: an optional dictionary of default values\n \"\"\"\n\n def __init__(self, root_path: str, defaults: t.Optional[dict] = None) -> None:\n super().__init__(defaults or {})\n self.root_path = root_path", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_envvar_Config.from_envvar.return.self_from_pyfile_rv_sile": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_envvar_Config.from_envvar.return.self_from_pyfile_rv_sile", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 77, "end_line": 99, "span_ids": ["Config.from_envvar"], "tokens": 207}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_envvar(self, variable_name: str, silent: bool = False) -> bool:\n \"\"\"Loads a configuration from an environment variable pointing to\n a configuration file. This is basically just a shortcut with nicer\n error messages for this line of code::\n\n app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTINGS'])\n\n :param variable_name: name of the environment variable\n :param silent: set to ``True`` if you want silent failure for missing\n files.\n :return: ``True`` if the file was loaded successfully.\n \"\"\"\n rv = os.environ.get(variable_name)\n if not rv:\n if silent:\n return False\n raise RuntimeError(\n f\"The environment variable {variable_name!r} is not set\"\n \" and as such configuration could not be loaded. Set\"\n \" this variable and make it point to a configuration\"\n \" file\"\n )\n return self.from_pyfile(rv, silent=silent)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_pyfile_Config.from_pyfile.return.True": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_pyfile_Config.from_pyfile.return.True", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 165, "end_line": 192, "span_ids": ["Config.from_pyfile"], "tokens": 273}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_pyfile(self, filename: str, silent: bool = False) -> bool:\n \"\"\"Updates the values in the config from a Python file. This function\n behaves as if the file was imported as module with the\n :meth:`from_object` function.\n\n :param filename: the filename of the config. This can either be an\n absolute filename or a filename relative to the\n root path.\n :param silent: set to ``True`` if you want silent failure for missing\n files.\n :return: ``True`` if the file was loaded successfully.\n\n .. versionadded:: 0.7\n `silent` parameter.\n \"\"\"\n filename = os.path.join(self.root_path, filename)\n d = types.ModuleType(\"config\")\n d.__file__ = filename\n try:\n with open(filename, mode=\"rb\") as config_file:\n exec(compile(config_file.read(), filename, \"exec\"), d.__dict__)\n except OSError as e:\n if silent and e.errno in (errno.ENOENT, errno.EISDIR, errno.ENOTDIR):\n return False\n e.strerror = f\"Unable to load configuration file ({e.strerror})\"\n raise\n self.from_object(d)\n return True", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_object_Config.from_object.for_key_in_dir_obj_.if_key_isupper_.self_key_getattr_obj_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_object_Config.from_object.for_key_in_dir_obj_.if_key_isupper_.self_key_getattr_obj_", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 128, "end_line": 164, "span_ids": ["Config.from_object"], "tokens": 348}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_object(self, obj: t.Union[object, str]) -> None:\n \"\"\"Updates the values from the given object. An object can be of one\n of the following two types:\n\n - a string: in this case the object with that name will be imported\n - an actual object reference: that object is used directly\n\n Objects are usually either modules or classes. :meth:`from_object`\n loads only the uppercase attributes of the module/class. A ``dict``\n object will not work with :meth:`from_object` because the keys of a\n ``dict`` are not attributes of the ``dict`` class.\n\n Example of module-based configuration::\n\n app.config.from_object('yourapplication.default_config')\n from yourapplication import default_config\n app.config.from_object(default_config)\n\n Nothing is done to the object before loading. If the object is a\n class and has ``@property`` attributes, it needs to be\n instantiated before being passed to this method.\n\n You should not use this function to load the actual configuration but\n rather configuration defaults. The actual config should be loaded\n with :meth:`from_pyfile` and ideally from a location not within the\n package because the package might be installed system wide.\n\n See :ref:`config-dev-prod` for an example of class-based configuration\n using :meth:`from_object`.\n\n :param obj: an import name or object\n \"\"\"\n if isinstance(obj, str):\n obj = import_string(obj)\n for key in dir(obj):\n if key.isupper():\n self[key] = getattr(obj, key)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_file_Config.from_file.return.self_from_mapping_obj_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_file_Config.from_file.return.self_from_mapping_obj_", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 232, "end_line": 273, "span_ids": ["Config.from_file"], "tokens": 332}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_file(\n self,\n filename: str,\n load: t.Callable[[t.IO[t.Any]], t.Mapping],\n silent: bool = False,\n ) -> bool:\n \"\"\"Update the values in the config from a file that is loaded\n using the ``load`` parameter. The loaded data is passed to the\n :meth:`from_mapping` method.\n\n .. code-block:: python\n\n import json\n app.config.from_file(\"config.json\", load=json.load)\n\n import toml\n app.config.from_file(\"config.toml\", load=toml.load)\n\n :param filename: The path to the data file. This can be an\n absolute path or relative to the config root path.\n :param load: A callable that takes a file handle and returns a\n mapping of loaded data from the file.\n :type load: ``Callable[[Reader], Mapping]`` where ``Reader``\n implements a ``read`` method.\n :param silent: Ignore the file if it doesn't exist.\n :return: ``True`` if the file was loaded successfully.\n\n .. versionadded:: 2.0\n \"\"\"\n filename = os.path.join(self.root_path, filename)\n\n try:\n with open(filename) as f:\n obj = load(f)\n except OSError as e:\n if silent and e.errno in (errno.ENOENT, errno.EISDIR):\n return False\n\n e.strerror = f\"Unable to load configuration file ({e.strerror})\"\n raise\n\n return self.from_mapping(obj)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_mapping_Config.from_mapping.return.True": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_mapping_Config.from_mapping.return.True", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 275, "end_line": 292, "span_ids": ["Config.from_mapping"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_mapping(\n self, mapping: t.Optional[t.Mapping[str, t.Any]] = None, **kwargs: t.Any\n ) -> bool:\n \"\"\"Updates the config like :meth:`update` ignoring items with\n non-upper keys.\n\n :return: Always returns ``True``.\n\n .. versionadded:: 0.11\n \"\"\"\n mappings: t.Dict[str, t.Any] = {}\n if mapping is not None:\n mappings.update(mapping)\n mappings.update(kwargs)\n for key, value in mappings.items():\n if key.isupper():\n self[key] = value\n return True", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.get_namespace_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.get_namespace_", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 222, "end_line": 267, "span_ids": ["Config.__repr__", "Config.get_namespace"], "tokens": 346}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def get_namespace(\n self, namespace: str, lowercase: bool = True, trim_namespace: bool = True\n ) -> t.Dict[str, t.Any]:\n \"\"\"Returns a dictionary containing a subset of configuration options\n that match the specified namespace/prefix. Example usage::\n\n app.config['IMAGE_STORE_TYPE'] = 'fs'\n app.config['IMAGE_STORE_PATH'] = '/var/app/images'\n app.config['IMAGE_STORE_BASE_URL'] = 'http://img.website.com'\n image_store_config = app.config.get_namespace('IMAGE_STORE_')\n\n The resulting dictionary `image_store_config` would look like::\n\n {\n 'type': 'fs',\n 'path': '/var/app/images',\n 'base_url': 'http://img.website.com'\n }\n\n This is often useful when configuration options map directly to\n keyword arguments in functions or class constructors.\n\n :param namespace: a configuration namespace\n :param lowercase: a flag indicating if the keys of the resulting\n dictionary should be lowercase\n :param trim_namespace: a flag indicating if the keys of the resulting\n dictionary should not include the namespace\n\n .. versionadded:: 0.11\n \"\"\"\n rv = {}\n for k, v in self.items():\n if not k.startswith(namespace):\n continue\n if trim_namespace:\n key = k[len(namespace) :]\n else:\n key = k\n if lowercase:\n key = key.lower()\n rv[key] = v\n return rv\n\n def __repr__(self) -> str:\n return f\"<{type(self).__name__} {dict.__repr__(self)}>\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.pop__AppCtxGlobals.pop.if_default_is__sentinel_.else_.return.self___dict___pop_name_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.pop__AppCtxGlobals.pop.if_default_is__sentinel_.else_.return.self___dict___pop_name_d", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 73, "end_line": 85, "span_ids": ["_AppCtxGlobals.pop"], "tokens": 124}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class _AppCtxGlobals:\n\n def pop(self, name: str, default: t.Any = _sentinel) -> t.Any:\n \"\"\"Get and remove an attribute by name. Like :meth:`dict.pop`.\n\n :param name: Name of attribute to pop.\n :param default: Value to return if the attribute is not present,\n instead of raising a ``KeyError``.\n\n .. versionadded:: 0.11\n \"\"\"\n if default is _sentinel:\n return self.__dict__.pop(name)\n else:\n return self.__dict__.pop(name, default)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.setdefault__AppCtxGlobals.__repr__.return.object___repr___self_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals.setdefault__AppCtxGlobals.__repr__.return.object___repr___self_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 88, "end_line": 110, "span_ids": ["_AppCtxGlobals.__contains__", "_AppCtxGlobals.__repr__", "_AppCtxGlobals.__iter__", "_AppCtxGlobals.setdefault"], "tokens": 201}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class _AppCtxGlobals:\n\n def setdefault(self, name: str, default: t.Any = None) -> t.Any:\n \"\"\"Get the value of an attribute if it is present, otherwise\n set and return a default value. Like :meth:`dict.setdefault`.\n\n :param name: Name of attribute to get.\n :param default: Value to set and return if the attribute is not\n present.\n\n .. versionadded:: 0.11\n \"\"\"\n return self.__dict__.setdefault(name, default)\n\n def __contains__(self, item: str) -> bool:\n return item in self.__dict__\n\n def __iter__(self) -> t.Iterator[str]:\n return iter(self.__dict__)\n\n def __repr__(self) -> str:\n ctx = _cv_app.get(None)\n if ctx is not None:\n return f\"\"\n return object.__repr__(self)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_after_this_request_after_this_request.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_after_this_request_after_this_request.return.f", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 113, "end_line": 143, "span_ids": ["after_this_request"], "tokens": 226}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def after_this_request(f: ft.AfterRequestCallable) -> ft.AfterRequestCallable:\n \"\"\"Executes a function after this request. This is useful to modify\n response objects. The function is passed the response object and has\n to return the same or a new one.\n\n Example::\n\n @app.route('/')\n def index():\n @after_this_request\n def add_header(response):\n response.headers['X-Foo'] = 'Parachute'\n return response\n return 'Hello World!'\n\n This is more useful if a function other than the view function wants to\n modify a response. For instance think of a decorator that wants to add\n some headers without converting the return value into a response object.\n\n .. versionadded:: 0.9\n \"\"\"\n ctx = _cv_request.get(None)\n\n if ctx is None:\n raise RuntimeError(\n \"'after_this_request' can only be used when a request\"\n \" context is active, such as in a view function.\"\n )\n\n ctx._after_request_functions.append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_copy_current_request_context_copy_current_request_context.return.update_wrapper_wrapper_f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_copy_current_request_context_copy_current_request_context.return.update_wrapper_wrapper_f", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 146, "end_line": 184, "span_ids": ["copy_current_request_context"], "tokens": 271}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def copy_current_request_context(f: t.Callable) -> t.Callable:\n \"\"\"A helper function that decorates a function to retain the current\n request context. This is useful when working with greenlets. The moment\n the function is decorated a copy of the request context is created and\n then pushed when the function is called. The current session is also\n included in the copied request context.\n\n Example::\n\n import gevent\n from flask import copy_current_request_context\n\n @app.route('/')\n def index():\n @copy_current_request_context\n def do_some_work():\n # do some work here, it can access flask.request or\n # flask.session like you would otherwise in the view function.\n ...\n gevent.spawn(do_some_work)\n return 'Regular response'\n\n .. versionadded:: 0.10\n \"\"\"\n ctx = _cv_request.get(None)\n\n if ctx is None:\n raise RuntimeError(\n \"'copy_current_request_context' can only be used when a\"\n \" request context is active, such as in a view function.\"\n )\n\n ctx = ctx.copy()\n\n def wrapper(*args, **kwargs):\n with ctx:\n return ctx.app.ensure_sync(f)(*args, **kwargs)\n\n return update_wrapper(wrapper, f)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_app_context_AppContext.push.appcontext_pushed_send_se": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_app_context_AppContext.push.appcontext_pushed_send_se", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 219, "end_line": 245, "span_ids": ["AppContext.push", "AppContext", "has_app_context"], "tokens": 230}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def has_app_context() -> bool:\n \"\"\"Works like :func:`has_request_context` but for the application\n context. You can also just do a boolean check on the\n :data:`current_app` object instead.\n\n .. versionadded:: 0.9\n \"\"\"\n return _cv_app.get(None) is not None\n\n\nclass AppContext:\n \"\"\"The app context contains application-specific information. An app\n context is created and pushed at the beginning of each request if\n one is not already active. An app context is also pushed when\n running CLI commands.\n \"\"\"\n\n def __init__(self, app: \"Flask\") -> None:\n self.app = app\n self.url_adapter = app.create_url_adapter(None)\n self.g: _AppCtxGlobals = app.app_ctx_globals_class()\n self._cv_tokens: t.List[contextvars.Token] = []\n\n def push(self) -> None:\n \"\"\"Binds the app context to the current context.\"\"\"\n self._cv_tokens.append(_cv_app.set(self))\n appcontext_pushed.send(self.app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_AppContext.pop_AppContext.__exit__.self_pop_exc_value_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_AppContext.pop_AppContext.__exit__.self_pop_exc_value_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 247, "end_line": 275, "span_ids": ["AppContext.pop", "AppContext.__exit__", "AppContext.__enter__"], "tokens": 212}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class AppContext:\n\n def pop(self, exc: t.Optional[BaseException] = _sentinel) -> None: # type: ignore\n \"\"\"Pops the app context.\"\"\"\n try:\n if len(self._cv_tokens) == 1:\n if exc is _sentinel:\n exc = sys.exc_info()[1]\n self.app.do_teardown_appcontext(exc)\n finally:\n ctx = _cv_app.get()\n _cv_app.reset(self._cv_tokens.pop())\n\n if ctx is not self:\n raise AssertionError(\n f\"Popped wrong app context. ({ctx!r} instead of {self!r})\"\n )\n\n appcontext_popped.send(self.app)\n\n def __enter__(self) -> \"AppContext\":\n self.push()\n return self\n\n def __exit__(\n self,\n exc_type: t.Optional[type],\n exc_value: t.Optional[BaseException],\n tb: t.Optional[TracebackType],\n ) -> None:\n self.pop(exc_value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.copy_RequestContext.match_request.try_.except_HTTPException_as_e.self.request.routing_exception.e": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.copy_RequestContext.match_request.try_.except_HTTPException_as_e.self.request.routing_exception.e", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 342, "end_line": 370, "span_ids": ["RequestContext.copy", "RequestContext.match_request"], "tokens": 242}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class RequestContext:\n\n def copy(self) -> \"RequestContext\":\n \"\"\"Creates a copy of this request context with the same request object.\n This can be used to move a request context to a different greenlet.\n Because the actual request object is the same this cannot be used to\n move a request context to a different thread unless access to the\n request object is locked.\n\n .. versionadded:: 0.10\n\n .. versionchanged:: 1.1\n The current session object is used instead of reloading the original\n data. This prevents `flask.session` pointing to an out-of-date object.\n \"\"\"\n return self.__class__(\n self.app,\n environ=self.request.environ,\n request=self.request,\n session=self.session,\n )\n\n def match_request(self) -> None:\n \"\"\"Can be overridden by a subclass to hook into the matching\n of the request.\n \"\"\"\n try:\n result = self.url_adapter.match(return_rule=True) # type: ignore\n self.request.url_rule, self.request.view_args = result # type: ignore\n except HTTPException as e:\n self.request.routing_exception = e", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_attach_enctype_error_multidict_attach_enctype_error_multidict.request.files.__class__.newcls": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_attach_enctype_error_multidict_attach_enctype_error_multidict.request.files.__class__.newcls", "embedding": null, "metadata": {"file_path": "src/flask/debughelpers.py", "file_name": "debughelpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 71, "end_line": 94, "span_ids": ["attach_enctype_error_multidict.newcls", "attach_enctype_error_multidict", "attach_enctype_error_multidict.newcls.__getitem__"], "tokens": 165}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def attach_enctype_error_multidict(request):\n \"\"\"Patch ``request.files.__getitem__`` to raise a descriptive error\n about ``enctype=multipart/form-data``.\n\n :param request: The request to patch.\n :meta private:\n \"\"\"\n oldcls = request.files.__class__\n\n class newcls(oldcls):\n def __getitem__(self, key):\n try:\n return super().__getitem__(key)\n except KeyError as e:\n if key not in request.form:\n raise\n\n raise DebugFilesKeyError(request, key).with_traceback(\n e.__traceback__\n ) from None\n\n newcls.__name__ = oldcls.__name__\n newcls.__module__ = oldcls.__module__\n request.files.__class__ = newcls", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py__dump_loader_info__dump_loader_info.for_key_value_in_sorted_.yield_f_key_value_r_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py__dump_loader_info__dump_loader_info.for_key_value_in_sorted_.yield_f_key_value_r_", "embedding": null, "metadata": {"file_path": "src/flask/debughelpers.py", "file_name": "debughelpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 96, "end_line": 110, "span_ids": ["_dump_loader_info"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _dump_loader_info(loader) -> t.Generator:\n yield f\"class: {type(loader).__module__}.{type(loader).__name__}\"\n for key, value in sorted(loader.__dict__.items()):\n if key.startswith(\"_\"):\n continue\n if isinstance(value, (tuple, list)):\n if not all(isinstance(x, str) for x in value):\n continue\n yield f\"{key}:\"\n for item in value:\n yield f\" - {item}\"\n continue\n elif not isinstance(value, (str, int, float, bool)):\n continue\n yield f\"{key}: {value!r}\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_explain_template_loading_attempts_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_explain_template_loading_attempts_", "embedding": null, "metadata": {"file_path": "src/flask/debughelpers.py", "file_name": "debughelpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 114, "end_line": 159, "span_ids": ["explain_template_loading_attempts"], "tokens": 407}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def explain_template_loading_attempts(app: Flask, template, attempts) -> None:\n \"\"\"This should help developers understand what failed\"\"\"\n info = [f\"Locating template {template!r}:\"]\n total_found = 0\n blueprint = None\n if request_ctx and request_ctx.request.blueprint is not None:\n blueprint = request_ctx.request.blueprint\n\n for idx, (loader, srcobj, triple) in enumerate(attempts):\n if isinstance(srcobj, Flask):\n src_info = f\"application {srcobj.import_name!r}\"\n elif isinstance(srcobj, Blueprint):\n src_info = f\"blueprint {srcobj.name!r} ({srcobj.import_name})\"\n else:\n src_info = repr(srcobj)\n\n info.append(f\"{idx + 1:5}: trying loader of {src_info}\")\n\n for line in _dump_loader_info(loader):\n info.append(f\" {line}\")\n\n if triple is None:\n detail = \"no match\"\n else:\n detail = f\"found ({triple[1] or ''!r})\"\n total_found += 1\n info.append(f\" -> {detail}\")\n\n seems_fishy = False\n if total_found == 0:\n info.append(\"Error: the template could not be found.\")\n seems_fishy = True\n elif total_found > 1:\n info.append(\"Warning: multiple loaders returned a match for the template.\")\n seems_fishy = True\n\n if blueprint is not None and seems_fishy:\n info.append(\n \" The template was looked up from an endpoint that belongs\"\n f\" to the blueprint {blueprint!r}.\"\n )\n info.append(\" Maybe you did not place a template in the right folder?\")\n info.append(\" See https://flask.palletsprojects.com/blueprints/#templates\")\n\n app.logger.info(\"\\n\".join(info))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_load_dotenv_get_load_dotenv.return.val_lower_in_0_fal": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_load_dotenv_get_load_dotenv.return.val_lower_in_0_fal", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 36, "end_line": 48, "span_ids": ["get_load_dotenv"], "tokens": 107}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_load_dotenv(default: bool = True) -> bool:\n \"\"\"Get whether the user has disabled loading default dotenv files by\n setting :envvar:`FLASK_SKIP_DOTENV`. The default is ``True``, load\n the files.\n\n :param default: What to return if the env var isn't set.\n \"\"\"\n val = os.environ.get(\"FLASK_SKIP_DOTENV\")\n\n if not val:\n return default\n\n return val.lower() in (\"0\", \"false\", \"no\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context_stream_with_context.try_.except_TypeError_._type_ignore": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context_stream_with_context.try_.except_TypeError_._type_ignore", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 51, "end_line": 97, "span_ids": ["stream_with_context"], "tokens": 344}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def stream_with_context(\n generator_or_function: t.Union[\n t.Iterator[t.AnyStr], t.Callable[..., t.Iterator[t.AnyStr]]\n ]\n) -> t.Iterator[t.AnyStr]:\n \"\"\"Request contexts disappear when the response is started on the server.\n This is done for efficiency reasons and to make it less likely to encounter\n memory leaks with badly written WSGI middlewares. The downside is that if\n you are using streamed responses, the generator cannot access request bound\n information any more.\n\n This function however can help you keep the context around for longer::\n\n from flask import stream_with_context, request, Response\n\n @app.route('/stream')\n def streamed_response():\n @stream_with_context\n def generate():\n yield 'Hello '\n yield request.args['name']\n yield '!'\n return Response(generate())\n\n Alternatively it can also be used around a specific generator::\n\n from flask import stream_with_context, request, Response\n\n @app.route('/stream')\n def streamed_response():\n def generate():\n yield 'Hello '\n yield request.args['name']\n yield '!'\n return Response(stream_with_context(generate()))\n\n .. versionadded:: 0.9\n \"\"\"\n try:\n gen = iter(generator_or_function) # type: ignore\n except TypeError:\n\n def decorator(*args: t.Any, **kwargs: t.Any) -> t.Any:\n gen = generator_or_function(*args, **kwargs) # type: ignore\n return stream_with_context(gen)\n\n return update_wrapper(decorator, generator_or_function) # type: ignore\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context.generator_stream_with_context.return.wrapped_g": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_stream_with_context.generator_stream_with_context.return.wrapped_g", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 99, "end_line": 127, "span_ids": ["stream_with_context"], "tokens": 289}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def stream_with_context(\n generator_or_function: t.Union[\n t.Iterator[t.AnyStr], t.Callable[..., t.Iterator[t.AnyStr]]\n ]\n) -> t.Iterator[t.AnyStr]:\n # ... other code\n\n def generator() -> t.Generator:\n ctx = _cv_request.get(None)\n if ctx is None:\n raise RuntimeError(\n \"'stream_with_context' can only be used when a request\"\n \" context is active, such as in a view function.\"\n )\n with ctx:\n # Dummy sentinel. Has to be inside the context block or we're\n # not actually keeping the context around.\n yield None\n\n # The try/finally is here so that if someone passes a WSGI level\n # iterator in we're still running the cleanup logic. Generators\n # don't need that because they are closed on their destruction\n # automatically.\n try:\n yield from gen\n finally:\n if hasattr(gen, \"close\"):\n gen.close()\n\n # The trick is to start the generator. Then the code execution runs until\n # the first dummy None is yielded at which point the context was already\n # pushed. This item is discarded. Then when the iteration continues the\n # real generator is executed.\n wrapped_g = generator()\n next(wrapped_g)\n return wrapped_g", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_template_attribute_get_template_attribute.return.getattr_current_app_jinja": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_template_attribute_get_template_attribute.return.getattr_current_app_jinja", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 342, "end_line": 361, "span_ids": ["get_template_attribute"], "tokens": 184}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_template_attribute(template_name: str, attribute: str) -> t.Any:\n \"\"\"Loads a macro (or variable) a template exports. This can be used to\n invoke a macro from within Python code. If you for example have a\n template named :file:`_cider.html` with the following contents:\n\n .. sourcecode:: html+jinja\n\n {% macro hello(name) %}Hello {{ name }}!{% endmacro %}\n\n You can access this from Python code like this::\n\n hello = get_template_attribute('_cider.html', 'hello')\n return hello('World')\n\n .. versionadded:: 0.2\n\n :param template_name: the name of the template\n :param attribute: the name of the variable of macro to access\n \"\"\"\n return getattr(current_app.jinja_env.get_template(template_name).module, attribute)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_flash_flash.message_flashed_send_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_flash_flash.message_flashed_send_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 364, "end_line": 393, "span_ids": ["flash"], "tokens": 293}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def flash(message: str, category: str = \"message\") -> None:\n \"\"\"Flashes a message to the next request. In order to remove the\n flashed message from the session and to display it to the user,\n the template has to call :func:`get_flashed_messages`.\n\n .. versionchanged:: 0.3\n `category` parameter added.\n\n :param message: the message to be flashed.\n :param category: the category for the message. The following values\n are recommended: ``'message'`` for any kind of message,\n ``'error'`` for errors, ``'info'`` for information\n messages and ``'warning'`` for warnings. However any\n kind of string can be used as category.\n \"\"\"\n # Original implementation:\n #\n # session.setdefault('_flashes', []).append((category, message))\n #\n # This assumed that changes made to mutable structures in the session are\n # always in sync with the session object, which is not true for session\n # implementations that use external storage for keeping their keys/values.\n flashes = session.get(\"_flashes\", [])\n flashes.append((category, message))\n session[\"_flashes\"] = flashes\n message_flashed.send(\n current_app._get_current_object(), # type: ignore\n message=message,\n category=category,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_file_send_file.return.werkzeug_utils_send_file_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_file_send_file.return.werkzeug_utils_send_file_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 391, "end_line": 516, "span_ids": ["send_file"], "tokens": 1261}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def send_file(\n path_or_file: t.Union[os.PathLike, str, t.BinaryIO],\n mimetype: t.Optional[str] = None,\n as_attachment: bool = False,\n download_name: t.Optional[str] = None,\n conditional: bool = True,\n etag: t.Union[bool, str] = True,\n last_modified: t.Optional[t.Union[datetime, int, float]] = None,\n max_age: t.Optional[\n t.Union[int, t.Callable[[t.Optional[str]], t.Optional[int]]]\n ] = None,\n) -> \"Response\":\n \"\"\"Send the contents of a file to the client.\n\n The first argument can be a file path or a file-like object. Paths\n are preferred in most cases because Werkzeug can manage the file and\n get extra information from the path. Passing a file-like object\n requires that the file is opened in binary mode, and is mostly\n useful when building a file in memory with :class:`io.BytesIO`.\n\n Never pass file paths provided by a user. The path is assumed to be\n trusted, so a user could craft a path to access a file you didn't\n intend. Use :func:`send_from_directory` to safely serve\n user-requested paths from within a directory.\n\n If the WSGI server sets a ``file_wrapper`` in ``environ``, it is\n used, otherwise Werkzeug's built-in wrapper is used. Alternatively,\n if the HTTP server supports ``X-Sendfile``, configuring Flask with\n ``USE_X_SENDFILE = True`` will tell the server to send the given\n path, which is much more efficient than reading it in Python.\n\n :param path_or_file: The path to the file to send, relative to the\n current working directory if a relative path is given.\n Alternatively, a file-like object opened in binary mode. Make\n sure the file pointer is seeked to the start of the data.\n :param mimetype: The MIME type to send for the file. If not\n provided, it will try to detect it from the file name.\n :param as_attachment: Indicate to a browser that it should offer to\n save the file instead of displaying it.\n :param download_name: The default name browsers will use when saving\n the file. Defaults to the passed file name.\n :param conditional: Enable conditional and range responses based on\n request headers. Requires passing a file path and ``environ``.\n :param etag: Calculate an ETag for the file, which requires passing\n a file path. Can also be a string to use instead.\n :param last_modified: The last modified time to send for the file,\n in seconds. If not provided, it will try to detect it from the\n file path.\n :param max_age: How long the client should cache the file, in\n seconds. If set, ``Cache-Control`` will be ``public``, otherwise\n it will be ``no-cache`` to prefer conditional caching.\n\n .. versionchanged:: 2.0\n ``download_name`` replaces the ``attachment_filename``\n parameter. If ``as_attachment=False``, it is passed with\n ``Content-Disposition: inline`` instead.\n\n .. versionchanged:: 2.0\n ``max_age`` replaces the ``cache_timeout`` parameter.\n ``conditional`` is enabled and ``max_age`` is not set by\n default.\n\n .. versionchanged:: 2.0\n ``etag`` replaces the ``add_etags`` parameter. It can be a\n string to use instead of generating one.\n\n .. versionchanged:: 2.0\n Passing a file-like object that inherits from\n :class:`~io.TextIOBase` will raise a :exc:`ValueError` rather\n than sending an empty file.\n\n .. versionadded:: 2.0\n Moved the implementation to Werkzeug. This is now a wrapper to\n pass some Flask-specific arguments.\n\n .. versionchanged:: 1.1\n ``filename`` may be a :class:`~os.PathLike` object.\n\n .. versionchanged:: 1.1\n Passing a :class:`~io.BytesIO` object supports range requests.\n\n .. versionchanged:: 1.0.3\n Filenames are encoded with ASCII instead of Latin-1 for broader\n compatibility with WSGI servers.\n\n .. versionchanged:: 1.0\n UTF-8 filenames as specified in :rfc:`2231` are supported.\n\n .. versionchanged:: 0.12\n The filename is no longer automatically inferred from file\n objects. If you want to use automatic MIME and etag support,\n pass a filename via ``filename_or_fp`` or\n ``attachment_filename``.\n\n .. versionchanged:: 0.12\n ``attachment_filename`` is preferred over ``filename`` for MIME\n detection.\n\n .. versionchanged:: 0.9\n ``cache_timeout`` defaults to\n :meth:`Flask.get_send_file_max_age`.\n\n .. versionchanged:: 0.7\n MIME guessing and etag support for file-like objects was\n deprecated because it was unreliable. Pass a filename if you are\n able to, otherwise attach an etag yourself.\n\n .. versionchanged:: 0.5\n The ``add_etags``, ``cache_timeout`` and ``conditional``\n parameters were added. The default behavior is to add etags.\n\n .. versionadded:: 0.2\n \"\"\"\n return werkzeug.utils.send_file( # type: ignore[return-value]\n **_prepare_send_file_kwargs(\n path_or_file=path_or_file,\n environ=request.environ,\n mimetype=mimetype,\n as_attachment=as_attachment,\n download_name=download_name,\n conditional=conditional,\n etag=etag,\n last_modified=last_modified,\n max_age=max_age,\n )\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_from_directory_send_from_directory.return.werkzeug_utils_send_from_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_send_from_directory_send_from_directory.return.werkzeug_utils_send_from_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 519, "end_line": 559, "span_ids": ["send_from_directory"], "tokens": 349}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def send_from_directory(\n directory: t.Union[os.PathLike, str],\n path: t.Union[os.PathLike, str],\n **kwargs: t.Any,\n) -> \"Response\":\n \"\"\"Send a file from within a directory using :func:`send_file`.\n\n .. code-block:: python\n\n @app.route(\"/uploads/\")\n def download_file(name):\n return send_from_directory(\n app.config['UPLOAD_FOLDER'], name, as_attachment=True\n )\n\n This is a secure way to serve files from a folder, such as static\n files or uploads. Uses :func:`~werkzeug.security.safe_join` to\n ensure the path coming from the client is not maliciously crafted to\n point outside the specified directory.\n\n If the final path does not point to an existing regular file,\n raises a 404 :exc:`~werkzeug.exceptions.NotFound` error.\n\n :param directory: The directory that ``path`` must be located under,\n relative to the current application's root path.\n :param path: The path to the file to send, relative to\n ``directory``.\n :param kwargs: Arguments to pass to :func:`send_file`.\n\n .. versionchanged:: 2.0\n ``path`` replaces the ``filename`` parameter.\n\n .. versionadded:: 2.0\n Moved the implementation to Werkzeug. This is now a wrapper to\n pass some Flask-specific arguments.\n\n .. versionadded:: 0.5\n \"\"\"\n return werkzeug.utils.send_from_directory( # type: ignore[return-value]\n directory, path, **_prepare_send_file_kwargs(**kwargs)\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_root_path_get_root_path.return.os_path_dirname_os_path_a": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_root_path_get_root_path.return.os_path_dirname_os_path_a", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 562, "end_line": 608, "span_ids": ["get_root_path"], "tokens": 416}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_root_path(import_name: str) -> str:\n \"\"\"Find the root path of a package, or the path that contains a\n module. If it cannot be found, returns the current working\n directory.\n\n Not to be confused with the value returned by :func:`find_package`.\n\n :meta private:\n \"\"\"\n # Module already imported and has a file attribute. Use that first.\n mod = sys.modules.get(import_name)\n\n if mod is not None and hasattr(mod, \"__file__\") and mod.__file__ is not None:\n return os.path.dirname(os.path.abspath(mod.__file__))\n\n # Next attempt: check the loader.\n loader = pkgutil.get_loader(import_name)\n\n # Loader does not exist or we're referring to an unloaded main\n # module or a main module without path (interactive sessions), go\n # with the current working directory.\n if loader is None or import_name == \"__main__\":\n return os.getcwd()\n\n if hasattr(loader, \"get_filename\"):\n filepath = loader.get_filename(import_name)\n else:\n # Fall back to imports.\n __import__(import_name)\n mod = sys.modules[import_name]\n filepath = getattr(mod, \"__file__\", None)\n\n # If we don't have a file path it might be because it is a\n # namespace package. In this case pick the root path from the\n # first module that is contained in the package.\n if filepath is None:\n raise RuntimeError(\n \"No root path can be found for the provided module\"\n f\" {import_name!r}. This can happen because the module\"\n \" came from an import hook that does not provide file\"\n \" name information or because it's a namespace package.\"\n \" In this case the root path needs to be explicitly\"\n \" provided.\"\n )\n\n # filepath is import_name.py for a module, or __init__.py for a package.\n return os.path.dirname(os.path.abspath(filepath))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_locked_cached_property_locked_cached_property.__delete__.with_self_lock_.super___delete___obj_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_locked_cached_property_locked_cached_property.__delete__.with_self_lock_.super___delete___obj_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 611, "end_line": 654, "span_ids": ["locked_cached_property", "locked_cached_property.__get__", "locked_cached_property.__delete__", "locked_cached_property.__set__"], "tokens": 349}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class locked_cached_property(werkzeug.utils.cached_property):\n \"\"\"A :func:`property` that is only evaluated once. Like\n :class:`werkzeug.utils.cached_property` except access uses a lock\n for thread safety.\n\n .. deprecated:: 2.3\n Will be removed in Flask 2.4. Use a lock inside the decorated function if\n locking is needed.\n\n .. versionchanged:: 2.0\n Inherits from Werkzeug's ``cached_property`` (and ``property``).\n \"\"\"\n\n def __init__(\n self,\n fget: t.Callable[[t.Any], t.Any],\n name: t.Optional[str] = None,\n doc: t.Optional[str] = None,\n ) -> None:\n import warnings\n\n warnings.warn(\n \"'locked_cached_property' is deprecated and will be removed in Flask 2.4.\"\n \" Use a lock inside the decorated function if locking is needed.\",\n DeprecationWarning,\n stacklevel=2,\n )\n super().__init__(fget, name=name, doc=doc)\n self.lock = RLock()\n\n def __get__(self, obj: object, type: type = None) -> t.Any: # type: ignore\n if obj is None:\n return self\n\n with self.lock:\n return super().__get__(obj, type=type)\n\n def __set__(self, obj: object, value: t.Any) -> None:\n with self.lock:\n super().__set__(obj, value)\n\n def __delete__(self, obj: object) -> None:\n with self.lock:\n super().__delete__(obj)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_loads_loads.return._json_loads_s_kwargs_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_loads_loads.return._json_loads_s_kwargs_", "embedding": null, "metadata": {"file_path": "src/flask/json/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 77, "end_line": 105, "span_ids": ["loads"], "tokens": 244}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def loads(s: str | bytes, **kwargs: t.Any) -> t.Any:\n \"\"\"Deserialize data as JSON.\n\n If :data:`~flask.current_app` is available, it will use its\n :meth:`app.json.loads() `\n method, otherwise it will use :func:`json.loads`.\n\n :param s: Text or UTF-8 bytes.\n :param kwargs: Arguments passed to the ``loads`` implementation.\n\n .. versionchanged:: 2.3\n The ``app`` parameter was removed.\n\n .. versionchanged:: 2.2\n Calls ``current_app.json.loads``, allowing an app to override\n the behavior.\n\n .. versionchanged:: 2.0\n ``encoding`` will be removed in Flask 2.1. The data must be a\n string or UTF-8 bytes.\n\n .. versionchanged:: 1.0.3\n ``app`` can be passed directly, rather than requiring an app\n context for configuration.\n \"\"\"\n if current_app:\n return current_app.json.loads(s, **kwargs)\n\n return _json.loads(s, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_load_load.return._json_load_fp_kwargs_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_load_load.return._json_load_fp_kwargs_", "embedding": null, "metadata": {"file_path": "src/flask/json/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 108, "end_line": 135, "span_ids": ["load"], "tokens": 253}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def load(fp: t.IO[t.AnyStr], **kwargs: t.Any) -> t.Any:\n \"\"\"Deserialize data as JSON read from a file.\n\n If :data:`~flask.current_app` is available, it will use its\n :meth:`app.json.load() `\n method, otherwise it will use :func:`json.load`.\n\n :param fp: A file opened for reading text or UTF-8 bytes.\n :param kwargs: Arguments passed to the ``load`` implementation.\n\n .. versionchanged:: 2.3\n The ``app`` parameter was removed.\n\n .. versionchanged:: 2.2\n Calls ``current_app.json.load``, allowing an app to override\n the behavior.\n\n .. versionchanged:: 2.2\n The ``app`` parameter will be removed in Flask 2.3.\n\n .. versionchanged:: 2.0\n ``encoding`` will be removed in Flask 2.1. The file must be text\n mode, or binary mode with UTF-8 bytes.\n \"\"\"\n if current_app:\n return current_app.json.load(fp, **kwargs)\n\n return _json.load(fp, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_jsonify_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_jsonify_", "embedding": null, "metadata": {"file_path": "src/flask/json/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 138, "end_line": 171, "span_ids": ["jsonify"], "tokens": 311}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def jsonify(*args: t.Any, **kwargs: t.Any) -> Response:\n \"\"\"Serialize the given arguments as JSON, and return a\n :class:`~flask.Response` object with the ``application/json``\n mimetype. A dict or list returned from a view will be converted to a\n JSON response automatically without needing to call this.\n\n This requires an active request or application context, and calls\n :meth:`app.json.response() `.\n\n In debug mode, the output is formatted with indentation to make it\n easier to read. This may also be controlled by the provider.\n\n Either positional or keyword arguments can be given, not both.\n If no arguments are given, ``None`` is serialized.\n\n :param args: A single value to serialize, or multiple values to\n treat as a list to serialize.\n :param kwargs: Treat as a dict to serialize.\n\n .. versionchanged:: 2.2\n Calls ``current_app.json.response``, allowing an app to override\n the behavior.\n\n .. versionchanged:: 2.0.2\n :class:`decimal.Decimal` is supported by converting to a string.\n\n .. versionchanged:: 0.11\n Added support for serializing top-level arrays. This was a\n security risk in ancient browsers. See :ref:`security-json`.\n\n .. versionadded:: 0.2\n \"\"\"\n return current_app.json.response(*args, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py___loads": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py___loads", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 54, "span_ids": ["docstring", "imports"], "tokens": 365}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "\"\"\"\nTagged JSON\n~~~~~~~~~~~\n\nA compact representation for lossless serialization of non-standard JSON\ntypes. :class:`~flask.sessions.SecureCookieSessionInterface` uses this\nto serialize the session data, but it may be useful in other places. It\ncan be extended to support other types.\n\n.. autoclass:: TaggedJSONSerializer\n :members:\n\n.. autoclass:: JSONTag\n :members:\n\nLet's see an example that adds support for\n:class:`~collections.OrderedDict`. Dicts don't have an order in JSON, so\nto handle this we will dump the items as a list of ``[key, value]``\npairs. Subclass :class:`JSONTag` and give it the new key ``' od'`` to\nidentify the type. The session serializer processes dicts first, so\ninsert the new tag at the front of the order since ``OrderedDict`` must\nbe processed before ``dict``.\n\n.. code-block:: python\n\n from flask.json.tag import JSONTag\n\n class TagOrderedDict(JSONTag):\n __slots__ = ('serializer',)\n key = ' od'\n\n def check(self, value):\n return isinstance(value, OrderedDict)\n\n def to_json(self, value):\n return [[k, self.serializer.tag(v)] for k, v in iteritems(value)]\n\n def to_python(self, value):\n return OrderedDict(value)\n\n app.session_interface.serializer.register(TagOrderedDict, index=0)\n\"\"\"\nimport typing as t\nfrom base64 import b64decode\nfrom base64 import b64encode\nfrom datetime import datetime\nfrom uuid import UUID\n\nfrom markupsafe import Markup\nfrom werkzeug.http import http_date\nfrom werkzeug.http import parse_date\n\nfrom ..json import dumps\nfrom ..json import loads", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_JSONTag_JSONTag.tag.return._self_key_self_to_json_v": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_JSONTag_JSONTag.tag.return._self_key_self_to_json_v", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 57, "end_line": 87, "span_ids": ["JSONTag.check", "JSONTag.to_python", "JSONTag.tag", "JSONTag", "JSONTag.to_json"], "tokens": 265}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class JSONTag:\n \"\"\"Base class for defining type tags for :class:`TaggedJSONSerializer`.\"\"\"\n\n __slots__ = (\"serializer\",)\n\n #: The tag to mark the serialized object with. If ``None``, this tag is\n #: only used as an intermediate step during tagging.\n key: t.Optional[str] = None\n\n def __init__(self, serializer: \"TaggedJSONSerializer\") -> None:\n \"\"\"Create a tagger for the given serializer.\"\"\"\n self.serializer = serializer\n\n def check(self, value: t.Any) -> bool:\n \"\"\"Check if the given value should be tagged by this tag.\"\"\"\n raise NotImplementedError\n\n def to_json(self, value: t.Any) -> t.Any:\n \"\"\"Convert the Python object to an object that is a valid JSON type.\n The tag will be added later.\"\"\"\n raise NotImplementedError\n\n def to_python(self, value: t.Any) -> t.Any:\n \"\"\"Convert the JSON representation back to the correct type. The tag\n will already be removed.\"\"\"\n raise NotImplementedError\n\n def tag(self, value: t.Any) -> t.Any:\n \"\"\"Convert the value to a valid JSON type and add the tag structure\n around it.\"\"\"\n return {self.key: self.to_json(value)}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagDict_TagDict.to_python.return._key_2_value_key_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagDict_TagDict.to_python.return._key_2_value_key_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 90, "end_line": 113, "span_ids": ["TagDict.to_python", "TagDict.to_json", "TagDict", "TagDict.check"], "tokens": 176}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TagDict(JSONTag):\n \"\"\"Tag for 1-item dicts whose only key matches a registered tag.\n\n Internally, the dict key is suffixed with `__`, and the suffix is removed\n when deserializing.\n \"\"\"\n\n __slots__ = ()\n key = \" di\"\n\n def check(self, value: t.Any) -> bool:\n return (\n isinstance(value, dict)\n and len(value) == 1\n and next(iter(value)) in self.serializer.tags\n )\n\n def to_json(self, value: t.Any) -> t.Any:\n key = next(iter(value))\n return {f\"{key}__\": self.serializer.tag(value[key])}\n\n def to_python(self, value: t.Any) -> t.Any:\n key = next(iter(value))\n return {key[:-2]: value[key]}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_PassDict_TagBytes.to_python.return.b64decode_value_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_PassDict_TagBytes.to_python.return.b64decode_value_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 116, "end_line": 167, "span_ids": ["PassList.check", "PassDict.check", "PassList:4", "TagTuple", "PassDict.to_json", "PassList", "TagBytes", "PassList.to_json", "TagBytes.check", "TagBytes.to_python", "TagBytes.to_json", "TagTuple.to_json", "PassDict:4", "PassDict", "TagTuple.check", "TagTuple.to_python"], "tokens": 332}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class PassDict(JSONTag):\n __slots__ = ()\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, dict)\n\n def to_json(self, value: t.Any) -> t.Any:\n # JSON objects may only have string keys, so don't bother tagging the\n # key here.\n return {k: self.serializer.tag(v) for k, v in value.items()}\n\n tag = to_json\n\n\nclass TagTuple(JSONTag):\n __slots__ = ()\n key = \" t\"\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, tuple)\n\n def to_json(self, value: t.Any) -> t.Any:\n return [self.serializer.tag(item) for item in value]\n\n def to_python(self, value: t.Any) -> t.Any:\n return tuple(value)\n\n\nclass PassList(JSONTag):\n __slots__ = ()\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, list)\n\n def to_json(self, value: t.Any) -> t.Any:\n return [self.serializer.tag(item) for item in value]\n\n tag = to_json\n\n\nclass TagBytes(JSONTag):\n __slots__ = ()\n key = \" b\"\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, bytes)\n\n def to_json(self, value: t.Any) -> t.Any:\n return b64encode(value).decode(\"ascii\")\n\n def to_python(self, value: t.Any) -> t.Any:\n return b64decode(value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagMarkup_TagMarkup.to_python.return.Markup_value_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagMarkup_TagMarkup.to_python.return.Markup_value_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 170, "end_line": 185, "span_ids": ["TagMarkup", "TagMarkup.check", "TagMarkup.to_python", "TagMarkup.to_json"], "tokens": 141}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TagMarkup(JSONTag):\n \"\"\"Serialize anything matching the :class:`~markupsafe.Markup` API by\n having a ``__html__`` method to the result of that method. Always\n deserializes to an instance of :class:`~markupsafe.Markup`.\"\"\"\n\n __slots__ = ()\n key = \" m\"\n\n def check(self, value: t.Any) -> bool:\n return callable(getattr(value, \"__html__\", None))\n\n def to_json(self, value: t.Any) -> t.Any:\n return str(value.__html__())\n\n def to_python(self, value: t.Any) -> t.Any:\n return Markup(value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagUUID_TagDateTime.to_python.return.parse_date_value_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TagUUID_TagDateTime.to_python.return.parse_date_value_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 188, "end_line": 213, "span_ids": ["TagDateTime.to_json", "TagUUID", "TagUUID.to_json", "TagDateTime", "TagDateTime.to_python", "TagDateTime.check", "TagUUID.check", "TagUUID.to_python"], "tokens": 158}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TagUUID(JSONTag):\n __slots__ = ()\n key = \" u\"\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, UUID)\n\n def to_json(self, value: t.Any) -> t.Any:\n return value.hex\n\n def to_python(self, value: t.Any) -> t.Any:\n return UUID(value)\n\n\nclass TagDateTime(JSONTag):\n __slots__ = ()\n key = \" d\"\n\n def check(self, value: t.Any) -> bool:\n return isinstance(value, datetime)\n\n def to_json(self, value: t.Any) -> t.Any:\n return http_date(value)\n\n def to_python(self, value: t.Any) -> t.Any:\n return parse_date(value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer_TaggedJSONSerializer.__init__.for_cls_in_self_default_t.self_register_cls_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer_TaggedJSONSerializer.__init__.for_cls_in_self_default_t.self_register_cls_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 216, "end_line": 251, "span_ids": ["TaggedJSONSerializer"], "tokens": 225}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TaggedJSONSerializer:\n \"\"\"Serializer that uses a tag system to compactly represent objects that\n are not JSON types. Passed as the intermediate serializer to\n :class:`itsdangerous.Serializer`.\n\n The following extra types are supported:\n\n * :class:`dict`\n * :class:`tuple`\n * :class:`bytes`\n * :class:`~markupsafe.Markup`\n * :class:`~uuid.UUID`\n * :class:`~datetime.datetime`\n \"\"\"\n\n __slots__ = (\"tags\", \"order\")\n\n #: Tag classes to bind when creating the serializer. Other tags can be\n #: added later using :meth:`~register`.\n default_tags = [\n TagDict,\n PassDict,\n TagTuple,\n PassList,\n TagBytes,\n TagMarkup,\n TagUUID,\n TagDateTime,\n ]\n\n def __init__(self) -> None:\n self.tags: t.Dict[str, JSONTag] = {}\n self.order: t.List[JSONTag] = []\n\n for cls in self.default_tags:\n self.register(cls)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.register_TaggedJSONSerializer.register.if_index_is_None_.else_.self_order_insert_index_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.register_TaggedJSONSerializer.register.if_index_is_None_.else_.self_order_insert_index_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 253, "end_line": 284, "span_ids": ["TaggedJSONSerializer.register"], "tokens": 252}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TaggedJSONSerializer:\n\n def register(\n self,\n tag_class: t.Type[JSONTag],\n force: bool = False,\n index: t.Optional[int] = None,\n ) -> None:\n \"\"\"Register a new tag with this serializer.\n\n :param tag_class: tag class to register. Will be instantiated with this\n serializer instance.\n :param force: overwrite an existing tag. If false (default), a\n :exc:`KeyError` is raised.\n :param index: index to insert the new tag in the tag order. Useful when\n the new tag is a special case of an existing tag. If ``None``\n (default), the tag is appended to the end of the order.\n\n :raise KeyError: if the tag key is already registered and ``force`` is\n not true.\n \"\"\"\n tag = tag_class(self)\n key = tag.key\n\n if key is not None:\n if not force and key in self.tags:\n raise KeyError(f\"Tag '{key}' is already registered.\")\n\n self.tags[key] = tag\n\n if index is None:\n self.order.append(tag)\n else:\n self.order.insert(index, tag)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.tag_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/tag.py_TaggedJSONSerializer.tag_", "embedding": null, "metadata": {"file_path": "src/flask/json/tag.py", "file_name": "tag.py", "file_type": "text/x-python", "category": "implementation", "start_line": 286, "end_line": 313, "span_ids": ["TaggedJSONSerializer.untag", "TaggedJSONSerializer.dumps", "TaggedJSONSerializer.loads", "TaggedJSONSerializer.tag"], "tokens": 212}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TaggedJSONSerializer:\n\n def tag(self, value: t.Any) -> t.Dict[str, t.Any]:\n \"\"\"Convert a value to a tagged representation if necessary.\"\"\"\n for tag in self.order:\n if tag.check(value):\n return tag.tag(value)\n\n return value\n\n def untag(self, value: t.Dict[str, t.Any]) -> t.Any:\n \"\"\"Convert a tagged representation back to the original type.\"\"\"\n if len(value) != 1:\n return value\n\n key = next(iter(value))\n\n if key not in self.tags:\n return value\n\n return self.tags[key].to_python(value[key])\n\n def dumps(self, value: t.Any) -> str:\n \"\"\"Tag the value and dump it to a compact JSON string.\"\"\"\n return dumps(self.tag(value), separators=(\",\", \":\"))\n\n def loads(self, value: str) -> t.Any:\n \"\"\"Load data from a JSON string and deserialized any tagged objects.\"\"\"\n return loads(value, object_hook=self.untag)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_logging_wsgi_errors_stream.return.request_environ_wsgi_err": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_logging_wsgi_errors_stream.return.request_environ_wsgi_err", "embedding": null, "metadata": {"file_path": "src/flask/logging.py", "file_name": "logging.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 23, "span_ids": ["impl", "imports:6", "imports", "wsgi_errors_stream"], "tokens": 172}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import logging\nimport sys\nimport typing as t\n\nfrom werkzeug.local import LocalProxy\n\nfrom .globals import request\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .app import Flask\n\n\n@LocalProxy\ndef wsgi_errors_stream() -> t.TextIO:\n \"\"\"Find the most appropriate error stream for the application. If a request\n is active, log to ``wsgi.errors``, otherwise use ``sys.stderr``.\n\n If you configure your own :class:`logging.StreamHandler`, you may want to\n use this for the stream. If you are using file or dict configuration and\n can't import this directly, you can refer to it as\n ``ext://flask.logging.wsgi_errors_stream``.\n \"\"\"\n return request.environ[\"wsgi.errors\"] if request else sys.stderr", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_has_level_handler_default_handler_setFormat": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_has_level_handler_default_handler_setFormat", "embedding": null, "metadata": {"file_path": "src/flask/logging.py", "file_name": "logging.py", "file_type": "text/x-python", "category": "implementation", "start_line": 26, "end_line": 50, "span_ids": ["impl:2", "has_level_handler"], "tokens": 190}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def has_level_handler(logger: logging.Logger) -> bool:\n \"\"\"Check if there is a handler in the logging chain that will handle the\n given logger's :meth:`effective level <~logging.Logger.getEffectiveLevel>`.\n \"\"\"\n level = logger.getEffectiveLevel()\n current = logger\n\n while current:\n if any(handler.level <= level for handler in current.handlers):\n return True\n\n if not current.propagate:\n break\n\n current = current.parent # type: ignore\n\n return False\n\n\n#: Log messages to :func:`~flask.logging.wsgi_errors_stream` with the format\n#: ``[%(asctime)s] %(levelname)s in %(module)s: %(message)s``.\ndefault_handler = logging.StreamHandler(wsgi_errors_stream) # type: ignore\ndefault_handler.setFormatter(\n logging.Formatter(\"[%(asctime)s] %(levelname)s in %(module)s: %(message)s\")\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_create_logger_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/logging.py_create_logger_", "embedding": null, "metadata": {"file_path": "src/flask/logging.py", "file_name": "logging.py", "file_type": "text/x-python", "category": "implementation", "start_line": 53, "end_line": 75, "span_ids": ["create_logger"], "tokens": 170}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def create_logger(app: \"Flask\") -> logging.Logger:\n \"\"\"Get the Flask app's logger and configure it if needed.\n\n The logger name will be the same as\n :attr:`app.import_name `.\n\n When :attr:`~flask.Flask.debug` is enabled, set the logger level to\n :data:`logging.DEBUG` if it is not set.\n\n If there is no handler for the logger's effective level, add a\n :class:`~logging.StreamHandler` for\n :func:`~flask.logging.wsgi_errors_stream` with a basic format.\n \"\"\"\n logger = logging.getLogger(app.name)\n\n if app.debug and not logger.level:\n logger.setLevel(logging.DEBUG)\n\n if not has_level_handler(logger):\n logger.addHandler(default_handler)\n\n return logger", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__init___Scaffold.__init__.self.url_default_functions.defaultdict_list_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__init___Scaffold.__init__.self.url_default_functions.defaultdict_list_", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 76, "end_line": 222, "span_ids": ["Scaffold"], "tokens": 1470}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def __init__(\n self,\n import_name: str,\n static_folder: t.Optional[t.Union[str, os.PathLike]] = None,\n static_url_path: t.Optional[str] = None,\n template_folder: t.Optional[t.Union[str, os.PathLike]] = None,\n root_path: t.Optional[str] = None,\n ):\n #: The name of the package or module that this object belongs\n #: to. Do not change this once it is set by the constructor.\n self.import_name = import_name\n\n self.static_folder = static_folder # type: ignore\n self.static_url_path = static_url_path\n\n #: The path to the templates folder, relative to\n #: :attr:`root_path`, to add to the template loader. ``None`` if\n #: templates should not be added.\n self.template_folder = template_folder\n\n if root_path is None:\n root_path = get_root_path(self.import_name)\n\n #: Absolute path to the package on the filesystem. Used to look\n #: up resources contained in the package.\n self.root_path = root_path\n\n #: The Click command group for registering CLI commands for this\n #: object. The commands are available from the ``flask`` command\n #: once the application has been discovered and blueprints have\n #: been registered.\n self.cli = AppGroup()\n\n #: A dictionary mapping endpoint names to view functions.\n #:\n #: To register a view function, use the :meth:`route` decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.view_functions: t.Dict[str, t.Callable] = {}\n\n #: A data structure of registered error handlers, in the format\n #: ``{scope: {code: {class: handler}}}``. The ``scope`` key is\n #: the name of a blueprint the handlers are active for, or\n #: ``None`` for all requests. The ``code`` key is the HTTP\n #: status code for ``HTTPException``, or ``None`` for\n #: other exceptions. The innermost dictionary maps exception\n #: classes to handler functions.\n #:\n #: To register an error handler, use the :meth:`errorhandler`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.error_handler_spec: t.Dict[\n ft.AppOrBlueprintKey,\n t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ft.ErrorHandlerCallable]],\n ] = defaultdict(lambda: defaultdict(dict))\n\n #: A data structure of functions to call at the beginning of\n #: each request, in the format ``{scope: [functions]}``. The\n #: ``scope`` key is the name of a blueprint the functions are\n #: active for, or ``None`` for all requests.\n #:\n #: To register a function, use the :meth:`before_request`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.before_request_funcs: t.Dict[\n ft.AppOrBlueprintKey, t.List[ft.BeforeRequestCallable]\n ] = defaultdict(list)\n\n #: A data structure of functions to call at the end of each\n #: request, in the format ``{scope: [functions]}``. The\n #: ``scope`` key is the name of a blueprint the functions are\n #: active for, or ``None`` for all requests.\n #:\n #: To register a function, use the :meth:`after_request`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.after_request_funcs: t.Dict[\n ft.AppOrBlueprintKey, t.List[ft.AfterRequestCallable]\n ] = defaultdict(list)\n\n #: A data structure of functions to call at the end of each\n #: request even if an exception is raised, in the format\n #: ``{scope: [functions]}``. The ``scope`` key is the name of a\n #: blueprint the functions are active for, or ``None`` for all\n #: requests.\n #:\n #: To register a function, use the :meth:`teardown_request`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.teardown_request_funcs: t.Dict[\n ft.AppOrBlueprintKey, t.List[ft.TeardownCallable]\n ] = defaultdict(list)\n\n #: A data structure of functions to call to pass extra context\n #: values when rendering templates, in the format\n #: ``{scope: [functions]}``. The ``scope`` key is the name of a\n #: blueprint the functions are active for, or ``None`` for all\n #: requests.\n #:\n #: To register a function, use the :meth:`context_processor`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.template_context_processors: t.Dict[\n ft.AppOrBlueprintKey, t.List[ft.TemplateContextProcessorCallable]\n ] = defaultdict(list, {None: [_default_template_ctx_processor]})\n\n #: A data structure of functions to call to modify the keyword\n #: arguments passed to the view function, in the format\n #: ``{scope: [functions]}``. The ``scope`` key is the name of a\n #: blueprint the functions are active for, or ``None`` for all\n #: requests.\n #:\n #: To register a function, use the\n #: :meth:`url_value_preprocessor` decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.url_value_preprocessors: t.Dict[\n ft.AppOrBlueprintKey,\n t.List[ft.URLValuePreprocessorCallable],\n ] = defaultdict(list)\n\n #: A data structure of functions to call to modify the keyword\n #: arguments when generating URLs, in the format\n #: ``{scope: [functions]}``. The ``scope`` key is the name of a\n #: blueprint the functions are active for, or ``None`` for all\n #: requests.\n #:\n #: To register a function, use the :meth:`url_defaults`\n #: decorator.\n #:\n #: This data structure is internal. It should not be modified\n #: directly and its format may change at any time.\n self.url_default_functions: t.Dict[\n ft.AppOrBlueprintKey, t.List[ft.URLDefaultCallable]\n ] = defaultdict(list)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__repr___Scaffold.static_url_path_6.self._static_url_path.value": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.__repr___Scaffold.static_url_path_6.self._static_url_path.value", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 224, "end_line": 276, "span_ids": ["Scaffold.static_folder", "Scaffold.__repr__", "Scaffold.static_url_path", "Scaffold._check_setup_finished", "Scaffold.static_url_path_6", "Scaffold.static_folder_3", "Scaffold.has_static_folder"], "tokens": 377}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def __repr__(self) -> str:\n return f\"<{type(self).__name__} {self.name!r}>\"\n\n def _check_setup_finished(self, f_name: str) -> None:\n raise NotImplementedError\n\n @property\n def static_folder(self) -> t.Optional[str]:\n \"\"\"The absolute path to the configured static folder. ``None``\n if no static folder is set.\n \"\"\"\n if self._static_folder is not None:\n return os.path.join(self.root_path, self._static_folder)\n else:\n return None\n\n @static_folder.setter\n def static_folder(self, value: t.Optional[t.Union[str, os.PathLike]]) -> None:\n if value is not None:\n value = os.fspath(value).rstrip(r\"\\/\")\n\n self._static_folder = value\n\n @property\n def has_static_folder(self) -> bool:\n \"\"\"``True`` if :attr:`static_folder` is set.\n\n .. versionadded:: 0.5\n \"\"\"\n return self.static_folder is not None\n\n @property\n def static_url_path(self) -> t.Optional[str]:\n \"\"\"The URL prefix that the static route will be accessible from.\n\n If it was not configured during init, it is derived from\n :attr:`static_folder`.\n \"\"\"\n if self._static_url_path is not None:\n return self._static_url_path\n\n if self.static_folder is not None:\n basename = os.path.basename(self.static_folder)\n return f\"/{basename}\".rstrip(\"/\")\n\n return None\n\n @static_url_path.setter\n def static_url_path(self, value: t.Optional[str]) -> None:\n if value is not None:\n value = value.rstrip(\"/\")\n\n self._static_url_path = value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.send_static_file_Scaffold.send_static_file.return.send_from_directory_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.send_static_file_Scaffold.send_static_file.return.send_from_directory_", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 312, "end_line": 328, "span_ids": ["Scaffold.send_static_file"], "tokens": 167}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def send_static_file(self, filename: str) -> \"Response\":\n \"\"\"The view function used to serve files from\n :attr:`static_folder`. A route is automatically registered for\n this view at :attr:`static_url_path` if :attr:`static_folder` is\n set.\n\n .. versionadded:: 0.5\n \"\"\"\n if not self.has_static_folder:\n raise RuntimeError(\"'static_folder' must be set to serve static_files.\")\n\n # send_file only knows to call get_send_file_max_age on the app,\n # call it here so it works for blueprints too.\n max_age = self.get_send_file_max_age(filename)\n return send_from_directory(\n t.cast(str, self.static_folder), filename, max_age=max_age\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.jinja_loader_Scaffold.jinja_loader.if_self_template_folder_i.else_.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.jinja_loader_Scaffold.jinja_loader.if_self_template_folder_i.else_.return.None", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 320, "end_line": 331, "span_ids": ["Scaffold.jinja_loader"], "tokens": 109}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @cached_property\n def jinja_loader(self) -> t.Optional[FileSystemLoader]:\n \"\"\"The Jinja loader for this object's templates. By default this\n is a class :class:`jinja2.loaders.FileSystemLoader` to\n :attr:`template_folder` if it is set.\n\n .. versionadded:: 0.5\n \"\"\"\n if self.template_folder is not None:\n return FileSystemLoader(os.path.join(self.root_path, self.template_folder))\n else:\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.open_resource_Scaffold.open_resource.return.open_os_path_join_self_ro": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.open_resource_Scaffold.open_resource.return.open_os_path_join_self_ro", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 343, "end_line": 364, "span_ids": ["Scaffold.open_resource"], "tokens": 209}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def open_resource(self, resource: str, mode: str = \"rb\") -> t.IO[t.AnyStr]:\n \"\"\"Open a resource file relative to :attr:`root_path` for\n reading.\n\n For example, if the file ``schema.sql`` is next to the file\n ``app.py`` where the ``Flask`` app is defined, it can be opened\n with:\n\n .. code-block:: python\n\n with app.open_resource(\"schema.sql\") as f:\n conn.executescript(f.read())\n\n :param resource: Path to the resource relative to\n :attr:`root_path`.\n :param mode: Open the file in this mode. Only reading is\n supported, valid values are \"r\" (or \"rt\") and \"rb\".\n \"\"\"\n if mode not in {\"r\", \"rt\", \"rb\"}:\n raise ValueError(\"Resources can only be opened for reading.\")\n\n return open(os.path.join(self.root_path, resource), mode)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._method_route_Scaffold.patch.return.self__method_route_PATCH": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._method_route_Scaffold.patch.return.self__method_route_PATCH", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 356, "end_line": 405, "span_ids": ["Scaffold.delete", "Scaffold.put", "Scaffold._method_route", "Scaffold.get", "Scaffold.patch", "Scaffold.post"], "tokens": 444}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def _method_route(\n self,\n method: str,\n rule: str,\n options: dict,\n ) -> t.Callable[[T_route], T_route]:\n if \"methods\" in options:\n raise TypeError(\"Use the 'route' decorator to use the 'methods' argument.\")\n\n return self.route(rule, methods=[method], **options)\n\n @setupmethod\n def get(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Shortcut for :meth:`route` with ``methods=[\"GET\"]``.\n\n .. versionadded:: 2.0\n \"\"\"\n return self._method_route(\"GET\", rule, options)\n\n @setupmethod\n def post(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Shortcut for :meth:`route` with ``methods=[\"POST\"]``.\n\n .. versionadded:: 2.0\n \"\"\"\n return self._method_route(\"POST\", rule, options)\n\n @setupmethod\n def put(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Shortcut for :meth:`route` with ``methods=[\"PUT\"]``.\n\n .. versionadded:: 2.0\n \"\"\"\n return self._method_route(\"PUT\", rule, options)\n\n @setupmethod\n def delete(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Shortcut for :meth:`route` with ``methods=[\"DELETE\"]``.\n\n .. versionadded:: 2.0\n \"\"\"\n return self._method_route(\"DELETE\", rule, options)\n\n @setupmethod\n def patch(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Shortcut for :meth:`route` with ``methods=[\"PATCH\"]``.\n\n .. versionadded:: 2.0\n \"\"\"\n return self._method_route(\"PATCH\", rule, options)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.route_Scaffold.route.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.route_Scaffold.route.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 407, "end_line": 437, "span_ids": ["Scaffold.route"], "tokens": 237}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def route(self, rule: str, **options: t.Any) -> t.Callable[[T_route], T_route]:\n \"\"\"Decorate a view function to register it with the given URL\n rule and options. Calls :meth:`add_url_rule`, which has more\n details about the implementation.\n\n .. code-block:: python\n\n @app.route(\"/\")\n def index():\n return \"Hello, World!\"\n\n See :ref:`url-route-registrations`.\n\n The endpoint name for the route defaults to the name of the view\n function if the ``endpoint`` parameter isn't passed.\n\n The ``methods`` parameter defaults to ``[\"GET\"]``. ``HEAD`` and\n ``OPTIONS`` are added automatically.\n\n :param rule: The URL rule string.\n :param options: Extra options passed to the\n :class:`~werkzeug.routing.Rule` object.\n \"\"\"\n\n def decorator(f: T_route) -> T_route:\n endpoint = options.pop(\"endpoint\", None)\n self.add_url_rule(rule, endpoint, f, **options)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.add_url_rule_Scaffold.add_url_rule.raise_NotImplementedError": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.add_url_rule_Scaffold.add_url_rule.raise_NotImplementedError", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 439, "end_line": 505, "span_ids": ["Scaffold.add_url_rule"], "tokens": 501}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def add_url_rule(\n self,\n rule: str,\n endpoint: t.Optional[str] = None,\n view_func: t.Optional[ft.RouteCallable] = None,\n provide_automatic_options: t.Optional[bool] = None,\n **options: t.Any,\n ) -> None:\n \"\"\"Register a rule for routing incoming requests and building\n URLs. The :meth:`route` decorator is a shortcut to call this\n with the ``view_func`` argument. These are equivalent:\n\n .. code-block:: python\n\n @app.route(\"/\")\n def index():\n ...\n\n .. code-block:: python\n\n def index():\n ...\n\n app.add_url_rule(\"/\", view_func=index)\n\n See :ref:`url-route-registrations`.\n\n The endpoint name for the route defaults to the name of the view\n function if the ``endpoint`` parameter isn't passed. An error\n will be raised if a function has already been registered for the\n endpoint.\n\n The ``methods`` parameter defaults to ``[\"GET\"]``. ``HEAD`` is\n always added automatically, and ``OPTIONS`` is added\n automatically by default.\n\n ``view_func`` does not necessarily need to be passed, but if the\n rule should participate in routing an endpoint name must be\n associated with a view function at some point with the\n :meth:`endpoint` decorator.\n\n .. code-block:: python\n\n app.add_url_rule(\"/\", endpoint=\"index\")\n\n @app.endpoint(\"index\")\n def index():\n ...\n\n If ``view_func`` has a ``required_methods`` attribute, those\n methods are added to the passed and automatic methods. If it\n has a ``provide_automatic_methods`` attribute, it is used as the\n default if the parameter is not passed.\n\n :param rule: The URL rule string.\n :param endpoint: The endpoint name to associate with the rule\n and view function. Used when routing and building URLs.\n Defaults to ``view_func.__name__``.\n :param view_func: The view function to associate with the\n endpoint name.\n :param provide_automatic_options: Add the ``OPTIONS`` method and\n respond to ``OPTIONS`` requests automatically.\n :param options: Extra options passed to the\n :class:`~werkzeug.routing.Rule` object.\n \"\"\"\n raise NotImplementedError", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.endpoint_Scaffold.endpoint.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.endpoint_Scaffold.endpoint.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 507, "end_line": 529, "span_ids": ["Scaffold.endpoint"], "tokens": 143}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def endpoint(self, endpoint: str) -> t.Callable[[F], F]:\n \"\"\"Decorate a view function to register it for the given\n endpoint. Used if a rule is added without a ``view_func`` with\n :meth:`add_url_rule`.\n\n .. code-block:: python\n\n app.add_url_rule(\"/ex\", endpoint=\"example\")\n\n @app.endpoint(\"example\")\n def example():\n ...\n\n :param endpoint: The endpoint name to associate with the view\n function.\n \"\"\"\n\n def decorator(f: F) -> F:\n self.view_functions[endpoint] = f\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.before_request_Scaffold.before_request.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.before_request_Scaffold.before_request.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 531, "end_line": 556, "span_ids": ["Scaffold.before_request"], "tokens": 234}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def before_request(self, f: T_before_request) -> T_before_request:\n \"\"\"Register a function to run before each request.\n\n For example, this can be used to open a database connection, or\n to load the logged in user from the session.\n\n .. code-block:: python\n\n @app.before_request\n def load_user():\n if \"user_id\" in session:\n g.user = db.session.get(session[\"user_id\"])\n\n The function will be called without any arguments. If it returns\n a non-``None`` value, the value is handled as if it was the\n return value from the view, and further request handling is\n stopped.\n\n This is available on both app and blueprint objects. When used on an app, this\n executes before every request. When used on a blueprint, this executes before\n every request that the blueprint handles. To register with a blueprint and\n execute before every request, use :meth:`.Blueprint.before_app_request`.\n \"\"\"\n self.before_request_funcs.setdefault(None, []).append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.after_request_Scaffold.after_request.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.after_request_Scaffold.after_request.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 558, "end_line": 577, "span_ids": ["Scaffold.after_request"], "tokens": 214}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def after_request(self, f: T_after_request) -> T_after_request:\n \"\"\"Register a function to run after each request to this object.\n\n The function is called with the response object, and must return\n a response object. This allows the functions to modify or\n replace the response before it is sent.\n\n If a function raises an exception, any remaining\n ``after_request`` functions will not be called. Therefore, this\n should not be used for actions that must execute, such as to\n close resources. Use :meth:`teardown_request` for that.\n\n This is available on both app and blueprint objects. When used on an app, this\n executes after every request. When used on a blueprint, this executes after\n every request that the blueprint handles. To register with a blueprint and\n execute after every request, use :meth:`.Blueprint.after_app_request`.\n \"\"\"\n self.after_request_funcs.setdefault(None, []).append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.teardown_request_Scaffold.teardown_request.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.teardown_request_Scaffold.teardown_request.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 579, "end_line": 611, "span_ids": ["Scaffold.teardown_request"], "tokens": 303}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def teardown_request(self, f: T_teardown) -> T_teardown:\n \"\"\"Register a function to be called when the request context is\n popped. Typically this happens at the end of each request, but\n contexts may be pushed manually as well during testing.\n\n .. code-block:: python\n\n with app.test_request_context():\n ...\n\n When the ``with`` block exits (or ``ctx.pop()`` is called), the\n teardown functions are called just before the request context is\n made inactive.\n\n When a teardown function was called because of an unhandled\n exception it will be passed an error object. If an\n :meth:`errorhandler` is registered, it will handle the exception\n and the teardown will not receive it.\n\n Teardown functions must avoid raising exceptions. If they\n execute code that might fail they must surround that code with a\n ``try``/``except`` block and log any errors.\n\n The return values of teardown functions are ignored.\n\n This is available on both app and blueprint objects. When used on an app, this\n executes after every request. When used on a blueprint, this executes after\n every request that the blueprint handles. To register with a blueprint and\n execute after every request, use :meth:`.Blueprint.teardown_app_request`.\n \"\"\"\n self.teardown_request_funcs.setdefault(None, []).append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.errorhandler_Scaffold.errorhandler.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.errorhandler_Scaffold.errorhandler.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 669, "end_line": 711, "span_ids": ["Scaffold.errorhandler"], "tokens": 352}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def errorhandler(\n self, code_or_exception: t.Union[t.Type[Exception], int]\n ) -> t.Callable[[T_error_handler], T_error_handler]:\n \"\"\"Register a function to handle errors by code or exception class.\n\n A decorator that is used to register a function given an\n error code. Example::\n\n @app.errorhandler(404)\n def page_not_found(error):\n return 'This page does not exist', 404\n\n You can also register handlers for arbitrary exceptions::\n\n @app.errorhandler(DatabaseError)\n def special_exception_handler(error):\n return 'Database connection failed', 500\n\n This is available on both app and blueprint objects. When used on an app, this\n can handle errors from every request. When used on a blueprint, this can handle\n errors from requests that the blueprint handles. To register with a blueprint\n and affect every request, use :meth:`.Blueprint.app_errorhandler`.\n\n .. versionadded:: 0.7\n Use :meth:`register_error_handler` instead of modifying\n :attr:`error_handler_spec` directly, for application wide error\n handlers.\n\n .. versionadded:: 0.7\n One can now additionally also register custom exception types\n that do not necessarily have to be a subclass of the\n :class:`~werkzeug.exceptions.HTTPException` class.\n\n :param code_or_exception: the code as integer for the handler, or\n an arbitrary exception\n \"\"\"\n\n def decorator(f: T_error_handler) -> T_error_handler:\n self.register_error_handler(code_or_exception, f)\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.register_error_handler_Scaffold.register_error_handler.self_error_handler_spec_N": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.register_error_handler_Scaffold.register_error_handler.self_error_handler_spec_N", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 713, "end_line": 726, "span_ids": ["Scaffold.register_error_handler"], "tokens": 118}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def register_error_handler(\n self,\n code_or_exception: t.Union[t.Type[Exception], int],\n f: ft.ErrorHandlerCallable,\n ) -> None:\n \"\"\"Alternative error attach function to the :meth:`errorhandler`\n decorator that is more straightforward to use for non decorator\n usage.\n\n .. versionadded:: 0.7\n \"\"\"\n exc_class, code = self._get_exc_class_and_code(code_or_exception)\n self.error_handler_spec[None][code][exc_class] = f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._get_exc_class_and_code_Scaffold._get_exc_class_and_code.if_issubclass_exc_class_.else_.return.exc_class_None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold._get_exc_class_and_code_Scaffold._get_exc_class_and_code.if_issubclass_exc_class_.else_.return.exc_class_None", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 728, "end_line": 770, "span_ids": ["Scaffold._get_exc_class_and_code"], "tokens": 325}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @staticmethod\n def _get_exc_class_and_code(\n exc_class_or_code: t.Union[t.Type[Exception], int]\n ) -> t.Tuple[t.Type[Exception], t.Optional[int]]:\n \"\"\"Get the exception class being handled. For HTTP status codes\n or ``HTTPException`` subclasses, return both the exception and\n status code.\n\n :param exc_class_or_code: Any exception class, or an HTTP status\n code as an integer.\n \"\"\"\n exc_class: t.Type[Exception]\n\n if isinstance(exc_class_or_code, int):\n try:\n exc_class = default_exceptions[exc_class_or_code]\n except KeyError:\n raise ValueError(\n f\"'{exc_class_or_code}' is not a recognized HTTP\"\n \" error code. Use a subclass of HTTPException with\"\n \" that code instead.\"\n ) from None\n else:\n exc_class = exc_class_or_code\n\n if isinstance(exc_class, Exception):\n raise TypeError(\n f\"{exc_class!r} is an instance, not a class. Handlers\"\n \" can only be registered for Exception classes or HTTP\"\n \" error codes.\"\n )\n\n if not issubclass(exc_class, Exception):\n raise ValueError(\n f\"'{exc_class.__name__}' is not a subclass of Exception.\"\n \" Handlers can only be registered for Exception classes\"\n \" or HTTP error codes.\"\n )\n\n if issubclass(exc_class, HTTPException):\n return exc_class, exc_class.code\n else:\n return exc_class, None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__find_package_path__find_package_path.return.package_path": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__find_package_path__find_package_path.return.package_path", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 815, "end_line": 880, "span_ids": ["_find_package_path"], "tokens": 565}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _find_package_path(import_name):\n \"\"\"Find the path that contains the package or module.\"\"\"\n root_mod_name, _, _ = import_name.partition(\".\")\n\n try:\n root_spec = importlib.util.find_spec(root_mod_name)\n\n if root_spec is None:\n raise ValueError(\"not found\")\n # ImportError: the machinery told us it does not exist\n # ValueError:\n # - the module name was invalid\n # - the module name is __main__\n # - *we* raised `ValueError` due to `root_spec` being `None`\n except (ImportError, ValueError):\n pass # handled below\n else:\n # namespace package\n if root_spec.origin in {\"namespace\", None}:\n package_spec = importlib.util.find_spec(import_name)\n if package_spec is not None and package_spec.submodule_search_locations:\n # Pick the path in the namespace that contains the submodule.\n package_path = pathlib.Path(\n os.path.commonpath(package_spec.submodule_search_locations)\n )\n search_locations = (\n location\n for location in root_spec.submodule_search_locations\n if _path_is_relative_to(package_path, location)\n )\n else:\n # Pick the first path.\n search_locations = iter(root_spec.submodule_search_locations)\n return os.path.dirname(next(search_locations))\n # a package (with __init__.py)\n elif root_spec.submodule_search_locations:\n return os.path.dirname(os.path.dirname(root_spec.origin))\n # just a normal module\n else:\n return os.path.dirname(root_spec.origin)\n\n # we were unable to find the `package_path` using PEP 451 loaders\n loader = pkgutil.get_loader(root_mod_name)\n\n if loader is None or root_mod_name == \"__main__\":\n # import name is not found, or interactive/main module\n return os.getcwd()\n\n if hasattr(loader, \"get_filename\"):\n filename = loader.get_filename(root_mod_name)\n elif hasattr(loader, \"archive\"):\n # zipimporter's loader.archive points to the .egg or .zip file.\n filename = loader.archive\n else:\n # At least one loader is missing both get_filename and archive:\n # Google App Engine's HardenedModulesHook, use __file__.\n filename = importlib.import_module(root_mod_name).__file__\n\n package_path = os.path.abspath(os.path.dirname(filename))\n\n # If the imported name is a package, filename is currently pointing\n # to the root of the package, need to get the current directory.\n if _matching_loader_thinks_module_is_package(loader, root_mod_name):\n package_path = os.path.dirname(package_path)\n\n return package_path", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_find_package_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_find_package_", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 883, "end_line": 922, "span_ids": ["find_package"], "tokens": 318}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def find_package(import_name: str):\n \"\"\"Find the prefix that a package is installed under, and the path\n that it would be imported from.\n\n The prefix is the directory containing the standard directory\n hierarchy (lib, bin, etc.). If the package is not installed to the\n system (:attr:`sys.prefix`) or a virtualenv (``site-packages``),\n ``None`` is returned.\n\n The path is the entry in :attr:`sys.path` that contains the package\n for import. If the package is not installed, it's assumed that the\n package was imported from the current working directory.\n \"\"\"\n package_path = _find_package_path(import_name)\n py_prefix = os.path.abspath(sys.prefix)\n\n # installed to the system\n if _path_is_relative_to(pathlib.PurePath(package_path), py_prefix):\n return py_prefix, package_path\n\n site_parent, site_folder = os.path.split(package_path)\n\n # installed to a virtualenv\n if site_folder.lower() == \"site-packages\":\n parent, folder = os.path.split(site_parent)\n\n # Windows (prefix/lib/site-packages)\n if folder.lower() == \"lib\":\n return parent, package_path\n\n # Unix (prefix/lib/pythonX.Y/site-packages)\n if os.path.basename(parent).lower() == \"lib\":\n return os.path.dirname(parent), package_path\n\n # something else (prefix/site-packages)\n return site_parent, package_path\n\n # not installed\n return None, package_path", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_hashlib_SessionMixin.accessed.True": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_hashlib_SessionMixin.accessed.True", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 46, "span_ids": ["SessionMixin", "imports:12", "impl", "SessionMixin:3", "SessionMixin.permanent", "SessionMixin.permanent_1", "imports"], "tokens": 315}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import hashlib\nimport typing as t\nimport warnings\nfrom collections.abc import MutableMapping\nfrom datetime import datetime\nfrom datetime import timezone\n\nfrom itsdangerous import BadSignature\nfrom itsdangerous import URLSafeTimedSerializer\nfrom werkzeug.datastructures import CallbackDict\n\nfrom .helpers import is_ip\nfrom .json.tag import TaggedJSONSerializer\n\nif t.TYPE_CHECKING: # pragma: no cover\n import typing_extensions as te\n from .app import Flask\n from .wrappers import Request, Response\n\n\nclass SessionMixin(MutableMapping):\n \"\"\"Expands a basic dictionary with session attributes.\"\"\"\n\n @property\n def permanent(self) -> bool:\n \"\"\"This reflects the ``'_permanent'`` key in the dict.\"\"\"\n return self.get(\"_permanent\", False)\n\n @permanent.setter\n def permanent(self, value: bool) -> None:\n self[\"_permanent\"] = bool(value)\n\n #: Some implementations can detect whether a session is newly\n #: created, but that is not guaranteed. Use with caution. The mixin\n # default is hard-coded ``False``.\n new = False\n\n #: Some implementations can detect changes to the session and set\n #: this when that happens. The mixin default is hard coded to\n #: ``True``.\n modified = True\n\n #: Some implementations can detect when session data is read or\n #: written and set this when that happens. The mixin default is hard\n #: coded to ``True``.\n accessed = True", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSession_SecureCookieSession.setdefault.return.super_setdefault_key_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSession_SecureCookieSession.setdefault.return.super_setdefault_key_d", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 48, "end_line": 87, "span_ids": ["SecureCookieSession.__getitem__", "SecureCookieSession.setdefault", "SecureCookieSession.get", "SecureCookieSession", "SecureCookieSession.__init__.on_update"], "tokens": 381}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SecureCookieSession(CallbackDict, SessionMixin):\n \"\"\"Base class for sessions based on signed cookies.\n\n This session backend will set the :attr:`modified` and\n :attr:`accessed` attributes. It cannot reliably track whether a\n session is new (vs. empty), so :attr:`new` remains hard coded to\n ``False``.\n \"\"\"\n\n #: When data is changed, this is set to ``True``. Only the session\n #: dictionary itself is tracked; if the session contains mutable\n #: data (for example a nested dict) then this must be set to\n #: ``True`` manually when modifying that data. The session cookie\n #: will only be written to the response if this is ``True``.\n modified = False\n\n #: When data is read or written, this is set to ``True``. Used by\n # :class:`.SecureCookieSessionInterface` to add a ``Vary: Cookie``\n #: header, which allows caching proxies to cache different pages for\n #: different users.\n accessed = False\n\n def __init__(self, initial: t.Any = None) -> None:\n def on_update(self) -> None:\n self.modified = True\n self.accessed = True\n\n super().__init__(initial, on_update)\n\n def __getitem__(self, key: str) -> t.Any:\n self.accessed = True\n return super().__getitem__(key)\n\n def get(self, key: str, default: t.Any = None) -> t.Any:\n self.accessed = True\n return super().get(key, default)\n\n def setdefault(self, key: str, default: t.Any = None) -> t.Any:\n self.accessed = True\n return super().setdefault(key, default)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_NullSession_NullSession.del__fail": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_NullSession_NullSession.del__fail", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 90, "end_line": 104, "span_ids": ["NullSession", "NullSession:3", "NullSession._fail"], "tokens": 148}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class NullSession(SecureCookieSession):\n \"\"\"Class used to generate nicer error messages if sessions are not\n available. Will still allow read-only access to the empty session\n but fail on setting.\n \"\"\"\n\n def _fail(self, *args: t.Any, **kwargs: t.Any) -> \"te.NoReturn\":\n raise RuntimeError(\n \"The session is unavailable because no secret \"\n \"key was set. Set the secret_key on the \"\n \"application to something unique and secret.\"\n )\n\n __setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail # type: ignore # noqa: B950\n del _fail", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface_SessionInterface.pickle_based.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface_SessionInterface.pickle_based.False", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 108, "end_line": 156, "span_ids": ["SessionInterface"], "tokens": 468}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n \"\"\"The basic interface you have to implement in order to replace the\n default session interface which uses werkzeug's securecookie\n implementation. The only methods you have to implement are\n :meth:`open_session` and :meth:`save_session`, the others have\n useful defaults which you don't need to change.\n\n The session object returned by the :meth:`open_session` method has to\n provide a dictionary like interface plus the properties and methods\n from the :class:`SessionMixin`. We recommend just subclassing a dict\n and adding that mixin::\n\n class Session(dict, SessionMixin):\n pass\n\n If :meth:`open_session` returns ``None`` Flask will call into\n :meth:`make_null_session` to create a session that acts as replacement\n if the session support cannot work because some requirement is not\n fulfilled. The default :class:`NullSession` class that is created\n will complain that the secret key was not set.\n\n To replace the session interface on an application all you have to do\n is to assign :attr:`flask.Flask.session_interface`::\n\n app = Flask(__name__)\n app.session_interface = MySessionInterface()\n\n Multiple requests with the same session may be sent and handled\n concurrently. When implementing a new session interface, consider\n whether reads or writes to the backing store must be synchronized.\n There is no guarantee on the order in which the session for each\n request is opened or saved, it will occur in the order that requests\n begin and end processing.\n\n .. versionadded:: 0.8\n \"\"\"\n\n #: :meth:`make_null_session` will look here for the class that should\n #: be created when a null session is requested. Likewise the\n #: :meth:`is_null_session` method will perform a typecheck against\n #: this type.\n null_session_class = NullSession\n\n #: A flag that indicates if the session interface is pickle based.\n #: This can be used by Flask extensions to make a decision in regards\n #: to how to deal with the session object.\n #:\n #: .. versionadded:: 0.10\n pickle_based = False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.make_null_session_SessionInterface.make_null_session.return.self_null_session_class_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.make_null_session_SessionInterface.make_null_session.return.self_null_session_class_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 150, "end_line": 160, "span_ids": ["SessionInterface.make_null_session"], "tokens": 117}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def make_null_session(self, app: \"Flask\") -> NullSession:\n \"\"\"Creates a null session which acts as a replacement object if the\n real session support could not be loaded due to a configuration\n error. This mainly aids the user experience because the job of the\n null session is to still support lookup without complaining but\n modifications are answered with a helpful error message of what\n failed.\n\n This creates an instance of :attr:`null_session_class` by default.\n \"\"\"\n return self.null_session_class()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_domain_SessionInterface.get_cookie_domain.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_domain_SessionInterface.get_cookie_domain.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 178, "end_line": 234, "span_ids": ["SessionInterface.get_cookie_domain"], "tokens": 473}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def get_cookie_domain(self, app: \"Flask\") -> t.Optional[str]:\n \"\"\"Returns the domain that should be set for the session cookie.\n\n Uses ``SESSION_COOKIE_DOMAIN`` if it is configured, otherwise\n falls back to detecting the domain based on ``SERVER_NAME``.\n\n Once detected (or if not set at all), ``SESSION_COOKIE_DOMAIN`` is\n updated to avoid re-running the logic.\n \"\"\"\n\n rv = app.config[\"SESSION_COOKIE_DOMAIN\"]\n\n # set explicitly, or cached from SERVER_NAME detection\n # if False, return None\n if rv is not None:\n return rv if rv else None\n\n rv = app.config[\"SERVER_NAME\"]\n\n # server name not set, cache False to return none next time\n if not rv:\n app.config[\"SESSION_COOKIE_DOMAIN\"] = False\n return None\n\n # chop off the port which is usually not supported by browsers\n # remove any leading '.' since we'll add that later\n rv = rv.rsplit(\":\", 1)[0].lstrip(\".\")\n\n if \".\" not in rv:\n # Chrome doesn't allow names without a '.'. This should only\n # come up with localhost. Hack around this by not setting\n # the name, and show a warning.\n warnings.warn(\n f\"{rv!r} is not a valid cookie domain, it must contain\"\n \" a '.'. Add an entry to your hosts file, for example\"\n f\" '{rv}.localdomain', and use that instead.\"\n )\n app.config[\"SESSION_COOKIE_DOMAIN\"] = False\n return None\n\n ip = is_ip(rv)\n\n if ip:\n warnings.warn(\n \"The session cookie domain is an IP address. This may not work\"\n \" as intended in some browsers. Add an entry to your hosts\"\n ' file, for example \"localhost.localdomain\", and use that'\n \" instead.\"\n )\n\n # if this is not an ip and app is mounted at the root, allow subdomain\n # matching by adding a '.' prefix\n if self.get_cookie_path(app) == \"/\" and not ip:\n rv = f\".{rv}\"\n\n app.config[\"SESSION_COOKIE_DOMAIN\"] = rv\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_path_SessionInterface.get_expiration_time.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.get_cookie_path_SessionInterface.get_expiration_time.return.None", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 241, "end_line": 279, "span_ids": ["SessionInterface.get_cookie_secure", "SessionInterface.get_cookie_path", "SessionInterface.get_expiration_time", "SessionInterface.get_cookie_samesite", "SessionInterface.get_cookie_httponly"], "tokens": 406}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def get_cookie_path(self, app: \"Flask\") -> str:\n \"\"\"Returns the path for which the cookie should be valid. The\n default implementation uses the value from the ``SESSION_COOKIE_PATH``\n config var if it's set, and falls back to ``APPLICATION_ROOT`` or\n uses ``/`` if it's ``None``.\n \"\"\"\n return app.config[\"SESSION_COOKIE_PATH\"] or app.config[\"APPLICATION_ROOT\"]\n\n def get_cookie_httponly(self, app: \"Flask\") -> bool:\n \"\"\"Returns True if the session cookie should be httponly. This\n currently just returns the value of the ``SESSION_COOKIE_HTTPONLY``\n config var.\n \"\"\"\n return app.config[\"SESSION_COOKIE_HTTPONLY\"]\n\n def get_cookie_secure(self, app: \"Flask\") -> bool:\n \"\"\"Returns True if the cookie should be secure. This currently\n just returns the value of the ``SESSION_COOKIE_SECURE`` setting.\n \"\"\"\n return app.config[\"SESSION_COOKIE_SECURE\"]\n\n def get_cookie_samesite(self, app: \"Flask\") -> str:\n \"\"\"Return ``'Strict'`` or ``'Lax'`` if the cookie should use the\n ``SameSite`` attribute. This currently just returns the value of\n the :data:`SESSION_COOKIE_SAMESITE` setting.\n \"\"\"\n return app.config[\"SESSION_COOKIE_SAMESITE\"]\n\n def get_expiration_time(\n self, app: \"Flask\", session: SessionMixin\n ) -> t.Optional[datetime]:\n \"\"\"A helper method that returns an expiration date for the session\n or ``None`` if the session is linked to the browser session. The\n default implementation returns now + the permanent session\n lifetime configured on the application.\n \"\"\"\n if session.permanent:\n return datetime.now(timezone.utc) + app.permanent_session_lifetime\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.should_set_cookie_SessionInterface.should_set_cookie.return.session_modified_or_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.should_set_cookie_SessionInterface.should_set_cookie.return.session_modified_or_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 276, "end_line": 290, "span_ids": ["SessionInterface.should_set_cookie"], "tokens": 144}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def should_set_cookie(self, app: \"Flask\", session: SessionMixin) -> bool:\n \"\"\"Used by session backends to determine if a ``Set-Cookie`` header\n should be set for this session cookie for this response. If the session\n has been modified, the cookie is set. If the session is permanent and\n the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is\n always set.\n\n This check is usually skipped if the session was deleted.\n\n .. versionadded:: 0.11\n \"\"\"\n\n return session.modified or (\n session.permanent and app.config[\"SESSION_REFRESH_EACH_REQUEST\"]\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.open_session_session_json_serializer.TaggedJSONSerializer_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.open_session_session_json_serializer.TaggedJSONSerializer_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 297, "end_line": 323, "span_ids": ["impl:2", "SessionInterface.save_session", "SessionInterface.open_session"], "tokens": 222}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def open_session(\n self, app: \"Flask\", request: \"Request\"\n ) -> t.Optional[SessionMixin]:\n \"\"\"This is called at the beginning of each request, after\n pushing the request context, before matching the URL.\n\n This must return an object which implements a dictionary-like\n interface as well as the :class:`SessionMixin` interface.\n\n This will return ``None`` to indicate that loading failed in\n some way that is not immediately an error. The request\n context will fall back to using :meth:`make_null_session`\n in this case.\n \"\"\"\n raise NotImplementedError()\n\n def save_session(\n self, app: \"Flask\", session: SessionMixin, response: \"Response\"\n ) -> None:\n \"\"\"This is called at the end of each request, after generating\n a response, before removing the request context. It is skipped\n if :meth:`is_null_session` returns ``True``.\n \"\"\"\n raise NotImplementedError()\n\n\nsession_json_serializer = TaggedJSONSerializer()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface_SecureCookieSessionInterface.get_signing_serializer.return.URLSafeTimedSerializer_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface_SecureCookieSessionInterface.get_signing_serializer.return.URLSafeTimedSerializer_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 316, "end_line": 348, "span_ids": ["SecureCookieSessionInterface.get_signing_serializer", "SecureCookieSessionInterface"], "tokens": 276}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SecureCookieSessionInterface(SessionInterface):\n \"\"\"The default session interface that stores sessions in signed cookies\n through the :mod:`itsdangerous` module.\n \"\"\"\n\n #: the salt that should be applied on top of the secret key for the\n #: signing of cookie based sessions.\n salt = \"cookie-session\"\n #: the hash function to use for the signature. The default is sha1\n digest_method = staticmethod(hashlib.sha1)\n #: the name of the itsdangerous supported key derivation. The default\n #: is hmac.\n key_derivation = \"hmac\"\n #: A python serializer for the payload. The default is a compact\n #: JSON derived serializer with support for some extra Python types\n #: such as datetime objects or tuples.\n serializer = session_json_serializer\n session_class = SecureCookieSession\n\n def get_signing_serializer(\n self, app: \"Flask\"\n ) -> t.Optional[URLSafeTimedSerializer]:\n if not app.secret_key:\n return None\n signer_kwargs = dict(\n key_derivation=self.key_derivation, digest_method=self.digest_method\n )\n return URLSafeTimedSerializer(\n app.secret_key,\n salt=self.salt,\n serializer=self.serializer,\n signer_kwargs=signer_kwargs,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.open_session_SecureCookieSessionInterface.open_session.try_.except_BadSignature_.return.self_session_class_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.open_session_SecureCookieSessionInterface.open_session.try_.except_BadSignature_.return.self_session_class_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 350, "end_line": 364, "span_ids": ["SecureCookieSessionInterface.open_session"], "tokens": 127}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SecureCookieSessionInterface(SessionInterface):\n\n def open_session(\n self, app: \"Flask\", request: \"Request\"\n ) -> t.Optional[SecureCookieSession]:\n s = self.get_signing_serializer(app)\n if s is None:\n return None\n val = request.cookies.get(self.get_cookie_name(app))\n if not val:\n return self.session_class()\n max_age = int(app.permanent_session_lifetime.total_seconds())\n try:\n data = s.loads(val, max_age=max_age)\n return self.session_class(data)\n except BadSignature:\n return self.session_class()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.save_session_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SecureCookieSessionInterface.save_session_", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 376, "end_line": 420, "span_ids": ["SecureCookieSessionInterface.save_session"], "tokens": 318}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SecureCookieSessionInterface(SessionInterface):\n\n def save_session(\n self, app: \"Flask\", session: SessionMixin, response: \"Response\"\n ) -> None:\n name = self.get_cookie_name(app)\n domain = self.get_cookie_domain(app)\n path = self.get_cookie_path(app)\n secure = self.get_cookie_secure(app)\n samesite = self.get_cookie_samesite(app)\n httponly = self.get_cookie_httponly(app)\n\n # If the session is modified to be empty, remove the cookie.\n # If the session is empty, return without setting the cookie.\n if not session:\n if session.modified:\n response.delete_cookie(\n name,\n domain=domain,\n path=path,\n secure=secure,\n samesite=samesite,\n httponly=httponly,\n )\n\n return\n\n # Add a \"Vary: Cookie\" header if the session was accessed at all.\n if session.accessed:\n response.vary.add(\"Cookie\")\n\n if not self.should_set_cookie(app, session):\n return\n\n expires = self.get_expiration_time(app, session)\n val = self.get_signing_serializer(app).dumps(dict(session)) # type: ignore\n response.set_cookie(\n name,\n val, # type: ignore\n expires=expires,\n httponly=httponly,\n domain=domain,\n path=path,\n secure=secure,\n samesite=samesite,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/signals.py_t_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/signals.py_t_", "embedding": null, "metadata": {"file_path": "src/flask/signals.py", "file_name": "signals.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 57, "span_ids": ["impl", "try_.except_ImportError_.Namespace:docstring", "try_.except_ImportError_.Namespace.signal", "impl:2", "try_.except_ImportError_._FakeSignal", "try_.except_ImportError_.Namespace", "try_.except_ImportError_._FakeSignal:docstring", "imports", "imports:2", "try_.except_ImportError_._FakeSignal.__init__"], "tokens": 483}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\ntry:\n from blinker import Namespace\n\n signals_available = True\nexcept ImportError:\n signals_available = False\n\n class Namespace: # type: ignore\n def signal(self, name: str, doc: t.Optional[str] = None) -> \"_FakeSignal\":\n return _FakeSignal(name, doc)\n\n class _FakeSignal:\n \"\"\"If blinker is unavailable, create a fake class with the same\n interface that allows sending of signals but will fail with an\n error on anything else. Instead of doing anything on send, it\n will just ignore the arguments and do nothing instead.\n \"\"\"\n\n def __init__(self, name: str, doc: t.Optional[str] = None) -> None:\n self.name = name\n self.__doc__ = doc\n\n def send(self, *args: t.Any, **kwargs: t.Any) -> t.Any:\n pass\n\n def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.Any:\n raise RuntimeError(\n \"Signalling support is unavailable because the blinker\"\n \" library is not installed.\"\n ) from None\n\n connect = connect_via = connected_to = temporarily_connected_to = _fail\n disconnect = _fail\n has_receivers_for = receivers_for = _fail\n del _fail\n\n\n# The namespace for code signals. If you are not Flask code, do\n# not put signals in here. Create your own namespace instead.\n_signals = Namespace()\n\n\n# Core signals. For usage examples grep the source code or consult\n# the API documentation in docs/api.rst as well as docs/signals.rst\ntemplate_rendered = _signals.signal(\"template-rendered\")\nbefore_render_template = _signals.signal(\"before-render-template\")\nrequest_started = _signals.signal(\"request-started\")\nrequest_finished = _signals.signal(\"request-finished\")\nrequest_tearing_down = _signals.signal(\"request-tearing-down\")\ngot_request_exception = _signals.signal(\"got-request-exception\")\nappcontext_tearing_down = _signals.signal(\"appcontext-tearing-down\")\nappcontext_pushed = _signals.signal(\"appcontext-pushed\")\nappcontext_popped = _signals.signal(\"appcontext-popped\")\nmessage_flashed = _signals.signal(\"message-flashed\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_Environment_Environment.__init__.self.app.app": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_Environment_Environment.__init__.self.app.app", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 33, "end_line": 43, "span_ids": ["Environment"], "tokens": 108}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Environment(BaseEnvironment):\n \"\"\"Works like a regular Jinja2 environment but has some additional\n knowledge of how Flask's blueprint works so that it can prepend the\n name of the blueprint to referenced templates if necessary.\n \"\"\"\n\n def __init__(self, app: \"Flask\", **options: t.Any) -> None:\n if \"loader\" not in options:\n options[\"loader\"] = app.create_global_jinja_loader()\n BaseEnvironment.__init__(self, **options)\n self.app = app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader_DispatchingJinjaLoader.get_source.return.self__get_source_fast_env": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader_DispatchingJinjaLoader.get_source.return.self__get_source_fast_env", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 46, "end_line": 59, "span_ids": ["DispatchingJinjaLoader.get_source", "DispatchingJinjaLoader"], "tokens": 127}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DispatchingJinjaLoader(BaseLoader):\n \"\"\"A loader that looks for templates in the application and all\n the blueprint folders.\n \"\"\"\n\n def __init__(self, app: \"Flask\") -> None:\n self.app = app\n\n def get_source( # type: ignore\n self, environment: Environment, template: str\n ) -> t.Tuple[str, t.Optional[str], t.Optional[t.Callable]]:\n if self.app.config[\"EXPLAIN_TEMPLATE_LOADING\"]:\n return self._get_source_explained(environment, template)\n return self._get_source_fast(environment, template)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_explained_DispatchingJinjaLoader._get_source_explained.raise_TemplateNotFound_te": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_explained_DispatchingJinjaLoader._get_source_explained.raise_TemplateNotFound_te", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 61, "end_line": 85, "span_ids": ["DispatchingJinjaLoader._get_source_explained"], "tokens": 210}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DispatchingJinjaLoader(BaseLoader):\n\n def _get_source_explained(\n self, environment: Environment, template: str\n ) -> t.Tuple[str, t.Optional[str], t.Optional[t.Callable]]:\n attempts = []\n rv: t.Optional[t.Tuple[str, t.Optional[str], t.Optional[t.Callable[[], bool]]]]\n trv: t.Optional[\n t.Tuple[str, t.Optional[str], t.Optional[t.Callable[[], bool]]]\n ] = None\n\n for srcobj, loader in self._iter_loaders(template):\n try:\n rv = loader.get_source(environment, template)\n if trv is None:\n trv = rv\n except TemplateNotFound:\n rv = None\n attempts.append((loader, srcobj, rv))\n\n from .debughelpers import explain_template_loading_attempts\n\n explain_template_loading_attempts(self.app, template, attempts)\n\n if trv is not None:\n return trv\n raise TemplateNotFound(template)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_fast_DispatchingJinjaLoader.list_templates.return.list_result_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_DispatchingJinjaLoader._get_source_fast_DispatchingJinjaLoader.list_templates.return.list_result_", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 87, "end_line": 121, "span_ids": ["DispatchingJinjaLoader._iter_loaders", "DispatchingJinjaLoader.list_templates", "DispatchingJinjaLoader._get_source_fast"], "tokens": 256}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DispatchingJinjaLoader(BaseLoader):\n\n def _get_source_fast(\n self, environment: Environment, template: str\n ) -> t.Tuple[str, t.Optional[str], t.Optional[t.Callable]]:\n for _srcobj, loader in self._iter_loaders(template):\n try:\n return loader.get_source(environment, template)\n except TemplateNotFound:\n continue\n raise TemplateNotFound(template)\n\n def _iter_loaders(\n self, template: str\n ) -> t.Generator[t.Tuple[\"Scaffold\", BaseLoader], None, None]:\n loader = self.app.jinja_loader\n if loader is not None:\n yield self.app, loader\n\n for blueprint in self.app.iter_blueprints():\n loader = blueprint.jinja_loader\n if loader is not None:\n yield blueprint, loader\n\n def list_templates(self) -> t.List[str]:\n result = set()\n loader = self.app.jinja_loader\n if loader is not None:\n result.update(loader.list_templates())\n\n for blueprint in self.app.iter_blueprints():\n loader = blueprint.jinja_loader\n if loader is not None:\n for template in loader.list_templates():\n result.add(template)\n\n return list(result)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient_FlaskClient.__init__.self.environ_base._": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient_FlaskClient.__init__.self.environ_base._", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 94, "end_line": 118, "span_ids": ["FlaskClient"], "tokens": 239}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskClient(Client):\n \"\"\"Works like a regular Werkzeug test client but has knowledge about\n Flask's contexts to defer the cleanup of the request context until\n the end of a ``with`` block. For general information about how to\n use this class refer to :class:`werkzeug.test.Client`.\n\n .. versionchanged:: 0.12\n `app.test_client()` includes preset default environment, which can be\n set after instantiation of the `app.test_client()` object in\n `client.environ_base`.\n\n Basic usage is outlined in the :doc:`/testing` chapter.\n \"\"\"\n\n application: \"Flask\"\n\n def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:\n super().__init__(*args, **kwargs)\n self.preserve_context = False\n self._new_contexts: t.List[t.ContextManager[t.Any]] = []\n self._context_stack = ExitStack()\n self.environ_base = {\n \"REMOTE_ADDR\": \"127.0.0.1\",\n \"HTTP_USER_AGENT\": f\"werkzeug/{werkzeug.__version__}\",\n }", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.session_transaction_FlaskClient.session_transaction.with_app_test_request_con.self_cookie_jar_extract_w": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.session_transaction_FlaskClient.session_transaction.with_app_test_request_con.self_cookie_jar_extract_w", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 120, "end_line": 173, "span_ids": ["FlaskClient.session_transaction"], "tokens": 498}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskClient(Client):\n\n @contextmanager\n def session_transaction(\n self, *args: t.Any, **kwargs: t.Any\n ) -> t.Generator[SessionMixin, None, None]:\n \"\"\"When used in combination with a ``with`` statement this opens a\n session transaction. This can be used to modify the session that\n the test client uses. Once the ``with`` block is left the session is\n stored back.\n\n ::\n\n with client.session_transaction() as session:\n session['value'] = 42\n\n Internally this is implemented by going through a temporary test\n request context and since session handling could depend on\n request variables this function accepts the same arguments as\n :meth:`~flask.Flask.test_request_context` which are directly\n passed through.\n \"\"\"\n if self.cookie_jar is None:\n raise RuntimeError(\n \"Session transactions only make sense with cookies enabled.\"\n )\n app = self.application\n environ_overrides = kwargs.setdefault(\"environ_overrides\", {})\n self.cookie_jar.inject_wsgi(environ_overrides)\n outer_reqctx = _cv_request.get(None)\n with app.test_request_context(*args, **kwargs) as c:\n session_interface = app.session_interface\n sess = session_interface.open_session(app, c.request)\n if sess is None:\n raise RuntimeError(\n \"Session backend did not open a session. Check the configuration\"\n )\n\n # Since we have to open a new request context for the session\n # handling we want to make sure that we hide out own context\n # from the caller. By pushing the original request context\n # (or None) on top of this and popping it we get exactly that\n # behavior. It's important to not use the push and pop\n # methods of the actual request context object since that would\n # mean that cleanup handlers are called\n token = _cv_request.set(outer_reqctx) # type: ignore[arg-type]\n try:\n yield sess\n finally:\n _cv_request.reset(token)\n\n resp = app.response_class()\n if not session_interface.is_null_session(sess):\n session_interface.save_session(app, sess, resp)\n headers = resp.get_wsgi_headers(c.request.environ)\n self.cookie_jar.extract_wsgi(c.request.environ, headers)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskCliRunner_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskCliRunner_", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 253, "end_line": 287, "span_ids": ["FlaskCliRunner", "FlaskCliRunner.invoke"], "tokens": 329}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskCliRunner(CliRunner):\n \"\"\"A :class:`~click.testing.CliRunner` for testing a Flask app's\n CLI commands. Typically created using\n :meth:`~flask.Flask.test_cli_runner`. See :ref:`testing-cli`.\n \"\"\"\n\n def __init__(self, app: \"Flask\", **kwargs: t.Any) -> None:\n self.app = app\n super().__init__(**kwargs)\n\n def invoke( # type: ignore\n self, cli: t.Any = None, args: t.Any = None, **kwargs: t.Any\n ) -> t.Any:\n \"\"\"Invokes a CLI command in an isolated environment. See\n :meth:`CliRunner.invoke ` for\n full method documentation. See :ref:`testing-cli` for examples.\n\n If the ``obj`` argument is not given, passes an instance of\n :class:`~flask.cli.ScriptInfo` that knows how to load the Flask\n app being tested.\n\n :param cli: Command object to invoke. Default is the app's\n :attr:`~flask.app.Flask.cli` group.\n :param args: List of strings to invoke the command with.\n\n :return: a :class:`~click.testing.Result` object.\n \"\"\"\n if cli is None:\n cli = self.app.cli # type: ignore\n\n if \"obj\" not in kwargs:\n kwargs[\"obj\"] = ScriptInfo(create_app=lambda: self.app)\n\n return super().invoke(cli, args, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/typing.py_t_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/typing.py_t_", "embedding": null, "metadata": {"file_path": "src/flask/typing.py", "file_name": "typing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 81, "span_ids": ["impl", "impl:34", "impl:2", "docstring:3", "docstring", "imports:4", "imports", "docstring:2", "imports:2", "imports:3"], "tokens": 736}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\nif t.TYPE_CHECKING: # pragma: no cover\n from _typeshed.wsgi import WSGIApplication # noqa: F401\n from werkzeug.datastructures import Headers # noqa: F401\n from werkzeug.wrappers import Response # noqa: F401\n\n# The possible types that are directly convertible or are a Response object.\nResponseValue = t.Union[\n \"Response\",\n str,\n bytes,\n t.List[t.Any],\n # Only dict is actually accepted, but Mapping allows for TypedDict.\n t.Mapping[str, t.Any],\n t.Iterator[str],\n t.Iterator[bytes],\n]\n\n# the possible types for an individual HTTP header\n# This should be a Union, but mypy doesn't pass unless it's a TypeVar.\nHeaderValue = t.Union[str, t.List[str], t.Tuple[str, ...]]\n\n# the possible types for HTTP headers\nHeadersValue = t.Union[\n \"Headers\",\n t.Mapping[str, HeaderValue],\n t.Sequence[t.Tuple[str, HeaderValue]],\n]\n\n# The possible types returned by a route function.\nResponseReturnValue = t.Union[\n ResponseValue,\n t.Tuple[ResponseValue, HeadersValue],\n t.Tuple[ResponseValue, int],\n t.Tuple[ResponseValue, int, HeadersValue],\n \"WSGIApplication\",\n]\n\n# Allow any subclass of werkzeug.Response, such as the one from Flask,\n# as a callback argument. Using werkzeug.Response directly makes a\n# callback annotated with flask.Response fail type checking.\nResponseClass = t.TypeVar(\"ResponseClass\", bound=\"Response\")\n\nAppOrBlueprintKey = t.Optional[str] # The App key is None, whereas blueprints are named\nAfterRequestCallable = t.Union[\n t.Callable[[ResponseClass], ResponseClass],\n t.Callable[[ResponseClass], t.Awaitable[ResponseClass]],\n]\nBeforeFirstRequestCallable = t.Union[\n t.Callable[[], None], t.Callable[[], t.Awaitable[None]]\n]\nBeforeRequestCallable = t.Union[\n t.Callable[[], t.Optional[ResponseReturnValue]],\n t.Callable[[], t.Awaitable[t.Optional[ResponseReturnValue]]],\n]\nShellContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]\nTeardownCallable = t.Union[\n t.Callable[[t.Optional[BaseException]], None],\n t.Callable[[t.Optional[BaseException]], t.Awaitable[None]],\n]\nTemplateContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]\nTemplateFilterCallable = t.Callable[..., t.Any]\nTemplateGlobalCallable = t.Callable[..., t.Any]\nTemplateTestCallable = t.Callable[..., bool]\nURLDefaultCallable = t.Callable[[str, dict], None]\nURLValuePreprocessorCallable = t.Callable[[t.Optional[str], t.Optional[dict]], None]\n\n# This should take Exception, but that either breaks typing the argument\n# with a specific exception, or decorating multiple times with different\n# exceptions (and using a union type on the argument).\n# https://github.com/pallets/flask/issues/4095\n# https://github.com/pallets/flask/issues/4295\n# https://github.com/pallets/flask/issues/4297\nErrorHandlerCallable = t.Callable[[t.Any], ResponseReturnValue]\n\nRouteCallable = t.Union[\n t.Callable[..., ResponseReturnValue],\n t.Callable[..., t.Awaitable[ResponseReturnValue]],\n]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_t_View.dispatch_request.raise_NotImplementedError": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_t_View.dispatch_request.raise_NotImplementedError", "embedding": null, "metadata": {"file_path": "src/flask/views.py", "file_name": "views.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 80, "span_ids": ["impl", "View.dispatch_request", "impl:2", "View", "imports", "imports:2"], "tokens": 676}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\nfrom . import typing as ft\nfrom .globals import current_app\nfrom .globals import request\n\n\nhttp_method_funcs = frozenset(\n [\"get\", \"post\", \"head\", \"options\", \"delete\", \"put\", \"trace\", \"patch\"]\n)\n\n\nclass View:\n \"\"\"Subclass this class and override :meth:`dispatch_request` to\n create a generic class-based view. Call :meth:`as_view` to create a\n view function that creates an instance of the class with the given\n arguments and calls its ``dispatch_request`` method with any URL\n variables.\n\n See :doc:`views` for a detailed guide.\n\n .. code-block:: python\n\n class Hello(View):\n init_every_request = False\n\n def dispatch_request(self, name):\n return f\"Hello, {name}!\"\n\n app.add_url_rule(\n \"/hello/\", view_func=Hello.as_view(\"hello\")\n )\n\n Set :attr:`methods` on the class to change what methods the view\n accepts.\n\n Set :attr:`decorators` on the class to apply a list of decorators to\n the generated view function. Decorators applied to the class itself\n will not be applied to the generated view function!\n\n Set :attr:`init_every_request` to ``False`` for efficiency, unless\n you need to store request-global data on ``self``.\n \"\"\"\n\n #: The methods this view is registered for. Uses the same default\n #: (``[\"GET\", \"HEAD\", \"OPTIONS\"]``) as ``route`` and\n #: ``add_url_rule`` by default.\n methods: t.ClassVar[t.Optional[t.Collection[str]]] = None\n\n #: Control whether the ``OPTIONS`` method is handled automatically.\n #: Uses the same default (``True``) as ``route`` and\n #: ``add_url_rule`` by default.\n provide_automatic_options: t.ClassVar[t.Optional[bool]] = None\n\n #: A list of decorators to apply, in order, to the generated view\n #: function. Remember that ``@decorator`` syntax is applied bottom\n #: to top, so the first decorator in the list would be the bottom\n #: decorator.\n #:\n #: .. versionadded:: 0.8\n decorators: t.ClassVar[t.List[t.Callable]] = []\n\n #: Create a new instance of this view class for every request by\n #: default. If a view subclass sets this to ``False``, the same\n #: instance is used for every request.\n #:\n #: A single instance is more efficient, especially if complex setup\n #: is done during init. However, storing data on ``self`` is no\n #: longer safe across requests, and :data:`~flask.g` should be used\n #: instead.\n #:\n #: .. versionadded:: 2.2\n init_every_request: t.ClassVar[bool] = True\n\n def dispatch_request(self) -> ft.ResponseReturnValue:\n \"\"\"The actual view function behavior. Subclasses must override\n this and return a valid response. Any variables from the URL\n rule are passed as keyword arguments.\n \"\"\"\n raise NotImplementedError()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_View.as_view_View.as_view.return.view": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_View.as_view_View.as_view.return.view", "embedding": null, "metadata": {"file_path": "src/flask/views.py", "file_name": "views.py", "file_type": "text/x-python", "category": "implementation", "start_line": 82, "end_line": 132, "span_ids": ["View.as_view"], "tokens": 459}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class View:\n\n @classmethod\n def as_view(\n cls, name: str, *class_args: t.Any, **class_kwargs: t.Any\n ) -> ft.RouteCallable:\n \"\"\"Convert the class into a view function that can be registered\n for a route.\n\n By default, the generated view will create a new instance of the\n view class for every request and call its\n :meth:`dispatch_request` method. If the view class sets\n :attr:`init_every_request` to ``False``, the same instance will\n be used for every request.\n\n Except for ``name``, all other arguments passed to this method\n are forwarded to the view class ``__init__`` method.\n\n .. versionchanged:: 2.2\n Added the ``init_every_request`` class attribute.\n \"\"\"\n if cls.init_every_request:\n\n def view(**kwargs: t.Any) -> ft.ResponseReturnValue:\n self = view.view_class( # type: ignore[attr-defined]\n *class_args, **class_kwargs\n )\n return current_app.ensure_sync(self.dispatch_request)(**kwargs)\n\n else:\n self = cls(*class_args, **class_kwargs)\n\n def view(**kwargs: t.Any) -> ft.ResponseReturnValue:\n return current_app.ensure_sync(self.dispatch_request)(**kwargs)\n\n if cls.decorators:\n view.__name__ = name\n view.__module__ = cls.__module__\n for decorator in cls.decorators:\n view = decorator(view)\n\n # We attach the view class to the view function for two reasons:\n # first of all it allows us to easily figure out what class-based\n # view this thing came from, secondly it's also used for instantiating\n # the view class so you can actually replace it with something else\n # for testing purposes and debugging.\n view.view_class = cls # type: ignore\n view.__name__ = name\n view.__doc__ = cls.__doc__\n view.__module__ = cls.__module__\n view.methods = cls.methods # type: ignore\n view.provide_automatic_options = cls.provide_automatic_options # type: ignore\n return view", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_MethodView_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/views.py_MethodView_", "embedding": null, "metadata": {"file_path": "src/flask/views.py", "file_name": "views.py", "file_type": "text/x-python", "category": "implementation", "start_line": 135, "end_line": 189, "span_ids": ["MethodView", "MethodView.__init_subclass__", "MethodView.dispatch_request"], "tokens": 386}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class MethodView(View):\n \"\"\"Dispatches request methods to the corresponding instance methods.\n For example, if you implement a ``get`` method, it will be used to\n handle ``GET`` requests.\n\n This can be useful for defining a REST API.\n\n :attr:`methods` is automatically set based on the methods defined on\n the class.\n\n See :doc:`views` for a detailed guide.\n\n .. code-block:: python\n\n class CounterAPI(MethodView):\n def get(self):\n return str(session.get(\"counter\", 0))\n\n def post(self):\n session[\"counter\"] = session.get(\"counter\", 0) + 1\n return redirect(url_for(\"counter\"))\n\n app.add_url_rule(\n \"/counter\", view_func=CounterAPI.as_view(\"counter\")\n )\n \"\"\"\n\n def __init_subclass__(cls, **kwargs: t.Any) -> None:\n super().__init_subclass__(**kwargs)\n\n if \"methods\" not in cls.__dict__:\n methods = set()\n\n for base in cls.__bases__:\n if getattr(base, \"methods\", None):\n methods.update(base.methods) # type: ignore[attr-defined]\n\n for key in http_method_funcs:\n if hasattr(cls, key):\n methods.add(key.upper())\n\n if methods:\n cls.methods = methods\n\n def dispatch_request(self, **kwargs: t.Any) -> ft.ResponseReturnValue:\n meth = getattr(self, request.method.lower(), None)\n\n # If the request method is HEAD and we don't have a handler for it\n # retry with GET.\n if meth is None and request.method == \"HEAD\":\n meth = getattr(self, \"get\", None)\n\n assert meth is not None, f\"Unimplemented method {request.method!r}\"\n return current_app.ensure_sync(meth)(**kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Response_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Response_", "embedding": null, "metadata": {"file_path": "src/flask/wrappers.py", "file_name": "wrappers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 136, "end_line": 172, "span_ids": ["Response", "Response.max_cookie_size"], "tokens": 288}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Response(ResponseBase):\n \"\"\"The response object that is used by default in Flask. Works like the\n response object from Werkzeug but is set to have an HTML mimetype by\n default. Quite often you don't have to create this object yourself because\n :meth:`~flask.Flask.make_response` will take care of that for you.\n\n If you want to replace the response object used you can subclass this and\n set :attr:`~flask.Flask.response_class` to your subclass.\n\n .. versionchanged:: 1.0\n JSON support is added to the response, like the request. This is useful\n when testing to get the test client response data as JSON.\n\n .. versionchanged:: 1.0\n\n Added :attr:`max_cookie_size`.\n \"\"\"\n\n default_mimetype = \"text/html\"\n\n json_module = json\n\n autocorrect_location_header = False\n\n @property\n def max_cookie_size(self) -> int: # type: ignore\n \"\"\"Read-only view of the :data:`MAX_COOKIE_SIZE` config key.\n\n See :attr:`~werkzeug.wrappers.Response.max_cookie_size` in\n Werkzeug's docs.\n \"\"\"\n if current_app:\n return current_app.config[\"MAX_COOKIE_SIZE\"]\n\n # return Werkzeug's default when not in an app context\n return super().max_cookie_size", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_os__standard_os_environ.mp_undo_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_os__standard_os_environ.mp_undo_", "embedding": null, "metadata": {"file_path": "tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 35, "span_ids": ["_standard_os_environ", "imports"], "tokens": 243}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import os\nimport pkgutil\nimport sys\nimport textwrap\n\nimport pytest\nfrom _pytest import monkeypatch\n\nfrom flask import Flask\nfrom flask.globals import request_ctx\n\n\n@pytest.fixture(scope=\"session\", autouse=True)\ndef _standard_os_environ():\n \"\"\"Set up ``os.environ`` at the start of the test session to have\n standard values. Returns a list of operations that is used by\n :func:`._reset_os_environ` after each test.\n \"\"\"\n mp = monkeypatch.MonkeyPatch()\n out = (\n (os.environ, \"FLASK_ENV_FILE\", monkeypatch.notset),\n (os.environ, \"FLASK_APP\", monkeypatch.notset),\n (os.environ, \"FLASK_DEBUG\", monkeypatch.notset),\n (os.environ, \"FLASK_RUN_FROM_CLI\", monkeypatch.notset),\n (os.environ, \"WERKZEUG_RUN_MAIN\", monkeypatch.notset),\n )\n\n for _, key, value in out:\n if value is monkeypatch.notset:\n mp.delenv(key, False)\n else:\n mp.setenv(key, value)\n\n yield out\n mp.undo()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py__reset_os_environ_leak_detector.assert_leaks_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py__reset_os_environ_leak_detector.assert_leaks_", "embedding": null, "metadata": {"file_path": "tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "implementation", "start_line": 38, "end_line": 97, "span_ids": ["req_ctx", "app", "_reset_os_environ", "test_apps", "client", "app_ctx", "leak_detector"], "tokens": 329}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture(autouse=True)\ndef _reset_os_environ(monkeypatch, _standard_os_environ):\n \"\"\"Reset ``os.environ`` to the standard environ after each test,\n in case a test changed something without cleaning up.\n \"\"\"\n monkeypatch._setitem.extend(_standard_os_environ)\n\n\n@pytest.fixture\ndef app():\n app = Flask(\"flask_test\", root_path=os.path.dirname(__file__))\n app.config.update(\n TESTING=True,\n SECRET_KEY=\"test key\",\n )\n return app\n\n\n@pytest.fixture\ndef app_ctx(app):\n with app.app_context() as ctx:\n yield ctx\n\n\n@pytest.fixture\ndef req_ctx(app):\n with app.test_request_context() as ctx:\n yield ctx\n\n\n@pytest.fixture\ndef client(app):\n return app.test_client()\n\n\n@pytest.fixture\ndef test_apps(monkeypatch):\n monkeypatch.syspath_prepend(os.path.join(os.path.dirname(__file__), \"test_apps\"))\n original_modules = set(sys.modules.keys())\n\n yield\n\n # Remove any imports cached during the test. Otherwise \"import app\"\n # will work in the next test even though it's no longer on the path.\n for key in sys.modules.keys() - original_modules:\n sys.modules.pop(key)\n\n\n@pytest.fixture(autouse=True)\ndef leak_detector():\n yield\n\n # make sure we're not leaking a request context since we are\n # testing flask internally in debug mode in a few cases\n leaks = []\n while request_ctx:\n leaks.append(request_ctx._get_current_object())\n request_ctx.pop()\n\n assert leaks == []", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_limit_loader_limit_loader.monkeypatch_setattr_pkgut": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_limit_loader_limit_loader.monkeypatch_setattr_pkgut", "embedding": null, "metadata": {"file_path": "tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "implementation", "start_line": 99, "end_line": 127, "span_ids": ["limit_loader", "limit_loader.LimitedLoader.__init__", "limit_loader.LimitedLoader"], "tokens": 223}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture(params=(True, False))\ndef limit_loader(request, monkeypatch):\n \"\"\"Patch pkgutil.get_loader to give loader without get_filename or archive.\n\n This provides for tests where a system has custom loaders, e.g. Google App\n Engine's HardenedModulesHook, which have neither the `get_filename` method\n nor the `archive` attribute.\n\n This fixture will run the testcase twice, once with and once without the\n limitation/mock.\n \"\"\"\n if not request.param:\n return\n\n class LimitedLoader:\n def __init__(self, loader):\n self.loader = loader\n\n def __getattr__(self, name):\n if name in {\"archive\", \"get_filename\"}:\n raise AttributeError(f\"Mocking a loader which does not have {name!r}.\")\n return getattr(self.loader, name)\n\n old_get_loader = pkgutil.get_loader\n\n def get_loader(*args, **kwargs):\n return LimitedLoader(old_get_loader(*args, **kwargs))\n\n monkeypatch.setattr(pkgutil, \"get_loader\", get_loader)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_modules_tmpdir_site_packages.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_modules_tmpdir_site_packages.return.rv", "embedding": null, "metadata": {"file_path": "tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "implementation", "start_line": 130, "end_line": 153, "span_ids": ["modules_tmpdir", "modules_tmpdir_prefix", "site_packages"], "tokens": 160}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture\ndef modules_tmpdir(tmpdir, monkeypatch):\n \"\"\"A tmpdir added to sys.path.\"\"\"\n rv = tmpdir.mkdir(\"modules_tmpdir\")\n monkeypatch.syspath_prepend(str(rv))\n return rv\n\n\n@pytest.fixture\ndef modules_tmpdir_prefix(modules_tmpdir, monkeypatch):\n monkeypatch.setattr(sys, \"prefix\", str(modules_tmpdir))\n return modules_tmpdir\n\n\n@pytest.fixture\ndef site_packages(modules_tmpdir, monkeypatch):\n \"\"\"Create a fake site-packages.\"\"\"\n rv = (\n modules_tmpdir.mkdir(\"lib\")\n .mkdir(f\"python{sys.version_info.major}.{sys.version_info.minor}\")\n .mkdir(\"site-packages\")\n )\n monkeypatch.syspath_prepend(str(rv))\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_install_egg_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/conftest.py_install_egg_", "embedding": null, "metadata": {"file_path": "tests/conftest.py", "file_name": "conftest.py", "file_type": "text/x-python", "category": "implementation", "start_line": 156, "end_line": 198, "span_ids": ["install_egg", "purge_module"], "tokens": 234}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture\ndef install_egg(modules_tmpdir, monkeypatch):\n \"\"\"Generate egg from package name inside base and put the egg into\n sys.path.\"\"\"\n\n def inner(name, base=modules_tmpdir):\n base.join(name).ensure_dir()\n base.join(name).join(\"__init__.py\").ensure()\n\n egg_setup = base.join(\"setup.py\")\n egg_setup.write(\n textwrap.dedent(\n f\"\"\"\n from setuptools import setup\n setup(\n name=\"{name}\",\n version=\"1.0\",\n packages=[\"site_egg\"],\n zip_safe=True,\n )\n \"\"\"\n )\n )\n\n import subprocess\n\n subprocess.check_call(\n [sys.executable, \"setup.py\", \"bdist_egg\"], cwd=str(modules_tmpdir)\n )\n (egg_path,) = modules_tmpdir.join(\"dist/\").listdir()\n monkeypatch.syspath_prepend(str(egg_path))\n return egg_path\n\n return inner\n\n\n@pytest.fixture\ndef purge_module(request):\n def inner(name):\n request.addfinalizer(lambda: sys.modules.pop(name, None))\n\n return inner", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_pytest_test_app_tearing_down_with_handled_exception_by_app_handler.assert_cleanup_stuff_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_pytest_test_app_tearing_down_with_handled_exception_by_app_handler.assert_cleanup_stuff_", "embedding": null, "metadata": {"file_path": "tests/test_appctx.py", "file_name": "test_appctx.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 110, "span_ids": ["test_app_tearing_down_with_handled_exception_by_app_handler", "test_basic_url_generation", "test_request_context_means_app_context", "test_url_generation_without_context_fails", "test_url_generation_requires_server_name", "imports", "test_app_tearing_down_with_handled_exception_by_except_block", "test_app_tearing_down_with_previous_exception", "test_app_tearing_down", "test_app_context_provides_current_app"], "tokens": 509}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\n\nimport flask\nfrom flask.globals import app_ctx\nfrom flask.globals import request_ctx\n\n\ndef test_basic_url_generation(app):\n app.config[\"SERVER_NAME\"] = \"localhost\"\n app.config[\"PREFERRED_URL_SCHEME\"] = \"https\"\n\n @app.route(\"/\")\n def index():\n pass\n\n with app.app_context():\n rv = flask.url_for(\"index\")\n assert rv == \"https://localhost/\"\n\n\ndef test_url_generation_requires_server_name(app):\n with app.app_context():\n with pytest.raises(RuntimeError):\n flask.url_for(\"index\")\n\n\ndef test_url_generation_without_context_fails():\n with pytest.raises(RuntimeError):\n flask.url_for(\"index\")\n\n\ndef test_request_context_means_app_context(app):\n with app.test_request_context():\n assert flask.current_app._get_current_object() is app\n assert not flask.current_app\n\n\ndef test_app_context_provides_current_app(app):\n with app.app_context():\n assert flask.current_app._get_current_object() is app\n assert not flask.current_app\n\n\ndef test_app_tearing_down(app):\n cleanup_stuff = []\n\n @app.teardown_appcontext\n def cleanup(exception):\n cleanup_stuff.append(exception)\n\n with app.app_context():\n pass\n\n assert cleanup_stuff == [None]\n\n\ndef test_app_tearing_down_with_previous_exception(app):\n cleanup_stuff = []\n\n @app.teardown_appcontext\n def cleanup(exception):\n cleanup_stuff.append(exception)\n\n try:\n raise Exception(\"dummy\")\n except Exception:\n pass\n\n with app.app_context():\n pass\n\n assert cleanup_stuff == [None]\n\n\ndef test_app_tearing_down_with_handled_exception_by_except_block(app):\n cleanup_stuff = []\n\n @app.teardown_appcontext\n def cleanup(exception):\n cleanup_stuff.append(exception)\n\n with app.app_context():\n try:\n raise Exception(\"dummy\")\n except Exception:\n pass\n\n assert cleanup_stuff == [None]\n\n\ndef test_app_tearing_down_with_handled_exception_by_app_handler(app, client):\n app.config[\"PROPAGATE_EXCEPTIONS\"] = True\n cleanup_stuff = []\n\n @app.teardown_appcontext\n def cleanup(exception):\n cleanup_stuff.append(exception)\n\n @app.route(\"/\")\n def index():\n raise Exception(\"dummy\")\n\n @app.errorhandler(Exception)\n def handler(f):\n return flask.jsonify(str(f))\n\n with app.app_context():\n client.get(\"/\")\n\n assert cleanup_stuff == [None]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_tearing_down_with_unhandled_exception_test_app_tearing_down_with_unhandled_exception.assert_str_cleanup_stuff_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_tearing_down_with_unhandled_exception_test_app_tearing_down_with_unhandled_exception.assert_str_cleanup_stuff_", "embedding": null, "metadata": {"file_path": "tests/test_appctx.py", "file_name": "test_appctx.py", "file_type": "text/x-python", "category": "test", "start_line": 113, "end_line": 131, "span_ids": ["test_app_tearing_down_with_unhandled_exception"], "tokens": 122}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_app_tearing_down_with_unhandled_exception(app, client):\n app.config[\"PROPAGATE_EXCEPTIONS\"] = True\n cleanup_stuff = []\n\n @app.teardown_appcontext\n def cleanup(exception):\n cleanup_stuff.append(exception)\n\n @app.route(\"/\")\n def index():\n raise ValueError(\"dummy\")\n\n with pytest.raises(ValueError, match=\"dummy\"):\n with app.app_context():\n client.get(\"/\")\n\n assert len(cleanup_stuff) == 1\n assert isinstance(cleanup_stuff[0], ValueError)\n assert str(cleanup_stuff[0]) == \"dummy\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_ctx_globals_methods_test_custom_app_ctx_globals_class.with_app_app_context_.assert_flask_render_templ": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_app_ctx_globals_methods_test_custom_app_ctx_globals_class.with_app_app_context_.assert_flask_render_templ", "embedding": null, "metadata": {"file_path": "tests/test_appctx.py", "file_name": "test_appctx.py", "file_type": "text/x-python", "category": "test", "start_line": 132, "end_line": 162, "span_ids": ["test_custom_app_ctx_globals_class.CustomRequestGlobals.__init__", "test_app_ctx_globals_methods", "test_custom_app_ctx_globals_class", "test_custom_app_ctx_globals_class.CustomRequestGlobals"], "tokens": 273}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_app_ctx_globals_methods(app, app_ctx):\n # get\n assert flask.g.get(\"foo\") is None\n assert flask.g.get(\"foo\", \"bar\") == \"bar\"\n # __contains__\n assert \"foo\" not in flask.g\n flask.g.foo = \"bar\"\n assert \"foo\" in flask.g\n # setdefault\n flask.g.setdefault(\"bar\", \"the cake is a lie\")\n flask.g.setdefault(\"bar\", \"hello world\")\n assert flask.g.bar == \"the cake is a lie\"\n # pop\n assert flask.g.pop(\"bar\") == \"the cake is a lie\"\n with pytest.raises(KeyError):\n flask.g.pop(\"bar\")\n assert flask.g.pop(\"bar\", \"more cake\") == \"more cake\"\n # __iter__\n assert list(flask.g) == [\"foo\"]\n # __repr__\n assert repr(flask.g) == \"\"\n\n\ndef test_custom_app_ctx_globals_class(app):\n class CustomRequestGlobals:\n def __init__(self):\n self.spam = \"eggs\"\n\n app.app_ctx_globals_class = CustomRequestGlobals\n with app.app_context():\n assert flask.render_template_string(\"{{ g.spam }}\") == \"eggs\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_context_refcounts_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_appctx.py_test_context_refcounts_", "embedding": null, "metadata": {"file_path": "tests/test_appctx.py", "file_name": "test_appctx.py", "file_type": "text/x-python", "category": "test", "start_line": 167, "end_line": 213, "span_ids": ["test_context_refcounts", "test_clean_pop"], "tokens": 234}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_context_refcounts(app, client):\n called = []\n\n @app.teardown_request\n def teardown_req(error=None):\n called.append(\"request\")\n\n @app.teardown_appcontext\n def teardown_app(error=None):\n called.append(\"app\")\n\n @app.route(\"/\")\n def index():\n with app_ctx:\n with request_ctx:\n pass\n\n assert flask.request.environ[\"werkzeug.request\"] is not None\n return \"\"\n\n res = client.get(\"/\")\n assert res.status_code == 200\n assert res.data == b\"\"\n assert called == [\"request\", \"app\"]\n\n\ndef test_clean_pop(app):\n app.testing = False\n called = []\n\n @app.teardown_request\n def teardown_req(error=None):\n 1 / 0\n\n @app.teardown_appcontext\n def teardown_app(error=None):\n called.append(\"TEARDOWN\")\n\n try:\n with app.test_request_context():\n called.append(flask.current_app.name)\n except ZeroDivisionError:\n pass\n\n assert called == [\"flask_test\", \"TEARDOWN\"]\n assert not flask.current_app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/__init__.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/blueprintapp/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 10, "span_ids": ["impl", "docstring", "imports", "docstring:2", "imports:2", "imports:3", "impl:4"], "tokens": 59}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napp = Flask(__name__)\napp.config[\"DEBUG\"] = True\nfrom blueprintapp.apps.admin import admin # noqa: E402\nfrom blueprintapp.apps.frontend import frontend # noqa: E402\n\napp.register_blueprint(admin)\napp.register_blueprint(frontend)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/admin/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/admin/__init__.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/blueprintapp/apps/admin/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 21, "span_ids": ["index2", "impl", "imports", "index"], "tokens": 76}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Blueprint\nfrom flask import render_template\n\nadmin = Blueprint(\n \"admin\",\n __name__,\n url_prefix=\"/admin\",\n template_folder=\"templates\",\n static_folder=\"static\",\n)\n\n\n@admin.route(\"/\")\ndef index():\n return render_template(\"admin/index.html\")\n\n\n@admin.route(\"/index2\")\ndef index2():\n return render_template(\"./admin/index.html\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/frontend/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/blueprintapp/apps/frontend/__init__.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/blueprintapp/apps/frontend/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 15, "span_ids": ["missing_template", "impl", "imports", "index"], "tokens": 60}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Blueprint\nfrom flask import render_template\n\nfrontend = Blueprint(\"frontend\", __name__, template_folder=\"templates\")\n\n\n@frontend.route(\"/\")\ndef index():\n return render_template(\"frontend/index.html\")\n\n\n@frontend.route(\"/missing\")\ndef missing_template():\n return render_template(\"missing_template.html\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/app.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/app.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 4, "span_ids": ["impl", "imports"], "tokens": 13}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\ntestapp = Flask(\"testapp\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/factory.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/factory.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/factory.py", "file_name": "factory.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 14, "span_ids": ["create_app", "imports", "no_app", "create_app2"], "tokens": 44}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\n\ndef create_app():\n return Flask(\"app\")\n\n\ndef create_app2(foo, bar):\n return Flask(\"_\".join([\"app2\", foo, bar]))\n\n\ndef no_app():\n pass", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/importerrorapp.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/importerrorapp.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/importerrorapp.py", "file_name": "importerrorapp.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 6, "span_ids": ["impl", "imports"], "tokens": 16}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\nraise ImportError()\n\ntestapp = Flask(\"testapp\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/__init__.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/inner1/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 4, "span_ids": ["impl", "imports"], "tokens": 11}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napplication = Flask(__name__)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/inner2/flask.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/inner1/inner2/flask.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/inner1/inner2/flask.py", "file_name": "flask.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 4, "span_ids": ["impl", "imports"], "tokens": 11}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napp = Flask(__name__)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/multiapp.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/cliapp/multiapp.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/cliapp/multiapp.py", "file_name": "multiapp.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 5, "span_ids": ["impl", "imports"], "tokens": 21}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napp1 = Flask(\"app1\")\napp2 = Flask(\"app2\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/hello.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/hello.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/helloworld/hello.py", "file_name": "hello.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 9, "span_ids": ["hello", "impl", "imports"], "tokens": 23}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Flask\n\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef hello():\n return \"Hello World!\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/wsgi.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/helloworld/wsgi.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/helloworld/wsgi.py", "file_name": "wsgi.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 2, "span_ids": ["docstring", "imports"], "tokens": 10}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from hello import app # noqa: F401", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/subdomaintestmodule/__init__.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_apps/subdomaintestmodule/__init__.py__", "embedding": null, "metadata": {"file_path": "tests/test_apps/subdomaintestmodule/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 5, "span_ids": ["impl", "imports"], "tokens": 19}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from flask import Module\n\n\nmod = Module(__name__, \"foo\", subdomain=\"foo\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_route_test_async_error_handler.assert_response_status_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_route_test_async_error_handler.assert_response_status_co", "embedding": null, "metadata": {"file_path": "tests/test_async.py", "file_name": "test_async.py", "file_type": "text/x-python", "category": "test", "start_line": 81, "end_line": 94, "span_ids": ["test_async_route", "test_async_error_handler"], "tokens": 127}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"path\", [\"/\", \"/home\", \"/bp/\", \"/view\", \"/methodview\"])\ndef test_async_route(path, async_app):\n test_client = async_app.test_client()\n response = test_client.get(path)\n assert b\"GET\" in response.get_data()\n response = test_client.post(path)\n assert b\"POST\" in response.get_data()\n\n\n@pytest.mark.parametrize(\"path\", [\"/error\", \"/bp/error\"])\ndef test_async_error_handler(path, async_app):\n test_client = async_app.test_client()\n response = test_client.get(path)\n assert response.status_code == 412", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_before_after_request_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_test_async_before_after_request_", "embedding": null, "metadata": {"file_path": "tests/test_async.py", "file_name": "test_async.py", "file_type": "text/x-python", "category": "test", "start_line": 97, "end_line": 146, "span_ids": ["test_async_before_after_request"], "tokens": 248}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_async_before_after_request():\n app_before_called = False\n app_after_called = False\n bp_before_called = False\n bp_after_called = False\n\n app = Flask(__name__)\n\n @app.route(\"/\")\n def index():\n return \"\"\n\n @app.before_request\n async def before():\n nonlocal app_before_called\n app_before_called = True\n\n @app.after_request\n async def after(response):\n nonlocal app_after_called\n app_after_called = True\n return response\n\n blueprint = Blueprint(\"bp\", __name__)\n\n @blueprint.route(\"/\")\n def bp_index():\n return \"\"\n\n @blueprint.before_request\n async def bp_before():\n nonlocal bp_before_called\n bp_before_called = True\n\n @blueprint.after_request\n async def bp_after(response):\n nonlocal bp_after_called\n bp_after_called = True\n return response\n\n app.register_blueprint(blueprint, url_prefix=\"/bp\")\n\n test_client = app.test_client()\n test_client.get(\"/\")\n assert app_before_called\n assert app_after_called\n test_client.get(\"/bp/\")\n assert bp_before_called\n assert bp_after_called", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_gc_test_method_route_no_methods.with_pytest_raises_TypeEr.app_get_methods_GE": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_gc_test_method_route_no_methods.with_pytest_raises_TypeEr.app_get_methods_GE", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 66, "span_ids": ["test_method_route_no_methods", "impl", "test_method_route", "test_options_work", "imports", "test_options_on_multiple_rules"], "tokens": 379}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import gc\nimport re\nimport uuid\nimport warnings\nimport weakref\nfrom datetime import datetime\nfrom datetime import timezone\nfrom platform import python_implementation\n\nimport pytest\nimport werkzeug.serving\nfrom markupsafe import Markup\nfrom werkzeug.exceptions import BadRequest\nfrom werkzeug.exceptions import Forbidden\nfrom werkzeug.exceptions import NotFound\nfrom werkzeug.http import parse_date\nfrom werkzeug.routing import BuildError\nfrom werkzeug.routing import RequestRedirect\n\nimport flask\n\n\nrequire_cpython_gc = pytest.mark.skipif(\n python_implementation() != \"CPython\",\n reason=\"Requires CPython GC behavior\",\n)\n\n\ndef test_options_work(app, client):\n @app.route(\"/\", methods=[\"GET\", \"POST\"])\n def index():\n return \"Hello World\"\n\n rv = client.open(\"/\", method=\"OPTIONS\")\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\", \"POST\"]\n assert rv.data == b\"\"\n\n\ndef test_options_on_multiple_rules(app, client):\n @app.route(\"/\", methods=[\"GET\", \"POST\"])\n def index():\n return \"Hello World\"\n\n @app.route(\"/\", methods=[\"PUT\"])\n def index_put():\n return \"Aha!\"\n\n rv = client.open(\"/\", method=\"OPTIONS\")\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\", \"POST\", \"PUT\"]\n\n\n@pytest.mark.parametrize(\"method\", [\"get\", \"post\", \"put\", \"delete\", \"patch\"])\ndef test_method_route(app, client, method):\n method_route = getattr(app, method)\n client_method = getattr(client, method)\n\n @method_route(\"/\")\n def hello():\n return \"Hello\"\n\n assert client_method(\"/\").data == b\"Hello\"\n\n\ndef test_method_route_no_methods(app):\n with pytest.raises(TypeError):\n app.get(\"/\", methods=[\"GET\", \"POST\"])", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_attr_test_provide_automatic_options_attr.assert_sorted_rv_allow_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_attr_test_provide_automatic_options_attr.assert_sorted_rv_allow_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 68, "end_line": 87, "span_ids": ["test_provide_automatic_options_attr"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_provide_automatic_options_attr():\n app = flask.Flask(__name__)\n\n def index():\n return \"Hello World!\"\n\n index.provide_automatic_options = False\n app.route(\"/\")(index)\n rv = app.test_client().open(\"/\", method=\"OPTIONS\")\n assert rv.status_code == 405\n\n app = flask.Flask(__name__)\n\n def index2():\n return \"Hello World!\"\n\n index2.provide_automatic_options = True\n app.route(\"/\", methods=[\"OPTIONS\"])(index2)\n rv = app.test_client().open(\"/\", method=\"OPTIONS\")\n assert sorted(rv.allow) == [\"OPTIONS\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_kwarg_test_provide_automatic_options_kwarg.None_10": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_provide_automatic_options_kwarg_test_provide_automatic_options_kwarg.None_10", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 90, "end_line": 124, "span_ids": ["test_provide_automatic_options_kwarg"], "tokens": 246}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_provide_automatic_options_kwarg(app, client):\n def index():\n return flask.request.method\n\n def more():\n return flask.request.method\n\n app.add_url_rule(\"/\", view_func=index, provide_automatic_options=False)\n app.add_url_rule(\n \"/more\",\n view_func=more,\n methods=[\"GET\", \"POST\"],\n provide_automatic_options=False,\n )\n assert client.get(\"/\").data == b\"GET\"\n\n rv = client.post(\"/\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\"]\n\n rv = client.open(\"/\", method=\"OPTIONS\")\n assert rv.status_code == 405\n\n rv = client.head(\"/\")\n assert rv.status_code == 200\n assert not rv.data # head truncates\n assert client.post(\"/more\").data == b\"POST\"\n assert client.get(\"/more\").data == b\"GET\"\n\n rv = client.delete(\"/more\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"POST\"]\n\n rv = client.open(\"/more\", method=\"OPTIONS\")\n assert rv.status_code == 405", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_mapping_test_url_mapping.assert_random_uuid4_in_rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_mapping_test_url_mapping.assert_random_uuid4_in_rv", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 158, "end_line": 191, "span_ids": ["test_url_mapping"], "tokens": 309}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_url_mapping(app, client):\n random_uuid4 = \"7eb41166-9ebf-4d26-b771-ea3f54f8b383\"\n\n def index():\n return flask.request.method\n\n def more():\n return flask.request.method\n\n def options():\n return random_uuid4\n\n app.add_url_rule(\"/\", \"index\", index)\n app.add_url_rule(\"/more\", \"more\", more, methods=[\"GET\", \"POST\"])\n\n # Issue 1288: Test that automatic options are not added\n # when non-uppercase 'options' in methods\n app.add_url_rule(\"/options\", \"options\", options, methods=[\"options\"])\n\n assert client.get(\"/\").data == b\"GET\"\n rv = client.post(\"/\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\"]\n rv = client.head(\"/\")\n assert rv.status_code == 200\n assert not rv.data # head truncates\n assert client.post(\"/more\").data == b\"POST\"\n assert client.get(\"/more\").data == b\"GET\"\n rv = client.delete(\"/more\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\", \"POST\"]\n rv = client.open(\"/options\", method=\"OPTIONS\")\n assert rv.status_code == 200\n assert random_uuid4 in rv.data.decode(\"utf-8\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_werkzeug_routing_test_endpoint_decorator.assert_client_get_foo_b": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_werkzeug_routing_test_endpoint_decorator.assert_client_get_foo_b", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 194, "end_line": 230, "span_ids": ["test_werkzeug_routing", "test_endpoint_decorator"], "tokens": 226}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_werkzeug_routing(app, client):\n from werkzeug.routing import Submount, Rule\n\n app.url_map.add(\n Submount(\"/foo\", [Rule(\"/bar\", endpoint=\"bar\"), Rule(\"/\", endpoint=\"index\")])\n )\n\n def bar():\n return \"bar\"\n\n def index():\n return \"index\"\n\n app.view_functions[\"bar\"] = bar\n app.view_functions[\"index\"] = index\n\n assert client.get(\"/foo/\").data == b\"index\"\n assert client.get(\"/foo/bar\").data == b\"bar\"\n\n\ndef test_endpoint_decorator(app, client):\n from werkzeug.routing import Submount, Rule\n\n app.url_map.add(\n Submount(\"/foo\", [Rule(\"/bar\", endpoint=\"bar\"), Rule(\"/\", endpoint=\"index\")])\n )\n\n @app.endpoint(\"bar\")\n def bar():\n return \"bar\"\n\n @app.endpoint(\"index\")\n def index():\n return \"index\"\n\n assert client.get(\"/foo/\").data == b\"index\"\n assert client.get(\"/foo/bar\").data == b\"bar\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_test_session.assert_client_get_get_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_test_session.assert_client_get_get_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 233, "end_line": 253, "span_ids": ["test_session"], "tokens": 159}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session(app, client):\n @app.route(\"/set\", methods=[\"POST\"])\n def set():\n assert not flask.session.accessed\n assert not flask.session.modified\n flask.session[\"value\"] = flask.request.form[\"value\"]\n assert flask.session.accessed\n assert flask.session.modified\n return \"value set\"\n\n @app.route(\"/get\")\n def get():\n assert not flask.session.accessed\n assert not flask.session.modified\n v = flask.session.get(\"value\", \"None\")\n assert flask.session.accessed\n assert not flask.session.modified\n return v\n\n assert client.post(\"/set\", data={\"value\": \"42\"}).data == b\"value set\"\n assert client.get(\"/get\").data == b\"42\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_test_session_using_server_name_and_port.assert_httponly_in_rv_h": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_test_session_using_server_name_and_port.assert_httponly_in_rv_h", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 256, "end_line": 279, "span_ids": ["test_session_using_server_name", "test_session_using_server_name_and_port"], "tokens": 190}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_using_server_name(app, client):\n app.config.update(SERVER_NAME=\"example.com\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n rv = client.get(\"/\", \"http://example.com/\")\n assert \"domain=.example.com\" in rv.headers[\"set-cookie\"].lower()\n assert \"httponly\" in rv.headers[\"set-cookie\"].lower()\n\n\ndef test_session_using_server_name_and_port(app, client):\n app.config.update(SERVER_NAME=\"example.com:8080\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n rv = client.get(\"/\", \"http://example.com:8080/\")\n assert \"domain=.example.com\" in rv.headers[\"set-cookie\"].lower()\n assert \"httponly\" in rv.headers[\"set-cookie\"].lower()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_port_and_path_test_session_using_server_name_port_and_path.assert_httponly_in_rv_h": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_server_name_port_and_path_test_session_using_server_name_port_and_path.assert_httponly_in_rv_h", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 282, "end_line": 293, "span_ids": ["test_session_using_server_name_port_and_path"], "tokens": 122}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_using_server_name_port_and_path(app, client):\n app.config.update(SERVER_NAME=\"example.com:8080\", APPLICATION_ROOT=\"/foo\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n rv = client.get(\"/\", \"http://example.com:8080/foo\")\n assert \"domain=example.com\" in rv.headers[\"set-cookie\"].lower()\n assert \"path=/foo\" in rv.headers[\"set-cookie\"].lower()\n assert \"httponly\" in rv.headers[\"set-cookie\"].lower()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_application_root_test_session_using_application_root.assert_path_bar_in_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_application_root_test_session_using_application_root.assert_path_bar_in_rv_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 296, "end_line": 315, "span_ids": ["test_session_using_application_root.PrefixPathMiddleware.__init__", "test_session_using_application_root.PrefixPathMiddleware", "test_session_using_application_root"], "tokens": 154}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_using_application_root(app, client):\n class PrefixPathMiddleware:\n def __init__(self, app, prefix):\n self.app = app\n self.prefix = prefix\n\n def __call__(self, environ, start_response):\n environ[\"SCRIPT_NAME\"] = self.prefix\n return self.app(environ, start_response)\n\n app.wsgi_app = PrefixPathMiddleware(app.wsgi_app, \"/bar\")\n app.config.update(APPLICATION_ROOT=\"/bar\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n rv = client.get(\"/\", \"http://example.com:8080/\")\n assert \"path=/bar\" in rv.headers[\"set-cookie\"].lower()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_session_settings_test_session_using_session_settings.None_9": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_session_settings_test_session_using_session_settings.None_9", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 316, "end_line": 351, "span_ids": ["test_session_using_session_settings"], "tokens": 276}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_using_session_settings(app, client):\n app.config.update(\n SERVER_NAME=\"www.example.com:8080\",\n APPLICATION_ROOT=\"/test\",\n SESSION_COOKIE_DOMAIN=\".example.com\",\n SESSION_COOKIE_HTTPONLY=False,\n SESSION_COOKIE_SECURE=True,\n SESSION_COOKIE_SAMESITE=\"Lax\",\n SESSION_COOKIE_PATH=\"/\",\n )\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n @app.route(\"/clear\")\n def clear():\n flask.session.pop(\"testing\", None)\n return \"Goodbye World\"\n\n rv = client.get(\"/\", \"http://www.example.com:8080/test/\")\n cookie = rv.headers[\"set-cookie\"].lower()\n assert \"domain=.example.com\" in cookie\n assert \"path=/\" in cookie\n assert \"secure\" in cookie\n assert \"httponly\" not in cookie\n assert \"samesite\" in cookie\n\n rv = client.get(\"/clear\", \"http://www.example.com:8080/test/\")\n cookie = rv.headers[\"set-cookie\"].lower()\n assert \"session=;\" in cookie\n assert \"domain=.example.com\" in cookie\n assert \"path=/\" in cookie\n assert \"secure\" in cookie\n assert \"samesite\" in cookie", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_samesite_attribute_test_session_using_samesite_attribute.assert_samesite_lax_in_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_using_samesite_attribute_test_session_using_samesite_attribute.assert_samesite_lax_in_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 356, "end_line": 380, "span_ids": ["test_session_using_samesite_attribute"], "tokens": 185}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_using_samesite_attribute(app, client):\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"Hello World\"\n\n app.config.update(SESSION_COOKIE_SAMESITE=\"invalid\")\n\n with pytest.raises(ValueError):\n client.get(\"/\")\n\n app.config.update(SESSION_COOKIE_SAMESITE=None)\n rv = client.get(\"/\")\n cookie = rv.headers[\"set-cookie\"].lower()\n assert \"samesite\" not in cookie\n\n app.config.update(SESSION_COOKIE_SAMESITE=\"Strict\")\n rv = client.get(\"/\")\n cookie = rv.headers[\"set-cookie\"].lower()\n assert \"samesite=strict\" in cookie\n\n app.config.update(SESSION_COOKIE_SAMESITE=\"Lax\")\n rv = client.get(\"/\")\n cookie = rv.headers[\"set-cookie\"].lower()\n assert \"samesite=lax\" in cookie", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_localhost_warning_test_session_ip_warning.assert_cookie_domain_is_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_localhost_warning_test_session_ip_warning.assert_cookie_domain_is_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 383, "end_line": 408, "span_ids": ["test_session_ip_warning", "test_session_localhost_warning"], "tokens": 225}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_localhost_warning(recwarn, app, client):\n app.config.update(SERVER_NAME=\"localhost:5000\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"testing\"\n\n rv = client.get(\"/\", \"http://localhost:5000/\")\n assert \"domain\" not in rv.headers[\"set-cookie\"].lower()\n w = recwarn.pop(UserWarning)\n assert \"'localhost' is not a valid cookie domain\" in str(w.message)\n\n\ndef test_session_ip_warning(recwarn, app, client):\n app.config.update(SERVER_NAME=\"127.0.0.1:5000\")\n\n @app.route(\"/\")\n def index():\n flask.session[\"testing\"] = 42\n return \"testing\"\n\n rv = client.get(\"/\", \"http://127.0.0.1:5000/\")\n assert \"domain=127.0.0.1\" in rv.headers[\"set-cookie\"].lower()\n w = recwarn.pop(UserWarning)\n assert \"cookie domain is an IP\" in str(w.message)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_missing_session_test_session_expiration.assert_match_is_None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_missing_session_test_session_expiration.assert_match_is_None", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 409, "end_line": 451, "span_ids": ["test_session_expiration", "test_missing_session"], "tokens": 322}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_missing_session(app):\n app.secret_key = None\n\n def expect_exception(f, *args, **kwargs):\n e = pytest.raises(RuntimeError, f, *args, **kwargs)\n assert e.value.args and \"session is unavailable\" in e.value.args[0]\n\n with app.test_request_context():\n assert flask.session.get(\"missing_key\") is None\n expect_exception(flask.session.__setitem__, \"foo\", 42)\n expect_exception(flask.session.pop, \"foo\")\n\n\ndef test_session_expiration(app, client):\n permanent = True\n\n @app.route(\"/\")\n def index():\n flask.session[\"test\"] = 42\n flask.session.permanent = permanent\n return \"\"\n\n @app.route(\"/test\")\n def test():\n return str(flask.session.permanent)\n\n rv = client.get(\"/\")\n assert \"set-cookie\" in rv.headers\n match = re.search(r\"(?i)\\bexpires=([^;]+)\", rv.headers[\"set-cookie\"])\n expires = parse_date(match.group())\n expected = datetime.now(timezone.utc) + app.permanent_session_lifetime\n assert expires.year == expected.year\n assert expires.month == expected.month\n assert expires.day == expected.day\n\n rv = client.get(\"/test\")\n assert rv.data == b\"True\"\n\n permanent = False\n rv = client.get(\"/\")\n assert \"set-cookie\" in rv.headers\n match = re.search(r\"\\bexpires=([^;]+)\", rv.headers[\"set-cookie\"])\n assert match is None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_stored_last_test_session_special_types.dump_session_contents.return._204": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_stored_last_test_session_special_types.dump_session_contents.return._204", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 454, "end_line": 482, "span_ids": ["test_session_stored_last", "test_session_special_types"], "tokens": 246}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_stored_last(app, client):\n @app.after_request\n def modify_session(response):\n flask.session[\"foo\"] = 42\n return response\n\n @app.route(\"/\")\n def dump_session_contents():\n return repr(flask.session.get(\"foo\"))\n\n assert client.get(\"/\").data == b\"None\"\n assert client.get(\"/\").data == b\"42\"\n\n\ndef test_session_special_types(app, client):\n now = datetime.now(timezone.utc).replace(microsecond=0)\n the_uuid = uuid.uuid4()\n\n @app.route(\"/\")\n def dump_session_contents():\n flask.session[\"t\"] = (1, 2, 3)\n flask.session[\"b\"] = b\"\\xff\"\n flask.session[\"m\"] = Markup(\"\")\n flask.session[\"u\"] = the_uuid\n flask.session[\"d\"] = now\n flask.session[\"t_tag\"] = {\" t\": \"not-a-tuple\"}\n flask.session[\"di_t_tag\"] = {\" t__\": \"not-a-tuple\"}\n flask.session[\"di_tag\"] = {\" di\": \"not-a-dict\"}\n return \"\", 204\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_special_types.with_client__test_session_special_types.with_client_.assert_s_di_tag_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_special_types.with_client__test_session_special_types.with_client_.assert_s_di_tag_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 484, "end_line": 496, "span_ids": ["test_session_special_types"], "tokens": 159}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_special_types(app, client):\n # ... other code\n\n with client:\n client.get(\"/\")\n s = flask.session\n assert s[\"t\"] == (1, 2, 3)\n assert type(s[\"b\"]) == bytes\n assert s[\"b\"] == b\"\\xff\"\n assert type(s[\"m\"]) == Markup\n assert s[\"m\"] == Markup(\"\")\n assert s[\"u\"] == the_uuid\n assert s[\"d\"] == now\n assert s[\"t_tag\"] == {\" t\": \"not-a-tuple\"}\n assert s[\"di_t_tag\"] == {\" t__\": \"not-a-tuple\"}\n assert s[\"di_tag\"] == {\" di\": \"not-a-dict\"}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_cookie_setting_test_session_cookie_setting.None_3": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_cookie_setting_test_session_cookie_setting.None_3", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 501, "end_line": 539, "span_ids": ["test_session_cookie_setting"], "tokens": 301}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_cookie_setting(app):\n is_permanent = True\n\n @app.route(\"/bump\")\n def bump():\n rv = flask.session[\"foo\"] = flask.session.get(\"foo\", 0) + 1\n flask.session.permanent = is_permanent\n return str(rv)\n\n @app.route(\"/read\")\n def read():\n return str(flask.session.get(\"foo\", 0))\n\n def run_test(expect_header):\n with app.test_client() as c:\n assert c.get(\"/bump\").data == b\"1\"\n assert c.get(\"/bump\").data == b\"2\"\n assert c.get(\"/bump\").data == b\"3\"\n\n rv = c.get(\"/read\")\n set_cookie = rv.headers.get(\"set-cookie\")\n assert (set_cookie is not None) == expect_header\n assert rv.data == b\"3\"\n\n is_permanent = True\n app.config[\"SESSION_REFRESH_EACH_REQUEST\"] = True\n run_test(expect_header=True)\n\n is_permanent = True\n app.config[\"SESSION_REFRESH_EACH_REQUEST\"] = False\n run_test(expect_header=False)\n\n is_permanent = False\n app.config[\"SESSION_REFRESH_EACH_REQUEST\"] = True\n run_test(expect_header=False)\n\n is_permanent = False\n app.config[\"SESSION_REFRESH_EACH_REQUEST\"] = False\n run_test(expect_header=False)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_vary_cookie_test_flashes.assert_list_flask_get_fla": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_session_vary_cookie_test_flashes.assert_list_flask_get_fla", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 542, "end_line": 603, "span_ids": ["test_flashes", "test_session_vary_cookie"], "tokens": 404}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_vary_cookie(app, client):\n @app.route(\"/set\")\n def set_session():\n flask.session[\"test\"] = \"test\"\n return \"\"\n\n @app.route(\"/get\")\n def get():\n return flask.session.get(\"test\")\n\n @app.route(\"/getitem\")\n def getitem():\n return flask.session[\"test\"]\n\n @app.route(\"/setdefault\")\n def setdefault():\n return flask.session.setdefault(\"test\", \"default\")\n\n @app.route(\"/vary-cookie-header-set\")\n def vary_cookie_header_set():\n response = flask.Response()\n response.vary.add(\"Cookie\")\n flask.session[\"test\"] = \"test\"\n return response\n\n @app.route(\"/vary-header-set\")\n def vary_header_set():\n response = flask.Response()\n response.vary.update((\"Accept-Encoding\", \"Accept-Language\"))\n flask.session[\"test\"] = \"test\"\n return response\n\n @app.route(\"/no-vary-header\")\n def no_vary_header():\n return \"\"\n\n def expect(path, header_value=\"Cookie\"):\n rv = client.get(path)\n\n if header_value:\n # The 'Vary' key should exist in the headers only once.\n assert len(rv.headers.get_all(\"Vary\")) == 1\n assert rv.headers[\"Vary\"] == header_value\n else:\n assert \"Vary\" not in rv.headers\n\n expect(\"/set\")\n expect(\"/get\")\n expect(\"/getitem\")\n expect(\"/setdefault\")\n expect(\"/vary-cookie-header-set\")\n expect(\"/vary-header-set\", \"Accept-Encoding, Accept-Language, Cookie\")\n expect(\"/no-vary-header\", None)\n\n\ndef test_flashes(app, req_ctx):\n assert not flask.session.modified\n flask.flash(\"Zap\")\n flask.session.modified = False\n flask.flash(\"Zip\")\n assert flask.session.modified\n assert list(flask.get_flashed_messages()) == [\"Zap\", \"Zip\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_extended_flashing_test_extended_flashing.None_7": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_extended_flashing_test_extended_flashing.None_7", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 604, "end_line": 682, "span_ids": ["test_extended_flashing"], "tokens": 527}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_extended_flashing(app):\n # Be sure app.testing=True below, else tests can fail silently.\n #\n # Specifically, if app.testing is not set to True, the AssertionErrors\n # in the view functions will cause a 500 response to the test client\n # instead of propagating exceptions.\n\n @app.route(\"/\")\n def index():\n flask.flash(\"Hello World\")\n flask.flash(\"Hello World\", \"error\")\n flask.flash(Markup(\"Testing\"), \"warning\")\n return \"\"\n\n @app.route(\"/test/\")\n def test():\n messages = flask.get_flashed_messages()\n assert list(messages) == [\n \"Hello World\",\n \"Hello World\",\n Markup(\"Testing\"),\n ]\n return \"\"\n\n @app.route(\"/test_with_categories/\")\n def test_with_categories():\n messages = flask.get_flashed_messages(with_categories=True)\n assert len(messages) == 3\n assert list(messages) == [\n (\"message\", \"Hello World\"),\n (\"error\", \"Hello World\"),\n (\"warning\", Markup(\"Testing\")),\n ]\n return \"\"\n\n @app.route(\"/test_filter/\")\n def test_filter():\n messages = flask.get_flashed_messages(\n category_filter=[\"message\"], with_categories=True\n )\n assert list(messages) == [(\"message\", \"Hello World\")]\n return \"\"\n\n @app.route(\"/test_filters/\")\n def test_filters():\n messages = flask.get_flashed_messages(\n category_filter=[\"message\", \"warning\"], with_categories=True\n )\n assert list(messages) == [\n (\"message\", \"Hello World\"),\n (\"warning\", Markup(\"Testing\")),\n ]\n return \"\"\n\n @app.route(\"/test_filters_without_returning_categories/\")\n def test_filters2():\n messages = flask.get_flashed_messages(category_filter=[\"message\", \"warning\"])\n assert len(messages) == 2\n assert messages[0] == \"Hello World\"\n assert messages[1] == Markup(\"Testing\")\n return \"\"\n\n # Create new test client on each test to clean flashed messages.\n\n client = app.test_client()\n client.get(\"/\")\n client.get(\"/test_with_categories/\")\n\n client = app.test_client()\n client.get(\"/\")\n client.get(\"/test_filter/\")\n\n client = app.test_client()\n client.get(\"/\")\n client.get(\"/test_filters/\")\n\n client = app.test_client()\n client.get(\"/\")\n client.get(\"/test_filters_without_returning_categories/\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_processing_test_request_processing.assert_rv_b_request_af": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_processing_test_request_processing.assert_rv_b_request_af", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 687, "end_line": 709, "span_ids": ["test_request_processing"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_processing(app, client):\n evts = []\n\n @app.before_request\n def before_request():\n evts.append(\"before\")\n\n @app.after_request\n def after_request(response):\n response.data += b\"|after\"\n evts.append(\"after\")\n return response\n\n @app.route(\"/\")\n def index():\n assert \"before\" in evts\n assert \"after\" not in evts\n return \"request\"\n\n assert \"after\" not in evts\n rv = client.get(\"/\").data\n assert \"after\" in evts\n assert rv == b\"request|after\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_preprocessing_early_return_test_request_preprocessing_early_return.assert_evts_1_2_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_preprocessing_early_return_test_request_preprocessing_early_return.assert_evts_1_2_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 712, "end_line": 736, "span_ids": ["test_request_preprocessing_early_return"], "tokens": 135}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_preprocessing_early_return(app, client):\n evts = []\n\n @app.before_request\n def before_request1():\n evts.append(1)\n\n @app.before_request\n def before_request2():\n evts.append(2)\n return \"hello\"\n\n @app.before_request\n def before_request3():\n evts.append(3)\n return \"bye\"\n\n @app.route(\"/\")\n def index():\n evts.append(\"index\")\n return \"damnit\"\n\n rv = client.get(\"/\").data.strip()\n assert rv == b\"hello\"\n assert evts == [1, 2]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_after_request_processing_test_teardown_request_handler_debug_mode.assert_len_called_1": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_after_request_processing_test_teardown_request_handler_debug_mode.assert_len_called_1", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 739, "end_line": 787, "span_ids": ["test_teardown_request_handler", "test_after_request_processing", "test_teardown_request_handler_debug_mode"], "tokens": 257}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_after_request_processing(app, client):\n @app.route(\"/\")\n def index():\n @flask.after_this_request\n def foo(response):\n response.headers[\"X-Foo\"] = \"a header\"\n return response\n\n return \"Test\"\n\n resp = client.get(\"/\")\n assert resp.status_code == 200\n assert resp.headers[\"X-Foo\"] == \"a header\"\n\n\ndef test_teardown_request_handler(app, client):\n called = []\n\n @app.teardown_request\n def teardown_request(exc):\n called.append(True)\n return \"Ignored\"\n\n @app.route(\"/\")\n def root():\n return \"Response\"\n\n rv = client.get(\"/\")\n assert rv.status_code == 200\n assert b\"Response\" in rv.data\n assert len(called) == 1\n\n\ndef test_teardown_request_handler_debug_mode(app, client):\n called = []\n\n @app.teardown_request\n def teardown_request(exc):\n called.append(True)\n return \"Ignored\"\n\n @app.route(\"/\")\n def root():\n return \"Response\"\n\n rv = client.get(\"/\")\n assert rv.status_code == 200\n assert b\"Response\" in rv.data\n assert len(called) == 1", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_teardown_request_handler_error_test_teardown_request_handler_error.assert_len_called_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_teardown_request_handler_error_test_teardown_request_handler_error.assert_len_called_2", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 790, "end_line": 825, "span_ids": ["test_teardown_request_handler_error"], "tokens": 229}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_teardown_request_handler_error(app, client):\n called = []\n app.testing = False\n\n @app.teardown_request\n def teardown_request1(exc):\n assert type(exc) == ZeroDivisionError\n called.append(True)\n # This raises a new error and blows away sys.exc_info(), so we can\n # test that all teardown_requests get passed the same original\n # exception.\n try:\n raise TypeError()\n except Exception:\n pass\n\n @app.teardown_request\n def teardown_request2(exc):\n assert type(exc) == ZeroDivisionError\n called.append(True)\n # This raises a new error and blows away sys.exc_info(), so we can\n # test that all teardown_requests get passed the same original\n # exception.\n try:\n raise TypeError()\n except Exception:\n pass\n\n @app.route(\"/\")\n def fails():\n 1 // 0\n\n rv = client.get(\"/\")\n assert rv.status_code == 500\n assert b\"Internal Server Error\" in rv.data\n assert len(called) == 2", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_before_after_request_order_test_before_after_request_order.assert_called_1_2_3": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_before_after_request_order_test_before_after_request_order.assert_called_1_2_3", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 828, "end_line": 863, "span_ids": ["test_before_after_request_order"], "tokens": 181}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_before_after_request_order(app, client):\n called = []\n\n @app.before_request\n def before1():\n called.append(1)\n\n @app.before_request\n def before2():\n called.append(2)\n\n @app.after_request\n def after1(response):\n called.append(4)\n return response\n\n @app.after_request\n def after2(response):\n called.append(3)\n return response\n\n @app.teardown_request\n def finish1(exc):\n called.append(6)\n\n @app.teardown_request\n def finish2(exc):\n called.append(5)\n\n @app.route(\"/\")\n def index():\n return \"42\"\n\n rv = client.get(\"/\")\n assert rv.data == b\"42\"\n assert called == [1, 2, 3, 4, 5, 6]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_test_error_handling.assert_b_forbidden_rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_test_error_handling.assert_b_forbidden_rv", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 866, "end_line": 901, "span_ids": ["test_error_handling"], "tokens": 218}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_error_handling(app, client):\n app.testing = False\n\n @app.errorhandler(404)\n def not_found(e):\n return \"not found\", 404\n\n @app.errorhandler(500)\n def internal_server_error(e):\n return \"internal server error\", 500\n\n @app.errorhandler(Forbidden)\n def forbidden(e):\n return \"forbidden\", 403\n\n @app.route(\"/\")\n def index():\n flask.abort(404)\n\n @app.route(\"/error\")\n def error():\n 1 // 0\n\n @app.route(\"/forbidden\")\n def error2():\n flask.abort(403)\n\n rv = client.get(\"/\")\n assert rv.status_code == 404\n assert rv.data == b\"not found\"\n rv = client.get(\"/error\")\n assert rv.status_code == 500\n assert b\"internal server error\" == rv.data\n rv = client.get(\"/forbidden\")\n assert rv.status_code == 403\n assert b\"forbidden\" == rv.data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_http_error_subclass_handling_test_http_error_subclass_handling.assert_client_get_3_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_http_error_subclass_handling_test_http_error_subclass_handling.assert_client_get_3_d", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 977, "end_line": 1006, "span_ids": ["test_http_error_subclass_handling", "test_http_error_subclass_handling.ForbiddenSubclass", "test_http_error_subclass_handling.ForbiddenSubclass:2"], "tokens": 183}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_http_error_subclass_handling(app, client):\n class ForbiddenSubclass(Forbidden):\n pass\n\n @app.errorhandler(ForbiddenSubclass)\n def handle_forbidden_subclass(e):\n assert isinstance(e, ForbiddenSubclass)\n return \"banana\"\n\n @app.errorhandler(403)\n def handle_403(e):\n assert not isinstance(e, ForbiddenSubclass)\n assert isinstance(e, Forbidden)\n return \"apple\"\n\n @app.route(\"/1\")\n def index1():\n raise ForbiddenSubclass()\n\n @app.route(\"/2\")\n def index2():\n flask.abort(403)\n\n @app.route(\"/3\")\n def index3():\n raise Forbidden()\n\n assert client.get(\"/1\").data == b\"banana\"\n assert client.get(\"/2\").data == b\"apple\"\n assert client.get(\"/3\").data == b\"apple\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_errorhandler_precedence_test_errorhandler_precedence.assert_rv_data_b_E2_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_errorhandler_precedence_test_errorhandler_precedence.assert_rv_data_b_E2_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1009, "end_line": 1039, "span_ids": ["test_errorhandler_precedence.E2", "test_errorhandler_precedence.E2:2", "test_errorhandler_precedence", "test_errorhandler_precedence.E3:2", "test_errorhandler_precedence.E3", "test_errorhandler_precedence.E1:2", "test_errorhandler_precedence.E1"], "tokens": 155}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_errorhandler_precedence(app, client):\n class E1(Exception):\n pass\n\n class E2(Exception):\n pass\n\n class E3(E1, E2):\n pass\n\n @app.errorhandler(E2)\n def handle_e2(e):\n return \"E2\"\n\n @app.errorhandler(Exception)\n def handle_exception(e):\n return \"Exception\"\n\n @app.route(\"/E1\")\n def raise_e1():\n raise E1\n\n @app.route(\"/E3\")\n def raise_e3():\n raise E3\n\n rv = client.get(\"/E1\")\n assert rv.data == b\"Exception\"\n\n rv = client.get(\"/E3\")\n assert rv.data == b\"E2\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_with_response_instance_test_make_response_with_response_instance.assert_rv_headers_X_Foo_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_with_response_instance_test_make_response_with_response_instance.assert_rv_headers_X_Foo_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1278, "end_line": 1296, "span_ids": ["test_make_response_with_response_instance"], "tokens": 180}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_make_response_with_response_instance(app, req_ctx):\n rv = flask.make_response(flask.jsonify({\"msg\": \"W00t\"}), 400)\n assert rv.status_code == 400\n assert rv.data == b'{\"msg\":\"W00t\"}\\n'\n assert rv.mimetype == \"application/json\"\n\n rv = flask.make_response(flask.Response(\"\"), 400)\n assert rv.status_code == 400\n assert rv.data == b\"\"\n assert rv.mimetype == \"text/html\"\n\n rv = flask.make_response(\n flask.Response(\"\", headers={\"Content-Type\": \"text/html\"}),\n 400,\n [(\"X-Foo\", \"bar\")],\n )\n assert rv.status_code == 400\n assert rv.headers[\"Content-Type\"] == \"text/html\"\n assert rv.headers[\"X-Foo\"] == \"bar\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_test_build_error_handler.None_1.assert_flask_url_for_spa": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_test_build_error_handler.None_1.assert_flask_url_for_spa", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1354, "end_line": 1377, "span_ids": ["test_build_error_handler"], "tokens": 182}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_build_error_handler(app):\n # Test base case, a URL which results in a BuildError.\n with app.test_request_context():\n pytest.raises(BuildError, flask.url_for, \"spam\")\n\n # Verify the error is re-raised if not the current exception.\n try:\n with app.test_request_context():\n flask.url_for(\"spam\")\n except BuildError as err:\n error = err\n try:\n raise RuntimeError(\"Test case where BuildError is not current.\")\n except RuntimeError:\n pytest.raises(BuildError, app.handle_url_build_error, error, \"spam\", {})\n\n # Test a custom handler.\n def handler(error, endpoint, values):\n # Just a test.\n return \"/test_handler/\"\n\n app.url_build_error_handlers.append(handler)\n with app.test_request_context():\n assert flask.url_for(\"spam\") == \"/test_handler/\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_reraise_test_static_folder_with_ending_slash.assert_rv_data_b_catch": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_build_error_handler_reraise_test_static_folder_with_ending_slash.assert_rv_data_b_catch", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1373, "end_line": 1461, "span_ids": ["test_static_folder_with_ending_slash", "test_build_error_handler_reraise", "test_static_url_path", "test_static_url_empty_path_default", "test_static_url_path_with_ending_slash", "test_static_files", "test_url_for_passes_special_values_to_build_error_handler", "test_static_folder_with_pathlib_path", "test_static_url_empty_path"], "tokens": 625}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_build_error_handler_reraise(app):\n # Test a custom handler which reraises the BuildError\n def handler_raises_build_error(error, endpoint, values):\n raise error\n\n app.url_build_error_handlers.append(handler_raises_build_error)\n\n with app.test_request_context():\n pytest.raises(BuildError, flask.url_for, \"not.existing\")\n\n\ndef test_url_for_passes_special_values_to_build_error_handler(app):\n @app.url_build_error_handlers.append\n def handler(error, endpoint, values):\n assert values == {\n \"_external\": False,\n \"_anchor\": None,\n \"_method\": None,\n \"_scheme\": None,\n }\n return \"handled\"\n\n with app.test_request_context():\n flask.url_for(\"/\")\n\n\ndef test_static_files(app, client):\n rv = client.get(\"/static/index.html\")\n assert rv.status_code == 200\n assert rv.data.strip() == b\"

Hello World!

\"\n with app.test_request_context():\n assert flask.url_for(\"static\", filename=\"index.html\") == \"/static/index.html\"\n rv.close()\n\n\ndef test_static_url_path():\n app = flask.Flask(__name__, static_url_path=\"/foo\")\n app.testing = True\n rv = app.test_client().get(\"/foo/index.html\")\n assert rv.status_code == 200\n rv.close()\n\n with app.test_request_context():\n assert flask.url_for(\"static\", filename=\"index.html\") == \"/foo/index.html\"\n\n\ndef test_static_url_path_with_ending_slash():\n app = flask.Flask(__name__, static_url_path=\"/foo/\")\n app.testing = True\n rv = app.test_client().get(\"/foo/index.html\")\n assert rv.status_code == 200\n rv.close()\n\n with app.test_request_context():\n assert flask.url_for(\"static\", filename=\"index.html\") == \"/foo/index.html\"\n\n\ndef test_static_url_empty_path(app):\n app = flask.Flask(__name__, static_folder=\"\", static_url_path=\"\")\n rv = app.test_client().open(\"/static/index.html\", method=\"GET\")\n assert rv.status_code == 200\n rv.close()\n\n\ndef test_static_url_empty_path_default(app):\n app = flask.Flask(__name__, static_folder=\"\")\n rv = app.test_client().open(\"/static/index.html\", method=\"GET\")\n assert rv.status_code == 200\n rv.close()\n\n\ndef test_static_folder_with_pathlib_path(app):\n from pathlib import Path\n\n app = flask.Flask(__name__, static_folder=Path(\"static\"))\n rv = app.test_client().open(\"/static/index.html\", method=\"GET\")\n assert rv.status_code == 200\n rv.close()\n\n\ndef test_static_folder_with_ending_slash():\n app = flask.Flask(__name__, static_folder=\"static/\")\n\n @app.route(\"/\")\n def catch_all(path):\n return path\n\n rv = app.test_client().get(\"/catch/all\")\n assert rv.data == b\"catch/all\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_static_route_with_host_matching_test_request_locals.assert_not_flask_g": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_static_route_with_host_matching_test_request_locals.assert_not_flask_g", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1464, "end_line": 1487, "span_ids": ["test_static_route_with_host_matching", "test_request_locals"], "tokens": 234}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_static_route_with_host_matching():\n app = flask.Flask(__name__, host_matching=True, static_host=\"example.com\")\n c = app.test_client()\n rv = c.get(\"http://example.com/static/index.html\")\n assert rv.status_code == 200\n rv.close()\n with app.test_request_context():\n rv = flask.url_for(\"static\", filename=\"index.html\", _external=True)\n assert rv == \"http://example.com/static/index.html\"\n # Providing static_host without host_matching=True should error.\n with pytest.raises(AssertionError):\n flask.Flask(__name__, static_host=\"example.com\")\n # Providing host_matching=True with static_folder\n # but without static_host should error.\n with pytest.raises(AssertionError):\n flask.Flask(__name__, host_matching=True)\n # Providing host_matching=True without static_host\n # but with static_folder=None should not error.\n flask.Flask(__name__, host_matching=True, static_folder=None)\n\n\ndef test_request_locals():\n assert repr(flask.g) == \"\"\n assert not flask.g", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_server_name_subdomain_test_server_name_subdomain.assert_rv_data_b_subdo": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_server_name_subdomain_test_server_name_subdomain.assert_rv_data_b_subdo", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1490, "end_line": 1532, "span_ids": ["test_server_name_subdomain"], "tokens": 319}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_server_name_subdomain():\n app = flask.Flask(__name__, subdomain_matching=True)\n client = app.test_client()\n\n @app.route(\"/\")\n def index():\n return \"default\"\n\n @app.route(\"/\", subdomain=\"foo\")\n def subdomain():\n return \"subdomain\"\n\n app.config[\"SERVER_NAME\"] = \"dev.local:5000\"\n rv = client.get(\"/\")\n assert rv.data == b\"default\"\n\n rv = client.get(\"/\", \"http://dev.local:5000\")\n assert rv.data == b\"default\"\n\n rv = client.get(\"/\", \"https://dev.local:5000\")\n assert rv.data == b\"default\"\n\n app.config[\"SERVER_NAME\"] = \"dev.local:443\"\n rv = client.get(\"/\", \"https://dev.local\")\n\n # Werkzeug 1.0 fixes matching https scheme with 443 port\n if rv.status_code != 404:\n assert rv.data == b\"default\"\n\n app.config[\"SERVER_NAME\"] = \"dev.local\"\n rv = client.get(\"/\", \"https://dev.local\")\n assert rv.data == b\"default\"\n\n # suppress Werkzeug 0.15 warning about name mismatch\n with warnings.catch_warnings():\n warnings.filterwarnings(\n \"ignore\", \"Current server name\", UserWarning, \"flask.app\"\n )\n rv = client.get(\"/\", \"http://foo.localhost\")\n assert rv.status_code == 404\n\n rv = client.get(\"/\", \"http://foo.dev.local\")\n assert rv.data == b\"subdomain\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_content_length_test_max_content_length.assert_rv_data_b_42_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_content_length_test_max_content_length.assert_rv_data_b_42_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1583, "end_line": 1601, "span_ids": ["test_max_content_length"], "tokens": 114}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_max_content_length(app, client):\n app.config[\"MAX_CONTENT_LENGTH\"] = 64\n\n @app.before_request\n def always_first():\n flask.request.form[\"myfile\"]\n AssertionError()\n\n @app.route(\"/accept\", methods=[\"POST\"])\n def accept_file():\n flask.request.form[\"myfile\"]\n AssertionError()\n\n @app.errorhandler(413)\n def catcher(error):\n return \"42\"\n\n rv = client.post(\"/accept\", data={\"myfile\": \"foo\" * 100})\n assert rv.data == b\"42\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_processors_test_url_processors.assert_client_get_foo_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_url_processors_test_url_processors.assert_client_get_foo_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1604, "end_line": 1630, "span_ids": ["test_url_processors"], "tokens": 207}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_url_processors(app, client):\n @app.url_defaults\n def add_language_code(endpoint, values):\n if flask.g.lang_code is not None and app.url_map.is_endpoint_expecting(\n endpoint, \"lang_code\"\n ):\n values.setdefault(\"lang_code\", flask.g.lang_code)\n\n @app.url_value_preprocessor\n def pull_lang_code(endpoint, values):\n flask.g.lang_code = values.pop(\"lang_code\", None)\n\n @app.route(\"//\")\n def index():\n return flask.url_for(\"about\")\n\n @app.route(\"//about\")\n def about():\n return flask.url_for(\"something_else\")\n\n @app.route(\"/foo\")\n def something_else():\n return flask.url_for(\"about\", lang_code=\"en\")\n\n assert client.get(\"/de/\").data == b\"/de/about\"\n assert client.get(\"/de/about\").data == b\"/foo\"\n assert client.get(\"/foo\").data == b\"/en/about\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_inject_blueprint_url_defaults_test_inject_blueprint_url_defaults.assert_url_expected": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_inject_blueprint_url_defaults_test_inject_blueprint_url_defaults.assert_url_expected", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1620, "end_line": 1641, "span_ids": ["test_inject_blueprint_url_defaults"], "tokens": 132}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_inject_blueprint_url_defaults(app):\n bp = flask.Blueprint(\"foo\", __name__, template_folder=\"template\")\n\n @bp.url_defaults\n def bp_defaults(endpoint, values):\n values[\"page\"] = \"login\"\n\n @bp.route(\"/\")\n def view(page):\n pass\n\n app.register_blueprint(bp)\n\n values = dict()\n app.inject_url_defaults(\"foo.view\", values)\n expected = dict(page=\"login\")\n assert values == expected\n\n with app.test_request_context(\"/somepage\"):\n url = flask.url_for(\"foo.view\")\n expected = \"/login\"\n assert url == expected", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.assert_client_get_bar_1": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.assert_client_get_bar_1", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1750, "end_line": 1772, "span_ids": ["test_route_decorator_custom_endpoint"], "tokens": 169}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_route_decorator_custom_endpoint(app, client):\n app.debug = True\n\n @app.route(\"/foo/\")\n def foo():\n return flask.request.endpoint\n\n @app.route(\"/bar/\", endpoint=\"bar\")\n def for_bar():\n return flask.request.endpoint\n\n @app.route(\"/bar/123\", endpoint=\"123\")\n def for_bar_foo():\n return flask.request.endpoint\n\n with app.test_request_context():\n assert flask.url_for(\"foo\") == \"/foo/\"\n assert flask.url_for(\"bar\") == \"/bar/\"\n assert flask.url_for(\"123\") == \"/bar/123\"\n\n assert client.get(\"/foo/\").data == b\"foo\"\n assert client.get(\"/bar/\").data == b\"bar\"\n assert client.get(\"/bar/123\").data == b\"123\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_get_method_on_g_test_g_iteration_protocol.assert_sorted_flask_g_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_get_method_on_g_test_g_iteration_protocol.assert_sorted_flask_g_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1826, "end_line": 1839, "span_ids": ["test_get_method_on_g", "test_g_iteration_protocol"], "tokens": 122}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_get_method_on_g(app_ctx):\n assert flask.g.get(\"x\") is None\n assert flask.g.get(\"x\", 11) == 11\n flask.g.x = 42\n assert flask.g.get(\"x\") == 42\n assert flask.g.x == 42\n\n\ndef test_g_iteration_protocol(app_ctx):\n flask.g.foo = 23\n flask.g.bar = 42\n assert \"foo\" in flask.g\n assert \"foos\" not in flask.g\n assert sorted(flask.g) == [\"bar\", \"foo\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_basic_support_test_subdomain_basic_support.assert_rv_data_b_test_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_basic_support_test_subdomain_basic_support.assert_rv_data_b_test_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1842, "end_line": 1859, "span_ids": ["test_subdomain_basic_support"], "tokens": 126}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_subdomain_basic_support():\n app = flask.Flask(__name__, subdomain_matching=True)\n app.config[\"SERVER_NAME\"] = \"localhost.localdomain\"\n client = app.test_client()\n\n @app.route(\"/\")\n def normal_index():\n return \"normal index\"\n\n @app.route(\"/\", subdomain=\"test\")\n def test_index():\n return \"test index\"\n\n rv = client.get(\"/\", \"http://localhost.localdomain/\")\n assert rv.data == b\"normal index\"\n\n rv = client.get(\"/\", \"http://test.localhost.localdomain/\")\n assert rv.data == b\"test index\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_test_subdomain_matching_with_ports.assert_rv_data_b_index": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_test_subdomain_matching_with_ports.assert_rv_data_b_index", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1862, "end_line": 1885, "span_ids": ["test_subdomain_matching_with_ports", "test_subdomain_matching"], "tokens": 198}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_subdomain_matching():\n app = flask.Flask(__name__, subdomain_matching=True)\n client = app.test_client()\n app.config[\"SERVER_NAME\"] = \"localhost.localdomain\"\n\n @app.route(\"/\", subdomain=\"\")\n def index(user):\n return f\"index for {user}\"\n\n rv = client.get(\"/\", \"http://mitsuhiko.localhost.localdomain/\")\n assert rv.data == b\"index for mitsuhiko\"\n\n\ndef test_subdomain_matching_with_ports():\n app = flask.Flask(__name__, subdomain_matching=True)\n app.config[\"SERVER_NAME\"] = \"localhost.localdomain:3000\"\n client = app.test_client()\n\n @app.route(\"/\", subdomain=\"\")\n def index(user):\n return f\"index for {user}\"\n\n rv = client.get(\"/\", \"http://mitsuhiko.localhost.localdomain:3000/\")\n assert rv.data == b\"index for mitsuhiko\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_other_name_test_subdomain_matching_other_name.assert_rv_status_code_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_subdomain_matching_other_name_test_subdomain_matching_other_name.assert_rv_status_code_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1775, "end_line": 1796, "span_ids": ["test_subdomain_matching_other_name"], "tokens": 203}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"matching\", (False, True))\ndef test_subdomain_matching_other_name(matching):\n app = flask.Flask(__name__, subdomain_matching=matching)\n app.config[\"SERVER_NAME\"] = \"localhost.localdomain:3000\"\n client = app.test_client()\n\n @app.route(\"/\")\n def index():\n return \"\", 204\n\n # suppress Werkzeug 0.15 warning about name mismatch\n with warnings.catch_warnings():\n warnings.filterwarnings(\n \"ignore\", \"Current server name\", UserWarning, \"flask.app\"\n )\n # ip address can't match name\n rv = client.get(\"/\", \"http://127.0.0.1:3000/\")\n assert rv.status_code == 404 if matching else 204\n\n # allow all subdomains if matching is disabled\n rv = client.get(\"/\", \"http://www.localhost.localdomain:3000/\")\n assert rv.status_code == 404 if matching else 204", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_multi_route_rules_test_run_defaults.assert_rv_result_r": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_multi_route_rules_test_run_defaults.assert_rv_result_r", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1909, "end_line": 1946, "span_ids": ["test_multi_route_class_views.View", "test_multi_route_class_views.View.__init__", "test_multi_route_class_views", "test_multi_route_rules", "test_run_defaults"], "tokens": 245}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_multi_route_rules(app, client):\n @app.route(\"/\")\n @app.route(\"//\")\n def index(test=\"a\"):\n return test\n\n rv = client.open(\"/\")\n assert rv.data == b\"a\"\n rv = client.open(\"/b/\")\n assert rv.data == b\"b\"\n\n\ndef test_multi_route_class_views(app, client):\n class View:\n def __init__(self, app):\n app.add_url_rule(\"/\", \"index\", self.index)\n app.add_url_rule(\"//\", \"index\", self.index)\n\n def index(self, test=\"a\"):\n return test\n\n _ = View(app)\n rv = client.open(\"/\")\n assert rv.data == b\"a\"\n rv = client.open(\"/b/\")\n assert rv.data == b\"b\"\n\n\ndef test_run_defaults(monkeypatch, app):\n rv = {}\n\n # Mocks werkzeug.serving.run_simple method\n def run_simple_mock(*args, **kwargs):\n rv[\"result\"] = \"running...\"\n\n monkeypatch.setattr(werkzeug.serving, \"run_simple\", run_simple_mock)\n app.run()\n assert rv[\"result\"] == \"running...\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_server_port_test_run_server_port.assert_rv_result_f_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_server_port_test_run_server_port.assert_rv_result_f_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1949, "end_line": 1959, "span_ids": ["test_run_server_port"], "tokens": 118}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_run_server_port(monkeypatch, app):\n rv = {}\n\n # Mocks werkzeug.serving.run_simple method\n def run_simple_mock(hostname, port, application, *args, **kwargs):\n rv[\"result\"] = f\"running on {hostname}:{port} ...\"\n\n monkeypatch.setattr(werkzeug.serving, \"run_simple\", run_simple_mock)\n hostname, port = \"localhost\", 8000\n app.run(hostname, port, debug=True)\n assert rv[\"result\"] == f\"running on {hostname}:{port} ...\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_from_config_test_run_from_config.app_run_host_port_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_run_from_config_test_run_from_config.app_run_host_port_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1962, "end_line": 1983, "span_ids": ["test_run_from_config"], "tokens": 264}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"host,port,server_name,expect_host,expect_port\",\n (\n (None, None, \"pocoo.org:8080\", \"pocoo.org\", 8080),\n (\"localhost\", None, \"pocoo.org:8080\", \"localhost\", 8080),\n (None, 80, \"pocoo.org:8080\", \"pocoo.org\", 80),\n (\"localhost\", 80, \"pocoo.org:8080\", \"localhost\", 80),\n (\"localhost\", 0, \"localhost:8080\", \"localhost\", 0),\n (None, None, \"localhost:8080\", \"localhost\", 8080),\n (None, None, \"localhost:0\", \"localhost\", 0),\n ),\n)\ndef test_run_from_config(\n monkeypatch, host, port, server_name, expect_host, expect_port, app\n):\n def run_simple_mock(hostname, port, *args, **kwargs):\n assert hostname == expect_host\n assert port == expect_port\n\n monkeypatch.setattr(werkzeug.serving, \"run_simple\", run_simple_mock)\n app.config[\"SERVER_NAME\"] = server_name\n app.run(host, port)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_cookie_size_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_max_cookie_size_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1986, "end_line": 2030, "span_ids": ["test_max_cookie_size", "test_app_freed_on_zero_refcount"], "tokens": 308}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_max_cookie_size(app, client, recwarn):\n app.config[\"MAX_COOKIE_SIZE\"] = 100\n\n # outside app context, default to Werkzeug static value,\n # which is also the default config\n response = flask.Response()\n default = flask.Flask.default_config[\"MAX_COOKIE_SIZE\"]\n assert response.max_cookie_size == default\n\n # inside app context, use app config\n with app.app_context():\n assert flask.Response().max_cookie_size == 100\n\n @app.route(\"/\")\n def index():\n r = flask.Response(\"\", status=204)\n r.set_cookie(\"foo\", \"bar\" * 100)\n return r\n\n client.get(\"/\")\n assert len(recwarn) == 1\n w = recwarn.pop()\n assert \"cookie is too large\" in str(w.message)\n\n app.config[\"MAX_COOKIE_SIZE\"] = 0\n\n client.get(\"/\")\n assert len(recwarn) == 0\n\n\n@require_cpython_gc\ndef test_app_freed_on_zero_refcount():\n # A Flask instance should not create a reference cycle that prevents CPython\n # from freeing it when all external references to it are released (see #3761).\n gc.disable()\n try:\n app = flask.Flask(__name__)\n assert app.view_functions[\"static\"]\n weak = weakref.ref(app)\n assert weak() is not None\n del app\n assert weak() is None\n finally:\n gc.enable()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_specific_user_error_handling_test_blueprint_specific_user_error_handling.assert_client_get_funct": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_specific_user_error_handling_test_blueprint_specific_user_error_handling.assert_client_get_funct", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 48, "end_line": 79, "span_ids": ["test_blueprint_specific_user_error_handling.MyFunctionException", "test_blueprint_specific_user_error_handling.MyDecoratorException:2", "test_blueprint_specific_user_error_handling.MyFunctionException:2", "test_blueprint_specific_user_error_handling.MyDecoratorException", "test_blueprint_specific_user_error_handling"], "tokens": 184}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_specific_user_error_handling(app, client):\n class MyDecoratorException(Exception):\n pass\n\n class MyFunctionException(Exception):\n pass\n\n blue = flask.Blueprint(\"blue\", __name__)\n\n @blue.errorhandler(MyDecoratorException)\n def my_decorator_exception_handler(e):\n assert isinstance(e, MyDecoratorException)\n return \"boom\"\n\n def my_function_exception_handler(e):\n assert isinstance(e, MyFunctionException)\n return \"bam\"\n\n blue.register_error_handler(MyFunctionException, my_function_exception_handler)\n\n @blue.route(\"/decorator\")\n def blue_deco_test():\n raise MyDecoratorException()\n\n @blue.route(\"/function\")\n def blue_func_test():\n raise MyFunctionException()\n\n app.register_blueprint(blue)\n\n assert client.get(\"/decorator\").data == b\"boom\"\n assert client.get(\"/function\").data == b\"bam\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_app_error_handling_test_blueprint_app_error_handling.assert_client_get_nope_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_app_error_handling_test_blueprint_app_error_handling.assert_client_get_nope_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 82, "end_line": 103, "span_ids": ["test_blueprint_app_error_handling"], "tokens": 153}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_app_error_handling(app, client):\n errors = flask.Blueprint(\"errors\", __name__)\n\n @errors.app_errorhandler(403)\n def forbidden_handler(e):\n return \"you shall not pass\", 403\n\n @app.route(\"/forbidden\")\n def app_forbidden():\n flask.abort(403)\n\n forbidden_bp = flask.Blueprint(\"forbidden_bp\", __name__)\n\n @forbidden_bp.route(\"/nope\")\n def bp_forbidden():\n flask.abort(403)\n\n app.register_blueprint(errors)\n app.register_blueprint(forbidden_bp)\n\n assert client.get(\"/forbidden\").data == b\"you shall not pass\"\n assert client.get(\"/nope\").data == b\"you shall not pass\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_prefix_slash_test_blueprint_prefix_slash.assert_client_get_url_st": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_prefix_slash_test_blueprint_prefix_slash.assert_client_get_url_st", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 106, "end_line": 130, "span_ids": ["test_blueprint_prefix_slash"], "tokens": 185}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n (\"prefix\", \"rule\", \"url\"),\n (\n (\"\", \"/\", \"/\"),\n (\"/\", \"\", \"/\"),\n (\"/\", \"/\", \"/\"),\n (\"/foo\", \"\", \"/foo\"),\n (\"/foo/\", \"\", \"/foo/\"),\n (\"\", \"/bar\", \"/bar\"),\n (\"/foo/\", \"/bar\", \"/foo/bar\"),\n (\"/foo/\", \"bar\", \"/foo/bar\"),\n (\"/foo\", \"/bar\", \"/foo/bar\"),\n (\"/foo/\", \"//bar\", \"/foo/bar\"),\n (\"/foo//\", \"/bar\", \"/foo/bar\"),\n ),\n)\ndef test_blueprint_prefix_slash(app, client, prefix, rule, url):\n bp = flask.Blueprint(\"test\", __name__, url_prefix=prefix)\n\n @bp.route(rule)\n def index():\n return \"\", 204\n\n app.register_blueprint(bp)\n assert client.get(url).status_code == 204", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_defaults_test_blueprint_url_defaults.assert_client_get_2_bar": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_defaults_test_blueprint_url_defaults.assert_client_get_2_bar", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 131, "end_line": 148, "span_ids": ["test_blueprint_url_defaults"], "tokens": 171}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_url_defaults(app, client):\n bp = flask.Blueprint(\"test\", __name__)\n\n @bp.route(\"/foo\", defaults={\"baz\": 42})\n def foo(bar, baz):\n return f\"{bar}/{baz:d}\"\n\n @bp.route(\"/bar\")\n def bar(bar):\n return str(bar)\n\n app.register_blueprint(bp, url_prefix=\"/1\", url_defaults={\"bar\": 23})\n app.register_blueprint(bp, name=\"test2\", url_prefix=\"/2\", url_defaults={\"bar\": 19})\n\n assert client.get(\"/1/foo\").data == b\"23/42\"\n assert client.get(\"/2/foo\").data == b\"19/42\"\n assert client.get(\"/1/bar\").data == b\"23\"\n assert client.get(\"/2/bar\").data == b\"19\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_processors_test_blueprint_url_processors.assert_client_get_de_ab": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_url_processors_test_blueprint_url_processors.assert_client_get_de_ab", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 153, "end_line": 175, "span_ids": ["test_blueprint_url_processors"], "tokens": 156}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_url_processors(app, client):\n bp = flask.Blueprint(\"frontend\", __name__, url_prefix=\"/\")\n\n @bp.url_defaults\n def add_language_code(endpoint, values):\n values.setdefault(\"lang_code\", flask.g.lang_code)\n\n @bp.url_value_preprocessor\n def pull_lang_code(endpoint, values):\n flask.g.lang_code = values.pop(\"lang_code\")\n\n @bp.route(\"/\")\n def index():\n return flask.url_for(\".about\")\n\n @bp.route(\"/about\")\n def about():\n return flask.url_for(\".index\")\n\n app.register_blueprint(bp)\n\n assert client.get(\"/de/\").data == b\"/de/about\"\n assert client.get(\"/de/about\").data == b\"/de/\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_and_static_test_templates_and_static.with_flask_Flask___name__.assert_flask_render_templ": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_and_static_test_templates_and_static.with_flask_Flask___name__.assert_flask_render_templ", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 178, "end_line": 222, "span_ids": ["test_templates_and_static"], "tokens": 382}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_templates_and_static(test_apps):\n from blueprintapp import app\n\n client = app.test_client()\n\n rv = client.get(\"/\")\n assert rv.data == b\"Hello from the Frontend\"\n rv = client.get(\"/admin/\")\n assert rv.data == b\"Hello from the Admin\"\n rv = client.get(\"/admin/index2\")\n assert rv.data == b\"Hello from the Admin\"\n rv = client.get(\"/admin/static/test.txt\")\n assert rv.data.strip() == b\"Admin File\"\n rv.close()\n rv = client.get(\"/admin/static/css/test.css\")\n assert rv.data.strip() == b\"/* nested file */\"\n rv.close()\n\n # try/finally, in case other tests use this app for Blueprint tests.\n max_age_default = app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"]\n try:\n expected_max_age = 3600\n if app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] == expected_max_age:\n expected_max_age = 7200\n app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] = expected_max_age\n rv = client.get(\"/admin/static/css/test.css\")\n cc = parse_cache_control_header(rv.headers[\"Cache-Control\"])\n assert cc.max_age == expected_max_age\n rv.close()\n finally:\n app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] = max_age_default\n\n with app.test_request_context():\n assert (\n flask.url_for(\"admin.static\", filename=\"test.txt\")\n == \"/admin/static/test.txt\"\n )\n\n with app.test_request_context():\n with pytest.raises(TemplateNotFound) as e:\n flask.render_template(\"missing.html\")\n assert e.value.name == \"missing.html\"\n\n with flask.Flask(__name__).test_request_context():\n assert flask.render_template(\"nested/nested.txt\") == \"I'm nested\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_default_static_max_age_test_default_static_max_age.try_.finally_.app_config_SEND_FILE_MAX": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_default_static_max_age_test_default_static_max_age.try_.finally_.app_config_SEND_FILE_MAX", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 225, "end_line": 246, "span_ids": ["test_default_static_max_age", "test_default_static_max_age.MyBlueprint.get_send_file_max_age", "test_default_static_max_age.MyBlueprint"], "tokens": 206}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_default_static_max_age(app):\n class MyBlueprint(flask.Blueprint):\n def get_send_file_max_age(self, filename):\n return 100\n\n blueprint = MyBlueprint(\"blueprint\", __name__, static_folder=\"static\")\n app.register_blueprint(blueprint)\n\n # try/finally, in case other tests use this app for Blueprint tests.\n max_age_default = app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"]\n try:\n with app.test_request_context():\n unexpected_max_age = 3600\n if app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] == unexpected_max_age:\n unexpected_max_age = 7200\n app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] = unexpected_max_age\n rv = blueprint.send_static_file(\"index.html\")\n cc = parse_cache_control_header(rv.headers[\"Cache-Control\"])\n assert cc.max_age == 100\n rv.close()\n finally:\n app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] = max_age_default", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.None_4": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_test_route_decorator_custom_endpoint.None_4", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 311, "end_line": 340, "span_ids": ["test_route_decorator_custom_endpoint"], "tokens": 211}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_route_decorator_custom_endpoint(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.route(\"/foo\")\n def foo():\n return flask.request.endpoint\n\n @bp.route(\"/bar\", endpoint=\"bar\")\n def foo_bar():\n return flask.request.endpoint\n\n @bp.route(\"/bar/123\", endpoint=\"123\")\n def foo_bar_foo():\n return flask.request.endpoint\n\n @bp.route(\"/bar/foo\")\n def bar_foo():\n return flask.request.endpoint\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.request.endpoint\n\n assert client.get(\"/\").data == b\"index\"\n assert client.get(\"/py/foo\").data == b\"bp.foo\"\n assert client.get(\"/py/bar\").data == b\"bp.bar\"\n assert client.get(\"/py/bar/123\").data == b\"bp.123\"\n assert client.get(\"/py/bar/foo\").data == b\"bp.bar_foo\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_context_processing_test_context_processing.assert_b_43_in_answer_pa": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_context_processing_test_context_processing.assert_b_43_in_answer_pa", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 693, "end_line": 730, "span_ids": ["test_context_processing"], "tokens": 260}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_context_processing(app, client):\n answer_bp = flask.Blueprint(\"answer_bp\", __name__)\n\n template_string = lambda: flask.render_template_string( # noqa: E731\n \"{% if notanswer %}{{ notanswer }} is not the answer. {% endif %}\"\n \"{% if answer %}{{ answer }} is the answer.{% endif %}\"\n )\n\n # App global context processor\n @answer_bp.app_context_processor\n def not_answer_context_processor():\n return {\"notanswer\": 43}\n\n # Blueprint local context processor\n @answer_bp.context_processor\n def answer_context_processor():\n return {\"answer\": 42}\n\n # Setup endpoints for testing\n @answer_bp.route(\"/bp\")\n def bp_page():\n return template_string()\n\n @app.route(\"/\")\n def app_page():\n return template_string()\n\n # Register the blueprint\n app.register_blueprint(answer_bp)\n\n app_page_bytes = client.get(\"/\").data\n answer_page_bytes = client.get(\"/bp\").data\n\n assert b\"43\" in app_page_bytes\n assert b\"42\" not in app_page_bytes\n\n assert b\"42\" in answer_page_bytes\n assert b\"43\" in answer_page_bytes", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_global_test_template_global.with_app_app_context_.assert_rv_42_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_global_test_template_global.with_app_app_context_.assert_rv_42_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 733, "end_line": 751, "span_ids": ["test_template_global"], "tokens": 151}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_template_global(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_global()\n def get_answer():\n return 42\n\n # Make sure the function is not in the jinja_env already\n assert \"get_answer\" not in app.jinja_env.globals.keys()\n app.register_blueprint(bp)\n\n # Tests\n assert \"get_answer\" in app.jinja_env.globals.keys()\n assert app.jinja_env.globals[\"get_answer\"] is get_answer\n assert app.jinja_env.globals[\"get_answer\"]() == 42\n\n with app.app_context():\n rv = flask.render_template_string(\"{{ get_answer() }}\")\n assert rv == \"42\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_request_processing_test_request_processing.assert_evts_before_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_request_processing_test_request_processing.assert_evts_before_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 754, "end_line": 782, "span_ids": ["test_request_processing"], "tokens": 165}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_processing(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n evts = []\n\n @bp.before_request\n def before_bp():\n evts.append(\"before\")\n\n @bp.after_request\n def after_bp(response):\n response.data += b\"|after\"\n evts.append(\"after\")\n return response\n\n @bp.teardown_request\n def teardown_bp(exc):\n evts.append(\"teardown\")\n\n # Setup routes for testing\n @bp.route(\"/bp\")\n def bp_endpoint():\n return \"request\"\n\n app.register_blueprint(bp)\n\n assert evts == []\n rv = client.get(\"/bp\")\n assert rv.data == b\"request|after\"\n assert evts == [\"before\", \"after\", \"teardown\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_request_processing_test_app_request_processing.None_4": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_request_processing_test_app_request_processing.None_4", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 721, "end_line": 757, "span_ids": ["test_app_request_processing"], "tokens": 220}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_app_request_processing(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n evts = []\n\n @bp.before_app_request\n def before_app():\n evts.append(\"before\")\n\n @bp.after_app_request\n def after_app(response):\n response.data += b\"|after\"\n evts.append(\"after\")\n return response\n\n @bp.teardown_app_request\n def teardown_app(exc):\n evts.append(\"teardown\")\n\n app.register_blueprint(bp)\n\n # Setup routes for testing\n @app.route(\"/\")\n def bp_endpoint():\n return \"request\"\n\n # before first request\n assert evts == []\n\n # first request\n resp = client.get(\"/\").data\n assert resp == b\"request|after\"\n assert evts == [\"before\", \"after\", \"teardown\"]\n\n # second request\n resp = client.get(\"/\").data\n assert resp == b\"request|after\"\n assert evts == [\"before\", \"after\", \"teardown\"] * 2", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_url_processors_test_app_url_processors.assert_client_get_de_ab": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_app_url_processors_test_app_url_processors.assert_client_get_de_ab", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 828, "end_line": 852, "span_ids": ["test_app_url_processors"], "tokens": 182}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_app_url_processors(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n # Register app-wide url defaults and preprocessor on blueprint\n @bp.app_url_defaults\n def add_language_code(endpoint, values):\n values.setdefault(\"lang_code\", flask.g.lang_code)\n\n @bp.app_url_value_preprocessor\n def pull_lang_code(endpoint, values):\n flask.g.lang_code = values.pop(\"lang_code\")\n\n # Register route rules at the app level\n @app.route(\"//\")\n def index():\n return flask.url_for(\"about\")\n\n @app.route(\"//about\")\n def about():\n return flask.url_for(\"index\")\n\n app.register_blueprint(bp)\n\n assert client.get(\"/de/\").data == b\"/de/about\"\n assert client.get(\"/de/about\").data == b\"/de/\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py__This_file_was_part_of_F_test_cli_name.assert_testapp_cli_name_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py__This_file_was_part_of_F_test_cli_name.assert_testapp_cli_name_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 43, "span_ids": ["impl", "docstring", "runner", "imports", "test_cli_name"], "tokens": 239}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "# This file was part of Flask-CLI and was modified under the terms of\nimport os\nimport ssl\nimport sys\nimport types\nfrom functools import partial\nfrom pathlib import Path\n\nimport click\nimport pytest\nfrom _pytest.monkeypatch import notset\nfrom click.testing import CliRunner\n\nfrom flask import Blueprint\nfrom flask import current_app\nfrom flask import Flask\nfrom flask.cli import AppGroup\nfrom flask.cli import find_best_app\nfrom flask.cli import FlaskGroup\nfrom flask.cli import get_version\nfrom flask.cli import load_dotenv\nfrom flask.cli import locate_app\nfrom flask.cli import NoAppException\nfrom flask.cli import prepare_import\nfrom flask.cli import run_command\nfrom flask.cli import ScriptInfo\nfrom flask.cli import with_appcontext\n\ncwd = Path.cwd()\ntest_path = (Path(__file__) / \"..\" / \"test_apps\").resolve()\n\n\n@pytest.fixture\ndef runner():\n return CliRunner()\n\n\ndef test_cli_name(test_apps):\n \"\"\"Make sure the CLI object's name is the app's name and not the app itself\"\"\"\n from cliapp.app import testapp\n\n assert testapp.cli.name == testapp.name", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_find_best_app_test_find_best_app.pytest_raises_TypeError_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_find_best_app_test_find_best_app.pytest_raises_TypeError_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 46, "end_line": 130, "span_ids": ["test_find_best_app.Module_11.create_app", "test_find_best_app.Module_5", "test_find_best_app.Module_4.create_app", "test_find_best_app.Module_9", "test_find_best_app.Module_10.create_app", "test_find_best_app.Module_11", "test_find_best_app", "test_find_best_app.Module_4", "test_find_best_app.Module_6", "test_find_best_app.Module_8:2", "test_find_best_app.Module_10", "test_find_best_app.Module_1:2", "test_find_best_app.Module_7", "test_find_best_app.Module_2:2", "test_find_best_app.Module_9:2", "test_find_best_app.Module_1", "test_find_best_app.Module_2", "test_find_best_app.Module_3", "test_find_best_app.Module:2", "test_find_best_app.Module", "test_find_best_app.Module_6:2", "test_find_best_app.Module_7:2", "test_find_best_app.Module_5.make_app", "test_find_best_app.Module_3.create_app", "test_find_best_app.Module_8"], "tokens": 430}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_find_best_app(test_apps):\n class Module:\n app = Flask(\"appname\")\n\n assert find_best_app(Module) == Module.app\n\n class Module:\n application = Flask(\"appname\")\n\n assert find_best_app(Module) == Module.application\n\n class Module:\n myapp = Flask(\"appname\")\n\n assert find_best_app(Module) == Module.myapp\n\n class Module:\n @staticmethod\n def create_app():\n return Flask(\"appname\")\n\n app = find_best_app(Module)\n assert isinstance(app, Flask)\n assert app.name == \"appname\"\n\n class Module:\n @staticmethod\n def create_app(**kwargs):\n return Flask(\"appname\")\n\n app = find_best_app(Module)\n assert isinstance(app, Flask)\n assert app.name == \"appname\"\n\n class Module:\n @staticmethod\n def make_app():\n return Flask(\"appname\")\n\n app = find_best_app(Module)\n assert isinstance(app, Flask)\n assert app.name == \"appname\"\n\n class Module:\n myapp = Flask(\"appname1\")\n\n @staticmethod\n def create_app():\n return Flask(\"appname2\")\n\n assert find_best_app(Module) == Module.myapp\n\n class Module:\n myapp = Flask(\"appname1\")\n\n @staticmethod\n def create_app():\n return Flask(\"appname2\")\n\n assert find_best_app(Module) == Module.myapp\n\n class Module:\n pass\n\n pytest.raises(NoAppException, find_best_app, Module)\n\n class Module:\n myapp1 = Flask(\"appname1\")\n myapp2 = Flask(\"appname2\")\n\n pytest.raises(NoAppException, find_best_app, Module)\n\n class Module:\n @staticmethod\n def create_app(foo, bar):\n return Flask(\"appname2\")\n\n pytest.raises(NoAppException, find_best_app, Module)\n\n class Module:\n @staticmethod\n def create_app():\n raise TypeError(\"bad bad factory!\")\n\n pytest.raises(TypeError, find_best_app, Module)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_suppress_raise_test_get_version.assert_f_Werkzeug_werkze": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_suppress_raise_test_get_version.assert_f_Werkzeug_werkze", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 220, "end_line": 246, "span_ids": ["test_get_version.MockCtx:2", "test_get_version", "test_locate_app_suppress_raise", "test_get_version.MockCtx"], "tokens": 205}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_locate_app_suppress_raise(test_apps):\n app = locate_app(\"notanapp.py\", None, raise_if_not_found=False)\n assert app is None\n\n # only direct import error is suppressed\n with pytest.raises(NoAppException):\n locate_app(\"cliapp.importerrorapp\", None, raise_if_not_found=False)\n\n\ndef test_get_version(test_apps, capsys):\n from flask import __version__ as flask_version\n from werkzeug import __version__ as werkzeug_version\n from platform import python_version\n\n class MockCtx:\n resilient_parsing = False\n color = None\n\n def exit(self):\n return\n\n ctx = MockCtx()\n get_version(ctx, None, \"test\")\n out, err = capsys.readouterr()\n assert f\"Python {python_version()}\" in out\n assert f\"Flask {flask_version}\" in out\n assert f\"Werkzeug {werkzeug_version}\" in out", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_scriptinfo_test_scriptinfo.None_9": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_scriptinfo_test_scriptinfo.None_9", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 249, "end_line": 288, "span_ids": ["test_scriptinfo"], "tokens": 311}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_scriptinfo(test_apps, monkeypatch):\n obj = ScriptInfo(app_import_path=\"cliapp.app:testapp\")\n app = obj.load_app()\n assert app.name == \"testapp\"\n assert obj.load_app() is app\n\n # import app with module's absolute path\n cli_app_path = str(test_path / \"cliapp\" / \"app.py\")\n\n obj = ScriptInfo(app_import_path=cli_app_path)\n app = obj.load_app()\n assert app.name == \"testapp\"\n assert obj.load_app() is app\n obj = ScriptInfo(app_import_path=f\"{cli_app_path}:testapp\")\n app = obj.load_app()\n assert app.name == \"testapp\"\n assert obj.load_app() is app\n\n def create_app():\n return Flask(\"createapp\")\n\n obj = ScriptInfo(create_app=create_app)\n app = obj.load_app()\n assert app.name == \"createapp\"\n assert obj.load_app() is app\n\n obj = ScriptInfo()\n pytest.raises(NoAppException, obj.load_app)\n\n # import app from wsgi.py in current directory\n monkeypatch.chdir(test_path / \"helloworld\")\n obj = ScriptInfo()\n app = obj.load_app()\n assert app.name == \"hello\"\n\n # import app from app.py in current directory\n monkeypatch.chdir(test_path / \"cliapp\")\n obj = ScriptInfo()\n app = obj.load_app()\n assert app.name == \"testapp\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes_TestRoutes.test_simple.self_expect_order_aaa_p": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes_TestRoutes.test_simple.self_expect_order_aaa_p", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 432, "end_line": 473, "span_ids": ["TestRoutes.app", "TestRoutes.invoke_no_routes", "TestRoutes", "TestRoutes.expect_order", "TestRoutes.invoke", "TestRoutes.test_simple"], "tokens": 284}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestRoutes:\n @pytest.fixture\n def app(self):\n app = Flask(__name__)\n app.testing = True\n\n @app.route(\"/get_post//\", methods=[\"GET\", \"POST\"])\n def yyy_get_post(x, y):\n pass\n\n @app.route(\"/zzz_post\", methods=[\"POST\"])\n def aaa_post():\n pass\n\n return app\n\n @pytest.fixture\n def invoke(self, app, runner):\n cli = FlaskGroup(create_app=lambda: app)\n return partial(runner.invoke, cli)\n\n @pytest.fixture\n def invoke_no_routes(self, runner):\n def create_app():\n app = Flask(__name__, static_folder=None)\n app.testing = True\n\n return app\n\n cli = FlaskGroup(create_app=create_app)\n return partial(runner.invoke, cli)\n\n def expect_order(self, order, output):\n # skip the header and match the start of each row\n for expect, line in zip(order, output.splitlines()[2:]):\n # do this instead of startswith for nicer pytest output\n assert line[: len(expect)] == expect\n\n def test_simple(self, invoke):\n result = invoke([\"routes\"])\n assert result.exit_code == 0\n self.expect_order([\"aaa_post\", \"static\", \"yyy_get_post\"], result.output)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes.test_sort_TestRoutes.test_no_routes.assert_No_routes_were_re": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_TestRoutes.test_sort_TestRoutes.test_no_routes.assert_No_routes_were_re", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 475, "end_line": 499, "span_ids": ["TestRoutes.test_no_routes", "TestRoutes.test_all_methods", "TestRoutes.test_sort"], "tokens": 250}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestRoutes:\n\n def test_sort(self, app, invoke):\n default_output = invoke([\"routes\"]).output\n endpoint_output = invoke([\"routes\", \"-s\", \"endpoint\"]).output\n assert default_output == endpoint_output\n self.expect_order(\n [\"static\", \"yyy_get_post\", \"aaa_post\"],\n invoke([\"routes\", \"-s\", \"methods\"]).output,\n )\n self.expect_order(\n [\"yyy_get_post\", \"static\", \"aaa_post\"],\n invoke([\"routes\", \"-s\", \"rule\"]).output,\n )\n match_order = [r.endpoint for r in app.url_map.iter_rules()]\n self.expect_order(match_order, invoke([\"routes\", \"-s\", \"match\"]).output)\n\n def test_all_methods(self, invoke):\n output = invoke([\"routes\"]).output\n assert \"GET, HEAD, OPTIONS, POST\" not in output\n output = invoke([\"routes\", \"--all-methods\"]).output\n assert \"GET, HEAD, OPTIONS, POST\" in output\n\n def test_no_routes(self, invoke_no_routes):\n result = invoke_no_routes([\"routes\"])\n assert result.exit_code == 0\n assert \"No routes were registered.\" in result.output", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_adhoc_test_run_cert_adhoc.None_1.run_command_make_context_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_adhoc_test_run_cert_adhoc.None_1.run_command_make_context_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 570, "end_line": 584, "span_ids": ["test_run_cert_adhoc"], "tokens": 147}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_run_cert_adhoc(monkeypatch):\n monkeypatch.setitem(sys.modules, \"cryptography\", None)\n\n # cryptography not installed\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"adhoc\"])\n\n # cryptography installed\n monkeypatch.setitem(sys.modules, \"cryptography\", types.ModuleType(\"cryptography\"))\n ctx = run_command.make_context(\"run\", [\"--cert\", \"adhoc\"])\n assert ctx.params[\"cert\"] == \"adhoc\"\n\n # no key with adhoc\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"adhoc\", \"--key\", __file__])", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_import_test_run_cert_no_ssl.with_pytest_raises_click_.run_command_make_context_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_import_test_run_cert_no_ssl.with_pytest_raises_click_.run_command_make_context_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 600, "end_line": 626, "span_ids": ["test_run_cert_import", "test_run_cert_no_ssl"], "tokens": 226}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_run_cert_import(monkeypatch):\n monkeypatch.setitem(sys.modules, \"not_here\", None)\n\n # ImportError\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"not_here\"])\n\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"flask\"])\n\n # SSLContext\n ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n\n monkeypatch.setitem(sys.modules, \"ssl_context\", ssl_context)\n ctx = run_command.make_context(\"run\", [\"--cert\", \"ssl_context\"])\n assert ctx.params[\"cert\"] is ssl_context\n\n # no --key with SSLContext\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"ssl_context\", \"--key\", __file__])\n\n\ndef test_run_cert_no_ssl(monkeypatch):\n monkeypatch.setitem(sys.modules, \"ssl\", None)\n\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", \"not_here\"])", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_json_test_config_from_file.common_object_test_app_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_json_test_config_from_file.common_object_test_app_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 37, "span_ids": ["impl", "common_object_test", "imports", "test_config_from_object", "test_config_from_pyfile", "test_config_from_file"], "tokens": 203}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import json\nimport os\nimport textwrap\n\nimport pytest\n\nimport flask\n\n\n# config keys used for the TestConfig\nTEST_KEY = \"foo\"\nSECRET_KEY = \"config\"\n\n\ndef common_object_test(app):\n assert app.secret_key == \"config\"\n assert app.config[\"TEST_KEY\"] == \"foo\"\n assert \"TestConfig\" not in app.config\n\n\ndef test_config_from_pyfile():\n app = flask.Flask(__name__)\n app.config.from_pyfile(f\"{__file__.rsplit('.', 1)[0]}.py\")\n common_object_test(app)\n\n\ndef test_config_from_object():\n app = flask.Flask(__name__)\n app.config.from_object(__name__)\n common_object_test(app)\n\n\ndef test_config_from_file():\n app = flask.Flask(__name__)\n current_dir = os.path.dirname(os.path.abspath(__file__))\n app.config.from_file(os.path.join(current_dir, \"static\", \"config.json\"), json.load)\n common_object_test(app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_envvar_missing_test_config_from_envvar_missing.assert_not_app_config_fro": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_envvar_missing_test_config_from_envvar_missing.assert_not_app_config_fro", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 153, "end_line": 163, "span_ids": ["test_config_from_envvar_missing"], "tokens": 117}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_config_from_envvar_missing(monkeypatch):\n monkeypatch.setattr(\"os.environ\", {\"FOO_SETTINGS\": \"missing.cfg\"})\n app = flask.Flask(__name__)\n with pytest.raises(IOError) as e:\n app.config.from_envvar(\"FOO_SETTINGS\")\n msg = str(e.value)\n assert msg.startswith(\n \"[Errno 2] Unable to load configuration file (No such file or directory):\"\n )\n assert msg.endswith(\"missing.cfg'\")\n assert not app.config.from_envvar(\"FOO_SETTINGS\", silent=True)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_get_namespace_test_get_namespace.None_15": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_get_namespace_test_get_namespace.None_15", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 150, "end_line": 173, "span_ids": ["test_get_namespace"], "tokens": 319}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_get_namespace():\n app = flask.Flask(__name__)\n app.config[\"FOO_OPTION_1\"] = \"foo option 1\"\n app.config[\"FOO_OPTION_2\"] = \"foo option 2\"\n app.config[\"BAR_STUFF_1\"] = \"bar stuff 1\"\n app.config[\"BAR_STUFF_2\"] = \"bar stuff 2\"\n foo_options = app.config.get_namespace(\"FOO_\")\n assert 2 == len(foo_options)\n assert \"foo option 1\" == foo_options[\"option_1\"]\n assert \"foo option 2\" == foo_options[\"option_2\"]\n bar_options = app.config.get_namespace(\"BAR_\", lowercase=False)\n assert 2 == len(bar_options)\n assert \"bar stuff 1\" == bar_options[\"STUFF_1\"]\n assert \"bar stuff 2\" == bar_options[\"STUFF_2\"]\n foo_options = app.config.get_namespace(\"FOO_\", trim_namespace=False)\n assert 2 == len(foo_options)\n assert \"foo option 1\" == foo_options[\"foo_option_1\"]\n assert \"foo option 2\" == foo_options[\"foo_option_2\"]\n bar_options = app.config.get_namespace(\n \"BAR_\", lowercase=False, trim_namespace=False\n )\n assert 2 == len(bar_options)\n assert \"bar stuff 1\" == bar_options[\"BAR_STUFF_1\"]\n assert \"bar stuff 2\" == bar_options[\"BAR_STUFF_2\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_pyfile_weird_encoding_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_pyfile_weird_encoding_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 176, "end_line": 191, "span_ids": ["test_from_pyfile_weird_encoding"], "tokens": 126}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"encoding\", [\"utf-8\", \"iso-8859-15\", \"latin-1\"])\ndef test_from_pyfile_weird_encoding(tmpdir, encoding):\n f = tmpdir.join(\"my_config.py\")\n f.write_binary(\n textwrap.dedent(\n f\"\"\"\n # -*- coding: {encoding} -*-\n TEST_VALUE = \"f\u00f6\u00f6\"\n \"\"\"\n ).encode(encoding)\n )\n app = flask.Flask(__name__)\n app.config.from_pyfile(str(f))\n value = app.config[\"TEST_VALUE\"]\n assert value == \"f\u00f6\u00f6\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_converters.py_from_werkzeug_routing_imp_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_converters.py_from_werkzeug_routing_imp_", "embedding": null, "metadata": {"file_path": "tests/test_converters.py", "file_name": "test_converters.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 43, "span_ids": ["test_context_available.ContextConverter.to_python", "test_custom_converters", "test_custom_converters.ListConverter.to_python", "test_custom_converters.ListConverter", "test_context_available.ContextConverter", "imports", "test_context_available"], "tokens": 260}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from werkzeug.routing import BaseConverter\n\nfrom flask import request\nfrom flask import session\nfrom flask import url_for\n\n\ndef test_custom_converters(app, client):\n class ListConverter(BaseConverter):\n def to_python(self, value):\n return value.split(\",\")\n\n def to_url(self, value):\n base_to_url = super().to_url\n return \",\".join(base_to_url(x) for x in value)\n\n app.url_map.converters[\"list\"] = ListConverter\n\n @app.route(\"/\")\n def index(args):\n return \"|\".join(args)\n\n assert client.get(\"/1,2,3\").data == b\"1|2|3\"\n\n with app.test_request_context():\n assert url_for(\"index\", args=[4, 5, 6]) == \"/4,5,6\"\n\n\ndef test_context_available(app, client):\n class ContextConverter(BaseConverter):\n def to_python(self, value):\n assert request is not None\n assert session is not None\n return value\n\n app.url_map.converters[\"ctx\"] = ContextConverter\n\n @app.get(\"/\")\n def index(name):\n return name\n\n assert client.get(\"/admin\").data == b\"admin\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_io_PyBytesIO.__getattr__.return.getattr_self__io_name_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_io_PyBytesIO.__getattr__.return.getattr_self__io_name_", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 30, "span_ids": ["FakePath.__fspath__", "PyBytesIO", "imports", "PyBytesIO.__getattr__", "FakePath"], "tokens": 156}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import io\nimport os\n\nimport pytest\nimport werkzeug.exceptions\n\nimport flask\nfrom flask.helpers import get_debug_flag\n\n\nclass FakePath:\n \"\"\"Fake object to represent a ``PathLike object``.\n\n This represents a ``pathlib.Path`` object in python 3.\n See: https://www.python.org/dev/peps/pep-0519/\n \"\"\"\n\n def __init__(self, path):\n self.path = path\n\n def __fspath__(self):\n return self.path\n\n\nclass PyBytesIO:\n def __init__(self, *args, **kwargs):\n self._io = io.BytesIO(*args, **kwargs)\n\n def __getattr__(self, name):\n return getattr(self._io, name)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestSendfile_TestSendfile.test_send_from_directory.rv_close_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestSendfile_TestSendfile.test_send_from_directory.rv_close_", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 33, "end_line": 99, "span_ids": ["TestSendfile.test_send_file", "TestSendfile.test_static_file.StaticFileApp", "TestSendfile.test_send_from_directory", "TestSendfile.test_static_file.StaticFileApp.get_send_file_max_age", "TestSendfile.test_static_file", "TestSendfile"], "tokens": 484}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestSendfile:\n def test_send_file(self, app, req_ctx):\n rv = flask.send_file(\"static/index.html\")\n assert rv.direct_passthrough\n assert rv.mimetype == \"text/html\"\n\n with app.open_resource(\"static/index.html\") as f:\n rv.direct_passthrough = False\n assert rv.data == f.read()\n\n rv.close()\n\n def test_static_file(self, app, req_ctx):\n # Default max_age is None.\n\n # Test with static file handler.\n rv = app.send_static_file(\"index.html\")\n assert rv.cache_control.max_age is None\n rv.close()\n\n # Test with direct use of send_file.\n rv = flask.send_file(\"static/index.html\")\n assert rv.cache_control.max_age is None\n rv.close()\n\n app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"] = 3600\n\n # Test with static file handler.\n rv = app.send_static_file(\"index.html\")\n assert rv.cache_control.max_age == 3600\n rv.close()\n\n # Test with direct use of send_file.\n rv = flask.send_file(\"static/index.html\")\n assert rv.cache_control.max_age == 3600\n rv.close()\n\n # Test with pathlib.Path.\n rv = app.send_static_file(FakePath(\"index.html\"))\n assert rv.cache_control.max_age == 3600\n rv.close()\n\n class StaticFileApp(flask.Flask):\n def get_send_file_max_age(self, filename):\n return 10\n\n app = StaticFileApp(__name__)\n\n with app.test_request_context():\n # Test with static file handler.\n rv = app.send_static_file(\"index.html\")\n assert rv.cache_control.max_age == 10\n rv.close()\n\n # Test with direct use of send_file.\n rv = flask.send_file(\"static/index.html\")\n assert rv.cache_control.max_age == 10\n rv.close()\n\n def test_send_from_directory(self, app, req_ctx):\n app.root_path = os.path.join(\n os.path.dirname(__file__), \"test_apps\", \"subdomaintestmodule\"\n )\n rv = flask.send_from_directory(\"static\", \"hello.txt\")\n rv.direct_passthrough = False\n assert rv.data.strip() == b\"Hello Subdomain\"\n rv.close()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor_TestUrlFor.test_url_for_with_alternating_schemes.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor_TestUrlFor.test_url_for_with_alternating_schemes.None_2", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 102, "end_line": 141, "span_ids": ["TestUrlFor.test_url_for_with_alternating_schemes", "TestUrlFor", "TestUrlFor.test_url_for_with_scheme", "TestUrlFor.test_url_for_with_scheme_not_external", "TestUrlFor.test_url_for_with_anchor"], "tokens": 293}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestUrlFor:\n def test_url_for_with_anchor(self, app, req_ctx):\n @app.route(\"/\")\n def index():\n return \"42\"\n\n assert flask.url_for(\"index\", _anchor=\"x y\") == \"/#x%20y\"\n\n def test_url_for_with_scheme(self, app, req_ctx):\n @app.route(\"/\")\n def index():\n return \"42\"\n\n assert (\n flask.url_for(\"index\", _external=True, _scheme=\"https\")\n == \"https://localhost/\"\n )\n\n def test_url_for_with_scheme_not_external(self, app, req_ctx):\n app.add_url_rule(\"/\", endpoint=\"index\")\n\n # Implicit external with scheme.\n url = flask.url_for(\"index\", _scheme=\"https\")\n assert url == \"https://localhost/\"\n\n # Error when external=False with scheme\n with pytest.raises(ValueError):\n flask.url_for(\"index\", _scheme=\"https\", _external=False)\n\n def test_url_for_with_alternating_schemes(self, app, req_ctx):\n @app.route(\"/\")\n def index():\n return \"42\"\n\n assert flask.url_for(\"index\", _external=True) == \"http://localhost/\"\n assert (\n flask.url_for(\"index\", _external=True, _scheme=\"https\")\n == \"https://localhost/\"\n )\n assert flask.url_for(\"index\", _external=True) == \"http://localhost/\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor.test_url_with_method_TestUrlFor.test_url_with_method.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestUrlFor.test_url_with_method_TestUrlFor.test_url_with_method.None_2", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 139, "end_line": 158, "span_ids": ["TestUrlFor.test_url_with_method.MyView", "TestUrlFor.test_url_with_method", "TestUrlFor.test_url_with_method.MyView.get"], "tokens": 205}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestUrlFor:\n\n def test_url_with_method(self, app, req_ctx):\n from flask.views import MethodView\n\n class MyView(MethodView):\n def get(self, id=None):\n if id is None:\n return \"List\"\n return f\"Get {id:d}\"\n\n def post(self):\n return \"Create\"\n\n myview = MyView.as_view(\"myview\")\n app.add_url_rule(\"/myview/\", methods=[\"GET\"], view_func=myview)\n app.add_url_rule(\"/myview/\", methods=[\"GET\"], view_func=myview)\n app.add_url_rule(\"/myview/create\", methods=[\"POST\"], view_func=myview)\n\n assert flask.url_for(\"myview\", _method=\"GET\") == \"/myview/\"\n assert flask.url_for(\"myview\", id=42, _method=\"GET\") == \"/myview/42\"\n assert flask.url_for(\"myview\", _method=\"POST\") == \"/myview/create\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestNoImports_TestNoImports.test_name_with_import_error.try_.except_NotImplementedErro.AssertionError_Flask_imp": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestNoImports_TestNoImports.test_name_with_import_error.try_.except_NotImplementedErro.AssertionError_Flask_imp", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 161, "end_line": 177, "span_ids": ["TestNoImports", "TestNoImports.test_name_with_import_error"], "tokens": 168}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestNoImports:\n \"\"\"Test Flasks are created without import.\n\n Avoiding ``__import__`` helps create Flask instances where there are errors\n at import time. Those runtime errors will be apparent to the user soon\n enough, but tools which build Flask instances meta-programmatically benefit\n from a Flask which does not ``__import__``. Instead of importing to\n retrieve file paths or metadata on a module or package, use the pkgutil and\n imp modules in the Python standard library.\n \"\"\"\n\n def test_name_with_import_error(self, modules_tmpdir):\n modules_tmpdir.join(\"importerror.py\").write(\"raise NotImplementedError()\")\n try:\n flask.Flask(\"importerror\")\n except NotImplementedError:\n AssertionError(\"Flask(import_name) is importing import_name.\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming_TestStreaming.test_streaming_with_context_as_decorator.assert_rv_data_b_Hello": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming_TestStreaming.test_streaming_with_context_as_decorator.assert_rv_data_b_Hello", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 180, "end_line": 206, "span_ids": ["TestStreaming", "TestStreaming.test_streaming_with_context_as_decorator", "TestStreaming.test_streaming_with_context"], "tokens": 165}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestStreaming:\n def test_streaming_with_context(self, app, client):\n @app.route(\"/\")\n def index():\n def generate():\n yield \"Hello \"\n yield flask.request.args[\"name\"]\n yield \"!\"\n\n return flask.Response(flask.stream_with_context(generate()))\n\n rv = client.get(\"/?name=World\")\n assert rv.data == b\"Hello World!\"\n\n def test_streaming_with_context_as_decorator(self, app, client):\n @app.route(\"/\")\n def index():\n @flask.stream_with_context\n def generate(hello):\n yield hello\n yield flask.request.args[\"name\"]\n yield \"!\"\n\n return flask.Response(generate(\"Hello \"))\n\n rv = client.get(\"/?name=World\")\n assert rv.data == b\"Hello World!\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming.test_streaming_with_context_and_custom_close_TestStreaming.test_stream_keeps_session.assert_rv_data_b_flask": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestStreaming.test_streaming_with_context_and_custom_close_TestStreaming.test_stream_keeps_session.assert_rv_data_b_flask", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 208, "end_line": 251, "span_ids": ["TestStreaming.test_streaming_with_context_and_custom_close.Wrapper.__init__", "TestStreaming.test_streaming_with_context_and_custom_close", "TestStreaming.test_streaming_with_context_and_custom_close.Wrapper", "TestStreaming.test_stream_keeps_session"], "tokens": 233}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestStreaming:\n\n def test_streaming_with_context_and_custom_close(self, app, client):\n called = []\n\n class Wrapper:\n def __init__(self, gen):\n self._gen = gen\n\n def __iter__(self):\n return self\n\n def close(self):\n called.append(42)\n\n def __next__(self):\n return next(self._gen)\n\n next = __next__\n\n @app.route(\"/\")\n def index():\n def generate():\n yield \"Hello \"\n yield flask.request.args[\"name\"]\n yield \"!\"\n\n return flask.Response(flask.stream_with_context(Wrapper(generate())))\n\n rv = client.get(\"/?name=World\")\n assert rv.data == b\"Hello World!\"\n assert called == [42]\n\n def test_stream_keeps_session(self, app, client):\n @app.route(\"/\")\n def index():\n flask.session[\"test\"] = \"flask\"\n\n @flask.stream_with_context\n def gen():\n yield flask.session[\"test\"]\n\n return flask.Response(gen())\n\n rv = client.get(\"/\")\n assert rv.data == b\"flask\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_package_paths_test_uninstalled_package_paths.assert_app_instance_path_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_package_paths_test_uninstalled_package_paths.assert_app_instance_path_", "embedding": null, "metadata": {"file_path": "tests/test_instance_config.py", "file_name": "test_instance_config.py", "file_type": "text/x-python", "category": "test", "start_line": 31, "end_line": 44, "span_ids": ["test_uninstalled_package_paths"], "tokens": 114}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_uninstalled_package_paths(modules_tmpdir, purge_module):\n app = modules_tmpdir.mkdir(\"config_package_app\")\n init = app.join(\"__init__.py\")\n init.write(\n \"import os\\n\"\n \"import flask\\n\"\n \"here = os.path.abspath(os.path.dirname(__file__))\\n\"\n \"app = flask.Flask(__name__)\\n\"\n )\n purge_module(\"config_package_app\")\n\n from config_package_app import app\n\n assert app.instance_path == str(modules_tmpdir.join(\"instance\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_installed_module_paths_test_installed_package_paths.assert_app_instance_path_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_installed_module_paths_test_installed_package_paths.assert_app_instance_path_", "embedding": null, "metadata": {"file_path": "tests/test_instance_config.py", "file_name": "test_instance_config.py", "file_type": "text/x-python", "category": "test", "start_line": 62, "end_line": 90, "span_ids": ["test_installed_module_paths", "test_installed_package_paths"], "tokens": 209}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_installed_module_paths(\n modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages, limit_loader\n):\n site_packages.join(\"site_app.py\").write(\n \"import flask\\napp = flask.Flask(__name__)\\n\"\n )\n purge_module(\"site_app\")\n\n from site_app import app\n\n assert app.instance_path == modules_tmpdir.join(\"var\").join(\"site_app-instance\")\n\n\ndef test_installed_package_paths(\n limit_loader, modules_tmpdir, modules_tmpdir_prefix, purge_module, monkeypatch\n):\n installed_path = modules_tmpdir.mkdir(\"path\")\n monkeypatch.syspath_prepend(installed_path)\n\n app = installed_path.mkdir(\"installed_package\")\n init = app.join(\"__init__.py\")\n init.write(\"import flask\\napp = flask.Flask(__name__)\")\n purge_module(\"installed_package\")\n\n from installed_package import app\n\n assert app.instance_path == modules_tmpdir.join(\"var\").join(\n \"installed_package-instance\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_prefix_package_paths_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_prefix_package_paths_", "embedding": null, "metadata": {"file_path": "tests/test_instance_config.py", "file_name": "test_instance_config.py", "file_type": "text/x-python", "category": "test", "start_line": 93, "end_line": 122, "span_ids": ["test_prefix_package_paths", "test_egg_installed_paths"], "tokens": 224}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_prefix_package_paths(\n limit_loader, modules_tmpdir, modules_tmpdir_prefix, purge_module, site_packages\n):\n app = site_packages.mkdir(\"site_package\")\n init = app.join(\"__init__.py\")\n init.write(\"import flask\\napp = flask.Flask(__name__)\")\n purge_module(\"site_package\")\n\n import site_package\n\n assert site_package.app.instance_path == modules_tmpdir.join(\"var\").join(\n \"site_package-instance\"\n )\n\n\ndef test_egg_installed_paths(install_egg, modules_tmpdir, modules_tmpdir_prefix):\n modules_tmpdir.mkdir(\"site_egg\").join(\"__init__.py\").write(\n \"import flask\\n\\napp = flask.Flask(__name__)\"\n )\n install_egg(\"site_egg\")\n try:\n import site_egg\n\n assert site_egg.app.instance_path == str(\n modules_tmpdir.join(\"var/\").join(\"site_egg-instance\")\n )\n finally:\n if \"site_egg\" in sys.modules:\n del sys.modules[\"site_egg\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_datetime_test_bad_request_debug_message.assert_contains_debug": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_datetime_test_bad_request_debug_message.assert_contains_debug", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 27, "span_ids": ["imports", "test_bad_request_debug_message"], "tokens": 157}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import datetime\nimport decimal\nimport io\nimport uuid\n\nimport pytest\nfrom werkzeug.http import http_date\n\nimport flask\nfrom flask import json\nfrom flask.json.provider import DefaultJSONProvider\n\n\n@pytest.mark.parametrize(\"debug\", (True, False))\ndef test_bad_request_debug_message(app, client, debug):\n app.config[\"DEBUG\"] = debug\n app.config[\"TRAP_BAD_REQUEST_ERRORS\"] = False\n\n @app.route(\"/json\", methods=[\"POST\"])\n def post_json():\n flask.request.get_json()\n return None\n\n rv = client.post(\"/json\", data=None, content_type=\"application/json\")\n assert rv.status_code == 400\n contains = b\"Failed to decode JSON object\" in rv.data\n assert contains == debug", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_bad_requests_test_json_dump_to_file.assert_rv_test_data": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_bad_requests_test_json_dump_to_file.assert_rv_test_data", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 30, "end_line": 64, "span_ids": ["test_json_dump_to_file", "test_json_as_unicode", "test_json_bad_requests", "test_json_custom_mimetypes"], "tokens": 262}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_json_bad_requests(app, client):\n @app.route(\"/json\", methods=[\"POST\"])\n def return_json():\n return flask.jsonify(foo=str(flask.request.get_json()))\n\n rv = client.post(\"/json\", data=\"malformed\", content_type=\"application/json\")\n assert rv.status_code == 400\n\n\ndef test_json_custom_mimetypes(app, client):\n @app.route(\"/json\", methods=[\"POST\"])\n def return_json():\n return flask.request.get_json()\n\n rv = client.post(\"/json\", data='\"foo\"', content_type=\"application/x+json\")\n assert rv.data == b\"foo\"\n\n\n@pytest.mark.parametrize(\n \"test_value,expected\", [(True, '\"\\\\u2603\"'), (False, '\"\\u2603\"')]\n)\ndef test_json_as_unicode(test_value, expected, app, app_ctx):\n app.json.ensure_ascii = test_value\n rv = app.json.dumps(\"\\N{SNOWMAN}\")\n assert rv == expected\n\n\ndef test_json_dump_to_file(app, app_ctx):\n test_data = {\"name\": \"Flask\"}\n out = io.StringIO()\n\n flask.json.dump(test_data, out)\n out.seek(0)\n rv = flask.json.load(out)\n assert rv == test_data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_basic_types_test_jsonify_basic_types.assert_flask_json_loads_r": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_basic_types_test_jsonify_basic_types.assert_flask_json_loads_r", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 66, "end_line": 74, "span_ids": ["test_jsonify_basic_types"], "tokens": 110}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"test_value\", [0, -1, 1, 23, 3.14, \"s\", \"longer string\", True, False, None]\n)\ndef test_jsonify_basic_types(test_value, app, client):\n url = \"/jsonify_basic_types\"\n app.add_url_rule(url, url, lambda x=test_value: flask.jsonify(x))\n rv = client.get(url)\n assert rv.mimetype == \"application/json\"\n assert flask.json.loads(rv.data) == test_value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_dicts_test_jsonify_dicts.for_url_in_kw_dict_.assert_flask_json_loads_r": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_dicts_test_jsonify_dicts.for_url_in_kw_dict_.assert_flask_json_loads_r", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 77, "end_line": 101, "span_ids": ["test_jsonify_dicts"], "tokens": 163}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_jsonify_dicts(app, client):\n d = {\n \"a\": 0,\n \"b\": 23,\n \"c\": 3.14,\n \"d\": \"t\",\n \"e\": \"Hi\",\n \"f\": True,\n \"g\": False,\n \"h\": [\"test list\", 10, False],\n \"i\": {\"test\": \"dict\"},\n }\n\n @app.route(\"/kw\")\n def return_kwargs():\n return flask.jsonify(**d)\n\n @app.route(\"/dict\")\n def return_dict():\n return flask.jsonify(d)\n\n for url in \"/kw\", \"/dict\":\n rv = client.get(url)\n assert rv.mimetype == \"application/json\"\n assert flask.json.loads(rv.data) == d", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_arrays_test_jsonify_arrays.for_url_in_args_unpack_.assert_flask_json_loads_r": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_arrays_test_jsonify_arrays.for_url_in_args_unpack_.assert_flask_json_loads_r", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 104, "end_line": 129, "span_ids": ["test_jsonify_arrays"], "tokens": 154}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_jsonify_arrays(app, client):\n \"\"\"Test jsonify of lists and args unpacking.\"\"\"\n a_list = [\n 0,\n 42,\n 3.14,\n \"t\",\n \"hello\",\n True,\n False,\n [\"test list\", 2, False],\n {\"test\": \"dict\"},\n ]\n\n @app.route(\"/args_unpack\")\n def return_args_unpack():\n return flask.jsonify(*a_list)\n\n @app.route(\"/array\")\n def return_array():\n return flask.jsonify(a_list)\n\n for url in \"/args_unpack\", \"/array\":\n rv = client.get(url)\n assert rv.mimetype == \"application/json\"\n assert flask.json.loads(rv.data) == a_list", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_datetime_FixedOffset.dst.return.datetime_timedelta_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_datetime_FixedOffset.dst.return.datetime_timedelta_", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 132, "end_line": 162, "span_ids": ["FixedOffset.dst", "FixedOffset.tzname", "test_jsonify_datetime", "FixedOffset.utcoffset", "FixedOffset"], "tokens": 210}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"value\", [datetime.datetime(1973, 3, 11, 6, 30, 45), datetime.date(1975, 1, 5)]\n)\ndef test_jsonify_datetime(app, client, value):\n @app.route(\"/\")\n def index():\n return flask.jsonify(value=value)\n\n r = client.get()\n assert r.json[\"value\"] == http_date(value)\n\n\nclass FixedOffset(datetime.tzinfo):\n \"\"\"Fixed offset in hours east from UTC.\n\n This is a slight adaptation of the ``FixedOffset`` example found in\n https://docs.python.org/2.7/library/datetime.html.\n \"\"\"\n\n def __init__(self, hours, name):\n self.__offset = datetime.timedelta(hours=hours)\n self.__name = name\n\n def utcoffset(self, dt):\n return self.__offset\n\n def tzname(self, dt):\n return self.__name\n\n def dst(self, dt):\n return datetime.timedelta()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_tojson_filter_test_tojson_filter.assert_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_tojson_filter_test_tojson_filter.assert_rv_", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 204, "end_line": 214, "span_ids": ["test_tojson_filter"], "tokens": 135}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_tojson_filter(app, req_ctx):\n # The tojson filter is tested in Jinja, this confirms that it's\n # using Flask's dumps.\n rv = flask.render_template_string(\n \"const data = {{ data|tojson }};\",\n data={\"name\": \"\", \"time\": datetime.datetime(2021, 2, 1, 7, 15)},\n )\n assert rv == (\n 'const data = {\"name\": \"\\\\u003c/script\\\\u003e\",'\n ' \"time\": \"Mon, 01 Feb 2021 07:15:00 GMT\"};'\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_customization_test_json_customization.assert_rv_data_b_42_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_customization_test_json_customization.assert_rv_data_b_42_", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 223, "end_line": 257, "span_ids": ["test_json_customization.CustomProvider", "test_json_customization.X", "test_json_customization", "test_json_customization.X:2", "test_json_customization.CustomProvider.object_hook"], "tokens": 230}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_json_customization(app, client):\n class X: # noqa: B903, for Python2 compatibility\n def __init__(self, val):\n self.val = val\n\n def default(o):\n if isinstance(o, X):\n return f\"<{o.val}>\"\n\n return DefaultJSONProvider.default(o)\n\n class CustomProvider(DefaultJSONProvider):\n def object_hook(self, obj):\n if len(obj) == 1 and \"_foo\" in obj:\n return X(obj[\"_foo\"])\n\n return obj\n\n def loads(self, s, **kwargs):\n kwargs.setdefault(\"object_hook\", self.object_hook)\n return super().loads(s, **kwargs)\n\n app.json = CustomProvider(app)\n app.json.default = default\n\n @app.route(\"/\", methods=[\"POST\"])\n def index():\n return flask.json.dumps(flask.request.get_json()[\"x\"])\n\n rv = client.post(\n \"/\",\n data=flask.json.dumps({\"x\": {\"_foo\": 42}}),\n content_type=\"application/json\",\n )\n assert rv.data == b'\"<42>\"'", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py__has_encoding_test_modified_url_encoding.assert_rv_get_data_as_tex": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py__has_encoding_test_modified_url_encoding.assert_rv_get_data_as_tex", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 296, "end_line": 322, "span_ids": ["test_modified_url_encoding.ModifiedRequest:2", "test_modified_url_encoding", "test_modified_url_encoding.ModifiedRequest", "_has_encoding"], "tokens": 174}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _has_encoding(name):\n try:\n import codecs\n\n codecs.lookup(name)\n return True\n except LookupError:\n return False\n\n\n@pytest.mark.skipif(\n not _has_encoding(\"euc-kr\"), reason=\"The euc-kr encoding is required.\"\n)\ndef test_modified_url_encoding(app, client):\n class ModifiedRequest(flask.Request):\n url_charset = \"euc-kr\"\n\n app.request_class = ModifiedRequest\n app.url_map.charset = \"euc-kr\"\n\n @app.route(\"/\")\n def index():\n return flask.request.args[\"foo\"]\n\n rv = client.get(\"/\", query_string={\"foo\": \"\uc815\uc0c1\ucc98\ub9ac\"}, charset=\"euc-kr\")\n assert rv.status_code == 200\n assert rv.get_data(as_text=True) == \"\uc815\uc0c1\ucc98\ub9ac\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_key_sorting_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_key_sorting_", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 289, "end_line": 366, "span_ids": ["test_json_key_sorting", "test_html_method", "test_html_method.ObjectWithHTML", "test_html_method.ObjectWithHTML.__html__"], "tokens": 519}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_json_key_sorting(app, client):\n app.debug = True\n assert app.json.sort_keys\n d = dict.fromkeys(range(20), \"foo\")\n\n @app.route(\"/\")\n def index():\n return flask.jsonify(values=d)\n\n rv = client.get(\"/\")\n lines = [x.strip() for x in rv.data.strip().decode(\"utf-8\").splitlines()]\n sorted_by_str = [\n \"{\",\n '\"values\": {',\n '\"0\": \"foo\",',\n '\"1\": \"foo\",',\n '\"10\": \"foo\",',\n '\"11\": \"foo\",',\n '\"12\": \"foo\",',\n '\"13\": \"foo\",',\n '\"14\": \"foo\",',\n '\"15\": \"foo\",',\n '\"16\": \"foo\",',\n '\"17\": \"foo\",',\n '\"18\": \"foo\",',\n '\"19\": \"foo\",',\n '\"2\": \"foo\",',\n '\"3\": \"foo\",',\n '\"4\": \"foo\",',\n '\"5\": \"foo\",',\n '\"6\": \"foo\",',\n '\"7\": \"foo\",',\n '\"8\": \"foo\",',\n '\"9\": \"foo\"',\n \"}\",\n \"}\",\n ]\n sorted_by_int = [\n \"{\",\n '\"values\": {',\n '\"0\": \"foo\",',\n '\"1\": \"foo\",',\n '\"2\": \"foo\",',\n '\"3\": \"foo\",',\n '\"4\": \"foo\",',\n '\"5\": \"foo\",',\n '\"6\": \"foo\",',\n '\"7\": \"foo\",',\n '\"8\": \"foo\",',\n '\"9\": \"foo\",',\n '\"10\": \"foo\",',\n '\"11\": \"foo\",',\n '\"12\": \"foo\",',\n '\"13\": \"foo\",',\n '\"14\": \"foo\",',\n '\"15\": \"foo\",',\n '\"16\": \"foo\",',\n '\"17\": \"foo\",',\n '\"18\": \"foo\",',\n '\"19\": \"foo\"',\n \"}\",\n \"}\",\n ]\n\n try:\n assert lines == sorted_by_int\n except AssertionError:\n assert lines == sorted_by_str\n\n\ndef test_html_method():\n class ObjectWithHTML:\n def __html__(self):\n return \"

test

\"\n\n result = json.dumps(ObjectWithHTML())\n assert result == '\"

test

\"'", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_from_datetime_import_date_test_dump_load_unchanged.assert_s_loads_s_dumps_da": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_from_datetime_import_date_test_dump_load_unchanged.assert_s_loads_s_dumps_da", "embedding": null, "metadata": {"file_path": "tests/test_json_tag.py", "file_name": "test_json_tag.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 29, "span_ids": ["test_dump_load_unchanged", "imports"], "tokens": 182}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from datetime import datetime\nfrom datetime import timezone\nfrom uuid import uuid4\n\nimport pytest\nfrom markupsafe import Markup\n\nfrom flask.json.tag import JSONTag\nfrom flask.json.tag import TaggedJSONSerializer\n\n\n@pytest.mark.parametrize(\n \"data\",\n (\n {\" t\": (1, 2, 3)},\n {\" t__\": b\"a\"},\n {\" di\": \" di\"},\n {\"x\": (1, 2, 3), \"y\": 4},\n (1, 2, 3),\n [(1, 2, 3)],\n b\"\\xff\",\n Markup(\"\"),\n uuid4(),\n datetime.now(tz=timezone.utc).replace(microsecond=0),\n ),\n)\ndef test_dump_load_unchanged(data):\n s = TaggedJSONSerializer()\n assert s.loads(s.dumps(data)) == data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_duplicate_tag_test_custom_tag.assert_s_loads_s_dumps_Fo": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_duplicate_tag_test_custom_tag.assert_s_loads_s_dumps_Fo", "embedding": null, "metadata": {"file_path": "tests/test_json_tag.py", "file_name": "test_json_tag.py", "file_type": "text/x-python", "category": "test", "start_line": 32, "end_line": 63, "span_ids": ["test_custom_tag.TagFoo:2", "test_custom_tag.Foo", "test_custom_tag", "test_duplicate_tag", "test_custom_tag.Foo:2", "test_duplicate_tag.TagDict", "test_duplicate_tag.TagDict:2", "test_custom_tag.TagFoo"], "tokens": 202}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_duplicate_tag():\n class TagDict(JSONTag):\n key = \" d\"\n\n s = TaggedJSONSerializer()\n pytest.raises(KeyError, s.register, TagDict)\n s.register(TagDict, force=True, index=0)\n assert isinstance(s.tags[\" d\"], TagDict)\n assert isinstance(s.order[0], TagDict)\n\n\ndef test_custom_tag():\n class Foo: # noqa: B903, for Python2 compatibility\n def __init__(self, data):\n self.data = data\n\n class TagFoo(JSONTag):\n __slots__ = ()\n key = \" f\"\n\n def check(self, value):\n return isinstance(value, Foo)\n\n def to_json(self, value):\n return self.serializer.tag(value.data)\n\n def to_python(self, value):\n return Foo(value)\n\n s = TaggedJSONSerializer()\n s.register(TagFoo)\n assert s.loads(s.dumps(Foo(\"bar\"))).data == \"bar\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_tag_interface_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json_tag.py_test_tag_interface_", "embedding": null, "metadata": {"file_path": "tests/test_json_tag.py", "file_name": "test_json_tag.py", "file_type": "text/x-python", "category": "test", "start_line": 66, "end_line": 87, "span_ids": ["test_tag_interface", "test_tag_order.Tag2", "test_tag_order", "test_tag_order.Tag1", "test_tag_order.Tag2:2", "test_tag_order.Tag1:2"], "tokens": 135}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_tag_interface():\n t = JSONTag(None)\n pytest.raises(NotImplementedError, t.check, None)\n pytest.raises(NotImplementedError, t.to_json, None)\n pytest.raises(NotImplementedError, t.to_python, None)\n\n\ndef test_tag_order():\n class Tag1(JSONTag):\n key = \" 1\"\n\n class Tag2(JSONTag):\n key = \" 2\"\n\n s = TaggedJSONSerializer()\n\n s.register(Tag1, index=-1)\n assert isinstance(s.order[-2], Tag1)\n\n s.register(Tag2, index=None)\n assert isinstance(s.order[-1], Tag2)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_logging_reset_logging.if_logging_plugin_.pytestconfig_pluginmanage": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_logging_reset_logging.if_logging_plugin_.pytestconfig_pluginmanage", "embedding": null, "metadata": {"file_path": "tests/test_logging.py", "file_name": "test_logging.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 33, "span_ids": ["imports", "reset_logging"], "tokens": 159}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import logging\nimport sys\nfrom io import StringIO\n\nimport pytest\n\nfrom flask.logging import default_handler\nfrom flask.logging import has_level_handler\nfrom flask.logging import wsgi_errors_stream\n\n\n@pytest.fixture(autouse=True)\ndef reset_logging(pytestconfig):\n root_handlers = logging.root.handlers[:]\n logging.root.handlers = []\n root_level = logging.root.level\n\n logger = logging.getLogger(\"flask_test\")\n logger.handlers = []\n logger.setLevel(logging.NOTSET)\n\n logging_plugin = pytestconfig.pluginmanager.unregister(name=\"logging-plugin\")\n\n yield\n\n logging.root.handlers[:] = root_handlers\n logging.root.setLevel(root_level)\n\n logger.handlers = []\n logger.setLevel(logging.NOTSET)\n\n if logging_plugin:\n pytestconfig.pluginmanager.register(logging_plugin, \"logging-plugin\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_test_logger_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_logging.py_test_logger_", "embedding": null, "metadata": {"file_path": "tests/test_logging.py", "file_name": "test_logging.py", "file_type": "text/x-python", "category": "test", "start_line": 36, "end_line": 99, "span_ids": ["test_has_level_handler", "test_logger_debug", "test_log_view_exception", "test_logger", "test_wsgi_errors_stream", "test_existing_handler"], "tokens": 362}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_logger(app):\n assert app.logger.name == \"flask_test\"\n assert app.logger.level == logging.NOTSET\n assert app.logger.handlers == [default_handler]\n\n\ndef test_logger_debug(app):\n app.debug = True\n assert app.logger.level == logging.DEBUG\n assert app.logger.handlers == [default_handler]\n\n\ndef test_existing_handler(app):\n logging.root.addHandler(logging.StreamHandler())\n assert app.logger.level == logging.NOTSET\n assert not app.logger.handlers\n\n\ndef test_wsgi_errors_stream(app, client):\n @app.route(\"/\")\n def index():\n app.logger.error(\"test\")\n return \"\"\n\n stream = StringIO()\n client.get(\"/\", errors_stream=stream)\n assert \"ERROR in test_logging: test\" in stream.getvalue()\n\n assert wsgi_errors_stream._get_current_object() is sys.stderr\n\n with app.test_request_context(errors_stream=stream):\n assert wsgi_errors_stream._get_current_object() is stream\n\n\ndef test_has_level_handler():\n logger = logging.getLogger(\"flask.app\")\n assert not has_level_handler(logger)\n\n handler = logging.StreamHandler()\n logging.root.addHandler(handler)\n assert has_level_handler(logger)\n\n logger.propagate = False\n assert not has_level_handler(logger)\n logger.propagate = True\n\n handler.setLevel(logging.ERROR)\n assert not has_level_handler(logger)\n\n\ndef test_log_view_exception(app, client):\n @app.route(\"/\")\n def index():\n raise Exception(\"test\")\n\n app.testing = False\n stream = StringIO()\n rv = client.get(\"/\", errors_stream=stream)\n assert rv.status_code == 500\n assert rv.data\n err = stream.getvalue()\n assert \"Exception on / [GET]\" in err\n assert \"Exception: test\" in err", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_regression.py_flask_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_regression.py_flask_", "embedding": null, "metadata": {"file_path": "tests/test_regression.py", "file_name": "test_regression.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 31, "span_ids": ["test_aborting", "test_aborting.Foo:2", "test_aborting.Foo", "imports"], "tokens": 168}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import flask\n\n\ndef test_aborting(app):\n class Foo(Exception):\n whatever = 42\n\n @app.errorhandler(Foo)\n def handle_foo(e):\n return str(e.whatever)\n\n @app.route(\"/\")\n def index():\n raise flask.abort(flask.redirect(flask.url_for(\"test\")))\n\n @app.route(\"/test\")\n def test():\n raise Foo()\n\n with app.test_client() as c:\n rv = c.get(\"/\")\n location_parts = rv.headers[\"Location\"].rpartition(\"/\")\n\n if location_parts[0]:\n # For older Werkzeug that used absolute redirects.\n assert location_parts[0] == \"http://localhost\"\n\n assert location_parts[2] == \"test\"\n rv = c.get(\"/test\")\n assert rv.data == b\"42\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_proper_test_request_context_test_proper_test_request_context.None_4.pass": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_proper_test_request_context_test_proper_test_request_context.None_4.pass", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 63, "end_line": 104, "span_ids": ["test_proper_test_request_context"], "tokens": 265}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_proper_test_request_context(app):\n app.config.update(SERVER_NAME=\"localhost.localdomain:5000\")\n\n @app.route(\"/\")\n def index():\n return None\n\n @app.route(\"/\", subdomain=\"foo\")\n def sub():\n return None\n\n with app.test_request_context(\"/\"):\n assert (\n flask.url_for(\"index\", _external=True)\n == \"http://localhost.localdomain:5000/\"\n )\n\n with app.test_request_context(\"/\"):\n assert (\n flask.url_for(\"sub\", _external=True)\n == \"http://foo.localhost.localdomain:5000/\"\n )\n\n # suppress Werkzeug 0.15 warning about name mismatch\n with warnings.catch_warnings():\n warnings.filterwarnings(\n \"ignore\", \"Current server name\", UserWarning, \"flask.app\"\n )\n with app.test_request_context(\n \"/\", environ_overrides={\"HTTP_HOST\": \"localhost\"}\n ):\n pass\n\n app.config.update(SERVER_NAME=\"localhost\")\n with app.test_request_context(\"/\", environ_overrides={\"SERVER_NAME\": \"localhost\"}):\n pass\n\n app.config.update(SERVER_NAME=\"localhost:80\")\n with app.test_request_context(\n \"/\", environ_overrides={\"SERVER_NAME\": \"localhost:80\"}\n ):\n pass", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_context_binding_test_manual_context_binding.with_pytest_raises_Runtim.index_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_context_binding_test_manual_context_binding.with_pytest_raises_Runtim.index_", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 107, "end_line": 145, "span_ids": ["test_context_binding", "test_manual_context_binding", "test_context_test"], "tokens": 222}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_context_binding(app):\n @app.route(\"/\")\n def index():\n return f\"Hello {flask.request.args['name']}!\"\n\n @app.route(\"/meh\")\n def meh():\n return flask.request.url\n\n with app.test_request_context(\"/?name=World\"):\n assert index() == \"Hello World!\"\n with app.test_request_context(\"/meh\"):\n assert meh() == \"http://localhost/meh\"\n assert not flask.request\n\n\ndef test_context_test(app):\n assert not flask.request\n assert not flask.has_request_context()\n ctx = app.test_request_context()\n ctx.push()\n try:\n assert flask.request\n assert flask.has_request_context()\n finally:\n ctx.pop()\n\n\ndef test_manual_context_binding(app):\n @app.route(\"/\")\n def index():\n return f\"Hello {flask.request.args['name']}!\"\n\n ctx = app.test_request_context(\"/?name=World\")\n ctx.push()\n assert index() == \"Hello World!\"\n ctx.pop()\n with pytest.raises(RuntimeError):\n index()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying_TestGreenletContextCopying.test_greenlet_context_copying.assert_result_42": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying_TestGreenletContextCopying.test_greenlet_context_copying.assert_result_42", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 148, "end_line": 177, "span_ids": ["TestGreenletContextCopying", "TestGreenletContextCopying.test_greenlet_context_copying"], "tokens": 201}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.skipif(greenlet is None, reason=\"greenlet not installed\")\nclass TestGreenletContextCopying:\n def test_greenlet_context_copying(self, app, client):\n greenlets = []\n\n @app.route(\"/\")\n def index():\n flask.session[\"fizz\"] = \"buzz\"\n reqctx = request_ctx.copy()\n\n def g():\n assert not flask.request\n assert not flask.current_app\n with reqctx:\n assert flask.request\n assert flask.current_app == app\n assert flask.request.path == \"/\"\n assert flask.request.args[\"foo\"] == \"bar\"\n assert flask.session.get(\"fizz\") == \"buzz\"\n assert not flask.request\n return 42\n\n greenlets.append(greenlet(g))\n return \"Hello World!\"\n\n rv = client.get(\"/?foo=bar\")\n assert rv.data == b\"Hello World!\"\n\n result = greenlets[0].run()\n assert result == 42", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying.test_greenlet_context_copying_api_test_session_error_pops_context.assert_not_flask_current_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_TestGreenletContextCopying.test_greenlet_context_copying_api_test_session_error_pops_context.assert_not_flask_current_", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 173, "end_line": 220, "span_ids": ["test_session_error_pops_context.FailingSessionInterface", "test_session_error_pops_context.FailingSessionInterface.open_session", "test_session_error_pops_context.CustomFlask:2", "TestGreenletContextCopying.test_greenlet_context_copying_api", "test_session_error_pops_context.SessionError:2", "test_session_error_pops_context", "test_session_error_pops_context.CustomFlask", "test_session_error_pops_context.SessionError"], "tokens": 298}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.skipif(greenlet is None, reason=\"greenlet not installed\")\nclass TestGreenletContextCopying:\n\n def test_greenlet_context_copying_api(self, app, client):\n greenlets = []\n\n @app.route(\"/\")\n def index():\n flask.session[\"fizz\"] = \"buzz\"\n\n @flask.copy_current_request_context\n def g():\n assert flask.request\n assert flask.current_app == app\n assert flask.request.path == \"/\"\n assert flask.request.args[\"foo\"] == \"bar\"\n assert flask.session.get(\"fizz\") == \"buzz\"\n return 42\n\n greenlets.append(greenlet(g))\n return \"Hello World!\"\n\n rv = client.get(\"/?foo=bar\")\n assert rv.data == b\"Hello World!\"\n\n result = greenlets[0].run()\n assert result == 42\n\n\ndef test_session_error_pops_context():\n class SessionError(Exception):\n pass\n\n class FailingSessionInterface(SessionInterface):\n def open_session(self, app, request):\n raise SessionError()\n\n class CustomFlask(flask.Flask):\n session_interface = FailingSessionInterface()\n\n app = CustomFlask(__name__)\n\n @app.route(\"/\")\n def index():\n # shouldn't get here\n AssertionError()\n\n response = app.test_client().get(\"/\")\n assert response.status_code == 500\n assert not flask.request\n assert not flask.current_app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_session_dynamic_cookie_name_test_session_dynamic_cookie_name.None_3": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_session_dynamic_cookie_name_test_session_dynamic_cookie_name.None_3", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 229, "end_line": 277, "span_ids": ["test_session_dynamic_cookie_name", "test_session_dynamic_cookie_name.CustomFlask:2", "test_session_dynamic_cookie_name.PathAwareSessionInterface.get_cookie_name", "test_session_dynamic_cookie_name.PathAwareSessionInterface", "test_session_dynamic_cookie_name.CustomFlask"], "tokens": 391}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_dynamic_cookie_name():\n # This session interface will use a cookie with a different name if the\n # requested url ends with the string \"dynamic_cookie\"\n class PathAwareSessionInterface(SecureCookieSessionInterface):\n def get_cookie_name(self, app):\n if flask.request.url.endswith(\"dynamic_cookie\"):\n return \"dynamic_cookie_name\"\n else:\n return super().get_cookie_name(app)\n\n class CustomFlask(flask.Flask):\n session_interface = PathAwareSessionInterface()\n\n app = CustomFlask(__name__)\n app.secret_key = \"secret_key\"\n\n @app.route(\"/set\", methods=[\"POST\"])\n def set():\n flask.session[\"value\"] = flask.request.form[\"value\"]\n return \"value set\"\n\n @app.route(\"/get\")\n def get():\n v = flask.session.get(\"value\", \"None\")\n return v\n\n @app.route(\"/set_dynamic_cookie\", methods=[\"POST\"])\n def set_dynamic_cookie():\n flask.session[\"value\"] = flask.request.form[\"value\"]\n return \"value set\"\n\n @app.route(\"/get_dynamic_cookie\")\n def get_dynamic_cookie():\n v = flask.session.get(\"value\", \"None\")\n return v\n\n test_client = app.test_client()\n\n # first set the cookie in both /set urls but each with a different value\n assert test_client.post(\"/set\", data={\"value\": \"42\"}).data == b\"value set\"\n assert (\n test_client.post(\"/set_dynamic_cookie\", data={\"value\": \"616\"}).data\n == b\"value set\"\n )\n\n # now check that the relevant values come back - meaning that different\n # cookies are being used for the urls that end with \"dynamic cookie\"\n assert test_client.get(\"/get\").data == b\"42\"\n assert test_client.get(\"/get_dynamic_cookie\").data == b\"616\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_bad_environ_raises_bad_request_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_test_bad_environ_raises_bad_request_", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 275, "end_line": 321, "span_ids": ["test_environ_for_valid_idna_completes", "test_bad_environ_raises_bad_request", "test_normal_environ_completes"], "tokens": 278}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_bad_environ_raises_bad_request():\n app = flask.Flask(__name__)\n\n from flask.testing import EnvironBuilder\n\n builder = EnvironBuilder(app)\n environ = builder.get_environ()\n\n # use a non-printable character in the Host - this is key to this test\n environ[\"HTTP_HOST\"] = \"\\x8a\"\n\n with app.request_context(environ):\n response = app.full_dispatch_request()\n assert response.status_code == 400\n\n\ndef test_environ_for_valid_idna_completes():\n app = flask.Flask(__name__)\n\n @app.route(\"/\")\n def index():\n return \"Hello World!\"\n\n from flask.testing import EnvironBuilder\n\n builder = EnvironBuilder(app)\n environ = builder.get_environ()\n\n # these characters are all IDNA-compatible\n environ[\"HTTP_HOST\"] = \"\u0105\u015b\u017a\u00e4\u00fc\u0436\u0160\u00df\u044f.com\"\n\n with app.request_context(environ):\n response = app.full_dispatch_request()\n\n assert response.status_code == 200\n\n\ndef test_normal_environ_completes():\n app = flask.Flask(__name__)\n\n @app.route(\"/\")\n def index():\n return \"Hello World!\"\n\n response = app.test_client().get(\"/\", headers={\"host\": \"xn--on-0ia.com\"})\n assert response.status_code == 200", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_session_interface.py_flask_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_session_interface.py_flask_", "embedding": null, "metadata": {"file_path": "tests/test_session_interface.py", "file_name": "test_session_interface.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 29, "span_ids": ["test_open_session_with_endpoint.MySessionInterface", "imports", "test_open_session_with_endpoint", "test_open_session_with_endpoint.MySessionInterface.save_session"], "tokens": 157}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import flask\nfrom flask.globals import request_ctx\nfrom flask.sessions import SessionInterface\n\n\ndef test_open_session_with_endpoint():\n \"\"\"If request.endpoint (or other URL matching behavior) is needed\n while loading the session, RequestContext.match_request() can be\n called manually.\n \"\"\"\n\n class MySessionInterface(SessionInterface):\n def save_session(self, app, session, response):\n pass\n\n def open_session(self, app, request):\n request_ctx.match_request()\n assert request.endpoint is not None\n\n app = flask.Flask(__name__)\n app.session_interface = MySessionInterface()\n\n @app.get(\"/\")\n def index():\n return \"Hello, World!\"\n\n response = app.test_client().get(\"/\")\n assert response.status_code == 200", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_pytest_test_template_rendered.try_.finally_.flask_template_rendered_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_pytest_test_template_rendered.try_.finally_.flask_template_rendered_d", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 33, "span_ids": ["impl", "test_template_rendered", "impl:2", "imports", "imports:2", "imports:3", "impl:5"], "tokens": 169}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\n\ntry:\n import blinker\nexcept ImportError:\n blinker = None\n\nimport flask\n\npytestmark = pytest.mark.skipif(\n blinker is None, reason=\"Signals require the blinker library.\"\n)\n\n\ndef test_template_rendered(app, client):\n @app.route(\"/\")\n def index():\n return flask.render_template(\"simple_template.html\", whiskey=42)\n\n recorded = []\n\n def record(sender, template, context):\n recorded.append((template, context))\n\n flask.template_rendered.connect(record, app)\n try:\n client.get(\"/\")\n assert len(recorded) == 1\n template, context = recorded[0]\n assert template.name == \"simple_template.html\"\n assert context[\"whiskey\"] == 42\n finally:\n flask.template_rendered.disconnect(record, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_before_render_template_test_before_render_template.try_.finally_.flask_before_render_templ": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_before_render_template_test_before_render_template.try_.finally_.flask_before_render_templ", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 36, "end_line": 58, "span_ids": ["test_before_render_template"], "tokens": 159}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_before_render_template():\n app = flask.Flask(__name__)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"simple_template.html\", whiskey=42)\n\n recorded = []\n\n def record(sender, template, context):\n context[\"whiskey\"] = 43\n recorded.append((template, context))\n\n flask.before_render_template.connect(record, app)\n try:\n rv = app.test_client().get(\"/\")\n assert len(recorded) == 1\n template, context = recorded[0]\n assert template.name == \"simple_template.html\"\n assert context[\"whiskey\"] == 43\n assert rv.data == b\"

43

\"\n finally:\n flask.before_render_template.disconnect(record, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_signals_test_request_signals.try_.finally_.flask_request_finished_di": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_signals_test_request_signals.try_.finally_.flask_request_finished_di", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 61, "end_line": 103, "span_ids": ["test_request_signals"], "tokens": 231}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_signals():\n app = flask.Flask(__name__)\n calls = []\n\n def before_request_signal(sender):\n calls.append(\"before-signal\")\n\n def after_request_signal(sender, response):\n assert response.data == b\"stuff\"\n calls.append(\"after-signal\")\n\n @app.before_request\n def before_request_handler():\n calls.append(\"before-handler\")\n\n @app.after_request\n def after_request_handler(response):\n calls.append(\"after-handler\")\n response.data = \"stuff\"\n return response\n\n @app.route(\"/\")\n def index():\n calls.append(\"handler\")\n return \"ignored anyway\"\n\n flask.request_started.connect(before_request_signal, app)\n flask.request_finished.connect(after_request_signal, app)\n\n try:\n rv = app.test_client().get(\"/\")\n assert rv.data == b\"stuff\"\n\n assert calls == [\n \"before-signal\",\n \"before-handler\",\n \"handler\",\n \"after-handler\",\n \"after-signal\",\n ]\n finally:\n flask.request_started.disconnect(before_request_signal, app)\n flask.request_finished.disconnect(after_request_signal, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_exception_signal_test_appcontext_signals.try_.finally_.flask_appcontext_popped_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_request_exception_signal_test_appcontext_signals.try_.finally_.flask_appcontext_popped_d", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 106, "end_line": 147, "span_ids": ["test_appcontext_signals", "test_request_exception_signal"], "tokens": 248}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_exception_signal():\n app = flask.Flask(__name__)\n recorded = []\n\n @app.route(\"/\")\n def index():\n 1 // 0\n\n def record(sender, exception):\n recorded.append(exception)\n\n flask.got_request_exception.connect(record, app)\n try:\n assert app.test_client().get(\"/\").status_code == 500\n assert len(recorded) == 1\n assert isinstance(recorded[0], ZeroDivisionError)\n finally:\n flask.got_request_exception.disconnect(record, app)\n\n\ndef test_appcontext_signals(app, client):\n recorded = []\n\n def record_push(sender, **kwargs):\n recorded.append(\"push\")\n\n def record_pop(sender, **kwargs):\n recorded.append(\"pop\")\n\n @app.route(\"/\")\n def index():\n return \"Hello\"\n\n flask.appcontext_pushed.connect(record_push, app)\n flask.appcontext_popped.connect(record_pop, app)\n try:\n rv = client.get(\"/\")\n assert rv.data == b\"Hello\"\n assert recorded == [\"push\", \"pop\"]\n finally:\n flask.appcontext_pushed.disconnect(record_push, app)\n flask.appcontext_popped.disconnect(record_pop, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_flash_signal_test_flash_signal.try_.finally_.flask_message_flashed_dis": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_flash_signal_test_flash_signal.try_.finally_.flask_message_flashed_dis", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 153, "end_line": 174, "span_ids": ["test_flash_signal"], "tokens": 137}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_flash_signal(app):\n @app.route(\"/\")\n def index():\n flask.flash(\"This is a flash message\", category=\"notice\")\n return flask.redirect(\"/other\")\n\n recorded = []\n\n def record(sender, message, category):\n recorded.append((message, category))\n\n flask.message_flashed.connect(record, app)\n try:\n client = app.test_client()\n with client.session_transaction():\n client.get(\"/\")\n assert len(recorded) == 1\n message, category = recorded[0]\n assert message == \"This is a flash message\"\n assert category == \"notice\"\n finally:\n flask.message_flashed.disconnect(record, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_appcontext_tearing_down_signal_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_signals.py_test_appcontext_tearing_down_signal_", "embedding": null, "metadata": {"file_path": "tests/test_signals.py", "file_name": "test_signals.py", "file_type": "text/x-python", "category": "test", "start_line": 174, "end_line": 193, "span_ids": ["test_appcontext_tearing_down_signal"], "tokens": 123}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_appcontext_tearing_down_signal(app, client):\n app.testing = False\n recorded = []\n\n def record_teardown(sender, exc):\n recorded.append(exc)\n\n @app.route(\"/\")\n def index():\n 1 // 0\n\n flask.appcontext_tearing_down.connect(record_teardown, app)\n try:\n rv = client.get(\"/\")\n assert rv.status_code == 500\n assert len(recorded) == 1\n assert isinstance(recorded[0], ZeroDivisionError)\n finally:\n flask.appcontext_tearing_down.disconnect(record_teardown, app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_subclassing.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_subclassing.py__", "embedding": null, "metadata": {"file_path": "tests/test_subclassing.py", "file_name": "test_subclassing.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 22, "span_ids": ["test_suppressed_exception_logging.SuppressedFlask", "test_suppressed_exception_logging", "test_suppressed_exception_logging.SuppressedFlask.log_exception", "imports"], "tokens": 108}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from io import StringIO\n\nimport flask\n\n\ndef test_suppressed_exception_logging():\n class SuppressedFlask(flask.Flask):\n def log_exception(self, exc_info):\n pass\n\n out = StringIO()\n app = SuppressedFlask(__name__)\n\n @app.route(\"/\")\n def index():\n raise Exception(\"test\")\n\n rv = app.test_client().get(\"/\", errors_stream=out)\n assert rv.status_code == 500\n assert b\"Internal Server Error\" in rv.data\n assert not out.getvalue()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_logging_test_standard_context.assert_rv_data_split_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_logging_test_standard_context.assert_rv_data_split_", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 68, "span_ids": ["test_request_less_rendering", "test_context_processing", "test_original_win", "imports", "test_simple_stream", "test_standard_context"], "tokens": 371}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import logging\n\nimport pytest\nimport werkzeug.serving\nfrom jinja2 import TemplateNotFound\nfrom markupsafe import Markup\n\nimport flask\n\n\ndef test_context_processing(app, client):\n @app.context_processor\n def context_processor():\n return {\"injected_value\": 42}\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"context_template.html\", value=23)\n\n rv = client.get(\"/\")\n assert rv.data == b\"

23|42\"\n\n\ndef test_original_win(app, client):\n @app.route(\"/\")\n def index():\n return flask.render_template_string(\"{{ config }}\", config=42)\n\n rv = client.get(\"/\")\n assert rv.data == b\"42\"\n\n\ndef test_simple_stream(app, client):\n @app.route(\"/\")\n def index():\n return flask.stream_template_string(\"{{ config }}\", config=42)\n\n rv = client.get(\"/\")\n assert rv.data == b\"42\"\n\n\ndef test_request_less_rendering(app, app_ctx):\n app.config[\"WORLD_NAME\"] = \"Special World\"\n\n @app.context_processor\n def context_processor():\n return dict(foo=42)\n\n rv = flask.render_template_string(\"Hello {{ config.WORLD_NAME }} {{ foo }}\")\n assert rv == \"Hello Special World 42\"\n\n\ndef test_standard_context(app, client):\n @app.route(\"/\")\n def index():\n flask.g.foo = 23\n flask.session[\"test\"] = \"aha\"\n return flask.render_template_string(\n \"\"\"\n {{ request.args.foo }}\n {{ g.foo }}\n {{ config.DEBUG }}\n {{ session.test }}\n \"\"\"\n )\n\n rv = client.get(\"/?foo=42\")\n assert rv.data.split() == [b\"42\", b\"23\", b\"False\", b\"aha\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_test_escaping.assert_lines_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_test_escaping.assert_lines_", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 71, "end_line": 88, "span_ids": ["test_escaping"], "tokens": 113}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_escaping(app, client):\n text = \"

Hello World!\"\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\n \"escaping_template.html\", text=text, html=Markup(text)\n )\n\n lines = client.get(\"/\").data.splitlines()\n assert lines == [\n b\"<p>Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"<p>Hello World!\",\n b\"

Hello World!\",\n ]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_no_escaping_test_no_escaping.assert_lines_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_no_escaping_test_no_escaping.assert_lines_", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 91, "end_line": 110, "span_ids": ["test_no_escaping"], "tokens": 127}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_no_escaping(app, client):\n text = \"

Hello World!\"\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\n \"non_escaping_template.txt\", text=text, html=Markup(text)\n )\n\n lines = client.get(\"/\").data.splitlines()\n assert lines == [\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"<p>Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n b\"

Hello World!\",\n ]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_without_template_filename_test_add_template_test.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_escaping_without_template_filename_test_add_template_test.None_2", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 103, "end_line": 224, "span_ids": ["test_template_test", "test_template_filter_with_name_and_template", "test_template_filter_with_name", "test_template_filter", "test_add_template_filter_with_name", "test_add_template_filter_with_name_and_template", "test_add_template_test", "test_escaping_without_template_filename", "test_add_template_filter", "test_template_filter_with_template", "test_macros", "test_add_template_filter_with_template"], "tokens": 805}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_escaping_without_template_filename(app, client, req_ctx):\n assert flask.render_template_string(\"{{ foo }}\", foo=\"\") == \"<test>\"\n assert flask.render_template(\"mail.txt\", foo=\"\") == \" Mail\"\n\n\ndef test_macros(app, req_ctx):\n macro = flask.get_template_attribute(\"_macro.html\", \"hello\")\n assert macro(\"World\") == \"Hello World!\"\n\n\ndef test_template_filter(app):\n @app.template_filter()\n def my_reverse(s):\n return s[::-1]\n\n assert \"my_reverse\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"my_reverse\"] == my_reverse\n assert app.jinja_env.filters[\"my_reverse\"](\"abcd\") == \"dcba\"\n\n\ndef test_add_template_filter(app):\n def my_reverse(s):\n return s[::-1]\n\n app.add_template_filter(my_reverse)\n assert \"my_reverse\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"my_reverse\"] == my_reverse\n assert app.jinja_env.filters[\"my_reverse\"](\"abcd\") == \"dcba\"\n\n\ndef test_template_filter_with_name(app):\n @app.template_filter(\"strrev\")\n def my_reverse(s):\n return s[::-1]\n\n assert \"strrev\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"strrev\"] == my_reverse\n assert app.jinja_env.filters[\"strrev\"](\"abcd\") == \"dcba\"\n\n\ndef test_add_template_filter_with_name(app):\n def my_reverse(s):\n return s[::-1]\n\n app.add_template_filter(my_reverse, \"strrev\")\n assert \"strrev\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"strrev\"] == my_reverse\n assert app.jinja_env.filters[\"strrev\"](\"abcd\") == \"dcba\"\n\n\ndef test_template_filter_with_template(app, client):\n @app.template_filter()\n def super_reverse(s):\n return s[::-1]\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_add_template_filter_with_template(app, client):\n def super_reverse(s):\n return s[::-1]\n\n app.add_template_filter(super_reverse)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_template_filter_with_name_and_template(app, client):\n @app.template_filter(\"super_reverse\")\n def my_reverse(s):\n return s[::-1]\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_add_template_filter_with_name_and_template(app, client):\n def my_reverse(s):\n return s[::-1]\n\n app.add_template_filter(my_reverse, \"super_reverse\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_template_test(app):\n @app.template_test()\n def boolean(value):\n return isinstance(value, bool)\n\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == boolean\n assert app.jinja_env.tests[\"boolean\"](False)\n\n\ndef test_add_template_test(app):\n def boolean(value):\n return isinstance(value, bool)\n\n app.add_template_test(boolean)\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == boolean\n assert app.jinja_env.tests[\"boolean\"](False)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_test_with_name_test_custom_template_loader.assert_rv_data_b_Hello": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_test_with_name_test_custom_template_loader.assert_rv_data_b_Hello", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 227, "end_line": 329, "span_ids": ["test_custom_template_loader.MyFlask.create_global_jinja_loader", "test_add_template_test_with_name", "test_template_test_with_name", "test_custom_template_loader", "test_add_template_test_with_template", "test_add_template_global", "test_custom_template_loader.MyFlask", "test_add_template_test_with_name_and_template", "test_template_test_with_name_and_template", "test_template_test_with_template"], "tokens": 614}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_template_test_with_name(app):\n @app.template_test(\"boolean\")\n def is_boolean(value):\n return isinstance(value, bool)\n\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == is_boolean\n assert app.jinja_env.tests[\"boolean\"](False)\n\n\ndef test_add_template_test_with_name(app):\n def is_boolean(value):\n return isinstance(value, bool)\n\n app.add_template_test(is_boolean, \"boolean\")\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == is_boolean\n assert app.jinja_env.tests[\"boolean\"](False)\n\n\ndef test_template_test_with_template(app, client):\n @app.template_test()\n def boolean(value):\n return isinstance(value, bool)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_add_template_test_with_template(app, client):\n def boolean(value):\n return isinstance(value, bool)\n\n app.add_template_test(boolean)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_template_test_with_name_and_template(app, client):\n @app.template_test(\"boolean\")\n def is_boolean(value):\n return isinstance(value, bool)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_add_template_test_with_name_and_template(app, client):\n def is_boolean(value):\n return isinstance(value, bool)\n\n app.add_template_test(is_boolean, \"boolean\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_add_template_global(app, app_ctx):\n @app.template_global()\n def get_stuff():\n return 42\n\n assert \"get_stuff\" in app.jinja_env.globals.keys()\n assert app.jinja_env.globals[\"get_stuff\"] == get_stuff\n assert app.jinja_env.globals[\"get_stuff\"](), 42\n\n rv = flask.render_template_string(\"{{ get_stuff() }}\")\n assert rv == \"42\"\n\n\ndef test_custom_template_loader(client):\n class MyFlask(flask.Flask):\n def create_global_jinja_loader(self):\n from jinja2 import DictLoader\n\n return DictLoader({\"index.html\": \"Hello Custom World!\"})\n\n app = MyFlask(__name__)\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"index.html\")\n\n c = app.test_client()\n rv = c.get(\"/\")\n assert rv.data == b\"Hello Custom World!\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_iterable_loader_test_iterable_loader.assert_rv_data_b_h1_J": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_iterable_loader_test_iterable_loader.assert_rv_data_b_h1_J", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 332, "end_line": 349, "span_ids": ["test_iterable_loader"], "tokens": 109}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_iterable_loader(app, client):\n @app.context_processor\n def context_processor():\n return {\"whiskey\": \"Jameson\"}\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\n [\n \"no_template.xml\", # should skip this one\n \"simple_template.html\", # should render this\n \"context_template.html\",\n ],\n value=23,\n )\n\n rv = client.get(\"/\")\n assert rv.data == b\"

Jameson

\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_templates_auto_reload_test_templates_auto_reload_debug_run.assert_app_jinja_env_auto": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_templates_auto_reload_test_templates_auto_reload_debug_run.assert_app_jinja_env_auto", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 362, "end_line": 404, "span_ids": ["test_templates_auto_reload", "test_templates_auto_reload_debug_run"], "tokens": 385}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_templates_auto_reload(app):\n # debug is False, config option is None\n assert app.debug is False\n assert app.config[\"TEMPLATES_AUTO_RELOAD\"] is None\n assert app.jinja_env.auto_reload is False\n # debug is False, config option is False\n app = flask.Flask(__name__)\n app.config[\"TEMPLATES_AUTO_RELOAD\"] = False\n assert app.debug is False\n assert app.jinja_env.auto_reload is False\n # debug is False, config option is True\n app = flask.Flask(__name__)\n app.config[\"TEMPLATES_AUTO_RELOAD\"] = True\n assert app.debug is False\n assert app.jinja_env.auto_reload is True\n # debug is True, config option is None\n app = flask.Flask(__name__)\n app.config[\"DEBUG\"] = True\n assert app.config[\"TEMPLATES_AUTO_RELOAD\"] is None\n assert app.jinja_env.auto_reload is True\n # debug is True, config option is False\n app = flask.Flask(__name__)\n app.config[\"DEBUG\"] = True\n app.config[\"TEMPLATES_AUTO_RELOAD\"] = False\n assert app.jinja_env.auto_reload is False\n # debug is True, config option is True\n app = flask.Flask(__name__)\n app.config[\"DEBUG\"] = True\n app.config[\"TEMPLATES_AUTO_RELOAD\"] = True\n assert app.jinja_env.auto_reload is True\n\n\ndef test_templates_auto_reload_debug_run(app, monkeypatch):\n def run_simple_mock(*args, **kwargs):\n pass\n\n monkeypatch.setattr(werkzeug.serving, \"run_simple\", run_simple_mock)\n\n app.run()\n assert not app.jinja_env.auto_reload\n\n app.run(debug=True)\n assert app.jinja_env.auto_reload", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_loader_debugging_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_templating.py_test_template_loader_debugging_", "embedding": null, "metadata": {"file_path": "tests/test_templating.py", "file_name": "test_templating.py", "file_type": "text/x-python", "category": "test", "start_line": 399, "end_line": 444, "span_ids": ["test_custom_jinja_env.CustomEnvironment", "test_custom_jinja_env.CustomFlask", "test_custom_jinja_env", "test_template_loader_debugging._TestHandler.handle", "test_custom_jinja_env.CustomEnvironment:2", "test_custom_jinja_env.CustomFlask:2", "test_template_loader_debugging", "test_template_loader_debugging._TestHandler"], "tokens": 326}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_template_loader_debugging(test_apps, monkeypatch):\n from blueprintapp import app\n\n called = []\n\n class _TestHandler(logging.Handler):\n def handle(self, record):\n called.append(True)\n text = str(record.msg)\n assert \"1: trying loader of application 'blueprintapp'\" in text\n assert (\n \"2: trying loader of blueprint 'admin' (blueprintapp.apps.admin)\"\n ) in text\n assert (\n \"trying loader of blueprint 'frontend' (blueprintapp.apps.frontend)\"\n ) in text\n assert \"Error: the template could not be found\" in text\n assert (\n \"looked up from an endpoint that belongs to the blueprint 'frontend'\"\n ) in text\n assert \"See https://flask.palletsprojects.com/blueprints/#templates\" in text\n\n with app.test_client() as c:\n monkeypatch.setitem(app.config, \"EXPLAIN_TEMPLATE_LOADING\", True)\n monkeypatch.setattr(\n logging.getLogger(\"blueprintapp\"), \"handlers\", [_TestHandler()]\n )\n\n with pytest.raises(TemplateNotFound) as excinfo:\n c.get(\"/missing\")\n\n assert \"missing_template.html\" in str(excinfo.value)\n\n assert len(called) == 1\n\n\ndef test_custom_jinja_env():\n class CustomEnvironment(flask.templating.Environment):\n pass\n\n class CustomFlask(flask.Flask):\n jinja_environment = CustomEnvironment\n\n app = CustomFlask(__name__)\n assert isinstance(app.jinja_env, CustomEnvironment)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_click_test_environ_base_default.assert_flask_g_user_agent": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_click_test_environ_base_default.assert_flask_g_user_agent", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 54, "span_ids": ["impl", "test_environ_defaults", "impl:2", "imports:11", "test_environ_base_default", "imports", "test_environ_defaults_from_config"], "tokens": 324}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import click\nimport pytest\nimport werkzeug\n\nimport flask\nfrom flask import appcontext_popped\nfrom flask.cli import ScriptInfo\nfrom flask.globals import _cv_request\nfrom flask.json import jsonify\nfrom flask.testing import EnvironBuilder\nfrom flask.testing import FlaskCliRunner\n\ntry:\n import blinker\nexcept ImportError:\n blinker = None\n\n\ndef test_environ_defaults_from_config(app, client):\n app.config[\"SERVER_NAME\"] = \"example.com:1234\"\n app.config[\"APPLICATION_ROOT\"] = \"/foo\"\n\n @app.route(\"/\")\n def index():\n return flask.request.url\n\n ctx = app.test_request_context()\n assert ctx.request.url == \"http://example.com:1234/foo/\"\n\n rv = client.get(\"/\")\n assert rv.data == b\"http://example.com:1234/foo/\"\n\n\ndef test_environ_defaults(app, client, app_ctx, req_ctx):\n @app.route(\"/\")\n def index():\n return flask.request.url\n\n ctx = app.test_request_context()\n assert ctx.request.url == \"http://localhost/\"\n with client:\n rv = client.get(\"/\")\n assert rv.data == b\"http://localhost/\"\n\n\ndef test_environ_base_default(app, client, app_ctx):\n @app.route(\"/\")\n def index():\n flask.g.user_agent = flask.request.headers[\"User-Agent\"]\n return flask.request.remote_addr\n\n rv = client.get(\"/\")\n assert rv.data == b\"127.0.0.1\"\n assert flask.g.user_agent == f\"werkzeug/{werkzeug.__version__}\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_environ_base_modified_test_environ_base_modified.None_7": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_environ_base_modified_test_environ_base_modified.None_7", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 56, "end_line": 72, "span_ids": ["test_environ_base_modified"], "tokens": 166}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_environ_base_modified(app, client, app_ctx):\n @app.route(\"/\")\n def index():\n flask.g.user_agent = flask.request.headers[\"User-Agent\"]\n return flask.request.remote_addr\n\n client.environ_base[\"REMOTE_ADDR\"] = \"0.0.0.0\"\n client.environ_base[\"HTTP_USER_AGENT\"] = \"Foo\"\n rv = client.get(\"/\")\n assert rv.data == b\"0.0.0.0\"\n assert flask.g.user_agent == \"Foo\"\n\n client.environ_base[\"REMOTE_ADDR\"] = \"0.0.0.1\"\n client.environ_base[\"HTTP_USER_AGENT\"] = \"Bar\"\n rv = client.get(\"/\")\n assert rv.data == b\"0.0.0.1\"\n assert flask.g.user_agent == \"Bar\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_open_environ_test_client_open_environ.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_open_environ_test_client_open_environ.None_2", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 75, "end_line": 89, "span_ids": ["test_client_open_environ"], "tokens": 125}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_client_open_environ(app, client, request):\n @app.route(\"/index\")\n def index():\n return flask.request.remote_addr\n\n builder = EnvironBuilder(app, path=\"/index\", method=\"GET\")\n request.addfinalizer(builder.close)\n\n rv = client.open(builder)\n assert rv.data == b\"127.0.0.1\"\n\n environ = builder.get_environ()\n client.environ_base[\"REMOTE_ADDR\"] = \"127.0.0.2\"\n rv = client.open(environ)\n assert rv.data == b\"127.0.0.2\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_specify_url_scheme_test_environbuilder_json_dumps.assert_eb_input_stream_re": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_specify_url_scheme_test_environbuilder_json_dumps.assert_eb_input_stream_re", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 93, "end_line": 117, "span_ids": ["test_specify_url_scheme", "test_environbuilder_json_dumps", "test_path_is_url"], "tokens": 189}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_specify_url_scheme(app, client):\n @app.route(\"/\")\n def index():\n return flask.request.url\n\n ctx = app.test_request_context(url_scheme=\"https\")\n assert ctx.request.url == \"https://localhost/\"\n\n rv = client.get(\"/\", url_scheme=\"https\")\n assert rv.data == b\"https://localhost/\"\n\n\ndef test_path_is_url(app):\n eb = EnvironBuilder(app, \"https://example.com/\")\n assert eb.url_scheme == \"https\"\n assert eb.host == \"example.com\"\n assert eb.script_root == \"\"\n assert eb.path == \"/\"\n\n\ndef test_environbuilder_json_dumps(app):\n \"\"\"EnvironBuilder.json_dumps() takes settings from the app.\"\"\"\n app.json.ensure_ascii = False\n eb = EnvironBuilder(app, json=\"\\u20ac\")\n assert eb.input_stream.read().decode(\"utf8\") == '\"\\u20ac\"'", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_blueprint_with_subdomain_test_blueprint_with_subdomain.assert_rv_data_b_http_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_blueprint_with_subdomain_test_blueprint_with_subdomain.assert_rv_data_b_http_", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 119, "end_line": 140, "span_ids": ["test_blueprint_with_subdomain"], "tokens": 163}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_with_subdomain():\n app = flask.Flask(__name__, subdomain_matching=True)\n app.config[\"SERVER_NAME\"] = \"example.com:1234\"\n app.config[\"APPLICATION_ROOT\"] = \"/foo\"\n client = app.test_client()\n\n bp = flask.Blueprint(\"company\", __name__, subdomain=\"xxx\")\n\n @bp.route(\"/\")\n def index():\n return flask.request.url\n\n app.register_blueprint(bp)\n\n ctx = app.test_request_context(\"/\", subdomain=\"xxx\")\n assert ctx.request.url == \"http://xxx.example.com:1234/foo/\"\n\n with ctx:\n assert ctx.request.blueprint == bp.name\n\n rv = client.get(\"/\", subdomain=\"xxx\")\n assert rv.data == b\"http://xxx.example.com:1234/foo/\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_redirect_keep_session_test_redirect_keep_session.with_client_.None_5": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_redirect_keep_session_test_redirect_keep_session.with_client_.None_5", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 143, "end_line": 168, "span_ids": ["test_redirect_keep_session"], "tokens": 187}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_redirect_keep_session(app, client, app_ctx):\n @app.route(\"/\", methods=[\"GET\", \"POST\"])\n def index():\n if flask.request.method == \"POST\":\n return flask.redirect(\"/getsession\")\n flask.session[\"data\"] = \"foo\"\n return \"index\"\n\n @app.route(\"/getsession\")\n def get_session():\n return flask.session.get(\"data\", \"\")\n\n with client:\n rv = client.get(\"/getsession\")\n assert rv.data == b\"\"\n\n rv = client.get(\"/\")\n assert rv.data == b\"index\"\n assert flask.session.get(\"data\") == \"foo\"\n\n rv = client.post(\"/\", data={}, follow_redirects=True)\n assert rv.data == b\"foo\"\n assert flask.session.get(\"data\") == \"foo\"\n\n rv = client.get(\"/getsession\")\n assert rv.data == b\"foo\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_session_transactions_test_session_transaction_needs_cookies.assert_cookies_in_str_e": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_session_transactions_test_session_transaction_needs_cookies.assert_cookies_in_str_e", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 172, "end_line": 212, "span_ids": ["test_session_transactions", "test_session_transaction_needs_cookies", "test_session_transactions_no_null_sessions", "test_session_transactions_keep_context"], "tokens": 269}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_session_transactions(app, client):\n @app.route(\"/\")\n def index():\n return str(flask.session[\"foo\"])\n\n with client:\n with client.session_transaction() as sess:\n assert len(sess) == 0\n sess[\"foo\"] = [42]\n assert len(sess) == 1\n rv = client.get(\"/\")\n assert rv.data == b\"[42]\"\n with client.session_transaction() as sess:\n assert len(sess) == 1\n assert sess[\"foo\"] == [42]\n\n\ndef test_session_transactions_no_null_sessions():\n app = flask.Flask(__name__)\n\n with app.test_client() as c:\n with pytest.raises(RuntimeError) as e:\n with c.session_transaction():\n pass\n assert \"Session backend did not open a session\" in str(e.value)\n\n\ndef test_session_transactions_keep_context(app, client, req_ctx):\n client.get(\"/\")\n req = flask.request._get_current_object()\n assert req is not None\n with client.session_transaction():\n assert req is flask.request._get_current_object()\n\n\ndef test_session_transaction_needs_cookies(app):\n c = app.test_client(use_cookies=False)\n with pytest.raises(RuntimeError) as e:\n with c.session_transaction():\n pass\n assert \"cookies\" in str(e.value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_test_client_context_binding_test_test_client_context_binding.try_.else_.raise_AssertionError_som": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_test_client_context_binding_test_test_client_context_binding.try_.else_.raise_AssertionError_som", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 215, "end_line": 244, "span_ids": ["test_test_client_context_binding"], "tokens": 175}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_test_client_context_binding(app, client):\n app.testing = False\n\n @app.route(\"/\")\n def index():\n flask.g.value = 42\n return \"Hello World!\"\n\n @app.route(\"/other\")\n def other():\n 1 // 0\n\n with client:\n resp = client.get(\"/\")\n assert flask.g.value == 42\n assert resp.data == b\"Hello World!\"\n assert resp.status_code == 200\n\n resp = client.get(\"/other\")\n assert not hasattr(flask.g, \"value\")\n assert b\"Internal Server Error\" in resp.data\n assert resp.status_code == 500\n flask.g.value = 23\n\n try:\n flask.g.value\n except (AttributeError, RuntimeError):\n pass\n else:\n raise AssertionError(\"some kind of exception expected\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_reuse_client_test_full_url_request.with_client_.assert_vodka_in_flask_r": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_reuse_client_test_full_url_request.with_client_.assert_vodka_in_flask_r", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 247, "end_line": 266, "span_ids": ["test_full_url_request", "test_reuse_client"], "tokens": 129}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_reuse_client(client):\n c = client\n\n with c:\n assert client.get(\"/\").status_code == 404\n\n with c:\n assert client.get(\"/\").status_code == 404\n\n\ndef test_full_url_request(app, client):\n @app.route(\"/action\", methods=[\"POST\"])\n def action():\n return \"x\"\n\n with client:\n rv = client.post(\"http://domain.com/action?vodka=42\", data={\"gin\": 43})\n assert rv.status_code == 200\n assert \"gin\" in flask.request.form\n assert \"vodka\" in flask.request.args", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_json_request_and_response_test_json_request_and_response.with_client_.assert_rv_get_json_j": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_json_request_and_response_test_json_request_and_response.with_client_.assert_rv_get_json_j", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 292, "end_line": 308, "span_ids": ["test_json_request_and_response"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_json_request_and_response(app, client):\n @app.route(\"/echo\", methods=[\"POST\"])\n def echo():\n return jsonify(flask.request.get_json())\n\n with client:\n json_data = {\"drink\": {\"gin\": 1, \"tonic\": True}, \"price\": 10}\n rv = client.post(\"/echo\", json=json_data)\n\n # Request should be in JSON\n assert flask.request.is_json\n assert flask.request.get_json() == json_data\n\n # Response should be in JSON\n assert rv.status_code == 200\n assert rv.is_json\n assert rv.get_json() == json_data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_json_no_app_context_test_client_json_no_app_context.assert_ns_count_1": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_json_no_app_context_test_client_json_no_app_context.assert_ns_count_1", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 311, "end_line": 329, "span_ids": ["test_client_json_no_app_context", "test_client_json_no_app_context.Namespace:2", "test_client_json_no_app_context.Namespace"], "tokens": 140}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.skipif(blinker is None, reason=\"blinker is not installed\")\ndef test_client_json_no_app_context(app, client):\n @app.route(\"/hello\", methods=[\"POST\"])\n def hello():\n return f\"Hello, {flask.request.json['name']}!\"\n\n class Namespace:\n count = 0\n\n def add(self, app):\n self.count += 1\n\n ns = Namespace()\n\n with appcontext_popped.connected_to(ns.add, app):\n rv = client.post(\"/hello\", json={\"name\": \"Flask\"})\n\n assert rv.get_data(as_text=True) == \"Hello, Flask!\"\n assert ns.count == 1", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_pytest_test_error_handler_no_match.assert_client_get_abort": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_pytest_test_error_handler_no_match.assert_client_get_abort", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 58, "span_ids": ["test_error_handler_no_match.CustomException:2", "test_error_handler_no_match.CustomException", "test_error_handler_no_match", "imports"], "tokens": 348}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\nfrom werkzeug.exceptions import Forbidden\nfrom werkzeug.exceptions import HTTPException\nfrom werkzeug.exceptions import InternalServerError\nfrom werkzeug.exceptions import NotFound\n\nimport flask\n\n\ndef test_error_handler_no_match(app, client):\n class CustomException(Exception):\n pass\n\n @app.errorhandler(CustomException)\n def custom_exception_handler(e):\n assert isinstance(e, CustomException)\n return \"custom\"\n\n with pytest.raises(TypeError) as exc_info:\n app.register_error_handler(CustomException(), None)\n\n assert \"CustomException() is an instance, not a class.\" in str(exc_info.value)\n\n with pytest.raises(ValueError) as exc_info:\n app.register_error_handler(list, None)\n\n assert \"'list' is not a subclass of Exception.\" in str(exc_info.value)\n\n @app.errorhandler(500)\n def handle_500(e):\n assert isinstance(e, InternalServerError)\n\n if e.original_exception is not None:\n return f\"wrapped {type(e.original_exception).__name__}\"\n\n return \"direct\"\n\n with pytest.raises(ValueError) as exc_info:\n app.register_error_handler(999, None)\n\n assert \"Use a subclass of HTTPException\" in str(exc_info.value)\n\n @app.route(\"/custom\")\n def custom_test():\n raise CustomException()\n\n @app.route(\"/keyerror\")\n def key_error():\n raise KeyError()\n\n @app.route(\"/abort\")\n def do_abort():\n flask.abort(500)\n\n app.testing = False\n assert client.get(\"/custom\").data == b\"custom\"\n assert client.get(\"/keyerror\").data == b\"wrapped KeyError\"\n assert client.get(\"/abort\").data == b\"direct\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_subclass_test_error_handler_subclass.assert_c_get_child_regi": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_subclass_test_error_handler_subclass.assert_c_get_child_regi", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 55, "end_line": 91, "span_ids": ["test_error_handler_subclass.ChildExceptionUnregistered:2", "test_error_handler_subclass", "test_error_handler_subclass.ChildExceptionUnregistered", "test_error_handler_subclass.ParentException:2", "test_error_handler_subclass.ChildExceptionRegistered", "test_error_handler_subclass.ChildExceptionRegistered:2", "test_error_handler_subclass.ParentException"], "tokens": 215}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_error_handler_subclass(app):\n class ParentException(Exception):\n pass\n\n class ChildExceptionUnregistered(ParentException):\n pass\n\n class ChildExceptionRegistered(ParentException):\n pass\n\n @app.errorhandler(ParentException)\n def parent_exception_handler(e):\n assert isinstance(e, ParentException)\n return \"parent\"\n\n @app.errorhandler(ChildExceptionRegistered)\n def child_exception_handler(e):\n assert isinstance(e, ChildExceptionRegistered)\n return \"child-registered\"\n\n @app.route(\"/parent\")\n def parent_test():\n raise ParentException()\n\n @app.route(\"/child-unregistered\")\n def unregistered_test():\n raise ChildExceptionUnregistered()\n\n @app.route(\"/child-registered\")\n def registered_test():\n raise ChildExceptionRegistered()\n\n c = app.test_client()\n\n assert c.get(\"/parent\").data == b\"parent\"\n assert c.get(\"/child-unregistered\").data == b\"parent\"\n assert c.get(\"/child-registered\").data == b\"child-registered\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_http_subclass_test_error_handler_http_subclass.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_http_subclass_test_error_handler_http_subclass.None_2", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 94, "end_line": 127, "span_ids": ["test_error_handler_http_subclass.ForbiddenSubclassUnregistered", "test_error_handler_http_subclass", "test_error_handler_http_subclass.ForbiddenSubclassRegistered:2", "test_error_handler_http_subclass.ForbiddenSubclassUnregistered:2", "test_error_handler_http_subclass.ForbiddenSubclassRegistered"], "tokens": 219}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_error_handler_http_subclass(app):\n class ForbiddenSubclassRegistered(Forbidden):\n pass\n\n class ForbiddenSubclassUnregistered(Forbidden):\n pass\n\n @app.errorhandler(403)\n def code_exception_handler(e):\n assert isinstance(e, Forbidden)\n return \"forbidden\"\n\n @app.errorhandler(ForbiddenSubclassRegistered)\n def subclass_exception_handler(e):\n assert isinstance(e, ForbiddenSubclassRegistered)\n return \"forbidden-registered\"\n\n @app.route(\"/forbidden\")\n def forbidden_test():\n raise Forbidden()\n\n @app.route(\"/forbidden-registered\")\n def registered_test():\n raise ForbiddenSubclassRegistered()\n\n @app.route(\"/forbidden-unregistered\")\n def unregistered_test():\n raise ForbiddenSubclassUnregistered()\n\n c = app.test_client()\n\n assert c.get(\"/forbidden\").data == b\"forbidden\"\n assert c.get(\"/forbidden-unregistered\").data == b\"forbidden\"\n assert c.get(\"/forbidden-registered\").data == b\"forbidden-registered\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_blueprint_test_error_handler_blueprint.assert_c_get_bp_error_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_error_handler_blueprint_test_error_handler_blueprint.assert_c_get_bp_error_", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 130, "end_line": 154, "span_ids": ["test_error_handler_blueprint"], "tokens": 142}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_error_handler_blueprint(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.errorhandler(500)\n def bp_exception_handler(e):\n return \"bp-error\"\n\n @bp.route(\"/error\")\n def bp_test():\n raise InternalServerError()\n\n @app.errorhandler(500)\n def app_exception_handler(e):\n return \"app-error\"\n\n @app.route(\"/error\")\n def app_test():\n raise InternalServerError()\n\n app.register_blueprint(bp, url_prefix=\"/bp\")\n\n c = app.test_client()\n\n assert c.get(\"/error\").data == b\"app-error\"\n assert c.get(\"/bp/error\").data == b\"bp-error\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_default_error_handler_test_default_error_handler.assert_c_get_slash_fo": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_test_default_error_handler_test_default_error_handler.assert_c_get_slash_fo", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 157, "end_line": 208, "span_ids": ["test_default_error_handler"], "tokens": 336}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_default_error_handler():\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.errorhandler(HTTPException)\n def bp_exception_handler(e):\n assert isinstance(e, HTTPException)\n assert isinstance(e, NotFound)\n return \"bp-default\"\n\n @bp.errorhandler(Forbidden)\n def bp_forbidden_handler(e):\n assert isinstance(e, Forbidden)\n return \"bp-forbidden\"\n\n @bp.route(\"/undefined\")\n def bp_registered_test():\n raise NotFound()\n\n @bp.route(\"/forbidden\")\n def bp_forbidden_test():\n raise Forbidden()\n\n app = flask.Flask(__name__)\n\n @app.errorhandler(HTTPException)\n def catchall_exception_handler(e):\n assert isinstance(e, HTTPException)\n assert isinstance(e, NotFound)\n return \"default\"\n\n @app.errorhandler(Forbidden)\n def catchall_forbidden_handler(e):\n assert isinstance(e, Forbidden)\n return \"forbidden\"\n\n @app.route(\"/forbidden\")\n def forbidden():\n raise Forbidden()\n\n @app.route(\"/slash/\")\n def slash():\n return \"slash\"\n\n app.register_blueprint(bp, url_prefix=\"/bp\")\n\n c = app.test_client()\n assert c.get(\"/bp/undefined\").data == b\"bp-default\"\n assert c.get(\"/bp/forbidden\").data == b\"bp-forbidden\"\n assert c.get(\"/undefined\").data == b\"default\"\n assert c.get(\"/forbidden\").data == b\"forbidden\"\n # Don't handle RequestRedirect raised when adding slash.\n assert c.get(\"/slash\", follow_redirects=True).data == b\"slash\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers_TestGenericHandlers.report_error.return.f_direct_type_e___name_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers_TestGenericHandlers.report_error.return.f_direct_type_e___name_", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 211, "end_line": 244, "span_ids": ["TestGenericHandlers.app", "TestGenericHandlers.Custom", "TestGenericHandlers", "TestGenericHandlers.report_error"], "tokens": 172}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestGenericHandlers:\n \"\"\"Test how very generic handlers are dispatched to.\"\"\"\n\n class Custom(Exception):\n pass\n\n @pytest.fixture()\n def app(self, app):\n @app.route(\"/custom\")\n def do_custom():\n raise self.Custom()\n\n @app.route(\"/error\")\n def do_error():\n raise KeyError()\n\n @app.route(\"/abort\")\n def do_abort():\n flask.abort(500)\n\n @app.route(\"/raise\")\n def do_raise():\n raise InternalServerError()\n\n app.config[\"PROPAGATE_EXCEPTIONS\"] = False\n return app\n\n def report_error(self, e):\n original = getattr(e, \"original_exception\", None)\n\n if original is not None:\n return f\"wrapped {type(original).__name__}\"\n\n return f\"direct {type(e).__name__}\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_class_or_code_TestGenericHandlers.test_handle_class_or_code.assert_client_get_raise": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_class_or_code_TestGenericHandlers.test_handle_class_or_code.assert_client_get_raise", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 246, "end_line": 261, "span_ids": ["TestGenericHandlers.test_handle_class_or_code"], "tokens": 162}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestGenericHandlers:\n\n @pytest.mark.parametrize(\"to_handle\", (InternalServerError, 500))\n def test_handle_class_or_code(self, app, client, to_handle):\n \"\"\"``InternalServerError`` and ``500`` are aliases, they should\n have the same behavior. Both should only receive\n ``InternalServerError``, which might wrap another error.\n \"\"\"\n\n @app.errorhandler(to_handle)\n def handle_500(e):\n assert isinstance(e, InternalServerError)\n return self.report_error(e)\n\n assert client.get(\"/custom\").data == b\"wrapped Custom\"\n assert client.get(\"/error\").data == b\"wrapped KeyError\"\n assert client.get(\"/abort\").data == b\"direct InternalServerError\"\n assert client.get(\"/raise\").data == b\"direct InternalServerError\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_generic_http_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_user_error_handler.py_TestGenericHandlers.test_handle_generic_http_", "embedding": null, "metadata": {"file_path": "tests/test_user_error_handler.py", "file_name": "test_user_error_handler.py", "file_type": "text/x-python", "category": "test", "start_line": 263, "end_line": 290, "span_ids": ["TestGenericHandlers.test_handle_generic_http", "TestGenericHandlers.test_handle_generic"], "tokens": 222}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestGenericHandlers:\n\n def test_handle_generic_http(self, app, client):\n \"\"\"``HTTPException`` should only receive ``HTTPException``\n subclasses. It will receive ``404`` routing exceptions.\n \"\"\"\n\n @app.errorhandler(HTTPException)\n def handle_http(e):\n assert isinstance(e, HTTPException)\n return str(e.code)\n\n assert client.get(\"/error\").data == b\"500\"\n assert client.get(\"/abort\").data == b\"500\"\n assert client.get(\"/not-found\").data == b\"404\"\n\n def test_handle_generic(self, app, client):\n \"\"\"Generic ``Exception`` will handle all exceptions directly,\n including ``HTTPExceptions``.\n \"\"\"\n\n @app.errorhandler(Exception)\n def handle_exception(e):\n return self.report_error(e)\n\n assert client.get(\"/custom\").data == b\"direct Custom\"\n assert client.get(\"/error\").data == b\"direct KeyError\"\n assert client.get(\"/abort\").data == b\"direct InternalServerError\"\n assert client.get(\"/not-found\").data == b\"direct NotFound\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_pytest_test_view_inheritance.assert_sorted_meths_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_pytest_test_view_inheritance.assert_sorted_meths_", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 77, "span_ids": ["test_view_inheritance.BetterIndex.delete", "test_view_patching.Index.get", "test_view_inheritance.BetterIndex", "test_basic_view", "test_method_based_view.Index", "test_view_patching", "test_basic_view.Index:2", "test_view_patching.Index", "test_method_based_view.Index.get", "imports", "test_view_inheritance.Index.get", "test_view_patching.Other.get", "test_view_inheritance", "test_method_based_view", "test_basic_view.Index", "common_test", "test_view_inheritance.Index", "test_view_patching.Other"], "tokens": 421}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\nfrom werkzeug.http import parse_set_header\n\nimport flask.views\n\n\ndef common_test(app):\n c = app.test_client()\n\n assert c.get(\"/\").data == b\"GET\"\n assert c.post(\"/\").data == b\"POST\"\n assert c.put(\"/\").status_code == 405\n meths = parse_set_header(c.open(\"/\", method=\"OPTIONS\").headers[\"Allow\"])\n assert sorted(meths) == [\"GET\", \"HEAD\", \"OPTIONS\", \"POST\"]\n\n\ndef test_basic_view(app):\n class Index(flask.views.View):\n methods = [\"GET\", \"POST\"]\n\n def dispatch_request(self):\n return flask.request.method\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n common_test(app)\n\n\ndef test_method_based_view(app):\n class Index(flask.views.MethodView):\n def get(self):\n return \"GET\"\n\n def post(self):\n return \"POST\"\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n\n common_test(app)\n\n\ndef test_view_patching(app):\n class Index(flask.views.MethodView):\n def get(self):\n 1 // 0\n\n def post(self):\n 1 // 0\n\n class Other(Index):\n def get(self):\n return \"GET\"\n\n def post(self):\n return \"POST\"\n\n view = Index.as_view(\"index\")\n view.view_class = Other\n app.add_url_rule(\"/\", view_func=view)\n common_test(app)\n\n\ndef test_view_inheritance(app, client):\n class Index(flask.views.MethodView):\n def get(self):\n return \"GET\"\n\n def post(self):\n return \"POST\"\n\n class BetterIndex(Index):\n def delete(self):\n return \"DELETE\"\n\n app.add_url_rule(\"/\", view_func=BetterIndex.as_view(\"index\"))\n\n meths = parse_set_header(client.open(\"/\", method=\"OPTIONS\").headers[\"Allow\"])\n assert sorted(meths) == [\"DELETE\", \"GET\", \"HEAD\", \"OPTIONS\", \"POST\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_decorators_test_view_decorators.assert_rv_data_b_Aweso": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_decorators_test_view_decorators.assert_rv_data_b_Aweso", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 80, "end_line": 98, "span_ids": ["test_view_decorators.Index:2", "test_view_decorators", "test_view_decorators.Index"], "tokens": 138}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_view_decorators(app, client):\n def add_x_parachute(f):\n def new_function(*args, **kwargs):\n resp = flask.make_response(f(*args, **kwargs))\n resp.headers[\"X-Parachute\"] = \"awesome\"\n return resp\n\n return new_function\n\n class Index(flask.views.View):\n decorators = [add_x_parachute]\n\n def dispatch_request(self):\n return \"Awesome\"\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n rv = client.get(\"/\")\n assert rv.headers[\"X-Parachute\"] == \"awesome\"\n assert rv.data == b\"Awesome\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_provide_automatic_options_attr_test_view_provide_automatic_options_attr.assert_OPTIONS_in_rv_al": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_view_provide_automatic_options_attr_test_view_provide_automatic_options_attr.assert_OPTIONS_in_rv_al", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 101, "end_line": 138, "span_ids": ["test_view_provide_automatic_options_attr.Index2:2", "test_view_provide_automatic_options_attr.Index1", "test_view_provide_automatic_options_attr", "test_view_provide_automatic_options_attr.Index3.dispatch_request", "test_view_provide_automatic_options_attr.Index1:2", "test_view_provide_automatic_options_attr.Index3", "test_view_provide_automatic_options_attr.Index2"], "tokens": 248}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_view_provide_automatic_options_attr():\n app = flask.Flask(__name__)\n\n class Index1(flask.views.View):\n provide_automatic_options = False\n\n def dispatch_request(self):\n return \"Hello World!\"\n\n app.add_url_rule(\"/\", view_func=Index1.as_view(\"index\"))\n c = app.test_client()\n rv = c.open(\"/\", method=\"OPTIONS\")\n assert rv.status_code == 405\n\n app = flask.Flask(__name__)\n\n class Index2(flask.views.View):\n methods = [\"OPTIONS\"]\n provide_automatic_options = True\n\n def dispatch_request(self):\n return \"Hello World!\"\n\n app.add_url_rule(\"/\", view_func=Index2.as_view(\"index\"))\n c = app.test_client()\n rv = c.open(\"/\", method=\"OPTIONS\")\n assert sorted(rv.allow) == [\"OPTIONS\"]\n\n app = flask.Flask(__name__)\n\n class Index3(flask.views.View):\n def dispatch_request(self):\n return \"Hello World!\"\n\n app.add_url_rule(\"/\", view_func=Index3.as_view(\"index\"))\n c = app.test_client()\n rv = c.open(\"/\", method=\"OPTIONS\")\n assert \"OPTIONS\" in rv.allow", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_implicit_head_test_implicit_head.None_3": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_implicit_head_test_implicit_head.None_3", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 141, "end_line": 152, "span_ids": ["test_implicit_head", "test_implicit_head.Index.get", "test_implicit_head.Index"], "tokens": 111}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_implicit_head(app, client):\n class Index(flask.views.MethodView):\n def get(self):\n return flask.Response(\"Blub\", headers={\"X-Method\": flask.request.method})\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n rv = client.get(\"/\")\n assert rv.data == b\"Blub\"\n assert rv.headers[\"X-Method\"] == \"GET\"\n rv = client.head(\"/\")\n assert rv.data == b\"\"\n assert rv.headers[\"X-Method\"] == \"HEAD\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_explicit_head_test_endpoint_override.common_test_app_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_explicit_head_test_endpoint_override.common_test_app_", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 155, "end_line": 186, "span_ids": ["test_explicit_head", "test_explicit_head.Index.get", "test_endpoint_override.Index:2", "test_endpoint_override.Index", "test_endpoint_override", "test_explicit_head.Index"], "tokens": 205}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_explicit_head(app, client):\n class Index(flask.views.MethodView):\n def get(self):\n return \"GET\"\n\n def head(self):\n return flask.Response(\"\", headers={\"X-Method\": \"HEAD\"})\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n rv = client.get(\"/\")\n assert rv.data == b\"GET\"\n rv = client.head(\"/\")\n assert rv.data == b\"\"\n assert rv.headers[\"X-Method\"] == \"HEAD\"\n\n\ndef test_endpoint_override(app):\n app.debug = True\n\n class Index(flask.views.View):\n methods = [\"GET\", \"POST\"]\n\n def dispatch_request(self):\n return flask.request.method\n\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n\n with pytest.raises(AssertionError):\n app.add_url_rule(\"/\", view_func=Index.as_view(\"index\"))\n\n # But these tests should still pass. We just log a warning.\n common_test(app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_methods_var_inheritance_test_methods_var_inheritance.assert_ChildView_methods_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_methods_var_inheritance_test_methods_var_inheritance.assert_ChildView_methods_", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 189, "end_line": 204, "span_ids": ["test_methods_var_inheritance.ChildView.get", "test_methods_var_inheritance", "test_methods_var_inheritance.BaseView:2", "test_methods_var_inheritance.BaseView", "test_methods_var_inheritance.ChildView"], "tokens": 122}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_methods_var_inheritance(app, client):\n class BaseView(flask.views.MethodView):\n methods = [\"GET\", \"PROPFIND\"]\n\n class ChildView(BaseView):\n def get(self):\n return \"GET\"\n\n def propfind(self):\n return \"PROPFIND\"\n\n app.add_url_rule(\"/\", view_func=ChildView.as_view(\"index\"))\n\n assert client.get(\"/\").data == b\"GET\"\n assert client.open(\"/\", method=\"PROPFIND\").data == b\"PROPFIND\"\n assert ChildView.methods == {\"PROPFIND\", \"GET\"}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_multiple_inheritance_test_multiple_inheritance.assert_sorted_GetDeleteVi": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_multiple_inheritance_test_multiple_inheritance.assert_sorted_GetDeleteVi", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 207, "end_line": 223, "span_ids": ["test_multiple_inheritance.DeleteView", "test_multiple_inheritance.DeleteView.delete", "test_multiple_inheritance.GetDeleteView", "test_multiple_inheritance.GetDeleteView:2", "test_multiple_inheritance.GetView.get", "test_multiple_inheritance.GetView", "test_multiple_inheritance"], "tokens": 119}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_multiple_inheritance(app, client):\n class GetView(flask.views.MethodView):\n def get(self):\n return \"GET\"\n\n class DeleteView(flask.views.MethodView):\n def delete(self):\n return \"DELETE\"\n\n class GetDeleteView(GetView, DeleteView):\n pass\n\n app.add_url_rule(\"/\", view_func=GetDeleteView.as_view(\"index\"))\n\n assert client.get(\"/\").data == b\"GET\"\n assert client.delete(\"/\").data == b\"DELETE\"\n assert sorted(GetDeleteView.methods) == [\"DELETE\", \"GET\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_remove_method_from_parent_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_views.py_test_remove_method_from_parent_", "embedding": null, "metadata": {"file_path": "tests/test_views.py", "file_name": "test_views.py", "file_type": "text/x-python", "category": "test", "start_line": 226, "end_line": 261, "span_ids": ["test_remove_method_from_parent.GetView", "test_remove_method_from_parent", "test_init_once", "test_remove_method_from_parent.OtherView", "test_remove_method_from_parent.OtherView.post", "test_remove_method_from_parent.View:2", "test_remove_method_from_parent.View", "test_init_once.CountInit", "test_remove_method_from_parent.GetView.get", "test_init_once.CountInit:2"], "tokens": 214}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_remove_method_from_parent(app, client):\n class GetView(flask.views.MethodView):\n def get(self):\n return \"GET\"\n\n class OtherView(flask.views.MethodView):\n def post(self):\n return \"POST\"\n\n class View(GetView, OtherView):\n methods = [\"GET\"]\n\n app.add_url_rule(\"/\", view_func=View.as_view(\"index\"))\n\n assert client.get(\"/\").data == b\"GET\"\n assert client.post(\"/\").status_code == 405\n assert sorted(View.methods) == [\"GET\"]\n\n\ndef test_init_once(app, client):\n n = 0\n\n class CountInit(flask.views.View):\n init_every_request = False\n\n def __init__(self):\n nonlocal n\n n += 1\n\n def dispatch_request(self):\n return str(n)\n\n app.add_url_rule(\"/\", view_func=CountInit.as_view(\"index\"))\n assert client.get(\"/\").data == b\"1\"\n assert client.get(\"/\").data == b\"1\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/make_celery.py__": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/celery/make_celery.py__", "embedding": null, "metadata": {"file_path": "examples/celery/make_celery.py", "file_name": "make_celery.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 5, "span_ids": ["impl", "imports"], "tokens": 25}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from task_app import create_app\n\nflask_app = create_app()\ncelery_app = flask_app.extensions[\"celery\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/__init__.py_from_celery_import_Celery_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/__init__.py_from_celery_import_Celery_", "embedding": null, "metadata": {"file_path": "examples/celery/src/task_app/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 40, "span_ids": ["celery_init_app.FlaskTask", "create_app", "imports", "celery_init_app.FlaskTask.__call__", "celery_init_app"], "tokens": 228}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from celery import Celery\nfrom celery import Task\nfrom flask import Flask\nfrom flask import render_template\n\n\ndef create_app() -> Flask:\n app = Flask(__name__)\n app.config.from_mapping(\n CELERY=dict(\n broker_url=\"redis://localhost\",\n result_backend=\"redis://localhost\",\n task_ignore_result=True,\n ),\n )\n app.config.from_prefixed_env()\n celery_init_app(app)\n\n @app.route(\"/\")\n def index() -> str:\n return render_template(\"index.html\")\n\n from . import views\n\n app.register_blueprint(views.bp)\n return app\n\n\ndef celery_init_app(app: Flask) -> Celery:\n class FlaskTask(Task):\n def __call__(self, *args: object, **kwargs: object) -> object:\n with app.app_context():\n return self.run(*args, **kwargs)\n\n celery_app = Celery(app.name, task_cls=FlaskTask)\n celery_app.config_from_object(app.config[\"CELERY\"])\n celery_app.set_default()\n app.extensions[\"celery\"] = celery_app\n return celery_app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/tasks.py_time_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/tasks.py_time_", "embedding": null, "metadata": {"file_path": "examples/celery/src/task_app/tasks.py", "file_name": "tasks.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 24, "span_ids": ["process", "add", "imports", "block"], "tokens": 127}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import time\n\nfrom celery import shared_task\nfrom celery import Task\n\n\n@shared_task(ignore_result=False)\ndef add(a: int, b: int) -> int:\n return a + b\n\n\n@shared_task()\ndef block() -> None:\n time.sleep(5)\n\n\n@shared_task(bind=True, ignore_result=False)\ndef process(self: Task, total: int) -> object:\n for i in range(total):\n self.update_state(state=\"PROGRESS\", meta={\"current\": i + 1, \"total\": total})\n time.sleep(1)\n\n return {\"current\": total, \"total\": total}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/views.py_from_celery_result_import_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/celery/src/task_app/views.py_from_celery_result_import_", "embedding": null, "metadata": {"file_path": "examples/celery/src/task_app/views.py", "file_name": "views.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 39, "span_ids": ["impl", "result", "imports", "process", "add", "block"], "tokens": 235}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from celery.result import AsyncResult\nfrom flask import Blueprint\nfrom flask import request\n\nfrom . import tasks\n\nbp = Blueprint(\"tasks\", __name__, url_prefix=\"/tasks\")\n\n\n@bp.get(\"/result/\")\ndef result(id: str) -> dict[str, object]:\n result = AsyncResult(id)\n ready = result.ready()\n return {\n \"ready\": ready,\n \"successful\": result.successful() if ready else None,\n \"value\": result.get() if ready else result.result,\n }\n\n\n@bp.post(\"/add\")\ndef add() -> dict[str, object]:\n a = request.form.get(\"a\", type=int)\n b = request.form.get(\"b\", type=int)\n result = tasks.add.delay(a, b)\n return {\"result_id\": result.id}\n\n\n@bp.post(\"/block\")\ndef block() -> dict[str, object]:\n result = tasks.block.delay()\n return {\"result_id\": result.id}\n\n\n@bp.post(\"/process\")\ndef process() -> dict[str, object]:\n result = tasks.process.delay(total=request.form.get(\"total\", type=int))\n return {\"result_id\": result.id}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_pytest_test_register.with_app_app_context_.assert_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_pytest_test_register.with_app_app_context_.assert_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_auth.py", "file_name": "test_auth.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 21, "span_ids": ["test_register", "imports"], "tokens": 148}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\nfrom flask import g\nfrom flask import session\n\nfrom flaskr.db import get_db\n\n\ndef test_register(client, app):\n # test that viewing the page renders without template errors\n assert client.get(\"/auth/register\").status_code == 200\n\n # test that successful registration redirects to the login page\n response = client.post(\"/auth/register\", data={\"username\": \"a\", \"password\": \"a\"})\n assert response.headers[\"Location\"] == \"/auth/login\"\n\n # test that the user was inserted into the database\n with app.app_context():\n assert (\n get_db().execute(\"SELECT * FROM user WHERE username = 'a'\").fetchone()\n is not None\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_test_register_validate_input_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/examples/tutorial/tests/test_auth.py_test_register_validate_input_", "embedding": null, "metadata": {"file_path": "examples/tutorial/tests/test_auth.py", "file_name": "test_auth.py", "file_type": "text/x-python", "category": "test", "start_line": 24, "end_line": 70, "span_ids": ["test_login_validate_input", "test_logout", "test_login", "test_register_validate_input"], "tokens": 307}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n (\"username\", \"password\", \"message\"),\n (\n (\"\", \"\", b\"Username is required.\"),\n (\"a\", \"\", b\"Password is required.\"),\n (\"test\", \"test\", b\"already registered\"),\n ),\n)\ndef test_register_validate_input(client, username, password, message):\n response = client.post(\n \"/auth/register\", data={\"username\": username, \"password\": password}\n )\n assert message in response.data\n\n\ndef test_login(client, auth):\n # test that viewing the page renders without template errors\n assert client.get(\"/auth/login\").status_code == 200\n\n # test that successful login redirects to the index page\n response = auth.login()\n assert response.headers[\"Location\"] == \"/\"\n\n # login request set the user_id in the session\n # check that the user is loaded from the session\n with client:\n client.get(\"/\")\n assert session[\"user_id\"] == 1\n assert g.user[\"username\"] == \"test\"\n\n\n@pytest.mark.parametrize(\n (\"username\", \"password\", \"message\"),\n ((\"a\", \"test\", b\"Incorrect username.\"), (\"test\", \"a\", b\"Incorrect password.\")),\n)\ndef test_login_validate_input(auth, username, password, message):\n response = auth.login(username, password)\n assert message in response.data\n\n\ndef test_logout(client, auth):\n auth.login()\n\n with client:\n auth.logout()\n assert \"user_id\" not in session", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py_from_import_json_as_jso___version__._2_3_0_dev_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py_from_import_json_as_jso___version__._2_3_0_dev_", "embedding": null, "metadata": {"file_path": "src/flask/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 42, "span_ids": ["impl"], "tokens": 440}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from . import json as json\nfrom .app import Flask as Flask\nfrom .app import Request as Request\nfrom .app import Response as Response\nfrom .blueprints import Blueprint as Blueprint\nfrom .config import Config as Config\nfrom .ctx import after_this_request as after_this_request\nfrom .ctx import copy_current_request_context as copy_current_request_context\nfrom .ctx import has_app_context as has_app_context\nfrom .ctx import has_request_context as has_request_context\nfrom .globals import current_app as current_app\nfrom .globals import g as g\nfrom .globals import request as request\nfrom .globals import session as session\nfrom .helpers import abort as abort\nfrom .helpers import flash as flash\nfrom .helpers import get_flashed_messages as get_flashed_messages\nfrom .helpers import get_template_attribute as get_template_attribute\nfrom .helpers import make_response as make_response\nfrom .helpers import redirect as redirect\nfrom .helpers import send_file as send_file\nfrom .helpers import send_from_directory as send_from_directory\nfrom .helpers import stream_with_context as stream_with_context\nfrom .helpers import url_for as url_for\nfrom .json import jsonify as jsonify\nfrom .signals import appcontext_popped as appcontext_popped\nfrom .signals import appcontext_pushed as appcontext_pushed\nfrom .signals import appcontext_tearing_down as appcontext_tearing_down\nfrom .signals import before_render_template as before_render_template\nfrom .signals import got_request_exception as got_request_exception\nfrom .signals import message_flashed as message_flashed\nfrom .signals import request_finished as request_finished\nfrom .signals import request_started as request_started\nfrom .signals import request_tearing_down as request_tearing_down\nfrom .signals import signals_available as signals_available\nfrom .signals import template_rendered as template_rendered\nfrom .templating import render_template as render_template\nfrom .templating import render_template_string as render_template_string\nfrom .templating import stream_template as stream_template\nfrom .templating import stream_template_string as stream_template_string\n\n__version__ = \"2.3.0.dev\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py___getattr___": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/__init__.py___getattr___", "embedding": null, "metadata": {"file_path": "src/flask/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 45, "end_line": 93, "span_ids": ["__getattr__"], "tokens": 293}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def __getattr__(name):\n if name == \"_app_ctx_stack\":\n import warnings\n from .globals import __app_ctx_stack\n\n warnings.warn(\n \"'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return __app_ctx_stack\n\n if name == \"_request_ctx_stack\":\n import warnings\n from .globals import __request_ctx_stack\n\n warnings.warn(\n \"'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return __request_ctx_stack\n\n if name == \"escape\":\n import warnings\n from markupsafe import escape\n\n warnings.warn(\n \"'flask.escape' is deprecated and will be removed in Flask 2.4. Import\"\n \" 'markupsafe.escape' instead.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return escape\n\n if name == \"escape\":\n import warnings\n from markupsafe import Markup\n\n warnings.warn(\n \"'flask.Markup' is deprecated and will be removed in Flask 2.4. Import\"\n \" 'markupsafe.Markup' instead.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return Markup\n\n raise AttributeError(name)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._The_class_that_is_used_Flask.json_provider_class.DefaultJSONProvider": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._The_class_that_is_used_Flask.json_provider_class.DefaultJSONProvider", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 202, "end_line": 283, "span_ids": ["Flask"], "tokens": 822}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n #: The class that is used for request objects. See :class:`~flask.Request`\n #: for more information.\n request_class = Request\n\n #: The class that is used for response objects. See\n #: :class:`~flask.Response` for more information.\n response_class = Response\n\n #: The class of the object assigned to :attr:`aborter`, created by\n #: :meth:`create_aborter`. That object is called by\n #: :func:`flask.abort` to raise HTTP errors, and can be\n #: called directly as well.\n #:\n #: Defaults to :class:`werkzeug.exceptions.Aborter`.\n #:\n #: .. versionadded:: 2.2\n aborter_class = Aborter\n\n #: The class that is used for the Jinja environment.\n #:\n #: .. versionadded:: 0.11\n jinja_environment = Environment\n\n #: The class that is used for the :data:`~flask.g` instance.\n #:\n #: Example use cases for a custom class:\n #:\n #: 1. Store arbitrary attributes on flask.g.\n #: 2. Add a property for lazy per-request database connectors.\n #: 3. Return None instead of AttributeError on unexpected attributes.\n #: 4. Raise exception if an unexpected attr is set, a \"controlled\" flask.g.\n #:\n #: In Flask 0.9 this property was called `request_globals_class` but it\n #: was changed in 0.10 to :attr:`app_ctx_globals_class` because the\n #: flask.g object is now application context scoped.\n #:\n #: .. versionadded:: 0.10\n app_ctx_globals_class = _AppCtxGlobals\n\n #: The class that is used for the ``config`` attribute of this app.\n #: Defaults to :class:`~flask.Config`.\n #:\n #: Example use cases for a custom class:\n #:\n #: 1. Default values for certain config options.\n #: 2. Access to config values through attributes in addition to keys.\n #:\n #: .. versionadded:: 0.11\n config_class = Config\n\n #: The testing flag. Set this to ``True`` to enable the test mode of\n #: Flask extensions (and in the future probably also Flask itself).\n #: For example this might activate test helpers that have an\n #: additional runtime cost which should not be enabled by default.\n #:\n #: If this is enabled and PROPAGATE_EXCEPTIONS is not changed from the\n #: default it's implicitly enabled.\n #:\n #: This attribute can also be configured from the config with the\n #: ``TESTING`` configuration key. Defaults to ``False``.\n testing = ConfigAttribute(\"TESTING\")\n\n #: If a secret key is set, cryptographic components can use this to\n #: sign cookies and other things. Set this to a complex random value\n #: when you want to use the secure cookie for instance.\n #:\n #: This attribute can also be configured from the config with the\n #: :data:`SECRET_KEY` configuration key. Defaults to ``None``.\n secret_key = ConfigAttribute(\"SECRET_KEY\")\n\n #: A :class:`~datetime.timedelta` which is used to set the expiration\n #: date of a permanent session. The default is 31 days which makes a\n #: permanent session survive for roughly one month.\n #:\n #: This attribute can also be configured from the config with the\n #: ``PERMANENT_SESSION_LIFETIME`` configuration key. Defaults to\n #: ``timedelta(days=31)``\n permanent_session_lifetime = ConfigAttribute(\n \"PERMANENT_SESSION_LIFETIME\", get_converter=_make_timedelta\n )\n\n json_provider_class: t.Type[JSONProvider] = DefaultJSONProvider", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._A_subclass_of_class__Flask.session_interface.SecureCookieSessionInterf": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._A_subclass_of_class__Flask.session_interface.SecureCookieSessionInterf", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 284, "end_line": 365, "span_ids": ["Flask"], "tokens": 763}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n \"\"\"A subclass of :class:`~flask.json.provider.JSONProvider`. An\n instance is created and assigned to :attr:`app.json` when creating\n the app.\n\n The default, :class:`~flask.json.provider.DefaultJSONProvider`, uses\n Python's built-in :mod:`json` library. A different provider can use\n a different JSON library.\n\n .. versionadded:: 2.2\n \"\"\"\n\n #: Options that are passed to the Jinja environment in\n #: :meth:`create_jinja_environment`. Changing these options after\n #: the environment is created (accessing :attr:`jinja_env`) will\n #: have no effect.\n #:\n #: .. versionchanged:: 1.1.0\n #: This is a ``dict`` instead of an ``ImmutableDict`` to allow\n #: easier configuration.\n #:\n jinja_options: dict = {}\n\n #: Default configuration parameters.\n default_config = ImmutableDict(\n {\n \"DEBUG\": None,\n \"TESTING\": False,\n \"PROPAGATE_EXCEPTIONS\": None,\n \"SECRET_KEY\": None,\n \"PERMANENT_SESSION_LIFETIME\": timedelta(days=31),\n \"USE_X_SENDFILE\": False,\n \"SERVER_NAME\": None,\n \"APPLICATION_ROOT\": \"/\",\n \"SESSION_COOKIE_NAME\": \"session\",\n \"SESSION_COOKIE_DOMAIN\": None,\n \"SESSION_COOKIE_PATH\": None,\n \"SESSION_COOKIE_HTTPONLY\": True,\n \"SESSION_COOKIE_SECURE\": False,\n \"SESSION_COOKIE_SAMESITE\": None,\n \"SESSION_REFRESH_EACH_REQUEST\": True,\n \"MAX_CONTENT_LENGTH\": None,\n \"SEND_FILE_MAX_AGE_DEFAULT\": None,\n \"TRAP_BAD_REQUEST_ERRORS\": None,\n \"TRAP_HTTP_EXCEPTIONS\": False,\n \"EXPLAIN_TEMPLATE_LOADING\": False,\n \"PREFERRED_URL_SCHEME\": \"http\",\n \"TEMPLATES_AUTO_RELOAD\": None,\n \"MAX_COOKIE_SIZE\": 4093,\n }\n )\n\n #: The rule object to use for URL rules created. This is used by\n #: :meth:`add_url_rule`. Defaults to :class:`werkzeug.routing.Rule`.\n #:\n #: .. versionadded:: 0.7\n url_rule_class = Rule\n\n #: The map object to use for storing the URL rules and routing\n #: configuration parameters. Defaults to :class:`werkzeug.routing.Map`.\n #:\n #: .. versionadded:: 1.1.0\n url_map_class = Map\n\n #: The :meth:`test_client` method creates an instance of this test\n #: client class. Defaults to :class:`~flask.testing.FlaskClient`.\n #:\n #: .. versionadded:: 0.7\n test_client_class: t.Optional[t.Type[\"FlaskClient\"]] = None\n\n #: The :class:`~click.testing.CliRunner` subclass, by default\n #: :class:`~flask.testing.FlaskCliRunner` that is used by\n #: :meth:`test_cli_runner`. Its ``__init__`` method should take a\n #: Flask app object as the first argument.\n #:\n #: .. versionadded:: 1.0\n test_cli_runner_class: t.Optional[t.Type[\"FlaskCliRunner\"]] = None\n\n #: the session interface to use. By default an instance of\n #: :class:`~flask.sessions.SecureCookieSessionInterface` is used here.\n #:\n #: .. versionadded:: 0.8\n session_interface: SessionInterface = SecureCookieSessionInterface()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._check_setup_finished_Flask._check_setup_finished.if_self__got_first_reques.raise_AssertionError_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask._check_setup_finished_Flask._check_setup_finished.if_self__got_first_reques.raise_AssertionError_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 522, "end_line": 532, "span_ids": ["Flask._check_setup_finished"], "tokens": 110}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def _check_setup_finished(self, f_name: str) -> None:\n if self._got_first_request:\n raise AssertionError(\n f\"The setup method '{f_name}' can no longer be called\"\n \" on the application. It has already handled its first\"\n \" request, any changes will not be applied\"\n \" consistently.\\n\"\n \"Make sure all imports, decorators, functions, etc.\"\n \" needed to set up the application are done before\"\n \" running it.\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.name_Flask.name.return.self_import_name": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.name_Flask.name.return.self_import_name", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 534, "end_line": 549, "span_ids": ["Flask.name"], "tokens": 162}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @cached_property\n def name(self) -> str: # type: ignore\n \"\"\"The name of the application. This is usually the import name\n with the difference that it's guessed from the run file if the\n import name is main. This name is used as a display name when\n Flask needs the name of the application. It can be set and overridden\n to change the value.\n\n .. versionadded:: 0.8\n \"\"\"\n if self.import_name == \"__main__\":\n fn = getattr(sys.modules[\"__main__\"], \"__file__\", None)\n if fn is None:\n return \"__main__\"\n return os.path.splitext(os.path.basename(fn))[0]\n return self.import_name", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_aborter_Flask.make_aborter.return.self_aborter_class_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_aborter_Flask.make_aborter.return.self_aborter_class_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 623, "end_line": 633, "span_ids": ["Flask.make_aborter"], "tokens": 108}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_aborter(self) -> Aborter:\n \"\"\"Create the object to assign to :attr:`aborter`. That object\n is called by :func:`flask.abort` to raise HTTP errors, and can\n be called directly as well.\n\n By default, this creates an instance of :attr:`aborter_class`,\n which defaults to :class:`werkzeug.exceptions.Aborter`.\n\n .. versionadded:: 2.2\n \"\"\"\n return self.aborter_class()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_global_jinja_loader_Flask.create_global_jinja_loader.return.DispatchingJinjaLoader_se": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.create_global_jinja_loader_Flask.create_global_jinja_loader.return.DispatchingJinjaLoader_se", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 700, "end_line": 711, "span_ids": ["Flask.create_global_jinja_loader"], "tokens": 120}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def create_global_jinja_loader(self) -> DispatchingJinjaLoader:\n \"\"\"Creates the loader for the Jinja2 environment. Can be used to\n override just the loader and keeping the rest unchanged. It's\n discouraged to override this function. Instead one should override\n the :meth:`jinja_loader` function instead.\n\n The global loader dispatches between the loaders of the application\n and the individual blueprints.\n\n .. versionadded:: 0.7\n \"\"\"\n return DispatchingJinjaLoader(self)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.select_jinja_autoescape_Flask.select_jinja_autoescape.return.filename_endswith_html": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.select_jinja_autoescape_Flask.select_jinja_autoescape.return.filename_endswith_html", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 713, "end_line": 724, "span_ids": ["Flask.select_jinja_autoescape"], "tokens": 120}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def select_jinja_autoescape(self, filename: str) -> bool:\n \"\"\"Returns ``True`` if autoescaping should be active for the given\n template name. If no template name is given, returns `True`.\n\n .. versionchanged:: 2.2\n Autoescaping is now enabled by default for ``.svg`` files.\n\n .. versionadded:: 0.5\n \"\"\"\n if filename is None:\n return True\n return filename.endswith((\".html\", \".htm\", \".xml\", \".xhtml\", \".svg\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_shell_context_Flask.debug_15.if_self_config_TEMPLATES.self.jinja_env.auto_reload.value": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_shell_context_Flask.debug_15.if_self_config_TEMPLATES.self.jinja_env.auto_reload.value", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 754, "end_line": 784, "span_ids": ["Flask.debug", "Flask.make_shell_context", "Flask.debug_15"], "tokens": 247}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_shell_context(self) -> dict:\n \"\"\"Returns the shell context for an interactive shell for this\n application. This runs all the registered shell context\n processors.\n\n .. versionadded:: 0.11\n \"\"\"\n rv = {\"app\": self, \"g\": g}\n for processor in self.shell_context_processors:\n rv.update(processor())\n return rv\n\n @property\n def debug(self) -> bool:\n \"\"\"Whether debug mode is enabled. When using ``flask run`` to start the\n development server, an interactive debugger will be shown for unhandled\n exceptions, and the server will be reloaded when code changes. This maps to the\n :data:`DEBUG` config key. It may not behave as expected if set late.\n\n **Do not enable debug mode when deploying in production.**\n\n Default: ``False``\n \"\"\"\n return self.config[\"DEBUG\"]\n\n @debug.setter\n def debug(self, value: bool) -> None:\n self.config[\"DEBUG\"] = value\n\n if self.config[\"TEMPLATES_AUTO_RELOAD\"] is None:\n self.jinja_env.auto_reload = value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run_Flask.run._the_flask_run_command": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run_Flask.run._the_flask_run_command", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 786, "end_line": 850, "span_ids": ["Flask.run"], "tokens": 702}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def run(\n self,\n host: t.Optional[str] = None,\n port: t.Optional[int] = None,\n debug: t.Optional[bool] = None,\n load_dotenv: bool = True,\n **options: t.Any,\n ) -> None:\n \"\"\"Runs the application on a local development server.\n\n Do not use ``run()`` in a production setting. It is not intended to\n meet security and performance requirements for a production server.\n Instead, see :doc:`/deploying/index` for WSGI server recommendations.\n\n If the :attr:`debug` flag is set the server will automatically reload\n for code changes and show a debugger in case an exception happened.\n\n If you want to run the application in debug mode, but disable the\n code execution on the interactive debugger, you can pass\n ``use_evalex=False`` as parameter. This will keep the debugger's\n traceback screen active, but disable code execution.\n\n It is not recommended to use this function for development with\n automatic reloading as this is badly supported. Instead you should\n be using the :command:`flask` command line script's ``run`` support.\n\n .. admonition:: Keep in Mind\n\n Flask will suppress any server error with a generic error page\n unless it is in debug mode. As such to enable just the\n interactive debugger without the code reloading, you have to\n invoke :meth:`run` with ``debug=True`` and ``use_reloader=False``.\n Setting ``use_debugger`` to ``True`` without being in debug mode\n won't catch any exceptions because there won't be any to\n catch.\n\n :param host: the hostname to listen on. Set this to ``'0.0.0.0'`` to\n have the server available externally as well. Defaults to\n ``'127.0.0.1'`` or the host in the ``SERVER_NAME`` config variable\n if present.\n :param port: the port of the webserver. Defaults to ``5000`` or the\n port defined in the ``SERVER_NAME`` config variable if present.\n :param debug: if given, enable or disable debug mode. See\n :attr:`debug`.\n :param load_dotenv: Load the nearest :file:`.env` and :file:`.flaskenv`\n files to set environment variables. Will also change the working\n directory to the directory containing the first file found.\n :param options: the options to be forwarded to the underlying Werkzeug\n server. See :func:`werkzeug.serving.run_simple` for more\n information.\n\n .. versionchanged:: 1.0\n If installed, python-dotenv will be used to load environment\n variables from :file:`.env` and :file:`.flaskenv` files.\n\n The :envvar:`FLASK_DEBUG` environment variable will override :attr:`debug`.\n\n Threaded mode is enabled by default.\n\n .. versionchanged:: 0.10\n The default port is now picked from the ``SERVER_NAME``\n variable.\n \"\"\"\n # Ignore this call so that it doesn't start another server if\n # the 'flask run' command is used.\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run.if_os_environ_get_FLASK__Flask.run.try_.finally_.self._got_first_request.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.run.if_os_environ_get_FLASK__Flask.run.try_.finally_.self._got_first_request.False", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 851, "end_line": 907, "span_ids": ["Flask.run"], "tokens": 460}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def run(\n self,\n host: t.Optional[str] = None,\n port: t.Optional[int] = None,\n debug: t.Optional[bool] = None,\n load_dotenv: bool = True,\n **options: t.Any,\n ) -> None:\n if os.environ.get(\"FLASK_RUN_FROM_CLI\") == \"true\":\n if not is_running_from_reloader():\n click.secho(\n \" * Ignoring a call to 'app.run()' that would block\"\n \" the current 'flask' CLI command.\\n\"\n \" Only call 'app.run()' in an 'if __name__ ==\"\n ' \"__main__\"\\' guard.',\n fg=\"red\",\n )\n\n return\n\n if get_load_dotenv(load_dotenv):\n cli.load_dotenv()\n\n # if set, env var overrides existing value\n if \"FLASK_DEBUG\" in os.environ:\n self.debug = get_debug_flag()\n\n # debug passed to method overrides all other sources\n if debug is not None:\n self.debug = bool(debug)\n\n server_name = self.config.get(\"SERVER_NAME\")\n sn_host = sn_port = None\n\n if server_name:\n sn_host, _, sn_port = server_name.partition(\":\")\n\n if not host:\n if sn_host:\n host = sn_host\n else:\n host = \"127.0.0.1\"\n\n if port or port == 0:\n port = int(port)\n elif sn_port:\n port = int(sn_port)\n else:\n port = 5000\n\n options.setdefault(\"use_reloader\", self.debug)\n options.setdefault(\"use_debugger\", self.debug)\n options.setdefault(\"threaded\", True)\n\n cli.show_server_banner(self.debug, self.name)\n\n from werkzeug.serving import run_simple\n\n try:\n run_simple(t.cast(str, host), port, self, **options)\n finally:\n # reset the first request information if the development server\n # reset normally. This makes it possible to restart the server\n # without reloader and that stuff from an interactive shell.\n self._got_first_request = False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_global_Flask.add_template_global.self_jinja_env_globals_na": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.add_template_global_Flask.add_template_global.self_jinja_env_globals_na", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1179, "end_line": 1191, "span_ids": ["Flask.add_template_global"], "tokens": 114}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n @setupmethod\n def add_template_global(\n self, f: ft.TemplateGlobalCallable, name: t.Optional[str] = None\n ) -> None:\n \"\"\"Register a custom template global function. Works exactly like the\n :meth:`template_global` decorator.\n\n .. versionadded:: 0.10\n\n :param name: the optional name of the global function, otherwise the\n function name will be used.\n \"\"\"\n self.jinja_env.globals[name or f.__name__] = f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_default_options_response_Flask.ensure_sync.return.func": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.make_default_options_response_Flask.ensure_sync.return.func", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1533, "end_line": 1568, "span_ids": ["Flask.make_default_options_response", "Flask.should_ignore_error", "Flask.ensure_sync"], "tokens": 293}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def make_default_options_response(self) -> Response:\n \"\"\"This method is called to create the default ``OPTIONS`` response.\n This can be changed through subclassing to change the default\n behavior of ``OPTIONS`` responses.\n\n .. versionadded:: 0.7\n \"\"\"\n adapter = request_ctx.url_adapter\n methods = adapter.allowed_methods() # type: ignore[union-attr]\n rv = self.response_class()\n rv.allow.update(methods)\n return rv\n\n def should_ignore_error(self, error: t.Optional[BaseException]) -> bool:\n \"\"\"This is called to figure out if an error should be ignored\n or not as far as the teardown system is concerned. If this\n function returns ``True`` then the teardown handlers will not be\n passed the error.\n\n .. versionadded:: 0.10\n \"\"\"\n return False\n\n def ensure_sync(self, func: t.Callable) -> t.Callable:\n \"\"\"Ensure that the function is synchronous for WSGI workers.\n Plain ``def`` functions are returned as-is. ``async def``\n functions are wrapped to run and wait for the response.\n\n Override this method to change how the app runs async views.\n\n .. versionadded:: 2.0\n \"\"\"\n if iscoroutinefunction(func):\n return self.async_to_sync(func)\n\n return func", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for_Flask.url_for.req_ctx._cv_request_get_None_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for_Flask.url_for.req_ctx._cv_request_get_None_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1593, "end_line": 1649, "span_ids": ["Flask.url_for"], "tokens": 617}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def url_for(\n self,\n endpoint: str,\n *,\n _anchor: t.Optional[str] = None,\n _method: t.Optional[str] = None,\n _scheme: t.Optional[str] = None,\n _external: t.Optional[bool] = None,\n **values: t.Any,\n ) -> str:\n \"\"\"Generate a URL to the given endpoint with the given values.\n\n This is called by :func:`flask.url_for`, and can be called\n directly as well.\n\n An *endpoint* is the name of a URL rule, usually added with\n :meth:`@app.route() `, and usually the same name as the\n view function. A route defined in a :class:`~flask.Blueprint`\n will prepend the blueprint's name separated by a ``.`` to the\n endpoint.\n\n In some cases, such as email messages, you want URLs to include\n the scheme and domain, like ``https://example.com/hello``. When\n not in an active request, URLs will be external by default, but\n this requires setting :data:`SERVER_NAME` so Flask knows what\n domain to use. :data:`APPLICATION_ROOT` and\n :data:`PREFERRED_URL_SCHEME` should also be configured as\n needed. This config is only used when not in an active request.\n\n Functions can be decorated with :meth:`url_defaults` to modify\n keyword arguments before the URL is built.\n\n If building fails for some reason, such as an unknown endpoint\n or incorrect values, the app's :meth:`handle_url_build_error`\n method is called. If that returns a string, that is returned,\n otherwise a :exc:`~werkzeug.routing.BuildError` is raised.\n\n :param endpoint: The endpoint name associated with the URL to\n generate. If this starts with a ``.``, the current blueprint\n name (if any) will be used.\n :param _anchor: If given, append this as ``#anchor`` to the URL.\n :param _method: If given, generate the URL associated with this\n method for the endpoint.\n :param _scheme: If given, the URL will have this scheme if it\n is external.\n :param _external: If given, prefer the URL to be internal\n (False) or require it to be external (True). External URLs\n include the scheme and domain. When not in an active\n request, URLs are external by default.\n :param values: Values to use for the variable parts of the URL\n rule. Unknown keys are appended as query string arguments,\n like ``?a=b&c=d``.\n\n .. versionadded:: 2.2\n Moved from ``flask.url_for``, which calls this method.\n \"\"\"\n req_ctx = _cv_request.get(None)\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for.if_req_ctx_is_not_None__Flask.url_for.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.url_for.if_req_ctx_is_not_None__Flask.url_for.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1651, "end_line": 1715, "span_ids": ["Flask.url_for"], "tokens": 567}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def url_for(\n self,\n endpoint: str,\n *,\n _anchor: t.Optional[str] = None,\n _method: t.Optional[str] = None,\n _scheme: t.Optional[str] = None,\n _external: t.Optional[bool] = None,\n **values: t.Any,\n ) -> str:\n # ... other code\n\n if req_ctx is not None:\n url_adapter = req_ctx.url_adapter\n blueprint_name = req_ctx.request.blueprint\n\n # If the endpoint starts with \".\" and the request matches a\n # blueprint, the endpoint is relative to the blueprint.\n if endpoint[:1] == \".\":\n if blueprint_name is not None:\n endpoint = f\"{blueprint_name}{endpoint}\"\n else:\n endpoint = endpoint[1:]\n\n # When in a request, generate a URL without scheme and\n # domain by default, unless a scheme is given.\n if _external is None:\n _external = _scheme is not None\n else:\n app_ctx = _cv_app.get(None)\n\n # If called by helpers.url_for, an app context is active,\n # use its url_adapter. Otherwise, app.url_for was called\n # directly, build an adapter.\n if app_ctx is not None:\n url_adapter = app_ctx.url_adapter\n else:\n url_adapter = self.create_url_adapter(None)\n\n if url_adapter is None:\n raise RuntimeError(\n \"Unable to build URLs outside an active request\"\n \" without 'SERVER_NAME' configured. Also configure\"\n \" 'APPLICATION_ROOT' and 'PREFERRED_URL_SCHEME' as\"\n \" needed.\"\n )\n\n # When outside a request, generate a URL with scheme and\n # domain by default.\n if _external is None:\n _external = True\n\n # It is an error to set _scheme when _external=False, in order\n # to avoid accidental insecure URLs.\n if _scheme is not None and not _external:\n raise ValueError(\"When specifying '_scheme', '_external' must be True.\")\n\n self.inject_url_defaults(endpoint, values)\n\n try:\n rv = url_adapter.build( # type: ignore[union-attr]\n endpoint,\n values,\n method=_method,\n url_scheme=_scheme,\n force_external=_external,\n )\n except BuildError as error:\n values.update(\n _anchor=_anchor, _method=_method, _scheme=_scheme, _external=_external\n )\n return self.handle_url_build_error(error, endpoint, values)\n\n if _anchor is not None:\n rv = f\"{rv}#{url_quote(_anchor)}\"\n\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.redirect_Flask.redirect.return._wz_redirect_location_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.redirect_Flask.redirect.return._wz_redirect_location_co", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1717, "end_line": 1729, "span_ids": ["Flask.redirect"], "tokens": 120}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def redirect(self, location: str, code: int = 302) -> BaseResponse:\n \"\"\"Create a redirect response object.\n\n This is called by :func:`flask.redirect`, and can be called\n directly as well.\n\n :param location: The URL to redirect to.\n :param code: The status code for the redirect.\n\n .. versionadded:: 2.2\n Moved from ``flask.redirect``, which calls this method.\n \"\"\"\n return _wz_redirect(location, code=code, Response=self.response_class)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.inject_url_defaults_Flask.inject_url_defaults.for_name_in_names_.if_name_in_self_url_defau.for_func_in_self_url_defa.func_endpoint_values_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.inject_url_defaults_Flask.inject_url_defaults.for_name_in_names_.if_name_in_self_url_defau.for_func_in_self_url_defa.func_endpoint_values_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1913, "end_line": 1932, "span_ids": ["Flask.inject_url_defaults"], "tokens": 169}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def inject_url_defaults(self, endpoint: str, values: dict) -> None:\n \"\"\"Injects the URL defaults for the given endpoint directly into\n the values dictionary passed. This is used internally and\n automatically called on URL building.\n\n .. versionadded:: 0.7\n \"\"\"\n names: t.Iterable[t.Optional[str]] = (None,)\n\n # url_for may be called outside a request context, parse the\n # passed endpoint instead of using request.blueprints.\n if \".\" in endpoint:\n names = chain(\n names, reversed(_split_blueprint_path(endpoint.rpartition(\".\")[0]))\n )\n\n for name in names:\n if name in self.url_default_functions:\n for func in self.url_default_functions[name]:\n func(endpoint, values)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.wsgi_app_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/app.py_Flask.wsgi_app_", "embedding": null, "metadata": {"file_path": "src/flask/app.py", "file_name": "app.py", "file_type": "text/x-python", "category": "implementation", "start_line": 2174, "end_line": 2228, "span_ids": ["Flask.wsgi_app", "Flask.__call__"], "tokens": 461}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Flask(Scaffold):\n\n def wsgi_app(self, environ: dict, start_response: t.Callable) -> t.Any:\n \"\"\"The actual WSGI application. This is not implemented in\n :meth:`__call__` so that middlewares can be applied without\n losing a reference to the app object. Instead of doing this::\n\n app = MyMiddleware(app)\n\n It's a better idea to do this instead::\n\n app.wsgi_app = MyMiddleware(app.wsgi_app)\n\n Then you still have the original application object around and\n can continue to call methods on it.\n\n .. versionchanged:: 0.7\n Teardown events for the request and app contexts are called\n even if an unhandled error occurs. Other events may not be\n called depending on when an error occurs during dispatch.\n See :ref:`callbacks-and-errors`.\n\n :param environ: A WSGI environment.\n :param start_response: A callable accepting a status code,\n a list of headers, and an optional exception context to\n start the response.\n \"\"\"\n ctx = self.request_context(environ)\n error: t.Optional[BaseException] = None\n try:\n try:\n ctx.push()\n response = self.full_dispatch_request()\n except Exception as e:\n error = e\n response = self.handle_exception(e)\n except: # noqa: B001\n error = sys.exc_info()[1]\n raise\n return response(environ, start_response)\n finally:\n if \"werkzeug.debug.preserve_context\" in environ:\n environ[\"werkzeug.debug.preserve_context\"](_cv_app.get())\n environ[\"werkzeug.debug.preserve_context\"](_cv_request.get())\n\n if error is not None and self.should_ignore_error(error):\n error = None\n\n ctx.pop(error)\n\n def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:\n \"\"\"The WSGI server calls the Flask application object as the\n WSGI application. This calls :meth:`wsgi_app`, which can be\n wrapped to apply middleware.\n \"\"\"\n return self.wsgi_app(environ, start_response)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_os_T_url_value_preprocessor.t_TypeVar_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_os_T_url_value_preprocessor.t_TypeVar_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 29, "span_ids": ["imports:5", "impl", "imports:9", "impl:2", "imports", "impl:3"], "tokens": 303}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import os\nimport typing as t\nfrom collections import defaultdict\nfrom functools import update_wrapper\n\nfrom . import typing as ft\nfrom .scaffold import _endpoint_from_view_func\nfrom .scaffold import _sentinel\nfrom .scaffold import Scaffold\nfrom .scaffold import setupmethod\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .app import Flask\n\nDeferredSetupFunction = t.Callable[[\"BlueprintSetupState\"], t.Callable]\nT_after_request = t.TypeVar(\"T_after_request\", bound=ft.AfterRequestCallable)\nT_before_request = t.TypeVar(\"T_before_request\", bound=ft.BeforeRequestCallable)\nT_error_handler = t.TypeVar(\"T_error_handler\", bound=ft.ErrorHandlerCallable)\nT_teardown = t.TypeVar(\"T_teardown\", bound=ft.TeardownCallable)\nT_template_context_processor = t.TypeVar(\n \"T_template_context_processor\", bound=ft.TemplateContextProcessorCallable\n)\nT_template_filter = t.TypeVar(\"T_template_filter\", bound=ft.TemplateFilterCallable)\nT_template_global = t.TypeVar(\"T_template_global\", bound=ft.TemplateGlobalCallable)\nT_template_test = t.TypeVar(\"T_template_test\", bound=ft.TemplateTestCallable)\nT_url_defaults = t.TypeVar(\"T_url_defaults\", bound=ft.URLDefaultCallable)\nT_url_value_preprocessor = t.TypeVar(\n \"T_url_value_preprocessor\", bound=ft.URLValuePreprocessorCallable\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint_Blueprint._got_registered_once.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint_Blueprint._got_registered_once.False", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 117, "end_line": 170, "span_ids": ["Blueprint"], "tokens": 555}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n \"\"\"Represents a blueprint, a collection of routes and other\n app-related functions that can be registered on a real application\n later.\n\n A blueprint is an object that allows defining application functions\n without requiring an application object ahead of time. It uses the\n same decorators as :class:`~flask.Flask`, but defers the need for an\n application by recording them for later registration.\n\n Decorating a function with a blueprint creates a deferred function\n that is called with :class:`~flask.blueprints.BlueprintSetupState`\n when the blueprint is registered on an application.\n\n See :doc:`/blueprints` for more information.\n\n :param name: The name of the blueprint. Will be prepended to each\n endpoint name.\n :param import_name: The name of the blueprint package, usually\n ``__name__``. This helps locate the ``root_path`` for the\n blueprint.\n :param static_folder: A folder with static files that should be\n served by the blueprint's static route. The path is relative to\n the blueprint's root path. Blueprint static files are disabled\n by default.\n :param static_url_path: The url to serve static files from.\n Defaults to ``static_folder``. If the blueprint does not have\n a ``url_prefix``, the app's static route will take precedence,\n and the blueprint's static files won't be accessible.\n :param template_folder: A folder with templates that should be added\n to the app's template search path. The path is relative to the\n blueprint's root path. Blueprint templates are disabled by\n default. Blueprint templates have a lower precedence than those\n in the app's templates folder.\n :param url_prefix: A path to prepend to all of the blueprint's URLs,\n to make them distinct from the rest of the app's routes.\n :param subdomain: A subdomain that blueprint routes will match on by\n default.\n :param url_defaults: A dict of default values that blueprint routes\n will receive by default.\n :param root_path: By default, the blueprint will automatically set\n this based on ``import_name``. In certain situations this\n automatic detection can fail, so the path can be specified\n manually instead.\n\n .. versionchanged:: 1.1.0\n Blueprints have a ``cli`` group to register nested CLI commands.\n The ``cli_group`` parameter controls the name of the group under\n the ``flask`` command.\n\n .. versionadded:: 0.7\n \"\"\"\n\n _got_registered_once = False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.__init___Blueprint.__init__.self._blueprints._": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.__init___Blueprint.__init__.self._blueprints._", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 172, "end_line": 206, "span_ids": ["Blueprint"], "tokens": 285}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n def __init__(\n self,\n name: str,\n import_name: str,\n static_folder: t.Optional[t.Union[str, os.PathLike]] = None,\n static_url_path: t.Optional[str] = None,\n template_folder: t.Optional[t.Union[str, os.PathLike]] = None,\n url_prefix: t.Optional[str] = None,\n subdomain: t.Optional[str] = None,\n url_defaults: t.Optional[dict] = None,\n root_path: t.Optional[str] = None,\n cli_group: t.Optional[str] = _sentinel, # type: ignore\n ):\n super().__init__(\n import_name=import_name,\n static_folder=static_folder,\n static_url_path=static_url_path,\n template_folder=template_folder,\n root_path=root_path,\n )\n\n if \".\" in name:\n raise ValueError(\"'name' may not contain a dot '.' character.\")\n\n self.name = name\n self.url_prefix = url_prefix\n self.subdomain = subdomain\n self.deferred_functions: t.List[DeferredSetupFunction] = []\n\n if url_defaults is None:\n url_defaults = {}\n\n self.url_values_defaults = url_defaults\n self.cli_group = cli_group\n self._blueprints: t.List[t.Tuple[\"Blueprint\", dict]] = []", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint._check_setup_finished_Blueprint._check_setup_finished.if_self__got_registered_o.raise_AssertionError_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint._check_setup_finished_Blueprint._check_setup_finished.if_self__got_registered_o.raise_AssertionError_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 208, "end_line": 216, "span_ids": ["Blueprint._check_setup_finished"], "tokens": 110}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n def _check_setup_finished(self, f_name: str) -> None:\n if self._got_registered_once:\n raise AssertionError(\n f\"The setup method '{f_name}' can no longer be called on the blueprint\"\n f\" '{self.name}'. It has already been registered at least once, any\"\n \" changes will not be applied consistently.\\n\"\n \"Make sure all imports, decorators, functions, etc. needed to set up\"\n \" the blueprint are done before registering it.\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.record_Blueprint.make_setup_state.return.BlueprintSetupState_self_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.record_Blueprint.make_setup_state.return.BlueprintSetupState_self_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 218, "end_line": 248, "span_ids": ["Blueprint.record", "Blueprint.record_once", "Blueprint.make_setup_state"], "tokens": 278}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def record(self, func: t.Callable) -> None:\n \"\"\"Registers a function that is called when the blueprint is\n registered on the application. This function is called with the\n state as argument as returned by the :meth:`make_setup_state`\n method.\n \"\"\"\n self.deferred_functions.append(func)\n\n @setupmethod\n def record_once(self, func: t.Callable) -> None:\n \"\"\"Works like :meth:`record` but wraps the function in another\n function that will ensure the function is only called once. If the\n blueprint is registered a second time on the application, the\n function passed is not called.\n \"\"\"\n\n def wrapper(state: BlueprintSetupState) -> None:\n if state.first_registration:\n func(state)\n\n self.record(update_wrapper(wrapper, func))\n\n def make_setup_state(\n self, app: \"Flask\", options: dict, first_registration: bool = False\n ) -> BlueprintSetupState:\n \"\"\"Creates an instance of :meth:`~flask.blueprints.BlueprintSetupState`\n object that is later passed to the register callback functions.\n Subclasses can override this to return a subclass of the setup state.\n \"\"\"\n return BlueprintSetupState(self, app, options, first_registration)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_blueprint_Blueprint.register_blueprint.self__blueprints_append_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_blueprint_Blueprint.register_blueprint.self__blueprints_append_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 250, "end_line": 266, "span_ids": ["Blueprint.register_blueprint"], "tokens": 166}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def register_blueprint(self, blueprint: \"Blueprint\", **options: t.Any) -> None:\n \"\"\"Register a :class:`~flask.Blueprint` on this blueprint. Keyword\n arguments passed to this method will override the defaults set\n on the blueprint.\n\n .. versionchanged:: 2.0.1\n The ``name`` option can be used to change the (pre-dotted)\n name the blueprint is registered with. This allows the same\n blueprint to be registered multiple times with unique names\n for ``url_for``.\n\n .. versionadded:: 2.0\n \"\"\"\n if blueprint is self:\n raise ValueError(\"Cannot register a blueprint on itself\")\n self._blueprints.append((blueprint, options))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_Blueprint.register.cli_resolved_group.options_get_cli_group_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register_Blueprint.register.cli_resolved_group.options_get_cli_group_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 268, "end_line": 362, "span_ids": ["Blueprint.register"], "tokens": 774}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n def register(self, app: \"Flask\", options: dict) -> None:\n \"\"\"Called by :meth:`Flask.register_blueprint` to register all\n views and callbacks registered on the blueprint with the\n application. Creates a :class:`.BlueprintSetupState` and calls\n each :meth:`record` callback with it.\n\n :param app: The application this blueprint is being registered\n with.\n :param options: Keyword arguments forwarded from\n :meth:`~Flask.register_blueprint`.\n\n .. versionchanged:: 2.3\n Nested blueprints now correctly apply subdomains.\n\n .. versionchanged:: 2.1\n Registering the same blueprint with the same name multiple\n times is an error.\n\n .. versionchanged:: 2.0.1\n Nested blueprints are registered with their dotted name.\n This allows different blueprints with the same name to be\n nested at different locations.\n\n .. versionchanged:: 2.0.1\n The ``name`` option can be used to change the (pre-dotted)\n name the blueprint is registered with. This allows the same\n blueprint to be registered multiple times with unique names\n for ``url_for``.\n \"\"\"\n name_prefix = options.get(\"name_prefix\", \"\")\n self_name = options.get(\"name\", self.name)\n name = f\"{name_prefix}.{self_name}\".lstrip(\".\")\n\n if name in app.blueprints:\n bp_desc = \"this\" if app.blueprints[name] is self else \"a different\"\n existing_at = f\" '{name}'\" if self_name != name else \"\"\n\n raise ValueError(\n f\"The name '{self_name}' is already registered for\"\n f\" {bp_desc} blueprint{existing_at}. Use 'name=' to\"\n f\" provide a unique name.\"\n )\n\n first_bp_registration = not any(bp is self for bp in app.blueprints.values())\n first_name_registration = name not in app.blueprints\n\n app.blueprints[name] = self\n self._got_registered_once = True\n state = self.make_setup_state(app, options, first_bp_registration)\n\n if self.has_static_folder:\n state.add_url_rule(\n f\"{self.static_url_path}/\",\n view_func=self.send_static_file,\n endpoint=\"static\",\n )\n\n # Merge blueprint data into parent.\n if first_bp_registration or first_name_registration:\n\n def extend(bp_dict, parent_dict):\n for key, values in bp_dict.items():\n key = name if key is None else f\"{name}.{key}\"\n parent_dict[key].extend(values)\n\n for key, value in self.error_handler_spec.items():\n key = name if key is None else f\"{name}.{key}\"\n value = defaultdict(\n dict,\n {\n code: {\n exc_class: func for exc_class, func in code_values.items()\n }\n for code, code_values in value.items()\n },\n )\n app.error_handler_spec[key] = value\n\n for endpoint, func in self.view_functions.items():\n app.view_functions[endpoint] = func\n\n extend(self.before_request_funcs, app.before_request_funcs)\n extend(self.after_request_funcs, app.after_request_funcs)\n extend(\n self.teardown_request_funcs,\n app.teardown_request_funcs,\n )\n extend(self.url_default_functions, app.url_default_functions)\n extend(self.url_value_preprocessors, app.url_value_preprocessors)\n extend(self.template_context_processors, app.template_context_processors)\n\n for deferred in self.deferred_functions:\n deferred(state)\n\n cli_resolved_group = options.get(\"cli_group\", self.cli_group)\n # ... other code", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register.if_self_cli_commands__Blueprint.register.for_blueprint_bp_options.blueprint_register_app_b": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.register.if_self_cli_commands__Blueprint.register.for_blueprint_bp_options.blueprint_register_app_b", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 364, "end_line": 402, "span_ids": ["Blueprint.register"], "tokens": 356}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n def register(self, app: \"Flask\", options: dict) -> None:\n # ... other code\n\n if self.cli.commands:\n if cli_resolved_group is None:\n app.cli.commands.update(self.cli.commands)\n elif cli_resolved_group is _sentinel:\n self.cli.name = name\n app.cli.add_command(self.cli)\n else:\n self.cli.name = cli_resolved_group\n app.cli.add_command(self.cli)\n\n for blueprint, bp_options in self._blueprints:\n bp_options = bp_options.copy()\n bp_url_prefix = bp_options.get(\"url_prefix\")\n bp_subdomain = bp_options.get(\"subdomain\")\n\n if bp_subdomain is None:\n bp_subdomain = blueprint.subdomain\n\n if state.subdomain is not None and bp_subdomain is not None:\n bp_options[\"subdomain\"] = bp_subdomain + \".\" + state.subdomain\n elif bp_subdomain is not None:\n bp_options[\"subdomain\"] = bp_subdomain\n elif state.subdomain is not None:\n bp_options[\"subdomain\"] = state.subdomain\n\n if bp_url_prefix is None:\n bp_url_prefix = blueprint.url_prefix\n\n if state.url_prefix is not None and bp_url_prefix is not None:\n bp_options[\"url_prefix\"] = (\n state.url_prefix.rstrip(\"/\") + \"/\" + bp_url_prefix.lstrip(\"/\")\n )\n elif bp_url_prefix is not None:\n bp_options[\"url_prefix\"] = bp_url_prefix\n elif state.url_prefix is not None:\n bp_options[\"url_prefix\"] = state.url_prefix\n\n bp_options[\"name_prefix\"] = name\n blueprint.register(app, bp_options)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_url_rule_Blueprint.add_url_rule.self_record_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.add_url_rule_Blueprint.add_url_rule.self_record_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 404, "end_line": 433, "span_ids": ["Blueprint.add_url_rule"], "tokens": 239}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def add_url_rule(\n self,\n rule: str,\n endpoint: t.Optional[str] = None,\n view_func: t.Optional[ft.RouteCallable] = None,\n provide_automatic_options: t.Optional[bool] = None,\n **options: t.Any,\n ) -> None:\n \"\"\"Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for\n full documentation.\n\n The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,\n used with :func:`url_for`, is prefixed with the blueprint's name.\n \"\"\"\n if endpoint and \".\" in endpoint:\n raise ValueError(\"'endpoint' may not contain a dot '.' character.\")\n\n if view_func and hasattr(view_func, \"__name__\") and \".\" in view_func.__name__:\n raise ValueError(\"'view_func' name may not contain a dot '.' character.\")\n\n self.record(\n lambda s: s.add_url_rule(\n rule,\n endpoint,\n view_func,\n provide_automatic_options=provide_automatic_options,\n **options,\n )\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.before_app_request_Blueprint.app_context_processor.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.before_app_request_Blueprint.app_context_processor.return.f", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 545, "end_line": 585, "span_ids": ["Blueprint.after_app_request", "Blueprint.teardown_app_request", "Blueprint.app_context_processor", "Blueprint.before_app_request"], "tokens": 362}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def before_app_request(self, f: T_before_request) -> T_before_request:\n \"\"\"Like :meth:`before_request`, but before every request, not only those handled\n by the blueprint. Equivalent to :meth:`.Flask.before_request`.\n \"\"\"\n self.record_once(\n lambda s: s.app.before_request_funcs.setdefault(None, []).append(f)\n )\n return f\n\n @setupmethod\n def after_app_request(self, f: T_after_request) -> T_after_request:\n \"\"\"Like :meth:`after_request`, but after every request, not only those handled\n by the blueprint. Equivalent to :meth:`.Flask.after_request`.\n \"\"\"\n self.record_once(\n lambda s: s.app.after_request_funcs.setdefault(None, []).append(f)\n )\n return f\n\n @setupmethod\n def teardown_app_request(self, f: T_teardown) -> T_teardown:\n \"\"\"Like :meth:`teardown_request`, but after every request, not only those\n handled by the blueprint. Equivalent to :meth:`.Flask.teardown_request`.\n \"\"\"\n self.record_once(\n lambda s: s.app.teardown_request_funcs.setdefault(None, []).append(f)\n )\n return f\n\n @setupmethod\n def app_context_processor(\n self, f: T_template_context_processor\n ) -> T_template_context_processor:\n \"\"\"Like :meth:`context_processor`, but for templates rendered by every view, not\n only by the blueprint. Equivalent to :meth:`.Flask.context_processor`.\n \"\"\"\n self.record_once(\n lambda s: s.app.template_context_processors.setdefault(None, []).append(f)\n )\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_errorhandler_Blueprint.app_errorhandler.return.decorator": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_errorhandler_Blueprint.app_errorhandler.return.decorator", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 587, "end_line": 599, "span_ids": ["Blueprint.app_errorhandler"], "tokens": 119}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def app_errorhandler(\n self, code: t.Union[t.Type[Exception], int]\n ) -> t.Callable[[T_error_handler], T_error_handler]:\n \"\"\"Like :meth:`errorhandler`, but for every request, not only those handled by\n the blueprint. Equivalent to :meth:`.Flask.errorhandler`.\n \"\"\"\n\n def decorator(f: T_error_handler) -> T_error_handler:\n self.record_once(lambda s: s.app.errorhandler(code)(f))\n return f\n\n return decorator", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_url_value_preprocessor_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/blueprints.py_Blueprint.app_url_value_preprocessor_", "embedding": null, "metadata": {"file_path": "src/flask/blueprints.py", "file_name": "blueprints.py", "file_type": "text/x-python", "category": "implementation", "start_line": 601, "end_line": 622, "span_ids": ["Blueprint.app_url_defaults", "Blueprint.app_url_value_preprocessor"], "tokens": 193}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Blueprint(Scaffold):\n\n @setupmethod\n def app_url_value_preprocessor(\n self, f: T_url_value_preprocessor\n ) -> T_url_value_preprocessor:\n \"\"\"Like :meth:`url_value_preprocessor`, but for every request, not only those\n handled by the blueprint. Equivalent to :meth:`.Flask.url_value_preprocessor`.\n \"\"\"\n self.record_once(\n lambda s: s.app.url_value_preprocessors.setdefault(None, []).append(f)\n )\n return f\n\n @setupmethod\n def app_url_defaults(self, f: T_url_defaults) -> T_url_defaults:\n \"\"\"Like :meth:`url_defaults`, but for every request, not only those handled by\n the blueprint. Equivalent to :meth:`.Flask.url_defaults`.\n \"\"\"\n self.record_once(\n lambda s: s.app.url_default_functions.setdefault(None, []).append(f)\n )\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_from___future___import_an_NoAppException._Raised_if_an_applicati": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_from___future___import_an_NoAppException._Raised_if_an_applicati", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 29, "span_ids": ["imports:20", "impl", "imports", "NoAppException"], "tokens": 139}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nimport ast\nimport inspect\nimport os\nimport platform\nimport re\nimport sys\nimport traceback\nimport typing as t\nfrom functools import update_wrapper\nfrom operator import attrgetter\n\nimport click\nfrom click.core import ParameterSource\nfrom werkzeug import run_simple\nfrom werkzeug.serving import is_running_from_reloader\nfrom werkzeug.utils import import_string\n\nfrom .globals import current_app\nfrom .helpers import get_debug_flag\nfrom .helpers import get_load_dotenv\n\nif t.TYPE_CHECKING:\n from .app import Flask\n\n\nclass NoAppException(click.UsageError):\n \"\"\"Raised if an application cannot be found or loaded.\"\"\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_locate_app_locate_app.if_app_name_is_None_.else_.return.find_app_by_string_module": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_locate_app_locate_app.if_app_name_is_None_.else_.return.find_app_by_string_module", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 216, "end_line": 237, "span_ids": ["locate_app"], "tokens": 180}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def locate_app(module_name, app_name, raise_if_not_found=True):\n try:\n __import__(module_name)\n except ImportError:\n # Reraise the ImportError if it occurred within the imported module.\n # Determine this by checking whether the trace has a depth > 1.\n if sys.exc_info()[2].tb_next:\n raise NoAppException(\n f\"While importing {module_name!r}, an ImportError was\"\n f\" raised:\\n\\n{traceback.format_exc()}\"\n ) from None\n elif raise_if_not_found:\n raise NoAppException(f\"Could not import {module_name!r}.\") from None\n else:\n return\n\n module = sys.modules[module_name]\n\n if app_name is None:\n return find_best_app(module)\n else:\n return find_app_by_string(module, app_name)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_app__app_option.click_Option_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_app__app_option.click_Option_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 393, "end_line": 418, "span_ids": ["_set_app", "impl:6"], "tokens": 236}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _set_app(ctx: click.Context, param: click.Option, value: str | None) -> str | None:\n if value is None:\n return None\n\n info = ctx.ensure_object(ScriptInfo)\n info.app_import_path = value\n return value\n\n\n# This option is eager so the app will be available if --help is given.\n# --help is also eager, so --app must be before it in the param list.\n# no_args_is_help bypasses eager processing, so this option must be\n# processed manually in that case to ensure FLASK_APP gets picked up.\n_app_option = click.Option(\n [\"-A\", \"--app\"],\n metavar=\"IMPORT\",\n help=(\n \"The Flask application or factory function to load, in the form 'module:name'.\"\n \" Module can be a dotted import or file path. Name is not required if it is\"\n \" 'app', 'application', 'create_app', or 'make_app', and can be 'name(args)' to\"\n \" pass arguments.\"\n ),\n is_eager=True,\n expose_value=False,\n callback=_set_app,\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_debug__set_debug.return.value": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__set_debug__set_debug.return.value", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 421, "end_line": 435, "span_ids": ["_set_debug"], "tokens": 148}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _set_debug(ctx: click.Context, param: click.Option, value: bool) -> bool | None:\n # If the flag isn't provided, it will default to False. Don't use\n # that, let debug be set by env in that case.\n source = ctx.get_parameter_source(param.name) # type: ignore[arg-type]\n\n if source is not None and source in (\n ParameterSource.DEFAULT,\n ParameterSource.DEFAULT_MAP,\n ):\n return None\n\n # Set with env var instead of ScriptInfo.load so that it can be\n # accessed early during a factory function.\n os.environ[\"FLASK_DEBUG\"] = \"1\" if value else \"0\"\n return value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__debug_option__env_file_option.click_Option_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py__debug_option__env_file_option.click_Option_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 438, "end_line": 478, "span_ids": ["impl:8", "_env_file_callback", "impl:10"], "tokens": 254}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "_debug_option = click.Option(\n [\"--debug/--no-debug\"],\n help=\"Set debug mode.\",\n expose_value=False,\n callback=_set_debug,\n)\n\n\ndef _env_file_callback(\n ctx: click.Context, param: click.Option, value: str | None\n) -> str | None:\n if value is None:\n return None\n\n import importlib\n\n try:\n importlib.import_module(\"dotenv\")\n except ImportError:\n raise click.BadParameter(\n \"python-dotenv must be installed to load an env file.\",\n ctx=ctx,\n param=param,\n ) from None\n\n # Don't check FLASK_SKIP_DOTENV, that only disables automatically\n # loading .env and .flaskenv files.\n load_dotenv(value)\n return value\n\n\n# This option is eager so env vars are loaded as early as possible to be\n# used by other options.\n_env_file_option = click.Option(\n [\"-e\", \"--env-file\"],\n type=click.Path(exists=True, dir_okay=False),\n help=\"Load environment variables from this file. python-dotenv must be installed.\",\n is_eager=True,\n expose_value=False,\n callback=_env_file_callback,\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup_FlaskGroup.__init__.self._loaded_plugin_commands.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup_FlaskGroup.__init__.self._loaded_plugin_commands.False", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 481, "end_line": 545, "span_ids": ["FlaskGroup"], "tokens": 599}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskGroup(AppGroup):\n \"\"\"Special subclass of the :class:`AppGroup` group that supports\n loading more commands from the configured Flask app. Normally a\n developer does not have to interface with this class but there are\n some very advanced use cases for which it makes sense to create an\n instance of this. see :ref:`custom-scripts`.\n\n :param add_default_commands: if this is True then the default run and\n shell commands will be added.\n :param add_version_option: adds the ``--version`` option.\n :param create_app: an optional callback that is passed the script info and\n returns the loaded app.\n :param load_dotenv: Load the nearest :file:`.env` and :file:`.flaskenv`\n files to set environment variables. Will also change the working\n directory to the directory containing the first file found.\n :param set_debug_flag: Set the app's debug flag.\n\n .. versionchanged:: 2.2\n Added the ``-A/--app``, ``--debug/--no-debug``, ``-e/--env-file`` options.\n\n .. versionchanged:: 2.2\n An app context is pushed when running ``app.cli`` commands, so\n ``@with_appcontext`` is no longer required for those commands.\n\n .. versionchanged:: 1.0\n If installed, python-dotenv will be used to load environment variables\n from :file:`.env` and :file:`.flaskenv` files.\n \"\"\"\n\n def __init__(\n self,\n add_default_commands: bool = True,\n create_app: t.Callable[..., Flask] | None = None,\n add_version_option: bool = True,\n load_dotenv: bool = True,\n set_debug_flag: bool = True,\n **extra: t.Any,\n ) -> None:\n params = list(extra.pop(\"params\", None) or ())\n # Processing is done with option callbacks instead of a group\n # callback. This allows users to make a custom group callback\n # without losing the behavior. --env-file must come first so\n # that it is eagerly evaluated before --app.\n params.extend((_env_file_option, _app_option, _debug_option))\n\n if add_version_option:\n params.append(version_option)\n\n if \"context_settings\" not in extra:\n extra[\"context_settings\"] = {}\n\n extra[\"context_settings\"].setdefault(\"auto_envvar_prefix\", \"FLASK\")\n\n super().__init__(params=params, **extra)\n\n self.create_app = create_app\n self.load_dotenv = load_dotenv\n self.set_debug_flag = set_debug_flag\n\n if add_default_commands:\n self.add_command(run_command)\n self.add_command(shell_command)\n self.add_command(routes_command)\n\n self._loaded_plugin_commands = False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup._load_plugin_commands_FlaskGroup._load_plugin_commands.self._loaded_plugin_commands.True": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup._load_plugin_commands_FlaskGroup._load_plugin_commands.self._loaded_plugin_commands.True", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 547, "end_line": 562, "span_ids": ["FlaskGroup._load_plugin_commands"], "tokens": 135}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskGroup(AppGroup):\n\n def _load_plugin_commands(self):\n if self._loaded_plugin_commands:\n return\n\n if sys.version_info >= (3, 10):\n from importlib import metadata\n else:\n # Use a backport on Python < 3.10. We technically have\n # importlib.metadata on 3.8+, but the API changed in 3.10,\n # so use the backport for consistency.\n import importlib_metadata as metadata\n\n for ep in metadata.entry_points(group=\"flask.commands\"):\n self.add_command(ep.load(), ep.name)\n\n self._loaded_plugin_commands = True", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.get_command_FlaskGroup.get_command.return.app_cli_get_command_ctx_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.get_command_FlaskGroup.get_command.return.app_cli_get_command_ctx_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 564, "end_line": 589, "span_ids": ["FlaskGroup.get_command"], "tokens": 226}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskGroup(AppGroup):\n\n def get_command(self, ctx, name):\n self._load_plugin_commands()\n # Look up built-in and plugin commands, which should be\n # available even if the app fails to load.\n rv = super().get_command(ctx, name)\n\n if rv is not None:\n return rv\n\n info = ctx.ensure_object(ScriptInfo)\n\n # Look up commands provided by the app, showing an error and\n # continuing if the app couldn't be loaded.\n try:\n app = info.load_app()\n except NoAppException as e:\n click.secho(f\"Error: {e.format_message()}\\n\", err=True, fg=\"red\")\n return None\n\n # Push an app context for the loaded app unless it is already\n # active somehow. This makes the context available to parameter\n # and command callbacks without needing @with_appcontext.\n if not current_app or current_app._get_current_object() is not app:\n ctx.with_resource(app.app_context())\n\n return app.cli.get_command(ctx, name)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.make_context__path_is_ancestor.return.os_path_join_path_other_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_FlaskGroup.make_context__path_is_ancestor.return.os_path_join_path_other_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 612, "end_line": 651, "span_ids": ["_path_is_ancestor", "FlaskGroup.make_context", "FlaskGroup.parse_args"], "tokens": 406}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskGroup(AppGroup):\n\n def make_context(\n self,\n info_name: str | None,\n args: list[str],\n parent: click.Context | None = None,\n **extra: t.Any,\n ) -> click.Context:\n # Set a flag to tell app.run to become a no-op. If app.run was\n # not in a __name__ == __main__ guard, it would start the server\n # when importing, blocking whatever command is being called.\n os.environ[\"FLASK_RUN_FROM_CLI\"] = \"true\"\n\n # Attempt to load .env and .flask env files. The --env-file\n # option can cause another file to be loaded.\n if get_load_dotenv(self.load_dotenv):\n load_dotenv()\n\n if \"obj\" not in extra and \"obj\" not in self.context_settings:\n extra[\"obj\"] = ScriptInfo(\n create_app=self.create_app, set_debug_flag=self.set_debug_flag\n )\n\n return super().make_context(info_name, args, parent=parent, **extra)\n\n def parse_args(self, ctx: click.Context, args: list[str]) -> list[str]:\n if not args and self.no_args_is_help:\n # Attempt to load --env-file and --app early in case they\n # were given as env vars. Otherwise no_args_is_help will not\n # see commands from app.cli.\n _env_file_option.handle_parse_result(ctx, {}, [])\n _app_option.handle_parse_result(ctx, {}, [])\n\n return super().parse_args(ctx, args)\n\n\ndef _path_is_ancestor(path, other):\n \"\"\"Take ``other`` and remove the length of ``path`` from it. Then join it\n to ``path``. If it is the original value, ``path`` is an ancestor of\n ``other``.\"\"\"\n return os.path.join(path, other[len(path) :].lstrip(os.sep)) == other", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_load_dotenv_load_dotenv._True_if_at_least_one_fi": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_load_dotenv_load_dotenv._True_if_at_least_one_fi", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 654, "end_line": 712, "span_ids": ["load_dotenv"], "tokens": 439}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def load_dotenv(path: str | os.PathLike | None = None) -> bool:\n \"\"\"Load \"dotenv\" files in order of precedence to set environment variables.\n\n If an env var is already set it is not overwritten, so earlier files in the\n list are preferred over later files.\n\n This is a no-op if `python-dotenv`_ is not installed.\n\n .. _python-dotenv: https://github.com/theskumar/python-dotenv#readme\n\n :param path: Load the file at this location instead of searching.\n :return: ``True`` if a file was loaded.\n\n .. versionchanged:: 2.0\n The current directory is not changed to the location of the\n loaded file.\n\n .. versionchanged:: 2.0\n When loading the env files, set the default encoding to UTF-8.\n\n .. versionchanged:: 1.1.0\n Returns ``False`` when python-dotenv is not installed, or when\n the given path isn't a file.\n\n .. versionadded:: 1.0\n \"\"\"\n try:\n import dotenv\n except ImportError:\n if path or os.path.isfile(\".env\") or os.path.isfile(\".flaskenv\"):\n click.secho(\n \" * Tip: There are .env or .flaskenv files present.\"\n ' Do \"pip install python-dotenv\" to use them.',\n fg=\"yellow\",\n err=True,\n )\n\n return False\n\n # Always return after attempting to load a given path, don't load\n # the default files.\n if path is not None:\n if os.path.isfile(path):\n return dotenv.load_dotenv(path, encoding=\"utf-8\")\n\n return False\n\n loaded = False\n\n for name in (\".env\", \".flaskenv\"):\n path = dotenv.find_dotenv(name, usecwd=True)\n\n if not path:\n continue\n\n dotenv.load_dotenv(path, encoding=\"utf-8\")\n loaded = True\n\n return loaded # True if at least one file was located and loaded.", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_show_server_banner_CertParamType.convert.None_1.except_click_BadParameter.raise": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_show_server_banner_CertParamType.convert.None_1.except_click_BadParameter.raise", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 715, "end_line": 772, "span_ids": ["show_server_banner", "CertParamType", "CertParamType.convert"], "tokens": 353}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def show_server_banner(debug, app_import_path):\n \"\"\"Show extra startup messages the first time the server is run,\n ignoring the reloader.\n \"\"\"\n if is_running_from_reloader():\n return\n\n if app_import_path is not None:\n click.echo(f\" * Serving Flask app '{app_import_path}'\")\n\n if debug is not None:\n click.echo(f\" * Debug mode: {'on' if debug else 'off'}\")\n\n\nclass CertParamType(click.ParamType):\n \"\"\"Click option type for the ``--cert`` option. Allows either an\n existing file, the string ``'adhoc'``, or an import for a\n :class:`~ssl.SSLContext` object.\n \"\"\"\n\n name = \"path\"\n\n def __init__(self):\n self.path_type = click.Path(exists=True, dir_okay=False, resolve_path=True)\n\n def convert(self, value, param, ctx):\n try:\n import ssl\n except ImportError:\n raise click.BadParameter(\n 'Using \"--cert\" requires Python to be compiled with SSL support.',\n ctx,\n param,\n ) from None\n\n try:\n return self.path_type(value, param, ctx)\n except click.BadParameter:\n value = click.STRING(value, param, ctx).lower()\n\n if value == \"adhoc\":\n try:\n import cryptography # noqa: F401\n except ImportError:\n raise click.BadParameter(\n \"Using ad-hoc certificates requires the cryptography library.\",\n ctx,\n param,\n ) from None\n\n return value\n\n obj = import_string(value, silent=True)\n\n if isinstance(obj, ssl.SSLContext):\n return obj\n\n raise", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_params_insert_shell_command.code_interact_banner_bann": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_run_command_params_insert_shell_command.code_interact_banner_bann", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 936, "end_line": 985, "span_ids": ["impl:12", "shell_command"], "tokens": 371}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "run_command.params.insert(0, _debug_option)\n\n\n@click.command(\"shell\", short_help=\"Run a shell in the app context.\")\n@with_appcontext\ndef shell_command() -> None:\n \"\"\"Run an interactive Python shell in the context of a given\n Flask application. The application will populate the default\n namespace of this shell according to its configuration.\n\n This is useful for executing small snippets of management code\n without having to manually configure the application.\n \"\"\"\n import code\n\n banner = (\n f\"Python {sys.version} on {sys.platform}\\n\"\n f\"App: {current_app.import_name}\\n\"\n f\"Instance: {current_app.instance_path}\"\n )\n ctx: dict = {}\n\n # Support the regular Python interpreter startup script if someone\n # is using it.\n startup = os.environ.get(\"PYTHONSTARTUP\")\n if startup and os.path.isfile(startup):\n with open(startup) as f:\n eval(compile(f.read(), startup, \"exec\"), ctx)\n\n ctx.update(current_app.make_shell_context())\n\n # Site, customize, or startup script can set a hook to call when\n # entering interactive mode. The default one sets up readline with\n # tab and history completion.\n interactive_hook = getattr(sys, \"__interactivehook__\", None)\n\n if interactive_hook is not None:\n try:\n import readline\n from rlcompleter import Completer\n except ImportError:\n pass\n else:\n # rlcompleter uses __main__.__dict__ by default, which is\n # flask.__main__. Use the shell context instead.\n readline.set_completer(Completer(ctx).complete)\n\n interactive_hook()\n\n code.interact(banner=banner, local=ctx)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_routes_command_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/cli.py_routes_command_", "embedding": null, "metadata": {"file_path": "src/flask/cli.py", "file_name": "cli.py", "file_type": "text/x-python", "category": "implementation", "start_line": 988, "end_line": 1055, "span_ids": ["main", "impl:15", "impl:13", "routes_command"], "tokens": 497}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@click.command(\"routes\", short_help=\"Show the routes for the app.\")\n@click.option(\n \"--sort\",\n \"-s\",\n type=click.Choice((\"endpoint\", \"methods\", \"rule\", \"match\")),\n default=\"endpoint\",\n help=(\n 'Method to sort routes by. \"match\" is the order that Flask will match '\n \"routes when dispatching a request.\"\n ),\n)\n@click.option(\"--all-methods\", is_flag=True, help=\"Show HEAD and OPTIONS methods.\")\n@with_appcontext\ndef routes_command(sort: str, all_methods: bool) -> None:\n \"\"\"Show all registered routes with endpoints and methods.\"\"\"\n\n rules = list(current_app.url_map.iter_rules())\n if not rules:\n click.echo(\"No routes were registered.\")\n return\n\n ignored_methods = set(() if all_methods else (\"HEAD\", \"OPTIONS\"))\n\n if sort in (\"endpoint\", \"rule\"):\n rules = sorted(rules, key=attrgetter(sort))\n elif sort == \"methods\":\n rules = sorted(rules, key=lambda rule: sorted(rule.methods)) # type: ignore\n\n rule_methods = [\n \", \".join(sorted(rule.methods - ignored_methods)) # type: ignore\n for rule in rules\n ]\n\n headers = (\"Endpoint\", \"Methods\", \"Rule\")\n widths = (\n max(len(rule.endpoint) for rule in rules),\n max(len(methods) for methods in rule_methods),\n max(len(rule.rule) for rule in rules),\n )\n widths = [max(len(h), w) for h, w in zip(headers, widths)]\n row = \"{{0:<{0}}} {{1:<{1}}} {{2:<{2}}}\".format(*widths)\n\n click.echo(row.format(*headers).strip())\n click.echo(row.format(*(\"-\" * width for width in widths)))\n\n for rule, methods in zip(rules, rule_methods):\n click.echo(row.format(rule.endpoint, methods, rule.rule).rstrip())\n\n\ncli = FlaskGroup(\n name=\"flask\",\n help=\"\"\"\\\nA general utility script for Flask applications.\n\nAn application to load must be given with the '--app' option,\n'FLASK_APP' environment variable, or with a 'wsgi.py' or 'app.py' file\nin the current directory.\n\"\"\",\n)\n\n\ndef main() -> None:\n cli.main()\n\n\nif __name__ == \"__main__\":\n main()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_prefixed_env_Config.from_prefixed_env.return.True": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/config.py_Config.from_prefixed_env_Config.from_prefixed_env.return.True", "embedding": null, "metadata": {"file_path": "src/flask/config.py", "file_name": "config.py", "file_type": "text/x-python", "category": "implementation", "start_line": 101, "end_line": 163, "span_ids": ["Config.from_prefixed_env"], "tokens": 456}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Config(dict):\n\n def from_prefixed_env(\n self, prefix: str = \"FLASK\", *, loads: t.Callable[[str], t.Any] = json.loads\n ) -> bool:\n \"\"\"Load any environment variables that start with ``FLASK_``,\n dropping the prefix from the env key for the config key. Values\n are passed through a loading function to attempt to convert them\n to more specific types than strings.\n\n Keys are loaded in :func:`sorted` order.\n\n The default loading function attempts to parse values as any\n valid JSON type, including dicts and lists.\n\n Specific items in nested dicts can be set by separating the\n keys with double underscores (``__``). If an intermediate key\n doesn't exist, it will be initialized to an empty dict.\n\n :param prefix: Load env vars that start with this prefix,\n separated with an underscore (``_``).\n :param loads: Pass each string value to this function and use\n the returned value as the config value. If any error is\n raised it is ignored and the value remains a string. The\n default is :func:`json.loads`.\n\n .. versionadded:: 2.1\n \"\"\"\n prefix = f\"{prefix}_\"\n len_prefix = len(prefix)\n\n for key in sorted(os.environ):\n if not key.startswith(prefix):\n continue\n\n value = os.environ[key]\n\n try:\n value = loads(value)\n except Exception:\n # Keep the value as a string if loading failed.\n pass\n\n # Change to key.removeprefix(prefix) on Python >= 3.9.\n key = key[len_prefix:]\n\n if \"__\" not in key:\n # A non-nested key, set directly.\n self[key] = value\n continue\n\n # Traverse nested dictionaries with keys separated by \"__\".\n current = self\n *parts, tail = key.split(\"__\")\n\n for part in parts:\n # If an intermediate dict does not exist, create it.\n if part not in current:\n current[part] = {}\n\n current = current[part]\n\n current[tail] = value\n\n return True", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_contextvars__sentinel.object_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_contextvars__sentinel.object_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 22, "span_ids": ["impl", "impl:2", "imports:11", "imports", "imports:7", "impl:3"], "tokens": 124}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import contextvars\nimport sys\nimport typing as t\nfrom functools import update_wrapper\nfrom types import TracebackType\n\nfrom werkzeug.exceptions import HTTPException\n\nfrom . import typing as ft\nfrom .globals import _cv_app\nfrom .globals import _cv_request\nfrom .signals import appcontext_popped\nfrom .signals import appcontext_pushed\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .app import Flask\n from .sessions import SessionMixin\n from .wrappers import Request\n\n\n# a singleton sentinel value for parameter defaults\n_sentinel = object()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals__AppCtxGlobals.get.return.self___dict___get_name_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py__AppCtxGlobals__AppCtxGlobals.get.return.self___dict___get_name_d", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 25, "end_line": 72, "span_ids": ["_AppCtxGlobals.get", "_AppCtxGlobals.__delattr__", "_AppCtxGlobals.__setattr__", "_AppCtxGlobals", "_AppCtxGlobals.__getattr__"], "tokens": 329}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class _AppCtxGlobals:\n \"\"\"A plain object. Used as a namespace for storing data during an\n application context.\n\n Creating an app context automatically creates this object, which is\n made available as the :data:`g` proxy.\n\n .. describe:: 'key' in g\n\n Check whether an attribute is present.\n\n .. versionadded:: 0.10\n\n .. describe:: iter(g)\n\n Return an iterator over the attribute names.\n\n .. versionadded:: 0.10\n \"\"\"\n\n # Define attr methods to let mypy know this is a namespace object\n # that has arbitrary attributes.\n\n def __getattr__(self, name: str) -> t.Any:\n try:\n return self.__dict__[name]\n except KeyError:\n raise AttributeError(name) from None\n\n def __setattr__(self, name: str, value: t.Any) -> None:\n self.__dict__[name] = value\n\n def __delattr__(self, name: str) -> None:\n try:\n del self.__dict__[name]\n except KeyError:\n raise AttributeError(name) from None\n\n def get(self, name: str, default: t.Optional[t.Any] = None) -> t.Any:\n \"\"\"Get an attribute by name, or a default value. Like\n :meth:`dict.get`.\n\n :param name: Name of attribute to get.\n :param default: Value to return if the attribute is not present.\n\n .. versionadded:: 0.10\n \"\"\"\n return self.__dict__.get(name, default)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_request_context_has_request_context.return._cv_request_get_None_is_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_has_request_context_has_request_context.return._cv_request_get_None_is_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 187, "end_line": 216, "span_ids": ["has_request_context"], "tokens": 227}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def has_request_context() -> bool:\n \"\"\"If you have code that wants to test if a request context is there or\n not this function can be used. For instance, you may want to take advantage\n of request information if the request object is available, but fail\n silently if it is unavailable.\n\n ::\n\n class User(db.Model):\n\n def __init__(self, username, remote_addr=None):\n self.username = username\n if remote_addr is None and has_request_context():\n remote_addr = request.remote_addr\n self.remote_addr = remote_addr\n\n Alternatively you can also just test any of the context bound objects\n (such as :class:`request` or :class:`g`) for truthness::\n\n class User(db.Model):\n\n def __init__(self, username, remote_addr=None):\n self.username = username\n if remote_addr is None and request:\n remote_addr = request.remote_addr\n self.remote_addr = remote_addr\n\n .. versionadded:: 0.7\n \"\"\"\n return _cv_request.get(None) is not None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext_RequestContext.__init__.self._cv_tokens._": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext_RequestContext.__init__.self._cv_tokens._", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 278, "end_line": 324, "span_ids": ["RequestContext"], "tokens": 444}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class RequestContext:\n \"\"\"The request context contains per-request information. The Flask\n app creates and pushes it at the beginning of the request, then pops\n it at the end of the request. It will create the URL adapter and\n request object for the WSGI environment provided.\n\n Do not attempt to use this class directly, instead use\n :meth:`~flask.Flask.test_request_context` and\n :meth:`~flask.Flask.request_context` to create this object.\n\n When the request context is popped, it will evaluate all the\n functions registered on the application for teardown execution\n (:meth:`~flask.Flask.teardown_request`).\n\n The request context is automatically popped at the end of the\n request. When using the interactive debugger, the context will be\n restored so ``request`` is still accessible. Similarly, the test\n client can preserve the context after the request ends. However,\n teardown functions may already have closed some resources such as\n database connections.\n \"\"\"\n\n def __init__(\n self,\n app: \"Flask\",\n environ: dict,\n request: t.Optional[\"Request\"] = None,\n session: t.Optional[\"SessionMixin\"] = None,\n ) -> None:\n self.app = app\n if request is None:\n request = app.request_class(environ)\n request.json_module = app.json\n self.request: Request = request\n self.url_adapter = None\n try:\n self.url_adapter = app.create_url_adapter(self.request)\n except HTTPException as e:\n self.request.routing_exception = e\n self.flashes: t.Optional[t.List[t.Tuple[str, str]]] = None\n self.session: t.Optional[\"SessionMixin\"] = session\n # Functions that should be executed after the request on the response\n # object. These will be called before the regular \"after_request\"\n # functions.\n self._after_request_functions: t.List[ft.AfterRequestCallable] = []\n\n self._cv_tokens: t.List[t.Tuple[contextvars.Token, t.Optional[AppContext]]] = []", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.push_RequestContext.push.if_self_url_adapter_is_no.self_match_request_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.push_RequestContext.push.if_self_url_adapter_is_no.self_match_request_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 356, "end_line": 383, "span_ids": ["RequestContext.push"], "tokens": 243}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class RequestContext:\n\n def push(self) -> None:\n # Before we push the request context we have to ensure that there\n # is an application context.\n app_ctx = _cv_app.get(None)\n\n if app_ctx is None or app_ctx.app is not self.app:\n app_ctx = self.app.app_context()\n app_ctx.push()\n else:\n app_ctx = None\n\n self._cv_tokens.append((_cv_request.set(self), app_ctx))\n\n # Open the session at the moment that the request context is available.\n # This allows a custom open_session method to use the request context.\n # Only open a new session if this is the first time the request was\n # pushed, otherwise stream_with_context loses the session.\n if self.session is None:\n session_interface = self.app.session_interface\n self.session = session_interface.open_session(self.app, self.request)\n\n if self.session is None:\n self.session = session_interface.make_null_session(self.app)\n\n # Match the request URL after loading the session, so that the\n # session is available in custom URL converters.\n if self.url_adapter is not None:\n self.match_request()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.pop_RequestContext.pop.try_.finally_.if_ctx_is_not_self_.raise_AssertionError_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.pop_RequestContext.pop.try_.finally_.if_ctx_is_not_self_.raise_AssertionError_", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 385, "end_line": 420, "span_ids": ["RequestContext.pop"], "tokens": 290}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class RequestContext:\n\n def pop(self, exc: t.Optional[BaseException] = _sentinel) -> None: # type: ignore\n \"\"\"Pops the request context and unbinds it by doing that. This will\n also trigger the execution of functions registered by the\n :meth:`~flask.Flask.teardown_request` decorator.\n\n .. versionchanged:: 0.9\n Added the `exc` argument.\n \"\"\"\n clear_request = len(self._cv_tokens) == 1\n\n try:\n if clear_request:\n if exc is _sentinel:\n exc = sys.exc_info()[1]\n self.app.do_teardown_request(exc)\n\n request_close = getattr(self.request, \"close\", None)\n if request_close is not None:\n request_close()\n finally:\n ctx = _cv_request.get()\n token, app_ctx = self._cv_tokens.pop()\n _cv_request.reset(token)\n\n # get rid of circular dependencies at the end of the request\n # so that we don't require the GC to be active.\n if clear_request:\n ctx.request.environ[\"werkzeug.request\"] = None\n\n if app_ctx is not None:\n app_ctx.pop(exc)\n\n if ctx is not self:\n raise AssertionError(\n f\"Popped wrong request context. ({ctx!r} instead of {self!r})\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.__enter___": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/ctx.py_RequestContext.__enter___", "embedding": null, "metadata": {"file_path": "src/flask/ctx.py", "file_name": "ctx.py", "file_type": "text/x-python", "category": "implementation", "start_line": 422, "end_line": 439, "span_ids": ["RequestContext.__exit__", "RequestContext.__enter__", "RequestContext.__repr__"], "tokens": 117}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class RequestContext:\n\n def __enter__(self) -> \"RequestContext\":\n self.push()\n return self\n\n def __exit__(\n self,\n exc_type: t.Optional[type],\n exc_value: t.Optional[BaseException],\n tb: t.Optional[TracebackType],\n ) -> None:\n self.pop(exc_value)\n\n def __repr__(self) -> str:\n return (\n f\"<{type(self).__name__} {self.request.url!r}\"\n f\" [{self.request.method}] of {self.app.name}>\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_t_DebugFilesKeyError.__str__.return.self_msg": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_t_DebugFilesKeyError.__str__.return.self_msg", "embedding": null, "metadata": {"file_path": "src/flask/debughelpers.py", "file_name": "debughelpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 38, "span_ids": ["DebugFilesKeyError.__str__", "UnexpectedUnicodeError", "DebugFilesKeyError", "imports"], "tokens": 287}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\nfrom .app import Flask\nfrom .blueprints import Blueprint\nfrom .globals import request_ctx\n\n\nclass UnexpectedUnicodeError(AssertionError, UnicodeError):\n \"\"\"Raised in places where we want some better error reporting for\n unexpected unicode or binary data.\n \"\"\"\n\n\nclass DebugFilesKeyError(KeyError, AssertionError):\n \"\"\"Raised from request.files during debugging. The idea is that it can\n provide a better error message than just a generic KeyError/BadRequest.\n \"\"\"\n\n def __init__(self, request, key):\n form_matches = request.form.getlist(key)\n buf = [\n f\"You tried to access the file {key!r} in the request.files\"\n \" dictionary but it does not exist. The mimetype for the\"\n f\" request is {request.mimetype!r} instead of\"\n \" 'multipart/form-data' which means that no file contents\"\n \" were transmitted. To fix this error you should provide\"\n ' enctype=\"multipart/form-data\" in your form.'\n ]\n if form_matches:\n names = \", \".join(repr(x) for x in form_matches)\n buf.append(\n \"\\n\\nThe browser instead transmitted some file names. \"\n f\"This was submitted: {names}\"\n )\n self.msg = \"\".join(buf)\n\n def __str__(self):\n return self.msg", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_FormDataRoutingRedirect_FormDataRoutingRedirect.__init__.super___init___join_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/debughelpers.py_FormDataRoutingRedirect_FormDataRoutingRedirect.__init__.super___init___join_", "embedding": null, "metadata": {"file_path": "src/flask/debughelpers.py", "file_name": "debughelpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 41, "end_line": 68, "span_ids": ["FormDataRoutingRedirect"], "tokens": 238}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FormDataRoutingRedirect(AssertionError):\n \"\"\"This exception is raised in debug mode if a routing redirect\n would cause the browser to drop the method or body. This happens\n when method is not GET, HEAD or OPTIONS and the status code is not\n 307 or 308.\n \"\"\"\n\n def __init__(self, request):\n exc = request.routing_exception\n buf = [\n f\"A request was sent to '{request.url}', but routing issued\"\n f\" a redirect to the canonical URL '{exc.new_url}'.\"\n ]\n\n if f\"{request.base_url}/\" == exc.new_url.partition(\"?\")[0]:\n buf.append(\n \" The URL was defined with a trailing slash. Flask\"\n \" will redirect to the URL with a trailing slash if it\"\n \" was accessed without one.\"\n )\n\n buf.append(\n \" Send requests to the canonical URL, or use 307 or 308 for\"\n \" routing redirects. Otherwise, browsers will drop form\"\n \" data.\\n\\n\"\n \"This exception is only raised in debug mode.\"\n )\n super().__init__(\"\".join(buf))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py_t__FakeStack.top.return.self_cv_get_None_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py_t__FakeStack.top.return.self_cv_get_None_", "embedding": null, "metadata": {"file_path": "src/flask/globals.py", "file_name": "globals.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 31, "span_ids": ["impl", "_FakeStack", "imports:4", "_FakeStack.top", "imports"], "tokens": 213}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\nfrom contextvars import ContextVar\n\nfrom werkzeug.local import LocalProxy\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .app import Flask\n from .ctx import _AppCtxGlobals\n from .ctx import AppContext\n from .ctx import RequestContext\n from .sessions import SessionMixin\n from .wrappers import Request\n\n\nclass _FakeStack:\n def __init__(self, name: str, cv: ContextVar[t.Any]) -> None:\n self.name = name\n self.cv = cv\n\n @property\n def top(self) -> t.Optional[t.Any]:\n import warnings\n\n warnings.warn(\n f\"'_{self.name}_ctx_stack' is deprecated and will be removed in Flask 2.4.\"\n f\" Use 'g' to store data, or '{self.name}_ctx' to access the current\"\n \" context.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return self.cv.get(None)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py__no_app_msg_session.LocalProxy_type_igno": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py__no_app_msg_session.LocalProxy_type_igno", "embedding": null, "metadata": {"file_path": "src/flask/globals.py", "file_name": "globals.py", "file_type": "text/x-python", "category": "implementation", "start_line": 34, "end_line": 70, "span_ids": ["impl:2"], "tokens": 371}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "_no_app_msg = \"\"\"\\\nWorking outside of application context.\n\nThis typically means that you attempted to use functionality that needed\nthe current application. To solve this, set up an application context\nwith app.app_context(). See the documentation for more information.\\\n\"\"\"\n_cv_app: ContextVar[\"AppContext\"] = ContextVar(\"flask.app_ctx\")\n__app_ctx_stack = _FakeStack(\"app\", _cv_app)\napp_ctx: \"AppContext\" = LocalProxy( # type: ignore[assignment]\n _cv_app, unbound_message=_no_app_msg\n)\ncurrent_app: \"Flask\" = LocalProxy( # type: ignore[assignment]\n _cv_app, \"app\", unbound_message=_no_app_msg\n)\ng: \"_AppCtxGlobals\" = LocalProxy( # type: ignore[assignment]\n _cv_app, \"g\", unbound_message=_no_app_msg\n)\n\n_no_req_msg = \"\"\"\\\nWorking outside of request context.\n\nThis typically means that you attempted to use functionality that needed\nan active HTTP request. Consult the documentation on testing for\ninformation about how to avoid this problem.\\\n\"\"\"\n_cv_request: ContextVar[\"RequestContext\"] = ContextVar(\"flask.request_ctx\")\n__request_ctx_stack = _FakeStack(\"request\", _cv_request)\nrequest_ctx: \"RequestContext\" = LocalProxy( # type: ignore[assignment]\n _cv_request, unbound_message=_no_req_msg\n)\nrequest: \"Request\" = LocalProxy( # type: ignore[assignment]\n _cv_request, \"request\", unbound_message=_no_req_msg\n)\nsession: \"SessionMixin\" = LocalProxy( # type: ignore[assignment]\n _cv_request, \"session\", unbound_message=_no_req_msg\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py___getattr___": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/globals.py___getattr___", "embedding": null, "metadata": {"file_path": "src/flask/globals.py", "file_name": "globals.py", "file_type": "text/x-python", "category": "implementation", "start_line": 73, "end_line": 95, "span_ids": ["__getattr__"], "tokens": 133}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def __getattr__(name: str) -> t.Any:\n if name == \"_app_ctx_stack\":\n import warnings\n\n warnings.warn(\n \"'_app_ctx_stack' is deprecated and will be removed in Flask 2.4.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return __app_ctx_stack\n\n if name == \"_request_ctx_stack\":\n import warnings\n\n warnings.warn(\n \"'_request_ctx_stack' is deprecated and will be removed in Flask 2.4.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return __request_ctx_stack\n\n raise AttributeError(name)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_os_get_debug_flag.return.bool_val_and_val_lower_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_os_get_debug_flag.return.bool_val_and_val_lower_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 33, "span_ids": ["get_debug_flag", "impl", "imports:19", "imports"], "tokens": 229}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import os\nimport pkgutil\nimport socket\nimport sys\nimport typing as t\nfrom datetime import datetime\nfrom functools import lru_cache\nfrom functools import update_wrapper\nfrom threading import RLock\n\nimport werkzeug.utils\nfrom werkzeug.exceptions import abort as _wz_abort\nfrom werkzeug.utils import redirect as _wz_redirect\n\nfrom .globals import _cv_request\nfrom .globals import current_app\nfrom .globals import request\nfrom .globals import request_ctx\nfrom .globals import session\nfrom .signals import message_flashed\n\nif t.TYPE_CHECKING: # pragma: no cover\n from werkzeug.wrappers import Response as BaseResponse\n from .wrappers import Response\n import typing_extensions as te\n\n\ndef get_debug_flag() -> bool:\n \"\"\"Get whether debug mode should be enabled for the app, indicated by the\n :envvar:`FLASK_DEBUG` environment variable. The default is ``False``.\n \"\"\"\n val = os.environ.get(\"FLASK_DEBUG\")\n return bool(val and val.lower() not in {\"0\", \"false\", \"no\"})", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_make_response_make_response._type_ignore": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_make_response_make_response._type_ignore", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 130, "end_line": 176, "span_ids": ["make_response"], "tokens": 421}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def make_response(*args: t.Any) -> \"Response\":\n \"\"\"Sometimes it is necessary to set additional headers in a view. Because\n views do not have to return response objects but can return a value that\n is converted into a response object by Flask itself, it becomes tricky to\n add headers to it. This function can be called instead of using a return\n and you will get a response object which you can use to attach headers.\n\n If view looked like this and you want to add a new header::\n\n def index():\n return render_template('index.html', foo=42)\n\n You can now do something like this::\n\n def index():\n response = make_response(render_template('index.html', foo=42))\n response.headers['X-Parachutes'] = 'parachutes are cool'\n return response\n\n This function accepts the very same arguments you can return from a\n view function. This for example creates a response with a 404 error\n code::\n\n response = make_response(render_template('not_found.html'), 404)\n\n The other use case of this function is to force the return value of a\n view function into a response which is helpful with view\n decorators::\n\n response = make_response(view_function())\n response.headers['X-Parachutes'] = 'parachutes are cool'\n\n Internally this function does the following things:\n\n - if no arguments are passed, it creates a new response argument\n - if one argument is passed, :meth:`flask.Flask.make_response`\n is invoked with it.\n - if more than one argument is passed, the arguments are passed\n to the :meth:`flask.Flask.make_response` function as tuple.\n\n .. versionadded:: 0.6\n \"\"\"\n if not args:\n return current_app.response_class()\n if len(args) == 1:\n args = args[0]\n return current_app.make_response(args) # type: ignore", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_url_for_url_for.return.current_app_url_for_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_url_for_url_for.return.current_app_url_for_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 179, "end_line": 230, "span_ids": ["url_for"], "tokens": 455}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def url_for(\n endpoint: str,\n *,\n _anchor: t.Optional[str] = None,\n _method: t.Optional[str] = None,\n _scheme: t.Optional[str] = None,\n _external: t.Optional[bool] = None,\n **values: t.Any,\n) -> str:\n \"\"\"Generate a URL to the given endpoint with the given values.\n\n This requires an active request or application context, and calls\n :meth:`current_app.url_for() `. See that method\n for full documentation.\n\n :param endpoint: The endpoint name associated with the URL to\n generate. If this starts with a ``.``, the current blueprint\n name (if any) will be used.\n :param _anchor: If given, append this as ``#anchor`` to the URL.\n :param _method: If given, generate the URL associated with this\n method for the endpoint.\n :param _scheme: If given, the URL will have this scheme if it is\n external.\n :param _external: If given, prefer the URL to be internal (False) or\n require it to be external (True). External URLs include the\n scheme and domain. When not in an active request, URLs are\n external by default.\n :param values: Values to use for the variable parts of the URL rule.\n Unknown keys are appended as query string arguments, like\n ``?a=b&c=d``.\n\n .. versionchanged:: 2.2\n Calls ``current_app.url_for``, allowing an app to override the\n behavior.\n\n .. versionchanged:: 0.10\n The ``_scheme`` parameter was added.\n\n .. versionchanged:: 0.9\n The ``_anchor`` and ``_method`` parameters were added.\n\n .. versionchanged:: 0.9\n Calls ``app.handle_url_build_error`` on build errors.\n \"\"\"\n return current_app.url_for(\n endpoint,\n _anchor=_anchor,\n _method=_method,\n _scheme=_scheme,\n _external=_external,\n **values,\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_redirect_redirect.return._wz_redirect_location_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_redirect_redirect.return._wz_redirect_location_co", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 233, "end_line": 254, "span_ids": ["redirect"], "tokens": 207}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def redirect(\n location: str, code: int = 302, Response: t.Optional[t.Type[\"BaseResponse\"]] = None\n) -> \"BaseResponse\":\n \"\"\"Create a redirect response object.\n\n If :data:`~flask.current_app` is available, it will use its\n :meth:`~flask.Flask.redirect` method, otherwise it will use\n :func:`werkzeug.utils.redirect`.\n\n :param location: The URL to redirect to.\n :param code: The status code for the redirect.\n :param Response: The response class to use. Not used when\n ``current_app`` is active, which uses ``app.response_class``.\n\n .. versionadded:: 2.2\n Calls ``current_app.redirect`` if available instead of always\n using Werkzeug's default ``redirect``.\n \"\"\"\n if current_app:\n return current_app.redirect(location, code=code)\n\n return _wz_redirect(location, code=code, Response=Response)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_abort_abort._wz_abort_code_args_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_abort_abort._wz_abort_code_args_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 257, "end_line": 279, "span_ids": ["abort"], "tokens": 212}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def abort(\n code: t.Union[int, \"BaseResponse\"], *args: t.Any, **kwargs: t.Any\n) -> \"te.NoReturn\":\n \"\"\"Raise an :exc:`~werkzeug.exceptions.HTTPException` for the given\n status code.\n\n If :data:`~flask.current_app` is available, it will call its\n :attr:`~flask.Flask.aborter` object, otherwise it will use\n :func:`werkzeug.exceptions.abort`.\n\n :param code: The status code for the exception, which must be\n registered in ``app.aborter``.\n :param args: Passed to the exception.\n :param kwargs: Passed to the exception.\n\n .. versionadded:: 2.2\n Calls ``current_app.aborter`` if available instead of always\n using Werkzeug's default ``abort``.\n \"\"\"\n if current_app:\n current_app.aborter(code, *args, **kwargs)\n\n _wz_abort(code, *args, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_flashed_messages__prepare_send_file_kwargs.return.kwargs": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_get_flashed_messages__prepare_send_file_kwargs.return.kwargs", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 336, "end_line": 388, "span_ids": ["_prepare_send_file_kwargs", "get_flashed_messages"], "tokens": 499}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def get_flashed_messages(\n with_categories: bool = False, category_filter: t.Iterable[str] = ()\n) -> t.Union[t.List[str], t.List[t.Tuple[str, str]]]:\n \"\"\"Pulls all flashed messages from the session and returns them.\n Further calls in the same request to the function will return\n the same messages. By default just the messages are returned,\n but when `with_categories` is set to ``True``, the return value will\n be a list of tuples in the form ``(category, message)`` instead.\n\n Filter the flashed messages to one or more categories by providing those\n categories in `category_filter`. This allows rendering categories in\n separate html blocks. The `with_categories` and `category_filter`\n arguments are distinct:\n\n * `with_categories` controls whether categories are returned with message\n text (``True`` gives a tuple, where ``False`` gives just the message text).\n * `category_filter` filters the messages down to only those matching the\n provided categories.\n\n See :doc:`/patterns/flashing` for examples.\n\n .. versionchanged:: 0.3\n `with_categories` parameter added.\n\n .. versionchanged:: 0.9\n `category_filter` parameter added.\n\n :param with_categories: set to ``True`` to also receive categories.\n :param category_filter: filter of categories to limit return values. Only\n categories in the list will be returned.\n \"\"\"\n flashes = request_ctx.flashes\n if flashes is None:\n flashes = session.pop(\"_flashes\") if \"_flashes\" in session else []\n request_ctx.flashes = flashes\n if category_filter:\n flashes = list(filter(lambda f: f[0] in category_filter, flashes))\n if not with_categories:\n return [x[1] for x in flashes]\n return flashes\n\n\ndef _prepare_send_file_kwargs(**kwargs: t.Any) -> t.Dict[str, t.Any]:\n if kwargs.get(\"max_age\") is None:\n kwargs[\"max_age\"] = current_app.get_send_file_max_age\n\n kwargs.update(\n environ=request.environ,\n use_x_sendfile=current_app.config[\"USE_X_SENDFILE\"],\n response_class=current_app.response_class,\n _root_path=current_app.root_path, # type: ignore\n )\n return kwargs", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_is_ip_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/helpers.py_is_ip_", "embedding": null, "metadata": {"file_path": "src/flask/helpers.py", "file_name": "helpers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 657, "end_line": 685, "span_ids": ["is_ip", "_split_blueprint_path"], "tokens": 161}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def is_ip(value: str) -> bool:\n \"\"\"Determine if the given string is an IP address.\n\n :param value: value to check\n :type value: str\n\n :return: True if string is an IP address\n :rtype: bool\n \"\"\"\n for family in (socket.AF_INET, socket.AF_INET6):\n try:\n socket.inet_pton(family, value)\n except OSError:\n pass\n else:\n return True\n\n return False\n\n\n@lru_cache(maxsize=None)\ndef _split_blueprint_path(name: str) -> t.List[str]:\n out: t.List[str] = [name]\n\n if \".\" in name:\n out.extend(_split_blueprint_path(name.rpartition(\".\")[0]))\n\n return out", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_from___future___import_an_dumps.return._json_dumps_obj_kwargs": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_from___future___import_an_dumps.return._json_dumps_obj_kwargs", "embedding": null, "metadata": {"file_path": "src/flask/json/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 44, "span_ids": ["impl", "imports:6", "imports", "dumps"], "tokens": 316}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nimport json as _json\nimport typing as t\n\nfrom ..globals import current_app\nfrom .provider import _default\n\nif t.TYPE_CHECKING: # pragma: no cover\n from ..wrappers import Response\n\n\ndef dumps(obj: t.Any, **kwargs: t.Any) -> str:\n \"\"\"Serialize data as JSON.\n\n If :data:`~flask.current_app` is available, it will use its\n :meth:`app.json.dumps() `\n method, otherwise it will use :func:`json.dumps`.\n\n :param obj: The data to serialize.\n :param kwargs: Arguments passed to the ``dumps`` implementation.\n\n .. versionchanged:: 2.3\n The ``app`` parameter was removed.\n\n .. versionchanged:: 2.2\n Calls ``current_app.json.dumps``, allowing an app to override\n the behavior.\n\n .. versionchanged:: 2.0.2\n :class:`decimal.Decimal` is supported by converting to a string.\n\n .. versionchanged:: 2.0\n ``encoding`` will be removed in Flask 2.1.\n\n .. versionchanged:: 1.0.3\n ``app`` can be passed directly, rather than requiring an app\n context for configuration.\n \"\"\"\n if current_app:\n return current_app.json.dumps(obj, **kwargs)\n\n kwargs.setdefault(\"default\", _default)\n return _json.dumps(obj, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_dump_dump.if_current_app_.else_._json_dump_obj_fp_kwa": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/__init__.py_dump_dump.if_current_app_.else_._json_dump_obj_fp_kwa", "embedding": null, "metadata": {"file_path": "src/flask/json/__init__.py", "file_name": "__init__.py", "file_type": "text/x-python", "category": "implementation", "start_line": 47, "end_line": 74, "span_ids": ["dump"], "tokens": 257}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def dump(obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:\n \"\"\"Serialize data as JSON and write to a file.\n\n If :data:`~flask.current_app` is available, it will use its\n :meth:`app.json.dump() `\n method, otherwise it will use :func:`json.dump`.\n\n :param obj: The data to serialize.\n :param fp: A file opened for writing text. Should use the UTF-8\n encoding to be valid JSON.\n :param kwargs: Arguments passed to the ``dump`` implementation.\n\n .. versionchanged:: 2.3\n The ``app`` parameter was removed.\n\n .. versionchanged:: 2.2\n Calls ``current_app.json.dump``, allowing an app to override\n the behavior.\n\n .. versionchanged:: 2.0\n Writing to a binary file, and the ``encoding`` argument, will be\n removed in Flask 2.1.\n \"\"\"\n if current_app:\n current_app.json.dump(obj, fp, **kwargs)\n else:\n kwargs.setdefault(\"default\", _default)\n _json.dump(obj, fp, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_from___future___import_an_JSONProvider._prepare_response_obj.return.args_or_kwargs": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_from___future___import_an_JSONProvider._prepare_response_obj.return.args_or_kwargs", "embedding": null, "metadata": {"file_path": "src/flask/json/provider.py", "file_name": "provider.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 86, "span_ids": ["impl", "JSONProvider", "imports:10", "JSONProvider._prepare_response_obj", "JSONProvider.load", "imports", "JSONProvider.dumps", "JSONProvider.loads", "JSONProvider.dump"], "tokens": 656}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nimport dataclasses\nimport decimal\nimport json\nimport typing as t\nimport uuid\nimport weakref\nfrom datetime import date\n\nfrom werkzeug.http import http_date\n\nif t.TYPE_CHECKING: # pragma: no cover\n from ..app import Flask\n from ..wrappers import Response\n\n\nclass JSONProvider:\n \"\"\"A standard set of JSON operations for an application. Subclasses\n of this can be used to customize JSON behavior or use different\n JSON libraries.\n\n To implement a provider for a specific library, subclass this base\n class and implement at least :meth:`dumps` and :meth:`loads`. All\n other methods have default implementations.\n\n To use a different provider, either subclass ``Flask`` and set\n :attr:`~flask.Flask.json_provider_class` to a provider class, or set\n :attr:`app.json ` to an instance of the class.\n\n :param app: An application instance. This will be stored as a\n :class:`weakref.proxy` on the :attr:`_app` attribute.\n\n .. versionadded:: 2.2\n \"\"\"\n\n def __init__(self, app: Flask) -> None:\n self._app = weakref.proxy(app)\n\n def dumps(self, obj: t.Any, **kwargs: t.Any) -> str:\n \"\"\"Serialize data as JSON.\n\n :param obj: The data to serialize.\n :param kwargs: May be passed to the underlying JSON library.\n \"\"\"\n raise NotImplementedError\n\n def dump(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:\n \"\"\"Serialize data as JSON and write to a file.\n\n :param obj: The data to serialize.\n :param fp: A file opened for writing text. Should use the UTF-8\n encoding to be valid JSON.\n :param kwargs: May be passed to the underlying JSON library.\n \"\"\"\n fp.write(self.dumps(obj, **kwargs))\n\n def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any:\n \"\"\"Deserialize data as JSON.\n\n :param s: Text or UTF-8 bytes.\n :param kwargs: May be passed to the underlying JSON library.\n \"\"\"\n raise NotImplementedError\n\n def load(self, fp: t.IO[t.AnyStr], **kwargs: t.Any) -> t.Any:\n \"\"\"Deserialize data as JSON read from a file.\n\n :param fp: A file opened for reading text or UTF-8 bytes.\n :param kwargs: May be passed to the underlying JSON library.\n \"\"\"\n return self.loads(fp.read(), **kwargs)\n\n def _prepare_response_obj(\n self, args: t.Tuple[t.Any, ...], kwargs: t.Dict[str, t.Any]\n ) -> t.Any:\n if args and kwargs:\n raise TypeError(\"app.json.response() takes either args or kwargs, not both\")\n\n if not args and not kwargs:\n return None\n\n if len(args) == 1:\n return args[0]\n\n return args or kwargs", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_JSONProvider.response__default.raise_TypeError_f_Object_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_JSONProvider.response__default.raise_TypeError_f_Object_", "embedding": null, "metadata": {"file_path": "src/flask/json/provider.py", "file_name": "provider.py", "file_type": "text/x-python", "category": "implementation", "start_line": 88, "end_line": 120, "span_ids": ["JSONProvider.response", "_default"], "tokens": 269}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class JSONProvider:\n\n def response(self, *args: t.Any, **kwargs: t.Any) -> Response:\n \"\"\"Serialize the given arguments as JSON, and return a\n :class:`~flask.Response` object with the ``application/json``\n mimetype.\n\n The :func:`~flask.json.jsonify` function calls this method for\n the current application.\n\n Either positional or keyword arguments can be given, not both.\n If no arguments are given, ``None`` is serialized.\n\n :param args: A single value to serialize, or multiple values to\n treat as a list to serialize.\n :param kwargs: Treat as a dict to serialize.\n \"\"\"\n obj = self._prepare_response_obj(args, kwargs)\n return self._app.response_class(self.dumps(obj), mimetype=\"application/json\")\n\n\ndef _default(o: t.Any) -> t.Any:\n if isinstance(o, date):\n return http_date(o)\n\n if isinstance(o, (decimal.Decimal, uuid.UUID)):\n return str(o)\n\n if dataclasses and dataclasses.is_dataclass(o):\n return dataclasses.asdict(o)\n\n if hasattr(o, \"__html__\"):\n return str(o.__html__())\n\n raise TypeError(f\"Object of type {type(o).__name__} is not JSON serializable\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider_DefaultJSONProvider._The_mimetype_set_in_m": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider_DefaultJSONProvider._The_mimetype_set_in_m", "embedding": null, "metadata": {"file_path": "src/flask/json/provider.py", "file_name": "provider.py", "file_type": "text/x-python", "category": "implementation", "start_line": 123, "end_line": 165, "span_ids": ["DefaultJSONProvider"], "tokens": 413}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DefaultJSONProvider(JSONProvider):\n \"\"\"Provide JSON operations using Python's built-in :mod:`json`\n library. Serializes the following additional data types:\n\n - :class:`datetime.datetime` and :class:`datetime.date` are\n serialized to :rfc:`822` strings. This is the same as the HTTP\n date format.\n - :class:`uuid.UUID` is serialized to a string.\n - :class:`dataclasses.dataclass` is passed to\n :func:`dataclasses.asdict`.\n - :class:`~markupsafe.Markup` (or any object with a ``__html__``\n method) will call the ``__html__`` method to get a string.\n \"\"\"\n\n default: t.Callable[[t.Any], t.Any] = staticmethod(\n _default\n ) # type: ignore[assignment]\n \"\"\"Apply this function to any object that :meth:`json.dumps` does\n not know how to serialize. It should return a valid JSON type or\n raise a ``TypeError``.\n \"\"\"\n\n ensure_ascii = True\n \"\"\"Replace non-ASCII characters with escape sequences. This may be\n more compatible with some clients, but can be disabled for better\n performance and size.\n \"\"\"\n\n sort_keys = True\n \"\"\"Sort the keys in any serialized dicts. This may be useful for\n some caching situations, but can be disabled for better performance.\n When enabled, keys must all be strings, they are not converted\n before sorting.\n \"\"\"\n\n compact: bool | None = None\n \"\"\"If ``True``, or ``None`` out of debug mode, the :meth:`response`\n output will not add indentation, newlines, or spaces. If ``False``,\n or ``None`` in debug mode, it will use a non-compact representation.\n \"\"\"\n\n mimetype = \"application/json\"\n \"\"\"The mimetype set in :meth:`response`.\"\"\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.dumps_DefaultJSONProvider.loads.return.json_loads_s_kwargs_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.dumps_DefaultJSONProvider.loads.return.json_loads_s_kwargs_", "embedding": null, "metadata": {"file_path": "src/flask/json/provider.py", "file_name": "provider.py", "file_type": "text/x-python", "category": "implementation", "start_line": 167, "end_line": 188, "span_ids": ["DefaultJSONProvider.loads", "DefaultJSONProvider.dumps"], "tokens": 211}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DefaultJSONProvider(JSONProvider):\n\n def dumps(self, obj: t.Any, **kwargs: t.Any) -> str:\n \"\"\"Serialize data as JSON to a string.\n\n Keyword arguments are passed to :func:`json.dumps`. Sets some\n parameter defaults from the :attr:`default`,\n :attr:`ensure_ascii`, and :attr:`sort_keys` attributes.\n\n :param obj: The data to serialize.\n :param kwargs: Passed to :func:`json.dumps`.\n \"\"\"\n kwargs.setdefault(\"default\", self.default)\n kwargs.setdefault(\"ensure_ascii\", self.ensure_ascii)\n kwargs.setdefault(\"sort_keys\", self.sort_keys)\n return json.dumps(obj, **kwargs)\n\n def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any:\n \"\"\"Deserialize data as JSON from a string or bytes.\n\n :param s: Text or UTF-8 bytes.\n :param kwargs: Passed to :func:`json.loads`.\n \"\"\"\n return json.loads(s, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.response_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/json/provider.py_DefaultJSONProvider.response_", "embedding": null, "metadata": {"file_path": "src/flask/json/provider.py", "file_name": "provider.py", "file_type": "text/x-python", "category": "implementation", "start_line": 190, "end_line": 217, "span_ids": ["DefaultJSONProvider.response"], "tokens": 272}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class DefaultJSONProvider(JSONProvider):\n\n def response(self, *args: t.Any, **kwargs: t.Any) -> Response:\n \"\"\"Serialize the given arguments as JSON, and return a\n :class:`~flask.Response` object with it. The response mimetype\n will be \"application/json\" and can be changed with\n :attr:`mimetype`.\n\n If :attr:`compact` is ``False`` or debug mode is enabled, the\n output will be formatted to be easier to read.\n\n Either positional or keyword arguments can be given, not both.\n If no arguments are given, ``None`` is serialized.\n\n :param args: A single value to serialize, or multiple values to\n treat as a list to serialize.\n :param kwargs: Treat as a dict to serialize.\n \"\"\"\n obj = self._prepare_response_obj(args, kwargs)\n dump_args: t.Dict[str, t.Any] = {}\n\n if (self.compact is None and self._app.debug) or self.compact is False:\n dump_args.setdefault(\"indent\", 2)\n else:\n dump_args.setdefault(\"separators\", (\",\", \":\"))\n\n return self._app.response_class(\n f\"{self.dumps(obj, **dump_args)}\\n\", mimetype=self.mimetype\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_importlib.util_setupmethod.return.t_cast_F_update_wrapper_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_importlib.util_setupmethod.return.t_cast_F_update_wrapper_", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 51, "span_ids": ["impl", "impl:2", "docstring", "setupmethod", "imports:14", "imports", "impl:3", "imports:19"], "tokens": 407}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import importlib.util\nimport os\nimport pathlib\nimport pkgutil\nimport sys\nimport typing as t\nfrom collections import defaultdict\nfrom datetime import timedelta\nfrom functools import update_wrapper\n\nfrom jinja2 import FileSystemLoader\nfrom werkzeug.exceptions import default_exceptions\nfrom werkzeug.exceptions import HTTPException\nfrom werkzeug.utils import cached_property\n\nfrom . import typing as ft\nfrom .cli import AppGroup\nfrom .globals import current_app\nfrom .helpers import get_root_path\nfrom .helpers import send_from_directory\nfrom .templating import _default_template_ctx_processor\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .wrappers import Response\n\n# a singleton sentinel value for parameter defaults\n_sentinel = object()\n\nF = t.TypeVar(\"F\", bound=t.Callable[..., t.Any])\nT_after_request = t.TypeVar(\"T_after_request\", bound=ft.AfterRequestCallable)\nT_before_request = t.TypeVar(\"T_before_request\", bound=ft.BeforeRequestCallable)\nT_error_handler = t.TypeVar(\"T_error_handler\", bound=ft.ErrorHandlerCallable)\nT_teardown = t.TypeVar(\"T_teardown\", bound=ft.TeardownCallable)\nT_template_context_processor = t.TypeVar(\n \"T_template_context_processor\", bound=ft.TemplateContextProcessorCallable\n)\nT_url_defaults = t.TypeVar(\"T_url_defaults\", bound=ft.URLDefaultCallable)\nT_url_value_preprocessor = t.TypeVar(\n \"T_url_value_preprocessor\", bound=ft.URLValuePreprocessorCallable\n)\nT_route = t.TypeVar(\"T_route\", bound=ft.RouteCallable)\n\n\ndef setupmethod(f: F) -> F:\n f_name = f.__name__\n\n def wrapper_func(self, *args: t.Any, **kwargs: t.Any) -> t.Any:\n self._check_setup_finished(f_name)\n return f(self, *args, **kwargs)\n\n return t.cast(F, update_wrapper(wrapper_func, f))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold_Scaffold._static_url_path.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold_Scaffold._static_url_path.None", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 54, "end_line": 74, "span_ids": ["Scaffold"], "tokens": 216}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n \"\"\"Common behavior shared between :class:`~flask.Flask` and\n :class:`~flask.blueprints.Blueprint`.\n\n :param import_name: The import name of the module where this object\n is defined. Usually :attr:`__name__` should be used.\n :param static_folder: Path to a folder of static files to serve.\n If this is set, a static route will be added.\n :param static_url_path: URL prefix for the static route.\n :param template_folder: Path to a folder containing template files.\n for rendering. If this is set, a Jinja loader will be added.\n :param root_path: The path that static, template, and resource files\n are relative to. Typically not set, it is discovered based on\n the ``import_name``.\n\n .. versionadded:: 2.0\n \"\"\"\n\n name: str\n _static_folder: t.Optional[str] = None\n _static_url_path: t.Optional[str] = None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.get_send_file_max_age_Scaffold.get_send_file_max_age.return.value": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.get_send_file_max_age_Scaffold.get_send_file_max_age.return.value", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 278, "end_line": 300, "span_ids": ["Scaffold.get_send_file_max_age"], "tokens": 191}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n def get_send_file_max_age(self, filename: t.Optional[str]) -> t.Optional[int]:\n \"\"\"Used by :func:`send_file` to determine the ``max_age`` cache\n value for a given file path if it wasn't passed.\n\n By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from\n the configuration of :data:`~flask.current_app`. This defaults\n to ``None``, which tells the browser to use conditional requests\n instead of a timed cache, which is usually preferable.\n\n .. versionchanged:: 2.0\n The default configuration is ``None`` instead of 12 hours.\n\n .. versionadded:: 0.9\n \"\"\"\n value = current_app.config[\"SEND_FILE_MAX_AGE_DEFAULT\"]\n\n if value is None:\n return None\n\n if isinstance(value, timedelta):\n return int(value.total_seconds())\n\n return value", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.context_processor_Scaffold.context_processor.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.context_processor_Scaffold.context_processor.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 613, "end_line": 628, "span_ids": ["Scaffold.context_processor"], "tokens": 153}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def context_processor(\n self,\n f: T_template_context_processor,\n ) -> T_template_context_processor:\n \"\"\"Registers a template context processor function. These functions run before\n rendering a template. The keys of the returned dict are added as variables\n available in the template.\n\n This is available on both app and blueprint objects. When used on an app, this\n is called for every rendered template. When used on a blueprint, this is called\n for templates rendered from the blueprint's views. To register with a blueprint\n and affect every template, use :meth:`.Blueprint.app_context_processor`.\n \"\"\"\n self.template_context_processors[None].append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_value_preprocessor_Scaffold.url_value_preprocessor.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_value_preprocessor_Scaffold.url_value_preprocessor.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 630, "end_line": 653, "span_ids": ["Scaffold.url_value_preprocessor"], "tokens": 232}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def url_value_preprocessor(\n self,\n f: T_url_value_preprocessor,\n ) -> T_url_value_preprocessor:\n \"\"\"Register a URL value preprocessor function for all view\n functions in the application. These functions will be called before the\n :meth:`before_request` functions.\n\n The function can modify the values captured from the matched url before\n they are passed to the view. For example, this can be used to pop a\n common language code value and place it in ``g`` rather than pass it to\n every view.\n\n The function is passed the endpoint name and values dict. The return\n value is ignored.\n\n This is available on both app and blueprint objects. When used on an app, this\n is called for every request. When used on a blueprint, this is called for\n requests that the blueprint handles. To register with a blueprint and affect\n every request, use :meth:`.Blueprint.app_url_value_preprocessor`.\n \"\"\"\n self.url_value_preprocessors[None].append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_defaults_Scaffold.url_defaults.return.f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py_Scaffold.url_defaults_Scaffold.url_defaults.return.f", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 655, "end_line": 667, "span_ids": ["Scaffold.url_defaults"], "tokens": 144}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Scaffold:\n\n @setupmethod\n def url_defaults(self, f: T_url_defaults) -> T_url_defaults:\n \"\"\"Callback function for URL defaults for all view functions of the\n application. It's called with the endpoint and values and should\n update the values passed in place.\n\n This is available on both app and blueprint objects. When used on an app, this\n is called for every request. When used on a blueprint, this is called for\n requests that the blueprint handles. To register with a blueprint and affect\n every request, use :meth:`.Blueprint.app_url_defaults`.\n \"\"\"\n self.url_default_functions[None].append(f)\n return f", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__endpoint_from_view_func__path_is_relative_to.try_.except_ValueError_.return.False": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/scaffold.py__endpoint_from_view_func__path_is_relative_to.try_.except_ValueError_.return.False", "embedding": null, "metadata": {"file_path": "src/flask/scaffold.py", "file_name": "scaffold.py", "file_type": "text/x-python", "category": "implementation", "start_line": 773, "end_line": 812, "span_ids": ["_endpoint_from_view_func", "_path_is_relative_to", "_matching_loader_thinks_module_is_package"], "tokens": 319}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _endpoint_from_view_func(view_func: t.Callable) -> str:\n \"\"\"Internal helper that returns the default endpoint for a given\n function. This always is the function name.\n \"\"\"\n assert view_func is not None, \"expected view func if endpoint is not provided.\"\n return view_func.__name__\n\n\ndef _matching_loader_thinks_module_is_package(loader, mod_name):\n \"\"\"Attempt to figure out if the given name is a package or a module.\n\n :param: loader: The loader that handled the name.\n :param mod_name: The name of the package or module.\n \"\"\"\n # Use loader.is_package if it's available.\n if hasattr(loader, \"is_package\"):\n return loader.is_package(mod_name)\n\n cls = type(loader)\n\n # NamespaceLoader doesn't implement is_package, but all names it\n # loads must be packages.\n if cls.__module__ == \"_frozen_importlib\" and cls.__name__ == \"NamespaceLoader\":\n return True\n\n # Otherwise we need to fail with an error that explains what went\n # wrong.\n raise AttributeError(\n f\"'{cls.__name__}.is_package()' must be implemented for PEP 302\"\n f\" import hooks.\"\n )\n\n\ndef _path_is_relative_to(path: pathlib.PurePath, base: str) -> bool:\n # Path.is_relative_to doesn't exist until Python 3.9\n try:\n path.relative_to(base)\n return True\n except ValueError:\n return False", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.is_null_session_SessionInterface.get_cookie_name.return.app_config_SESSION_COOKI": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/sessions.py_SessionInterface.is_null_session_SessionInterface.get_cookie_name.return.app_config_SESSION_COOKI", "embedding": null, "metadata": {"file_path": "src/flask/sessions.py", "file_name": "sessions.py", "file_type": "text/x-python", "category": "implementation", "start_line": 170, "end_line": 181, "span_ids": ["SessionInterface.is_null_session", "SessionInterface.get_cookie_name"], "tokens": 120}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class SessionInterface:\n\n def is_null_session(self, obj: object) -> bool:\n \"\"\"Checks if a given object is a null session. Null sessions are\n not asked to be saved.\n\n This checks if the object is an instance of :attr:`null_session_class`\n by default.\n \"\"\"\n return isinstance(obj, self.null_session_class)\n\n def get_cookie_name(self, app: \"Flask\") -> str:\n \"\"\"The name of the session cookie. Uses``app.config[\"SESSION_COOKIE_NAME\"]``.\"\"\"\n return app.config[\"SESSION_COOKIE_NAME\"]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_t_if_t_TYPE_CHECKING_pr.Scaffold": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_t_if_t_TYPE_CHECKING_pr.Scaffold", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 18, "span_ids": ["impl", "imports", "imports:13"], "tokens": 118}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\nfrom jinja2 import BaseLoader\nfrom jinja2 import Environment as BaseEnvironment\nfrom jinja2 import Template\nfrom jinja2 import TemplateNotFound\n\nfrom .globals import _cv_app\nfrom .globals import _cv_request\nfrom .globals import current_app\nfrom .globals import request\nfrom .helpers import stream_with_context\nfrom .signals import before_render_template\nfrom .signals import template_rendered\n\nif t.TYPE_CHECKING: # pragma: no cover\n from .app import Flask\n from .scaffold import Scaffold", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__default_template_ctx_processor__default_template_ctx_processor.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__default_template_ctx_processor__default_template_ctx_processor.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 21, "end_line": 33, "span_ids": ["_default_template_ctx_processor"], "tokens": 119}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _default_template_ctx_processor() -> t.Dict[str, t.Any]:\n \"\"\"Default template context processor. Injects `request`,\n `session` and `g`.\n \"\"\"\n appctx = _cv_app.get(None)\n reqctx = _cv_request.get(None)\n rv: t.Dict[str, t.Any] = {}\n if appctx is not None:\n rv[\"g\"] = appctx.g\n if reqctx is not None:\n rv[\"request\"] = reqctx.request\n rv[\"session\"] = reqctx.session\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__render_render_template.return._render_app_template_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py__render_render_template.return._render_app_template_co", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 127, "end_line": 147, "span_ids": ["render_template", "_render"], "tokens": 214}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def _render(app: \"Flask\", template: Template, context: t.Dict[str, t.Any]) -> str:\n app.update_template_context(context)\n before_render_template.send(app, template=template, context=context)\n rv = template.render(context)\n template_rendered.send(app, template=template, context=context)\n return rv\n\n\ndef render_template(\n template_name_or_list: t.Union[str, Template, t.List[t.Union[str, Template]]],\n **context: t.Any,\n) -> str:\n \"\"\"Render a template by name with the given context.\n\n :param template_name_or_list: The name of the template to render. If\n a list is given, the first name to exist will be rendered.\n :param context: The variables to make available in the template.\n \"\"\"\n app = current_app._get_current_object() # type: ignore[attr-defined]\n template = app.jinja_env.get_or_select_template(template_name_or_list)\n return _render(app, template, context)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_render_template_string__stream.return.rv": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_render_template_string__stream.return.rv", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 150, "end_line": 178, "span_ids": ["render_template_string", "_stream"], "tokens": 218}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def render_template_string(source: str, **context: t.Any) -> str:\n \"\"\"Render a template from the given source string with the given\n context.\n\n :param source: The source code of the template to render.\n :param context: The variables to make available in the template.\n \"\"\"\n app = current_app._get_current_object() # type: ignore[attr-defined]\n template = app.jinja_env.from_string(source)\n return _render(app, template, context)\n\n\ndef _stream(\n app: \"Flask\", template: Template, context: t.Dict[str, t.Any]\n) -> t.Iterator[str]:\n app.update_template_context(context)\n before_render_template.send(app, template=template, context=context)\n\n def generate() -> t.Iterator[str]:\n yield from template.generate(context)\n template_rendered.send(app, template=template, context=context)\n\n rv = generate()\n\n # If a request context is active, keep it while generating.\n if request:\n rv = stream_with_context(rv)\n\n return rv", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_stream_template.return._stream_app_template_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_stream_template.return._stream_app_template_co", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 181, "end_line": 197, "span_ids": ["stream_template"], "tokens": 180}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def stream_template(\n template_name_or_list: t.Union[str, Template, t.List[t.Union[str, Template]]],\n **context: t.Any,\n) -> t.Iterator[str]:\n \"\"\"Render a template by name with the given context as a stream.\n This returns an iterator of strings, which can be used as a\n streaming response from a view.\n\n :param template_name_or_list: The name of the template to render. If\n a list is given, the first name to exist will be rendered.\n :param context: The variables to make available in the template.\n\n .. versionadded:: 2.2\n \"\"\"\n app = current_app._get_current_object() # type: ignore[attr-defined]\n template = app.jinja_env.get_or_select_template(template_name_or_list)\n return _stream(app, template, context)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_string_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/templating.py_stream_template_string_", "embedding": null, "metadata": {"file_path": "src/flask/templating.py", "file_name": "templating.py", "file_type": "text/x-python", "category": "implementation", "start_line": 200, "end_line": 213, "span_ids": ["stream_template_string"], "tokens": 139}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def stream_template_string(source: str, **context: t.Any) -> t.Iterator[str]:\n \"\"\"Render a template from the given source string with the given\n context as a stream. This returns an iterator of strings, which can\n be used as a streaming response from a view.\n\n :param source: The source code of the template to render.\n :param context: The variables to make available in the template.\n\n .. versionadded:: 2.2\n \"\"\"\n app = current_app._get_current_object() # type: ignore[attr-defined]\n template = app.jinja_env.from_string(source)\n return _stream(app, template, context)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_t_if_t_TYPE_CHECKING_pr.Flask": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_t_if_t_TYPE_CHECKING_pr.Flask", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 20, "span_ids": ["impl", "imports:14", "imports"], "tokens": 119}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\nfrom contextlib import contextmanager\nfrom contextlib import ExitStack\nfrom copy import copy\nfrom types import TracebackType\n\nimport werkzeug.test\nfrom click.testing import CliRunner\nfrom werkzeug.test import Client\nfrom werkzeug.urls import url_parse\nfrom werkzeug.wrappers import Request as BaseRequest\n\nfrom .cli import ScriptInfo\nfrom .globals import _cv_request\nfrom .sessions import SessionMixin\n\nif t.TYPE_CHECKING: # pragma: no cover\n from werkzeug.test import TestResponse\n\n from .app import Flask", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_EnvironBuilder_EnvironBuilder.json_dumps.return.self_app_json_dumps_obj_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_EnvironBuilder_EnvironBuilder.json_dumps.return.self_app_json_dumps_obj_", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 23, "end_line": 91, "span_ids": ["EnvironBuilder.json_dumps", "EnvironBuilder"], "tokens": 612}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class EnvironBuilder(werkzeug.test.EnvironBuilder):\n \"\"\"An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the\n application.\n\n :param app: The Flask application to configure the environment from.\n :param path: URL path being requested.\n :param base_url: Base URL where the app is being served, which\n ``path`` is relative to. If not given, built from\n :data:`PREFERRED_URL_SCHEME`, ``subdomain``,\n :data:`SERVER_NAME`, and :data:`APPLICATION_ROOT`.\n :param subdomain: Subdomain name to append to :data:`SERVER_NAME`.\n :param url_scheme: Scheme to use instead of\n :data:`PREFERRED_URL_SCHEME`.\n :param json: If given, this is serialized as JSON and passed as\n ``data``. Also defaults ``content_type`` to\n ``application/json``.\n :param args: other positional arguments passed to\n :class:`~werkzeug.test.EnvironBuilder`.\n :param kwargs: other keyword arguments passed to\n :class:`~werkzeug.test.EnvironBuilder`.\n \"\"\"\n\n def __init__(\n self,\n app: \"Flask\",\n path: str = \"/\",\n base_url: t.Optional[str] = None,\n subdomain: t.Optional[str] = None,\n url_scheme: t.Optional[str] = None,\n *args: t.Any,\n **kwargs: t.Any,\n ) -> None:\n assert not (base_url or subdomain or url_scheme) or (\n base_url is not None\n ) != bool(\n subdomain or url_scheme\n ), 'Cannot pass \"subdomain\" or \"url_scheme\" with \"base_url\".'\n\n if base_url is None:\n http_host = app.config.get(\"SERVER_NAME\") or \"localhost\"\n app_root = app.config[\"APPLICATION_ROOT\"]\n\n if subdomain:\n http_host = f\"{subdomain}.{http_host}\"\n\n if url_scheme is None:\n url_scheme = app.config[\"PREFERRED_URL_SCHEME\"]\n\n url = url_parse(path)\n base_url = (\n f\"{url.scheme or url_scheme}://{url.netloc or http_host}\"\n f\"/{app_root.lstrip('/')}\"\n )\n path = url.path\n\n if url.query:\n sep = b\"?\" if isinstance(url.query, bytes) else \"?\"\n path += sep + url.query\n\n self.app = app\n super().__init__(path, base_url, *args, **kwargs)\n\n def json_dumps(self, obj: t.Any, **kwargs: t.Any) -> str: # type: ignore\n \"\"\"Serialize ``obj`` to a JSON-formatted string.\n\n The serialization will be configured according to the config associated\n with this EnvironBuilder's ``app``.\n \"\"\"\n return self.app.json.dumps(obj, **kwargs)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient._copy_environ_FlaskClient._request_from_builder_args.try_.finally_.builder_close_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient._copy_environ_FlaskClient._request_from_builder_args.try_.finally_.builder_close_", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 175, "end_line": 190, "span_ids": ["FlaskClient._copy_environ", "FlaskClient._request_from_builder_args"], "tokens": 122}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskClient(Client):\n\n def _copy_environ(self, other):\n out = {**self.environ_base, **other}\n\n if self.preserve_context:\n out[\"werkzeug.debug.preserve_context\"] = self._new_contexts.append\n\n return out\n\n def _request_from_builder_args(self, args, kwargs):\n kwargs[\"environ_base\"] = self._copy_environ(kwargs.get(\"environ_base\", {}))\n builder = EnvironBuilder(self.application, *args, **kwargs)\n\n try:\n return builder.get_request()\n finally:\n builder.close()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.open_FlaskClient.__exit__.self__context_stack_close": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/testing.py_FlaskClient.open_FlaskClient.__exit__.self__context_stack_close", "embedding": null, "metadata": {"file_path": "src/flask/testing.py", "file_name": "testing.py", "file_type": "text/x-python", "category": "implementation", "start_line": 192, "end_line": 250, "span_ids": ["FlaskClient.open", "FlaskClient.__enter__", "FlaskClient.__exit__"], "tokens": 436}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class FlaskClient(Client):\n\n def open(\n self,\n *args: t.Any,\n buffered: bool = False,\n follow_redirects: bool = False,\n **kwargs: t.Any,\n ) -> \"TestResponse\":\n if args and isinstance(\n args[0], (werkzeug.test.EnvironBuilder, dict, BaseRequest)\n ):\n if isinstance(args[0], werkzeug.test.EnvironBuilder):\n builder = copy(args[0])\n builder.environ_base = self._copy_environ(builder.environ_base or {})\n request = builder.get_request()\n elif isinstance(args[0], dict):\n request = EnvironBuilder.from_environ(\n args[0], app=self.application, environ_base=self._copy_environ({})\n ).get_request()\n else:\n # isinstance(args[0], BaseRequest)\n request = copy(args[0])\n request.environ = self._copy_environ(request.environ)\n else:\n # request is None\n request = self._request_from_builder_args(args, kwargs)\n\n # Pop any previously preserved contexts. This prevents contexts\n # from being preserved across redirects or multiple requests\n # within a single block.\n self._context_stack.close()\n\n response = super().open(\n request,\n buffered=buffered,\n follow_redirects=follow_redirects,\n )\n response.json_module = self.application.json # type: ignore[assignment]\n\n # Re-push contexts that were preserved during the request.\n while self._new_contexts:\n cm = self._new_contexts.pop()\n self._context_stack.enter_context(cm)\n\n return response\n\n def __enter__(self) -> \"FlaskClient\":\n if self.preserve_context:\n raise RuntimeError(\"Cannot nest client invocations\")\n self.preserve_context = True\n return self\n\n def __exit__(\n self,\n exc_type: t.Optional[type],\n exc_value: t.Optional[BaseException],\n tb: t.Optional[TracebackType],\n ) -> None:\n self.preserve_context = False\n self._context_stack.close()", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_t_Request.endpoint.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_t_Request.endpoint.return.None", "embedding": null, "metadata": {"file_path": "src/flask/wrappers.py", "file_name": "wrappers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 73, "span_ids": ["impl", "Request.max_content_length", "Request", "imports", "imports:8", "Request.endpoint"], "tokens": 594}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import typing as t\n\nfrom werkzeug.exceptions import BadRequest\nfrom werkzeug.wrappers import Request as RequestBase\nfrom werkzeug.wrappers import Response as ResponseBase\n\nfrom . import json\nfrom .globals import current_app\nfrom .helpers import _split_blueprint_path\n\nif t.TYPE_CHECKING: # pragma: no cover\n from werkzeug.routing import Rule\n\n\nclass Request(RequestBase):\n \"\"\"The request object used by default in Flask. Remembers the\n matched endpoint and view arguments.\n\n It is what ends up as :class:`~flask.request`. If you want to replace\n the request object used you can subclass this and set\n :attr:`~flask.Flask.request_class` to your subclass.\n\n The request object is a :class:`~werkzeug.wrappers.Request` subclass and\n provides all of the attributes Werkzeug defines plus a few Flask\n specific ones.\n \"\"\"\n\n json_module: t.Any = json\n\n #: The internal URL rule that matched the request. This can be\n #: useful to inspect which methods are allowed for the URL from\n #: a before/after handler (``request.url_rule.methods``) etc.\n #: Though if the request's method was invalid for the URL rule,\n #: the valid list is available in ``routing_exception.valid_methods``\n #: instead (an attribute of the Werkzeug exception\n #: :exc:`~werkzeug.exceptions.MethodNotAllowed`)\n #: because the request was never internally bound.\n #:\n #: .. versionadded:: 0.6\n url_rule: t.Optional[\"Rule\"] = None\n\n #: A dict of view arguments that matched the request. If an exception\n #: happened when matching, this will be ``None``.\n view_args: t.Optional[t.Dict[str, t.Any]] = None\n\n #: If matching the URL failed, this is the exception that will be\n #: raised / was raised as part of the request handling. This is\n #: usually a :exc:`~werkzeug.exceptions.NotFound` exception or\n #: something similar.\n routing_exception: t.Optional[Exception] = None\n\n @property\n def max_content_length(self) -> t.Optional[int]: # type: ignore\n \"\"\"Read-only view of the ``MAX_CONTENT_LENGTH`` config key.\"\"\"\n if current_app:\n return current_app.config[\"MAX_CONTENT_LENGTH\"]\n else:\n return None\n\n @property\n def endpoint(self) -> t.Optional[str]:\n \"\"\"The endpoint that matched the request URL.\n\n This will be ``None`` if matching failed or has not been\n performed yet.\n\n This in combination with :attr:`view_args` can be used to\n reconstruct the same URL or a modified URL.\n \"\"\"\n if self.url_rule is not None:\n return self.url_rule.endpoint\n\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprint_Request.blueprint.return.None": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprint_Request.blueprint.return.None", "embedding": null, "metadata": {"file_path": "src/flask/wrappers.py", "file_name": "wrappers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 75, "end_line": 92, "span_ids": ["Request.blueprint"], "tokens": 124}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Request(RequestBase):\n\n @property\n def blueprint(self) -> t.Optional[str]:\n \"\"\"The registered name of the current blueprint.\n\n This will be ``None`` if the endpoint is not part of a\n blueprint, or if URL matching failed or has not been performed\n yet.\n\n This does not necessarily match the name the blueprint was\n created with. It may have been nested, or registered with a\n different name.\n \"\"\"\n endpoint = self.endpoint\n\n if endpoint is not None and \".\" in endpoint:\n return endpoint.rpartition(\".\")[0]\n\n return None", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprints_Request.on_json_loading_failed.try_.except_BadRequest_as_e_.raise_BadRequest_from_e": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/src/flask/wrappers.py_Request.blueprints_Request.on_json_loading_failed.try_.except_BadRequest_as_e_.raise_BadRequest_from_e", "embedding": null, "metadata": {"file_path": "src/flask/wrappers.py", "file_name": "wrappers.py", "file_type": "text/x-python", "category": "implementation", "start_line": 94, "end_line": 133, "span_ids": ["Request._load_form_data", "Request.on_json_loading_failed", "Request.blueprints"], "tokens": 258}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class Request(RequestBase):\n\n @property\n def blueprints(self) -> t.List[str]:\n \"\"\"The registered names of the current blueprint upwards through\n parent blueprints.\n\n This will be an empty list if there is no current blueprint, or\n if URL matching failed.\n\n .. versionadded:: 2.0.1\n \"\"\"\n name = self.blueprint\n\n if name is None:\n return []\n\n return _split_blueprint_path(name)\n\n def _load_form_data(self) -> None:\n super()._load_form_data()\n\n # In debug mode we're replacing the files multidict with an ad-hoc\n # subclass that raises a different error for key errors.\n if (\n current_app\n and current_app.debug\n and self.mimetype != \"multipart/form-data\"\n and not self.files\n ):\n from .debughelpers import attach_enctype_error_multidict\n\n attach_enctype_error_multidict(self)\n\n def on_json_loading_failed(self, e: t.Optional[ValueError]) -> t.Any:\n try:\n return super().on_json_loading_failed(e)\n except BadRequest as e:\n if current_app and current_app.debug:\n raise\n\n raise BadRequest() from e", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_asyncio_AsyncMethodView.post.return._POST_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py_asyncio_AsyncMethodView.post.return._POST_", "embedding": null, "metadata": {"file_path": "tests/test_async.py", "file_name": "test_async.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 37, "span_ids": ["impl", "AppError", "AsyncMethodView", "AsyncView", "AsyncMethodView.get", "AsyncMethodView.post", "imports", "AsyncView.dispatch_request", "BlueprintError"], "tokens": 136}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import asyncio\n\nimport pytest\n\nfrom flask import Blueprint\nfrom flask import Flask\nfrom flask import request\nfrom flask.views import MethodView\nfrom flask.views import View\n\npytest.importorskip(\"asgiref\")\n\n\nclass AppError(Exception):\n pass\n\n\nclass BlueprintError(Exception):\n pass\n\n\nclass AsyncView(View):\n methods = [\"GET\", \"POST\"]\n\n async def dispatch_request(self):\n await asyncio.sleep(0)\n return request.method\n\n\nclass AsyncMethodView(MethodView):\n async def get(self):\n await asyncio.sleep(0)\n return \"GET\"\n\n async def post(self):\n await asyncio.sleep(0)\n return \"POST\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py__async_app__async_app.return.app": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_async.py__async_app__async_app.return.app", "embedding": null, "metadata": {"file_path": "tests/test_async.py", "file_name": "test_async.py", "file_type": "text/x-python", "category": "test", "start_line": 40, "end_line": 78, "span_ids": ["_async_app"], "tokens": 236}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.fixture(name=\"async_app\")\ndef _async_app():\n app = Flask(__name__)\n\n @app.route(\"/\", methods=[\"GET\", \"POST\"])\n @app.route(\"/home\", methods=[\"GET\", \"POST\"])\n async def index():\n await asyncio.sleep(0)\n return request.method\n\n @app.errorhandler(AppError)\n async def handle(_):\n return \"\", 412\n\n @app.route(\"/error\")\n async def error():\n raise AppError()\n\n blueprint = Blueprint(\"bp\", __name__)\n\n @blueprint.route(\"/\", methods=[\"GET\", \"POST\"])\n async def bp_index():\n await asyncio.sleep(0)\n return request.method\n\n @blueprint.errorhandler(BlueprintError)\n async def bp_handle(_):\n return \"\", 412\n\n @blueprint.route(\"/error\")\n async def bp_error():\n raise BlueprintError()\n\n app.register_blueprint(blueprint, url_prefix=\"/bp\")\n\n app.add_url_rule(\"/view\", view_func=AsyncView.as_view(\"view\"))\n app.add_url_rule(\"/methodview\", view_func=AsyncMethodView.as_view(\"methodview\"))\n\n return app", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_dispatching_test_disallow_string_for_allowed_methods.with_pytest_raises_TypeEr.app_add_url_rule_met": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_request_dispatching_test_disallow_string_for_allowed_methods.with_pytest_raises_TypeEr.app_add_url_rule_met", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 128, "end_line": 153, "span_ids": ["test_request_dispatching", "test_disallow_string_for_allowed_methods"], "tokens": 211}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_request_dispatching(app, client):\n @app.route(\"/\")\n def index():\n return flask.request.method\n\n @app.route(\"/more\", methods=[\"GET\", \"POST\"])\n def more():\n return flask.request.method\n\n assert client.get(\"/\").data == b\"GET\"\n rv = client.post(\"/\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\"]\n rv = client.head(\"/\")\n assert rv.status_code == 200\n assert not rv.data # head truncates\n assert client.post(\"/more\").data == b\"POST\"\n assert client.get(\"/more\").data == b\"GET\"\n rv = client.delete(\"/more\")\n assert rv.status_code == 405\n assert sorted(rv.allow) == [\"GET\", \"HEAD\", \"OPTIONS\", \"POST\"]\n\n\ndef test_disallow_string_for_allowed_methods(app):\n with pytest.raises(TypeError):\n app.add_url_rule(\"/\", methods=\"GET POST\", endpoint=\"test\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_processing_test_user_error_handling.assert_client_get_da": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_error_handling_processing_test_user_error_handling.assert_client_get_da", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 902, "end_line": 961, "span_ids": ["test_user_error_handling", "test_before_request_and_routing_errors", "test_user_error_handling.MyException", "test_baseexception_error_handling", "test_user_error_handling.MyException:2", "test_error_handling_processing"], "tokens": 306}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_error_handling_processing(app, client):\n app.testing = False\n\n @app.errorhandler(500)\n def internal_server_error(e):\n return \"internal server error\", 500\n\n @app.route(\"/\")\n def broken_func():\n 1 // 0\n\n @app.after_request\n def after_request(resp):\n resp.mimetype = \"text/x-special\"\n return resp\n\n resp = client.get(\"/\")\n assert resp.mimetype == \"text/x-special\"\n assert resp.data == b\"internal server error\"\n\n\ndef test_baseexception_error_handling(app, client):\n app.testing = False\n\n @app.route(\"/\")\n def broken_func():\n raise KeyboardInterrupt()\n\n with pytest.raises(KeyboardInterrupt):\n client.get(\"/\")\n\n\ndef test_before_request_and_routing_errors(app, client):\n @app.before_request\n def attach_something():\n flask.g.something = \"value\"\n\n @app.errorhandler(404)\n def return_something(error):\n return flask.g.something, 404\n\n rv = client.get(\"/\")\n assert rv.status_code == 404\n assert rv.data == b\"value\"\n\n\ndef test_user_error_handling(app, client):\n class MyException(Exception):\n pass\n\n @app.errorhandler(MyException)\n def handle_my_exception(e):\n assert isinstance(e, MyException)\n return \"42\"\n\n @app.route(\"/\")\n def index():\n raise MyException()\n\n assert client.get(\"/\").data == b\"42\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trap_bad_request_key_error_test_trap_bad_request_key_error.if_expect_abort_.else_.with_pytest_raises_BadReq.client_get_abort_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trap_bad_request_key_error_test_trap_bad_request_key_error.if_expect_abort_.else_.with_pytest_raises_BadReq.client_get_abort_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1029, "end_line": 1061, "span_ids": ["test_trap_bad_request_key_error"], "tokens": 245}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n (\"debug\", \"trap\", \"expect_key\", \"expect_abort\"),\n [(False, None, True, True), (True, None, False, True), (False, True, False, False)],\n)\ndef test_trap_bad_request_key_error(app, client, debug, trap, expect_key, expect_abort):\n app.config[\"DEBUG\"] = debug\n app.config[\"TRAP_BAD_REQUEST_ERRORS\"] = trap\n\n @app.route(\"/key\")\n def fail():\n flask.request.form[\"missing_key\"]\n\n @app.route(\"/abort\")\n def allow_abort():\n flask.abort(400)\n\n if expect_key:\n rv = client.get(\"/key\")\n assert rv.status_code == 400\n assert b\"missing_key\" not in rv.data\n else:\n with pytest.raises(KeyError) as exc_info:\n client.get(\"/key\")\n\n assert exc_info.errisinstance(BadRequest)\n assert \"missing_key\" in exc_info.value.get_description()\n\n if expect_abort:\n rv = client.get(\"/abort\")\n assert rv.status_code == 400\n else:\n with pytest.raises(BadRequest):\n client.get(\"/abort\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trapping_of_all_http_exceptions_test_enctype_debug_helper.assert_This_was_submitte": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_trapping_of_all_http_exceptions_test_enctype_debug_helper.assert_This_was_submitte", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1064, "end_line": 1115, "span_ids": ["test_enctype_debug_helper", "test_trapping_of_all_http_exceptions", "test_error_handler_after_processor_error"], "tokens": 313}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_trapping_of_all_http_exceptions(app, client):\n app.config[\"TRAP_HTTP_EXCEPTIONS\"] = True\n\n @app.route(\"/fail\")\n def fail():\n flask.abort(404)\n\n with pytest.raises(NotFound):\n client.get(\"/fail\")\n\n\ndef test_error_handler_after_processor_error(app, client):\n app.testing = False\n\n @app.before_request\n def before_request():\n if _trigger == \"before\":\n 1 // 0\n\n @app.after_request\n def after_request(response):\n if _trigger == \"after\":\n 1 // 0\n return response\n\n @app.route(\"/\")\n def index():\n return \"Foo\"\n\n @app.errorhandler(500)\n def internal_server_error(e):\n return \"Hello Server Error\", 500\n\n for _trigger in \"before\", \"after\":\n rv = client.get(\"/\")\n assert rv.status_code == 500\n assert rv.data == b\"Hello Server Error\"\n\n\ndef test_enctype_debug_helper(app, client):\n from flask.debughelpers import DebugFilesKeyError\n\n app.debug = True\n\n @app.route(\"/fail\", methods=[\"POST\"])\n def index():\n return flask.request.files[\"foo\"].filename\n\n with pytest.raises(DebugFilesKeyError) as e:\n client.post(\"/fail\", data={\"foo\": \"index.txt\"})\n assert \"no file contents were transmitted\" in str(e.value)\n assert \"This was submitted: 'index.txt'\" in str(e.value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_types_test_response_types.None_25": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_types_test_response_types.None_25", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1118, "end_line": 1209, "span_ids": ["test_response_types"], "tokens": 688}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_response_types(app, client):\n @app.route(\"/text\")\n def from_text():\n return \"H\u00e4llo W\u00f6rld\"\n\n @app.route(\"/bytes\")\n def from_bytes():\n return \"H\u00e4llo W\u00f6rld\".encode()\n\n @app.route(\"/full_tuple\")\n def from_full_tuple():\n return (\n \"Meh\",\n 400,\n {\"X-Foo\": \"Testing\", \"Content-Type\": \"text/plain; charset=utf-8\"},\n )\n\n @app.route(\"/text_headers\")\n def from_text_headers():\n return \"Hello\", {\"X-Foo\": \"Test\", \"Content-Type\": \"text/plain; charset=utf-8\"}\n\n @app.route(\"/text_status\")\n def from_text_status():\n return \"Hi, status!\", 400\n\n @app.route(\"/response_headers\")\n def from_response_headers():\n return (\n flask.Response(\n \"Hello world\", 404, {\"Content-Type\": \"text/html\", \"X-Foo\": \"Baz\"}\n ),\n {\"Content-Type\": \"text/plain\", \"X-Foo\": \"Bar\", \"X-Bar\": \"Foo\"},\n )\n\n @app.route(\"/response_status\")\n def from_response_status():\n return app.response_class(\"Hello world\", 400), 500\n\n @app.route(\"/wsgi\")\n def from_wsgi():\n return NotFound()\n\n @app.route(\"/dict\")\n def from_dict():\n return {\"foo\": \"bar\"}, 201\n\n @app.route(\"/list\")\n def from_list():\n return [\"foo\", \"bar\"], 201\n\n assert client.get(\"/text\").data == \"H\u00e4llo W\u00f6rld\".encode()\n assert client.get(\"/bytes\").data == \"H\u00e4llo W\u00f6rld\".encode()\n\n rv = client.get(\"/full_tuple\")\n assert rv.data == b\"Meh\"\n assert rv.headers[\"X-Foo\"] == \"Testing\"\n assert rv.status_code == 400\n assert rv.mimetype == \"text/plain\"\n\n rv = client.get(\"/text_headers\")\n assert rv.data == b\"Hello\"\n assert rv.headers[\"X-Foo\"] == \"Test\"\n assert rv.status_code == 200\n assert rv.mimetype == \"text/plain\"\n\n rv = client.get(\"/text_status\")\n assert rv.data == b\"Hi, status!\"\n assert rv.status_code == 400\n assert rv.mimetype == \"text/html\"\n\n rv = client.get(\"/response_headers\")\n assert rv.data == b\"Hello world\"\n assert rv.content_type == \"text/plain\"\n assert rv.headers.getlist(\"X-Foo\") == [\"Bar\"]\n assert rv.headers[\"X-Bar\"] == \"Foo\"\n assert rv.status_code == 404\n\n rv = client.get(\"/response_status\")\n assert rv.data == b\"Hello world\"\n assert rv.status_code == 500\n\n rv = client.get(\"/wsgi\")\n assert b\"Not Found\" in rv.data\n assert rv.status_code == 404\n\n rv = client.get(\"/dict\")\n assert rv.json == {\"foo\": \"bar\"}\n assert rv.status_code == 201\n\n rv = client.get(\"/list\")\n assert rv.json == [\"foo\", \"bar\"]\n assert rv.status_code == 201", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_type_errors_test_response_type_errors.None_4.c_get_bad_wsgi_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_response_type_errors_test_response_type_errors.None_4.c_get_bad_wsgi_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1212, "end_line": 1258, "span_ids": ["test_response_type_errors"], "tokens": 259}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_response_type_errors():\n app = flask.Flask(__name__)\n app.testing = True\n\n @app.route(\"/none\")\n def from_none():\n pass\n\n @app.route(\"/small_tuple\")\n def from_small_tuple():\n return (\"Hello\",)\n\n @app.route(\"/large_tuple\")\n def from_large_tuple():\n return \"Hello\", 234, {\"X-Foo\": \"Bar\"}, \"???\"\n\n @app.route(\"/bad_type\")\n def from_bad_type():\n return True\n\n @app.route(\"/bad_wsgi\")\n def from_bad_wsgi():\n return lambda: None\n\n c = app.test_client()\n\n with pytest.raises(TypeError) as e:\n c.get(\"/none\")\n\n assert \"returned None\" in str(e.value)\n assert \"from_none\" in str(e.value)\n\n with pytest.raises(TypeError) as e:\n c.get(\"/small_tuple\")\n\n assert \"tuple must have the form\" in str(e.value)\n\n with pytest.raises(TypeError):\n c.get(\"/large_tuple\")\n\n with pytest.raises(TypeError) as e:\n c.get(\"/bad_type\")\n\n assert \"it was a bool\" in str(e.value)\n\n with pytest.raises(TypeError):\n c.get(\"/bad_wsgi\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_test_make_response.None_11": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_make_response_test_make_response.None_11", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1261, "end_line": 1280, "span_ids": ["test_make_response"], "tokens": 163}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_make_response(app, req_ctx):\n rv = flask.make_response()\n assert rv.status_code == 200\n assert rv.data == b\"\"\n assert rv.mimetype == \"text/html\"\n\n rv = flask.make_response(\"Awesome\")\n assert rv.status_code == 200\n assert rv.data == b\"Awesome\"\n assert rv.mimetype == \"text/html\"\n\n rv = flask.make_response(\"W00t\", 404)\n assert rv.status_code == 404\n assert rv.data == b\"W00t\"\n assert rv.mimetype == \"text/html\"\n\n rv = flask.make_response(c for c in \"Hello\")\n assert rv.status_code == 200\n assert rv.data == b\"Hello\"\n assert rv.mimetype == \"text/html\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_jsonify_no_prettyprint_test_url_generation.assert_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_jsonify_no_prettyprint_test_url_generation.assert_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1304, "end_line": 1344, "span_ids": ["test_jsonify_no_prettyprint", "test_jsonify_mimetype", "test_jsonify_args_and_kwargs_check", "test_json_dump_dataclass", "test_url_generation"], "tokens": 352}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"compact\", [True, False])\ndef test_jsonify_no_prettyprint(app, compact):\n app.json.compact = compact\n rv = app.json.response({\"msg\": {\"submsg\": \"W00t\"}, \"msg2\": \"foobar\"})\n data = rv.data.strip()\n assert (b\" \" not in data) is compact\n assert (b\"\\n\" not in data) is compact\n\n\ndef test_jsonify_mimetype(app, req_ctx):\n app.json.mimetype = \"application/vnd.api+json\"\n msg = {\"msg\": {\"submsg\": \"W00t\"}}\n rv = flask.make_response(flask.jsonify(msg), 200)\n assert rv.mimetype == \"application/vnd.api+json\"\n\n\ndef test_json_dump_dataclass(app, req_ctx):\n from dataclasses import make_dataclass\n\n Data = make_dataclass(\"Data\", [(\"name\", str)])\n value = app.json.dumps(Data(\"Flask\"))\n value = app.json.loads(value)\n assert value == {\"name\": \"Flask\"}\n\n\ndef test_jsonify_args_and_kwargs_check(app, req_ctx):\n with pytest.raises(TypeError) as e:\n flask.jsonify(\"fake args\", kwargs=\"fake\")\n assert \"args or kwargs\" in str(e.value)\n\n\ndef test_url_generation(app, req_ctx):\n @app.route(\"/hello/\", methods=[\"POST\"])\n def hello():\n pass\n\n assert flask.url_for(\"hello\", name=\"test x\") == \"/hello/test%20x\"\n assert (\n flask.url_for(\"hello\", name=\"test x\", _external=True)\n == \"http://localhost/hello/test%20x\"\n )", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_exception_propagation_test_werkzeug_passthrough_errors.app_run_debug_debug_use_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_exception_propagation_test_werkzeug_passthrough_errors.app_run_debug_debug_use_", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1535, "end_line": 1567, "span_ids": ["test_exception_propagation", "test_werkzeug_passthrough_errors"], "tokens": 277}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"key\", [\"TESTING\", \"PROPAGATE_EXCEPTIONS\", \"DEBUG\", None])\ndef test_exception_propagation(app, client, key):\n app.testing = False\n\n @app.route(\"/\")\n def index():\n 1 // 0\n\n if key is not None:\n app.config[key] = True\n\n with pytest.raises(ZeroDivisionError):\n client.get(\"/\")\n else:\n assert client.get(\"/\").status_code == 500\n\n\n@pytest.mark.parametrize(\"debug\", [True, False])\n@pytest.mark.parametrize(\"use_debugger\", [True, False])\n@pytest.mark.parametrize(\"use_reloader\", [True, False])\n@pytest.mark.parametrize(\"propagate_exceptions\", [None, True, False])\ndef test_werkzeug_passthrough_errors(\n monkeypatch, debug, use_debugger, use_reloader, propagate_exceptions, app\n):\n rv = {}\n\n # Mocks werkzeug.serving.run_simple method\n def run_simple_mock(*args, **kwargs):\n rv[\"passthrough_errors\"] = kwargs.get(\"passthrough_errors\")\n\n monkeypatch.setattr(werkzeug.serving, \"run_simple\", run_simple_mock)\n app.config[\"PROPAGATE_EXCEPTIONS\"] = propagate_exceptions\n app.run(debug=debug, use_debugger=use_debugger, use_reloader=use_reloader)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_nonascii_pathinfo_test_no_setup_after_first_request.assert_setup_method_add": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_nonascii_pathinfo_test_no_setup_after_first_request.assert_setup_method_add", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1644, "end_line": 1665, "span_ids": ["test_nonascii_pathinfo", "test_no_setup_after_first_request"], "tokens": 137}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_nonascii_pathinfo(app, client):\n @app.route(\"/\u043a\u0438\u0440\u0442\u0435\u0441\u0442\")\n def index():\n return \"Hello World!\"\n\n rv = client.get(\"/\u043a\u0438\u0440\u0442\u0435\u0441\u0442\")\n assert rv.data == b\"Hello World!\"\n\n\ndef test_no_setup_after_first_request(app, client):\n app.debug = True\n\n @app.route(\"/\")\n def index():\n return \"Awesome\"\n\n assert client.get(\"/\").data == b\"Awesome\"\n\n with pytest.raises(AssertionError) as exc_info:\n app.add_url_rule(\"/foo\", endpoint=\"late\")\n\n assert \"setup method 'add_url_rule'\" in str(exc_info.value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_routing_redirect_debugging_test_routing_redirect_debugging.assert_canonical_URL_ht": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_basic.py_test_routing_redirect_debugging_test_routing_redirect_debugging.assert_canonical_URL_ht", "embedding": null, "metadata": {"file_path": "tests/test_basic.py", "file_name": "test_basic.py", "file_type": "text/x-python", "category": "test", "start_line": 1668, "end_line": 1685, "span_ids": ["test_routing_redirect_debugging"], "tokens": 163}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_routing_redirect_debugging(monkeypatch, app, client):\n app.config[\"DEBUG\"] = True\n\n @app.route(\"/user/\", methods=[\"GET\", \"POST\"])\n def user():\n return flask.request.form[\"status\"]\n\n # default redirect code preserves form data\n rv = client.post(\"/user\", data={\"status\": \"success\"}, follow_redirects=True)\n assert rv.data == b\"success\"\n\n # 301 and 302 raise error\n monkeypatch.setattr(RequestRedirect, \"code\", 301)\n\n with client, pytest.raises(AssertionError) as exc_info:\n client.post(\"/user\", data={\"status\": \"error\"}, follow_redirects=True)\n\n assert \"canonical URL 'http://localhost/user/'\" in str(exc_info.value)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_pytest_test_blueprint_specific_error_handling.assert_client_get_what_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_pytest_test_blueprint_specific_error_handling.assert_client_get_what_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 43, "span_ids": ["test_blueprint_specific_error_handling", "imports"], "tokens": 283}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import pytest\nfrom jinja2 import TemplateNotFound\nfrom werkzeug.http import parse_cache_control_header\n\nimport flask\n\n\ndef test_blueprint_specific_error_handling(app, client):\n frontend = flask.Blueprint(\"frontend\", __name__)\n backend = flask.Blueprint(\"backend\", __name__)\n sideend = flask.Blueprint(\"sideend\", __name__)\n\n @frontend.errorhandler(403)\n def frontend_forbidden(e):\n return \"frontend says no\", 403\n\n @frontend.route(\"/frontend-no\")\n def frontend_no():\n flask.abort(403)\n\n @backend.errorhandler(403)\n def backend_forbidden(e):\n return \"backend says no\", 403\n\n @backend.route(\"/backend-no\")\n def backend_no():\n flask.abort(403)\n\n @sideend.route(\"/what-is-a-sideend\")\n def sideend_no():\n flask.abort(403)\n\n app.register_blueprint(frontend)\n app.register_blueprint(backend)\n app.register_blueprint(sideend)\n\n @app.errorhandler(403)\n def app_forbidden(e):\n return \"application itself says no\", 403\n\n assert client.get(\"/frontend-no\").data == b\"frontend says no\"\n assert client.get(\"/backend-no\").data == b\"backend says no\"\n assert client.get(\"/what-is-a-sideend\").data == b\"application itself says no\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_list_test_empty_url_defaults.assert_client_get_page_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_templates_list_test_empty_url_defaults.assert_client_get_page_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 247, "end_line": 287, "span_ids": ["test_dotted_name_not_allowed", "test_templates_list", "test_empty_url_defaults", "test_dotted_names_from_app"], "tokens": 239}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_templates_list(test_apps):\n from blueprintapp import app\n\n templates = sorted(app.jinja_env.list_templates())\n assert templates == [\"admin/index.html\", \"frontend/index.html\"]\n\n\ndef test_dotted_name_not_allowed(app, client):\n with pytest.raises(ValueError):\n flask.Blueprint(\"app.ui\", __name__)\n\n\ndef test_dotted_names_from_app(app, client):\n test = flask.Blueprint(\"test\", __name__)\n\n @app.route(\"/\")\n def app_index():\n return flask.url_for(\"test.index\")\n\n @test.route(\"/test/\")\n def index():\n return flask.url_for(\"app_index\")\n\n app.register_blueprint(test)\n\n rv = client.get(\"/\")\n assert rv.data == b\"/test/\"\n\n\ndef test_empty_url_defaults(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.route(\"/\", defaults={\"page\": 1})\n @bp.route(\"/page/\")\n def something(page):\n return str(page)\n\n app.register_blueprint(bp)\n\n assert client.get(\"/\").data == b\"1\"\n assert client.get(\"/page/2\").data == b\"2\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_with_dots_test_template_filter_after_route_with_template.assert_rv_data_b_dcba_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_route_decorator_custom_endpoint_with_dots_test_template_filter_after_route_with_template.assert_rv_data_b_dcba_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 322, "end_line": 439, "span_ids": ["test_template_filter_with_name", "test_template_filter", "test_add_template_filter_with_name", "test_template_filter_after_route_with_template", "test_add_template_filter", "test_endpoint_decorator", "test_template_filter_with_template", "test_route_decorator_custom_endpoint_with_dots"], "tokens": 778}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_route_decorator_custom_endpoint_with_dots(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n with pytest.raises(ValueError):\n bp.route(\"/\", endpoint=\"a.b\")(lambda: \"\")\n\n with pytest.raises(ValueError):\n bp.add_url_rule(\"/\", endpoint=\"a.b\")\n\n def view():\n return \"\"\n\n view.__name__ = \"a.b\"\n\n with pytest.raises(ValueError):\n bp.add_url_rule(\"/\", view_func=view)\n\n\ndef test_endpoint_decorator(app, client):\n from werkzeug.routing import Rule\n\n app.url_map.add(Rule(\"/foo\", endpoint=\"bar\"))\n\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.endpoint(\"bar\")\n def foobar():\n return flask.request.endpoint\n\n app.register_blueprint(bp, url_prefix=\"/bp_prefix\")\n\n assert client.get(\"/foo\").data == b\"bar\"\n assert client.get(\"/bp_prefix/bar\").status_code == 404\n\n\ndef test_template_filter(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_filter()\n def my_reverse(s):\n return s[::-1]\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"my_reverse\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"my_reverse\"] == my_reverse\n assert app.jinja_env.filters[\"my_reverse\"](\"abcd\") == \"dcba\"\n\n\ndef test_add_template_filter(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def my_reverse(s):\n return s[::-1]\n\n bp.add_app_template_filter(my_reverse)\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"my_reverse\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"my_reverse\"] == my_reverse\n assert app.jinja_env.filters[\"my_reverse\"](\"abcd\") == \"dcba\"\n\n\ndef test_template_filter_with_name(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_filter(\"strrev\")\n def my_reverse(s):\n return s[::-1]\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"strrev\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"strrev\"] == my_reverse\n assert app.jinja_env.filters[\"strrev\"](\"abcd\") == \"dcba\"\n\n\ndef test_add_template_filter_with_name(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def my_reverse(s):\n return s[::-1]\n\n bp.add_app_template_filter(my_reverse, \"strrev\")\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"strrev\" in app.jinja_env.filters.keys()\n assert app.jinja_env.filters[\"strrev\"] == my_reverse\n assert app.jinja_env.filters[\"strrev\"](\"abcd\") == \"dcba\"\n\n\ndef test_template_filter_with_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_filter()\n def super_reverse(s):\n return s[::-1]\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_template_filter_after_route_with_template(app, client):\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_filter()\n def super_reverse(s):\n return s[::-1]\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_add_template_filter_with_template_test_template_test_with_template.assert_b_Success_in_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_add_template_filter_with_template_test_template_test_with_template.assert_b_Success_in_rv_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 442, "end_line": 559, "span_ids": ["test_template_test", "test_template_filter_with_name_and_template", "test_add_template_test_with_name", "test_template_test_with_name", "test_add_template_filter_with_name_and_template", "test_add_template_test", "test_template_test_with_template", "test_add_template_filter_with_template"], "tokens": 752}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_add_template_filter_with_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def super_reverse(s):\n return s[::-1]\n\n bp.add_app_template_filter(super_reverse)\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_template_filter_with_name_and_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_filter(\"super_reverse\")\n def my_reverse(s):\n return s[::-1]\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_add_template_filter_with_name_and_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def my_reverse(s):\n return s[::-1]\n\n bp.add_app_template_filter(my_reverse, \"super_reverse\")\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_filter.html\", value=\"abcd\")\n\n rv = client.get(\"/\")\n assert rv.data == b\"dcba\"\n\n\ndef test_template_test(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_test()\n def is_boolean(value):\n return isinstance(value, bool)\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"is_boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"is_boolean\"] == is_boolean\n assert app.jinja_env.tests[\"is_boolean\"](False)\n\n\ndef test_add_template_test(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def is_boolean(value):\n return isinstance(value, bool)\n\n bp.add_app_template_test(is_boolean)\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"is_boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"is_boolean\"] == is_boolean\n assert app.jinja_env.tests[\"is_boolean\"](False)\n\n\ndef test_template_test_with_name(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_test(\"boolean\")\n def is_boolean(value):\n return isinstance(value, bool)\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == is_boolean\n assert app.jinja_env.tests[\"boolean\"](False)\n\n\ndef test_add_template_test_with_name(app):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def is_boolean(value):\n return isinstance(value, bool)\n\n bp.add_app_template_test(is_boolean, \"boolean\")\n app.register_blueprint(bp, url_prefix=\"/py\")\n assert \"boolean\" in app.jinja_env.tests.keys()\n assert app.jinja_env.tests[\"boolean\"] == is_boolean\n assert app.jinja_env.tests[\"boolean\"](False)\n\n\ndef test_template_test_with_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_test()\n def boolean(value):\n return isinstance(value, bool)\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_test_after_route_with_template_test_add_template_test_with_name_and_template.assert_b_Success_in_rv_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_template_test_after_route_with_template_test_add_template_test_with_name_and_template.assert_b_Success_in_rv_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 562, "end_line": 626, "span_ids": ["test_add_template_test_with_name_and_template", "test_add_template_test_with_template", "test_template_test_with_name_and_template", "test_template_test_after_route_with_template"], "tokens": 377}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_template_test_after_route_with_template(app, client):\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_test()\n def boolean(value):\n return isinstance(value, bool)\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_add_template_test_with_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def boolean(value):\n return isinstance(value, bool)\n\n bp.add_app_template_test(boolean)\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_template_test_with_name_and_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n @bp.app_template_test(\"boolean\")\n def is_boolean(value):\n return isinstance(value, bool)\n\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data\n\n\ndef test_add_template_test_with_name_and_template(app, client):\n bp = flask.Blueprint(\"bp\", __name__)\n\n def is_boolean(value):\n return isinstance(value, bool)\n\n bp.add_app_template_test(is_boolean, \"boolean\")\n app.register_blueprint(bp, url_prefix=\"/py\")\n\n @app.route(\"/\")\n def index():\n return flask.render_template(\"template_test.html\", value=False)\n\n rv = client.get(\"/\")\n assert b\"Success!\" in rv.data", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_blueprint_test_nested_blueprint.None_5": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_blueprint_test_nested_blueprint.None_5", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 787, "end_line": 833, "span_ids": ["test_nested_blueprint"], "tokens": 344}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_nested_blueprint(app, client):\n parent = flask.Blueprint(\"parent\", __name__)\n child = flask.Blueprint(\"child\", __name__)\n grandchild = flask.Blueprint(\"grandchild\", __name__)\n\n @parent.errorhandler(403)\n def forbidden(e):\n return \"Parent no\", 403\n\n @parent.route(\"/\")\n def parent_index():\n return \"Parent yes\"\n\n @parent.route(\"/no\")\n def parent_no():\n flask.abort(403)\n\n @child.route(\"/\")\n def child_index():\n return \"Child yes\"\n\n @child.route(\"/no\")\n def child_no():\n flask.abort(403)\n\n @grandchild.errorhandler(403)\n def grandchild_forbidden(e):\n return \"Grandchild no\", 403\n\n @grandchild.route(\"/\")\n def grandchild_index():\n return \"Grandchild yes\"\n\n @grandchild.route(\"/no\")\n def grandchild_no():\n flask.abort(403)\n\n child.register_blueprint(grandchild, url_prefix=\"/grandchild\")\n parent.register_blueprint(child, url_prefix=\"/child\")\n app.register_blueprint(parent, url_prefix=\"/parent\")\n\n assert client.get(\"/parent/\").data == b\"Parent yes\"\n assert client.get(\"/parent/child/\").data == b\"Child yes\"\n assert client.get(\"/parent/child/grandchild/\").data == b\"Grandchild yes\"\n assert client.get(\"/parent/no\").data == b\"Parent no\"\n assert client.get(\"/parent/child/no\").data == b\"Parent no\"\n assert client.get(\"/parent/child/grandchild/no\").data == b\"Grandchild no\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_callback_order_test_nested_callback_order.assert_client_get_b_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nested_callback_order_test_nested_callback_order.assert_client_get_b_d", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 836, "end_line": 913, "span_ids": ["test_nested_callback_order"], "tokens": 531}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_nested_callback_order(app, client):\n parent = flask.Blueprint(\"parent\", __name__)\n child = flask.Blueprint(\"child\", __name__)\n\n @app.before_request\n def app_before1():\n flask.g.setdefault(\"seen\", []).append(\"app_1\")\n\n @app.teardown_request\n def app_teardown1(e=None):\n assert flask.g.seen.pop() == \"app_1\"\n\n @app.before_request\n def app_before2():\n flask.g.setdefault(\"seen\", []).append(\"app_2\")\n\n @app.teardown_request\n def app_teardown2(e=None):\n assert flask.g.seen.pop() == \"app_2\"\n\n @app.context_processor\n def app_ctx():\n return dict(key=\"app\")\n\n @parent.before_request\n def parent_before1():\n flask.g.setdefault(\"seen\", []).append(\"parent_1\")\n\n @parent.teardown_request\n def parent_teardown1(e=None):\n assert flask.g.seen.pop() == \"parent_1\"\n\n @parent.before_request\n def parent_before2():\n flask.g.setdefault(\"seen\", []).append(\"parent_2\")\n\n @parent.teardown_request\n def parent_teardown2(e=None):\n assert flask.g.seen.pop() == \"parent_2\"\n\n @parent.context_processor\n def parent_ctx():\n return dict(key=\"parent\")\n\n @child.before_request\n def child_before1():\n flask.g.setdefault(\"seen\", []).append(\"child_1\")\n\n @child.teardown_request\n def child_teardown1(e=None):\n assert flask.g.seen.pop() == \"child_1\"\n\n @child.before_request\n def child_before2():\n flask.g.setdefault(\"seen\", []).append(\"child_2\")\n\n @child.teardown_request\n def child_teardown2(e=None):\n assert flask.g.seen.pop() == \"child_2\"\n\n @child.context_processor\n def child_ctx():\n return dict(key=\"child\")\n\n @child.route(\"/a\")\n def a():\n return \", \".join(flask.g.seen)\n\n @child.route(\"/b\")\n def b():\n return flask.render_template_string(\"{{ key }}\")\n\n parent.register_blueprint(child)\n app.register_blueprint(parent)\n assert (\n client.get(\"/a\").data == b\"app_1, app_2, parent_1, parent_2, child_1, child_2\"\n )\n assert client.get(\"/b\").data == b\"child\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_url_prefixes_test_nesting_url_prefixes.assert_response_status_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_url_prefixes_test_nesting_url_prefixes.assert_response_status_co", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 916, "end_line": 944, "span_ids": ["test_nesting_url_prefixes"], "tokens": 196}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"parent_init, child_init, parent_registration, child_registration\",\n [\n (\"/parent\", \"/child\", None, None),\n (\"/parent\", None, None, \"/child\"),\n (None, None, \"/parent\", \"/child\"),\n (\"/other\", \"/something\", \"/parent\", \"/child\"),\n ],\n)\ndef test_nesting_url_prefixes(\n parent_init,\n child_init,\n parent_registration,\n child_registration,\n app,\n client,\n) -> None:\n parent = flask.Blueprint(\"parent\", __name__, url_prefix=parent_init)\n child = flask.Blueprint(\"child\", __name__, url_prefix=child_init)\n\n @child.route(\"/\")\n def index():\n return \"index\"\n\n parent.register_blueprint(child, url_prefix=child_registration)\n app.register_blueprint(parent, url_prefix=parent_registration)\n\n response = client.get(\"/parent/child/\")\n assert response.status_code == 200", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_subdomains_test_nesting_subdomains.assert_response_status_co": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_nesting_subdomains_test_nesting_subdomains.assert_response_status_co", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 947, "end_line": 965, "span_ids": ["test_nesting_subdomains"], "tokens": 134}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_nesting_subdomains(app, client) -> None:\n subdomain = \"api\"\n parent = flask.Blueprint(\"parent\", __name__)\n child = flask.Blueprint(\"child\", __name__)\n\n @child.route(\"/child/\")\n def index():\n return \"child\"\n\n parent.register_blueprint(child)\n app.register_blueprint(parent, subdomain=subdomain)\n\n client.allow_subdomain_redirects = True\n\n domain_name = \"domain.tld\"\n app.config[\"SERVER_NAME\"] = domain_name\n response = client.get(\"/child/\", base_url=\"http://api.\" + domain_name)\n\n assert response.status_code == 200", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_child_and_parent_subdomain_test_child_and_parent_subdomain.None_2": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_child_and_parent_subdomain_test_child_and_parent_subdomain.None_2", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 968, "end_line": 993, "span_ids": ["test_child_and_parent_subdomain"], "tokens": 185}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_child_and_parent_subdomain(app, client) -> None:\n child_subdomain = \"api\"\n parent_subdomain = \"parent\"\n parent = flask.Blueprint(\"parent\", __name__)\n child = flask.Blueprint(\"child\", __name__, subdomain=child_subdomain)\n\n @child.route(\"/\")\n def index():\n return \"child\"\n\n parent.register_blueprint(child)\n app.register_blueprint(parent, subdomain=parent_subdomain)\n\n client.allow_subdomain_redirects = True\n\n domain_name = \"domain.tld\"\n app.config[\"SERVER_NAME\"] = domain_name\n response = client.get(\n \"/\", base_url=f\"http://{child_subdomain}.{parent_subdomain}.{domain_name}\"\n )\n\n assert response.status_code == 200\n\n response = client.get(\"/\", base_url=f\"http://{parent_subdomain}.{domain_name}\")\n\n assert response.status_code == 404", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_unique_blueprint_names_test_self_registration.with_pytest_raises_ValueE.bp_register_blueprint_bp_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_unique_blueprint_names_test_self_registration.with_pytest_raises_ValueE.bp_register_blueprint_bp_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 996, "end_line": 1016, "span_ids": ["test_self_registration", "test_unique_blueprint_names"], "tokens": 164}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_unique_blueprint_names(app, client) -> None:\n bp = flask.Blueprint(\"bp\", __name__)\n bp2 = flask.Blueprint(\"bp\", __name__)\n\n app.register_blueprint(bp)\n\n with pytest.raises(ValueError):\n app.register_blueprint(bp) # same bp, same name, error\n\n app.register_blueprint(bp, name=\"again\") # same bp, different name, ok\n\n with pytest.raises(ValueError):\n app.register_blueprint(bp2) # different bp, same name, error\n\n app.register_blueprint(bp2, name=\"alt\") # different bp, different name, ok\n\n\ndef test_self_registration(app, client) -> None:\n bp = flask.Blueprint(\"bp\", __name__)\n with pytest.raises(ValueError):\n bp.register_blueprint(bp)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_renaming_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_blueprints.py_test_blueprint_renaming_", "embedding": null, "metadata": {"file_path": "tests/test_blueprints.py", "file_name": "test_blueprints.py", "file_type": "text/x-python", "category": "test", "start_line": 1019, "end_line": 1049, "span_ids": ["test_blueprint_renaming"], "tokens": 246}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_blueprint_renaming(app, client) -> None:\n bp = flask.Blueprint(\"bp\", __name__)\n bp2 = flask.Blueprint(\"bp2\", __name__)\n\n @bp.get(\"/\")\n def index():\n return flask.request.endpoint\n\n @bp.get(\"/error\")\n def error():\n flask.abort(403)\n\n @bp.errorhandler(403)\n def forbidden(_: Exception):\n return \"Error\", 403\n\n @bp2.get(\"/\")\n def index2():\n return flask.request.endpoint\n\n bp.register_blueprint(bp2, url_prefix=\"/a\", name=\"sub\")\n app.register_blueprint(bp, url_prefix=\"/a\")\n app.register_blueprint(bp, url_prefix=\"/b\", name=\"alt\")\n\n assert client.get(\"/a/\").data == b\"bp.index\"\n assert client.get(\"/b/\").data == b\"alt.index\"\n assert client.get(\"/a/a/\").data == b\"bp.sub.index2\"\n assert client.get(\"/b/a/\").data == b\"alt.sub.index2\"\n assert client.get(\"/a/error\").data == b\"Error\"\n assert client.get(\"/b/error\").data == b\"Error\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_prepare_import_test_prepare_import.assert_sys_path_0_str": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_prepare_import_test_prepare_import.assert_sys_path_0_str", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 133, "end_line": 175, "span_ids": ["test_prepare_import"], "tokens": 345}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"value,path,result\",\n (\n (\"test\", cwd, \"test\"),\n (\"test.py\", cwd, \"test\"),\n (\"a/test\", cwd / \"a\", \"test\"),\n (\"test/__init__.py\", cwd, \"test\"),\n (\"test/__init__\", cwd, \"test\"),\n # nested package\n (\n test_path / \"cliapp\" / \"inner1\" / \"__init__\",\n test_path,\n \"cliapp.inner1\",\n ),\n (\n test_path / \"cliapp\" / \"inner1\" / \"inner2\",\n test_path,\n \"cliapp.inner1.inner2\",\n ),\n # dotted name\n (\"test.a.b\", cwd, \"test.a.b\"),\n (test_path / \"cliapp.app\", test_path, \"cliapp.app\"),\n # not a Python file, will be caught during import\n (test_path / \"cliapp\" / \"message.txt\", test_path, \"cliapp.message.txt\"),\n ),\n)\ndef test_prepare_import(request, value, path, result):\n \"\"\"Expect the correct path to be set and the correct import and app names\n to be returned.\n\n :func:`prepare_exec_for_file` has a side effect where the parent directory\n of the given import is added to :data:`sys.path`. This is reset after the\n test runs.\n \"\"\"\n original_path = sys.path[:]\n\n def reset_path():\n sys.path[:] = original_path\n\n request.addfinalizer(reset_path)\n\n assert prepare_import(value) == result\n assert sys.path[0] == str(path)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_test_locate_app.assert_locate_app_iname_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_test_locate_app.assert_locate_app_iname_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 178, "end_line": 194, "span_ids": ["test_locate_app"], "tokens": 182}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"iname,aname,result\",\n (\n (\"cliapp.app\", None, \"testapp\"),\n (\"cliapp.app\", \"testapp\", \"testapp\"),\n (\"cliapp.factory\", None, \"app\"),\n (\"cliapp.factory\", \"create_app\", \"app\"),\n (\"cliapp.factory\", \"create_app()\", \"app\"),\n (\"cliapp.factory\", 'create_app2(\"foo\", \"bar\")', \"app2_foo_bar\"),\n # trailing comma space\n (\"cliapp.factory\", 'create_app2(\"foo\", \"bar\", )', \"app2_foo_bar\"),\n # strip whitespace\n (\"cliapp.factory\", \" create_app () \", \"app\"),\n ),\n)\ndef test_locate_app(test_apps, iname, aname, result):\n assert locate_app(iname, aname).name == result", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_raises_test_locate_app_raises.with_pytest_raises_NoAppE.locate_app_iname_aname_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_locate_app_raises_test_locate_app_raises.with_pytest_raises_NoAppE.locate_app_iname_aname_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 197, "end_line": 217, "span_ids": ["test_locate_app_raises"], "tokens": 160}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\n \"iname,aname\",\n (\n (\"notanapp.py\", None),\n (\"cliapp/app\", None),\n (\"cliapp.app\", \"notanapp\"),\n # not enough arguments\n (\"cliapp.factory\", 'create_app2(\"foo\")'),\n # invalid identifier\n (\"cliapp.factory\", \"create_app(\"),\n # no app returned\n (\"cliapp.factory\", \"no_app\"),\n # nested import error\n (\"cliapp.importerrorapp\", None),\n # not a Python file\n (\"cliapp.message.txt\", None),\n ),\n)\ndef test_locate_app_raises(test_apps, iname, aname):\n with pytest.raises(NoAppException):\n locate_app(iname, aname)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_app_cli_has_app_context_test_with_appcontext.assert_result_output_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_app_cli_has_app_context_test_with_appcontext.assert_result_output_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 291, "end_line": 319, "span_ids": ["test_with_appcontext", "test_app_cli_has_app_context"], "tokens": 222}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_app_cli_has_app_context(app, runner):\n def _param_cb(ctx, param, value):\n # current_app should be available in parameter callbacks\n return bool(current_app)\n\n @app.cli.command()\n @click.argument(\"value\", callback=_param_cb)\n def check(value):\n app = click.get_current_context().obj.load_app()\n # the loaded app should be the same as current_app\n same_app = current_app._get_current_object() is app\n return same_app, value\n\n cli = FlaskGroup(create_app=lambda: app)\n result = runner.invoke(cli, [\"check\", \"x\"], standalone_mode=False)\n assert result.return_value == (True, True)\n\n\ndef test_with_appcontext(runner):\n @click.command()\n @with_appcontext\n def testcmd():\n click.echo(current_app.name)\n\n obj = ScriptInfo(create_app=lambda: Flask(\"testapp\"))\n\n result = runner.invoke(testcmd, obj=obj)\n assert result.exit_code == 0\n assert result.output == \"testapp\\n\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_appgroup_app_context_test_appgroup_app_context.None_3": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_appgroup_app_context_test_appgroup_app_context.None_3", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 322, "end_line": 347, "span_ids": ["test_appgroup_app_context"], "tokens": 157}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_appgroup_app_context(runner):\n @click.group(cls=AppGroup)\n def cli():\n pass\n\n @cli.command()\n def test():\n click.echo(current_app.name)\n\n @cli.group()\n def subgroup():\n pass\n\n @subgroup.command()\n def test2():\n click.echo(current_app.name)\n\n obj = ScriptInfo(create_app=lambda: Flask(\"testappgroup\"))\n\n result = runner.invoke(cli, [\"test\"], obj=obj)\n assert result.exit_code == 0\n assert result.output == \"testappgroup\\n\"\n\n result = runner.invoke(cli, [\"subgroup\", \"test2\"], obj=obj)\n assert result.exit_code == 0\n assert result.output == \"testappgroup\\n\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_app_context_test_flaskgroup_debug.assert_result_output_f": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_app_context_test_flaskgroup_debug.assert_result_output_f", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 350, "end_line": 384, "span_ids": ["test_flaskgroup_app_context", "test_flaskgroup_debug"], "tokens": 224}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_flaskgroup_app_context(runner):\n def create_app():\n return Flask(\"flaskgroup\")\n\n @click.group(cls=FlaskGroup, create_app=create_app)\n def cli(**params):\n pass\n\n @cli.command()\n def test():\n click.echo(current_app.name)\n\n result = runner.invoke(cli, [\"test\"])\n assert result.exit_code == 0\n assert result.output == \"flaskgroup\\n\"\n\n\n@pytest.mark.parametrize(\"set_debug_flag\", (True, False))\ndef test_flaskgroup_debug(runner, set_debug_flag):\n def create_app():\n app = Flask(\"flaskgroup\")\n app.debug = True\n return app\n\n @click.group(cls=FlaskGroup, create_app=create_app, set_debug_flag=set_debug_flag)\n def cli(**params):\n pass\n\n @cli.command()\n def test():\n click.echo(str(current_app.debug))\n\n result = runner.invoke(cli, [\"test\"])\n assert result.exit_code == 0\n assert result.output == f\"{not set_debug_flag}\\n\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_nested_test_help_echo_exception.assert_Usage_in_result": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_flaskgroup_nested_test_help_echo_exception.assert_Usage_in_result", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 387, "end_line": 429, "span_ids": ["test_help_echo_exception", "test_no_command_echo_loading_error", "test_flaskgroup_nested", "test_help_echo_loading_error"], "tokens": 292}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_flaskgroup_nested(app, runner):\n cli = click.Group(\"cli\")\n flask_group = FlaskGroup(name=\"flask\", create_app=lambda: app)\n cli.add_command(flask_group)\n\n @flask_group.command()\n def show():\n click.echo(current_app.name)\n\n result = runner.invoke(cli, [\"flask\", \"show\"])\n assert result.output == \"flask_test\\n\"\n\n\ndef test_no_command_echo_loading_error():\n from flask.cli import cli\n\n runner = CliRunner(mix_stderr=False)\n result = runner.invoke(cli, [\"missing\"])\n assert result.exit_code == 2\n assert \"FLASK_APP\" in result.stderr\n assert \"Usage:\" in result.stderr\n\n\ndef test_help_echo_loading_error():\n from flask.cli import cli\n\n runner = CliRunner(mix_stderr=False)\n result = runner.invoke(cli, [\"--help\"])\n assert result.exit_code == 0\n assert \"FLASK_APP\" in result.stderr\n assert \"Usage:\" in result.stdout\n\n\ndef test_help_echo_exception():\n def create_app():\n raise Exception(\"oh no\")\n\n cli = FlaskGroup(create_app=create_app)\n runner = CliRunner(mix_stderr=False)\n result = runner.invoke(cli, [\"--help\"])\n assert result.exit_code == 0\n assert \"Exception: oh no\" in result.stderr\n assert \"Usage:\" in result.stdout", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_dotenv_not_available_test_load_dotenv.assert_not_load_dotenv_n": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_dotenv_not_available_test_load_dotenv.assert_not_load_dotenv_n", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 502, "end_line": 537, "span_ids": ["dotenv_not_available", "test_load_dotenv", "impl:5"], "tokens": 280}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def dotenv_not_available():\n try:\n import dotenv # noqa: F401\n except ImportError:\n return True\n\n return False\n\n\nneed_dotenv = pytest.mark.skipif(\n dotenv_not_available(), reason=\"dotenv is not installed\"\n)\n\n\n@need_dotenv\ndef test_load_dotenv(monkeypatch):\n # can't use monkeypatch.delitem since the keys don't exist yet\n for item in (\"FOO\", \"BAR\", \"SPAM\", \"HAM\"):\n monkeypatch._setitem.append((os.environ, item, notset))\n\n monkeypatch.setenv(\"EGGS\", \"3\")\n monkeypatch.chdir(test_path)\n assert load_dotenv()\n assert Path.cwd() == test_path\n # .flaskenv doesn't overwrite .env\n assert os.environ[\"FOO\"] == \"env\"\n # set only in .flaskenv\n assert os.environ[\"BAR\"] == \"bar\"\n # set only in .env\n assert os.environ[\"SPAM\"] == \"1\"\n # set manually, files don't overwrite\n assert os.environ[\"EGGS\"] == \"3\"\n # test env file encoding\n assert os.environ[\"HAM\"] == \"\u706b\u817f\"\n # Non existent file should not load\n assert not load_dotenv(\"non-existent-file\")", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_dotenv_path_test_disable_dotenv_from_env.assert_FOO_not_in_os_en": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_dotenv_path_test_disable_dotenv_from_env.assert_FOO_not_in_os_en", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 540, "end_line": 562, "span_ids": ["test_dotenv_path", "test_dotenv_optional", "test_disable_dotenv_from_env"], "tokens": 180}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@need_dotenv\ndef test_dotenv_path(monkeypatch):\n for item in (\"FOO\", \"BAR\", \"EGGS\"):\n monkeypatch._setitem.append((os.environ, item, notset))\n\n load_dotenv(test_path / \".flaskenv\")\n assert Path.cwd() == cwd\n assert \"FOO\" in os.environ\n\n\ndef test_dotenv_optional(monkeypatch):\n monkeypatch.setitem(sys.modules, \"dotenv\", None)\n monkeypatch.chdir(test_path)\n load_dotenv()\n assert \"FOO\" not in os.environ\n\n\n@need_dotenv\ndef test_disable_dotenv_from_env(monkeypatch, runner):\n monkeypatch.chdir(test_path)\n monkeypatch.setitem(os.environ, \"FLASK_SKIP_DOTENV\", \"1\")\n runner.invoke(FlaskGroup())\n assert \"FOO\" not in os.environ", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_path_test_run_cert_path.None_1": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_run_cert_path_test_run_cert_path.None_1", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 565, "end_line": 580, "span_ids": ["test_run_cert_path"], "tokens": 152}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_run_cert_path():\n # no key\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--cert\", __file__])\n\n # no cert\n with pytest.raises(click.BadParameter):\n run_command.make_context(\"run\", [\"--key\", __file__])\n\n # cert specified first\n ctx = run_command.make_context(\"run\", [\"--cert\", __file__, \"--key\", __file__])\n assert ctx.params[\"cert\"] == (__file__, __file__)\n\n # key specified first\n ctx = run_command.make_context(\"run\", [\"--key\", __file__, \"--cert\", __file__])\n assert ctx.params[\"cert\"] == (__file__, __file__)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_cli_blueprints_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_cli.py_test_cli_blueprints_", "embedding": null, "metadata": {"file_path": "tests/test_cli.py", "file_name": "test_cli.py", "file_type": "text/x-python", "category": "test", "start_line": 629, "end_line": 679, "span_ids": ["test_cli_empty", "test_cli_blueprints"], "tokens": 360}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_cli_blueprints(app):\n \"\"\"Test blueprint commands register correctly to the application\"\"\"\n custom = Blueprint(\"custom\", __name__, cli_group=\"customized\")\n nested = Blueprint(\"nested\", __name__)\n merged = Blueprint(\"merged\", __name__, cli_group=None)\n late = Blueprint(\"late\", __name__)\n\n @custom.cli.command(\"custom\")\n def custom_command():\n click.echo(\"custom_result\")\n\n @nested.cli.command(\"nested\")\n def nested_command():\n click.echo(\"nested_result\")\n\n @merged.cli.command(\"merged\")\n def merged_command():\n click.echo(\"merged_result\")\n\n @late.cli.command(\"late\")\n def late_command():\n click.echo(\"late_result\")\n\n app.register_blueprint(custom)\n app.register_blueprint(nested)\n app.register_blueprint(merged)\n app.register_blueprint(late, cli_group=\"late_registration\")\n\n app_runner = app.test_cli_runner()\n\n result = app_runner.invoke(args=[\"customized\", \"custom\"])\n assert \"custom_result\" in result.output\n\n result = app_runner.invoke(args=[\"nested\", \"nested\"])\n assert \"nested_result\" in result.output\n\n result = app_runner.invoke(args=[\"merged\"])\n assert \"merged_result\" in result.output\n\n result = app_runner.invoke(args=[\"late_registration\", \"late\"])\n assert \"late_result\" in result.output\n\n\ndef test_cli_empty(app):\n \"\"\"If a Blueprint's CLI group is empty, do not register it.\"\"\"\n bp = Blueprint(\"blue\", __name__, cli_group=\"blue\")\n app.register_blueprint(bp)\n\n result = app.test_cli_runner().invoke(args=[\"blue\", \"--help\"])\n assert result.exit_code == 2, f\"Unexpected success:\\n\\n{result.output}\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_test_from_prefixed_env_custom_prefix.assert_app_config_A_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_test_from_prefixed_env_custom_prefix.assert_app_config_A_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 40, "end_line": 68, "span_ids": ["test_from_prefixed_env", "test_from_prefixed_env_custom_prefix"], "tokens": 283}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_from_prefixed_env(monkeypatch):\n monkeypatch.setenv(\"FLASK_STRING\", \"value\")\n monkeypatch.setenv(\"FLASK_BOOL\", \"true\")\n monkeypatch.setenv(\"FLASK_INT\", \"1\")\n monkeypatch.setenv(\"FLASK_FLOAT\", \"1.2\")\n monkeypatch.setenv(\"FLASK_LIST\", \"[1, 2]\")\n monkeypatch.setenv(\"FLASK_DICT\", '{\"k\": \"v\"}')\n monkeypatch.setenv(\"NOT_FLASK_OTHER\", \"other\")\n\n app = flask.Flask(__name__)\n app.config.from_prefixed_env()\n\n assert app.config[\"STRING\"] == \"value\"\n assert app.config[\"BOOL\"] is True\n assert app.config[\"INT\"] == 1\n assert app.config[\"FLOAT\"] == 1.2\n assert app.config[\"LIST\"] == [1, 2]\n assert app.config[\"DICT\"] == {\"k\": \"v\"}\n assert \"OTHER\" not in app.config\n\n\ndef test_from_prefixed_env_custom_prefix(monkeypatch):\n monkeypatch.setenv(\"FLASK_A\", \"a\")\n monkeypatch.setenv(\"NOT_FLASK_A\", \"b\")\n\n app = flask.Flask(__name__)\n app.config.from_prefixed_env(\"NOT_FLASK\")\n\n assert app.config[\"A\"] == \"b\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_nested_test_from_prefixed_env_nested.assert_app_config_NEW_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_from_prefixed_env_nested_test_from_prefixed_env_nested.assert_app_config_NEW_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 71, "end_line": 99, "span_ids": ["test_from_prefixed_env_nested"], "tokens": 265}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_from_prefixed_env_nested(monkeypatch):\n monkeypatch.setenv(\"FLASK_EXIST__ok\", \"other\")\n monkeypatch.setenv(\"FLASK_EXIST__inner__ik\", \"2\")\n monkeypatch.setenv(\"FLASK_EXIST__new__more\", '{\"k\": false}')\n monkeypatch.setenv(\"FLASK_NEW__K\", \"v\")\n\n app = flask.Flask(__name__)\n app.config[\"EXIST\"] = {\"ok\": \"value\", \"flag\": True, \"inner\": {\"ik\": 1}}\n app.config.from_prefixed_env()\n\n if os.name != \"nt\":\n assert app.config[\"EXIST\"] == {\n \"ok\": \"other\",\n \"flag\": True,\n \"inner\": {\"ik\": 2},\n \"new\": {\"more\": {\"k\": False}},\n }\n else:\n # Windows env var keys are always uppercase.\n assert app.config[\"EXIST\"] == {\n \"ok\": \"value\",\n \"OK\": \"other\",\n \"flag\": True,\n \"inner\": {\"ik\": 1},\n \"INNER\": {\"IK\": 2},\n \"NEW\": {\"MORE\": {\"k\": False}},\n }\n\n assert app.config[\"NEW\"] == {\"K\": \"v\"}", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_mapping_test_config_from_mapping.with_pytest_raises_TypeEr.app_config_from_mapping_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_mapping_test_config_from_mapping.with_pytest_raises_TypeEr.app_config_from_mapping_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 102, "end_line": 121, "span_ids": ["test_config_from_mapping"], "tokens": 165}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_config_from_mapping():\n app = flask.Flask(__name__)\n app.config.from_mapping({\"SECRET_KEY\": \"config\", \"TEST_KEY\": \"foo\"})\n common_object_test(app)\n\n app = flask.Flask(__name__)\n app.config.from_mapping([(\"SECRET_KEY\", \"config\"), (\"TEST_KEY\", \"foo\")])\n common_object_test(app)\n\n app = flask.Flask(__name__)\n app.config.from_mapping(SECRET_KEY=\"config\", TEST_KEY=\"foo\")\n common_object_test(app)\n\n app = flask.Flask(__name__)\n app.config.from_mapping(SECRET_KEY=\"config\", TEST_KEY=\"foo\", skip_key=\"skip\")\n common_object_test(app)\n\n app = flask.Flask(__name__)\n with pytest.raises(TypeError):\n app.config.from_mapping({}, {})", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_class_test_config_from_envvar.common_object_test_app_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_from_class_test_config_from_envvar.common_object_test_app_", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 124, "end_line": 150, "span_ids": ["test_config_from_class.Test:2", "test_config_from_envvar", "test_config_from_class.Test", "test_config_from_class", "test_config_from_class.Base", "test_config_from_class.Base:2"], "tokens": 185}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_config_from_class():\n class Base:\n TEST_KEY = \"foo\"\n\n class Test(Base):\n SECRET_KEY = \"config\"\n\n app = flask.Flask(__name__)\n app.config.from_object(Test)\n common_object_test(app)\n\n\ndef test_config_from_envvar(monkeypatch):\n monkeypatch.setattr(\"os.environ\", {})\n app = flask.Flask(__name__)\n\n with pytest.raises(RuntimeError) as e:\n app.config.from_envvar(\"FOO_SETTINGS\")\n\n assert \"'FOO_SETTINGS' is not set\" in str(e.value)\n assert not app.config.from_envvar(\"FOO_SETTINGS\", silent=True)\n\n monkeypatch.setattr(\n \"os.environ\", {\"FOO_SETTINGS\": f\"{__file__.rsplit('.', 1)[0]}.py\"}\n )\n assert app.config.from_envvar(\"FOO_SETTINGS\")\n common_object_test(app)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_missing_test_session_lifetime.assert_app_permanent_sess": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_config.py_test_config_missing_test_session_lifetime.assert_app_permanent_sess", "embedding": null, "metadata": {"file_path": "tests/test_config.py", "file_name": "test_config.py", "file_type": "text/x-python", "category": "test", "start_line": 166, "end_line": 206, "span_ids": ["test_custom_config_class.Config:2", "test_custom_config_class", "test_config_missing", "test_custom_config_class.Config", "test_config_missing_file", "test_custom_config_class.Flask", "test_session_lifetime", "test_custom_config_class.Flask:2"], "tokens": 290}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_config_missing():\n app = flask.Flask(__name__)\n with pytest.raises(IOError) as e:\n app.config.from_pyfile(\"missing.cfg\")\n msg = str(e.value)\n assert msg.startswith(\n \"[Errno 2] Unable to load configuration file (No such file or directory):\"\n )\n assert msg.endswith(\"missing.cfg'\")\n assert not app.config.from_pyfile(\"missing.cfg\", silent=True)\n\n\ndef test_config_missing_file():\n app = flask.Flask(__name__)\n with pytest.raises(IOError) as e:\n app.config.from_file(\"missing.json\", load=json.load)\n msg = str(e.value)\n assert msg.startswith(\n \"[Errno 2] Unable to load configuration file (No such file or directory):\"\n )\n assert msg.endswith(\"missing.json'\")\n assert not app.config.from_file(\"missing.json\", load=json.load, silent=True)\n\n\ndef test_custom_config_class():\n class Config(flask.Config):\n pass\n\n class Flask(flask.Flask):\n config_class = Config\n\n app = Flask(__name__)\n assert isinstance(app.config, Config)\n app.config.from_object(__name__)\n common_object_test(app)\n\n\ndef test_session_lifetime():\n app = flask.Flask(__name__)\n app.config[\"PERMANENT_SESSION_LIFETIME\"] = 42\n assert app.permanent_session_lifetime.seconds == 42", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_test_redirect_no_app_test_abort_with_app.with_app_app_context_p.flask_abort_900_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_test_redirect_no_app_test_abort_with_app.with_app_app_context_p.flask_abort_900_", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 165, "end_line": 207, "span_ids": ["test_app_aborter_class.MyFlask:2", "test_app_aborter_class.MyAborter:2", "test_redirect_with_app", "test_app_aborter_class.MyFlask", "test_redirect_no_app", "test_abort_with_app.My900Error", "test_abort_no_app", "test_abort_with_app.My900Error:2", "test_app_aborter_class", "test_abort_with_app", "test_app_aborter_class.MyAborter"], "tokens": 236}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_redirect_no_app():\n response = flask.redirect(\"https://localhost\", 307)\n assert response.location == \"https://localhost\"\n assert response.status_code == 307\n\n\ndef test_redirect_with_app(app):\n def redirect(location, code=302):\n raise ValueError\n\n app.redirect = redirect\n\n with app.app_context(), pytest.raises(ValueError):\n flask.redirect(\"other\")\n\n\ndef test_abort_no_app():\n with pytest.raises(werkzeug.exceptions.Unauthorized):\n flask.abort(401)\n\n with pytest.raises(LookupError):\n flask.abort(900)\n\n\ndef test_app_aborter_class():\n class MyAborter(werkzeug.exceptions.Aborter):\n pass\n\n class MyFlask(flask.Flask):\n aborter_class = MyAborter\n\n app = MyFlask(__name__)\n assert isinstance(app.aborter, MyAborter)\n\n\ndef test_abort_with_app(app):\n class My900Error(werkzeug.exceptions.HTTPException):\n code = 900\n\n app.aborter.mapping[900] = My900Error\n\n with app.app_context(), pytest.raises(My900Error):\n flask.abort(900)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestHelpers_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_helpers.py_TestHelpers_", "embedding": null, "metadata": {"file_path": "tests/test_helpers.py", "file_name": "test_helpers.py", "file_type": "text/x-python", "category": "test", "start_line": 303, "end_line": 343, "span_ids": ["TestHelpers", "TestHelpers.test_make_response", "TestHelpers.test_open_resource", "TestHelpers.test_get_debug_flag", "TestHelpers.test_open_resource_exceptions"], "tokens": 299}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "class TestHelpers:\n @pytest.mark.parametrize(\n (\"debug\", \"expect\"),\n [\n (\"\", False),\n (\"0\", False),\n (\"False\", False),\n (\"No\", False),\n (\"True\", True),\n ],\n )\n def test_get_debug_flag(self, monkeypatch, debug, expect):\n monkeypatch.setenv(\"FLASK_DEBUG\", debug)\n assert get_debug_flag() == expect\n\n def test_make_response(self):\n app = flask.Flask(__name__)\n with app.test_request_context():\n rv = flask.helpers.make_response()\n assert rv.status_code == 200\n assert rv.mimetype == \"text/html\"\n\n rv = flask.helpers.make_response(\"Hello\")\n assert rv.status_code == 200\n assert rv.data == b\"Hello\"\n assert rv.mimetype == \"text/html\"\n\n @pytest.mark.parametrize(\"mode\", (\"r\", \"rb\", \"rt\"))\n def test_open_resource(self, mode):\n app = flask.Flask(__name__)\n\n with app.open_resource(\"static/index.html\", mode) as f:\n assert \"

Hello World!

\" in str(f.read())\n\n @pytest.mark.parametrize(\"mode\", (\"w\", \"x\", \"a\", \"r+\"))\n def test_open_resource_exceptions(self, mode):\n app = flask.Flask(__name__)\n\n with pytest.raises(ValueError):\n app.open_resource(\"static/index.html\", mode)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_sys_test_uninstalled_module_paths.assert_app_instance_path_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_sys_test_uninstalled_module_paths.assert_app_instance_path_", "embedding": null, "metadata": {"file_path": "tests/test_instance_config.py", "file_name": "test_instance_config.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 28, "span_ids": ["test_explicit_instance_paths", "imports", "test_uninstalled_module_paths"], "tokens": 187}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import sys\n\nimport pytest\n\nimport flask\n\n\ndef test_explicit_instance_paths(modules_tmpdir):\n with pytest.raises(ValueError) as excinfo:\n flask.Flask(__name__, instance_path=\"instance\")\n assert \"must be absolute\" in str(excinfo.value)\n\n app = flask.Flask(__name__, instance_path=str(modules_tmpdir))\n assert app.instance_path == str(modules_tmpdir)\n\n\ndef test_uninstalled_module_paths(modules_tmpdir, purge_module):\n app = modules_tmpdir.join(\"config_module_app.py\").write(\n \"import os\\n\"\n \"import flask\\n\"\n \"here = os.path.abspath(os.path.dirname(__file__))\\n\"\n \"app = flask.Flask(__name__)\\n\"\n )\n purge_module(\"config_module_app\")\n\n from config_module_app import app\n\n assert app.instance_path == str(modules_tmpdir.join(\"instance\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_namespace_paths_test_uninstalled_namespace_paths.assert_app_instance_path_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_instance_config.py_test_uninstalled_namespace_paths_test_uninstalled_namespace_paths.assert_app_instance_path_", "embedding": null, "metadata": {"file_path": "tests/test_instance_config.py", "file_name": "test_instance_config.py", "file_type": "text/x-python", "category": "test", "start_line": 47, "end_line": 63, "span_ids": ["test_uninstalled_namespace_paths"], "tokens": 139}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_uninstalled_namespace_paths(tmpdir, monkeypatch, purge_module):\n def create_namespace(package):\n project = tmpdir.join(f\"project-{package}\")\n monkeypatch.syspath_prepend(str(project))\n project.join(\"namespace\").join(package).join(\"__init__.py\").write(\n \"import flask\\napp = flask.Flask(__name__)\\n\", ensure=True\n )\n return project\n\n _ = create_namespace(\"package1\")\n project2 = create_namespace(\"package2\")\n purge_module(\"namespace.package2\")\n purge_module(\"namespace\")\n\n from namespace.package2 import app\n\n assert app.instance_path == str(project2.join(\"instance\"))", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_aware_datetimes_test_jsonify_aware_datetimes.assert_flask_json_dumps_d": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_aware_datetimes_test_jsonify_aware_datetimes.assert_flask_json_dumps_d", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 166, "end_line": 173, "span_ids": ["test_jsonify_aware_datetimes"], "tokens": 152}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "@pytest.mark.parametrize(\"tz\", ((\"UTC\", 0), (\"PST\", -8), (\"KST\", 9)))\ndef test_jsonify_aware_datetimes(tz):\n \"\"\"Test if aware datetime.datetime objects are converted into GMT.\"\"\"\n tzinfo = FixedOffset(hours=tz[1], name=tz[0])\n dt = datetime.datetime(2017, 1, 1, 12, 34, 56, tzinfo=tzinfo)\n gmt = FixedOffset(hours=0, name=\"GMT\")\n expected = dt.astimezone(gmt).strftime('\"%a, %d %b %Y %H:%M:%S %Z\"')\n assert flask.json.dumps(dt) == expected", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_uuid_types_test_jsonify_uuid_types.assert_rv_uuid_test_uu": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_jsonify_uuid_types_test_jsonify_uuid_types.assert_rv_uuid_test_uu", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 176, "end_line": 188, "span_ids": ["test_jsonify_uuid_types"], "tokens": 109}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_jsonify_uuid_types(app, client):\n \"\"\"Test jsonify with uuid.UUID types\"\"\"\n\n test_uuid = uuid.UUID(bytes=b\"\\xDE\\xAD\\xBE\\xEF\" * 4)\n url = \"/uuid_test\"\n app.add_url_rule(url, url, lambda: flask.jsonify(x=test_uuid))\n\n rv = client.get(url)\n\n rv_x = flask.json.loads(rv.data)[\"x\"]\n assert rv_x == str(test_uuid)\n rv_uuid = uuid.UUID(rv_x)\n assert rv_uuid == test_uuid", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_decimal_test_json_attr.assert_rv_data_b_3_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_json.py_test_json_decimal_test_json_attr.assert_rv_data_b_3_", "embedding": null, "metadata": {"file_path": "tests/test_json.py", "file_name": "test_json.py", "file_type": "text/x-python", "category": "test", "start_line": 191, "end_line": 207, "span_ids": ["test_json_decimal", "test_json_attr"], "tokens": 118}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_json_decimal():\n rv = flask.json.dumps(decimal.Decimal(\"0.003\"))\n assert rv == '\"0.003\"'\n\n\ndef test_json_attr(app, client):\n @app.route(\"/add\", methods=[\"POST\"])\n def add():\n json = flask.request.get_json()\n return str(json[\"a\"] + json[\"b\"])\n\n rv = client.post(\n \"/add\",\n data=flask.json.dumps({\"a\": 1, \"b\": 2}),\n content_type=\"application/json\",\n )\n assert rv.data == b\"3\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_warnings_test_teardown_with_handled_exception.assert_buffer_None_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_reqctx.py_warnings_test_teardown_with_handled_exception.assert_buffer_None_", "embedding": null, "metadata": {"file_path": "tests/test_reqctx.py", "file_name": "test_reqctx.py", "file_type": "text/x-python", "category": "test", "start_line": 1, "end_line": 60, "span_ids": ["impl", "impl:2", "test_teardown_with_handled_exception", "test_teardown_on_pop", "test_teardown_with_previous_exception", "imports", "imports:7"], "tokens": 246}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "import warnings\n\nimport pytest\n\nimport flask\nfrom flask.globals import request_ctx\nfrom flask.sessions import SecureCookieSessionInterface\nfrom flask.sessions import SessionInterface\n\ntry:\n from greenlet import greenlet\nexcept ImportError:\n greenlet = None\n\n\ndef test_teardown_on_pop(app):\n buffer = []\n\n @app.teardown_request\n def end_of_request(exception):\n buffer.append(exception)\n\n ctx = app.test_request_context()\n ctx.push()\n assert buffer == []\n ctx.pop()\n assert buffer == [None]\n\n\ndef test_teardown_with_previous_exception(app):\n buffer = []\n\n @app.teardown_request\n def end_of_request(exception):\n buffer.append(exception)\n\n try:\n raise Exception(\"dummy\")\n except Exception:\n pass\n\n with app.test_request_context():\n assert buffer == []\n assert buffer == [None]\n\n\ndef test_teardown_with_handled_exception(app):\n buffer = []\n\n @app.teardown_request\n def end_of_request(exception):\n buffer.append(exception)\n\n with app.test_request_context():\n assert buffer == []\n try:\n raise Exception(\"dummy\")\n except Exception:\n pass\n assert buffer == [None]", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_subdomain_test_cli_custom_obj.assert_NS_called": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_subdomain_test_cli_custom_obj.assert_NS_called", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 309, "end_line": 386, "span_ids": ["test_cli_invoke", "test_nosubdomain", "test_cli_custom_obj.NS", "test_cli_runner_class", "test_subdomain", "test_cli_runner_class.SubRunner:2", "test_cli_runner_class.SubRunner", "test_cli_custom_obj.NS:2", "test_cli_custom_obj"], "tokens": 440}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_subdomain():\n app = flask.Flask(__name__, subdomain_matching=True)\n app.config[\"SERVER_NAME\"] = \"example.com\"\n client = app.test_client()\n\n @app.route(\"/\", subdomain=\"\")\n def view(company_id):\n return company_id\n\n with app.test_request_context():\n url = flask.url_for(\"view\", company_id=\"xxx\")\n\n with client:\n response = client.get(url)\n\n assert 200 == response.status_code\n assert b\"xxx\" == response.data\n\n\ndef test_nosubdomain(app, client):\n app.config[\"SERVER_NAME\"] = \"example.com\"\n\n @app.route(\"/\")\n def view(company_id):\n return company_id\n\n with app.test_request_context():\n url = flask.url_for(\"view\", company_id=\"xxx\")\n\n with client:\n response = client.get(url)\n\n assert 200 == response.status_code\n assert b\"xxx\" == response.data\n\n\ndef test_cli_runner_class(app):\n runner = app.test_cli_runner()\n assert isinstance(runner, FlaskCliRunner)\n\n class SubRunner(FlaskCliRunner):\n pass\n\n app.test_cli_runner_class = SubRunner\n runner = app.test_cli_runner()\n assert isinstance(runner, SubRunner)\n\n\ndef test_cli_invoke(app):\n @app.cli.command(\"hello\")\n def hello_command():\n click.echo(\"Hello, World!\")\n\n runner = app.test_cli_runner()\n # invoke with command name\n result = runner.invoke(args=[\"hello\"])\n assert \"Hello\" in result.output\n # invoke with command object\n result = runner.invoke(hello_command)\n assert \"Hello\" in result.output\n\n\ndef test_cli_custom_obj(app):\n class NS:\n called = False\n\n def create_app():\n NS.called = True\n return app\n\n @app.cli.command(\"hello\")\n def hello_command():\n click.echo(\"Hello, World!\")\n\n script_info = ScriptInfo(create_app=create_app)\n runner = app.test_cli_runner()\n runner.invoke(hello_command, obj=script_info)\n assert NS.called", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_pop_all_preserved_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/test_testing.py_test_client_pop_all_preserved_", "embedding": null, "metadata": {"file_path": "tests/test_testing.py", "file_name": "test_testing.py", "file_type": "text/x-python", "category": "test", "start_line": 389, "end_line": 404, "span_ids": ["test_client_pop_all_preserved"], "tokens": 121}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "def test_client_pop_all_preserved(app, req_ctx, client):\n @app.route(\"/\")\n def index():\n # stream_with_context pushes a third context, preserved by response\n return flask.stream_with_context(\"hello\")\n\n # req_ctx fixture pushed an initial context\n with client:\n # request pushes a second request context, preserved by client\n rv = client.get(\"/\")\n\n # close the response, releasing the context held by stream_with_context\n rv.close()\n # only req_ctx fixture should still be pushed\n assert _cv_request.get(None) is req_ctx", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_app_decorators.py_from___future___import_an_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_app_decorators.py_from___future___import_an_", "embedding": null, "metadata": {"file_path": "tests/typing/typing_app_decorators.py", "file_name": "typing_app_decorators.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 39, "span_ids": ["impl", "teardown_async", "after_sync", "before_async", "imports", "after_async", "teardown_sync", "before_sync"], "tokens": 140}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nimport typing as t\n\nfrom flask import Flask\nfrom flask import Response\n\napp = Flask(__name__)\n\n\n@app.after_request\ndef after_sync(response: Response) -> Response:\n return Response()\n\n\n@app.after_request\nasync def after_async(response: Response) -> Response:\n return Response()\n\n\n@app.before_request\ndef before_sync() -> None:\n ...\n\n\n@app.before_request\nasync def before_async() -> None:\n ...\n\n\n@app.teardown_appcontext\ndef teardown_sync(exc: t.Optional[BaseException]) -> None:\n ...\n\n\n@app.teardown_appcontext\nasync def teardown_async(exc: t.Optional[BaseException]) -> None:\n ...", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_error_handler.py_from___future___import_an_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_error_handler.py_from___future___import_an_", "embedding": null, "metadata": {"file_path": "tests/typing/typing_error_handler.py", "file_name": "typing_error_handler.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 34, "span_ids": ["impl", "handle_multiple", "handle_custom", "handle_accept_base", "imports", "handle_400"], "tokens": 141}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nfrom http import HTTPStatus\n\nfrom werkzeug.exceptions import BadRequest\nfrom werkzeug.exceptions import NotFound\n\nfrom flask import Flask\n\napp = Flask(__name__)\n\n\n@app.errorhandler(400)\n@app.errorhandler(HTTPStatus.BAD_REQUEST)\n@app.errorhandler(BadRequest)\ndef handle_400(e: BadRequest) -> str:\n return \"\"\n\n\n@app.errorhandler(ValueError)\ndef handle_custom(e: ValueError) -> str:\n return \"\"\n\n\n@app.errorhandler(ValueError)\ndef handle_accept_base(e: Exception) -> str:\n return \"\"\n\n\n@app.errorhandler(BadRequest)\n@app.errorhandler(404)\ndef handle_multiple(e: BadRequest | NotFound) -> str:\n return \"\"", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}, "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_route.py_from___future___import_an_": {"__data__": {"id_": "/tmp/repos/swe-bench_pallets__flask/tests/typing/typing_route.py_from___future___import_an_", "embedding": null, "metadata": {"file_path": "tests/typing/typing_route.py", "file_name": "typing_route.py", "file_type": "text/x-python", "category": "implementation", "start_line": 1, "end_line": 115, "span_ids": ["impl", "return_template", "RenderTemplateView", "async_route", "hello_iterator", "tuple_headers", "hello_json_list", "return_template_stream", "tuple_status_enum", "tuple_status", "RenderTemplateView.dispatch_request", "hello_generator_expression", "hello_str", "typed_dict", "hello_json", "StatusJSON", "imports", "hello_generator", "impl:3", "hello_json_dict", "hello_bytes"], "tokens": 625}, "excluded_embed_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date", "start_line", "end_line", "tokens"], "excluded_llm_metadata_keys": ["file_name", "file_type", "file_size", "creation_date", "last_modified_date", "last_accessed_date"], "relationships": {}, "text": "from __future__ import annotations\n\nimport typing as t\nfrom http import HTTPStatus\n\nimport typing_extensions as te\n\nfrom flask import Flask\nfrom flask import jsonify\nfrom flask import stream_template\nfrom flask.templating import render_template\nfrom flask.views import View\nfrom flask.wrappers import Response\n\napp = Flask(__name__)\n\n\n@app.route(\"/str\")\ndef hello_str() -> str:\n return \"

Hello, World!

\"\n\n\n@app.route(\"/bytes\")\ndef hello_bytes() -> bytes:\n return b\"

Hello, World!

\"\n\n\n@app.route(\"/json\")\ndef hello_json() -> Response:\n return jsonify(\"Hello, World!\")\n\n\n@app.route(\"/json/dict\")\ndef hello_json_dict() -> t.Dict[str, t.Any]:\n return {\"response\": \"Hello, World!\"}\n\n\n@app.route(\"/json/dict\")\ndef hello_json_list() -> t.List[t.Any]:\n return [{\"message\": \"Hello\"}, {\"message\": \"World\"}]\n\n\nclass StatusJSON(te.TypedDict):\n status: str\n\n\n@app.route(\"/typed-dict\")\ndef typed_dict() -> StatusJSON:\n return {\"status\": \"ok\"}\n\n\n@app.route(\"/generator\")\ndef hello_generator() -> t.Generator[str, None, None]:\n def show() -> t.Generator[str, None, None]:\n for x in range(100):\n yield f\"data:{x}\\n\\n\"\n\n return show()\n\n\n@app.route(\"/generator-expression\")\ndef hello_generator_expression() -> t.Iterator[bytes]:\n return (f\"data:{x}\\n\\n\".encode() for x in range(100))\n\n\n@app.route(\"/iterator\")\ndef hello_iterator() -> t.Iterator[str]:\n return iter([f\"data:{x}\\n\\n\" for x in range(100)])\n\n\n@app.route(\"/status\")\n@app.route(\"/status/\")\ndef tuple_status(code: int = 200) -> tuple[str, int]:\n return \"hello\", code\n\n\n@app.route(\"/status-enum\")\ndef tuple_status_enum() -> tuple[str, int]:\n return \"hello\", HTTPStatus.OK\n\n\n@app.route(\"/headers\")\ndef tuple_headers() -> tuple[str, dict[str, str]]:\n return \"Hello, World!\", {\"Content-Type\": \"text/plain\"}\n\n\n@app.route(\"/template\")\n@app.route(\"/template/\")\ndef return_template(name: str | None = None) -> str:\n return render_template(\"index.html\", name=name)\n\n\n@app.route(\"/template\")\ndef return_template_stream() -> t.Iterator[str]:\n return stream_template(\"index.html\", name=\"Hello\")\n\n\n@app.route(\"/async\")\nasync def async_route() -> str:\n return \"Hello\"\n\n\nclass RenderTemplateView(View):\n def __init__(self: RenderTemplateView, template_name: str) -> None:\n self.template_name = template_name\n\n def dispatch_request(self: RenderTemplateView) -> str:\n return render_template(self.template_name)\n\n\napp.add_url_rule(\n \"/about\",\n view_func=RenderTemplateView.as_view(\"about_page\", template_name=\"about.html\"),\n)", "start_char_idx": null, "end_char_idx": null, "text_template": "{metadata_str}\n\n{content}", "metadata_template": "{key}: {value}", "metadata_seperator": "\n", "class_name": "TextNode"}, "__type__": "1"}}} \ No newline at end of file