<commit_before>package watch

import (
	"path/filepath"
	"sync/atomic"
	"time"

	"github.com/go-gonzo/fs/glob"
	"github.com/omeid/gonzo/context"
	"github.com/omeid/kargar"
	"gopkg.in/fsnotify.v1"
)

func throttle(limit time.Duration) func(func()) bool {
	var last int64
	lims := limit.Seconds()

	return func(cb func()) bool {
		now := time.Now().Unix()
		l := atomic.LoadInt64(&last)

		if l+int64(lims) < now {
			cb()
			atomic.StoreInt64(&last, now)
			return true
		}
		return false
	}
}

// Watcher ...
func Watcher(ctx context.Context, cb func(string), globs ...string) error {
<commit_msg>Update fsnotify import url.<commit_after>package watch

import (
	"path/filepath"
	"sync/atomic"
	"time"

	"github.com/fsnotify/fsnotify"
	"github.com/go-gonzo/fs/glob"
	"github.com/omeid/gonzo/context"
	"github.com/omeid/kargar"
)

func throttle(limit time.Duration) func(func()) bool {
	var last int64
	lims := limit.Seconds()

	return func(cb func()) bool {
		now := time.Now().Unix()
		l := atomic.LoadInt64(&last)

		if l+int64(lims) < now {
			cb()
			atomic.StoreInt64(&last, now)
			return true
		}
		return false
	}
}

// Watcher ...
func Watcher(ctx context.Context, cb func(string), globs ...string) error {

{'fraction_non_alphanumeric': 0.16365131578947367, 'fraction_numerical': 0.013980263157894737, 'mean_word_length': 3.5924528301886793, 'pattern_counts': {'":': 0, '<': 5, '<?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': '544979', 'n_tokens_mistral': 513, 'n_tokens_neox': 472, 'n_words': 97}