<commit_before>package main

import (
	"encoding/json"
	"flag"
	"log"
	"net"
	"path/filepath"
	"strings"
	"time"

	etcdErr "github.com/coreos/etcd/error"
	"github.com/coreos/go-etcd/etcd"
	"github.com/miekg/dns"
)

type (
	Server struct {
		etcd   *etcd.Client
		domain string
		prefix string
		ttl    uint32
	}

	Record struct {
		Priority uint16 `json:"priority"`
		Weight   uint16 `json:weight"`
		Port     uint16 `json:"port"`
		Target   string `json:"target"`
	}

	Node struct {
		IP net.IP `json:"ip"`
	}
)

func IsKeyNotFound(err error) bool {
	e, ok := err.(*etcd.EtcdError)
	return ok && e.ErrorCode == etcdErr.EcodeKeyNotFound
}

func NameError(w dns.ResponseWriter, req *dns.Msg) {
	m := new(dns.Msg)
	m.SetReply(req)
	m.SetRcode(req, dns.RcodeNameError)
	w.WriteMsg(m)
}

func (s *Server) GetNode(name string) (*Node, error) {
	name = strings.TrimSuffix(name, ".nodes.")
	key := filepath.Join("/", s.prefix, "nodes", name)

	resp, err := s.etcd.Get(key, false, false)

	if err != nil {
		return nil, err
	}<commit_msg>properly quote json fields<commit_after>package main

import (
	"encoding/json"
	"flag"
	"log"
	"net"
	"path/filepath"
	"strings"
	"time"

	etcdErr "github.com/coreos/etcd/error"
	"github.com/coreos/go-etcd/etcd"
	"github.com/miekg/dns"
)

type (
	Server struct {
		etcd   *etcd.Client
		domain string
		prefix string
		ttl    uint32
	}

	Record struct {
		Priority uint16 `json:"priority"`
		Weight   uint16 `json:"weight"`
		Port     uint16 `json:"port"`
		Target   string `json:"target"`
	}

	Node struct {
		IP net.IP `json:"ip"`
	}
)

func IsKeyNotFound(err error) bool {
	e, ok := err.(*etcd.EtcdError)
	return ok && e.ErrorCode == etcdErr.EcodeKeyNotFound
}

func NameError(w dns.ResponseWriter, req *dns.Msg) {
	m := new(dns.Msg)
	m.SetReply(req)
	m.SetRcode(req, dns.RcodeNameError)
	w.WriteMsg(m)
}

func (s *Server) GetNode(name string) (*Node, error) {
	name = strings.TrimSuffix(name, ".nodes.")
	key := filepath.Join("/", s.prefix, "nodes", name)

	resp, err := s.etcd.Get(key, false, false)

	if err != nil {
		return nil, err
	}
{'fraction_non_alphanumeric': 0.15766634522661524, 'fraction_numerical': 0.007714561234329798, 'mean_word_length': 3.6524663677130045, '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': '541689', 'n_tokens_mistral': 888, 'n_tokens_neox': 843, 'n_words': 187}