Replace memoize with threading where applicable

NOTE: Documentation now gets attached to *classes*, not actual segments. Hiding
      away classes (by changing their names to start with `_`) and/or doing

          self.__doc__ = self.__class__.__doc__

      does not work (hiding classes only hides documentation completely). I am
      not familiar with sphinx enough to say how this should be fixed.

Ref #168
Some fixes for flake8
Avoid using python setup.py test

Closes #295
Avoid ResourceWarning messages: close stdout