Skip to content

Commit 64fdf73

Browse files
Deploy preview for PR 1133 🛫
1 parent 1bdd17c commit 64fdf73

File tree

559 files changed

+642
-604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

559 files changed

+642
-604
lines changed

pr-preview/pr-1133/_sources/howto/enum.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,9 @@ Supported ``_sunder_`` names
990990
from the final class
991991
- :meth:`~Enum._generate_next_value_` -- used to get an appropriate value for
992992
an enum member; may be overridden
993-
- :meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing
993+
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
994994
member.
995-
- :meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an
995+
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an
996996
existing member. See `MultiValueEnum`_ for an example.
997997

998998
.. note::

pr-preview/pr-1133/_sources/library/enum.rst.txt

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ Data Types
175175
final *enum*, as well as creating the enum members, properly handling
176176
duplicates, providing iteration over the enum class, etc.
177177

178+
.. versionadded:: 3.11
179+
180+
Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available as an alias.
181+
178182
.. method:: EnumType.__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
179183

180184
This method is called in two different ways:
@@ -206,7 +210,7 @@ Data Types
206210
>>> Color.RED.value in Color
207211
True
208212

209-
.. versionchanged:: 3.12
213+
.. versionchanged:: 3.12
210214

211215
Before Python 3.12, a ``TypeError`` is raised if a
212216
non-Enum-member is used in a containment check.
@@ -251,20 +255,6 @@ Data Types
251255
>>> list(reversed(Color))
252256
[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]
253257

254-
.. method:: EnumType._add_alias_
255-
256-
Adds a new name as an alias to an existing member. Raises a
257-
:exc:`NameError` if the name is already assigned to a different member.
258-
259-
.. method:: EnumType._add_value_alias_
260-
261-
Adds a new value as an alias to an existing member. Raises a
262-
:exc:`ValueError` if the value is already linked with a different member.
263-
264-
.. versionadded:: 3.11
265-
266-
Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available as an alias.
267-
268258

269259
.. class:: Enum
270260

@@ -470,6 +460,30 @@ Data Types
470460

471461
.. versionchanged:: 3.12 Added :ref:`enum-dataclass-support`
472462

463+
.. method:: Enum._add_alias_
464+
465+
Adds a new name as an alias to an existing member::
466+
467+
>>> Color.RED._add_alias_("ERROR")
468+
>>> Color.ERROR
469+
<Color.RED: 1>
470+
471+
Raises a :exc:`NameError` if the name is already assigned to a different member.
472+
473+
.. versionadded:: 3.13
474+
475+
.. method:: Enum._add_value_alias_
476+
477+
Adds a new value as an alias to an existing member::
478+
479+
>>> Color.RED._add_value_alias_(42)
480+
>>> Color(42)
481+
<Color.RED: 1>
482+
483+
Raises a :exc:`ValueError` if the value is already linked with a different member.
484+
485+
.. versionadded:: 3.13
486+
473487

474488
.. class:: IntEnum
475489

