<commit_before>﻿//   Copyright 2014-2017 <NAME>
//
//   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.

module Tools.Paket
open System
open Anthology
open System.IO
open IoHelpers
open Collections
open Exec

let private parseContent (lines : string seq) =
    seq {
        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if 0 < items.Length then
                match items.[0] with
                | "nuget" -> yield (PackageId.from items.[1])
                | _ -> ()
    }

let private updateSourceContent (lines : string seq) (sources : RepositoryUrl seq) =
    seq {
        for source in sources do
            let sourceUri = source.toString
            yield sprintf "source %s" sourceUri

        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if 0 < items.Length then
                match items.[0] with
                | "source" -> ()
                | _ -> yield line
            else yield line
    }

let private generateDependenciesContent (packages : Package seq) =
    seq {
        for package in packages do
            match package.Version with
            | PackageVersion.PackageVersion x -> yield sprintf "nuget %s ~> %s" (package.Id.toString) x
            | PackageVersion.Unspecified -> yield sprintf "nuget %s" (package.Id.toString)
    }

let private removeDependenciesContent (lines : string seq) (packages : PackageId set) =
    seq {
        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)<commit_msg>ignore nuget version on convert<commit_after>﻿//   Copyright 2014-2017 <NAME>
//
//   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.

module Tools.Paket
open System
open Anthology
open System.IO
open IoHelpers
open Collections
open Exec

let private parseContent (lines : string seq) =
    seq {
        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if 0 < items.Length then
                match items.[0] with
                | "nuget" -> yield (PackageId.from items.[1])
                | _ -> ()
    }

let private updateSourceContent (lines : string seq) (sources : RepositoryUrl seq) =
    seq {
        for source in sources do
            let sourceUri = source.toString
            yield sprintf "source %s" sourceUri

        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if 0 < items.Length then
                match items.[0] with
                | "source" -> ()
                | _ -> yield line
            else yield line
    }

let private generateDependenciesContent (packages : Package seq) =
    seq {
        for package in packages do
            match package.Version with
            | PackageVersion.PackageVersion x -> yield sprintf "nuget %s" (package.Id.toString)
            | PackageVersion.Unspecified -> yield sprintf "nuget %s" (package.Id.toString)
    }

let private removeDependenciesContent (lines : string seq) (packages : PackageId set) =
    seq {
        for line in lines do
            let items = line.Split([|' '|], StringSplitOptions.RemoveEmptyEntries)
{'fraction_non_alphanumeric': 0.08789424860853433, 'fraction_numerical': 0.007884972170686457, 'mean_word_length': 2.242857142857143, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2824996', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1097, 'n_words': 435}