<commit_before>status_codes = {
  200: 'OK'
}

def webi_2_wsgi_status(status):
  '''

  given an integer status code used by webi, return wsgi compatible status code with description

  >>> webi_2_wsgi_status(200)
  '200 OK'
  '''
  return '%d %s' % (status, status_codes[status])

def wsgi(webi_app):
  ''' a wsgi adaptor for webi '''
  def wsgi_app(environ, start_response):
    status, headers, body = webi_app(environ)
    start_response(webi_2_wsgi_status(status), [(header, value) for header, value in headers.items()])
    return [chunk.encode() for chunk in body]
  return wsgi_app

if __name__ == '__main__':
  import doctest
  doctest.testmod()<commit_msg>fixed adaptor to write bytes<commit_after>status_codes = {
  200: 'OK'
}

def webi_2_wsgi_status(status):
  '''

  given an integer status code used by webi, return wsgi compatible status code with description

  >>> webi_2_wsgi_status(200)
  '200 OK'
  '''
  return '%d %s' % (status, status_codes[status])

def wsgi(webi_app):
  ''' webi to wsgi application adaptor '''
  def wsgi_app(environ, start_response):
    status, headers, body = webi_app(environ)
    start_response(webi_2_wsgi_status(status), [(header, value) for header, value in headers.items()])
    return [chunk.encode() for chunk in body]
  return wsgi_app

if __name__ == '__main__':
  import doctest
  doctest.testmod()
{'fraction_non_alphanumeric': 0.11946902654867257, 'fraction_numerical': 0.017699115044247787, 'mean_word_length': 4.630705394190872, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5595123', 'n_tokens_mistral': 508, 'n_tokens_neox': 475, 'n_words': 131}