rmalleman / eventboard-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

To install on a *nix system:

$ python setup.py install

If you have tox installed on your system you can use it to automate the creation of a virtualenv and run the unittests

$ tox 

This will create a python 3 virtualenv. You can activate it by running:

$ source .tox/py3/bin/activate

word-count.py

You can use this utility from the command line to either process a string or a file

$ word-count.py --string "lorem ipsum lorem"

should output

{'lorem': 2, 'ipsum': 1}

You can also process a text file using the file switch

meeting-times.py

To condense integer or unix timestamp meeting times

$ meeting-times.py --meeting 1,4 3,6 2,5  

for iso 3601 timestamps

$ meeting-times.py --string_meeting 2010-05-08T00:41:54.000000Z,2010-05-08T01:41:54.000000Z 2010-05-08T02:41:54.000000Z,2010-05-08T05:41:54.000000Z  

For either of these utilities you can get the help menu by using the --help switch

Tests

All unit tests are in meeting_times_test.py and wordcount_test.py

Additional Notes

Initially I tried to parallelize word count using the multiprocessing module but I wasn't getting any performance gains, even on large files. I suspect this is due to how expensive it is to aggregate the results. The only pep8 rule I didn't adhere to is the 79 character line length.

About


Languages

Language:Python 100.0%