<commit_before>package net.databinder.dispatch

import java.io.InputStream
import org.apache.http.HttpHost

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

object Doc extends Doc

class Database(host: HttpHost, name: String) extends HttpServer(host)  {
  def this(hostname: String, port: Int, name: String) = this(new HttpHost(hostname, port), name)
  def this(name: String) = this(new HttpHost("localhost", 5984), name)
  
  override def apply(uri: String) = new Request("/"  + name + "/" + uri)
  def all_docs = {
    for {
      Some(row) <- (this("_all_docs") >> { new Store(_) } )(Listing.rows).get
      id <- (new Store(row))(ListItem.id)
    } yield id
  }
  
  object ListItem extends Schema {
    val id = String('id)
  }
  object Listing extends Schema { 
    val rows = List[Map[Symbol, Option[Any]]]('rows)
  }
}

object Revise extends Schema {
  val id = String('id)
  val rev = String('rev)

  def update(stream: InputStream, source: Store) =
    (source << Doc._rev)(new Store(stream)(rev))
    
  def apply(source: Store) = new {
    def <<: (req: Http#Request) =
      (req <<< source.toString) >> (update(_, source))
  }
}<commit_msg>pattern extractor<commit_after>package net.databinder.dispatch

import java.io.InputStream
import org.apache.http.HttpHost

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

object Doc extends Doc

class Database(host: HttpHost, name: String) extends HttpServer(host)  {
  def this(hostname: String, port: Int, name: String) = this(new HttpHost(hostname, port), name)
  def this(name: String) = this(new HttpHost("localhost", 5984), name)
  
  override def apply(uri: String) = new Request("/"  + name + "/" + uri)
  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
  }
  
  object ListItem extends Schema {
    val id = String('id)
  }
  object Listing extends Schema { 
    val rows = List[Map[Symbol, Option[Any]]]('rows)
  }
}

object Revise extends Schema {
  val id = String('id)
  val rev = String('rev)

  def update(stream: InputStream, source: Store) =
    (source << Doc._rev)(new Store(stream)(rev))
    
  def apply(source: Store) = new {
    def <<: (req: Http#Request) =
      (req <<< source.toString) >> (update(_, source))
  }
}
{'fraction_non_alphanumeric': 0.15100533442757488, 'fraction_numerical': 0.003282724661469019, 'mean_word_length': 3.582706766917293, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 11, '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': '1793904', 'n_tokens_mistral': 830, 'n_tokens_neox': 816, 'n_words': 224}