fitnr/wordfilter — pull request #1 by mambocab (2014-12-21 15:18:54+00:00)
Title: Python package

Hey there, @fitnr! I'm the person who owns the Python package you mention [here](https://github.com/dariusk/wordfilter/pull/6). Sorry for the confusion. Here's what happened: I started a Python port, worked with packaging stuff, tried putting the package up on the PyPI test server, then finally saw your PR and bowed out. Since that implementation is up on the test server, it could be taken down at any time.

I was hoping we could work together to get your implementation up on the PyPI production server. I humbly submit this pull request to your branch -- if it looks good to you, then you/we can reopen the PR on the main branch.

You can see the changes I've made in today's (12/21) commits. I've made the following changes:

- merged most recent changes from `master`
- used `any(word in string for word in self.blacklist)` for bad-word checking
- lazily lowercased the blacklist before bad-word checking (see [this bug in the Ruby implementation](https://github.com/dariusk/wordfilter/pull/7))
- made `add_words` "do the right thing" for arbitrary iterables, like `set()`s and generators
- made `add_words` "do the right thing" for strings
- aliased `blacklisted`, `add_words`, and `clear` to the top-level module. This makes things easier in the common case where you only need one blacklist -- the user doesn't have to instantiate a `Wordfilter`. See `test_module_instance` for usage

The end of the commit history gets messy; my apologies.

There are a couple problems:

- the `json` reader seems to be pointed at the wrong file. I've never successfully dealt with datafile management for packages, so I gave up on this one.
- I can't run the tests -- I can't import from the test. Curiously, I can import from the interactive interpreter.

Do you have any insight on these issues?