Skip to content

Commit bab9359

Browse files
committed
Use a better way to document properties
1 parent f909e1e commit bab9359

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

compiler/docs/compiler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ def get_title_list(s: str) -> list:
417417

418418
f2.write(title + "\n" + "=" * len(title) + "\n\n")
419419
f2.write(".. autoclass:: pyrogram.types.{}()\n".format(type))
420-
f2.write(" :members:\n")
421420

422421
f.write(template.format(**fmt_keys))
423422

pyrogram/types/messages_and_media/message.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ class Message(Object, Update):
257257
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
258258
Additional interface options. An object for an inline keyboard, custom reply keyboard,
259259
instructions to remove reply keyboard or to force a reply from the user.
260+
261+
link (``str``, *property*):
262+
Generate a link to this message, only for groups and channels.
260263
"""
261264

262265
# TODO: Add game missing field. Also invoice, successful_payment, connected_website
@@ -672,7 +675,6 @@ async def _parse(
672675

673676
@property
674677
def link(self) -> str:
675-
"""Generate a link to this message, only for groups and channels."""
676678
if self.chat.type in ("group", "supergroup", "channel") and self.chat.username:
677679
return f"https://t.me/{self.chat.username}/{self.message_id}"
678680
else:
@@ -868,8 +870,8 @@ async def reply_animation(
868870
The total size of the file.
869871
870872
*args (``tuple``, *optional*):
871-
Extra custom arguments as defined in the *progress_args* parameter.
872-
You can either keep *\*args* or add every single extra argument in your function signature.
873+
Extra custom arguments as defined in the ``progress_args`` parameter.
874+
You can either keep ``*args`` or add every single extra argument in your function signature.
873875
874876
Returns:
875877
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -1011,8 +1013,8 @@ async def reply_audio(
10111013
The total size of the file.
10121014
10131015
*args (``tuple``, *optional*):
1014-
Extra custom arguments as defined in the *progress_args* parameter.
1015-
You can either keep *\*args* or add every single extra argument in your function signature.
1016+
Extra custom arguments as defined in the ``progress_args`` parameter.
1017+
You can either keep ``*args`` or add every single extra argument in your function signature.
10161018
10171019
Returns:
10181020
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -1355,8 +1357,8 @@ async def reply_document(
13551357
The total size of the file.
13561358
13571359
*args (``tuple``, *optional*):
1358-
Extra custom arguments as defined in the *progress_args* parameter.
1359-
You can either keep *\*args* or add every single extra argument in your function signature.
1360+
Extra custom arguments as defined in the ``progress_args`` parameter.
1361+
You can either keep ``*args`` or add every single extra argument in your function signature.
13601362
13611363
Returns:
13621364
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -1756,8 +1758,8 @@ async def reply_photo(
17561758
The total size of the file.
17571759
17581760
*args (``tuple``, *optional*):
1759-
Extra custom arguments as defined in the *progress_args* parameter.
1760-
You can either keep *\*args* or add every single extra argument in your function signature.
1761+
Extra custom arguments as defined in the ``progress_args`` parameter.
1762+
You can either keep ``*args`` or add every single extra argument in your function signature.
17611763
17621764
Returns:
17631765
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -1940,8 +1942,8 @@ async def reply_sticker(
19401942
The total size of the file.
19411943
19421944
*args (``tuple``, *optional*):
1943-
Extra custom arguments as defined in the *progress_args* parameter.
1944-
You can either keep *\*args* or add every single extra argument in your function signature.
1945+
Extra custom arguments as defined in the ``progress_args`` parameter.
1946+
You can either keep ``*args`` or add every single extra argument in your function signature.
19451947
19461948
Returns:
19471949
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -2179,8 +2181,8 @@ async def reply_video(
21792181
The total size of the file.
21802182
21812183
*args (``tuple``, *optional*):
2182-
Extra custom arguments as defined in the *progress_args* parameter.
2183-
You can either keep *\*args* or add every single extra argument in your function signature.
2184+
Extra custom arguments as defined in the ``progress_args`` parameter.
2185+
You can either keep ``*args`` or add every single extra argument in your function signature.
21842186
21852187
Returns:
21862188
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -2307,8 +2309,8 @@ async def reply_video_note(
23072309
The total size of the file.
23082310
23092311
*args (``tuple``, *optional*):
2310-
Extra custom arguments as defined in the *progress_args* parameter.
2311-
You can either keep *\*args* or add every single extra argument in your function signature.
2312+
Extra custom arguments as defined in the ``progress_args`` parameter.
2313+
You can either keep ``*args`` or add every single extra argument in your function signature.
23122314
23132315
Returns:
23142316
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -2432,8 +2434,8 @@ async def reply_voice(
24322434
The total size of the file.
24332435
24342436
*args (``tuple``, *optional*):
2435-
Extra custom arguments as defined in the *progress_args* parameter.
2436-
You can either keep *\*args* or add every single extra argument in your function signature.
2437+
Extra custom arguments as defined in the ``progress_args`` parameter.
2438+
You can either keep ``*args`` or add every single extra argument in your function signature.
24372439
24382440
Returns:
24392441
On success, the sent :obj:`~pyrogram.types.Message` is returned.
@@ -3052,8 +3054,8 @@ async def download(
30523054
The total size of the file.
30533055
30543056
*args (``tuple``, *optional*):
3055-
Extra custom arguments as defined in the *progress_args* parameter.
3056-
You can either keep *\*args* or add every single extra argument in your function signature.
3057+
Extra custom arguments as defined in the ``progress_args`` parameter.
3058+
You can either keep ``*args`` or add every single extra argument in your function signature.
30573059
30583060
Returns:
30593061
On success, the absolute path of the downloaded file as string is returned, None otherwise.

pyrogram/types/user_and_chats/user.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ class User(Object, Update):
138138
restrictions (List of :obj:`~pyrogram.types.Restriction`, *optional*):
139139
The list of reasons why this bot might be unavailable to some users.
140140
This field is available only in case *is_restricted* is True.
141+
142+
mention (``str``, *property*):
143+
Generate a text mention for this user.
144+
You can use ``user.mention()`` to mention the user using their first name (styled using html), or
145+
``user.mention("another name")`` for a custom name. To choose a different style
146+
("html" or "md"/"markdown") use ``user.mention(style="md")``.
141147
"""
142148

143149
def __init__(
@@ -192,11 +198,6 @@ def __init__(
192198

193199
@property
194200
def mention(self):
195-
"""Generate a text mention for this user.
196-
197-
You can use ``user.mention()`` to mention the user using their first name (styled using html), or
198-
``user.mention("another name")`` for a custom name. To choose a different style
199-
("html" or "md"/"markdown") use ``user.mention(style="md")``."""
200201
return Link(f"tg://user?id={self.id}", self.first_name, self._client.parse_mode)
201202

202203
@staticmethod

0 commit comments

Comments
 (0)