diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-01-12 21:17:00 -0500 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-01-12 21:44:59 -0500 |
commit | d04966dcec2f8e34f0ec0aea216ea098673ae90b (patch) | |
tree | e203bcda882e2b90124e209db4ffa0d5c990a516 /paramiko | |
parent | 714350c4dd459577898d72a59edc3213a99443d6 (diff) | |
download | paramiko-d04966dcec2f8e34f0ec0aea216ea098673ae90b.tar.gz |
Swap around __bytes__/__str__ for some classes
Plus related updates to tests, docstrings, changelog
Diffstat (limited to 'paramiko')
-rw-r--r-- | paramiko/message.py | 5 | ||||
-rw-r--r-- | paramiko/pkey.py | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/paramiko/message.py b/paramiko/message.py index d02f7855..cdefe4f8 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -54,10 +54,7 @@ class Message(object): else: self.packet = BytesIO() - def __str__(self): - """ - Return the byte stream content of this message, as a string/bytes obj. - """ + def __bytes__(self): return self.asbytes() def __repr__(self): diff --git a/paramiko/pkey.py b/paramiko/pkey.py index 058d1258..d5ea27b6 100644 --- a/paramiko/pkey.py +++ b/paramiko/pkey.py @@ -110,6 +110,7 @@ class PKey(object): """ pass + # TODO 4.0: just merge into __bytes__ (everywhere) def asbytes(self): """ Return a string of an SSH `.Message` made up of the public part(s) of @@ -118,7 +119,7 @@ class PKey(object): """ return bytes() - def __str__(self): + def __bytes__(self): return self.asbytes() # noinspection PyUnresolvedReferences |