From 68e6b2037eb1cc112b292f2720b638d462241952 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 11 May 2025 14:58:16 +0000 Subject: [PATCH 1/3] sync with cpython 927da992 --- deprecations/index.po | 15 +- deprecations/pending-removal-in-3.15.po | 83 +- whatsnew/3.12.po | 1381 +++++++++++------------ whatsnew/3.13.po | 15 +- 4 files changed, 743 insertions(+), 751 deletions(-) diff --git a/deprecations/index.po b/deprecations/index.po index 05c5babe57..4d0a235824 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -431,6 +431,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -439,11 +448,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 726d403414..902e9adc10 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-28 00:14+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -36,11 +36,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -94,17 +93,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -112,11 +109,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -170,9 +167,9 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" @@ -180,10 +177,10 @@ msgstr ":mod:`typing`:" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -191,6 +188,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -199,17 +205,16 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index b03e6092a8..e6ce46ad51 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see " -"the :ref:`changelog `." +"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" +"`changelog `." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog `。" @@ -55,18 +55,18 @@ msgid "" "improvements, and several modules have better performance." msgstr "" "Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" -"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的" -"是,:mod:`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` " -"中的檔案系統支援進行了許多改進,並且有數個模組得到更好的效能。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" "The language changes focus on usability, as :term:`f-strings ` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax ` and :keyword:`type` statement improve ergonomics for " -"using :term:`generic types ` and :term:`type aliases ` with static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" +"`generic types ` and :term:`type aliases ` with " +"static type checkers." msgstr "" "語言變更主要集中在可用性,因為 :term:`f-字串 `\\ 已經移除了許多限" "制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " @@ -95,8 +95,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 `, type parameter syntax and " -"the :keyword:`type` statement" +":ref:`PEP 695 `, type parameter syntax and the :keyword:" +"`type` statement" msgstr "" ":ref:`PEP 695 `,型別參數語法和 :keyword:`type` 陳述式" @@ -129,8 +129,8 @@ msgstr ":ref:`PEP 669 `,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions `_ " -"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions `_ for :" +"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -157,15 +157,15 @@ msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface ` has been added to " -"the :mod:`sqlite3` module" +"A :ref:`command-line interface ` has been added to the :mod:" +"`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 `\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -236,8 +236,8 @@ msgid "" ":ref:`PEP 692 `, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs `" msgstr "" -":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標" -"註 :term:`**kwargs `" +":ref:`PEP 692 `、使用 :class:`~typing.TypedDict` 來標註 :" +"term:`**kwargs `" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 `, :func:`typing.override` decorator" @@ -277,9 +277,9 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" -"個 :class:`unittest.TestCase` 的\\ `方法別名 `_\\ 已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" +"`unittest.TestCase` 的\\ `方法別名 `_\\ " +"已被刪除。" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1840 msgid "New Features" @@ -298,8 +298,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to " -"create :ref:`generic classes ` and :ref:`functions ` and :ref:`functions `::" msgstr "" @@ -346,9 +346,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` " -"and :class:`~typing.ParamSpec` parameters, as well " -"as :class:`~typing.TypeVar` parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" +"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " +"parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -444,11 +444,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected " -"unicode :ref:`escape sequences ` (such as ``\\N{snowman}" -"``) as these contain the ``\\N`` part that previously could not be part of " -"expression components of f-strings. Now, you can define expressions like " -"this:" +"couldn't contain any ``\\`` character. This also affected unicode :ref:" +"`escape sequences ` (such as ``\\N{snowman}``) as these " +"contain the ``\\N`` part that previously could not be part of expression " +"components of f-strings. Now, you can define expressions like this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -588,17 +587,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"` from Python code. Classes that implement " -"the :meth:`~object.__buffer__` method are now usable as buffer types." +"` from Python code. Classes that implement the :meth:`~object." +"__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The " -"new :class:`inspect.BufferFlags` enum represents the flags that can be used " -"to customize buffer creation. (Contributed by Jelle Zijlstra " -"in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The new :class:" +"`inspect.BufferFlags` enum represents the flags that can be used to " +"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -677,8 +675,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " -"in :gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" +"gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -695,8 +693,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and the :" +"mod:`typing` module." msgstr "" "本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" @@ -803,18 +801,17 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " -"version, :exc:`SyntaxError` will eventually be raised, instead " -"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" +"exc:`SyntaxError` will eventually be raised, instead of :exc:" +"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " -"of :exc:`DeprecationWarning`. In a future Python version they will be " -"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " -"in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" +"exc:`DeprecationWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -837,9 +834,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in " -"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " -"Irit Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in an :" +"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " +"Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -848,8 +845,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo " -"in :gh:`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" +"`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -905,13 +902,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler ` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " -"option :option:`-X perf <-X>`, as well as the " -"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " -"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " -"Galindo. Contributed by Pablo Galindo and Christian Heimes with " -"contributions from Gregory P. Smith [Google] and Mark Shannon " -"in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" +"option:`-X perf <-X>`, as well as the new :func:`sys." +"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" +"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " +"Contributed by Pablo Galindo and Christian Heimes with contributions from " +"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:628 @@ -932,8 +928,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it " -"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it a :term:" +"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -950,28 +946,25 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` " -"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " -"event loop in to eager task execution, making some use-cases 2x to 5x " -"faster. (Contributed by Jacob Bower & Itamar Oren " -"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." +"create_eager_task_factory` functions to allow opting an event loop in to " +"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " +"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 msgid "" "On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead " -"of :class:`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya " -"in :gh:`98024`.)" +"if :func:`os.pidfd_open` is available and functional instead of :class:" +"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform " -"(:class:`asyncio.PidfdChildWatcher` if supported " -"and :class:`asyncio.ThreadedChildWatcher` otherwise), so manually " -"configuring a child watcher is not recommended. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform (:" +"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." +"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " +"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -988,9 +981,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators " -"as :mod:`asyncio` does not support legacy generator-based coroutines. " -"(Contributed by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" +"`asyncio` does not support legacy generator-based coroutines. (Contributed " +"by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -1006,8 +999,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan in :gh:" +"`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -1017,8 +1010,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings " -"by :class:`~csv.reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1028,10 +1021,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` " -"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " -"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " -"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" +"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " +"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " +"(Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1125,8 +1118,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " -"於 :gh:`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" +"`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1141,16 +1134,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " -"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " -"Aditya in :gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" +"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" +"gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" +"`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1169,8 +1162,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower " -"in :gh:`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" +"`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1199,10 +1192,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` " -"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " -"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " -"pass information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." +"Path`, plus their Posix- and Windows-specific variants. Subclasses may " +"override the :meth:`pathlib.PurePath.with_segments` method to pass " +"information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1216,23 +1209,22 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " -"in :gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" +"gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy " -"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." +"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter " -"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " -"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " -"allowing for more precise control over the matching process." +"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" +"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " +"path's case sensitivity, allowing for more precise control over the matching " +"process." msgstr "" #: ../../whatsnew/3.12.rst:815 @@ -1264,8 +1256,8 @@ msgstr "random" #: ../../whatsnew/3.12.rst:833 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " -"in :gh:`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" +"`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" @@ -1329,31 +1321,29 @@ msgid "" "Add a :ref:`command-line interface `. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland " -"於 :gh:`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 `。(由 Erlend E. Aasland 於 :gh:" +"`77617` 中貢獻。)" #: ../../whatsnew/3.12.rst:874 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute " -"to :class:`sqlite3.Connection` and the *autocommit* parameter " -"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " -"handling `. (Contributed by Erlend " -"E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." +"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " +"control :pep:`249`-compliant :ref:`transaction handling `. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" #: ../../whatsnew/3.12.rst:881 msgid "" -"Add *entrypoint* keyword-only parameter " -"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " -"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." +"load_extension`, for overriding the SQLite extension entry point. " +"(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" #: ../../whatsnew/3.12.rst:886 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` " -"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " -"make configuration changes to a database connection. (Contributed by Erlend " -"E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." +"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " +"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" #: ../../whatsnew/3.12.rst:892 @@ -1374,28 +1364,27 @@ msgstr "sys" #: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"` monitoring API. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"` monitoring API. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" #: ../../whatsnew/3.12.rst:905 msgid "" -"Add :func:`sys.activate_stack_trampoline` " -"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " -"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " -"querying if stack profiler trampolines are active. (Contributed by Pablo " -"Galindo and Christian Heimes with contributions from Gregory P. Smith " -"[Google] and Mark Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` and :func:`sys." +"deactivate_stack_trampoline` for activating and deactivating stack profiler " +"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " +"stack profiler trampolines are active. (Contributed by Pablo Galindo and " +"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " +"Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy " -"form: :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +"that have the same information in its legacy form: :data:`sys.last_type`, :" +"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " +"Katriel in :gh:`102778`.)" msgstr "" #: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1739 @@ -1439,10 +1428,10 @@ msgstr "threading" #: ../../whatsnew/3.12.rst:940 msgid "" -"Add :func:`threading.settrace_all_threads` " -"and :func:`threading.setprofile_all_threads` that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " -"(Contributed by Pablo Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` and :func:`threading." +"setprofile_all_threads` that allow to set tracing and profiling functions in " +"all running threads in addition to the calling one. (Contributed by Pablo " +"Galindo in :gh:`93503`.)" msgstr "" #: ../../whatsnew/3.12.rst:946 @@ -1466,9 +1455,9 @@ msgstr "tokenize" #: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " -"See :ref:`whatsnew312-porting-to-python312` for more information on the " -"changes to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" +"ref:`whatsnew312-porting-to-python312` for more information on the changes " +"to the :mod:`tokenize` module." msgstr "" #: ../../whatsnew/3.12.rst:965 @@ -1477,9 +1466,9 @@ msgstr "types" #: ../../whatsnew/3.12.rst:967 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection " -"of :ref:`user-defined-generics` when subclassed. (Contributed by James " -"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection of :" +"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" +"Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" #: ../../whatsnew/3.12.rst:974 @@ -1488,16 +1477,15 @@ msgstr "typing" #: ../../whatsnew/3.12.rst:976 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"` now use :func:`inspect.getattr_static` rather " -"than :func:`hasattr` to lookup whether attributes exist. This means that " -"descriptors and :meth:`~object.__getattr__` methods are no longer " -"unexpectedly evaluated during ``isinstance()`` checks against runtime-" -"checkable protocols. However, it may also mean that some objects which used " -"to be considered instances of a runtime-checkable protocol may no longer be " -"considered instances of that protocol on Python 3.12+, and vice versa. Most " -"users are unlikely to be affected by this change. (Contributed by Alex " -"Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols ` now use :func:`inspect.getattr_static` rather than :func:" +"`hasattr` to lookup whether attributes exist. This means that descriptors " +"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " +"during ``isinstance()`` checks against runtime-checkable protocols. However, " +"it may also mean that some objects which used to be considered instances of " +"a runtime-checkable protocol may no longer be considered instances of that " +"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " +"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" #: ../../whatsnew/3.12.rst:987 @@ -1558,8 +1546,8 @@ msgid "" "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" #: ../../whatsnew/3.12.rst:1020 @@ -1662,8 +1650,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1072 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` " -"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` and :" +"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" @@ -1679,16 +1667,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to " -"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " -"Macías and Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to cover :pep:" +"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " +"Pablo Galindo in :gh:`102856`.)" msgstr "" #: ../../whatsnew/3.12.rst:1085 msgid "" -"Speed up :func:`super` method calls and attribute loads via the " -"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " -"Vladimir Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the new :opcode:" +"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " +"Matveev in :gh:`103497`.)" msgstr "" #: ../../whatsnew/3.12.rst:1091 @@ -1697,29 +1685,28 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " -"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " -"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " -"(Contributed by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" +"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" +"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " +"by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" -"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" -"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " -"Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" #: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " -"in :gh:`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" +"`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" #: ../../whatsnew/3.12.rst:1101 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " -"in :gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" +"gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" @@ -1757,8 +1744,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1116 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" @@ -1780,31 +1767,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:1125 msgid "" -"Add " -"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " -"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " -"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " -"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " -"(Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" +"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " +"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " +"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" +"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" -"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " -"於 :gh:`103764` 中貢獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " -"於 :gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1134 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang " -"in :gh:`101632`.)" +"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" +"gh:`101632`.)" msgstr "" "新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" @@ -1881,8 +1867,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -1894,23 +1880,24 @@ msgstr ":mod:`asyncio`:" #: ../../whatsnew/3.12.rst:1173 msgid "" -"The child watcher " -"classes :class:`asyncio.MultiLoopChildWatcher`, :class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` " -"and :class:`asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" +"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" +"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 @@ -1928,9 +1915,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -1940,27 +1926,24 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " -"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " -"removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, " -"call :meth:`~datetime.datetime.now` " -"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " -"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." +"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " +"will be removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." +"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " +"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" #: ../../whatsnew/3.12.rst:1207 msgid "" -":mod:`email`: Deprecate the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" @@ -2011,8 +1994,8 @@ msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger " -"in :gh:`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" +"`101588`.)" msgstr "" #: ../../whatsnew/3.12.rst:1230 @@ -2021,19 +2004,17 @@ msgid "" "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`contexts and start methods " -"`." +"majority of code is not expected to care. Use the :func:`~multiprocessing." +"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " +"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " +"methods `." msgstr "" #: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; " -"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " -"in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." +"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" @@ -2062,31 +2043,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:1258 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise " -"a :exc:`DeprecationWarning` when it can detect being called from a " -"multithreaded process. There has always been a fundamental incompatibility " -"with the POSIX platform when doing so. Even if such code *appeared* to work. " -"We added the warning to raise awareness as issues encountered by code doing " -"this are becoming more frequent. See the :func:`os.fork` documentation for " -"more details along with `this discussion on fork being incompatible with " -"threads `_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise a :exc:" +"`DeprecationWarning` when it can detect being called from a multithreaded " +"process. There has always been a fundamental incompatibility with the POSIX " +"platform when doing so. Even if such code *appeared* to work. We added the " +"warning to raise awareness as issues encountered by code doing this are " +"becoming more frequent. See the :func:`os.fork` documentation for more " +"details along with `this discussion on fork being incompatible with threads " +"`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" #: ../../whatsnew/3.12.rst:1268 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` " -"or :mod:`concurrent.futures` the fix is to use a " -"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " -"``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" +"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " +"start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" #: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel " -"in :gh:`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" +"`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" @@ -2115,14 +2095,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1290 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback` fields are deprecated. " -"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." +"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " +"(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " -"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" -"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" #: ../../whatsnew/3.12.rst:1294 msgid "" @@ -2138,16 +2117,16 @@ msgstr ":mod:`typing`:" #: ../../whatsnew/3.12.rst:1300 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases " -"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " -"respectively, are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" +"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " +"are deprecated. (:gh:`94309`.)" msgstr "" #: ../../whatsnew/3.12.rst:1304 msgid "" -":class:`typing.ByteString`, deprecated since Python 3.9, now causes " -"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " -"Alex Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" +"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " +"Waygood in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1308 @@ -2161,26 +2140,26 @@ msgstr "" #: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"`, :meth:`generator throw() ` " -"and :meth:`async generator throw() ` are deprecated and may be " -"removed in a future version of Python. Use the single-arg versions of these " -"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"`, :meth:`generator throw() ` and :meth:" +"`async generator throw() ` are deprecated and may be removed in " +"a future version of Python. Use the single-arg versions of these functions " +"instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" #: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent " -"` (previously it " -"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent ` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon " -"in :gh:`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1330 @@ -2195,13 +2174,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a " -"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a proper :exc:" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" -"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" -"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2393,35 +2372,32 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -2447,25 +2423,24 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -2474,9 +2449,8 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -2496,9 +2470,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders ` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" @@ -2515,8 +2489,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2533,10 +2507,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached ` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "` 的做法已被棄用。在 Python 3.15 中," @@ -2544,11 +2518,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent ` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "` 的做法已被棄用。在 Python 3.15 中," @@ -2603,17 +2576,15 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" @@ -2621,11 +2592,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" @@ -2679,16 +2650,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -2696,6 +2667,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -2704,20 +2684,19 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -2725,10 +2704,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader ` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "` 的做法將於 Python 3.16 被棄用。在 " @@ -2755,8 +2734,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:10 @@ -2862,17 +2841,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:24 msgid "" @@ -2885,18 +2864,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:27 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:30 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -2907,10 +2886,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:34 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -2928,19 +2907,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." @@ -2971,8 +2950,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" @@ -3029,11 +3008,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:92 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" @@ -3081,11 +3060,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:108 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -3093,19 +3072,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -3181,13 +3160,13 @@ msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:136 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -"的 :func:`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" #: ../../deprecations/pending-removal-in-future.rst:140 msgid "" @@ -3197,22 +3176,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:143 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:148 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: " -"use :meth:`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" #: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2237 msgid "Removed" @@ -3253,16 +3232,16 @@ msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" -"的 :class:`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" #: ../../whatsnew/3.12.rst:1376 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " -"Use :meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" -"用 :meth:`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" #: ../../whatsnew/3.12.rst:1382 msgid "distutils" @@ -3342,8 +3321,8 @@ msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner " -"in :gh:`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" msgstr "" #: ../../whatsnew/3.12.rst:1435 @@ -3352,11 +3331,11 @@ msgstr "hashlib" #: ../../whatsnew/3.12.rst:1437 msgid "" -"Remove the pure Python implementation " -"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " -"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " -"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " -"faster. (Contributed by Victor Stinner in :gh:`94199`.)" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1444 ../../whatsnew/3.12.rst:1473 @@ -3402,8 +3381,8 @@ msgstr "imp" #: ../../whatsnew/3.12.rst:1467 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " -"in :gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" #: ../../whatsnew/3.12.rst:1470 @@ -3448,11 +3427,11 @@ msgstr "``imp.get_suffixes()``" #: ../../whatsnew/3.12.rst:1479 msgid "" -":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " -"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " -"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" #: ../../whatsnew/3.12.rst:1480 msgid "``imp.get_tag()``" @@ -3583,10 +3562,10 @@ msgstr "io" #: ../../whatsnew/3.12.rst:1521 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` " -"(:func:`io.open`) function is a built-in function. Since Python " -"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " -"Stinner in :gh:`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." +"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." +"open` is also a static method. (Contributed by Victor Stinner in :gh:" +"`94169`.)" msgstr "" #: ../../whatsnew/3.12.rst:1528 @@ -3606,10 +3585,10 @@ msgstr "smtpd" #: ../../whatsnew/3.12.rst:1537 msgid "" -"The ``smtpd`` module has been removed according to the schedule " -"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " -"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " -"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule in :pep:" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" "根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" "被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " @@ -3639,9 +3618,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1555 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " -"for :class:`str` since Python 3.3. Code that previously set the text factory " -"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" +"`str` since Python 3.3. Code that previously set the text factory to " +"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" @@ -3671,12 +3650,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:1575 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call " -"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " -"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " -"sends a SNI TLS extension nor validates the server hostname. Code is subject " -"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." +"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." +"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1586 @@ -3834,9 +3813,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1618 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule " -"` parameter *use_load_tests* " -"(deprecated and ignored since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule ` parameter *use_load_tests* (deprecated and ignored " +"since Python 3.5)." msgstr "" #: ../../whatsnew/3.12.rst:1622 @@ -3882,9 +3861,8 @@ msgstr "zipimport" #: ../../whatsnew/3.12.rst:1646 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. " -"See :pep:`451` for the rationale. (Contributed by Victor Stinner " -"in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" +"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" #: ../../whatsnew/3.12.rst:1652 @@ -3893,20 +3871,20 @@ msgstr "其他" #: ../../whatsnew/3.12.rst:1654 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " -"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard " -"in :gh:`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" +"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `_. (Contributed by Julien Palard in :gh:" +"`98179`.)" msgstr "" #: ../../whatsnew/3.12.rst:1659 msgid "" -"Remove the *keyfile* and *certfile* parameters from " -"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " -"and the *key_file*, *cert_file* and *check_hostname* parameters from " -"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " -"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " -"by Victor Stinner in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" +"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " +"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " +"module, all deprecated since Python 3.6. Use the *context* parameter " +"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " +"in :gh:`94172`.)" msgstr "" #: ../../whatsnew/3.12.rst:1667 @@ -3919,8 +3897,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1670 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " -"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" +"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" @@ -3956,8 +3934,8 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy " -"Storchaka :gh:`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" +"`86388`.)" msgstr "" #: ../../whatsnew/3.12.rst:1701 @@ -3973,8 +3951,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1707 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" -"based :pypi:`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" +"`aiosmtpd` PyPI module." msgstr "" #: ../../whatsnew/3.12.rst:1711 @@ -3986,10 +3964,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:1716 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, " -"like :class:`bytearray` and :class:`memoryview` types: only the " -"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " -"Victor Stinner in :gh:`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, like :class:" +"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " +"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" +"`98393`.)" msgstr "" #: ../../whatsnew/3.12.rst:1721 @@ -4018,23 +3996,21 @@ msgstr "" #: ../../whatsnew/3.12.rst:1743 msgid "" -"When extracting tar files using :mod:`tarfile` " -"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " -"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" -"filter` for details." +"When extracting tar files using :mod:`tarfile` or :func:`shutil." +"unpack_archive`, pass the *filter* argument to limit features that may be " +"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" #: ../../whatsnew/3.12.rst:1748 msgid "" -"The output of the :func:`tokenize.tokenize` " -"and :func:`tokenize.generate_tokens` functions is now changed due to the " -"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " -"emitted any more for f-strings and the tokens described in :pep:`701` are " -"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " -"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " -"the appropriate tokens for the tokenization in the expression components. " -"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " -"tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` and :func:`tokenize." +"generate_tokens` functions is now changed due to the changes introduced in :" +"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" +"strings and the tokens described in :pep:`701` are now produced instead: " +"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " +"for f-string \"string\" parts in addition to the appropriate tokens for the " +"tokenization in the expression components. For example for the f-string " +"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" #: ../../whatsnew/3.12.rst:1757 @@ -4139,11 +4115,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1813 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " -"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " -"Also merged the 3 ``compileall`` commands into a single command to " -"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " -"by Victor Stinner in :gh:`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" +"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " +"3 ``compileall`` commands into a single command to build .pyc files for all " +"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" +"`99289`.)" msgstr "" #: ../../whatsnew/3.12.rst:1819 @@ -4262,8 +4238,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1873 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, " -"including :c:var:`PyType_Type`." +"to allow safely extending certain variable-sized types, including :c:var:" +"`PyType_Type`." msgstr "" #: ../../whatsnew/3.12.rst:1876 @@ -4278,10 +4254,10 @@ msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" #: ../../whatsnew/3.12.rst:1881 msgid "" -"Add the new :ref:`limited C API ` " -"function :c:func:`PyType_FromMetaclass`, which generalizes the " -"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " -"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API ` function :c:func:" +"`PyType_FromMetaclass`, which generalizes the existing :c:func:" +"`PyType_FromModuleAndSpec` using an additional metaclass argument. " +"(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" #: ../../whatsnew/3.12.rst:1886 @@ -4313,16 +4289,16 @@ msgid "" "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " -"in :gh:`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" +"`93274`.)" msgstr "" #: ../../whatsnew/3.12.rst:1903 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " -"extensions classes to support object :attr:`~object.__dict__` and weakrefs " -"with less bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1908 @@ -4352,9 +4328,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1920 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " -"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" +"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " +"functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" @@ -4367,11 +4343,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1930 msgid "" -"The C API now permits registering callbacks " -"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " -"be called whenever a dictionary is modified. This is intended for use by " -"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " -"Meyer in :gh:`91052`.)" +"The C API now permits registering callbacks via :c:func:" +"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " +"whenever a dictionary is modified. This is intended for use by optimizing " +"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" +"`91052`.)" msgstr "" #: ../../whatsnew/3.12.rst:1936 @@ -4391,18 +4367,18 @@ msgstr "" #: ../../whatsnew/3.12.rst:1945 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner " -"in :gh:`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" +"`91248`.)" msgstr "" #: ../../whatsnew/3.12.rst:1949 msgid "" -"Add :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " -"exception. These functions return and accept a single exception object, " -"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " -"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " -"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` and :c:func:" +"`PyErr_SetRaisedException` for saving and restoring the current exception. " +"These functions return and accept a single exception object, rather than the " +"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" +"`PyErr_Restore`. This is less error prone and a bit more efficient. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1957 @@ -4415,9 +4391,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying " -"the :attr:`~BaseException.args` passed to the exception's constructor. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"convenience functions for retrieving and modifying the :attr:`~BaseException." +"args` passed to the exception's constructor. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1966 @@ -4486,18 +4462,17 @@ msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" #: ../../whatsnew/3.12.rst:1990 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " -"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" -"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " -"info.) (Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" +"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " +"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " +"(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" #: ../../whatsnew/3.12.rst:1996 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` " -"and :c:func:`Py_DECREF` functions are now implemented as opaque function " -"calls to hide implementation details. (Contributed by Victor Stinner " -"in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" +"`Py_DECREF` functions are now implemented as opaque function calls to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" #: ../../whatsnew/3.12.rst:2004 @@ -4532,9 +4507,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2023 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " -"for example)." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" #: ../../whatsnew/3.12.rst:2027 @@ -4542,38 +4516,37 @@ msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " -"in :gh:`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" +"`98836`.)" msgstr "" #: ../../whatsnew/3.12.rst:2033 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " -"previous versions it caused all the rest of the format string to be copied " -"as-is to the result string, and any extra arguments discarded. (Contributed " -"by Serhiy Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" +"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded. (Contributed by Serhiy " +"Storchaka in :gh:`95781`.)" msgstr "" #: ../../whatsnew/3.12.rst:2039 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " -"in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" +"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" #: ../../whatsnew/3.12.rst:2043 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, " -"call :c:func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" +"func:`PyObject_ClearWeakRefs`, as before." msgstr "" #: ../../whatsnew/3.12.rst:2055 @@ -4594,10 +4567,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:2065 msgid "" -"The interpreter's error indicator is now always normalized. This means " -"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " -"functions that set the error indicator now normalize the exception before " -"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means that :" +"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " +"that set the error indicator now normalize the exception before storing it. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2070 @@ -4637,8 +4610,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2087 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` " -"(:meth:`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" +"`~object.__new__` in Python)." msgstr "" #: ../../whatsnew/3.12.rst:2091 @@ -4656,16 +4629,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:2100 msgid "" -"If initialization can be skipped, it can be done " -"in :c:member:`~PyTypeObject.tp_init` instead." +"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." +"tp_init` instead." msgstr "" #: ../../whatsnew/3.12.rst:2102 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using " -"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " -"acceptable for ``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using the :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " +"``PyType_From*`` functions." msgstr "" #: ../../whatsnew/3.12.rst:2107 @@ -4701,10 +4674,10 @@ msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning " -"``PyLong_...`` should be used instead. Two new *unstable* API functions are " -"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " -"which fit into a single machine word:" +"longer be accessed directly, instead the API functions beginning ``PyLong_..." +"`` should be used instead. Two new *unstable* API functions are provided for " +"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " +"a single machine word:" msgstr "" #: ../../whatsnew/3.12.rst:2131 @@ -4726,11 +4699,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2144 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field " -"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " -"this field will generate a compiler warning at compile time. This field will " -"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " -"in :gh:`101193`. PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" +"`PyDictObject` is deprecated for extension modules. Accessing this field " +"will generate a compiler warning at compile time. This field will be removed " +"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " +"PEP by Ken Jin.)" msgstr "" #: ../../whatsnew/3.12.rst:2149 @@ -4780,8 +4753,8 @@ msgstr "" msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`: 請改" -"用 :c:member:`PyConfig.use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." +"use_environment`" #: ../../whatsnew/3.12.rst:2161 msgid "" @@ -4793,8 +4766,8 @@ msgstr "" msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`: 請改" -"用 :c:member:`PyConfig.user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." +"user_site_directory`" #: ../../whatsnew/3.12.rst:2163 msgid "" @@ -4816,57 +4789,56 @@ msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" #: ../../whatsnew/3.12.rst:2167 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" #: ../../whatsnew/3.12.rst:2168 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"use :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`: 請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." +"legacy_windows_stdio`" #: ../../whatsnew/3.12.rst:2169 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2170 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" #: ../../whatsnew/3.12.rst:2171 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"use :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改" -"用 :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." +"filesystem_errors`" #: ../../whatsnew/3.12.rst:2172 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" +"func:`Py_PreInitialize`)" #: ../../whatsnew/3.12.rst:2174 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " -"in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" @@ -4891,11 +4863,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2187 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " -"and :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" +"`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " -"和 :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" +"`PyMember_SetOne`" #: ../../whatsnew/3.12.rst:2189 msgid "" @@ -4905,11 +4877,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2191 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " -"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" +"`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" -"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" +"`Py_AUDIT_READ`\\ (先前全大寫)旗標" #: ../../whatsnew/3.12.rst:2194 msgid "Several items are not exposed from :file:`Python.h`:" @@ -4929,17 +4901,16 @@ msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" #: ../../whatsnew/3.12.rst:2199 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " -"of :c:macro:`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" +"`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" -"於 :c:macro:`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" +"`Py_AUDIT_READ`。" #: ../../whatsnew/3.12.rst:2201 msgid "" -"In some configurations, ```` is not included " -"from :file:`Python.h`. It should be included manually when using " -"``offsetof()``." +"In some configurations, ```` is not included from :file:`Python." +"h`. It should be included manually when using ``offsetof()``." msgstr "" #: ../../whatsnew/3.12.rst:2204 @@ -4957,10 +4928,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:2212 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " -"Use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " +"instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2217 @@ -4981,30 +4951,29 @@ msgstr "" #: ../../whatsnew/3.12.rst:2223 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " -"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " -"instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" +"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" +"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " -"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" -"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 ` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -5034,8 +5003,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -5092,24 +5061,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -5132,51 +5101,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5184,27 +5153,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5215,16 +5184,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -"and :data:`sys.exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -"與 :data:`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -5235,8 +5204,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -"與 :data:`sys.prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5248,11 +5217,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5273,8 +5242,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5294,11 +5263,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5344,8 +5313,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5391,9 +5360,9 @@ msgid "" "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C " -"API。:file:`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor " -"Stinner 於 :gh:`92651` 中貢獻。)" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" #: ../../whatsnew/3.12.rst:2244 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." @@ -5440,8 +5409,8 @@ msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " -"於 :gh:`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" +"`85858` 中貢獻。)" #~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" #~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 00b971f26a..9fc480f716 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-07 00:15+0000\n" +"POT-Creation-Date: 2025-05-11 14:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3008,7 +3008,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:2005 -#: ../../deprecations/pending-removal-in-3.15.rst:93 +#: ../../deprecations/pending-removal-in-3.15.rst:100 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" @@ -3408,6 +3408,15 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:95 +msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " "it has yet to be supported by any major type checker." @@ -3416,7 +3425,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:95 +#: ../../deprecations/pending-removal-in-3.15.rst:102 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" From 58b250140f2a9158e48522ac0c9ace989a28be23 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 13 May 2025 00:16:59 +0000 Subject: [PATCH 2/3] sync with cpython 50b45c4f --- library/math.po | 264 +++++++------- library/unittest.mock.po | 736 +++++++++++++++++++------------------- library/urllib.request.po | 484 +++++++++++++------------ 3 files changed, 740 insertions(+), 744 deletions(-) diff --git a/library/math.po b/library/math.po index 1c6cb27a07..5c395482ea 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-19 00:14+0000\n" +"POT-Creation-Date: 2025-05-13 00:15+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -620,7 +620,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:139 ../../library/math.rst:205 +#: ../../library/math.rst:139 ../../library/math.rst:204 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -629,17 +629,14 @@ msgstr "" "`ValueError`。" #: ../../library/math.rst:147 -msgid "" -"Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " -"integral or is negative." +msgid "Return factorial of the nonnegative integer *n*." msgstr "" -"以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" -#: ../../library/math.rst:150 +#: ../../library/math.rst:149 msgid "Floats with integral values (like ``5.0``) are no longer accepted." msgstr "其值為整數的浮點數(如:``5.0``)已不再被接受。" -#: ../../library/math.rst:156 +#: ../../library/math.rst:155 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -651,13 +648,13 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:164 +#: ../../library/math.rst:163 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:171 +#: ../../library/math.rst:170 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -666,7 +663,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:175 +#: ../../library/math.rst:174 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -677,7 +674,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:185 +#: ../../library/math.rst:184 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -689,29 +686,29 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:196 +#: ../../library/math.rst:195 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:199 +#: ../../library/math.rst:198 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:202 +#: ../../library/math.rst:201 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:212 +#: ../../library/math.rst:211 msgid "Floating point arithmetic" msgstr "" -#: ../../library/math.rst:216 +#: ../../library/math.rst:215 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " "*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:223 +#: ../../library/math.rst:222 msgid "Return the absolute value of *x*." msgstr "回傳 *x* 的絕對值。" -#: ../../library/math.rst:228 +#: ../../library/math.rst:227 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " @@ -735,7 +732,7 @@ msgstr "" "將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:235 +#: ../../library/math.rst:234 msgid "" "Fused multiply-add operation. Return ``(x * y) + z``, computed as though " "with infinite precision and range followed by a single round to the " @@ -743,7 +740,7 @@ msgid "" "direct expression ``(x * y) + z``." msgstr "" -#: ../../library/math.rst:240 +#: ../../library/math.rst:239 msgid "" "This function follows the specification of the fusedMultiplyAdd operation " "described in the IEEE 754 standard. The standard leaves one case " @@ -752,7 +749,7 @@ msgid "" "not raise any exception." msgstr "" -#: ../../library/math.rst:251 +#: ../../library/math.rst:250 msgid "" "Return the floating-point remainder of ``x / y``, as defined by the platform " "C library function ``fmod(x, y)``. Note that the Python expression ``x % y`` " @@ -777,13 +774,13 @@ msgstr "" "``1e100``。因此,處理浮點數時通常會選擇函式 :func:`fmod`,而處理整數時會選擇 " "Python 運算式 ``x % y``。" -#: ../../library/math.rst:267 +#: ../../library/math.rst:266 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:270 +#: ../../library/math.rst:269 msgid "" "Note that :func:`modf` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -791,7 +788,7 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:278 +#: ../../library/math.rst:277 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -801,7 +798,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:284 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -809,13 +806,13 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:291 +#: ../../library/math.rst:290 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:299 +#: ../../library/math.rst:298 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -824,7 +821,7 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:306 +#: ../../library/math.rst:305 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -833,11 +830,11 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:314 +#: ../../library/math.rst:313 msgid "Floating point manipulation functions" msgstr "" -#: ../../library/math.rst:318 +#: ../../library/math.rst:317 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -846,7 +843,7 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:325 +#: ../../library/math.rst:324 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -857,7 +854,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:330 +#: ../../library/math.rst:329 msgid "" "Note that :func:`frexp` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -865,13 +862,13 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:337 +#: ../../library/math.rst:336 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:340 +#: ../../library/math.rst:339 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -880,7 +877,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:344 +#: ../../library/math.rst:343 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -894,7 +891,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/math.rst:351 +#: ../../library/math.rst:350 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -903,7 +900,7 @@ msgid "" "argument to the call." msgstr "" -#: ../../library/math.rst:357 +#: ../../library/math.rst:356 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -914,11 +911,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:366 +#: ../../library/math.rst:365 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:371 +#: ../../library/math.rst:370 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -926,128 +923,128 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:379 +#: ../../library/math.rst:378 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:385 +#: ../../library/math.rst:384 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:390 +#: ../../library/math.rst:389 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:396 +#: ../../library/math.rst:395 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:398 +#: ../../library/math.rst:397 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:400 +#: ../../library/math.rst:399 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:402 +#: ../../library/math.rst:401 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:402 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:404 +#: ../../library/math.rst:403 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:405 +#: ../../library/math.rst:404 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:407 +#: ../../library/math.rst:406 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:411 +#: ../../library/math.rst:410 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:417 +#: ../../library/math.rst:416 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:418 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:420 +#: ../../library/math.rst:419 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:421 +#: ../../library/math.rst:420 msgid "If *x* is a positive infinity, return *x*." msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:422 +#: ../../library/math.rst:421 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:425 +#: ../../library/math.rst:424 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:428 +#: ../../library/math.rst:427 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:432 +#: ../../library/math.rst:431 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:434 +#: ../../library/math.rst:433 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:441 +#: ../../library/math.rst:440 msgid "Power, exponential and logarithmic functions" msgstr "" -#: ../../library/math.rst:445 +#: ../../library/math.rst:444 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:452 +#: ../../library/math.rst:451 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:459 +#: ../../library/math.rst:458 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:466 +#: ../../library/math.rst:465 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -1056,41 +1053,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:483 +#: ../../library/math.rst:482 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:485 +#: ../../library/math.rst:484 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:491 +#: ../../library/math.rst:490 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:497 +#: ../../library/math.rst:496 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:504 +#: ../../library/math.rst:503 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:510 +#: ../../library/math.rst:509 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:516 +#: ../../library/math.rst:515 msgid "" "Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " "standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " @@ -1099,44 +1096,44 @@ msgid "" "y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:523 +#: ../../library/math.rst:522 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:526 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:535 +#: ../../library/math.rst:534 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:539 +#: ../../library/math.rst:538 msgid "Summation and product functions" msgstr "" -#: ../../library/math.rst:543 +#: ../../library/math.rst:542 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:547 ../../library/math.rst:608 +#: ../../library/math.rst:546 ../../library/math.rst:607 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:548 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:556 +#: ../../library/math.rst:555 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -1144,7 +1141,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:559 +#: ../../library/math.rst:558 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -1156,7 +1153,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:565 +#: ../../library/math.rst:564 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:572 +#: ../../library/math.rst:571 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:576 +#: ../../library/math.rst:575 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:580 +#: ../../library/math.rst:579 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:584 +#: ../../library/math.rst:583 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:592 +#: ../../library/math.rst:591 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:595 +#: ../../library/math.rst:594 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:604 +#: ../../library/math.rst:603 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:606 +#: ../../library/math.rst:605 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:610 +#: ../../library/math.rst:609 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:612 +#: ../../library/math.rst:611 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:619 +#: ../../library/math.rst:618 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:623 +#: ../../library/math.rst:622 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:628 +#: ../../library/math.rst:627 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:632 +#: ../../library/math.rst:631 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:636 +#: ../../library/math.rst:635 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:642 +#: ../../library/math.rst:641 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:648 +#: ../../library/math.rst:647 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:654 +#: ../../library/math.rst:653 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -1268,78 +1265,78 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:664 +#: ../../library/math.rst:663 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:669 +#: ../../library/math.rst:668 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:674 +#: ../../library/math.rst:673 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:678 +#: ../../library/math.rst:677 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:680 +#: ../../library/math.rst:679 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:686 +#: ../../library/math.rst:685 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:691 +#: ../../library/math.rst:690 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:696 +#: ../../library/math.rst:695 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:701 +#: ../../library/math.rst:700 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:706 +#: ../../library/math.rst:705 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:711 +#: ../../library/math.rst:710 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:715 +#: ../../library/math.rst:714 msgid "Special functions" msgstr "特殊函式" -#: ../../library/math.rst:719 +#: ../../library/math.rst:718 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:722 +#: ../../library/math.rst:721 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:726 +#: ../../library/math.rst:725 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:735 +#: ../../library/math.rst:734 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -1348,31 +1345,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:746 +#: ../../library/math.rst:745 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:754 +#: ../../library/math.rst:753 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:761 +#: ../../library/math.rst:760 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:765 +#: ../../library/math.rst:764 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:770 +#: ../../library/math.rst:769 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:775 +#: ../../library/math.rst:774 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -1381,13 +1378,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:786 +#: ../../library/math.rst:785 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:794 +#: ../../library/math.rst:793 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along " -"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " -"for some examples of how to use :class:`Mock`, :class:`MagicMock` " -"and :func:`patch`." +"module and class level attributes within the scope of a test, along with :" +"const:`sentinel` for creating unique objects. See the `quick guide`_ for " +"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" +"`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" -"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " -"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" +"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" +"`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" -"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " -"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " -"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" -"式)都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" +"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " +"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" +"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" +"都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't " -"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't callable: :class:" +"`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" -"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" +"`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" -"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" +"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" -"發 :exc:`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) " -"then :attr:`~object.__class__` returns the class of the spec object. This " -"allows mocks to pass :func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." +"__class__` returns the class of the spec object. This allows mocks to pass :" +"func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那" -"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" -"過 :func:`isinstance` 測試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." +"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" +"試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" -"發 :exc:`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See " -"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See the :" +"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " -"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" +"`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise " -"an :exc:`AttributeError`)." +"to access an attribute that doesn't exist will raise an :exc:" +"`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" -"發 :exc:`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" +"`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See " -"the :meth:`configure_mock` method for details." +"used to set attributes on the mock after it is created. See the :meth:" +"`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, " -"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " -"only pass if the call is the most recent one, and in the case " -"of :meth:`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, unlike :meth:" +"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " +"the call is the most recent one, and in the case of :meth:" +"`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " -"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" -"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" +"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" +"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. " -"The :attr:`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. The :attr:" +"`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -553,9 +553,9 @@ msgstr "" #: ../../library/unittest.mock.rst:441 msgid "" -"Note that :meth:`reset_mock` *doesn't* clear " -"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -"have set using normal assignment by default." +"Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" +"`side_effect` or any child attributes you have set using normal assignment " +"by default." msgstr "" #: ../../library/unittest.mock.rst:445 @@ -581,8 +581,8 @@ msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" #: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` " -"and :attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" +"attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " @@ -679,17 +679,17 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" -"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" -"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" -"(從 :attr:`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" +"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" +"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" +"`return_value` 得到)。" #: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock " -"(:data:`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock (:data:" +"`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" @@ -737,15 +737,14 @@ msgstr "" #: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the " -"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " -"are :data:`call` objects. These are tuples, so they can be unpacked to get " -"at the individual arguments and make more complex assertions. " -"See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" +"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " +"are tuples, so they can be unpacked to get at the individual arguments and " +"make more complex assertions. See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` " -"和 :attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解" -"包以取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" #: ../../library/unittest.mock.rst:678 @@ -757,8 +756,8 @@ msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare " -"with :attr:`call_args_list`." +"used for conveniently constructing lists of calls to compare with :attr:" +"`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" @@ -829,8 +828,8 @@ msgstr "" #: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass " -"an :func:`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" +"`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" @@ -849,13 +848,13 @@ msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" -"過 :func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" +"func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. " -"See :ref:`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. See :ref:" +"`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" @@ -867,9 +866,9 @@ msgid "" "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" -"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" -"字引數用於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" +"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" +"於配置 mock 的屬性:" #: ../../library/unittest.mock.rst:810 msgid "" @@ -911,15 +910,15 @@ msgstr "" #: ../../library/unittest.mock.rst:838 msgid "" -"This applies " -"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " -"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " -"apply to method calls on the mock object." +"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." +"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." +"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " +"calls on the mock object." msgstr "" -"這適用" -"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " -"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " -"mock 物件的方法呼叫。" +"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." +"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." +"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" +"呼叫。" #: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." @@ -929,14 +928,14 @@ msgstr "" #: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or " -"other :term:`descriptor`, on a class. :class:`PropertyMock` " -"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " -"can specify a return value when it is fetched." +"A mock intended to be used as a :class:`property`, or other :term:" +"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." +"__get__` and :meth:`~object.__set__` methods so you can specify a return " +"value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " -"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " -"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" +"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." +"__set__` 方法,因此你可以在它被提取時指定回傳值。" #: ../../library/unittest.mock.rst:854 msgid "" @@ -986,9 +985,9 @@ msgstr "" #: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach " -"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " -"mock type object::" +"Because of the way mock attributes are stored you can't directly attach a :" +"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " +"type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" @@ -1091,18 +1090,18 @@ msgstr "" #: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " -"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " -"will automatically detect the synchronous functions and set them " -"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " -"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " -"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" +"`AsyncMock` to a class with asynchronous and synchronous functions will " +"automatically detect the synchronous functions and set them as :class:" +"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " +"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " +"functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" -"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " -"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " -"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" +"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" +"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" +"有非同步函式將被設定為 :class:`AsyncMock`。" #: ../../library/unittest.mock.rst:968 msgid "" @@ -1132,8 +1131,8 @@ msgstr "斷言 mock 曾經被使用指定的引數等待過。" #: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. " -"The :attr:`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. The :attr:" +"`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" @@ -1151,8 +1150,8 @@ msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" -"在 :attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" +"attr:`await_args_list` 中。" #: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." @@ -1160,11 +1159,11 @@ msgstr "斷言 mock 從未被等待。" #: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " -"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" +"`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " -"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" +"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" #: ../../library/unittest.mock.rst:1092 msgid "" @@ -1174,8 +1173,8 @@ msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" #: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same " -"as :attr:`Mock.call_args`." +"that the mock was last awaited with. Functions the same as :attr:`Mock." +"call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" @@ -1191,9 +1190,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. " -"The :class:`ThreadingMock` object provides extra methods to wait for a call " -"to be invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." msgstr "" #: ../../library/unittest.mock.rst:1149 @@ -1205,8 +1204,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by " -"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." msgstr "" #: ../../library/unittest.mock.rst:1156 @@ -1226,14 +1225,14 @@ msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises " -"an :exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." msgstr "" #: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances " -"of :class:`ThreadingMock`." +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." msgstr "" #: ../../library/unittest.mock.rst:1189 @@ -1242,11 +1241,11 @@ msgstr "呼叫" #: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as " -"the :attr:`~Mock.return_value` attribute. The default return value is a new " -"Mock object; it is created the first time the return value is accessed " -"(either explicitly or by calling the Mock) - but it is stored and the same " -"one returned each time." +"Mock objects are callable. The call will return the value set as the :attr:" +"`~Mock.return_value` attribute. The default return value is a new Mock " +"object; it is created the first time the return value is accessed (either " +"explicitly or by calling the Mock) - but it is stored and the same one " +"returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" @@ -1254,11 +1253,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes " -"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes like :attr:" +"`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " -"和 :attr:`~Mock.call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." +"call_args_list` 等屬性中。" #: ../../library/unittest.mock.rst:1200 msgid "" @@ -1271,8 +1270,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to " -"make :attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to make :" +"attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" @@ -1296,8 +1295,8 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" -"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." +"return_value`,或回傳 :data:`DEFAULT`:" #: ../../library/unittest.mock.rst:1257 msgid "" @@ -1372,8 +1371,8 @@ msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" -"發 :exc:`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" @@ -1383,8 +1382,8 @@ msgstr "Mock 名稱與名稱屬性" msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to " -"use :meth:`~Mock.configure_mock`::" +"creation time. There are two alternatives. One option is to use :meth:`~Mock." +"configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" @@ -1447,8 +1446,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use " -"the :meth:`~Mock.attach_mock` method::" +"attach mocks that have names to a parent you use the :meth:`~Mock." +"attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" @@ -1490,10 +1489,10 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" -"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" -"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" -"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" +"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" +"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" +"術方法的支援,請參閱\\ :ref:`魔術方法 `。" #: ../../library/unittest.mock.rst:1408 msgid "The patchers" @@ -1540,11 +1539,10 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" -"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" -"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" -"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" -"傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" +"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" +"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" +"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" #: ../../library/unittest.mock.rst:1438 msgid "" @@ -1555,14 +1553,14 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" -"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" -"飾器作用時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" +"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" +"時 (decoration time)。" #: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to " -"the :class:`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to the :class:" +"`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" @@ -1578,9 +1576,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By " -"default :class:`AsyncMock` is used for async functions " -"and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By default :class:" +"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" @@ -1594,15 +1591,15 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See " -"the :func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See the :" +"func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" -"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" +"`create_autospec` 函式和 :ref:`auto-speccing`。" #: ../../library/unittest.mock.rst:1464 msgid "" @@ -1641,10 +1638,10 @@ msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with " -"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " -"way :mod:`unittest` finds tests. You can specify an alternative prefix by " -"setting ``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with ``patch." +"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" +"`unittest` finds tests. You can specify an alternative prefix by setting " +"``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1665,9 +1662,9 @@ msgstr "" #: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed " -"to :class:`AsyncMock` if the patched object is asynchronous, " -"to :class:`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed to :" +"class:`AsyncMock` if the patched object is asynchronous, to :class:" +"`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" @@ -1707,18 +1704,18 @@ msgstr "" #: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be " -"the :attr:`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be the :attr:" +"`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock " -"的 :attr:`~Mock.return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." +"return_value`。" #: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could " -"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " -"you can set the *return_value* to be anything you want." +"If the class is instantiated multiple times you could use :attr:`~Mock." +"side_effect` to return a new mock each time. Alternatively you can set the " +"*return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" @@ -1728,8 +1725,8 @@ msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" -"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." +"return_value` 上進行配置。例如: ::" #: ../../library/unittest.mock.rst:1521 msgid "" @@ -1870,16 +1867,16 @@ msgstr "" #: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like " -"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " -"can also be configured. These aren't syntactically valid to pass in directly " -"as keyword arguments, but a dictionary with these as keys can still be " -"expanded into a :func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like the :attr:`~Mock." +"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " +"configured. These aren't syntactically valid to pass in directly as keyword " +"arguments, but a dictionary with these as keys can still be expanded into a :" +"func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock " -"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" -"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" -"個 :func:`patch` 呼叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." +"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" +"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" +"叫: ::" #: ../../library/unittest.mock.rst:1586 msgid "" @@ -1906,8 +1903,8 @@ msgstr "" #: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail " -"with :exc:`AttributeError`::" +"attribute in a class) that does not exist will fail with :exc:" +"`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" @@ -1979,19 +1976,19 @@ msgstr "" msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. " -"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " -"for configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" +"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " +"configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" -"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " +"接受任意關鍵字引數來配置它所建立的 mock 物件。" #: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2081,9 +2078,8 @@ msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝 #: ../../library/unittest.mock.rst:1698 msgid "" -"When used as a class decorator :func:`patch.dict` honours " -"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " -"wrap:" +"When used as a class decorator :func:`patch.dict` honours ``patch." +"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" @@ -2118,14 +2114,15 @@ msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic " -"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " -"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." +"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." +"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." +"__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" -"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " -"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" +"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." +"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." +"__contains__`。" #: ../../library/unittest.mock.rst:1774 msgid "patch.multiple" @@ -2152,12 +2149,12 @@ msgstr "" msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned " -"when :func:`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned when :func:" +"`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" -"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" +"func:`patch.multiple` 作為情境管理器時會回傳字典。" #: ../../library/unittest.mock.rst:1790 msgid "" @@ -2167,14 +2164,14 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" -"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" -"由 :func:`patch.multiple` 完成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" +"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" +"成的\\ *所有* patch。" #: ../../library/unittest.mock.rst:1795 msgid "" -"When used as a class decorator :func:`patch.multiple` honours " -"``patch.TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours ``patch." +"TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" @@ -2186,9 +2183,9 @@ msgid "" "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" -"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" -"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" +"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " +"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" #: ../../library/unittest.mock.rst:1802 msgid "" @@ -2289,9 +2286,9 @@ msgid "" "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " -"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" -"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" +"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" +"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" #: ../../library/unittest.mock.rst:1848 msgid "" @@ -2371,8 +2368,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not " -"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" +"`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -2408,8 +2405,8 @@ msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的 #: ../../library/unittest.mock.rst:1902 msgid "" -"It is also possible to stop all patches which have been started by " -"using :func:`patch.stopall`." +"It is also possible to stop all patches which have been started by using :" +"func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" #: ../../library/unittest.mock.rst:1907 @@ -2457,14 +2454,14 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" -"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" +"`unittest.TestLoader` 預設尋找測試方法的方式相同。" #: ../../library/unittest.mock.rst:1936 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting " -"``patch.TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting ``patch." +"TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" @@ -2579,10 +2576,10 @@ msgstr "" msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do when it imports ``SomeClass`` from module a. If we " -"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " -"our test; module b already has a reference to the *real* ``SomeClass`` and " -"it looks like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we use :func:" +"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " +"module b already has a reference to the *real* ``SomeClass`` and it looks " +"like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2608,10 +2605,10 @@ msgstr "@patch('b.SomeClass')" #: ../../library/unittest.mock.rst:2021 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses " -"``a.SomeClass``. Both of these import forms are common. In this case the " -"class we want to patch is being looked up in the module and so we have to " -"patch ``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." +"SomeClass``. Both of these import forms are common. In this case the class " +"we want to patch is being looked up in the module and so we have to patch " +"``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " @@ -2631,14 +2628,14 @@ msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" #: ../../library/unittest.mock.rst:2040 @@ -2651,9 +2648,9 @@ msgstr "Mock 魔術方法" #: ../../library/unittest.mock.rst:2047 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known " -"as :term:`\"magic methods\" `. This allows mock objects to " -"replace containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known as :" +"term:`\"magic methods\" `. This allows mock objects to replace " +"containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" @@ -2680,8 +2677,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2079 msgid "" -"One use case for this is for mocking objects used as context managers in " -"a :keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in a :" +"keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" #: ../../library/unittest.mock.rst:2091 @@ -2689,14 +2686,14 @@ msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" -"在 :attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" +"attr:`~Mock.mock_calls` 內。" #: ../../library/unittest.mock.rst:2096 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise " -"an :exc:`AttributeError`." +"set a magic method that isn't in the spec will raise an :exc:" +"`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" @@ -2821,11 +2818,11 @@ msgstr "Magic Mock" #: ../../library/unittest.mock.rst:2141 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` " -"and :class:`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" +"`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` " -"和 :class:`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" +"`NonCallableMagicMock`。" #: ../../library/unittest.mock.rst:2146 msgid "" @@ -2960,13 +2957,13 @@ msgstr "舉例來說:" #: ../../library/unittest.mock.rst:2212 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using " -"the :attr:`~Mock.side_effect` attribute, unless you change their return " -"value to return something else::" +"They do the default equality comparison on identity, using the :attr:`~Mock." +"side_effect` attribute, unless you change their return value to return " +"something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" -"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" -"你變更它們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" +"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" +"們的回傳值以回傳其他內容: ::" #: ../../library/unittest.mock.rst:2217 msgid "" @@ -3090,8 +3087,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2284 msgid "" -"The ``sentinel`` attributes now preserve their identity when they " -"are :mod:`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they are :mod:" +"`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" @@ -3109,8 +3106,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2293 msgid "" -"In this example we monkey patch ``method`` to return " -"``sentinel.some_object``:" +"In this example we monkey patch ``method`` to return ``sentinel." +"some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" @@ -3120,13 +3117,13 @@ msgstr "DEFAULT" #: ../../library/unittest.mock.rst:2310 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually " -"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " -"to indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." +"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " +"indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " -"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" -"正常的回傳值應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." +"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" +"應該被使用。" #: ../../library/unittest.mock.rst:2316 msgid "call" @@ -3135,13 +3132,14 @@ msgstr "call" #: ../../library/unittest.mock.rst:2320 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " -"and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." +"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " -"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" -"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." +"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" +"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" +"起使用。" #: ../../library/unittest.mock.rst:2333 msgid "" @@ -3173,24 +3171,22 @@ msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in " -"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " -"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " -"individual arguments they contain." +"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." +"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " +"to get at the individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " -"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" -"個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." +"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" #: ../../library/unittest.mock.rst:2366 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` " -"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " -"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " -"ones you construct yourself, are three-tuples of (name, positional args, " -"keyword args)." +"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." +"call_args_list` are two-tuples of (positional args, keyword args) whereas " +"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " +"construct yourself, are three-tuples of (name, positional args, keyword " +"args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" @@ -3229,8 +3225,8 @@ msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" -"發 :exc:`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" +"`AttributeError`。" #: ../../library/unittest.mock.rst:2418 msgid "" @@ -3253,8 +3249,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2426 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing " -"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" +"`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" @@ -3264,8 +3260,8 @@ msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" -"個 :class:`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" +"`AsyncMock`。" #: ../../library/unittest.mock.rst:2437 msgid "ANY" @@ -3284,18 +3280,17 @@ msgstr "" #: ../../library/unittest.mock.rst:2446 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` " -"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " -"was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." +"assert_called_once_with` will then succeed no matter what was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` " -"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." +"assert_used_once_with` 的呼叫都會成功。" #: ../../library/unittest.mock.rst:2455 msgid "" -":data:`ANY` can also be used in comparisons with call lists " -"like :attr:`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists like :attr:" +"`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" @@ -3328,8 +3323,8 @@ msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set " -"``mock.FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set ``mock." +"FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" @@ -3431,8 +3426,8 @@ msgid "" "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" -"慮 :const:`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" +"`FILTER_DIR`。" #: ../../library/unittest.mock.rst:2540 msgid "mock_open" @@ -3457,25 +3452,23 @@ msgstr "" #: ../../library/unittest.mock.rst:2551 msgid "" -"*read_data* is a string for " -"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " -"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " -"Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方" -"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " -"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " -"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," -"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," -"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" -"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" -"案系統。" +"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." +"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " +"handle to return. Calls to those methods will take data from *read_data* " +"until it is depleted. The mock of these methods is pretty simplistic: every " +"time the *mock* is called, the *read_data* is rewound to the start. If you " +"need more control over the data that you are feeding to the tested code you " +"will need to customize this mock for yourself. When that is insufficient, " +"one of the in-memory filesystem packages on `PyPI `_ can " +"offer a realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." +"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " +"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " +"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" +"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" +"試的真實檔案系統。" #: ../../library/unittest.mock.rst:2561 msgid "" @@ -3483,9 +3476,9 @@ msgid "" "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" -"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" -"叫時回傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" +"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" +"傳它。" #: ../../library/unittest.mock.rst:2566 msgid "*read_data* is now reset on each call to the *mock*." @@ -3518,8 +3511,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2579 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and " -"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and has :meth:`~object." +"__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" @@ -3593,8 +3586,8 @@ msgid "" "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise " -"a :exc:`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise a :exc:" +"`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" @@ -3654,10 +3647,11 @@ msgid "" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" #: ../../library/unittest.mock.rst:2654 +#, fuzzy msgid "" -">>> mock.has_data()\n" +">>> mock.header_items()\n" "\n" -">>> mock.has_data.assret_called_with() # Intentional typo!" +">>> mock.header_items.assret_called_with() # Intentional typo!" msgstr "" ">>> mock.has_data()\n" "\n" @@ -3665,8 +3659,8 @@ msgstr "" #: ../../library/unittest.mock.rst:2660 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` " -"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" +"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3674,12 +3668,12 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" -"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" -"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" -"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" -"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" -"用的模組)一起使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" +"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" +"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" +"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" +"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" +"使用,而不會過於影響性能。" #: ../../library/unittest.mock.rst:2669 msgid "Here's an example of it in use::" @@ -3705,9 +3699,9 @@ msgstr "" #: ../../library/unittest.mock.rst:2679 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!" -"request.Request` takes two arguments in the constructor (one of which is " -"*self*). Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!request." +"Request` takes two arguments in the constructor (one of which is *self*). " +"Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" @@ -3781,11 +3775,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2711 msgid "" -"As well as using *autospec* through :func:`patch` there is " -"a :func:`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is a :func:" +"`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" -"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" +"`create_autospec` 用於直接建立有自動規格的 mock:" #: ../../library/unittest.mock.rst:2719 msgid "" @@ -4027,11 +4021,11 @@ msgstr "*wraps*" #: ../../library/unittest.mock.rst:2857 msgid "" -"If all three are set, mock will return the value " -"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " -"wrapped object altogether. If any two are set, the one with the higher " -"precedence will return the value. Regardless of the order of which was set " -"first, the order of precedence remains unchanged." +"If all three are set, mock will return the value from :attr:`~Mock." +"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " +"altogether. If any two are set, the one with the higher precedence will " +"return the value. Regardless of the order of which was set first, the order " +"of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" @@ -4041,8 +4035,8 @@ msgstr "" msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, " -"ignoring :attr:`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" +"`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" @@ -4059,11 +4053,11 @@ msgstr "" #: ../../library/unittest.mock.rst:2893 msgid "" -"When :class:`Mock` wraps an object, the default value " -"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." +"return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" -"為 :data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" +"data:`DEFAULT`。" #: ../../library/unittest.mock.rst:2902 msgid "" @@ -4106,18 +4100,18 @@ msgstr "" #~ msgid "" #~ "This can be useful where you want to make a series of assertions that " -#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " -#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " -#~ "have set using normal assignment by default. In case you want to " -#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " -#~ "corresponding parameter as ``True``. Child mocks and the return value " -#~ "mock (if any) are reset as well." +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the :" +#~ "attr:`return_value`, :attr:`side_effect` or any child attributes you have " +#~ "set using normal assignment by default. In case you want to reset :attr:" +#~ "`return_value` or :attr:`side_effect`, then pass the corresponding " +#~ "parameter as ``True``. Child mocks and the return value mock (if any) are " +#~ "reset as well." #~ msgstr "" #~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" -#~ "下,:meth:`reset_mock` *不會*\\ 清" -#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" -#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" -#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" +#~ "下,:meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:" +#~ "`side_effect` 或使用普通賦值設定的任何子屬性。如果你想要重置 :attr:" +#~ "`return_value` 或 :attr:`side_effect`,則將相應的參數設置為 ``True``。" +#~ "Child mock 和回傳值 mock(如果有的話)也會被重置。" #~ msgid "*return_value*, and *side_effect* are keyword-only arguments." #~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/urllib.request.po b/library/urllib.request.po index 0e3384e9e9..be0c52f527 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-03-24 00:15+0000\n" +"POT-Creation-Date: 2025-05-13 00:15+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "The `Requests package `_ is " "recommended for a higher-level HTTP client interface." msgstr "" -"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" +"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" #: ../../library/urllib.request.rst:26 msgid "" @@ -74,8 +74,8 @@ msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" -"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一" -"個 :class:`Request` 物件。" +"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一個 :class:" +"`Request` 物件。" #: ../../library/urllib.request.rst:42 msgid "" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. " -"See :class:`~http.client.HTTPSConnection` for more details." +"describing the various SSL options. See :class:`~http.client." +"HTTPSConnection` for more details." msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`。" @@ -117,37 +117,37 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. " -"See :class:`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. See :class:" +"`urllib.response.addinfourl` for more detail on these properties." msgstr "" "這個函式總是回傳一個可作為 :term:`context manager` 使用的物件,並有著特性 " -"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參" -"見 :class:`urllib.response.addinfourl`。" +"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" +"`urllib.response.addinfourl`。" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns " -"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " -"the three new methods above, the msg attribute contains the same information " -"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " -"phrase returned by server --- instead of the response headers as it is " -"specified in the documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns a :class:`http.client." +"HTTPResponse` object slightly modified. In addition to the three new methods " +"above, the msg attribute contains the same information as the :attr:`~http." +"client.HTTPResponse.reason` attribute --- the reason phrase returned by " +"server --- instead of the response headers as it is specified in the " +"documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同" -"的 :class:`http.client.HTTPResponse` 物件。除了上述提到的三個方法外,另有 " -"msg 屬性並有著與 :attr:`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺" -"服器回傳的原因敘述 (reason phrase),而不是" -"在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" +"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同的 :class:`http.client." +"HTTPResponse` 物件。除了上述提到的三個方法外,另有 msg 屬性並有著與 :attr:" +"`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺服器回傳的原因敘述 " +"(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" +"應 headers。" #: ../../library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs and requests explicitly handled by " -"legacy :class:`URLopener` and :class:`FancyURLopener` classes, this function " -"returns a :class:`urllib.response.addinfourl` object." +"For FTP, file, and data URLs and requests explicitly handled by legacy :" +"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " +"a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " -"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" -"個 :class:`urllib.response.addinfourl` 物件。" +"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` 與 :" +"class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." +"response.addinfourl` 物件。" #: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." @@ -156,8 +156,8 @@ msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。 #: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` " -"uses :class:`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` uses :class:" +"`UnknownHandler` to ensure this never happens)." msgstr "" "請注意若沒有 handler 處理請求時,``None`` 值將會被回傳。(即使有預設的全域類" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" @@ -166,9 +166,9 @@ msgstr "" #: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is " -"set), :class:`ProxyHandler` is default installed and makes sure the requests " -"are handled through the proxy." +"environment variable like :envvar:`!http_proxy` is set), :class:" +"`ProxyHandler` is default installed and makes sure the requests are handled " +"through the proxy." msgstr "" "另外,若有偵測到代理服務的設定(例如當 ``*_proxy`` 環境變數像是::envvar:!" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" @@ -179,19 +179,19 @@ msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by " -"using :class:`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by using :class:" +"`ProxyHandler` objects." msgstr "" -"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函" -"式 :func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理" -"服務的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得" -"的,現在則可以透過 :class:`ProxyHandler` 物件來取得。" +"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函式 :" +"func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理服務" +"的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," +"現在則可以透過 :class:`ProxyHandler` 物件來取得。" #: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" -"The default opener raises an :ref:`auditing event ` " -"``urllib.Request`` with arguments ``fullurl``, ``data``, ``headers``, " -"``method`` taken from the request object." +"The default opener raises an :ref:`auditing event ` ``urllib." +"Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " +"taken from the request object." msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" @@ -202,8 +202,8 @@ msgstr "新增 *cafile* 與 *capath*。" #: ../../library/urllib.request.rst:100 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, " -"if :const:`ssl.HAS_SNI` is true)." +"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." +"HAS_SNI` is true)." msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" @@ -222,13 +222,13 @@ msgstr "*context* 被新增。" #: ../../library/urllib.request.rst:111 msgid "" -"HTTPS connection now send an ALPN extension with protocol indicator ``http/" -"1.1`` when no *context* is given. Custom *context* should set ALPN protocols " -"with :meth:`~ssl.SSLContext.set_alpn_protocols`." +"HTTPS connection now send an ALPN extension with protocol indicator " +"``http/1.1`` when no *context* is given. Custom *context* should set ALPN " +"protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 ``http/" -"1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利" -"用 :meth:`~ssl.SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" +"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 " +"``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." +"SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" #: ../../library/urllib.request.rst:116 msgid "" @@ -240,16 +240,15 @@ msgstr "" msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " -"of :func:`~urllib.request.urlopen`. The code does not check for a " -"real :class:`OpenerDirector`, and any class with the appropriate interface " -"will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" +"`~urllib.request.urlopen`. The code does not check for a real :class:" +"`OpenerDirector`, and any class with the appropriate interface will work." msgstr "" "安裝一個 :class:`OpenerDirector` 實例作為預設的全域 opener。僅在當你想要讓 " -"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼" -"叫 :meth:`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不" -"會檢查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 " -"class 都能適用。" +"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼叫 :meth:" +"`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不會檢查 " +"class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" +"用。" #: ../../library/urllib.request.rst:133 msgid "" @@ -259,15 +258,19 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are " -"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`HTTPErrorProcessor`." +"(if proxy settings are detected), :class:`UnknownHandler`, :class:" +"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" +"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" +"`HTTPErrorProcessor`." msgstr "" "回傳一個 :class:`OpenerDirector` 實例,以給定的順序把 handlers 串接起來。" "*handler*\\s 可以是 :class:`BaseHandler` 的實例,亦或是 :class:`BaseHandler` " "的 subclasses(這個情況下必須有不帶參數的建構函式能夠被呼叫)。以下 classes " "的實例順位會在 *handler*\\s 之前,除非 *handler*\\s 已經包含它們,是它們的實" "例,或是它們的 subclasses::class:`ProxyHandler`\\ (如果代理服務設定被偵測" -"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" +"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:" +"`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" +"`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" #: ../../library/urllib.request.rst:143 msgid "" @@ -287,10 +290,10 @@ msgstr "" #: ../../library/urllib.request.rst:152 msgid "" -"Convert the given local path to a ``file:`` URL. This function " -"uses :func:`~urllib.parse.quote` function to encode the path. For historical " -"reasons, the return value omits the ``file:`` scheme prefix. This example " -"shows the function being used on Windows::" +"Convert the given local path to a ``file:`` URL. This function uses :func:" +"`~urllib.parse.quote` function to encode the path. For historical reasons, " +"the return value omits the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:157 @@ -307,10 +310,10 @@ msgstr "" #: ../../library/urllib.request.rst:165 msgid "" -"Convert the given ``file:`` URL to a local path. This function " -"uses :func:`~urllib.parse.unquote` to decode the URL. For historical " -"reasons, the given value *must* omit the ``file:`` scheme prefix. This " -"example shows the function being used on Windows::" +"Convert the given ``file:`` URL to a local path. This function uses :func:" +"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " +"value *must* omit the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:170 @@ -392,11 +395,11 @@ msgstr "" #: ../../library/urllib.request.rst:214 msgid "" -"For an HTTP POST request method, *data* should be a buffer in the " -"standard :mimetype:`application/x-www-form-urlencoded` format. " -"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" -"tuples and returns an ASCII string in this format. It should be encoded to " -"bytes before being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the standard :" +"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." +"parse.urlencode` function takes a mapping or sequence of 2-tuples and " +"returns an ASCII string in this format. It should be encoded to bytes before " +"being used as the *data* parameter." msgstr "" "對於一個 HTTP POST 請求方法,*data* 應為一個標準 :mimetype:`application/x-" "www-form-urlencoded` 格式的 buffer。:func:`urllib.parse.urlencode` 方法接受一" @@ -405,10 +408,10 @@ msgstr "" #: ../../library/urllib.request.rst:220 msgid "" -"*headers* should be a dictionary, and will be treated as " -"if :meth:`add_header` was called with each key and value as arguments. This " -"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " -"a browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as if :meth:" +"`add_header` was called with each key and value as arguments. This is often " +"used to \"spoof\" the ``User-Agent`` header value, which is used by a " +"browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -419,9 +422,10 @@ msgstr "" "叫 :meth:`add_header`。經常用於「偽裝」 ``User-Agent`` header 的值,這個 " "header 是用來讓一個瀏覽器向伺服器表明自己的身分 --- 有些 HTTP 伺服器僅允許來" "自普通瀏覽器的請求,而不接受來自程式腳本的請求。例如,Mozilla Firefox 會將 " -"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/" -"2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ (在 " -"Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳送。" +"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " +"Firefox/2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ " +"(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" +"送。" #: ../../library/urllib.request.rst:231 msgid "" @@ -444,16 +448,16 @@ msgstr "" #: ../../library/urllib.request.rst:239 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to " -"``http.cookiejar.request_host(self)``. This is the host name or IP address " -"of the original request that was initiated by the user. For example, if the " -"request is for an image in an HTML document, this should be the request-host " -"of the request for the page containing the image." +"defined by :rfc:`2965`. It defaults to ``http.cookiejar." +"request_host(self)``. This is the host name or IP address of the original " +"request that was initiated by the user. For example, if the request is for " +"an image in an HTML document, this should be the request-host of the request " +"for the page containing the image." msgstr "" -"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同" -"在 :rfc:`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是" -"使用者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中" -"的一個影像,則這個屬性應為請求包含影像頁面的請求主機。" +"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同在 :rfc:" +"`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是使用者發" +"起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" +"像,則這個屬性應為請求包含影像頁面的請求主機。" #: ../../library/urllib.request.rst:247 msgid "" @@ -471,11 +475,11 @@ msgstr "" #: ../../library/urllib.request.rst:254 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in " -"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " -"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " -"Subclasses may indicate a different default method by setting " -"the :attr:`~Request.method` attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" +"`~Request.method` attribute and is used by :meth:`get_method`. The default " +"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " +"indicate a different default method by setting the :attr:`~Request.method` " +"attribute in the class itself." msgstr "" "*method* 應為一個標示 HTTP 請求方法的字串(例如:``'HEAD'``)。如果有提供值," "則會被存在 :attr:`~Request.method` 屬性中且被 :meth:`get_method` 所使用。當 " @@ -594,9 +598,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to " -"section :ref:`http-password-mgr` for information on the interface that must " -"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" +"`http-password-mgr` for information on the interface that must be " +"supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -634,9 +638,8 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to " -"section :ref:`http-password-mgr` for information on the interface that must " -"be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" +"`http-password-mgr` for information on the interface that must be supported." msgstr "" #: ../../library/urllib.request.rst:404 @@ -712,9 +715,9 @@ msgstr "" #: ../../library/urllib.request.rst:487 msgid "" -"Request.full_url is a property with setter, getter and a deleter. " -"Getting :attr:`~Request.full_url` returns the original request URL with the " -"fragment, if it was present." +"Request.full_url is a property with setter, getter and a deleter. Getting :" +"attr:`~Request.full_url` returns the original request URL with the fragment, " +"if it was present." msgstr "" #: ../../library/urllib.request.rst:493 @@ -749,8 +752,8 @@ msgstr "" #: ../../library/urllib.request.rst:519 msgid "" -"boolean, indicates whether the request is unverifiable as defined " -"by :rfc:`2965`." +"boolean, indicates whether the request is unverifiable as defined by :rfc:" +"`2965`." msgstr "" #: ../../library/urllib.request.rst:524 @@ -772,10 +775,10 @@ msgstr "" #: ../../library/urllib.request.rst:541 msgid "" -"Return a string indicating the HTTP request method. " -"If :attr:`Request.method` is not ``None``, return its value, otherwise " -"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " -"not. This is only meaningful for HTTP requests." +"Return a string indicating the HTTP request method. If :attr:`Request." +"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" +"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " +"meaningful for HTTP requests." msgstr "" #: ../../library/urllib.request.rst:546 @@ -856,10 +859,10 @@ msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for " -"example :meth:`http_response` would be the HTTP protocol response handler. " -"Also *type* should be replaced with the actual HTTP code, for " -"example :meth:`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for example :meth:" +"`http_response` would be the HTTP protocol response handler. Also *type* " +"should be replaced with the actual HTTP code, for example :meth:" +"`http_error_404` would handle HTTP 404 errors." msgstr "" #: ../../library/urllib.request.rst:631 @@ -953,27 +956,25 @@ msgstr "" #: ../../library/urllib.request.rst:689 msgid "" "Handlers with a method named like :meth:`!_open` are called to " -"handle the request. This stage ends when a handler either returns a non-" -"\\ :const:`None` value (ie. a response), or raises an exception " -"(usually :exc:`~urllib.error.URLError`). Exceptions are allowed to " -"propagate." +"handle the request. This stage ends when a handler either returns a non-\\ :" +"const:`None` value (ie. a response), or raises an exception (usually :exc:" +"`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" #: ../../library/urllib.request.rst:694 msgid "" -"In fact, the above algorithm is first tried for methods " -"named :meth:`~BaseHandler.default_open`. If all such methods " -"return :const:`None`, the algorithm is repeated for methods named " -"like :meth:`!_open`. If all such methods return :const:`None`, " -"the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods named :meth:" +"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " +"algorithm is repeated for methods named like :meth:`!_open`. If " +"all such methods return :const:`None`, the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" #: ../../library/urllib.request.rst:700 msgid "" "Note that the implementation of these methods may involve calls of the " -"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " -"and :meth:`~OpenerDirector.error` methods." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" +"meth:`~OpenerDirector.error` methods." msgstr "" #: ../../library/urllib.request.rst:704 @@ -1010,8 +1011,8 @@ msgstr "" #: ../../library/urllib.request.rst:732 msgid "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are " -"named :class:`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_request` or :meth:`!_response` methods are named :class:" +"`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" #: ../../library/urllib.request.rst:739 @@ -1028,13 +1029,12 @@ msgstr "" #: ../../library/urllib.request.rst:748 msgid "" -"This method, if implemented, will be called by the " -"parent :class:`OpenerDirector`. It should return a file-like object as " -"described in the return value of the :meth:`~OpenerDirector.open` method " -"of :class:`OpenerDirector`, or ``None``. It should " -"raise :exc:`~urllib.error.URLError`, unless a truly exceptional thing " -"happens (for example, :exc:`MemoryError` should not be mapped " -"to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the parent :class:" +"`OpenerDirector`. It should return a file-like object as described in the " +"return value of the :meth:`~OpenerDirector.open` method of :class:" +"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." +"URLError`, unless a truly exceptional thing happens (for example, :exc:" +"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" #: ../../library/urllib.request.rst:755 @@ -1049,9 +1049,9 @@ msgstr "" #: ../../library/urllib.request.rst:765 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. Return values should be the same as " -"for :meth:`~BaseHandler.default_open`." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. Return values should be the same as for :meth:" +"`~BaseHandler.default_open`." msgstr "" #: ../../library/urllib.request.rst:771 @@ -1063,18 +1063,18 @@ msgstr "" #: ../../library/urllib.request.rst:775 msgid "" -"This method, if implemented, will be called by " -"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " -"same as for :meth:`default_open`." +"This method, if implemented, will be called by the :attr:`parent` :class:" +"`OpenerDirector`. Return values should be the same as for :meth:" +"`default_open`." msgstr "" #: ../../library/urllib.request.rst:782 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by " -"the :class:`OpenerDirector` getting the error, and should not normally be " -"called in other circumstances." +"HTTP errors. It will be called automatically by the :class:" +"`OpenerDirector` getting the error, and should not normally be called in " +"other circumstances." msgstr "" #: ../../library/urllib.request.rst:787 @@ -1087,8 +1087,8 @@ msgstr "" #: ../../library/urllib.request.rst:792 msgid "" -"Return values and exceptions raised should be the same as those " -"of :func:`urlopen`." +"Return values and exceptions raised should be the same as those of :func:" +"`urlopen`." msgstr "" #: ../../library/urllib.request.rst:799 @@ -1104,8 +1104,8 @@ msgstr "" #: ../../library/urllib.request.rst:805 msgid "" -"Arguments, return values and exceptions raised should be the same as " -"for :meth:`~BaseHandler.http_error_default`." +"Arguments, return values and exceptions raised should be the same as for :" +"meth:`~BaseHandler.http_error_default`." msgstr "" #: ../../library/urllib.request.rst:813 @@ -1116,9 +1116,9 @@ msgstr "" #: ../../library/urllib.request.rst:816 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " -"return value should be a :class:`Request` object." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " +"should be a :class:`Request` object." msgstr "" #: ../../library/urllib.request.rst:825 @@ -1129,11 +1129,11 @@ msgstr "" #: ../../library/urllib.request.rst:828 msgid "" -"This method, if defined, will be called by the " -"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " -"*response* will be an object implementing the same interface as the return " -"value of :func:`urlopen`. The return value should implement the same " -"interface as the return value of :func:`urlopen`." +"This method, if defined, will be called by the parent :class:" +"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " +"be an object implementing the same interface as the return value of :func:" +"`urlopen`. The return value should implement the same interface as the " +"return value of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:838 @@ -1160,19 +1160,18 @@ msgid "" "called by the default implementations of the :meth:`!http_error_30\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " -"raise :exc:`~urllib.error.HTTPError` if no other handler should try to " -"handle this URL, or return ``None`` if you can't but another handler might." +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" +"exc:`~urllib.error.HTTPError` if no other handler should try to handle this " +"URL, or return ``None`` if you can't but another handler might." msgstr "" #: ../../library/urllib.request.rst:863 msgid "" -"The default implementation of this method does not strictly " -"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " -"requests must not be automatically redirected without confirmation by the " -"user. In reality, browsers do allow automatic redirection of these " -"responses, changing the POST to a ``GET``, and the default implementation " -"reproduces this behavior." +"The default implementation of this method does not strictly follow :rfc:" +"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " +"be automatically redirected without confirmation by the user. In reality, " +"browsers do allow automatic redirection of these responses, changing the " +"POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" #: ../../library/urllib.request.rst:872 @@ -1237,8 +1236,8 @@ msgstr "HTTPPasswordMgr 物件" #: ../../library/urllib.request.rst:935 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` " -"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` and :class:" +"`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" #: ../../library/urllib.request.rst:941 @@ -1274,10 +1273,10 @@ msgstr "" #: ../../library/urllib.request.rst:968 msgid "" -"*realm*, *uri*, *user*, *passwd* are as " -"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " -"initial value of the ``is_authenticated`` flag for the given URI or list of " -"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." +"add_password`. *is_authenticated* sets the initial value of the " +"``is_authenticated`` flag for the given URI or list of URIs. If " +"*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" #: ../../library/urllib.request.rst:976 @@ -1303,8 +1302,8 @@ msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the " -"(failed) :class:`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the (failed) :class:" +"`Request` object, and *headers* should be the error headers." msgstr "" #: ../../library/urllib.request.rst:1006 @@ -1354,8 +1353,8 @@ msgstr "HTTPHandler 物件" #: ../../library/urllib.request.rst:1078 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on " -"``req.has_data()``." +"Send an HTTP request, which can be either GET or POST, depending on ``req." +"data``." msgstr "" #: ../../library/urllib.request.rst:1085 @@ -1364,8 +1363,8 @@ msgstr "HTTPSHandler 物件" #: ../../library/urllib.request.rst:1090 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on " -"``req.has_data()``." +"Send an HTTPS request, which can be either GET or POST, depending on ``req." +"data``." msgstr "" #: ../../library/urllib.request.rst:1097 @@ -1446,8 +1445,8 @@ msgstr "" msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise " -"an :exc:`~urllib.error.HTTPError` if no other handler handles the error." +"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." +"error.HTTPError` if no other handler handles the error." msgstr "" #: ../../library/urllib.request.rst:1186 @@ -1534,8 +1533,8 @@ msgstr "" #: ../../library/urllib.request.rst:1230 msgid "" -"It is also possible to achieve the same result without using " -"the :term:`context manager` approach::" +"It is also possible to achieve the same result without using the :term:" +"`context manager` approach::" msgstr "" #: ../../library/urllib.request.rst:1233 @@ -1644,11 +1643,11 @@ msgstr "" #: ../../library/urllib.request.rst:1288 msgid "" -":func:`build_opener` provides many handlers by default, including " -"a :class:`ProxyHandler`. By default, :class:`ProxyHandler` uses the " -"environment variables named ``_proxy``, where ```` is the " -"URL scheme involved. For example, the :envvar:`!http_proxy` environment " -"variable is read to obtain the HTTP proxy's URL." +":func:`build_opener` provides many handlers by default, including a :class:" +"`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " +"variables named ``_proxy``, where ```` is the URL scheme " +"involved. For example, the :envvar:`!http_proxy` environment variable is " +"read to obtain the HTTP proxy's URL." msgstr "" #: ../../library/urllib.request.rst:1294 @@ -1660,8 +1659,8 @@ msgstr "" #: ../../library/urllib.request.rst:1298 msgid "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" -"www.example.com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." +"com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" @@ -1670,8 +1669,8 @@ msgid "" "with opener.open('http://www.example.com/login.html') as f:\n" " print(f.read().decode('utf-8'))" msgstr "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" -"www.example.com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." +"com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" @@ -1728,10 +1727,9 @@ msgstr "" #: ../../library/urllib.request.rst:1329 msgid "" -"Also, remember that a few standard headers (:mailheader:`Content-" -"Length`, :mailheader:`Content-Type` and :mailheader:`Host`) are added when " -"the :class:`Request` is passed to :func:`urlopen` " -"(or :meth:`OpenerDirector.open`)." +"Also, remember that a few standard headers (:mailheader:`Content-Length`, :" +"mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" +"`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" #: ../../library/urllib.request.rst:1336 @@ -1843,9 +1841,9 @@ msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " "Return a tuple ``(filename, headers)`` where *filename* is the local file " -"name under which the object can be found, and *headers* is whatever " -"the :meth:`!info` method of the object returned by :func:`urlopen` returned " -"(for a remote object). Exceptions are the same as for :func:`urlopen`." +"name under which the object can be found, and *headers* is whatever the :" +"meth:`!info` method of the object returned by :func:`urlopen` returned (for " +"a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:1393 @@ -1867,14 +1865,14 @@ msgstr "" #: ../../library/urllib.request.rst:1404 msgid "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://" -"python.org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://python." +"org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" msgstr "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://" -"python.org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://python." +"org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" @@ -1882,9 +1880,9 @@ msgstr "" msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must be a bytes object in " -"standard :mimetype:`application/x-www-form-urlencoded` format; see " -"the :func:`urllib.parse.urlencode` function." +"type is ``GET``). The *data* argument must be a bytes object in standard :" +"mimetype:`application/x-www-form-urlencoded` format; see the :func:`urllib." +"parse.urlencode` function." msgstr "" #: ../../library/urllib.request.rst:1415 @@ -1924,8 +1922,8 @@ msgstr "" #: ../../library/urllib.request.rst:1440 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " -"objects using schemes other than :file:`http:`, :file:`ftp:`, " -"or :file:`file:`, you probably want to use :class:`FancyURLopener`." +"objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" +"`, you probably want to use :class:`FancyURLopener`." msgstr "" #: ../../library/urllib.request.rst:1444 @@ -1965,8 +1963,8 @@ msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " "arguments. If the scheme is not recognized, :meth:`open_unknown` is called. " -"The *data* argument has the same meaning as the *data* argument " -"of :func:`urlopen`." +"The *data* argument has the same meaning as the *data* argument of :func:" +"`urlopen`." msgstr "" #: ../../library/urllib.request.rst:1471 @@ -1980,35 +1978,35 @@ msgstr "" #: ../../library/urllib.request.rst:1480 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " -"value is a tuple consisting of a local filename and either " -"an :class:`email.message.Message` object containing the response headers " -"(for remote URLs) or ``None`` (for local URLs). The caller must then open " -"and read the contents of *filename*. If *filename* is not given and the URL " -"refers to a local file, the input filename is returned. If the URL is non-" -"local and *filename* is not given, the filename is the output " -"of :func:`tempfile.mktemp` with a suffix that matches the suffix of the last " -"path component of the input URL. If *reporthook* is given, it must be a " -"function accepting three numeric parameters: A chunk number, the maximum " -"size chunks are read in and the total size of the download (-1 if unknown). " -"It will be called once at the start and after each chunk of data is read " -"from the network. *reporthook* is ignored for local URLs." +"value is a tuple consisting of a local filename and either an :class:`email." +"message.Message` object containing the response headers (for remote URLs) or " +"``None`` (for local URLs). The caller must then open and read the contents " +"of *filename*. If *filename* is not given and the URL refers to a local " +"file, the input filename is returned. If the URL is non-local and " +"*filename* is not given, the filename is the output of :func:`tempfile." +"mktemp` with a suffix that matches the suffix of the last path component of " +"the input URL. If *reporthook* is given, it must be a function accepting " +"three numeric parameters: A chunk number, the maximum size chunks are read " +"in and the total size of the download (-1 if unknown). It will be called " +"once at the start and after each chunk of data is read from the network. " +"*reporthook* is ignored for local URLs." msgstr "" #: ../../library/urllib.request.rst:1493 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must in " -"standard :mimetype:`application/x-www-form-urlencoded` format; see " -"the :func:`urllib.parse.urlencode` function." +"type is ``GET``). The *data* argument must in standard :mimetype:" +"`application/x-www-form-urlencoded` format; see the :func:`urllib.parse." +"urlencode` function." msgstr "" #: ../../library/urllib.request.rst:1502 msgid "" -"Variable that specifies the user agent of the opener object. To " -"get :mod:`urllib` to tell servers that it is a particular user agent, set " -"this in a subclass as a class variable or in the constructor before calling " -"the base constructor." +"Variable that specifies the user agent of the opener object. To get :mod:" +"`urllib` to tell servers that it is a particular user agent, set this in a " +"subclass as a class variable or in the constructor before calling the base " +"constructor." msgstr "" #: ../../library/urllib.request.rst:1512 @@ -2024,9 +2022,9 @@ msgstr "" #: ../../library/urllib.request.rst:1519 msgid "" -"For all other response codes, the " -"method :meth:`~BaseHandler.http_error_default` is called which you can " -"override in subclasses to handle the error appropriately." +"For all other response codes, the method :meth:`~BaseHandler." +"http_error_default` is called which you can override in subclasses to handle " +"the error appropriately." msgstr "" #: ../../library/urllib.request.rst:1524 @@ -2040,8 +2038,8 @@ msgstr "" #: ../../library/urllib.request.rst:1529 msgid "" -"The parameters to the constructor are the same as those " -"for :class:`URLopener`." +"The parameters to the constructor are the same as those for :class:" +"`URLopener`." msgstr "" #: ../../library/urllib.request.rst:1533 @@ -2118,9 +2116,9 @@ msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " "text or (for example) HTML. The HTTP protocol provides type information in " -"the reply header, which can be inspected by looking at " -"the :mailheader:`Content-Type` header. If the returned data is HTML, you " -"can use the module :mod:`html.parser` to parse it." +"the reply header, which can be inspected by looking at the :mailheader:" +"`Content-Type` header. If the returned data is HTML, you can use the " +"module :mod:`html.parser` to parse it." msgstr "" #: ../../library/urllib.request.rst:1591 @@ -2149,9 +2147,9 @@ msgstr "" msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " -"Functions defined by this module are used internally by " -"the :mod:`urllib.request` module. The typical response object is " -"a :class:`urllib.response.addinfourl` instance:" +"Functions defined by this module are used internally by the :mod:`urllib." +"request` module. The typical response object is a :class:`urllib.response." +"addinfourl` instance:" msgstr "" #: ../../library/urllib.request.rst:1622 @@ -2162,8 +2160,8 @@ msgstr "" #: ../../library/urllib.request.rst:1626 msgid "" -"Returns the headers of the response in the form of " -"an :class:`~email.message.EmailMessage` instance." +"Returns the headers of the response in the form of an :class:`~email.message." +"EmailMessage` instance." msgstr "" #: ../../library/urllib.request.rst:1632 @@ -2204,8 +2202,8 @@ msgstr "HTML" #~ "... print(f.read(300))\n" #~ "...\n" #~ "b'\\n\\n\\n\\n\\n\\n\\n\\n\\n\n" #~ "\\n\\n\\n\\n\\n\\n\\n\\n\\n\n" #~ " Date: Wed, 14 May 2025 00:16:38 +0000 Subject: [PATCH 3/3] sync with cpython 78a04b33 --- c-api/unicode.po | 371 ++++++++++++++++++++++++----------------------- 1 file changed, 190 insertions(+), 181 deletions(-) diff --git a/c-api/unicode.po b/c-api/unicode.po index f29bafb0e6..ac345f6a7c 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-04-30 00:15+0000\n" +"POT-Creation-Date: 2025-05-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -866,25 +866,34 @@ msgstr "" #: ../../c-api/unicode.rst:626 msgid "" +"Return a mapping suitable for decoding a custom single-byte encoding. Given " +"a Unicode string *string* of up to 256 characters representing an encoding " +"table, returns either a compact internal mapping object or a dictionary " +"mapping character ordinals to byte values. Raises a :exc:`TypeError` and " +"return ``NULL`` on invalid input. .. versionadded:: 3.2" +msgstr "" + +#: ../../c-api/unicode.rst:636 +msgid "" "Return the name of the default string encoding, ``\"utf-8\"``. See :func:" "`sys.getdefaultencoding`." msgstr "" -#: ../../c-api/unicode.rst:629 +#: ../../c-api/unicode.rst:639 msgid "" "The returned string does not need to be freed, and is valid until " "interpreter shutdown." msgstr "" -#: ../../c-api/unicode.rst:635 +#: ../../c-api/unicode.rst:645 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:637 +#: ../../c-api/unicode.rst:647 msgid "On error, set an exception and return ``-1``." msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:648 +#: ../../c-api/unicode.rst:658 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -892,61 +901,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:659 +#: ../../c-api/unicode.rst:669 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:662 +#: ../../c-api/unicode.rst:672 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:665 +#: ../../c-api/unicode.rst:675 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:674 +#: ../../c-api/unicode.rst:684 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:678 +#: ../../c-api/unicode.rst:688 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:682 +#: ../../c-api/unicode.rst:692 msgid "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:689 +#: ../../c-api/unicode.rst:699 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:693 +#: ../../c-api/unicode.rst:703 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:701 +#: ../../c-api/unicode.rst:711 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:711 +#: ../../c-api/unicode.rst:721 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -954,7 +963,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:731 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -962,17 +971,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:730 +#: ../../c-api/unicode.rst:740 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:732 +#: ../../c-api/unicode.rst:742 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:749 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -981,21 +990,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:746 +#: ../../c-api/unicode.rst:756 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:749 ../../c-api/unicode.rst:784 +#: ../../c-api/unicode.rst:759 ../../c-api/unicode.rst:794 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "此函式會忽略 :ref:`Python UTF-8 模式 `。" -#: ../../c-api/unicode.rst:753 ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:763 ../../c-api/unicode.rst:879 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:757 +#: ../../c-api/unicode.rst:767 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -1003,7 +1012,7 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:766 +#: ../../c-api/unicode.rst:776 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." @@ -1011,7 +1020,7 @@ msgstr "" "類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" "字串長度。" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:784 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -1020,17 +1029,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:781 +#: ../../c-api/unicode.rst:791 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:788 ../../c-api/unicode.rst:900 +#: ../../c-api/unicode.rst:798 ../../c-api/unicode.rst:910 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:792 +#: ../../c-api/unicode.rst:802 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -1038,24 +1047,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:801 +#: ../../c-api/unicode.rst:811 msgid "File System Encoding" msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:803 +#: ../../c-api/unicode.rst:813 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:806 +#: ../../c-api/unicode.rst:816 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:812 +#: ../../c-api/unicode.rst:822 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " "-- obtained directly or through the :class:`os.PathLike` interface -- to :" @@ -1068,24 +1077,24 @@ msgid "" "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:824 +#: ../../c-api/unicode.rst:834 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:829 ../../c-api/unicode.rst:856 +#: ../../c-api/unicode.rst:839 ../../c-api/unicode.rst:866 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:842 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:848 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " @@ -1099,63 +1108,63 @@ msgid "" "result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:851 +#: ../../c-api/unicode.rst:861 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:862 +#: ../../c-api/unicode.rst:872 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:864 +#: ../../c-api/unicode.rst:874 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:871 ../../c-api/unicode.rst:884 -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:881 ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:914 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:888 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:881 +#: ../../c-api/unicode.rst:891 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:901 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:895 +#: ../../c-api/unicode.rst:905 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:909 +#: ../../c-api/unicode.rst:919 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:911 +#: ../../c-api/unicode.rst:921 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:915 +#: ../../c-api/unicode.rst:925 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1163,7 +1172,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:933 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1171,13 +1180,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:928 +#: ../../c-api/unicode.rst:938 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:931 +#: ../../c-api/unicode.rst:941 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1187,7 +1196,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:951 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1198,37 +1207,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:949 +#: ../../c-api/unicode.rst:959 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:956 +#: ../../c-api/unicode.rst:966 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:964 +#: ../../c-api/unicode.rst:974 msgid "Built-in Codecs" msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:966 +#: ../../c-api/unicode.rst:976 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:979 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:973 +#: ../../c-api/unicode.rst:983 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1236,28 +1245,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:978 +#: ../../c-api/unicode.rst:988 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:982 +#: ../../c-api/unicode.rst:992 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:987 +#: ../../c-api/unicode.rst:997 msgid "Generic Codecs" msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:999 msgid "These are the generic codec APIs:" msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:995 +#: ../../c-api/unicode.rst:1005 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1266,7 +1275,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1015 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1275,21 +1284,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1013 +#: ../../c-api/unicode.rst:1023 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:1015 +#: ../../c-api/unicode.rst:1025 msgid "These are the UTF-8 codec APIs:" msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:1020 +#: ../../c-api/unicode.rst:1030 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1027 +#: ../../c-api/unicode.rst:1037 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1297,20 +1306,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1035 +#: ../../c-api/unicode.rst:1045 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1039 ../../c-api/unicode.rst:1054 +#: ../../c-api/unicode.rst:1049 ../../c-api/unicode.rst:1064 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1045 +#: ../../c-api/unicode.rst:1055 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1319,7 +1328,7 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1051 +#: ../../c-api/unicode.rst:1061 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." @@ -1327,7 +1336,7 @@ msgstr "" "發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " "``NULL``。" -#: ../../c-api/unicode.rst:1057 +#: ../../c-api/unicode.rst:1067 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1336,19 +1345,19 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1064 ../../c-api/unicode.rst:1086 +#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1096 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1067 +#: ../../c-api/unicode.rst:1077 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1073 +#: ../../c-api/unicode.rst:1083 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" -#: ../../c-api/unicode.rst:1077 +#: ../../c-api/unicode.rst:1087 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " @@ -1358,35 +1367,35 @@ msgid "" "c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1091 +#: ../../c-api/unicode.rst:1101 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1093 +#: ../../c-api/unicode.rst:1103 msgid "These are the UTF-32 codec APIs:" msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1099 +#: ../../c-api/unicode.rst:1109 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1103 ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1113 ../../c-api/unicode.rst:1163 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1106 ../../c-api/unicode.rst:1156 +#: ../../c-api/unicode.rst:1116 ../../c-api/unicode.rst:1166 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1120 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1394,21 +1403,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1115 +#: ../../c-api/unicode.rst:1125 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1118 ../../c-api/unicode.rst:1169 +#: ../../c-api/unicode.rst:1128 ../../c-api/unicode.rst:1179 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1120 ../../c-api/unicode.rst:1171 +#: ../../c-api/unicode.rst:1130 ../../c-api/unicode.rst:1181 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1126 +#: ../../c-api/unicode.rst:1136 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1417,29 +1426,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1135 +#: ../../c-api/unicode.rst:1145 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1141 +#: ../../c-api/unicode.rst:1151 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1143 +#: ../../c-api/unicode.rst:1153 msgid "These are the UTF-16 codec APIs:" msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1149 +#: ../../c-api/unicode.rst:1159 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1170 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1448,13 +1457,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1176 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1177 +#: ../../c-api/unicode.rst:1187 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1464,28 +1473,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1186 +#: ../../c-api/unicode.rst:1196 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1192 +#: ../../c-api/unicode.rst:1202 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1194 +#: ../../c-api/unicode.rst:1204 msgid "These are the UTF-7 codec APIs:" msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1199 +#: ../../c-api/unicode.rst:1209 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1206 +#: ../../c-api/unicode.rst:1216 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1493,101 +1502,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1213 +#: ../../c-api/unicode.rst:1223 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1225 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1221 +#: ../../c-api/unicode.rst:1231 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1227 +#: ../../c-api/unicode.rst:1237 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1233 +#: ../../c-api/unicode.rst:1243 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1245 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1241 +#: ../../c-api/unicode.rst:1251 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1247 +#: ../../c-api/unicode.rst:1257 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1253 +#: ../../c-api/unicode.rst:1263 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1265 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1261 +#: ../../c-api/unicode.rst:1271 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1267 +#: ../../c-api/unicode.rst:1277 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1273 +#: ../../c-api/unicode.rst:1283 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1285 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1281 +#: ../../c-api/unicode.rst:1291 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1287 +#: ../../c-api/unicode.rst:1297 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1293 +#: ../../c-api/unicode.rst:1303 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1295 +#: ../../c-api/unicode.rst:1305 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1597,18 +1606,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1301 +#: ../../c-api/unicode.rst:1311 msgid "These are the mapping codec APIs:" msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1306 +#: ../../c-api/unicode.rst:1316 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1310 +#: ../../c-api/unicode.rst:1320 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1618,14 +1627,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1331 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1325 +#: ../../c-api/unicode.rst:1335 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1633,41 +1642,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1331 +#: ../../c-api/unicode.rst:1341 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1345 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1339 +#: ../../c-api/unicode.rst:1349 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1342 +#: ../../c-api/unicode.rst:1352 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1346 +#: ../../c-api/unicode.rst:1356 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1351 +#: ../../c-api/unicode.rst:1361 msgid "MBCS codecs for Windows" msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1353 +#: ../../c-api/unicode.rst:1363 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1675,13 +1684,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1360 +#: ../../c-api/unicode.rst:1370 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1367 +#: ../../c-api/unicode.rst:1377 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1689,50 +1698,50 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1376 +#: ../../c-api/unicode.rst:1386 msgid "" "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " "specified by *code_page*." msgstr "" -#: ../../c-api/unicode.rst:1382 +#: ../../c-api/unicode.rst:1392 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1389 +#: ../../c-api/unicode.rst:1399 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1397 +#: ../../c-api/unicode.rst:1407 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1403 +#: ../../c-api/unicode.rst:1413 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1405 +#: ../../c-api/unicode.rst:1415 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1409 +#: ../../c-api/unicode.rst:1419 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1414 +#: ../../c-api/unicode.rst:1424 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1419 +#: ../../c-api/unicode.rst:1429 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1741,33 +1750,33 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1424 ../../c-api/unicode.rst:1434 -#: ../../c-api/unicode.rst:1455 ../../c-api/unicode.rst:1468 +#: ../../c-api/unicode.rst:1434 ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1465 ../../c-api/unicode.rst:1478 msgid "On error, return ``NULL`` with an exception set." msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" -#: ../../c-api/unicode.rst:1426 +#: ../../c-api/unicode.rst:1436 msgid "Equivalent to :py:meth:`str.split`." msgstr "等價於 :py:meth:`str.split`。" -#: ../../c-api/unicode.rst:1431 +#: ../../c-api/unicode.rst:1441 msgid "" "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " "at the end of the string." msgstr "" -#: ../../c-api/unicode.rst:1436 +#: ../../c-api/unicode.rst:1446 msgid "Equivalent to :py:meth:`str.rsplit`." msgstr "等價於 :py:meth:`str.rsplit`。" -#: ../../c-api/unicode.rst:1441 +#: ../../c-api/unicode.rst:1451 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1448 +#: ../../c-api/unicode.rst:1458 msgid "" "Split a Unicode string at the first occurrence of *sep*, and return a 3-" "tuple containing the part before the separator, the separator itself, and " @@ -1775,39 +1784,39 @@ msgid "" "tuple containing the string itself, followed by two empty strings." msgstr "" -#: ../../c-api/unicode.rst:1453 ../../c-api/unicode.rst:1466 +#: ../../c-api/unicode.rst:1463 ../../c-api/unicode.rst:1476 msgid "*sep* must not be empty." msgstr "*sep* 不得為空。" -#: ../../c-api/unicode.rst:1457 +#: ../../c-api/unicode.rst:1467 msgid "Equivalent to :py:meth:`str.partition`." msgstr "等價於 :py:meth:`str.partition`。" -#: ../../c-api/unicode.rst:1462 +#: ../../c-api/unicode.rst:1472 msgid "" "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " "last occurrence of *sep*. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" -#: ../../c-api/unicode.rst:1470 +#: ../../c-api/unicode.rst:1480 msgid "Equivalent to :py:meth:`str.rpartition`." msgstr "等價於 :py:meth:`str.rpartition`。" -#: ../../c-api/unicode.rst:1475 +#: ../../c-api/unicode.rst:1485 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1482 +#: ../../c-api/unicode.rst:1492 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1490 +#: ../../c-api/unicode.rst:1500 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1816,7 +1825,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1510 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1826,37 +1835,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1508 +#: ../../c-api/unicode.rst:1518 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1515 +#: ../../c-api/unicode.rst:1525 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1522 +#: ../../c-api/unicode.rst:1532 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1529 +#: ../../c-api/unicode.rst:1539 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1542 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1538 +#: ../../c-api/unicode.rst:1548 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1865,18 +1874,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1545 ../../c-api/unicode.rst:1566 +#: ../../c-api/unicode.rst:1555 ../../c-api/unicode.rst:1576 msgid "This function does not raise exceptions." msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1552 +#: ../../c-api/unicode.rst:1562 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1561 +#: ../../c-api/unicode.rst:1571 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1884,47 +1893,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1571 +#: ../../c-api/unicode.rst:1581 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1573 +#: ../../c-api/unicode.rst:1583 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1574 +#: ../../c-api/unicode.rst:1584 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1575 +#: ../../c-api/unicode.rst:1585 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1577 +#: ../../c-api/unicode.rst:1587 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1583 +#: ../../c-api/unicode.rst:1593 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1589 +#: ../../c-api/unicode.rst:1599 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1592 +#: ../../c-api/unicode.rst:1602 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1598 +#: ../../c-api/unicode.rst:1608 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1935,7 +1944,7 @@ msgid "" "interns it." msgstr "" -#: ../../c-api/unicode.rst:1605 +#: ../../c-api/unicode.rst:1615 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1943,39 +1952,39 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1610 +#: ../../c-api/unicode.rst:1620 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1613 +#: ../../c-api/unicode.rst:1623 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1617 +#: ../../c-api/unicode.rst:1627 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1623 +#: ../../c-api/unicode.rst:1633 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1626 +#: ../../c-api/unicode.rst:1636 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1630 +#: ../../c-api/unicode.rst:1640 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -1984,6 +1993,6 @@ msgid "" "`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1638 +#: ../../c-api/unicode.rst:1648 msgid "Strings interned this way are made :term:`immortal`." msgstr ""