<commit_before>package abkzeromq

import (
  "fmt"
  "strings"
  zmq "github.com/alecthomas/gozmq"
)

type READ func(key string) string
type PUSH func(key string, val string) bool
type DELETE func(key string) bool

func ZmqRep(req_port int, rep_port int, read READ, push PUSH, del DELETE) {
  context, _ := zmq.NewContext()
  socket, _ := context.NewSocket(zmq.REP)
  socket.Bind(fmt.Sprintf("tcp://127.0.0.1:%d", req_port))
  socket.Bind(fmt.Sprintf("tcp://127.0.0.1:%d", rep_port))

  fmt.Printf("ZMQ REQ/REP Daemon at port %d and %d\n", req_port, rep_port)
  for {
    msg, _ := socket.Recv(0)
    fmt.Println("Got:", string(msg))
    msg_arr := strings.Fields(string(msg))
    if msg_arr[0] == "read" {
      read(msg_arr[1])
    } else if msg_arr[0] == "push" {
      push(msg_arr[1], strings.Join(msg_arr[2:], " "))
    } else if msg_arr[0] == "delete" {
      del(msg_arr[1])
    } else {
      fmt.Println("unhandled request sent: %s" % msg)
    }
    socket.Send(msg, 0)
  }
}

func ZmqReq(req_port int, rep_port int, dat ...string) {
  fmt.Printf("ZMQ REQ/REP Client at port %d and %d\n", req_port, rep_port)
  context, _ := zmq.NewContext()
  socket, _ := context.NewSocket(zmq.REQ)
  socket.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", req_port))
  socket.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", rep_port))

  var msg string
  msg = strings.Join(dat, " ")
  socket.Send([]byte(msg), 0)
  fmt.Printf("msg: %s\n", msg)
  socket.Recv(0)
}
<commit_msg>zeromq/zeromq Printf required not Println<commit_after>package abkzeromq

import (
  "fmt"
  "strings"
  zmq "github.com/alecthomas/gozmq"
)

type READ func(key string) string
type PUSH func(key string, val string) bool
type DELETE func(key string) bool

func ZmqRep(req_port int, rep_port int, read READ, push PUSH, del DELETE) {
  context, _ := zmq.NewContext()
  socket, _ := context.NewSocket(zmq.REP)
  socket.Bind(fmt.Sprintf("tcp://127.0.0.1:%d", req_port))
  socket.Bind(fmt.Sprintf("tcp://127.0.0.1:%d", rep_port))

  fmt.Printf("ZMQ REQ/REP Daemon at port %d and %d\n", req_port, rep_port)
  for {
    msg, _ := socket.Recv(0)
    fmt.Println("Got:", string(msg))
    msg_arr := strings.Fields(string(msg))
    if msg_arr[0] == "read" {
      read(msg_arr[1])
    } else if msg_arr[0] == "push" {
      push(msg_arr[1], strings.Join(msg_arr[2:], " "))
    } else if msg_arr[0] == "delete" {
      del(msg_arr[1])
    } else {
      fmt.Printf("unhandled request sent: %s" % msg)
    }
    socket.Send(msg, 0)
  }
}

func ZmqReq(req_port int, rep_port int, dat ...string) {
  fmt.Printf("ZMQ REQ/REP Client at port %d and %d\n", req_port, rep_port)
  context, _ := zmq.NewContext()
  socket, _ := context.NewSocket(zmq.REQ)
  socket.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", req_port))
  socket.Connect(fmt.Sprintf("tcp://127.0.0.1:%d", rep_port))

  var msg string
  msg = strings.Join(dat, " ")
  socket.Send([]byte(msg), 0)
  fmt.Printf("msg: %s\n", msg)
  socket.Recv(0)
}

{'fraction_non_alphanumeric': 0.1803056027164686, 'fraction_numerical': 0.023769100169779286, 'mean_word_length': 3.588785046728972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '1826658', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1198, 'n_words': 242}