<commit_before>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace IF.Lastfm.Core.Api.Helpers
{
    public static class ApiExtensions
    {
        public static T GetAttribute<T>(this Enum enumValue)
        where T : Attribute
        {
            return enumValue
                .GetType()
                .GetTypeInfo()
                .GetDeclaredField(enumValue.ToString())
                .GetCustomAttribute<T>();
        }

        public static string GetApiName(this Enum enumValue)
        {
            var attribute = enumValue.GetAttribute<ApiNameAttribute>();

            return (attribute != null && !string.IsNullOrWhiteSpace(attribute.Text))
                ? attribute.Text
                : enumValue.ToString();
        }

        public static int ToUnixTimestamp(this DateTime dt)
        {
            var d = (dt - new DateTime(1970, 1, 1).ToUniversalTime()).TotalSeconds;<commit_msg>Fix time bug with scrobbles<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace IF.Lastfm.Core.Api.Helpers
{
    public static class ApiExtensions
    {
        public static T GetAttribute<T>(this Enum enumValue)
        where T : Attribute
        {
            return enumValue
                .GetType()
                .GetTypeInfo()
                .GetDeclaredField(enumValue.ToString())
                .GetCustomAttribute<T>();
        }

        public static string GetApiName(this Enum enumValue)
        {
            var attribute = enumValue.GetAttribute<ApiNameAttribute>();

            return (attribute != null && !string.IsNullOrWhiteSpace(attribute.Text))
                ? attribute.Text
                : enumValue.ToString();
        }

        public static int ToUnixTimestamp(this DateTime dt)
        {
            var d = (dt - new DateTime(1970, 1, 1)).TotalSeconds;
{'fraction_non_alphanumeric': 0.08948432760364004, 'fraction_numerical': 0.006066734074823054, 'mean_word_length': 2.0446153846153847, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1782168', 'n_tokens_mistral': 511, 'n_tokens_neox': 490, 'n_words': 121}