Fix medium level bandit findings
Fix the rest of the medium level bandit findings. This allows enabling
more strict policy - when a new medium/high level warning appears, tests
will fail.
Additionally, fix new type flake8 issues.
Signed-off-by: Ondrej Nosek <onosek@redhat.com>