Fix type hints on the PkDecryption class

This commit is contained in:
Brendan Abolivier 2022-05-13 11:39:44 +01:00
parent 81f5c4a3cd
commit 86a3d95855
3 changed files with 7 additions and 4 deletions

5
.gitignore vendored
View file

@ -37,4 +37,7 @@ xcuserdata/
*.dSYM.zip *.dSYM.zip
*.dSYM *.dSYM
Pods/ Pods/
*.xcworkspace *.xcworkspace
# JetBrains tools
.idea/

View file

@ -217,7 +217,7 @@ class PkDecryption(object):
random_buffer, random_length random_buffer, random_length
) )
self._check_error(ret) self._check_error(ret)
self.public_key = bytes_to_native_str(ffi.unpack( self.public_key: str = bytes_to_native_str(ffi.unpack(
key_buffer, key_buffer,
key_length key_length
)) ))
@ -267,7 +267,7 @@ class PkDecryption(object):
@classmethod @classmethod
def from_pickle(cls, pickle, passphrase=""): def from_pickle(cls, pickle, passphrase=""):
# types: (bytes, str) -> PkDecryption # type: (bytes, str) -> PkDecryption
"""Restore a previously stored PkDecryption object. """Restore a previously stored PkDecryption object.
Creates a PkDecryption object from a pickled base64 string. Decrypts Creates a PkDecryption object from a pickled base64 string. Decrypts
@ -314,7 +314,7 @@ class PkDecryption(object):
return obj return obj
def decrypt(self, message, unicode_errors="replace"): def decrypt(self, message, unicode_errors="replace"):
# type (PkMessage, str) -> str # type: (PkMessage, str) -> str
"""Decrypt a previously encrypted Pk message. """Decrypt a previously encrypted Pk message.
Returns the decrypted plaintext. Returns the decrypted plaintext.

0
python/olm/py.typed Normal file
View file