forked from platypush/platypush
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:
parent
00a918dd20
commit
5ba3fa1b5b
1 changed files with 2 additions and 4 deletions
|
@ -412,10 +412,8 @@ def get_or_generate_jwt_rsa_key_pair():
|
||||||
pub_key_file = priv_key_file + '.pub'
|
pub_key_file = priv_key_file + '.pub'
|
||||||
|
|
||||||
if os.path.isfile(priv_key_file) and os.path.isfile(pub_key_file):
|
if os.path.isfile(priv_key_file) and os.path.isfile(pub_key_file):
|
||||||
with (
|
with open(pub_key_file, 'r') as f1, \
|
||||||
open(pub_key_file, 'r') as f1,
|
open(priv_key_file, 'r') as f2:
|
||||||
open(priv_key_file, 'r') as f2
|
|
||||||
):
|
|
||||||
return (
|
return (
|
||||||
rsa.PublicKey.load_pkcs1(f1.read().encode()),
|
rsa.PublicKey.load_pkcs1(f1.read().encode()),
|
||||||
rsa.PrivateKey.load_pkcs1(f2.read().encode()),
|
rsa.PrivateKey.load_pkcs1(f2.read().encode()),
|
||||||
|
|
Loading…
Reference in a new issue