@@ -175,14 +175,6 @@ async def _purge_messages_helper(
175
175
return ret
176
176
177
177
178
- class _Undefined :
179
- def __repr__ (self ) -> str :
180
- return "see-below"
181
-
182
-
183
- _undefined : Any = _Undefined ()
184
-
185
-
186
178
@runtime_checkable
187
179
class Snowflake (Protocol ):
188
180
"""An ABC that details the common operations on a Discord model.
@@ -382,7 +374,7 @@ async def _move(
382
374
payload = []
383
375
for index , c in enumerate (channels ):
384
376
d : Dict [str , Any ] = {"id" : c .id , "position" : index }
385
- if parent_id is not _undefined and c .id == self .id :
377
+ if parent_id is not MISSING and c .id == self .id :
386
378
d .update (parent_id = parent_id , lock_permissions = lock_permissions )
387
379
payload .append (d )
388
380
@@ -392,7 +384,7 @@ async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optiona
392
384
try :
393
385
parent = options .pop ("category" )
394
386
except KeyError :
395
- parent_id = _undefined
387
+ parent_id = MISSING
396
388
else :
397
389
parent_id = parent and parent .id
398
390
@@ -420,7 +412,7 @@ async def _edit(self, options: Dict[str, Any], reason: Optional[str]) -> Optiona
420
412
try :
421
413
position = options .pop ("position" )
422
414
except KeyError :
423
- if parent_id is not _undefined :
415
+ if parent_id is not MISSING :
424
416
if lock_permissions :
425
417
category = self .guild .get_channel (parent_id )
426
418
if category :
@@ -603,7 +595,7 @@ def category(self) -> Optional[CategoryChannel]:
603
595
604
596
@property
605
597
def permissions_synced (self ) -> bool :
606
- """:class:`bool`: Whether or not the permissions for this channel are synced with the
598
+ """:class:`bool`: Whether the permissions for this channel are synced with the
607
599
category it belongs to.
608
600
609
601
If there is no category then this is ``False``.
@@ -658,7 +650,7 @@ def permissions_for(self, obj: Union[Member, Role], /) -> Permissions:
658
650
# (or otherwise) are then OR'd together.
659
651
# After the role permissions are resolved, the member permissions
660
652
# have to take into effect.
661
- # After all that is done.. you have to do the following:
653
+ # After all that is done, you have to do the following:
662
654
663
655
# If manage permissions is True, then all permissions are set to True.
664
656
@@ -781,7 +773,7 @@ async def set_permissions(
781
773
self ,
782
774
target : Union [Member , Role ],
783
775
* ,
784
- overwrite : Optional [Union [ PermissionOverwrite , _Undefined ] ] = ...,
776
+ overwrite : Optional [PermissionOverwrite ] = ...,
785
777
reason : Optional [str ] = ...,
786
778
) -> None :
787
779
...
@@ -796,7 +788,7 @@ async def set_permissions(
796
788
) -> None :
797
789
...
798
790
799
- async def set_permissions (self , target , * , overwrite = _undefined , reason = None , ** permissions ):
791
+ async def set_permissions (self , target , * , overwrite = MISSING , reason = None , ** permissions ):
800
792
r"""|coro|
801
793
802
794
Sets the channel specific permission overwrites for a target in the
@@ -874,7 +866,7 @@ async def set_permissions(self, target, *, overwrite=_undefined, reason=None, **
874
866
else :
875
867
raise InvalidArgument ("target parameter must be either Member or Role" )
876
868
877
- if overwrite is _undefined :
869
+ if overwrite is MISSING :
878
870
if len (permissions ) == 0 :
879
871
raise InvalidArgument ("No overwrite provided." )
880
872
try :
@@ -1046,7 +1038,7 @@ async def move(self, **kwargs) -> None:
1046
1038
Raises
1047
1039
-------
1048
1040
InvalidArgument
1049
- An invalid position was given or a bad mix of arguments were passed.
1041
+ An invalid position was given or a bad mix of arguments was passed.
1050
1042
Forbidden
1051
1043
You do not have permissions to move the channel.
1052
1044
HTTPException
@@ -1152,20 +1144,22 @@ async def create_invite(
1152
1144
.. versionadded:: 2.0
1153
1145
1154
1146
target_user: Optional[:class:`User`]
1155
- The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`. The user must be streaming in the channel.
1147
+ The user whose stream to display for this invite, required if `target_type` is `TargetType.stream`.
1148
+ The user must be streaming in the channel.
1156
1149
1157
1150
.. versionadded:: 2.0
1158
1151
1159
1152
target_application_id: Optional[:class:`int`]
1160
- The id of the embedded application for the invite, required if `target_type` is `TargetType.embedded_application`.
1153
+ The id of the embedded application for the invite, required if `target_type` is
1154
+ `TargetType.embedded_application`.
1161
1155
1162
1156
.. versionadded:: 2.0
1163
1157
1164
- target_event: Optional[:class:`ScheduledEvent`]
1158
+ target_event: Optional[:class:`. ScheduledEvent`]
1165
1159
The scheduled event object to link to the event.
1166
- Shortcut to :meth:`Invite.set_scheduled_event`
1160
+ Shortcut to :meth:`. Invite.set_scheduled_event`
1167
1161
1168
- See :meth:`Invite.set_scheduled_event` for more
1162
+ See :meth:`. Invite.set_scheduled_event` for more
1169
1163
info on event invite linking.
1170
1164
1171
1165
.. versionadded:: 2.0
@@ -1383,11 +1377,13 @@ async def send(
1383
1377
1384
1378
.. versionadded:: 1.4
1385
1379
1386
- reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
1380
+ reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`,
1381
+ :class:`~discord.PartialMessage`]
1387
1382
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
1388
1383
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
1389
- whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user`
1390
- attribute of ``allowed_mentions`` or by setting ``mention_author``.
1384
+ whether this mentions the author of the referenced message using the
1385
+ :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
1386
+ setting ``mention_author``.
1391
1387
1392
1388
.. versionadded:: 1.6
1393
1389
@@ -1732,7 +1728,7 @@ def history(
1732
1728
If a datetime is provided, it is recommended to use a UTC aware datetime.
1733
1729
If the datetime is naive, it is assumed to be local time.
1734
1730
When using this argument, the maximum limit is 101. Note that if the limit is an
1735
- even number then this will return at most limit + 1 messages.
1731
+ even number, then this will return at most limit + 1 messages.
1736
1732
oldest_first: Optional[:class:`bool`]
1737
1733
If set to ``True``, return messages in oldest->newest order. Defaults to ``True`` if
1738
1734
``after`` is specified, otherwise ``False``.
0 commit comments