<commit_before>/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
#include <eosio/chain/contracts/abi_serializer.hpp>
#include <eosio/chain/contracts/chain_initializer.hpp>
#include <eosio/chain/contracts/types.hpp>
#include <eosio/chain/authority.hpp>
#include <eosio/chain/chain_config.hpp>
#include <eosio/chain/transaction.hpp>
#include <fc/io/raw.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fc/io/varint.hpp>

using namespace boost;

namespace eosio { namespace chain { namespace contracts {

   using boost::algorithm::ends_with;
   using std::string;

   template <typename T>
   inline fc::variant variant_from_stream(fc::datastream<const char*>& stream) {
      T temp;
      fc::raw::unpack( stream, temp );
      return fc::variant(temp);
   }

   template <typename T>
   auto pack_unpack() {
      return std::make_pair<abi_serializer::unpack_function, abi_serializer::pack_function>(
         []( fc::datastream<const char*>& stream, bool is_array, bool is_optional) -> fc::variant  {
            if( is_array )
               return variant_from_stream<vector<T>>(stream);
            else if ( is_optional )
               return variant_from_stream<optional<T>>(stream);
            return variant_from_stream<T>(stream);
         },
         []( const fc::variant& var, fc::datastream<char*>& ds, bool is_array, bool is_optional ){
            if( is_array )
               fc::raw::pack( ds, var.as<vector<T>>() );
            else if ( is_optional )
               fc::raw::pack( ds, var.as<optional<T>>() );
            else
               fc::raw::pack( ds,  var.as<T>());
         }
      );
   }

   abi_serializer::abi_serializer( const abi_def& abi ) {
      configure_built_in_types();
      set_abi(abi);
   }

