<commit_before>//
// Created by pkanev on 3/8/2017.
//

#include <sstream>
#include "NetworkDomainCallbackHandlers.h"

using namespace tns;

void NetworkDomainCallbackHandlers::ResponseReceivedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if ((!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "type")).FromMaybe(false)) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "response")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to ResponseReceived! Required params: 'requestId', `timestamp`, `type`, `response`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto type = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "type")).ToLocalChecked()->ToString();
        auto response = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "response")).ToLocalChecked();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();

        auto responseAsObj = response->ToObject();
        v8::Local<v8::String> responseJson;
        auto maybeResponseJson = v8::JSON::Stringify(context, responseAsObj);

        if (!maybeResponseJson.ToLocal(&responseJson)) {
            throw NativeScriptException("`response` parameter not in the correct format.");
        }

        auto responseJsonString = ArgConverter::ConvertToString(responseJson).c_str();
        auto protocolResponseJson = protocol::parseJSON(responseJsonString);

        protocol::ErrorSupport errorSupport;

        auto protocolResponseObj = protocol::Network::Response::parse(protocolResponseJson.get(),
                                   &errorSupport);

        auto requestIdString = ArgConverter::ConvertToString(requestId).c_str();
        auto networkRequestData = new v8_inspector::utils::NetworkRequestData();
        networkAgentInstance->m_responses.insert(std::make_pair(requestIdString, networkRequestData));

        networkAgentInstance->m_frontend.responseReceived(requestIdString,
                FrameId,
                LoaderId,
                timeStamp,
                ArgConverter::ConvertToString(
                    type).c_str(),
                std::move(protocolResponseObj));
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::RequestWillBeSentCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if ((!(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "url")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "request")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "type")).FromMaybe(false)))) {
            throw NativeScriptException("Not all parameters are present in the object argument in the call to RequestWillBeSent! Required params: 'requestId', `url`, `timestamp`, `type`, `request`, `timestamps`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto url = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "url")).ToLocalChecked()->ToString();
        auto request = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "request")).ToLocalChecked();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();
        auto typeArg = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "type")).ToLocalChecked()->ToString();

        auto requestAsObj = request->ToObject();
        v8::Local<v8::String> requestJson;
        auto maybeRequestJson = v8::JSON::Stringify(context, requestAsObj);

        if (!maybeRequestJson.ToLocal(&requestJson)) {
            throw NativeScriptException("`request` parameter not in the correct format.");
        }

        auto requestJsonString = ArgConverter::ConvertToString(requestJson).c_str();
        auto protocolRequestJson = protocol::parseJSON(requestJsonString);

        protocol::ErrorSupport errorSupport;

        auto protocolResponseObj = protocol::Network::Request::parse(protocolRequestJson.get(), &errorSupport);
        auto initiator = protocol::Network::Initiator::create().setType(protocol::Network::Initiator::TypeEnum::Script).build();

        protocol::Maybe<String16> type(ArgConverter::ConvertToString(typeArg).c_str());
        protocol::Maybe<protocol::Network::Response> emptyRedirect;
        networkAgentInstance->m_frontend.requestWillBeSent(ArgConverter::ConvertToString(requestId).c_str(),
                FrameId,
                LoaderId,
                ArgConverter::ConvertToString(url).c_str(),
                std::move(protocolResponseObj),
                timeStamp,
                std::move(initiator),
                emptyRedirect,
                type);
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::DataForRequestIdCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if (!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "data")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "hasTextContent")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to DataForRequestId! Required params: 'requestId', `data`, `hasTextContent`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto data = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "data")).ToLocalChecked()->ToString();
        auto hasTextContent = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "hasTextContent")).ToLocalChecked()->ToBoolean();

        auto requestIdString = ArgConverter::ConvertToString(requestId).c_str();
        auto dataString = ArgConverter::ConvertToString(data);
        auto hasTextContentBool = hasTextContent->BooleanValue();

        auto responses = networkAgentInstance->m_responses;
        auto it = responses.find(requestIdString);

        if (it == responses.end()) {
            throw NativeScriptException("Response not found for requestId = " +
                                        ArgConverter::ConvertToString(requestId));
        } else {
            v8_inspector::utils::NetworkRequestData* response = it->second;

            if (!hasTextContentBool) {
                response->setData(dataString);
            } else {
                response->setData(ArgConverter::ConvertToString(data));
            }

            response->setHasTextContent(hasTextContentBool);
        }
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::LoadingFinishedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if (!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to LoadingFinished! Required params: 'requestId', `timeStamp`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();

        networkAgentInstance->m_frontend.loadingFinished(ArgConverter::ConvertToString(requestId).c_str(), timeStamp);
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

const char* NetworkDomainCallbackHandlers::FrameId = "NSFrameIdentifier";
const char* NetworkDomainCallbackHandlers::LoaderId = "NSLoaderIdentifier";<commit_msg>fix inline js string to c-string conversion that failed on older devices<commit_after>//
// Created by pkanev on 3/8/2017.
//

#include <sstream>
#include "NetworkDomainCallbackHandlers.h"
#include "NativeScriptAssert.h"

using namespace tns;

void NetworkDomainCallbackHandlers::ResponseReceivedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if ((!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "type")).FromMaybe(false)) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "response")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to ResponseReceived! Required params: 'requestId', `timestamp`, `type`, `response`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto type = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "type")).ToLocalChecked()->ToString();
        auto response = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "response")).ToLocalChecked();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();

        auto responseAsObj = response->ToObject();
        v8::Local<v8::String> responseJson;
        auto maybeResponseJson = v8::JSON::Stringify(context, responseAsObj);

        if (!maybeResponseJson.ToLocal(&responseJson)) {
            throw NativeScriptException("`response` parameter not in the correct format.");
        }

        auto responseJsonString = ArgConverter::ConvertToString(responseJson);
        auto responseJsonCString = responseJsonString.c_str();
        auto protocolResponseJson = protocol::parseJSON(responseJsonCString);

        protocol::ErrorSupport errorSupport;

        auto protocolResponseObj = protocol::Network::Response::parse(protocolResponseJson.get(),
                                   &errorSupport);

        auto errorString = errorSupport.errors().utf8();

        if (!errorString.empty()) {
            auto errorMessage = "Error while parsing debug `response` object. ";
            DEBUG_WRITE_FORCE("%s Error: %s", errorMessage, errorString.c_str());

            throw NativeScriptException(errorMessage + errorString);
        }

        auto requestIdString = ArgConverter::ConvertToString(requestId).c_str();
        auto networkRequestData = new v8_inspector::utils::NetworkRequestData();
        networkAgentInstance->m_responses.insert(std::make_pair(requestIdString, networkRequestData));

        networkAgentInstance->m_frontend.responseReceived(requestIdString,
                FrameId,
                LoaderId,
                timeStamp,
                ArgConverter::ConvertToString(
                    type).c_str(),
                std::move(protocolResponseObj));
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::RequestWillBeSentCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if ((!(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "url")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "request")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false)) ||
                !(argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "type")).FromMaybe(false)))) {
            throw NativeScriptException("Not all parameters are present in the object argument in the call to RequestWillBeSent! Required params: 'requestId', `url`, `timestamp`, `type`, `request`, `timestamps`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto url = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "url")).ToLocalChecked()->ToString();
        auto request = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "request")).ToLocalChecked();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();
        auto typeArg = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "type")).ToLocalChecked()->ToString();

        auto requestAsObj = request->ToObject();
        v8::Local<v8::String> requestJson;
        auto maybeRequestJson = v8::JSON::Stringify(context, requestAsObj);

        if (!maybeRequestJson.ToLocal(&requestJson)) {
            throw NativeScriptException("`request` parameter not in the correct format.");
        }

        auto requestJsonString = ArgConverter::ConvertToString(requestJson);
        auto requestJsonCString = requestJsonString.c_str();
        auto protocolRequestJson = protocol::parseJSON(requestJsonCString);

        protocol::ErrorSupport errorSupport;

        auto protocolRequestObj = protocol::Network::Request::parse(protocolRequestJson.get(), &errorSupport);
        auto initiator = protocol::Network::Initiator::create().setType(protocol::Network::Initiator::TypeEnum::Script).build();

        auto errorString = errorSupport.errors().utf8();

        if (!errorString.empty()) {
            auto errorMessage = "Error while parsing debug `request` object. ";
            DEBUG_WRITE_FORCE("%s Error: %s", errorMessage, errorString.c_str());

            throw NativeScriptException(errorMessage + errorString);
        }

        protocol::Maybe<String16> type(ArgConverter::ConvertToString(typeArg).c_str());
        protocol::Maybe<protocol::Network::Response> emptyRedirect;
        networkAgentInstance->m_frontend.requestWillBeSent(ArgConverter::ConvertToString(requestId).c_str(),
                FrameId,
                LoaderId,
                ArgConverter::ConvertToString(url).c_str(),
                std::move(protocolRequestObj),
                timeStamp,
                std::move(initiator),
                emptyRedirect,
                type);
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::DataForRequestIdCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if (!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "data")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "hasTextContent")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to DataForRequestId! Required params: 'requestId', `data`, `hasTextContent`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto data = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "data")).ToLocalChecked()->ToString();
        auto hasTextContent = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "hasTextContent")).ToLocalChecked()->ToBoolean();

        auto requestIdString = ArgConverter::ConvertToString(requestId).c_str();
        auto dataString = ArgConverter::ConvertToString(data);
        auto hasTextContentBool = hasTextContent->BooleanValue();

        auto responses = networkAgentInstance->m_responses;
        auto it = responses.find(requestIdString);

        if (it == responses.end()) {
            throw NativeScriptException("Response not found for requestId = " +
                                        ArgConverter::ConvertToString(requestId));
        } else {
            v8_inspector::utils::NetworkRequestData* response = it->second;

            if (!hasTextContentBool) {
                response->setData(dataString);
            } else {
                response->setData(ArgConverter::ConvertToString(data));
            }

            response->setHasTextContent(hasTextContentBool);
        }
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

