add check_file util and update for flake8