From f0fe747258abd9fc3ce471cdcf55ece7424298ef Mon Sep 17 00:00:00 2001 From: Andrey Maksimov Date: Wed, 25 Sep 2019 01:56:36 +0300 Subject: [PATCH] Fix reading from closed stdin --- flake8_bandit.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flake8_bandit.py b/flake8_bandit.py index e76d534..7f4a88c 100644 --- a/flake8_bandit.py +++ b/flake8_bandit.py @@ -15,8 +15,13 @@ except ImportError: import ConfigParser as configparser +try: + from flake8.engine import pep8 as stdin_utils +except ImportError: + from flake8 import utils as stdin_utils + -__version__ = "2.1.1" +__version__ = "2.1.2" class BanditTester(object): @@ -90,7 +95,7 @@ def _load_source(self): if self.filename in ("stdin", "-", None): self.filename = "stdin" - self.lines = pycodestyle.stdin_get_value().splitlines(True) + self.lines = stdin_utils.stdin_get_value().splitlines(True) else: self.lines = pycodestyle.readlines(self.filename) if not self.tree: