Use typing.Protocol instead of abc.ABCMeta

This commit is contained in:
James
2021-04-04 23:05:49 +01:00
committed by GitHub
parent fe54b3cb92
commit 34ab772653
4 changed files with 99 additions and 101 deletions

View File

@ -2499,20 +2499,19 @@ interface, :meth:`WebhookAdapter.request`.
Abstract Base Classes
-----------------------
An :term:`py:abstract base class` (also known as an ``abc``) is a class that models can inherit
to get their behaviour. The Python implementation of an :doc:`abc <py:library/abc>` is
slightly different in that you can register them at run-time. **Abstract base classes cannot be instantiated**.
They are mainly there for usage with :func:`py:isinstance` and :func:`py:issubclass`\.
An :term:`abstract base class` (also known as an ``abc``) is a class that models can inherit
to get their behaviour. **Abstract base classes should not be instantiated**.
They are mainly there for usage with :func:`isinstance` and :func:`issubclass`\.
This library has a module related to abstract base classes, some of which are actually from the :doc:`abc <py:library/abc>` standard
module, others which are not.
This library has a module related to abstract base classes, in which all the ABCs are subclasses of
:class:`typing.Protocol`.
Snowflake
~~~~~~~~~~
.. attributetable:: discord.abc.Snowflake
.. autoclass:: discord.abc.Snowflake
.. autoclass:: discord.abc.Snowflake()
:members:
User
@ -2520,7 +2519,7 @@ User
.. attributetable:: discord.abc.User
.. autoclass:: discord.abc.User
.. autoclass:: discord.abc.User()
:members:
PrivateChannel
@ -2528,7 +2527,7 @@ PrivateChannel
.. attributetable:: discord.abc.PrivateChannel
.. autoclass:: discord.abc.PrivateChannel
.. autoclass:: discord.abc.PrivateChannel()
:members:
GuildChannel
@ -2536,7 +2535,7 @@ GuildChannel
.. attributetable:: discord.abc.GuildChannel
.. autoclass:: discord.abc.GuildChannel
.. autoclass:: discord.abc.GuildChannel()
:members:
Messageable
@ -2544,7 +2543,7 @@ Messageable
.. attributetable:: discord.abc.Messageable
.. autoclass:: discord.abc.Messageable
.. autoclass:: discord.abc.Messageable()
:members:
:exclude-members: history, typing
@ -2559,7 +2558,7 @@ Connectable
.. attributetable:: discord.abc.Connectable
.. autoclass:: discord.abc.Connectable
.. autoclass:: discord.abc.Connectable()
.. _discord_api_models: