From 5ba3fa1b5be69ddd27cad6540c57f0fcfd3a9722 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 8 Dec 2022 12:28:36 +0100 Subject: [PATCH] FIX: Parenthesized context managers are only available in Python >= 3.10 Since Parenthesized context managers are only supported on very recent versions of Python (thanks black for breaking back-compatibility), we should still use the old multiline syntax - it's not worth breaking compatibility with Python >= 3.6 and < 3.10 just to avoid typing a backslash. --- platypush/utils/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platypush/utils/__init__.py b/platypush/utils/__init__.py index efd13f17d8..1414587e3e 100644 --- a/platypush/utils/__init__.py +++ b/platypush/utils/__init__.py @@ -412,10 +412,8 @@ def get_or_generate_jwt_rsa_key_pair(): pub_key_file = priv_key_file + '.pub' if os.path.isfile(priv_key_file) and os.path.isfile(pub_key_file): - with ( - open(pub_key_file, 'r') as f1, - open(priv_key_file, 'r') as f2 - ): + with open(pub_key_file, 'r') as f1, \ + open(priv_key_file, 'r') as f2: return ( rsa.PublicKey.load_pkcs1(f1.read().encode()), rsa.PrivateKey.load_pkcs1(f2.read().encode()),