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.
This commit is contained in:
Fabio Manganiello 2022-12-08 12:28:36 +01:00
parent 00a918dd20
commit 5ba3fa1b5b
1 changed files with 2 additions and 4 deletions

View File

@ -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()),