   void abi_serializer::configure_built_in_types() {
      //public_key.hpp
      built_in_types.emplace("public_key",                pack_unpack<public_key_type>());

      //symbol.hpp
      built_in_types.emplace("symbol",                    pack_unpack<symbol>());
      built_in_types.emplace("symbol_code",               pack_unpack<symbol_code>());

      //asset.hpp
      built_in_types.emplace("asset",                     pack_unpack<asset>());

      //native.hpp
      built_in_types.emplace("string",                    pack_unpack<string>());
      built_in_types.emplace("time",                      pack_unpack<fc::time_point_sec>());
      built_in_types.emplace("signature",                 pack_unpack<signature_type>());
      built_in_types.emplace("checksum160",               pack_unpack<checksum160_type>());
      built_in_types.emplace("checksum256",               pack_unpack<checksum256_type>());
      built_in_types.emplace("checksum512",               pack_unpack<checksum512_type>());
      built_in_types.emplace("transaction_id_type",       pack_unpack<checksum256_type>());
      built_in_types.emplace("field_name",                pack_unpack<field_name>());
      built_in_types.emplace("fixed_string32",            pack_unpack<fixed_string32>());
      built_in_types.emplace("fixed_string16",            pack_unpack<fixed_string16>());
      built_in_types.emplace("type_name",                 pack_unpack<type_name>());
      built_in_types.emplace("bytes",                     pack_unpack<bytes>());
      built_in_types.emplace("uint8",                     pack_unpack<uint8>());
      built_in_types.emplace("uint16",                    pack_unpack<uint16>());
      built_in_types.emplace("uint32",                    pack_unpack<uint32>());
      built_in_types.emplace("uint64",                    pack_unpack<uint64>());
      built_in_types.emplace("uint128",                   pack_unpack<boost::multiprecision::uint128_t>());
      built_in_types.emplace("uint256",                   pack_unpack<boost::multiprecision::uint256_t>());
      built_in_types.emplace("varuint32",                 pack_unpack<fc::unsigned_int>());
      built_in_types.emplace("int8",                      pack_unpack<int8_t>());
      built_in_types.emplace("int16",                     pack_unpack<int16_t>());
      built_in_types.emplace("int32",                     pack_unpack<int32_t>());
      built_in_types.emplace("int64",                     pack_unpack<int64_t>());
      built_in_types.emplace("varint32",                  pack_unpack<fc::signed_int>());
      built_in_types.emplace("float64",                   pack_unpack<double>());
      built_in_types.emplace("name",                      pack_unpack<name>());
      built_in_types.emplace("account_name",              pack_unpack<account_name>());
      built_in_types.emplace("permission_name",           pack_unpack<permission_name>());
      built_in_types.emplace("action_name",               pack_unpack<action_name>());
      built_in_types.emplace("scope_name",                pack_unpack<scope_name>());<commit_msg>Added clause_pair as native type<commit_after>/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
#include <eosio/chain/contracts/abi_serializer.hpp>
#include <eosio/chain/contracts/chain_initializer.hpp>
#include <eosio/chain/contracts/types.hpp>
#include <eosio/chain/authority.hpp>
#include <eosio/chain/chain_config.hpp>
#include <eosio/chain/transaction.hpp>
#include <fc/io/raw.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <fc/io/varint.hpp>

using namespace boost;

namespace eosio { namespace chain { namespace contracts {

   using boost::algorithm::ends_with;
   using std::string;

   template <typename T>
   inline fc::variant variant_from_stream(fc::datastream<const char*>& stream) {
      T temp;
      fc::raw::unpack( stream, temp );
      return fc::variant(temp);
   }

   template <typename T>
   auto pack_unpack() {
      return std::make_pair<abi_serializer::unpack_function, abi_serializer::pack_function>(
         []( fc::datastream<const char*>& stream, bool is_array, bool is_optional) -> fc::variant  {
            if( is_array )
               return variant_from_stream<vector<T>>(stream);
            else if ( is_optional )
               return variant_from_stream<optional<T>>(stream);
            return variant_from_stream<T>(stream);
         },
         []( const fc::variant& var, fc::datastream<char*>& ds, bool is_array, bool is_optional ){
            if( is_array )
               fc::raw::pack( ds, var.as<vector<T>>() );
            else if ( is_optional )
               fc::raw::pack( ds, var.as<optional<T>>() );
            else
               fc::raw::pack( ds,  var.as<T>());
         }
      );
   }

   abi_serializer::abi_serializer( const abi_def& abi ) {
      configure_built_in_types();
      set_abi(abi);
   }

   void abi_serializer::configure_built_in_types() {
      //public_key.hpp
      built_in_types.emplace("public_key",                pack_unpack<public_key_type>());

      //symbol.hpp
      built_in_types.emplace("symbol",                    pack_unpack<symbol>());
      built_in_types.emplace("symbol_code",               pack_unpack<symbol_code>());

      //asset.hpp
      built_in_types.emplace("asset",                     pack_unpack<asset>());

      //native.hpp
      built_in_types.emplace("string",                    pack_unpack<string>());
      built_in_types.emplace("time",                      pack_unpack<fc::time_point_sec>());
      built_in_types.emplace("signature",                 pack_unpack<signature_type>());
      built_in_types.emplace("checksum160",               pack_unpack<checksum160_type>());
      built_in_types.emplace("checksum256",               pack_unpack<checksum256_type>());
      built_in_types.emplace("checksum512",               pack_unpack<checksum512_type>());
      built_in_types.emplace("clause_pair",               pack_unpack<clause_pair>());
      built_in_types.emplace("transaction_id_type",       pack_unpack<checksum256_type>());
      built_in_types.emplace("field_name",                pack_unpack<field_name>());
      built_in_types.emplace("fixed_string32",            pack_unpack<fixed_string32>());
      built_in_types.emplace("fixed_string16",            pack_unpack<fixed_string16>());
      built_in_types.emplace("type_name",                 pack_unpack<type_name>());
      built_in_types.emplace("bytes",                     pack_unpack<bytes>());
      built_in_types.emplace("uint8",                     pack_unpack<uint8>());
      built_in_types.emplace("uint16",                    pack_unpack<uint16>());
      built_in_types.emplace("uint32",                    pack_unpack<uint32>());
      built_in_types.emplace("uint64",                    pack_unpack<uint64>());
      built_in_types.emplace("uint128",                   pack_unpack<boost::multiprecision::uint128_t>());
      built_in_types.emplace("uint256",                   pack_unpack<boost::multiprecision::uint256_t>());
      built_in_types.emplace("varuint32",                 pack_unpack<fc::unsigned_int>());
      built_in_types.emplace("int8",                      pack_unpack<int8_t>());
      built_in_types.emplace("int16",                     pack_unpack<int16_t>());
      built_in_types.emplace("int32",                     pack_unpack<int32_t>());
      built_in_types.emplace("int64",                     pack_unpack<int64_t>());
      built_in_types.emplace("varint32",                  pack_unpack<fc::signed_int>());
      built_in_types.emplace("float64",                   pack_unpack<double>());
      built_in_types.emplace("name",                      pack_unpack<name>());
      built_in_types.emplace("account_name",              pack_unpack<account_name>());
      built_in_types.emplace("permission_name",           pack_unpack<permission_name>());
      built_in_types.emplace("action_name",               pack_unpack<action_name>());
      built_in_types.emplace("scope_name",                pack_unpack<scope_name>());
{'fraction_non_alphanumeric': 0.13364748345698818, 'fraction_numerical': 0.01503910166432725, 'mean_word_length': 2.606290672451193, 'pattern_counts': {'":': 0, '<': 124, '<?xml version=': 0, '>': 126, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3215858', 'n_tokens_mistral': 3235, 'n_tokens_neox': 3090, 'n_words': 375}