<commit_before>#pragma once

#include "Application.hpp"
#include "common/NetworkManager.hpp"
#include "common/NetworkRequester.hpp"
#include "common/NetworkWorker.hpp"
#include "singletons/Paths.hpp"

#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <QCryptographicHash>
#include <QFile>

namespace chatterino {

static QJsonObject parseJSONFromData(const QByteArray &data)
{
    QJsonDocument jsonDoc(QJsonDocument::fromJson(data));

    if (jsonDoc.isNull()) {
        return QJsonObject();
    }

    return jsonDoc.object();
}

static rapidjson::Document parseJSONFromData2(const QByteArray &data)
{
    rapidjson::Document ret(rapidjson::kNullType);

    rapidjson::ParseResult result = ret.Parse(data.data(), data.length());

    if (result.Code() != rapidjson::kParseErrorNone) {
        Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
            result.Offset());
        return ret;
    }

    return ret;
}

static rapidjson::Document parseJSONFromReply2(QNetworkReply *reply)
{
    rapidjson::Document ret(rapidjson::kNullType);

    if (reply->error() != QNetworkReply::NetworkError::NoError) {
        return ret;
    }

    QByteArray data = reply->readAll();
    rapidjson::ParseResult result = ret.Parse(data.data(), data.length());

    if (result.Code() != rapidjson::kParseErrorNone) {
        Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
            result.Offset());<commit_msg>Remove unused parseJSONFromReply2 function<commit_after>#pragma once

#include "Application.hpp"
#include "common/NetworkManager.hpp"
#include "common/NetworkRequester.hpp"
#include "common/NetworkWorker.hpp"
#include "singletons/Paths.hpp"

#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <QCryptographicHash>
#include <QFile>

namespace chatterino {

static QJsonObject parseJSONFromData(const QByteArray &data)
{
    QJsonDocument jsonDoc(QJsonDocument::fromJson(data));

    if (jsonDoc.isNull()) {
        return QJsonObject();
    }

    return jsonDoc.object();
}

static rapidjson::Document parseJSONFromData2(const QByteArray &data)
{
    rapidjson::Document ret(rapidjson::kNullType);

    rapidjson::ParseResult result = ret.Parse(data.data(), data.length());

    if (result.Code() != rapidjson::kParseErrorNone) {
        Log("JSON parse error: {} ({})", rapidjson::GetParseError_En(result.Code()),
            result.Offset());
{'fraction_non_alphanumeric': 0.14361485108119135, 'fraction_numerical': 0.0016319869441044472, 'mean_word_length': 4.715617715617715, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6248973', 'n_tokens_mistral': 768, 'n_tokens_neox': 757, 'n_words': 140}