<commit_before>#!/usr/bin/env python

from twisted.web import server, resource, static
from twisted.internet import reactor

#from xbee_reader import open_port

class Simple(resource.Resource):
    isLeaf = True
    def render_GET(self, request):
        return "<html>Hello, world!</html>"

def main(device='/dev/ttyUSB0', data_dir='/var/roost/data'):
  root = static.File('public') # FIXME This should be a parameter
  root.putChild('hello', Simple())
  reactor.listenTCP(8080, server.Site(root))
  #xbee_reader.open_port(device)
  reactor.run()

if __name__ == "__main__":
  main()
<commit_msg>Added arg parser to main.py<commit_after>#!/usr/bin/env python

from twisted.web import server, resource, static
from twisted.internet import reactor

#from xbee_reader import open_port

import sys, getopt

class Simple(resource.Resource):
    isLeaf = True
    def render_GET(self, request):
        return "<html>Hello, world!</html>"

def start_reactor(opts):
  web_dir = opts.get('--web-dir', '/var/roost/www')
  device = opts.get('--device', '/dev/ttyUSB0')
  print "Starting Roost"
  root = static.File(web_dir) 
  root.putChild('hello', Simple())
  reactor.listenTCP(8080, server.Site(root))
  #xbee_reader.open_port(device)
  reactor.run()

def main(argv=None):
  if argv is None:
    argv = sys.argv
  try:
    opts, args = getopt.getopt(argv[1:], "d:w:", ["device=", "web-dir="])
    return start_reactor(dict(opts));
  except getopt.error, msg:
    raise Exception(msg)
    print >>sys.stderr, err.msg
    print >>sys.stderr, "for help use --help"
    return 2

if __name__ == "__main__":
  sys.exit(main());

{'fraction_non_alphanumeric': 0.14842300556586271, 'fraction_numerical': 0.0074211502782931356, 'mean_word_length': 4.202572347266881, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '1721059', 'n_tokens_mistral': 567, 'n_tokens_neox': 556, 'n_words': 136}