diff --git a/poetry.lock b/poetry.lock index aa067a591..650182fd9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1177,13 +1177,13 @@ dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", [[package]] name = "flake8-comprehensions" -version = "3.10.1" +version = "3.14.0" description = "A flake8 plugin to help you write better list/set/dict comprehensions." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "flake8-comprehensions-3.10.1.tar.gz", hash = "sha256:412052ac4a947f36b891143430fef4859705af11b2572fbb689f90d372cf26ab"}, - {file = "flake8_comprehensions-3.10.1-py3-none-any.whl", hash = "sha256:d763de3c74bc18a79c039a7ec732e0a1985b0c79309ceb51e56401ad0a2cd44e"}, + {file = "flake8_comprehensions-3.14.0-py3-none-any.whl", hash = "sha256:7b9d07d94aa88e62099a6d1931ddf16c344d4157deedf90fe0d8ee2846f30e97"}, + {file = "flake8_comprehensions-3.14.0.tar.gz", hash = "sha256:81768c61bfc064e1a06222df08a2580d97de10cb388694becaf987c331c6c0cf"}, ] [package.dependencies] diff --git a/runway/utils/__init__.py b/runway/utils/__init__.py index 76991568b..bab7b6dcb 100644 --- a/runway/utils/__init__.py +++ b/runway/utils/__init__.py @@ -378,8 +378,9 @@ def __init__( self.__os_environ = dict(os.environ) self.__sys_argv = list(sys.argv) # deepcopy can't pickle sys.modules and dict()/.copy() are not safe - # pylint: disable=unnecessary-comprehension - self.__sys_modules = {k: v for k, v in sys.modules.items()} + self.__sys_modules = {} + for k, v in sys.modules.items(): + self.__sys_modules[k] = v self.__sys_path = list(sys.path) # more informative origin for log statements self.logger = logging.getLogger("runway." + self.__class__.__name__) diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 53aa384fa..0da12cc44 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -247,8 +247,9 @@ def test_sys_modules( caplog.set_level(logging.DEBUG, "runway.SafeHaven") monkeypatch.setattr(SafeHaven, "reset_all", MagicMock()) - # pylint: disable=unnecessary-comprehension - orig_val = {k: v for k, v in sys.modules.items()} + orig_val = {} + for k, v in sys.modules.items(): + orig_val[k] = v expected_logs = ["entering a safe haven...", "resetting sys.modules..."] with SafeHaven() as obj: