<commit_before>﻿// 
// Copyright (c) Microsoft and contributors.  All rights reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

using System;
using System.IO;
using Microsoft.Azure.Management.DataLake.Store;

namespace Microsoft.Azure.Management.HDInsight.Job.Models
{
    public class AzureDataLakeStoreAccess : IStorageAccess
    {
        // Data Lake Store account name
        private string AccountName;

        // Default storage root path for the cluster in Data Lake Store.
        private string DefaultStorageRootPath;

        // Data Lake Store management client.
        private DataLakeStoreFileSystemManagementClient ManagementClient;

        /// <summary>
        /// Initializes a new instance of the AzureDataLakeStoreAccess class.
        /// </summary>
        /// <param name='client'>
        /// Required. The Data Lake Store management client.
        /// </param>
        /// <param name='storageAccountName'>
        /// Required. The Data Lake Store account name without suffix. E.g., 'myaccount' instead of 'myaccount.azuredatalakestore.net'.
        /// </param>
        /// <param name='defaultStorageRootPath'>
        /// Required. The default storage root path in Data Lake Store for the cluster.
        /// </param>
        public AzureDataLakeStoreAccess(DataLakeStoreFileSystemManagementClient client, string storageAccountName, string defaultStorageRootPath)
        {
            if (string.IsNullOrEmpty(storageAccountName))
            {
                throw new ArgumentNullException(storageAccountName);
            }
            else if (storageAccountName.Contains("."))
            {
                throw new InvalidDataException("When providing a Data Lake Store storageAccountName, provide just the account name, which cannot contain the '.' character. E.g., use 'myaccount', not 'myaccount.azuredatalakestore.net'.");
            }

            this.AccountName = storageAccountName;
            this.ManagementClient = client;
            this.DefaultStorageRootPath = defaultStorageRootPath;
        }

        /// <summary>
        /// Gets the file content from Data Lake Store file path.
        /// </summary>
        /// <param name='filePath'>
        /// Required. File path to download the content of the file.
        /// </param>
        /// <returns>
        /// Stream which points to content of the file.
        /// </returns>
        public Stream GetFileContent(string filePath)
        {
            // The file path needs to be prefixed with DefaultStorageRootPath to get the actual path of the file in the cluster.
            return this.ManagementClient.FileSystem.Open(this.AccountName,
                this.DefaultStorageRootPath + (!this.DefaultStorageRootPath.EndsWith("/") ? "/" : string.Empty) + filePath);
        }
    }
}
<commit_msg>Move ADL code changes under .Net45 macro to fix build failure<commit_after>﻿// 
// Copyright (c) Microsoft and contributors.  All rights reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 
// See the License for the specific language governing permissions and
// limitations under the License.
// 

#if NET45
using System;
using System.IO;
using Microsoft.Azure.Management.DataLake.Store;

namespace Microsoft.Azure.Management.HDInsight.Job.Models
{
    public class AzureDataLakeStoreAccess : IStorageAccess
    {
        // Data Lake Store account name
        private string AccountName;

        // Default storage root path for the cluster in Data Lake Store.
        private string DefaultStorageRootPath;

        // Data Lake Store management client.
        private DataLakeStoreFileSystemManagementClient ManagementClient;

        /// <summary>
        /// Initializes a new instance of the AzureDataLakeStoreAccess class.
        /// </summary>
        /// <param name='client'>
        /// Required. The Data Lake Store management client.
        /// </param>
        /// <param name='storageAccountName'>
        /// Required. The Data Lake Store account name without suffix. E.g., 'myaccount' instead of 'myaccount.azuredatalakestore.net'.
        /// </param>
        /// <param name='defaultStorageRootPath'>
        /// Required. The default storage root path in Data Lake Store for the cluster.
        /// </param>
        public AzureDataLakeStoreAccess(DataLakeStoreFileSystemManagementClient client, string storageAccountName, string defaultStorageRootPath)
        {
            if (string.IsNullOrEmpty(storageAccountName))
            {
                throw new ArgumentNullException(storageAccountName);
            }
            else if (storageAccountName.Contains("."))
            {
                throw new InvalidDataException("When providing a Data Lake Store storageAccountName, provide just the account name, which cannot contain the '.' character. E.g., use 'myaccount', not 'myaccount.azuredatalakestore.net'.");
            }

            this.AccountName = storageAccountName;
            this.ManagementClient = client;
            this.DefaultStorageRootPath = defaultStorageRootPath;
        }

        /// <summary>
        /// Gets the file content from Data Lake Store file path.
        /// </summary>
        /// <param name='filePath'>
        /// Required. File path to download the content of the file.
        /// </param>
        /// <returns>
        /// Stream which points to content of the file.
        /// </returns>
        public Stream GetFileContent(string filePath)
        {
            // The file path needs to be prefixed with DefaultStorageRootPath to get the actual path of the file in the cluster.
            return this.ManagementClient.FileSystem.Open(this.AccountName,
                this.DefaultStorageRootPath + (!this.DefaultStorageRootPath.EndsWith("/") ? "/" : string.Empty) + filePath);
        }
    }
}
#endif

{'fraction_non_alphanumeric': 0.09317138201747889, 'fraction_numerical': 0.0017775144423048438, 'mean_word_length': 2.357533565390353, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4050477', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1611, 'n_words': 599}