Encoders inherit more from Encoder() class

refactors encoders to share more common fields and methods in parent `base.Encoder` class. 
Should simplify creation of a new encoder, and assertion tests share more common paths, so better testing (for tests :) )
I'd like to get this done before I start on reimplementation in c++ https://github.com/numenta/nupic.core/issues/62

fixes #544 
fixes #981 
fixes #947 

Put the condition in parentheses and remove backslashes (implicit continuations inside parens are preferred -- see PEP 8).