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


namespace System
{
    public static partial class ITreeNodeHelper
    {
        /// <summary>
        /// traverse every item in the tree node recursively.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="treeNode"></param>
        /// <returns></returns>
        public static IEnumerable<T> EnumerateRecursively<T>(ITreeNode<T> treeNode)
            where T : ITreeNode<T>
        {
            yield return treeNode.Self;
            for (int i = 0; i < treeNode.Children.Count; i++)
            {
                var child = treeNode.Children[i];
                var enumerable = EnumerateRecursively(child);
                foreach (var item in enumerable)
                {
                    yield return item;
                }
            }
        }

        /// <summary>
        /// traverse every item in the tree node non-recursively.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="treeNode"></param>
        /// <returns></returns>
        public static IEnumerable<T> EnumerateNonRecursively<T>(ITreeNode<T> treeNode)
            where T : ITreeNode<T>
        {
            var stack = new Stack<ITreeNode<T>>();
            stack.Push(treeNode);
            while (stack.Count > 0)
            {
                ITreeNode<T> current = stack.Pop();
                foreach (var item in current.Children)
                {
                    stack.Push(item);
                }
                yield return current.Self;
            }
        }

    }
}<commit_msg>clean<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace System
{
    public static partial class ITreeNodeHelper
    {
        /// <summary>
        /// traverse every item in the tree node recursively.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="treeNode"></param>
        /// <returns></returns>
        public static IEnumerable<T> EnumerateRecursively<T>(ITreeNode<T> treeNode)
            where T : ITreeNode<T>
        {
            yield return treeNode.Self;
            for (int i = 0; i < treeNode.Children.Count; i++)
            {
                T child = treeNode.Children[i];
                IEnumerable<T> enumerable = EnumerateRecursively(child);
                foreach (T item in enumerable)
                {
                    yield return item;
                }
            }
        }

        /// <summary>
        /// traverse every item in the tree node non-recursively.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="treeNode"></param>
        /// <returns></returns>
        public static IEnumerable<T> EnumerateNonRecursively<T>(ITreeNode<T> treeNode)
            where T : ITreeNode<T>
        {
            var stack = new Stack<ITreeNode<T>>();
            stack.Push(treeNode);
            while (stack.Count > 0)
            {
                ITreeNode<T> current = stack.Pop();
                foreach (T item in current.Children)
                {
                    stack.Push(item);
                }
                yield return current.Self;
            }
        }

    }
}
{'fraction_non_alphanumeric': 0.1181031911720847, 'fraction_numerical': 0.0011929615269907546, 'mean_word_length': 1.4146868250539957, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 60, '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': '5433690', 'n_tokens_mistral': 907, 'n_tokens_neox': 867, 'n_words': 210}