Skip to content

Commit 490adef

Browse files
authored
docs: Add question tags to type descriptors in docstrings (#936)
* docs: remove question marks in docstrings * refactor: see if adding ? to both param and type works * Revert "refactor: see if adding ? to both param and type works" This reverts commit 0e8ae2e. * Revert "docs: remove question marks in docstrings" This reverts commit d466a57. * docs: add ? to optional parameter types
1 parent 97a713d commit 490adef

File tree

17 files changed

+295
-295
lines changed

17 files changed

+295
-295
lines changed

interactions/api/dispatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def register(self, coro: Callable[..., Coroutine], name: Optional[str] = None) -
5858
:param coro: The coroutine to register as an event.
5959
:type coro: Callable[..., Coroutine]
6060
:param name?: The name to associate the coroutine with. Defaults to None.
61-
:type name: Optional[str]
61+
:type name?: Optional[str]
6262
"""
6363
_name: str = coro.__name__ if name is None else name
6464
event = self.events.get(_name, [])

interactions/api/gateway/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def __init__(
103103
:param intents: The Gateway intents of the application for event dispatch.
104104
:type intents: Intents
105105
:param session_id?: The ID of the session if trying to reconnect. Defaults to ``None``.
106-
:type session_id: Optional[str]
106+
:type session_id?: Optional[str]
107107
:param sequence?: The identifier sequence if trying to reconnect. Defaults to ``None``.
108-
:type sequence: Optional[int]
108+
:type sequence?: Optional[int]
109109
"""
110110
try:
111111
self._loop = get_event_loop() if version_info < (3, 10) else get_running_loop()
@@ -169,7 +169,7 @@ async def _establish_connection(
169169
Establishes a client connection with the Gateway.
170170
171171
:param shard?: The shards to establish a connection with. Defaults to ``None``.
172-
:type shard: Optional[List[Tuple[int]]]
172+
:type shard?: Optional[List[Tuple[int]]]
173173
:param presence: The presence to carry with. Defaults to ``None``.
174174
:type presence: Optional[ClientPresence]
175175
"""
@@ -211,7 +211,7 @@ async def _handle_connection(
211211
:param stream: The packet stream to handle.
212212
:type stream: Dict[str, Any]
213213
:param shard?: The shards to establish a connection with. Defaults to ``None``.
214-
:type shard: Optional[List[Tuple[int]]]
214+
:type shard?: Optional[List[Tuple[int]]]
215215
:param presence: The presence to carry with. Defaults to ``None``.
216216
:type presence: Optional[ClientPresence]
217217
"""
@@ -662,9 +662,9 @@ async def __identify(
662662
Sends an ``IDENTIFY`` packet to the gateway.
663663
664664
:param shard?: The shard ID to identify under.
665-
:type shard: Optional[List[Tuple[int]]]
665+
:type shard?: Optional[List[Tuple[int]]]
666666
:param presence?: The presence to change the bot to on identify.
667-
:type presence: Optional[ClientPresence]
667+
:type presence?: Optional[ClientPresence]
668668
"""
669669
self.__shard = shard
670670
self.__presence = presence

interactions/api/http/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def request(self, route: Route, **kwargs) -> Optional[Any]:
9393
:param route: The HTTP route to request.
9494
:type route: Route
9595
:param \**kwargs?: Optional keyword-only arguments to pass as information in the request.
96-
:type \**kwargs: dict
96+
:type \**kwargs?: dict
9797
:return: The contents of the request if any.
9898
:rtype: Optional[Any]
9999
"""

interactions/api/http/route.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, method: str, path: str, **kwargs) -> None:
2828
:param path: The path of the HTTP/URL.
2929
:type path: str
3030
:param \**kwargs?: Optional keyword-only arguments to pass as information in the route.
31-
:type \**kwargs: dict
31+
:type \**kwargs?: dict
3232
"""
3333
self.method = method
3434
self.path = path.format(**kwargs)

interactions/api/models/channel.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -211,21 +211,21 @@ async def send(
211211
Sends a message in the channel.
212212
213213
:param content?: The contents of the message as a string or string-converted value.
214-
:type content: Optional[str]
214+
:type content?: Optional[str]
215215
:param tts?: Whether the message utilizes the text-to-speech Discord programme or not.
216-
:type tts: Optional[bool]
216+
:type tts?: Optional[bool]
217217
:param files?: A file or list of files to be attached to the message.
218-
:type files: Optional[Union[File, List[File]]]
218+
:type files?: Optional[Union[File, List[File]]]
219219
:param attachments?: The attachments to attach to the message. Needs to be uploaded to the CDN first
220-
:type attachments: Optional[List[Attachment]]
220+
:type attachments?: Optional[List[Attachment]]
221221
:param embeds?: An embed, or list of embeds for the message.
222-
:type embeds: Optional[Union[Embed, List[Embed]]]
222+
:type embeds?: Optional[Union[Embed, List[Embed]]]
223223
:param allowed_mentions?: The message interactions/mention limits that the message can refer to.
224-
:type allowed_mentions: Optional[MessageInteraction]
224+
:type allowed_mentions?: Optional[MessageInteraction]
225225
:param stickers?: A list of stickers to send with your message. You can send up to 3 stickers per message.
226-
:type stickers: Optional[List[Sticker]]
226+
:type stickers?: Optional[List[Sticker]]
227227
:param components?: A component, or list of components for the message.
228-
:type components: Optional[Union[ActionRow, Button, SelectMenu, List[Actionrow], List[Button], List[SelectMenu]]]
228+
:type components?: Optional[Union[ActionRow, Button, SelectMenu, List[Actionrow], List[Button], List[SelectMenu]]]
229229
:return: The sent message as an object.
230230
:rtype: Message
231231
"""
@@ -315,31 +315,31 @@ async def modify(
315315
The fields `archived`, `auto_archive_duration` and `locked` require the provided channel to be a thread.
316316
317317
:param name?: The name of the channel, defaults to the current value of the channel
318-
:type name: str
318+
:type name?: str
319319
:param topic?: The topic of that channel, defaults to the current value of the channel
320-
:type topic: Optional[str]
320+
:type topic?: Optional[str]
321321
:param bitrate?: (voice channel only) The bitrate (in bits) of the voice channel, defaults to the current value of the channel
322-
:type bitrate: Optional[int]
322+
:type bitrate?: Optional[int]
323323
:param user_limit?: (voice channel only) Maximum amount of users in the channel, defaults to the current value of the channel
324-
:type user_limit: Optional[int]
324+
:type user_limit?: Optional[int]
325325
:param rate_limit_per_use?: Amount of seconds a user has to wait before sending another message (0-21600), defaults to the current value of the channel
326326
:type rate_limit_per_user: Optional[int]
327327
:param position?: Sorting position of the channel, defaults to the current value of the channel
328-
:type position: Optional[int]
328+
:type position?: Optional[int]
329329
:param parent_id?: The id of the parent category for a channel, defaults to the current value of the channel
330-
:type parent_id: Optional[int]
330+
:type parent_id?: Optional[int]
331331
:param nsfw?: Whether the channel is nsfw or not, defaults to the current value of the channel
332-
:type nsfw: Optional[bool]
332+
:type nsfw?: Optional[bool]
333333
:param permission_overwrites?: The permission overwrites, if any
334-
:type permission_overwrites: Optional[List[Overwrite]]
334+
:type permission_overwrites?: Optional[List[Overwrite]]
335335
:param archived?: Whether the thread is archived
336-
:type archived: Optional[bool]
336+
:type archived?: Optional[bool]
337337
:param auto_archive_duration?: The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
338-
:type auto_archive_duration: Optional[int]
338+
:type auto_archive_duration?: Optional[int]
339339
:param locked?: Whether the thread is locked
340-
:type locked: Optional[bool]
340+
:type locked?: Optional[bool]
341341
:param reason?: The reason for the edit
342-
:type reason: Optional[str]
342+
:type reason?: Optional[str]
343343
:return: The modified channel as new object
344344
:rtype: Channel
345345
"""
@@ -415,7 +415,7 @@ async def set_name(
415415
:param name: The new name of the channel
416416
:type name: str
417417
:param reason?: The reason of the edit
418-
:type reason: Optional[str]
418+
:type reason?: Optional[str]
419419
:return: The edited channel
420420
:rtype: Channel
421421
"""
@@ -434,7 +434,7 @@ async def set_topic(
434434
:param topic: The new topic of the channel
435435
:type topic: str
436436
:param reason?: The reason of the edit
437-
:type reason: Optional[str]
437+
:type reason?: Optional[str]
438438
:return: The edited channel
439439
:rtype: Channel
440440
"""
@@ -453,7 +453,7 @@ async def set_bitrate(
453453
:param bitrate: The new bitrate of the channel
454454
:type bitrate: int
455455
:param reason?: The reason of the edit
456-
:type reason: Optional[str]
456+
:type reason?: Optional[str]
457457
:return: The edited channel
458458
:rtype: Channel
459459
"""
@@ -475,7 +475,7 @@ async def set_user_limit(
475475
:param user_limit: The new user limit of the channel
476476
:type user_limit: int
477477
:param reason?: The reason of the edit
478-
:type reason: Optional[str]
478+
:type reason?: Optional[str]
479479
:return: The edited channel
480480
:rtype: Channel
481481
"""
@@ -499,7 +499,7 @@ async def set_rate_limit_per_user(
499499
:param rate_limit_per_user: The new rate_limit_per_user of the channel (0-21600)
500500
:type rate_limit_per_user: int
501501
:param reason?: The reason of the edit
502-
:type reason: Optional[str]
502+
:type reason?: Optional[str]
503503
:return: The edited channel
504504
:rtype: Channel
505505
"""
@@ -518,7 +518,7 @@ async def set_position(
518518
:param position: The new position of the channel
519519
:type position: int
520520
:param reason?: The reason of the edit
521-
:type reason: Optional[str]
521+
:type reason?: Optional[str]
522522
:return: The edited channel
523523
:rtype: Channel
524524
"""
@@ -537,7 +537,7 @@ async def set_parent_id(
537537
:param parent_id: The new parent_id of the channel
538538
:type parent_id: int
539539
:param reason?: The reason of the edit
540-
:type reason: Optional[str]
540+
:type reason?: Optional[str]
541541
:return: The edited channel
542542
:rtype: Channel
543543
"""
@@ -556,7 +556,7 @@ async def set_nsfw(
556556
:param nsfw: The new nsfw-flag of the channel
557557
:type nsfw: bool
558558
:param reason?: The reason of the edit
559-
:type reason: Optional[str]
559+
:type reason?: Optional[str]
560560
:return: The edited channel
561561
:rtype: Channel
562562
"""
@@ -575,7 +575,7 @@ async def archive(
575575
:param archived: Whether the Thread is archived, defaults to True
576576
:type archived: bool
577577
:param reason?: The reason of the archiving
578-
:type reason: Optional[str]
578+
:type reason?: Optional[str]
579579
:return: The edited channel
580580
:rtype: Channel
581581
"""
@@ -594,7 +594,7 @@ async def set_auto_archive_duration(
594594
:param auto_archive_duration: The time after the thread is automatically archived. One of 60, 1440, 4320, 10080
595595
:type auto_archive_duration: int
596596
:param reason?: The reason of the edit
597-
:type reason: Optional[str]
597+
:type reason?: Optional[str]
598598
:return: The edited channel
599599
:rtype: Channel
600600
"""
@@ -613,7 +613,7 @@ async def lock(
613613
:param locked: Whether the Thread is locked, defaults to True
614614
:type locked: bool
615615
:param reason?: The reason of the edit
616-
:type reason: Optional[str]
616+
:type reason?: Optional[str]
617617
:return: The edited channel
618618
:rtype: Channel
619619
"""
@@ -779,13 +779,13 @@ def check_pinned(message):
779779
:param amount: The amount of messages to delete
780780
:type amount: int
781781
:param check?: The function used to check if a message should be deleted. The message is only deleted if the check returns `True`
782-
:type check: Callable[[Message], bool]
782+
:type check?: Callable[[Message], bool]
783783
:param before?: An id of a message to purge only messages before that message
784-
:type before: Optional[int]
784+
:type before?: Optional[int]
785785
:param bulk?: Whether to bulk delete the messages (you cannot delete messages older than 14 days, default) or to delete every message seperately
786786
:param bulk: Optional[bool]
787787
:param reason?: The reason of the deletes
788-
:type reason: Optional[str]
788+
:type reason?: Optional[str]
789789
:return: A list of the deleted messages
790790
:rtype: List[Message]
791791
"""
@@ -975,15 +975,15 @@ async def create_thread(
975975
:type name: str
976976
:param auto_archive_duration?: duration in minutes to automatically archive the thread after recent activity,
977977
can be set to: 60, 1440, 4320, 10080
978-
:type auto_archive_duration: Optional[int]
978+
:type auto_archive_duration?: Optional[int]
979979
:param type?: The type of thread, defaults to public. ignored if creating thread from a message
980-
:type type: Optional[ChannelType]
980+
:type type?: Optional[ChannelType]
981981
:param invitable?: Boolean to display if the Thread is open to join or private.
982-
:type invitable: Optional[bool]
982+
:type invitable?: Optional[bool]
983983
:param message_id?: An optional message to create a thread from.
984-
:type message_id: Optional[Union[int, Snowflake, "Message"]]
984+
:type message_id?: Optional[Union[int, Snowflake, "Message"]]
985985
:param reason?: An optional reason for the audit log
986-
:type reason: Optional[str]
986+
:type reason?: Optional[str]
987987
:return: The created thread
988988
:rtype: Channel
989989
"""
@@ -1037,21 +1037,21 @@ async def create_invite(
10371037
Creates an invite for the channel
10381038
10391039
:param max_age?: Duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days). Default 86400 (24h)
1040-
:type max_age: Optional[int]
1040+
:type max_age?: Optional[int]
10411041
:param max_uses?: Max number of uses or 0 for unlimited. between 0 and 100. Default 0
1042-
:type max_uses: Optional[int]
1042+
:type max_uses?: Optional[int]
10431043
:param temporary?: Whether this invite only grants temporary membership. Default False
1044-
:type temporary: Optional[bool]
1044+
:type temporary?: Optional[bool]
10451045
:param unique?: If true, don't try to reuse a similar invite (useful for creating many unique one time use invites). Default False
1046-
:type unique: Optional[bool]
1046+
:type unique?: Optional[bool]
10471047
:param target_type?: The type of target for this voice channel invite
1048-
:type target_type: Optional["InviteTargetType"]
1048+
:type target_type?: Optional["InviteTargetType"]
10491049
:param target_user_id?: The id of the user whose stream to display for this invite, required if target_type is STREAM, the user must be streaming in the channel
1050-
:type target_user_id: Optional[int]
1050+
:type target_user_id?: Optional[int]
10511051
:param target_application_id?: The id of the embedded application to open for this invite, required if target_type is EMBEDDED_APPLICATION, the application must have the EMBEDDED flag
1052-
:type target_application_id: Optional[int]
1052+
:type target_application_id?: Optional[int]
10531053
:param reason?: The reason for the creation of the invite
1054-
:type reason: Optional[str]
1054+
:type reason?: Optional[str]
10551055
"""
10561056

10571057
if not self._client:

0 commit comments

Comments
 (0)