How do I get pylint to ignore unused-import for a single module, globally?
Asked Answered
Y

0

8

I use the typing module. I'd like to always use the code from typing import List, Set, Dict, Tuple, Optional without stopping to edit that line to reference only the types used in the current module.

But pylint complains "Usused foo imported from typing" for any types not used in this module. I get around that by using from typing import List, Set, Dict, Tuple, Optional # pylint: disable=unused-import.

Instead of appending # pylint: disable=unused-import EVERY time I import typing, is there a rule I can put in .pylintrc which means "disable unused-import, ONLY when I'm importing typing"?

I don't want to totally disable unused-import. I just want to disable it when importing from typing.

Yuhas answered 2/7, 2020 at 22:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.