<commit_before>﻿using Kentor.PU_Adapter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace PU_Stub.Controllers
{
    public class SnodController : ApiController
    {
        private static readonly IDictionary<string, string> TestPersons;
        static SnodController()
        {
            TestPersons = Kentor.PU_Adapter.TestData.TestPersonsPuData.PuDataList
                .ToDictionary(p => p.Substring(8, 12)); // index by person number
        }

        [HttpGet]
        public HttpResponseMessage PKNODPLUS(string arg)
        {
            System.Threading.Thread.Sleep(30); // Introduce production like latency

            string result;
            if (!TestPersons.TryGetValue(arg, out result))
            {
                if (arg.StartsWith("99"))
                {
                    // Returkod: 0102 = Sökt reservnummer saknas i registren 
                    result = "13270102                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _";
                }
                else
                {
                    // Returkod: 0001 = Sökt person saknas i registren 
                    result = "13270001                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _";
                }
            }
            result = "0\n0\n1327\n" + result; // add magic initial lines, like production PU does
            var resp = new HttpResponseMessage(HttpStatusCode.OK);
            resp.Content = new StringContent(result, System.Text.Encoding.GetEncoding("ISO-8859-1"), "text/plain");
            return resp;
        }
    }
}<commit_msg>Make delay async<commit_after>﻿using Kentor.PU_Adapter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;

namespace PU_Stub.Controllers
{
    public class SnodController : ApiController
    {
        private static readonly IDictionary<string, string> TestPersons;
        static SnodController()
        {
            TestPersons = Kentor.PU_Adapter.TestData.TestPersonsPuData.PuDataList
                .ToDictionary(p => p.Substring(8, 12)); // index by person number
        }

        [HttpGet]
        public async Task<HttpResponseMessage> PKNODPLUS(string arg)
        {
            await Task.Delay(30); // Introduce production like latency

            string result;
            if (!TestPersons.TryGetValue(arg, out result))
            {
                if (arg.StartsWith("99"))
                {
                    // Returkod: 0102 = Sökt reservnummer saknas i registren 
                    result = "13270102                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _";
                }
                else
                {
                    // Returkod: 0001 = Sökt person saknas i registren 
                    result = "13270001                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _";
                }
            }
            result = "0\n0\n1327\n" + result; // add magic initial lines, like production PU does
            var resp = new HttpResponseMessage(HttpStatusCode.OK);
            resp.Content = new StringContent(result, System.Text.Encoding.GetEncoding("ISO-8859-1"), "text/plain");
            return resp;
        }
    }
}
{'fraction_non_alphanumeric': 0.03330150393888756, 'fraction_numerical': 0.01002625925041776, 'mean_word_length': 0.30942334739803096, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 260, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6703000', 'n_tokens_mistral': 921, 'n_tokens_neox': 839, 'n_words': 198}