Refactor non-cli code out of cli.py in swh-scanner
Move non-cli code including imports out of cli module to scanner module.