Skip to content

Commit 55faee6

Browse files
committed
Docstring fixes
1 parent c2d9d61 commit 55faee6

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

telegram/passport/credentials.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ def decrypt(secret, hash, data, file=False):
5555
b64decode it.
5656
5757
Raises:
58-
:class:`TelegramDecryptionError`: Raised if the given hash does not match the hash of
59-
decrypted data
58+
:class:`TelegramDecryptionError`: Given hash does not match hash of decrypted data.
6059
6160
Returns:
62-
:obj:`bytes`: The decrypted data as bytes
61+
:obj:`bytes`: The decrypted data as bytes.
6362
6463
"""
6564
# First make sure that if secret, hash, or data was base64 encoded, to decode it into bytes
@@ -153,12 +152,11 @@ def de_json(cls, data, bot):
153152
@property
154153
def decrypted_secret(self):
155154
"""
156-
:obj:`str`: The secret as decrypted using the bot's private key.
155+
:obj:`str`: Lazily decrypt and return secret.
157156
158157
Raises:
159-
telegram.TelegramDecryptionError: If a decryption error happened while attempting
160-
to decrypt the data. This is most often a wrong/missing private_key, but will
161-
also happen in cases of tampered data.
158+
telegram.TelegramDecryptionError: Decryption failed. Usually due to bad
159+
private/public key but can also suggest malformed/tampered data.
162160
"""
163161
if not self._decrypted_secret:
164162
# Try decrypting according to step 1 at
@@ -181,14 +179,13 @@ def decrypted_secret(self):
181179
@property
182180
def decrypted_data(self):
183181
"""
184-
:class:`telegram.Credentials`: Decrypted credentials that were used to decrypt
185-
the data. This object also contains the user specified payload as
186-
`decrypted_data.payload`.
182+
:class:`telegram.Credentials`: Lazily decrypt and return credentials data. This object
183+
also contains the user specified payload as
184+
`decrypted_data.payload`.
187185
188186
Raises:
189-
telegram.TelegramDecryptionError: If a decryption error happened while attempting
190-
to decrypt the data. This is most often a wrong/missing private_key, but will
191-
also happen in cases of tampered data.
187+
telegram.TelegramDecryptionError: Decryption failed. Usually due to bad
188+
private/public key but can also suggest malformed/tampered data.
192189
"""
193190
if not self._decrypted_data:
194191
self._decrypted_data = Credentials.de_json(decrypt_json(self.decrypted_secret,

telegram/passport/passportdata.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,12 @@ def to_dict(self):
7575
@property
7676
def decrypted_data(self):
7777
"""
78-
List[:class:`telegram.EncryptedPassportElement`]: Decrypted array with information about
79-
documents and other Telegram Passport elements that was shared with the bot. This means
80-
that despite its name, :class:`telegram.EncryptedPassportElement`, will in fact be
81-
decrypted.
78+
List[:class:`telegram.EncryptedPassportElement`]: Lazily decrypt and return information
79+
about documents and other Telegram Passport elements which were shared with the bot.
8280
8381
Raises:
84-
telegram.TelegramDecryptionError: If a decryption error happened while attempting
85-
to decrypt the data. This is most often a wrong/missing private_key, but will
86-
also happen in cases of tampered data.
82+
telegram.TelegramDecryptionError: Decryption failed. Usually due to bad
83+
private/public key but can also suggest malformed/tampered data.
8784
"""
8885
if not self._decrypted_data:
8986
self._decrypted_data = [
@@ -98,13 +95,12 @@ def decrypted_data(self):
9895
@property
9996
def decrypted_credentials(self):
10097
"""
101-
:class:`telegram.Credentials`: Decrypted credentials that were used to decrypt
102-
the data. This object also contains the user specified payload as
103-
`decrypted_data.payload`.
98+
:class:`telegram.Credentials`: Lazily decrypt and return credentials that were used
99+
to decrypt the data. This object also contains the user specified payload as
100+
`decrypted_data.payload`.
104101
105102
Raises:
106-
telegram.TelegramDecryptionError: If a decryption error happened while attempting
107-
to decrypt the data. This is most often a wrong/missing private_key, but will
108-
also happen in cases of tampered data.
103+
telegram.TelegramDecryptionError: Decryption failed. Usually due to bad
104+
private/public key but can also suggest malformed/tampered data.
109105
"""
110106
return self.credentials.decrypted_data

0 commit comments

Comments
 (0)