Fix import check interaction with namespace modules

When running hacking from an oslo.* lib, all other oslo.* libs get
categorized as project because the import check was only looking at
the base module.  So when running in oslo.db, oslo.db should be
categorized as project and oslo.config as third-party, but both were
being seen as project because _get_import_type was only looking at
the 'oslo' part of the import.

This change extends _get_import_type to look at the entire module
path and adds the necessary logic for handling namespace modules
and non-module imports.  Since this is fairly complex and can't be
tested with doctests, standalone test cases are also added to verify
the behavior of the new code.

Note that prior to this change, oslo.db had 5 apparent H305
violations and 3 H307, which was incorrect.  After this change,
hacking correctly reports 3 H305 violations and 1 H307.

Also, because some of the stdlib modules don't play nice with the
new lookup method, this also includes a static list of stdlib
modules that will also be used for py2/3 compatibility in a
followup commit.

Change-Id: Ibb8c982bafcd69c9d642e86aa357a3a11b4395af
Merge "Fix import check interaction with namespace modules"