fix some pylint warnings
rewrite dict comprehension