<commit_before>// Copyright © 2009-2010 <NAME> <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package gospec

import (
	"fmt"
	filepath "path"
	"runtime"
)


type Location struct {
	File string
	Line int
}

func currentLocation() *Location {
	return newLocation(1)
}

func callerLocation() *Location {
	return newLocation(2)
}

func newLocation(n int) *Location {
	if _, file, line, ok := runtime.Caller(n + 2); ok { // TODO: is the change from n+1 to n+2 a bug in runtime.Caller or not?
		return &Location{filename(file), line}
	}
	return nil
}

func filename(path string) string {
	_, file := filepath.Split(path)
	return file
}

func (this *Location) equals(that *Location) bool {
	return this.File == that.File &&
		this.Line == that.Line
}

func (this *Location) String() string {
	if this == nil {
		return "Unknown File"
	}
	return fmt.Sprintf("%v:%v", this.File, this.Line)
}<commit_msg>Removed workaround for the runtime.Caller() bug which is now fixed in the tip<commit_after>// Copyright © 2009-2010 <NAME> <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package gospec

import (
	"fmt"
	filepath "path"
	"runtime"
)


type Location struct {
	File string
	Line int
}

func currentLocation() *Location {
	return newLocation(1)
}

func callerLocation() *Location {
	return newLocation(2)
}

func newLocation(n int) *Location {
	if _, file, line, ok := runtime.Caller(n + 1); ok {
		return &Location{filename(file), line}
	}
	return nil
}

func filename(path string) string {
	_, file := filepath.Split(path)
	return file
}

func (this *Location) equals(that *Location) bool {
	return this.File == that.File &&
		this.Line == that.Line
}

func (this *Location) String() string {
	if this == nil {
		return "Unknown File"
	}
	return fmt.Sprintf("%v:%v", this.File, this.Line)
}
{'fraction_non_alphanumeric': 0.1338701560140916, 'fraction_numerical': 0.01610468042274786, 'mean_word_length': 3.945273631840796, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4855828', 'n_tokens_mistral': 699, 'n_tokens_neox': 670, 'n_words': 216}