<commit_before>package net.databinder.dispatch

import java.io.InputStream
import java.net.URLEncoder.encode
import org.apache.http.HttpHost

trait Doc extends Schema {
  val _id = String(Symbol("_id")) 
  val _rev = String(Symbol("_rev"))
}

object Doc extends Doc

object Couch {
  def apply() = new Http("127.0.0.1", 5984)
}
  

case class Database(name: String) {
  def doc(http: Http)(id: String): Http#Request = http("/" + name + "/" + encode(id))
  def all_docs(http: Http) = {
    val Some(rows) = (doc(http)("_all_docs") >> { new Store(_) })(Listing.rows)
    for {
      Some(row) <- rows
      id <- (new Store(row))(ListItem.id)
    } yield id
  }
    
  object ListItem extends Schema {
    val id = String('id)
  }<commit_msg>http binding for database<commit_after>package net.databinder.dispatch

import java.io.InputStream
import java.net.URLEncoder.encode
import org.apache.http.HttpHost

trait Doc extends Schema {
  val _id = String(Symbol("_id")) 
  val _rev = String(Symbol("_rev"))
}

object Doc extends Doc

object Couch {
  def apply() = new Http("127.0.0.1", 5984)
}
  

case class Database(name: String) {
  class H(val http: Http) {
    def apply(id: String): Http#Request = http("/" + name + "/" + encode(id))
    def all_docs = {
      val Some(rows) = (this("_all_docs") >> { new Store(_) })(Listing.rows)
      for {
        Some(row) <- rows
        id <- (new Store(row))(ListItem.id)
      } yield id
    }
  }
  def apply(http: Http) = new H(http)
    
  object ListItem extends Schema {
    val id = String('id)
  }
{'fraction_non_alphanumeric': 0.15022566086395875, 'fraction_numerical': 0.012894906511927788, 'mean_word_length': 3.1945945945945944, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6648622', 'n_tokens_mistral': 559, 'n_tokens_neox': 541, 'n_words': 140}