<commit_before>package main

import (
	"fmt"
	"github.com/codegangsta/cli"
	"github.com/keybase/go-libcmdline"
	"github.com/keybase/go-libkb"
	"github.com/keybase/protocol/go"
	"github.com/maxtaco/go-framed-msgpack-rpc/rpc2"
	"net"
	"os"
)

// Keep this around to simplify things
var G = &libkb.G

type Daemon struct {
}

func RegisterProtocols(srv *rpc2.Server, xp *rpc2.Transport) {
	srv.Register(keybase_1.SignupProtocol(SignupHandler{xp}))
	srv.Register(keybase_1.ConfigProtocol(ConfigHandler{xp}))
	srv.Register(keybase_1.LoginProtocol(NewLoginHandler(xp)))
	srv.Register(keybase_1.IdentifyProtocol(NewIdentifyHandler(xp)))
	srv.Register(keybase_1.ProveProtocol(NewProveHandler(xp)))
	srv.Register(keybase_1.MykeyProtocol(NewMykeyHandler(xp)))
}

func (d *Daemon) Handle(c net.Conn) {
	xp := rpc2.NewTransport(c, libkb.NewRpcLogFactory())
	server := rpc2.NewServer(xp, libkb.WrapError)
	RegisterProtocols(server, xp)
	server.Run(true)
}

func (d *Daemon) RunClient() (err error) {
	return fmt.Errorf("can't run daemon in client mode")
}

func (d *Daemon) Run() (err error) {
	G.Daemon = true
	if err = d.ConfigRpcServer(); err != nil {
		return
	}
	if err = d.ListenLoop(); err != nil {<commit_msg>New rpc2 interface needs a WrapError func for protocolNotFound errors<commit_after>package main

import (
	"fmt"
	"github.com/codegangsta/cli"
	"github.com/keybase/go-libcmdline"
	"github.com/keybase/go-libkb"
	"github.com/keybase/protocol/go"
	"github.com/maxtaco/go-framed-msgpack-rpc/rpc2"
	"net"
	"os"
)

// Keep this around to simplify things
var G = &libkb.G

type Daemon struct {
}

func RegisterProtocols(srv *rpc2.Server, xp *rpc2.Transport) {
	srv.Register(keybase_1.SignupProtocol(SignupHandler{xp}))
	srv.Register(keybase_1.ConfigProtocol(ConfigHandler{xp}))
	srv.Register(keybase_1.LoginProtocol(NewLoginHandler(xp)))
	srv.Register(keybase_1.IdentifyProtocol(NewIdentifyHandler(xp)))
	srv.Register(keybase_1.ProveProtocol(NewProveHandler(xp)))
	srv.Register(keybase_1.MykeyProtocol(NewMykeyHandler(xp)))
}

func (d *Daemon) Handle(c net.Conn) {
	xp := rpc2.NewTransport(c, libkb.NewRpcLogFactory(), libkb.WrapError)
	server := rpc2.NewServer(xp, libkb.WrapError)
	RegisterProtocols(server, xp)
	server.Run(true)
}

func (d *Daemon) RunClient() (err error) {
	return fmt.Errorf("can't run daemon in client mode")
}

func (d *Daemon) Run() (err error) {
	G.Daemon = true
	if err = d.ConfigRpcServer(); err != nil {
		return
	}
	if err = d.ListenLoop(); err != nil {
{'fraction_non_alphanumeric': 0.14521984671238403, 'fraction_numerical': 0.00927793465106898, 'mean_word_length': 5.560846560846561, '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': '6352969', 'n_tokens_mistral': 971, 'n_tokens_neox': 964, 'n_words': 170}