From 86a3d958551ff4d170cf70c7dd85db1b2d6ebd01 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Fri, 13 May 2022 11:39:44 +0100 Subject: [PATCH] Fix type hints on the PkDecryption class --- .gitignore | 5 ++++- python/olm/pk.py | 6 +++--- python/olm/py.typed | 0 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 python/olm/py.typed diff --git a/.gitignore b/.gitignore index 1d25d98..1a6040b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,7 @@ xcuserdata/ *.dSYM.zip *.dSYM Pods/ -*.xcworkspace \ No newline at end of file +*.xcworkspace + +# JetBrains tools +.idea/ diff --git a/python/olm/pk.py b/python/olm/pk.py index 4352359..060d1f1 100644 --- a/python/olm/pk.py +++ b/python/olm/pk.py @@ -217,7 +217,7 @@ class PkDecryption(object): random_buffer, random_length ) 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_length )) @@ -267,7 +267,7 @@ class PkDecryption(object): @classmethod def from_pickle(cls, pickle, passphrase=""): - # types: (bytes, str) -> PkDecryption + # type: (bytes, str) -> PkDecryption """Restore a previously stored PkDecryption object. Creates a PkDecryption object from a pickled base64 string. Decrypts @@ -314,7 +314,7 @@ class PkDecryption(object): return obj def decrypt(self, message, unicode_errors="replace"): - # type (PkMessage, str) -> str + # type: (PkMessage, str) -> str """Decrypt a previously encrypted Pk message. Returns the decrypted plaintext. diff --git a/python/olm/py.typed b/python/olm/py.typed new file mode 100644 index 0000000..e69de29