Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:Ardana:8:CentOS
python-paramiko
0001-Use-args-not-kwargs-to-retain-py2-compat-f...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Use-args-not-kwargs-to-retain-py2-compat-for-now.patch of Package python-paramiko
From 876bb70316b9964727ba8d8e930c9965dec9edc3 Mon Sep 17 00:00:00 2001 From: Jeff Forcier <jeff@bitprophet.org> Date: Mon, 14 Mar 2022 19:21:01 -0400 Subject: [PATCH] Use args, not kwargs, to retain py2 compat for now --- paramiko/pkey.py | 5 +++-- tests/test_pkey.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/paramiko/pkey.py b/paramiko/pkey.py index b9969e23..db947b64 100644 --- a/paramiko/pkey.py +++ b/paramiko/pkey.py @@ -357,9 +357,10 @@ class PKey(object): # existing files, so using all 3 in both cases is fine. Ditto the use # of the 'mode' argument; it should be safe to give even for existing # files (though it will not act like a chmod in that case). - kwargs = dict(flags=os.O_WRONLY | os.O_TRUNC | os.O_CREAT, mode=o600) + # TODO 3.0: turn into kwargs again + args = [os.O_WRONLY | os.O_TRUNC | os.O_CREAT, o600] # NOTE: yea, you still gotta inform the FLO that it is in "write" mode - with os.fdopen(os.open(filename, **kwargs), mode="w") as f: + with os.fdopen(os.open(filename, *args), "w") as f: # TODO 3.0: remove the now redundant chmod os.chmod(filename, o600) self._write_private_key(f, key, format, password=password) diff --git a/tests/test_pkey.py b/tests/test_pkey.py index e178d0d7..99edaac2 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -525,8 +525,10 @@ class KeyTest(unittest.TestCase): # Write out in new location key.write_private_key_file(new, password=newpassword) # Expected open via os module - os_.open.assert_called_once_with(new, flags=os.O_WRONLY | os.O_CREAT | os.O_TRUNC, mode=o600) - os_.fdopen.assert_called_once_with(os_.open.return_value, mode="w") + os_.open.assert_called_once_with( + new, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, o600 + ) + os_.fdopen.assert_called_once_with(os_.open.return_value, "w") # Old chmod still around for backwards compat os_.chmod.assert_called_once_with(new, o600) assert ( -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor