Fix minor code duplicated warning in pylint