Datasets:
mteb
/

Modalities:
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
Dask
License:
Dataset Viewer
Auto-converted to Parquet
title
stringclasses
1 value
text
stringlengths
30
1.11M
id
stringlengths
27
31
include/nlohmann/detail/json_pointer.hpp/contains bool contains(const BasicJsonType* ptr) const { using size_type = typename BasicJsonType::size_type; for (const auto& reference_token : reference_tokens) { switch (ptr->type()) { case detail::value_t::object: { if (not ptr->contains(reference_token)) { // we did not find the key in the object return false; } ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { if (JSON_HEDLEY_UNLIKELY(reference_token == "-")) { // "-" always fails the range check return false; } const auto idx = static_cast<size_type>(array_index(reference_token)); if (idx >= ptr->size()) { // index out of range return false; } ptr = &ptr->operator[](idx); break; } default: { // we do not expect primitive values if there is still a // reference token to process return false; } } } // no reference token left means we found a primitive value return true; }
apositive_train_query0_00000
single_include/nlohmann/json.hpp/contains bool contains(const json_pointer& ptr) const { return ptr.contains(this); }
apositive_train_query0_00001
include/nlohmann/adl_serializer.hpp/adl_serializer/from_json class adl_serializer: static auto from_json(BasicJsonType&& j, ValueType& val) noexcept( noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val))) -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void()) { ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); }
negative_train_query0_00000
include/nlohmann/adl_serializer.hpp/adl_serializer/to_json class adl_serializer: static auto to_json(BasicJsonType& j, ValueType&& val) noexcept( noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val)))) -> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void()) { ::nlohmann::to_json(j, std::forward<ValueType>(val)); }
negative_train_query0_00001
include/nlohmann/json.hpp/is_number_float constexpr bool is_number_float() const noexcept { return m_type == value_t::number_float; }
negative_train_query0_00002
include/nlohmann/json.hpp/swap void swap(string_t& other) { // swap only works for strings if (JSON_HEDLEY_LIKELY(is_string())) { std::swap(*(m_value.string), other); } else { JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name()))); } }
negative_train_query0_00003
include/nlohmann/json.hpp/is_number_unsigned constexpr bool is_number_unsigned() const noexcept { return m_type == value_t::number_unsigned; }
negative_train_query0_00004
include/nlohmann/json.hpp/back reference back() { auto tmp = end(); --tmp; return *tmp; }
negative_train_query0_00005
include/nlohmann/json.hpp/begin iterator begin() noexcept { iterator result(this); result.set_begin(); return result; }
negative_train_query0_00006
include/nlohmann/json.hpp/to_msgpack static void to_msgpack(const basic_json& j, detail::output_adapter<uint8_t> o) { binary_writer<uint8_t>(o).write_msgpack(j); }
negative_train_query0_00007
include/nlohmann/json.hpp/to_ubjson static std::vector<uint8_t> to_ubjson(const basic_json& j, const bool use_size = false, const bool use_type = false) { std::vector<uint8_t> result; to_ubjson(j, result, use_size, use_type); return result; }
negative_train_query0_00008
include/nlohmann/json.hpp/from_cbor JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_cbor(detail::input_adapter&& i, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions); const bool res = binary_reader(detail::input_adapter(i)).sax_parse(input_format_t::cbor, &sdp, strict); return res ? result : basic_json(value_t::discarded); }
negative_train_query0_00009
include/nlohmann/json.hpp/from_ubjson JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_ubjson(A1 && a1, A2 && a2, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions); const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::ubjson, &sdp, strict); return res ? result : basic_json(value_t::discarded); }
negative_train_query0_00010
include/nlohmann/json.hpp/basic_json basic_json(std::nullptr_t = nullptr) noexcept : basic_json(value_t::null) { assert_invariant(); }
negative_train_query0_00011
include/nlohmann/json.hpp/push_back void push_back(const basic_json& val) { // push_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); } // transform null object into an array if (is_null()) { m_type = value_t::array; m_value = value_t::array; assert_invariant(); } // add element to array m_value.array->push_back(val); }
negative_train_query0_00012
include/nlohmann/json.hpp/value string_t value(const typename object_t::key_type& key, const char* default_value) const { return value(key, string_t(default_value)); }
negative_train_query0_00013
include/nlohmann/json.hpp/cend const_iterator cend() const noexcept { const_iterator result(this); result.set_end(); return result; }
negative_train_query0_00014
include/nlohmann/json.hpp/crend const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
negative_train_query0_00015
include/nlohmann/json.hpp/from_bson JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_bson(A1 && a1, A2 && a2, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions); const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::bson, &sdp, strict); return res ? result : basic_json(value_t::discarded); }
negative_train_query0_00016
include/nlohmann/json.hpp/unflatten basic_json unflatten() const { return json_pointer::unflatten(*this); }
negative_train_query0_00017
include/nlohmann/json.hpp/end iterator end() noexcept { iterator result(this); result.set_end(); return result; }
negative_train_query0_00018
include/nlohmann/json.hpp/crbegin const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
negative_train_query0_00019
include/nlohmann/json.hpp/merge_patch void merge_patch(const basic_json& apply_patch) { if (apply_patch.is_object()) { if (not is_object()) { *this = object(); } for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it) { if (it.value().is_null()) { erase(it.key()); } else { operator[](it.key()).merge_patch(it.value()); } } } else { *this = apply_patch; } }
negative_train_query0_00020
include/nlohmann/json.hpp/front const_reference front() const { return *cbegin(); }
negative_train_query0_00021
include/nlohmann/json.hpp/from_msgpack JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json from_msgpack(A1 && a1, A2 && a2, const bool strict = true, const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions); const bool res = binary_reader(detail::input_adapter(std::forward<A1>(a1), std::forward<A2>(a2))).sax_parse(input_format_t::msgpack, &sdp, strict); return res ? result : basic_json(value_t::discarded); }
negative_train_query0_00022
include/nlohmann/json.hpp/get_allocator static allocator_type get_allocator() { return allocator_type(); }
negative_train_query0_00023
include/nlohmann/json.hpp/is_boolean constexpr bool is_boolean() const noexcept { return m_type == value_t::boolean; }
negative_train_query0_00024
include/nlohmann/json.hpp/cbegin const_iterator cbegin() const noexcept { const_iterator result(this); result.set_begin(); return result; }
negative_train_query0_00025
include/nlohmann/json.hpp/insert iterator insert(const_iterator pos, basic_json&& val) { return insert(pos, val); }
negative_train_query0_00026
include/nlohmann/json.hpp/patch basic_json patch(const basic_json& json_patch) const { // make a working copy to apply the patch to basic_json result = *this; // the valid JSON Patch operations enum class patch_operations {add, remove, replace, move, copy, test, invalid}; const auto get_op = [](const std::string & op) { if (op == "add") { return patch_operations::add; } if (op == "remove") { return patch_operations::remove; } if (op == "replace") { return patch_operations::replace; } if (op == "move") { return patch_operations::move; } if (op == "copy") { return patch_operations::copy; } if (op == "test") { return patch_operations::test; } return patch_operations::invalid; }; // wrapper for "add" operation; add value at ptr const auto operation_add = [&result](json_pointer & ptr, basic_json val) { // adding to the root of the target document means replacing it if (ptr.empty()) { result = val; return; } // make sure the top element of the pointer exists json_pointer top_pointer = ptr.top(); if (top_pointer != ptr) { result.at(top_pointer); } // get reference to parent of JSON pointer ptr const auto last_path = ptr.back(); ptr.pop_back(); basic_json& parent = result[ptr]; switch (parent.m_type) { case value_t::null: case value_t::object: { // use operator[] to add value parent[last_path] = val; break; } case value_t::array: { if (last_path == "-") { // special case: append to back parent.push_back(val); } else { const auto idx = json_pointer::array_index(last_path); if (JSON_HEDLEY_UNLIKELY(static_cast<size_type>(idx) > parent.size())) { // avoid undefined behavior JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); } // default case: insert add offset parent.insert(parent.begin() + static_cast<difference_type>(idx), val); } break; } // if there exists a parent it cannot be primitive default: // LCOV_EXCL_LINE assert(false); // LCOV_EXCL_LINE } }; // wrapper for "remove" operation; remove value at ptr const auto operation_remove = [&result](json_pointer & ptr) { // get reference to parent of JSON pointer ptr const auto last_path = ptr.back(); ptr.pop_back(); basic_json& parent = result.at(ptr); // remove child if (parent.is_object()) { // perform range check auto it = parent.find(last_path); if (JSON_HEDLEY_LIKELY(it != parent.end())) { parent.erase(it); } else { JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found")); } } else if (parent.is_array()) { // note erase performs range check parent.erase(static_cast<size_type>(json_pointer::array_index(last_path))); } }; // type check: top level value must be an array if (JSON_HEDLEY_UNLIKELY(not json_patch.is_array())) { JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); } // iterate and apply the operations for (const auto& val : json_patch) { // wrapper to get a value for an operation const auto get_value = [&val](const std::string & op, const std::string & member, bool string_type) -> basic_json & { // find value auto it = val.m_value.object->find(member); // context-sensitive error message const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; // check if desired value is present if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end())) { JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); } // check if result is of type string if (JSON_HEDLEY_UNLIKELY(string_type and not it->second.is_string())) { JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'")); } // no error: return value return it->second; }; // type check: every element of the array must be an object if (JSON_HEDLEY_UNLIKELY(not val.is_object())) { JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); } // collect mandatory members const std::string op = get_value("op", "op", true); const std::string path = get_value(op, "path", true); json_pointer ptr(path); switch (get_op(op)) { case patch_operations::add: { operation_add(ptr, get_value("add", "value", false)); break; } case patch_operations::remove: { operation_remove(ptr); break; } case patch_operations::replace: { // the "path" location must exist - use at() result.at(ptr) = get_value("replace", "value", false); break; } case patch_operations::move: { const std::string from_path = get_value("move", "from", true); json_pointer from_ptr(from_path); // the "from" location must exist - use at() basic_json v = result.at(from_ptr); // The move operation is functionally identical to a // "remove" operation on the "from" location, followed // immediately by an "add" operation at the target // location with the value that was just removed. operation_remove(from_ptr); operation_add(ptr, v); break; } case patch_operations::copy: { const std::string from_path = get_value("copy", "from", true); const json_pointer from_ptr(from_path); // the "from" location must exist - use at() basic_json v = result.at(from_ptr); // The copy is functionally identical to an "add" // operation at the target location using the value // specified in the "from" member. operation_add(ptr, v); break; } case patch_operations::test: { bool success = false; JSON_TRY { // check if "value" matches the one at "path" // the "path" location must exist - use at() success = (result.at(ptr) == get_value("test", "value", false)); } JSON_INTERNAL_CATCH (out_of_range&) { // ignore out of range errors: success remains false } // throw an exception if test fails if (JSON_HEDLEY_UNLIKELY(not success)) { JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump())); } break; } default: { // op must be "add", "remove", "replace", "move", "copy", or // "test" JSON_THROW(parse_error::create(105, 0, "operation value '" + op + "' is invalid")); } } }
negative_train_query0_00027
include/nlohmann/json.hpp/array JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json array(initializer_list_t init = {}) { return basic_json(init, false, value_t::array); }
negative_train_query0_00028
include/nlohmann/json.hpp/is_null constexpr bool is_null() const noexcept { return m_type == value_t::null; }
negative_train_query0_00029
include/nlohmann/json.hpp/JSON_INTERNAL_CATCH ValueType value(const json_pointer& ptr, const ValueType& default_value) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) { // if pointer resolves a value, return it or use default value JSON_TRY { return ptr.get_checked(this); } JSON_INTERNAL_CATCH (out_of_range&) { return default_value; } }
negative_train_query0_00030
include/nlohmann/json.hpp/is_number_integer constexpr bool is_number_integer() const noexcept { return m_type == value_t::number_integer or m_type == value_t::number_unsigned; }
negative_train_query0_00031
include/nlohmann/json.hpp/rbegin reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
negative_train_query0_00032
include/nlohmann/json.hpp/accept static bool accept(IteratorType first, IteratorType last) { return parser(detail::input_adapter(first, last)).accept(true); }
negative_train_query0_00033
include/nlohmann/json.hpp/is_number constexpr bool is_number() const noexcept { return is_number_integer() or is_number_float(); }
negative_train_query0_00034
include/nlohmann/json.hpp/to_bson static std::vector<uint8_t> to_bson(const basic_json& j) { std::vector<uint8_t> result; to_bson(j, result); return result; }
negative_train_query0_00035
include/nlohmann/json.hpp/erase IteratorType erase(IteratorType first, IteratorType last) { // make sure iterator fits the current value if (JSON_HEDLEY_UNLIKELY(this != first.m_object or this != last.m_object)) { JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value")); } IteratorType result = end(); switch (m_type) { case value_t::boolean: case value_t::number_float: case value_t::number_integer: case value_t::number_unsigned: case value_t::string: { if (JSON_HEDLEY_LIKELY(not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end())) { JSON_THROW(invalid_iterator::create(204, "iterators out of range")); } if (is_string()) { AllocatorType<string_t> alloc; std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string); std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1); m_value.string = nullptr; } m_type = value_t::null; assert_invariant(); break; } case value_t::object: { result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator, last.m_it.object_iterator); break; } case value_t::array: { result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator, last.m_it.array_iterator); break; } default: JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()))); } return result; }
negative_train_query0_00036
include/nlohmann/json.hpp/sax_parse static bool sax_parse(IteratorType first, IteratorType last, SAX* sax) { return parser(detail::input_adapter(first, last)).sax_parse(sax); }
negative_train_query0_00037
include/nlohmann/json.hpp/object JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json object(initializer_list_t init = {}) { return basic_json(init, false, value_t::object); }
negative_train_query0_00038
include/nlohmann/json.hpp/is_string constexpr bool is_string() const noexcept { return m_type == value_t::string; }
negative_train_query0_00039
include/nlohmann/json.hpp/rend reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
negative_train_query0_00040
include/nlohmann/json.hpp/JSON_CATCH JSON_CATCH (std::out_of_range&) { // create better exception explanation JSON_THROW(out_of_range::create(403, "key '" + key + "' not found")); }
negative_train_query0_00041
include/nlohmann/json.hpp/to_cbor static void to_cbor(const basic_json& j, detail::output_adapter<char> o) { binary_writer<char>(o).write_cbor(j); }
negative_train_query0_00042
include/nlohmann/json.hpp/is_discarded constexpr bool is_discarded() const noexcept { return m_type == value_t::discarded; }
negative_train_query0_00043
include/nlohmann/json.hpp/count size_type count(KeyT&& key) const { // return 0 for all nonobject types return is_object() ? m_value.object->count(std::forward<KeyT>(key)) : 0; }
negative_train_query0_00044
include/nlohmann/json.hpp/type constexpr value_t type() const noexcept { return m_type; }
negative_train_query0_00045
include/nlohmann/json.hpp/is_array constexpr bool is_array() const noexcept { return m_type == value_t::array; }
negative_train_query0_00046
include/nlohmann/json.hpp/diff JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json diff(const basic_json& source, const basic_json& target, const std::string& path = "") { // the patch basic_json result(value_t::array); // if the values are the same, return empty patch if (source == target) { return result; } if (source.type() != target.type()) { // different types: replace value result.push_back( { {"op", "replace"}, {"path", path}, {"value", target} }); return result; } switch (source.type()) { case value_t::array: { // first pass: traverse common elements std::size_t i = 0; while (i < source.size() and i < target.size()) { // recursive call to compare array values at index i auto temp_diff = diff(source[i], target[i], path + "/" + std::to_string(i)); result.insert(result.end(), temp_diff.begin(), temp_diff.end()); ++i; } // i now reached the end of at least one array // in a second pass, traverse the remaining elements // remove my remaining elements const auto end_index = static_cast<difference_type>(result.size()); while (i < source.size()) { // add operations in reverse order to avoid invalid // indices result.insert(result.begin() + end_index, object( { {"op", "remove"}, {"path", path + "/" + std::to_string(i)} })); ++i; } // add other remaining elements while (i < target.size()) { result.push_back( { {"op", "add"}, {"path", path + "/" + std::to_string(i)}, {"value", target[i]} }); ++i; } break; } case value_t::object: { // first pass: traverse this object's elements for (auto it = source.cbegin(); it != source.cend(); ++it) { // escape the key name to be used in a JSON patch const auto key = json_pointer::escape(it.key()); if (target.find(it.key()) != target.end()) { // recursive call to compare object values at key it auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key); result.insert(result.end(), temp_diff.begin(), temp_diff.end()); } else { // found a key that is not in o -> remove it result.push_back(object( { {"op", "remove"}, {"path", path + "/" + key} })); } } // second pass: traverse other object's elements for (auto it = target.cbegin(); it != target.cend(); ++it) { if (source.find(it.key()) == source.end()) { // found a key that is not in this -> add it const auto key = json_pointer::escape(it.key()); result.push_back( { {"op", "add"}, {"path", path + "/" + key}, {"value", it.value()} }); } } break; } default: { // both primitive type: replace value result.push_back( { {"op", "replace"}, {"path", path}, {"value", target} }); break; } } return result; }
negative_train_query0_00047
include/nlohmann/json.hpp/is_object constexpr bool is_object() const noexcept { return m_type == value_t::object; }
negative_train_query0_00048
include/nlohmann/json.hpp/clear void clear() noexcept { switch (m_type) { case value_t::number_integer: { m_value.number_integer = 0; break; } case value_t::number_unsigned: { m_value.number_unsigned = 0; break; } case value_t::number_float: { m_value.number_float = 0.0; break; } case value_t::boolean: { m_value.boolean = false; break; } case value_t::string: { m_value.string->clear(); break; } case value_t::array: { m_value.array->clear(); break; } case value_t::object: { m_value.object->clear(); break; } default: break; } }
negative_train_query0_00049
include/nlohmann/json.hpp/is_structured constexpr bool is_structured() const noexcept { return is_array() or is_object(); }
negative_train_query0_00050
include/nlohmann/json.hpp/at const_reference at(const json_pointer& ptr) const { return ptr.get_checked(this); }
negative_train_query0_00051
include/nlohmann/json.hpp/is_primitive constexpr bool is_primitive() const noexcept { return is_null() or is_string() or is_boolean() or is_number(); }
negative_train_query0_00052
include/nlohmann/json.hpp/contains bool contains(KeyT && key) const { return is_object() and m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end(); }
negative_train_query0_00053
include/nlohmann/json.hpp/emplace std::pair<iterator, bool> emplace(Args&& ... args) { // emplace only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object()))) { JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name()))); } // transform null object into an object if (is_null()) { m_type = value_t::object; m_value = value_t::object; assert_invariant(); } // add element to array (perfect forwarding) auto res = m_value.object->emplace(std::forward<Args>(args)...); // create result iterator and set iterator to the result of emplace auto it = begin(); it.m_it.object_iterator = res.first; // return pair of iterator and boolean return {it, res.second}; }
negative_train_query0_00054
include/nlohmann/json.hpp/parse static basic_json parse(IteratorType first, IteratorType last, const parser_callback_t cb = nullptr, const bool allow_exceptions = true) { basic_json result; parser(detail::input_adapter(first, last), cb, allow_exceptions).parse(true, result); return result; }
negative_train_query0_00055
include/nlohmann/json.hpp/find const_iterator find(KeyT&& key) const { auto result = cend(); if (is_object()) { result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key)); } return result; }
negative_train_query0_00056
include/nlohmann/json.hpp/emplace_back reference emplace_back(Args&& ... args) { // emplace_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) { JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name()))); } // transform null object into an array if (is_null()) { m_type = value_t::array; m_value = value_t::array; assert_invariant(); } // add element to array (perfect forwarding) #ifdef JSON_HAS_CPP_17 return m_value.array->emplace_back(std::forward<Args>(args)...); #else m_value.array->emplace_back(std::forward<Args>(args)...); return m_value.array->back(); #endif }
negative_train_query0_00057
include/nlohmann/json.hpp/flatten basic_json flatten() const { basic_json result(value_t::object); json_pointer::flatten("", *this, result); return result; }
negative_train_query0_00058
include/nlohmann/json.hpp/meta JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json meta() { basic_json result; result["copyright"] = "(C) 2013-2017 Niels Lohmann"; result["name"] = "JSON for Modern C++"; result["url"] = "https://github.com/nlohmann/json"; result["version"]["string"] = std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." + std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." + std::to_string(NLOHMANN_JSON_VERSION_PATCH); result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR; result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR; result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH; #ifdef _WIN32 result["platform"] = "win32"; #elif defined __linux__ result["platform"] = "linux"; #elif defined __APPLE__ result["platform"] = "apple"; #elif defined __unix__ result["platform"] = "unix"; #else result["platform"] = "unknown"; #endif #if defined(__ICC) || defined(__INTEL_COMPILER) result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; #elif defined(__clang__) result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; #elif defined(__GNUC__) || defined(__GNUG__) result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; #elif defined(__HP_cc) || defined(__HP_aCC) result["compiler"] = "hp" #elif defined(__IBMCPP__) result["compiler"] = {{"family", "ilecpp"}, {"version", __IBMCPP__}}; #elif defined(_MSC_VER) result["compiler"] = {{"family", "msvc"}, {"version", _MSC_VER}}; #elif defined(__PGI) result["compiler"] = {{"family", "pgcpp"}, {"version", __PGI}}; #elif defined(__SUNPRO_CC) result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}}; #else result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}}; #endif #ifdef __cplusplus result["compiler"]["c++"] = std::to_string(__cplusplus); #else result["compiler"]["c++"] = "unknown"; #endif return result; }
negative_train_query0_00059
include/nlohmann/json.hpp/update void update(const_reference j) { // implicitly convert null value to an empty object if (is_null()) { m_type = value_t::object; m_value.object = create<object_t>(); assert_invariant(); } if (JSON_HEDLEY_UNLIKELY(not is_object())) { JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); } if (JSON_HEDLEY_UNLIKELY(not j.is_object())) { JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name()))); } for (auto it = j.cbegin(); it != j.cend(); ++it) { m_value.object->operator[](it.key()) = it.value(); } }
negative_train_query0_00060
include/nlohmann/json.hpp/insert_iterator iterator insert_iterator(const_iterator pos, Args&& ... args) { iterator result(this); assert(m_value.array != nullptr); auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator); m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...); result.m_it.array_iterator = m_value.array->begin() + insert_pos; // This could have been written as: // result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val); // but the return value of insert is missing in GCC 4.8, so it is written this way instead. return result; }
negative_train_query0_00061
include/nlohmann/json.hpp/assert_invariant void assert_invariant() const noexcept { assert(m_type != value_t::object or m_value.object != nullptr); assert(m_type != value_t::array or m_value.array != nullptr); assert(m_type != value_t::string or m_value.string != nullptr); }
negative_train_query0_00062
include/nlohmann/json.hpp/json_value/json_value class json_value: json_value(array_t&& value) { array = create<array_t>(std::move(value)); }
negative_train_query0_00063
include/nlohmann/detail/json_ref.hpp/json_ref/json_ref class json_ref: json_ref(Args && ... args) : owned_value(std::forward<Args>(args)...), value_ref(&owned_value), is_rvalue(true) {}
negative_train_query0_00064
include/nlohmann/detail/exceptions.hpp/parse_error/parse_error class parse_error: parse_error(int id_, std::size_t byte_, const char* what_arg) : exception(id_, what_arg), byte(byte_) {}
negative_train_query0_00065
include/nlohmann/detail/json_pointer.hpp/split static std::vector<std::string> split(const std::string& reference_string) { std::vector<std::string> result; // special case: empty reference string -> no reference tokens if (reference_string.empty()) { return result; } // check if nonempty reference string begins with slash if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/')) { JSON_THROW(detail::parse_error::create(107, 1, "JSON pointer must be empty or begin with '/' - was: '" + reference_string + "'")); } // extract the reference tokens: // - slash: position of the last read slash (or end of string) // - start: position after the previous slash for ( // search for the first slash after the first character std::size_t slash = reference_string.find_first_of('/', 1), // set the beginning of the first reference token start = 1; // we can stop if start == 0 (if slash == std::string::npos) start != 0; // set the beginning of the next reference token // (will eventually be 0 if slash == std::string::npos) start = (slash == std::string::npos) ? 0 : slash + 1, // find next slash slash = reference_string.find_first_of('/', start)) { // use the text between the beginning of the reference token // (start) and the last slash (slash). auto reference_token = reference_string.substr(start, slash - start); // check reference tokens are properly escaped for (std::size_t pos = reference_token.find_first_of('~'); pos != std::string::npos; pos = reference_token.find_first_of('~', pos + 1)) { assert(reference_token[pos] == '~'); // ~ must be followed by 0 or 1 if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 or (reference_token[pos + 1] != '0' and reference_token[pos + 1] != '1'))) { JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'")); } } // finally, store the reference token unescape(reference_token); result.push_back(reference_token); } return result; }
negative_train_query0_00066
include/nlohmann/detail/json_pointer.hpp/escape static std::string escape(std::string s) { replace_substring(s, "~", "~0"); replace_substring(s, "/", "~1"); return s; }
negative_train_query0_00067
include/nlohmann/detail/json_pointer.hpp/unflatten static BasicJsonType unflatten(const BasicJsonType& value) { if (JSON_HEDLEY_UNLIKELY(not value.is_object())) { JSON_THROW(detail::type_error::create(314, "only objects can be unflattened")); } BasicJsonType result; // iterate the JSON object values for (const auto& element : *value.m_value.object) { if (JSON_HEDLEY_UNLIKELY(not element.second.is_primitive())) { JSON_THROW(detail::type_error::create(315, "values in object must be primitive")); } // assign value to reference pointed to by JSON pointer; Note that if // the JSON pointer is "" (i.e., points to the whole value), function // get_and_create returns a reference to result itself. An assignment // will then create a primitive value. json_pointer(element.first).get_and_create(result) = element.second; } return result; }
negative_train_query0_00068
include/nlohmann/detail/json_pointer.hpp/replace_substring static void replace_substring(std::string& s, const std::string& f, const std::string& t) { assert(not f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != std::string::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f {} }
negative_train_query0_00069
include/nlohmann/detail/json_pointer.hpp/unescape static void unescape(std::string& s) { replace_substring(s, "~1", "/"); replace_substring(s, "~0", "~"); }
negative_train_query0_00070
include/nlohmann/detail/json_pointer.hpp/flatten static void flatten(const std::string& reference_string, const BasicJsonType& value, BasicJsonType& result) { switch (value.type()) { case detail::value_t::array: { if (value.m_value.array->empty()) { // flatten empty array as null result[reference_string] = nullptr; } else { // iterate array and use index as reference string for (std::size_t i = 0; i < value.m_value.array->size(); ++i) { flatten(reference_string + "/" + std::to_string(i), value.m_value.array->operator[](i), result); } } break; } case detail::value_t::object: { if (value.m_value.object->empty()) { // flatten empty object as null result[reference_string] = nullptr; } else { // iterate object and use keys as reference string for (const auto& element : *value.m_value.object) { flatten(reference_string + "/" + escape(element.first), element.second, result); } } break; } default: { // add primitive value with its reference string result[reference_string] = value; break; } } }
negative_train_query0_00071
include/nlohmann/detail/json_pointer.hpp/json_pointer/json_pointer class json_pointer: explicit json_pointer(const std::string& s = "") : reference_tokens(split(s)) {}
negative_train_query0_00072
include/nlohmann/detail/json_pointer.hpp/json_pointer/JSON_CATCH class json_pointer: JSON_CATCH(std::out_of_range&) { JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'")); }
negative_train_query0_00073
include/nlohmann/detail/input/input_adapters.hpp/input_stream_adapter/input_stream_adapter class input_stream_adapter: input_stream_adapter(const input_stream_adapter&) = delete;
negative_train_query0_00074
include/nlohmann/detail/input/input_adapters.hpp/input_buffer_adapter/input_buffer_adapter class input_buffer_adapter: input_buffer_adapter(input_buffer_adapter&&) = delete;
negative_train_query0_00075
include/nlohmann/detail/input/input_adapters.hpp/file_input_adapter/file_input_adapter class file_input_adapter: file_input_adapter(file_input_adapter&&) = default;
negative_train_query0_00076
include/nlohmann/detail/input/input_adapters.hpp/wide_string_input_adapter/wide_string_input_adapter class wide_string_input_adapter: explicit wide_string_input_adapter(const WideStringType& w) noexcept : str(w) {}
negative_train_query0_00077
include/nlohmann/detail/input/input_adapters.hpp/wide_string_input_adapter/fill_buffer class wide_string_input_adapter: void fill_buffer() { wide_string_input_helper<WideStringType, T>::fill_buffer(str, current_wchar, utf8_bytes, utf8_bytes_index, utf8_bytes_filled); }
negative_train_query0_00078
include/nlohmann/detail/input/input_adapters.hpp/input_adapter/input_adapter class input_adapter: input_adapter(const ContiguousContainer& c) : input_adapter(std::begin(c), std::end(c)) {}
negative_train_query0_00079
include/nlohmann/detail/input/lexer.hpp/lexer/lexer class lexer: lexer(lexer&&) = delete;
negative_train_query0_00080
include/nlohmann/detail/input/binary_reader.hpp/binary_reader/binary_reader class binary_reader: binary_reader(const binary_reader&) = delete;
negative_train_query0_00081
include/nlohmann/detail/input/binary_reader.hpp/binary_reader/get_string class binary_reader: bool get_string(const input_format_t format, const NumberType len, string_t& result) { bool success = true; std::generate_n(std::back_inserter(result), len, [this, &success, &format]() { get(); if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "string"))) { success = false; } return static_cast<char>(current); }); return success; }
negative_train_query0_00082
include/nlohmann/detail/input/binary_reader.hpp/binary_reader/get_number class binary_reader: bool get_number(const input_format_t format, NumberType& result) { // step 1: read input into array with system's byte order std::array<std::uint8_t, sizeof(NumberType)> vec; for (std::size_t i = 0; i < sizeof(NumberType); ++i) { get(); if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "number"))) { return false; } // reverse byte order prior to conversion if necessary if (is_little_endian != InputIsLittleEndian) { vec[sizeof(NumberType) - i - 1] = static_cast<std::uint8_t>(current); } else { vec[i] = static_cast<std::uint8_t>(current); // LCOV_EXCL_LINE } } // step 2: convert array into number of type T and return std::memcpy(&result, vec.data(), sizeof(NumberType)); return true; }
negative_train_query0_00083
include/nlohmann/detail/input/binary_reader.hpp/binary_reader/get_bson_string class binary_reader: bool get_bson_string(const NumberType len, string_t& result) { if (JSON_HEDLEY_UNLIKELY(len < 1)) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string"))); } return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) and get() != std::char_traits<char>::eof(); }
negative_train_query0_00084
include/nlohmann/detail/input/parser.hpp/parser/parser class parser: explicit parser(detail::input_adapter_t&& adapter, const parser_callback_t cb = nullptr, const bool allow_exceptions_ = true) : callback(cb), m_lexer(std::move(adapter)), allow_exceptions(allow_exceptions_) { // read first token get_token(); }
negative_train_query0_00085
include/nlohmann/detail/input/parser.hpp/parser/sax_parse_internal class parser: bool sax_parse_internal(SAX* sax) { // stack to remember the hierarchy of structured values we are parsing // true = array; false = object std::vector<bool> states; // value to avoid a goto (see comment where set to true) bool skip_to_state_evaluation = false; while (true) { if (not skip_to_state_evaluation) { // invariant: get_token() was called before each iteration switch (last_token) { case token_type::begin_object: { if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1)))) { return false; } // closing } -> we are done if (get_token() == token_type::end_object) { if (JSON_HEDLEY_UNLIKELY(not sax->end_object())) { return false; } break; } // parse key if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"))); } if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string()))) { return false; } // parse separator (:) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"))); } // remember we are now inside an object states.push_back(false); // parse values get_token(); continue; } case token_type::begin_array: { if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1)))) { return false; } // closing ] -> we are done if (get_token() == token_type::end_array) { if (JSON_HEDLEY_UNLIKELY(not sax->end_array())) { return false; } break; } // remember we are now inside an array states.push_back(true); // parse values (no need to call get_token) continue; } case token_type::value_float: { const auto res = m_lexer.get_number_float(); if (JSON_HEDLEY_UNLIKELY(not std::isfinite(res))) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'")); } if (JSON_HEDLEY_UNLIKELY(not sax->number_float(res, m_lexer.get_string()))) { return false; } break; } case token_type::literal_false: { if (JSON_HEDLEY_UNLIKELY(not sax->boolean(false))) { return false; } break; } case token_type::literal_null: { if (JSON_HEDLEY_UNLIKELY(not sax->null())) { return false; } break; } case token_type::literal_true: { if (JSON_HEDLEY_UNLIKELY(not sax->boolean(true))) { return false; } break; } case token_type::value_integer: { if (JSON_HEDLEY_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer()))) { return false; } break; } case token_type::value_string: { if (JSON_HEDLEY_UNLIKELY(not sax->string(m_lexer.get_string()))) { return false; } break; } case token_type::value_unsigned: { if (JSON_HEDLEY_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned()))) { return false; } break; } case token_type::parse_error: { // using "uninitialized" to avoid "expected" message return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::uninitialized, "value"))); } default: // the last token was unexpected { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"))); } } } else { skip_to_state_evaluation = false; } // we reached this line after we successfully parsed a value if (states.empty()) { // empty stack: we reached the end of the hierarchy: done return true; } if (states.back()) // array { // comma -> next value if (get_token() == token_type::value_separator) { // parse a new value get_token(); continue; } // closing ] if (JSON_HEDLEY_LIKELY(last_token == token_type::end_array)) { if (JSON_HEDLEY_UNLIKELY(not sax->end_array())) { return false; } // We are done with this array. Before we can parse a // new value, we need to evaluate the new state first. // By setting skip_to_state_evaluation to false, we // are effectively jumping to the beginning of this if. assert(not states.empty()); states.pop_back(); skip_to_state_evaluation = true; continue; } return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_array, "array"))); } else // object { // comma -> next value if (get_token() == token_type::value_separator) { // parse key if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"))); } if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string()))) { return false; } // parse separator (:) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"))); } // parse values get_token(); continue; } // closing } if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object)) { if (JSON_HEDLEY_UNLIKELY(not sax->end_object())) { return false; } // We are done with this object. Before we can parse a // new value, we need to evaluate the new state first. // By setting skip_to_state_evaluation to false, we // are effectively jumping to the beginning of this if. assert(not states.empty()); states.pop_back(); skip_to_state_evaluation = true; continue; } return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_object, "object"))); } } }
negative_train_query0_00086
include/nlohmann/detail/input/parser.hpp/parser/sax_parse class parser: bool sax_parse(SAX* sax, const bool strict = true) { (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {}; const bool result = sax_parse_internal(sax); // strict mode: next byte must be EOF if (result and strict and (get_token() != token_type::end_of_input)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_of_input, "value"))); } return result; }
negative_train_query0_00087
include/nlohmann/detail/input/json_sax.hpp/json_sax_dom_parser/json_sax_dom_parser class json_sax_dom_parser: json_sax_dom_parser(json_sax_dom_parser&&) = default;
negative_train_query0_00088
include/nlohmann/detail/input/json_sax.hpp/json_sax_dom_callback_parser/json_sax_dom_callback_parser class json_sax_dom_callback_parser: json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;
negative_train_query0_00089
include/nlohmann/detail/input/json_sax.hpp/json_sax_dom_callback_parser/handle_value class json_sax_dom_callback_parser: std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool skip_callback = false) { assert(not keep_stack.empty()); // do not handle this value if we know it would be added to a discarded // container if (not keep_stack.back()) { return {false, nullptr}; } // create value auto value = BasicJsonType(std::forward<Value>(v)); // check callback const bool keep = skip_callback or callback(static_cast<int>(ref_stack.size()), parse_event_t::value, value); // do not handle this value if we just learnt it shall be discarded if (not keep) { return {false, nullptr}; } if (ref_stack.empty()) { root = std::move(value); return {true, &root}; } // skip this value if we already decided to skip the parent // (https://github.com/nlohmann/json/issues/971#issuecomment-413678360) if (not ref_stack.back()) { return {false, nullptr}; } // we now only expect arrays and objects assert(ref_stack.back()->is_array() or ref_stack.back()->is_object()); // array if (ref_stack.back()->is_array()) { ref_stack.back()->m_value.array->push_back(std::move(value)); return {true, &(ref_stack.back()->m_value.array->back())}; } // object assert(ref_stack.back()->is_object()); // check if we should store an element for the current key assert(not key_keep_stack.empty()); const bool store_element = key_keep_stack.back(); key_keep_stack.pop_back(); if (not store_element) { return {false, nullptr}; } assert(object_element); *object_element = std::move(value); return {true, object_element}; }
negative_train_query0_00090
include/nlohmann/detail/output/binary_writer.hpp/binary_writer/binary_writer class binary_writer: explicit binary_writer(output_adapter_t<CharType> adapter) : oa(adapter) { assert(oa); }
negative_train_query0_00091
include/nlohmann/detail/output/binary_writer.hpp/binary_writer/write_number_with_ubjson_prefix class binary_writer: void write_number_with_ubjson_prefix(const NumberType n, const bool add_prefix) { if (add_prefix) { oa->write_character(get_ubjson_float_prefix(n)); } write_number(n); }
negative_train_query0_00092
include/nlohmann/detail/output/binary_writer.hpp/binary_writer/write_number class binary_writer: void write_number(const NumberType n) { // step 1: write number to array of length NumberType std::array<CharType, sizeof(NumberType)> vec; std::memcpy(vec.data(), &n, sizeof(NumberType)); // step 2: write array to output (with possible reordering) if (is_little_endian != OutputIsLittleEndian) { // reverse byte order prior to conversion if necessary std::reverse(vec.begin(), vec.end()); } oa->write_characters(vec.data(), sizeof(NumberType)); }
negative_train_query0_00093
include/nlohmann/detail/output/binary_writer.hpp/binary_writer/to_char_type class binary_writer: static constexpr CharType to_char_type(InputCharType x) noexcept { return x; }
negative_train_query0_00094
include/nlohmann/detail/output/serializer.hpp/serializer/serializer class serializer: serializer(serializer&&) = delete;
negative_train_query0_00095
include/nlohmann/detail/output/serializer.hpp/serializer/dump_integer class serializer: void dump_integer(NumberType x) { static constexpr std::array<std::array<char, 2>, 100> digits_to_99 { { {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}}, {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}}, {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}}, {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}}, {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}}, {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}}, {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}}, {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}}, {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}}, {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}}, } }; // special case for "0" if (x == 0) { o->write_character('0'); return; } // use a pointer to fill the buffer auto buffer_ptr = number_buffer.begin(); const bool is_negative = std::is_same<NumberType, number_integer_t>::value and not(x >= 0); // see issue #755 number_unsigned_t abs_value; unsigned int n_chars; if (is_negative) { *buffer_ptr = '-'; abs_value = remove_sign(x); // account one more byte for the minus sign n_chars = 1 + count_digits(abs_value); } else { abs_value = static_cast<number_unsigned_t>(x); n_chars = count_digits(abs_value); } // spare 1 byte for '\0' assert(n_chars < number_buffer.size() - 1); // jump to the end to generate the string from backward // so we later avoid reversing the result buffer_ptr += n_chars; // Fast int2ascii implementation inspired by "Fastware" talk by Andrei Alexandrescu // See: https://www.youtube.com/watch?v=o4-CwDo2zpg while (abs_value >= 100) { const auto digits_index = static_cast<unsigned>((abs_value % 100)); abs_value /= 100; *(--buffer_ptr) = digits_to_99[digits_index][1]; *(--buffer_ptr) = digits_to_99[digits_index][0]; } if (abs_value >= 10) { const auto digits_index = static_cast<unsigned>(abs_value); *(--buffer_ptr) = digits_to_99[digits_index][1]; *(--buffer_ptr) = digits_to_99[digits_index][0]; } else { *(--buffer_ptr) = static_cast<char>('0' + abs_value); } o->write_characters(number_buffer.data(), n_chars); }
negative_train_query0_00096
include/nlohmann/detail/output/output_adapters.hpp/output_vector_adapter/output_vector_adapter class output_vector_adapter: explicit output_vector_adapter(std::vector<CharType>& vec) noexcept : v(vec) {}
negative_train_query0_00097
End of preview. Expand in Data Studio

MultiSWEbenchRR

An MTEB dataset
Massive Text Embedding Benchmark

Multilingual Software Issue Localization.

Task category t2t
Domains Programming, Written
Reference https://multi-swe-bench.github.io/#/

Source datasets:

How to evaluate on this task

You can evaluate an embedding model on this dataset using the following code:

import mteb

task = mteb.get_task("MultiSWEbenchRR")
evaluator = mteb.MTEB([task])

model = mteb.get_model(YOUR_MODEL)
evaluator.run(model)

To learn more about how to run models on mteb task check out the GitHub repository.

Citation

If you use this dataset, please cite the dataset as well as mteb, as this dataset likely includes additional processing as a part of the MMTEB Contribution.


@misc{zan2025multiswebench,
  archiveprefix = {arXiv},
  author = {Daoguang Zan and Zhirong Huang and Wei Liu and Hanwu Chen and Linhao Zhang and Shulin Xin and Lu Chen and Qi Liu and Xiaojian Zhong and Aoyan Li and Siyao Liu and Yongsheng Xiao and Liangqiang Chen and Yuyu Zhang and Jing Su and Tianyu Liu and Rui Long and Kai Shen and Liang Xiang},
  eprint = {2504.02605},
  primaryclass = {cs.SE},
  title = {Multi-SWE-bench: A Multilingual Benchmark for Issue Resolving},
  url = {https://arxiv.org/abs/2504.02605},
  year = {2025},
}


@article{enevoldsen2025mmtebmassivemultilingualtext,
  title={MMTEB: Massive Multilingual Text Embedding Benchmark},
  author={Kenneth Enevoldsen and Isaac Chung and Imene Kerboua and Márton Kardos and Ashwin Mathur and David Stap and Jay Gala and Wissam Siblini and Dominik Krzemiński and Genta Indra Winata and Saba Sturua and Saiteja Utpala and Mathieu Ciancone and Marion Schaeffer and Gabriel Sequeira and Diganta Misra and Shreeya Dhakal and Jonathan Rystrøm and Roman Solomatin and Ömer Çağatan and Akash Kundu and Martin Bernstorff and Shitao Xiao and Akshita Sukhlecha and Bhavish Pahwa and Rafał Poświata and Kranthi Kiran GV and Shawon Ashraf and Daniel Auras and Björn Plüster and Jan Philipp Harries and Loïc Magne and Isabelle Mohr and Mariya Hendriksen and Dawei Zhu and Hippolyte Gisserot-Boukhlef and Tom Aarsen and Jan Kostkan and Konrad Wojtasik and Taemin Lee and Marek Šuppa and Crystina Zhang and Roberta Rocca and Mohammed Hamdy and Andrianos Michail and John Yang and Manuel Faysse and Aleksei Vatolin and Nandan Thakur and Manan Dey and Dipam Vasani and Pranjal Chitale and Simone Tedeschi and Nguyen Tai and Artem Snegirev and Michael Günther and Mengzhou Xia and Weijia Shi and Xing Han Lù and Jordan Clive and Gayatri Krishnakumar and Anna Maksimova and Silvan Wehrli and Maria Tikhonova and Henil Panchal and Aleksandr Abramov and Malte Ostendorff and Zheng Liu and Simon Clematide and Lester James Miranda and Alena Fenogenova and Guangyu Song and Ruqiya Bin Safi and Wen-Ding Li and Alessia Borghini and Federico Cassano and Hongjin Su and Jimmy Lin and Howard Yen and Lasse Hansen and Sara Hooker and Chenghao Xiao and Vaibhav Adlakha and Orion Weller and Siva Reddy and Niklas Muennighoff},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2502.13595},
  year={2025},
  url={https://arxiv.org/abs/2502.13595},
  doi = {10.48550/arXiv.2502.13595},
}

@article{muennighoff2022mteb,
  author = {Muennighoff, Niklas and Tazi, Nouamane and Magne, Loïc and Reimers, Nils},
  title = {MTEB: Massive Text Embedding Benchmark},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2210.07316},
  year = {2022}
  url = {https://arxiv.org/abs/2210.07316},
  doi = {10.48550/ARXIV.2210.07316},
}

Dataset Statistics

Dataset Statistics

The following code contains the descriptive statistics from the task. These can also be obtained using:

import mteb

task = mteb.get_task("MultiSWEbenchRR")

desc_stats = task.metadata.descriptive_stats
{}

This dataset card was automatically generated using MTEB

Downloads last month
17