Simplify class searching algorithm

New classes can't be found during call to _resolve_bases(cls)
if FOLLOW_IMPORTS=True, so we don't have to add them to candidates, thus
decreasing complexity from N^2 * k to N * (N + k)
Add several small fixes and cleanups in core module

Open file to write report in text mode (and thus use default encoding of
sys.stdout). Not sure about this, maybe its better to specify encode
report explicitly.

Add check of with_arguments parameter when reading as_dict() result in
format_text().

Calculate inference time without utils.timed() to respect --quiet option.