<commit_before>namespace AzureDataLake.Store
{
    public struct FsPermission
    {
        public readonly int Integer;

        public FsPermission(int value)
        {
            if (value > 7)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            if (value < 0)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            this.Integer = value;
        }

        public FsPermission(string value)
        {
            if (value.Length != 3)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            bool r = (value[0] == 'r' || value[0] == 'R');
            bool w = (value[1] == 'w' || value[1] == 'W');
            bool x = (value[2] == 'x' || value[2] == 'X');

            this.Integer = bools_to_int(r, w, x);
        }

        public override string ToString()
        {
            return string.Format("{0}({1})", nameof(FsPermission), this.ToRwxString());
        }

        public string ToRwxString()
        {
            char r = this.Read ? 'r' : '-';
            char w = this.Write? 'w' : '-';
            char x = this.Execute? 'x' : '-';
            string s = string.Format("{0}{1}{2}",r,w,x);
            return s;
        }

        public FsPermission(bool read, bool write, bool execute)
        {
            this.Integer = bools_to_int(read, write, execute);
        }

        private static int bools_to_int(bool read, bool write, bool execute)
        {
            return (bool_to_int(read) << 2) | (bool_to_int(write) << 1) | (bool_to_int(execute) << 0);
        }

        private static int bool_to_int(bool v)
        {
            return v ? 1 : 0;
        }

        public bool Read
        {
            get
            {
                return (0x4 & this.Integer) != 0;
            }
        }

        public bool Write
        {
            get
            {<commit_msg>Added utility function<commit_after>namespace AzureDataLake.Store
{
    public struct FsPermission
    {
        public readonly int Integer;

        public FsPermission(int value)
        {
            if (value > 7)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            if (value < 0)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            this.Integer = value;
        }

        public FsPermission(string value)
        {
            if (value.Length != 3)
            {
                throw new System.ArgumentOutOfRangeException(nameof(value));
            }

            bool r = (value[0] == 'r' || value[0] == 'R');
            bool w = (value[1] == 'w' || value[1] == 'W');
            bool x = (value[2] == 'x' || value[2] == 'X');

            this.Integer = bools_to_int(r, w, x);
        }

        public override string ToString()
        {
            return string.Format("{0}({1})", nameof(FsPermission), this.ToRwxString());
        }

        public string ToRwxString()
        {
            char r = bool_to_char(this.Read,'r');
            char w = bool_to_char(this.Write,'w');
            char x = bool_to_char(this.Execute,'x');
            string s = string.Format("{0}{1}{2}",r,w,x);
            return s;
        }

        private static char bool_to_char(bool b, char true_char)
        {
            return (b ? true_char : '-');
        }

        public FsPermission(bool read, bool write, bool execute)
        {
            this.Integer = bools_to_int(read, write, execute);
        }

        private static int bools_to_int(bool read, bool write, bool execute)
        {
            return (bool_to_int(read) << 2) | (bool_to_int(write) << 1) | (bool_to_int(execute) << 0);
        }

        private static int bool_to_int(bool v)
        {
            return v ? 1 : 0;
        }

        public bool Read
        {
            get
            {
                return (0x4 & this.Integer) != 0;
            }
        }

        public bool Write
        {
            get
            {
{'fraction_non_alphanumeric': 0.12100072167428434, 'fraction_numerical': 0.010584556170315132, 'mean_word_length': 1.3773584905660377, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, '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': '534798', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1187, 'n_words': 275}