void NetworkDomainCallbackHandlers::LoadingFinishedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
    try {
        auto networkAgentInstance = V8NetworkAgentImpl::Instance;

        if (!networkAgentInstance) {
            return;
        }

        if (args.Length() != 0 && !args[0]->IsObject()) {
            return;
        }

        auto isolate = args.GetIsolate();

        v8::HandleScope scope(isolate);

        auto context = isolate->GetCurrentContext();

        v8::Local<v8::Object> argsObj = args[0]->ToObject();

        if (!argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "requestId")).FromMaybe(false) ||
                !argsObj->Has(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).FromMaybe(false)) {
            throw NativeScriptException(
                "Not all parameters are present in the object argument in the call to LoadingFinished! Required params: 'requestId', `timeStamp`");
        }

        auto requestId = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "requestId")).ToLocalChecked()->ToString();
        auto timeStamp = argsObj->Get(context, ArgConverter::ConvertToV8String(isolate, "timestamp")).ToLocalChecked()->ToNumber()->IntegerValue();

        networkAgentInstance->m_frontend.loadingFinished(ArgConverter::ConvertToString(requestId).c_str(), timeStamp);
    } catch (NativeScriptException& e) {
        e.ReThrowToV8();
    } catch (std::exception e) {
        std::stringstream ss;
        ss << "Error: c exception: " << e.what() << std::endl;
        NativeScriptException nsEx(ss.str());
        nsEx.ReThrowToV8();
    } catch (...) {
        NativeScriptException nsEx(std::string("Error: c exception!"));
        nsEx.ReThrowToV8();
    }
}

const char* NetworkDomainCallbackHandlers::FrameId = "NSFrameIdentifier";
const char* NetworkDomainCallbackHandlers::LoaderId = "NSLoaderIdentifier";
{'fraction_non_alphanumeric': 0.1342757615035645, 'fraction_numerical': 0.0075340246273493195, 'mean_word_length': 3.2567241379310343, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 163, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2976923', 'n_tokens_mistral': 6760, 'n_tokens_neox': 6539, 'n_words': 1176}