<commit_before>package main

import (
	"fmt"
	"strings"
)

func Glob(pattern, subj string) bool {
	parts := strings.Split(pattern, "*")

	switch len(parts) {
	case 0:
		return false
	case 1:
		return subj == pattern
	default:
		leadingGlob := strings.HasPrefix(pattern, "*")
		trailingGlob := strings.HasSuffix(pattern, "*")
		end := len(parts) - 1

		for i, part := range parts {
			switch {
			case i == 0 && leadingGlob:
				end -= 1
				continue
			case i == 1 && leadingGlob:
				if !strings.Contains(subj, part) {
					return false
				}
			case i == end && trailingGlob:
				return true
			default:
				if subj != part {
					return false
				}
			}
			idx := strings.Index(subj, part) + len(part) + 1
			subj = subj[idx:]
		}
	}

	return true
}

func main() {
	fmt.Printf("%#v\n", Glob("*te*t", "blahtest123"))
}<commit_msg>Minor adjustments<commit_after>package main

import (
	"fmt"
	"strings"
)

func Glob(pattern, subj string) bool {
	parts := strings.Split(pattern, "*")

	switch len(parts) {
	case 0:
		return false
	case 1:
		return subj == pattern
	default:
		leadingGlob := strings.HasPrefix(pattern, "*")
		trailingGlob := strings.HasSuffix(pattern, "*")
		end := len(parts) - 1

		for i, part := range parts {
			switch {
			case i == 0 && leadingGlob:
				continue
			case i == 1 && leadingGlob:
				if !strings.Contains(subj, part) {
					return false
				}
			case i == end:
				if len(subj) > 0 {
					return trailingGlob
				}
				return true
			default:
				if !strings.HasPrefix(subj, part) {
					return false
				}
			}
			idx := strings.Index(subj, part) + len(part) + 1
			subj = subj[idx:]
		}
	}

	return true
}

func main() {
	fmt.Printf("%#v\n", Glob("*e*t*", "test123"))
}
{'fraction_non_alphanumeric': 0.15172817809021674, 'fraction_numerical': 0.011716461628588167, 'mean_word_length': 2.821029082774049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1227075', 'n_tokens_mistral': 767, 'n_tokens_neox': 628, 'n_words': 161}