@@ -879,10 +893,6 @@ Once all the members are created it is no longer used.
879893
Supported ``_sunder_`` names
880894
""""""""""""""""""""""""""""
881895

882-
- :meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing
883-
member.
884-
- :meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an
885-
existing member.
886896
- :attr:`~Enum._name_` -- name of the member
887897
- :attr:`~Enum._value_` -- value of the member; can be set in ``__new__``
888898
- :meth:`~Enum._missing_` -- a lookup function used when a value is not found;
@@ -903,6 +913,11 @@ Supported ``_sunder_`` names
903913
For :class:`Flag` classes the next value chosen will be the next highest
904914
power-of-two.
905915

916+
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
917+
member.
918+
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an
919+
existing member.
920+
906921
- While ``_sunder_`` names are generally reserved for the further development
907922
of the :class:`Enum` class and can not be used, some are explicitly allowed:
908923

pr-preview/pr-1133/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ <h3>瀏覽</h3>
320320
<a href="https://www.python.org/psf/donations/">Please donate.</a>
321321
<br>
322322
<br>
323-
最後更新於 8月 12, 2025 (00:21 UTC)。
323+
最後更新於 8月 13, 2025 (00:21 UTC)。
324324

325325
<a href="/bugs.html">Found a bug</a>?
326326

pr-preview/pr-1133/bugs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ <h2>說明文件的錯誤<a class="headerlink" href="#documentation-bugs" title=
231231
</section>
232232
<section id="getting-started-contributing-to-python-yourself">
233233
<span id="contributing-to-python"></span><h2>開始讓自己貢獻 Python<a class="headerlink" href="#getting-started-contributing-to-python-yourself" title="連結到這個標頭"></a></h2>
234-
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://devguide.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
234+
<p>除了只是回報你所發現的錯誤之外,同樣也歡迎你提交修正它們的修補程式 (patch)。你可以在 <a class="reference external" href="https://mail.python.org/mailman3/lists/core-mentorship.python.org/">Python 開發者指南</a>中找到如何開始修補 Python 的更多資訊。如果你有任何問題,<a class="reference external" href="https://devguide.python.org/">核心導師郵寄清單</a>是一個友善的地方,你可以在那裡得到,關於 Python 修正錯誤的過程中,所有問題的答案。</p>
235235
</section>
236236
</section>
237237

@@ -359,7 +359,7 @@ <h3>瀏覽</h3>
359359
<a href="https://www.python.org/psf/donations/">Please donate.</a>
360360
<br>
361361
<br>
362-
最後更新於 8月 12, 2025 (00:21 UTC)。
362+
最後更新於 8月 13, 2025 (00:21 UTC)。
363363

364364
<a href="/bugs.html">Found a bug</a>?
365365

pr-preview/pr-1133/c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ <h3>瀏覽</h3>
329329
<a href="https://www.python.org/psf/donations/">Please donate.</a>
330330
<br>
331331
<br>
332-
最後更新於 8月 12, 2025 (00:21 UTC)。
332+
最後更新於 8月 13, 2025 (00:21 UTC)。
333333

334334
<a href="/bugs.html">Found a bug</a>?
335335

pr-preview/pr-1133/c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ <h3>瀏覽</h3>
346346
<a href="https://www.python.org/psf/donations/">Please donate.</a>
347347
<br>
348348
<br>
349-
最後更新於 8月 12, 2025 (00:21 UTC)。
349+
最後更新於 8月 13, 2025 (00:21 UTC)。
350350

351351
<a href="/bugs.html">Found a bug</a>?
352352

pr-preview/pr-1133/c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>瀏覽</h3>
376376
<a href="https://www.python.org/psf/donations/">Please donate.</a>
377377
<br>
378378
<br>
379-
最後更新於 8月 12, 2025 (00:21 UTC)。
379+
最後更新於 8月 13, 2025 (00:21 UTC)。
380380

381381
<a href="/bugs.html">Found a bug</a>?
382382

pr-preview/pr-1133/c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ <h3>瀏覽</h3>
931931
<a href="https://www.python.org/psf/donations/">Please donate.</a>
932932
<br>
933933
<br>
934-
最後更新於 8月 12, 2025 (00:21 UTC)。
934+
最後更新於 8月 13, 2025 (00:21 UTC)。
935935

936936
<a href="/bugs.html">Found a bug</a>?
937937

pr-preview/pr-1133/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ <h3>瀏覽</h3>
340340
<a href="https://www.python.org/psf/donations/">Please donate.</a>
341341
<br>
342342
<br>
343-
最後更新於 8月 12, 2025 (00:21 UTC)。
343+
最後更新於 8月 13, 2025 (00:21 UTC)。
344344

345345
<a href="/bugs.html">Found a bug</a>?
346346

pr-preview/pr-1133/c-api/buffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ <h3>瀏覽</h3>
10221022
<a href="https://www.python.org/psf/donations/">Please donate.</a>
10231023
<br>
10241024
<br>
1025-
最後更新於 8月 12, 2025 (00:21 UTC)。
1025+
最後更新於 8月 13, 2025 (00:21 UTC)。
10261026

10271027
<a href="/bugs.html">Found a bug</a>?
10281028

0 commit comments

Comments
 (0)