<commit_before>package semver

import (
	"errors"
	"flag"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	numerals     string = "0123456789"
	alphabet            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	alphaNumeric        = alphabet + numerals
)

var (
	helpFlag    bool
	versionFlag bool
)

// Version struct represents a semantic version
type Version struct {
	Major uint64
	Minor uint64
	Patch uint64
}

func (v *Version) String() string {
	b := make([]byte, 0, 5)
	b = strconv.AppendUint(b, v.Major, 10)
	b = append(b, '.')
	b = strconv.AppendUint(b, v.Minor, 10)
	b = append(b, '.')
	b = strconv.AppendUint(b, v.Patch, 10)

	return string(b)
}

// Equal accepts to semver strings and compares them
func (v *Version) Equal(v2 *Version) bool {
	if v.Major != v2.Major {
		return false
	}

	if v.Minor != v2.Minor {
		return false
	}

	if v.Patch != v2.Patch {
		return false
	}

	return true
}

// CheckFlag takes a semver Version struct and sets
// a -version flag to return a semver string
func (v *Version) CheckFlag() {
	if versionFlag {
		fmt.Println(v.String())
		os.Exit(0)
	}

	// // Only continue if the main package hasn't parsed flags
	// if flag.Parsed() {
	// 	return
	// }
	//
	// if helpFlag {
	// 	fmt.Println("Usage of version:")
	// 	flag.PrintDefaults()
	// 	// os.Exit(0)
	// }
}

// SetVersion takes a semver string and creates a version flag
// It will parse all flags (versionFS.Parse())
func SetVersion(s string) error {
	// Create Version struct for supplied strings
	v, err := NewVersion(s)
	if err != nil {
		return err
	}

	// Create version flag
	v.CheckFlag()
<commit_msg>Updating semver vendor package<commit_after>package semver

import (
	"errors"
	"flag"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const (
	numerals     string = "0123456789"
	alphabet            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	alphaNumeric        = alphabet + numerals
	SemVersion          = "0.2.1"
)

var (
	helpFlag    bool
	versionFlag bool
)

// Version struct represents a semantic version
type Version struct {
	Major uint64
	Minor uint64
	Patch uint64
}

func (v *Version) String() string {
	b := make([]byte, 0, 5)
	b = strconv.AppendUint(b, v.Major, 10)
	b = append(b, '.')
	b = strconv.AppendUint(b, v.Minor, 10)
	b = append(b, '.')
	b = strconv.AppendUint(b, v.Patch, 10)

	return string(b)
}

// Equal accepts to semver strings and compares them
func (v *Version) Equal(v2 *Version) bool {
	if v.Major != v2.Major {
		return false
	}

	if v.Minor != v2.Minor {
		return false
	}

	if v.Patch != v2.Patch {
		return false
	}

	return true
}

// CheckFlag takes a semver Version struct and sets
// a -version flag to return a semver string
func (v *Version) CheckFlag() {
	if versionFlag {
		fmt.Println(v.String())
		os.Exit(0)
	}

	// // Only continue if the main package hasn't parsed flags
	// if flag.Parsed() {
	// 	return
	// }
	//
	// if helpFlag {
	// 	fmt.Println("Usage of version:")
	// 	flag.PrintDefaults()
	// 	// os.Exit(0)
	// }
}

// SetVersion takes a semver string and creates a version flag
// It will parse all flags (versionFS.Parse())
func SetVersion(s string) error {
	// Create Version struct for supplied strings
	v, err := NewVersion(s)
	if err != nil {
		return err
	}

	// Tag git repo if one exist

	// Create version flag
	v.CheckFlag()

{'fraction_non_alphanumeric': 0.12729461330123382, 'fraction_numerical': 0.018958772193800783, 'mean_word_length': 2.9290780141843973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6952280', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1225, 'n_words': 365}