diff --git a/c-api/allocation.po b/c-api/allocation.po index e8713614a1..d1b7524859 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -62,6 +62,8 @@ msgid "" "`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " "instead." msgstr "" +"注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" +"對於這種物件,請改用 :c:func:`PyObject_GC_New`。" #: ../../c-api/allocation.rst:45 msgid "" @@ -88,6 +90,8 @@ msgid "" "`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " "instead." msgstr "" +"注意,如果 *typeobj* 有 :c:macro:`Py_TPFLAGS_HAVE_GC` 設定,則此函式不適用。" +"對於這種物件,請改用 :c:func:`PyObject_GC_NewVar`。" #: ../../c-api/allocation.rst:63 msgid "" diff --git a/c-api/bool.po b/c-api/bool.po index 9a057a6678..5c1cf65dac 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -42,6 +41,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python boolean type; " "it is the same object as :class:`bool` in the Python layer." msgstr "" +"此 :c:type:`PyTypeObject` 實例代表 Python 的布林型別;它與 Python 層級中的 " +":class:`bool` 是同一個物件。" #: ../../c-api/bool.rst:22 msgid "" diff --git a/c-api/call.po b/c-api/call.po index 4f635027c2..ada203379c 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -122,6 +122,11 @@ msgid "" "versions, vectorcall should only be used with :c:macro:`immutable " "` or static types." msgstr "" +"當一個類別的 :py:meth:`~object.__call__` 方法被重新賦值時,:c:macro:" +"`Py_TPFLAGS_HAVE_VECTORCALL` 旗標現在會被移除。(這會在內部設定 :c:member:" +"`~PyTypeObject.tp_call`,因此可能會使它與 vectorcall 函式有不同的行為。)" +"在較早的 Python 版本中,vectorcall 應該只與 :c:macro:" +"`immutable ` 或靜態型別一起使用。" #: ../../c-api/call.rst:69 msgid "" diff --git a/c-api/iter.po b/c-api/iter.po index dbb2602f1d..71d9e97f69 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -87,6 +87,28 @@ msgid "" " /* continue doing useful work */\n" "}" msgstr "" +"PyObject *iterator = PyObject_GetIter(obj);\n" +"PyObject *item;\n" +"\n" +"if (iterator == NULL) {\n" +" /* 傳播錯誤 */\n" +"}\n" +"\n" +"while ((item = PyIter_Next(iterator))) {\n" +" /* 對 item 做些事情 */\n" +" ...\n" +" /* 完成後釋放參照 */\n" +" Py_DECREF(item);\n" +"}\n" +"\n" +"Py_DECREF(iterator);\n" +"\n" +"if (PyErr_Occurred()) {\n" +" /* 傳播錯誤 */\n" +"}\n" +"else {\n" +" /* 繼續做一些有用的任務 */\n" +"}" #: ../../c-api/iter.rst:59 msgid "" diff --git a/c-api/module.po b/c-api/module.po index 89ec8b6dcf..16304cac16 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -526,7 +526,7 @@ msgstr "" #: ../../c-api/module.rst:467 msgid "See :PEP:`489` for more details on multi-phase initialization." -msgstr "" +msgstr "更多關於多階段初始化的詳細資訊,請參閱 :pep:`489`。" #: ../../c-api/module.rst:470 msgid "Low-level module creation functions" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index 09e683c2bb..ee98fd31d1 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -90,6 +90,8 @@ msgid "" "# address size name\n" "7f3529fcf759 b py::bar:/run/t.py" msgstr "" +"# 位址 大小 名稱\n" +"7f3529fcf759 b py::bar:/run/t.py" #: ../../c-api/perfmaps.rst:41 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 01ae7ce871..ddee8b5b89 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -43,7 +43,7 @@ msgid "" "accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" -"件是「\\ :term:`不滅的 (immortal) `\\ 」,並且具有非常高的參照計" +"件是「:term:`不滅的 (immortal) `」,並且具有非常高的參照計" "數,不能反映實際的參照數量。因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" #: ../../c-api/refcounting.rst:24 @@ -68,6 +68,8 @@ msgid "" "On :ref:`Python build with Free Threading `, if " "*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." msgstr "" +"在\\ :ref:`啟用自由執行緒的 Python 建置 `\\ 中,如果 " +"*refcnt* 大於 ``UINT32_MAX``,則該物件會被設為\\ :term:`不滅的 (immortal) `。" #: ../../c-api/refcounting.rst:40 ../../c-api/refcounting.rst:53 #: ../../c-api/refcounting.rst:119 diff --git a/c-api/stable.po b/c-api/stable.po index a69db51911..54ff032f04 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -198,6 +198,8 @@ msgid "" "extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " "details." msgstr "" +"穩定 ABI 可以防止 ABI 問題,例如由於結構布局或函式簽名變化導致缺少符號或數據損壞的鏈接器 (linker) 錯誤。" +"然而,Python 的其他變化可能會改變 *行為* 的擴充。有關詳細信息,請參閱 Python 的向後相容性政策 (:pep:`387`)。" #: ../../c-api/stable.rst:107 msgid "" diff --git a/c-api/typehints.po b/c-api/typehints.po index c90a8f7b3c..3e3361c14e 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -72,6 +72,14 @@ msgid "" " ...\n" "}" msgstr "" +"...\n" +"static PyMethodDef my_obj_methods[] = {\n" +" // 其他方法。\n" +" ...\n" +" {\"__class_getitem__\", Py_GenericAlias, METH_O|METH_CLASS, \"See PEP " +"585\"}\n" +" ...\n" +"}" #: ../../c-api/typehints.rst:38 msgid "The data model method :meth:`~object.__class_getitem__`." diff --git a/extending/index.po b/extending/index.po index e8888e248b..757994de4f 100644 --- a/extending/index.po +++ b/extending/index.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -90,7 +89,7 @@ msgstr "" #: ../../extending/index.rst:44 msgid ":pep:`489` -- Multi-phase extension module initialization" -msgstr "" +msgstr ":pep:`489` -- 多階段擴充模組初始化" #: ../../extending/index.rst:57 msgid "Embedding the CPython runtime in a larger application" diff --git a/faq/gui.po b/faq/gui.po index 96851969b6..98bd3c188e 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -95,6 +95,7 @@ msgid "" "Various third-party freeze libraries such as py2exe and cx_Freeze have " "handling for Tkinter applications built-in." msgstr "" +"各種第三方凍結函式庫,例如 py2exe 和 cx_Freeze,都有內建了對 Tkinter 應用程式的處理。" #: ../../faq/gui.rst:54 msgid "Can I have Tk events handled while waiting for I/O?" diff --git a/faq/windows.po b/faq/windows.po index b46fe34cdc..34374de463 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -407,6 +406,11 @@ msgid "" "initmyAppc(); // Initialize (import) the helper class.\n" "PyRun_SimpleString(\"import myApp\"); // Import the shadow class." msgstr "" +"#include \n" +"...\n" +"Py_Initialize(); // 初始化 Python。\n" +"initmyAppc(); // 初始化(引入)幫助類別。\n" +"PyRun_SimpleString(\"import myApp\"); // 引入 shadow 類別。" #: ../../faq/windows.rst:218 msgid "" @@ -550,13 +554,3 @@ msgstr "" "上的版本發生這種情況。首先要確保你的作業系統仍受支援並且是最新的,如果這無法" "解決問題,請造訪 `Microsoft 支援頁面 `_\\ 以取得關於手動安裝 C Runtime 更新的指南。" - -#~ msgid "" -#~ "This series of screencasts aims to get you up and running with Python on " -#~ "Windows XP. The knowledge is distilled into 1.5 hours and will get you " -#~ "up and running with the right Python distribution, coding in your choice " -#~ "of IDE, and debugging and writing solid code with unit-tests." -#~ msgstr "" -#~ "這一組影片教學可以讓你在 Windows XP 上順利使用 Python。整組課程大約需要你" -#~ "一個半小時的時間。課程包含安裝正確的 Python 版本,在你喜歡的 IDE 中進行開" -#~ "發,除錯,以及對程式進行單元測試以生產可靠的程式。" diff --git a/howto/argparse.po b/howto/argparse.po index 323727fd39..5f4710c87f 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -1644,7 +1644,7 @@ msgstr "若要在 :mod:`argparse` 輸出中翻譯你自己的字串,請使用 #: ../../howto/argparse.rst:850 msgid "Custom type converters" -msgstr "" +msgstr "自定義型別轉換器" #: ../../howto/argparse.rst:852 msgid "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 3208fed349..1fb852831b 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -139,7 +139,7 @@ msgstr "" #: ../../howto/gdb_helpers.rst:68 msgid "add-auto-load-safe-path /path/to/cpython" -msgstr "" +msgstr "add-auto-load-safe-path /path/to/cpython" #: ../../howto/gdb_helpers.rst:70 msgid "You can also add multiple paths, separated by ``:``." @@ -483,6 +483,18 @@ msgid "" " 910 except KeyboardInterrupt:\n" " 911 # properly quit on a keyboard interrupt..." msgstr "" +"(gdb) py-list\n" +" 901 if options.profile:\n" +" 902 options.profile = False\n" +" 903 profile_me()\n" +" 904 return\n" +" 905\n" +">906 u = UI()\n" +" 907 if not u.quit:\n" +" 908 try:\n" +" 909 gtk.main()\n" +" 910 except KeyboardInterrupt:\n" +" 911 # properly quit on a keyboard interrupt..." #: ../../howto/gdb_helpers.rst:229 msgid "" @@ -937,6 +949,23 @@ msgid "" "1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" ">1548 main()" msgstr "" +"(gdb) py-bt\n" +"(output snipped)\n" +"#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in " +"()\n" +" main()\n" +"(gdb) frame 68\n" +"#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/" +"test/regrtest.py, line 1548, in (), throwflag=0) at Python/ceval." +"c:2665\n" +"2665 x = call_function(&sp, oparg);\n" +"(gdb) py-list\n" +"1543 # 在暫時改變 CWD 到一個臨時且可寫入的目錄的\n" +"1544 # 情境管理器中運行測試。\n" +"1545 # 如果無法建立或更改 CWD,則使用原始的 CWD。\n" +"1546 # 原始 CWD 可從 test_support.SAVEDCWD 獲得。\n" +"1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" +">1548 main()" #: ../../howto/gdb_helpers.rst:411 msgid "" @@ -956,6 +985,13 @@ msgid "" "* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" "sysdeps/unix/syscall-template.S:82" msgstr "" +"(gdb) info threads\n" +" 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +" 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +"* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" +"sysdeps/unix/syscall-template.S:82" #: ../../howto/gdb_helpers.rst:419 msgid "" @@ -1047,3 +1083,80 @@ msgid "" ", , _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140737213728528), count=1, " +"owner=140737213728528)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140737213728528))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140737213728528)\n" +" f()\n" +"\n" +"Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):\n" +"#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140736940992272), count=1, " +"owner=140736940992272)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140736940992272))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140736940992272)\n" +" f()\n" +"\n" +"Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):\n" +"#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 16, in _wait ()\n" +" time.sleep(0.01)\n" +"#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 378, in _check_notify " +"(self=, skipped=[], _mirrorOutput=False, testsRun=39, " +"buffer=False, _original_stderr=, " +"_stdout_buffer=, " +"_stderr_buffer=, " +"_moduleSetUpFailed=False, expectedFailures=[], errors=[], " +"_previousTestClass=, unexpectedSuccesses=[], " +"failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, " +"_threads=(0,), _cleanups=[], _type_equality_funcs={: , : " +", : " +", : " +", =1.0.4\" # minimum version" msgstr "" +"python -m pip install SomePackage==1.0.4 # 明確版本\n" +"python -m pip install \"SomePackage>=1.0.4\" # 最小版本" #: ../../installing/index.rst:103 msgid "" @@ -341,6 +342,10 @@ msgid "" "python3 -m pip install SomePackage # default Python 3\n" "python3.4 -m pip install SomePackage # specifically Python 3.4" msgstr "" +"python2 -m pip install SomePackage # 預設 Python 2\n" +"python2.7 -m pip install SomePackage # 指定 Python 2.7\n" +"python3 -m pip install SomePackage # 預設 Python 3\n" +"python3.4 -m pip install SomePackage # 指定 Python 3.4" #: ../../installing/index.rst:176 msgid "Appropriately versioned ``pip`` commands may also be available." @@ -361,6 +366,10 @@ msgid "" "py -3 -m pip install SomePackage # default Python 3\n" "py -3.4 -m pip install SomePackage # specifically Python 3.4" msgstr "" +"py -2 -m pip install SomePackage # 預設 Python 2\n" +"py -2.7 -m pip install SomePackage # 指定 Python 2.7\n" +"py -3 -m pip install SomePackage # 預設 Python 3\n" +"py -3.4 -m pip install SomePackage # 指定 Python 3.4" #: ../../installing/index.rst:195 msgid "Common installation issues" diff --git a/library/doctest.po b/library/doctest.po index 1e8a7c2bce..19e05a3df7 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-27 07:36+0000\n" +"POT-Creation-Date: 2025-07-16 00:16+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -474,7 +474,7 @@ msgid "" "searched. Objects imported into the module are not searched." msgstr "" -#: ../../library/doctest.rst:313 +#: ../../library/doctest.rst:317 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -487,11 +487,11 @@ msgid "" "__test__.K``." msgstr "" -#: ../../library/doctest.rst:322 +#: ../../library/doctest.rst:326 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: ../../library/doctest.rst:324 +#: ../../library/doctest.rst:328 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -513,7 +513,7 @@ msgstr "" "\"\"\"\n" "}" -#: ../../library/doctest.rst:336 +#: ../../library/doctest.rst:340 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -522,24 +522,24 @@ msgid "" "scanned for tests." msgstr "" -#: ../../library/doctest.rst:342 +#: ../../library/doctest.rst:346 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: ../../library/doctest.rst:349 +#: ../../library/doctest.rst:353 msgid "How are Docstring Examples Recognized?" msgstr "" -#: ../../library/doctest.rst:351 +#: ../../library/doctest.rst:355 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" -#: ../../library/doctest.rst:356 +#: ../../library/doctest.rst:360 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -573,18 +573,18 @@ msgstr "" "NO!!!\n" ">>>" -#: ../../library/doctest.rst:376 +#: ../../library/doctest.rst:380 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" -#: ../../library/doctest.rst:380 +#: ../../library/doctest.rst:384 msgid "The fine print:" msgstr "" -#: ../../library/doctest.rst:382 +#: ../../library/doctest.rst:386 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " @@ -592,7 +592,7 @@ msgid "" "line is expected." msgstr "" -#: ../../library/doctest.rst:387 +#: ../../library/doctest.rst:391 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " @@ -607,20 +607,20 @@ msgid "" "`DocTestParser` class." msgstr "" -#: ../../library/doctest.rst:399 +#: ../../library/doctest.rst:403 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: ../../library/doctest.rst:402 +#: ../../library/doctest.rst:406 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" -#: ../../library/doctest.rst:406 +#: ../../library/doctest.rst:410 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -629,7 +629,7 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:412 +#: ../../library/doctest.rst:416 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -637,7 +637,7 @@ msgid "" "use a raw string)::" msgstr "" -#: ../../library/doctest.rst:416 +#: ../../library/doctest.rst:420 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -646,11 +646,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:422 +#: ../../library/doctest.rst:426 msgid "The starting column doesn't matter::" msgstr "" -#: ../../library/doctest.rst:424 +#: ../../library/doctest.rst:428 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -662,17 +662,17 @@ msgstr "" " >>> math.floor(1.9)\n" " 1" -#: ../../library/doctest.rst:429 +#: ../../library/doctest.rst:433 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" -#: ../../library/doctest.rst:436 +#: ../../library/doctest.rst:440 msgid "What's the Execution Context?" msgstr "" -#: ../../library/doctest.rst:438 +#: ../../library/doctest.rst:442 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " @@ -683,17 +683,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: ../../library/doctest.rst:446 +#: ../../library/doctest.rst:450 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" -#: ../../library/doctest.rst:453 +#: ../../library/doctest.rst:457 msgid "What About Exceptions?" msgstr "" -#: ../../library/doctest.rst:455 +#: ../../library/doctest.rst:459 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -702,11 +702,11 @@ msgid "" "it accepts." msgstr "" -#: ../../library/doctest.rst:461 +#: ../../library/doctest.rst:465 msgid "Simple example::" msgstr "簡單範例: ::" -#: ../../library/doctest.rst:463 +#: ../../library/doctest.rst:467 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -718,20 +718,20 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" -#: ../../library/doctest.rst:468 +#: ../../library/doctest.rst:472 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" -#: ../../library/doctest.rst:471 +#: ../../library/doctest.rst:475 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" -#: ../../library/doctest.rst:475 +#: ../../library/doctest.rst:479 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" @@ -739,14 +739,14 @@ msgstr "" "Traceback (most recent call last):\n" "Traceback (innermost last):" -#: ../../library/doctest.rst:478 +#: ../../library/doctest.rst:482 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" -#: ../../library/doctest.rst:482 +#: ../../library/doctest.rst:486 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " @@ -754,7 +754,7 @@ msgid "" "multi-line detail::" msgstr "" -#: ../../library/doctest.rst:487 +#: ../../library/doctest.rst:491 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -770,20 +770,20 @@ msgstr "" " line\n" "detail" -#: ../../library/doctest.rst:494 +#: ../../library/doctest.rst:498 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" -#: ../../library/doctest.rst:497 +#: ../../library/doctest.rst:501 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" -#: ../../library/doctest.rst:500 +#: ../../library/doctest.rst:504 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -799,7 +799,7 @@ msgstr "" " line\n" "detail" -#: ../../library/doctest.rst:507 +#: ../../library/doctest.rst:511 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -808,11 +808,11 @@ msgid "" "transcript of a Monty Python skit." msgstr "" -#: ../../library/doctest.rst:513 +#: ../../library/doctest.rst:517 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: ../../library/doctest.rst:515 +#: ../../library/doctest.rst:519 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " @@ -822,7 +822,7 @@ msgid "" "create real problems." msgstr "" -#: ../../library/doctest.rst:522 +#: ../../library/doctest.rst:526 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " @@ -831,14 +831,14 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: ../../library/doctest.rst:528 +#: ../../library/doctest.rst:532 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" -#: ../../library/doctest.rst:532 +#: ../../library/doctest.rst:536 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " @@ -847,13 +847,13 @@ msgid "" "need to manually add the traceback header line to your test example." msgstr "" -#: ../../library/doctest.rst:540 +#: ../../library/doctest.rst:544 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: ../../library/doctest.rst:543 +#: ../../library/doctest.rst:547 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -867,7 +867,7 @@ msgstr "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:549 +#: ../../library/doctest.rst:553 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " @@ -875,7 +875,7 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:553 +#: ../../library/doctest.rst:557 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -889,11 +889,11 @@ msgstr "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:564 +#: ../../library/doctest.rst:568 msgid "Option Flags" msgstr "可選旗標" -#: ../../library/doctest.rst:566 +#: ../../library/doctest.rst:570 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -903,13 +903,13 @@ msgid "" "option." msgstr "" -#: ../../library/doctest.rst:572 +#: ../../library/doctest.rst:576 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: ../../library/doctest.rst:578 +#: ../../library/doctest.rst:582 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -921,7 +921,7 @@ msgid "" "not for several years." msgstr "" -#: ../../library/doctest.rst:590 +#: ../../library/doctest.rst:594 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -930,7 +930,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: ../../library/doctest.rst:599 +#: ../../library/doctest.rst:603 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -940,7 +940,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:610 +#: ../../library/doctest.rst:614 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -949,14 +949,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:619 +#: ../../library/doctest.rst:623 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: ../../library/doctest.rst:623 +#: ../../library/doctest.rst:627 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -966,7 +966,7 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:631 +#: ../../library/doctest.rst:635 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -992,20 +992,20 @@ msgstr "" "Traceback (most recent call last):\n" "__main__.Exception: message" -#: ../../library/doctest.rst:645 +#: ../../library/doctest.rst:649 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: ../../library/doctest.rst:649 +#: ../../library/doctest.rst:653 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:656 +#: ../../library/doctest.rst:660 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -1014,32 +1014,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:662 +#: ../../library/doctest.rst:666 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:667 +#: ../../library/doctest.rst:671 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:669 +#: ../../library/doctest.rst:673 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:674 +#: ../../library/doctest.rst:678 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:680 +#: ../../library/doctest.rst:684 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:686 +#: ../../library/doctest.rst:690 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -1049,7 +1049,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:695 +#: ../../library/doctest.rst:699 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -1060,7 +1060,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:706 +#: ../../library/doctest.rst:710 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -1068,17 +1068,17 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:714 +#: ../../library/doctest.rst:718 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:717 +#: ../../library/doctest.rst:721 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: ../../library/doctest.rst:723 +#: ../../library/doctest.rst:727 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -1087,39 +1087,39 @@ msgid "" "be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:729 +#: ../../library/doctest.rst:733 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "MY_FLAG = register_optionflag('MY_FLAG')" -#: ../../library/doctest.rst:739 +#: ../../library/doctest.rst:743 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:741 +#: ../../library/doctest.rst:745 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: ../../library/doctest.rst:752 +#: ../../library/doctest.rst:756 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: ../../library/doctest.rst:756 +#: ../../library/doctest.rst:760 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: ../../library/doctest.rst:759 +#: ../../library/doctest.rst:763 msgid "For example, this test passes:" msgstr "" -#: ../../library/doctest.rst:761 +#: ../../library/doctest.rst:765 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" @@ -1129,7 +1129,7 @@ msgstr "" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" -#: ../../library/doctest.rst:768 +#: ../../library/doctest.rst:772 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -1137,7 +1137,7 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:773 +#: ../../library/doctest.rst:777 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" @@ -1145,13 +1145,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:779 +#: ../../library/doctest.rst:783 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:782 +#: ../../library/doctest.rst:786 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" @@ -1159,13 +1159,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:788 +#: ../../library/doctest.rst:792 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:791 +#: ../../library/doctest.rst:795 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" @@ -1175,14 +1175,14 @@ msgstr "" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:798 +#: ../../library/doctest.rst:802 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: ../../library/doctest.rst:802 +#: ../../library/doctest.rst:806 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" @@ -1192,7 +1192,7 @@ msgstr "" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" -#: ../../library/doctest.rst:809 +#: ../../library/doctest.rst:813 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -1202,11 +1202,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:819 +#: ../../library/doctest.rst:823 msgid "Warnings" msgstr "警告" -#: ../../library/doctest.rst:821 +#: ../../library/doctest.rst:825 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -1216,7 +1216,7 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:827 +#: ../../library/doctest.rst:831 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" @@ -1224,11 +1224,11 @@ msgstr "" ">>> foo()\n" "{\"spam\", \"eggs\"}" -#: ../../library/doctest.rst:830 +#: ../../library/doctest.rst:834 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:832 +#: ../../library/doctest.rst:836 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" @@ -1236,11 +1236,11 @@ msgstr "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" -#: ../../library/doctest.rst:835 +#: ../../library/doctest.rst:839 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:837 +#: ../../library/doctest.rst:841 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" @@ -1250,15 +1250,15 @@ msgstr "" ">>> d\n" "['eggs', 'spam']" -#: ../../library/doctest.rst:841 +#: ../../library/doctest.rst:845 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:843 +#: ../../library/doctest.rst:847 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:845 +#: ../../library/doctest.rst:849 msgid "" ">>> id(1.0) # certain to fail some of the time\n" "7948648\n" @@ -1267,12 +1267,12 @@ msgid "" "" msgstr "" -#: ../../library/doctest.rst:853 +#: ../../library/doctest.rst:857 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:855 +#: ../../library/doctest.rst:859 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" @@ -1280,14 +1280,14 @@ msgstr "" ">>> C() # doctest: +ELLIPSIS\n" "" -#: ../../library/doctest.rst:861 +#: ../../library/doctest.rst:865 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for some floating-" "point calculations, and C libraries vary widely in quality here. ::" msgstr "" -#: ../../library/doctest.rst:865 +#: ../../library/doctest.rst:869 msgid "" ">>> 1000**0.1 # risky\n" "1.9952623149688797\n" @@ -1297,29 +1297,29 @@ msgid "" "1.9953" msgstr "" -#: ../../library/doctest.rst:872 +#: ../../library/doctest.rst:876 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: ../../library/doctest.rst:875 +#: ../../library/doctest.rst:879 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -#: ../../library/doctest.rst:878 +#: ../../library/doctest.rst:882 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:885 +#: ../../library/doctest.rst:889 msgid "Basic API" msgstr "基礎 API" -#: ../../library/doctest.rst:887 +#: ../../library/doctest.rst:891 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -1327,25 +1327,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:895 +#: ../../library/doctest.rst:899 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:898 +#: ../../library/doctest.rst:902 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:901 +#: ../../library/doctest.rst:905 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:904 +#: ../../library/doctest.rst:908 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -1355,20 +1355,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:911 +#: ../../library/doctest.rst:915 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:915 +#: ../../library/doctest.rst:919 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: ../../library/doctest.rst:918 +#: ../../library/doctest.rst:922 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -1377,7 +1377,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:924 +#: ../../library/doctest.rst:928 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -1385,7 +1385,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:929 +#: ../../library/doctest.rst:933 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -1398,27 +1398,27 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:938 +#: ../../library/doctest.rst:942 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in :data:`sys.argv`." msgstr "" -#: ../../library/doctest.rst:942 +#: ../../library/doctest.rst:946 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: ../../library/doctest.rst:946 +#: ../../library/doctest.rst:950 msgid "" "Optional argument *optionflags* (default value ``0``) takes the :ref:" "`bitwise OR ` of option flags. See section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:950 +#: ../../library/doctest.rst:954 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -1426,33 +1426,33 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:955 ../../library/doctest.rst:1098 +#: ../../library/doctest.rst:959 ../../library/doctest.rst:1102 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:959 ../../library/doctest.rst:1102 +#: ../../library/doctest.rst:963 ../../library/doctest.rst:1106 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:965 +#: ../../library/doctest.rst:969 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:968 +#: ../../library/doctest.rst:972 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: ../../library/doctest.rst:972 +#: ../../library/doctest.rst:976 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " @@ -1460,22 +1460,22 @@ msgid "" "directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:977 +#: ../../library/doctest.rst:981 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:979 +#: ../../library/doctest.rst:983 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: ../../library/doctest.rst:981 +#: ../../library/doctest.rst:985 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:984 +#: ../../library/doctest.rst:988 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -1486,39 +1486,39 @@ msgid "" "defaults to true." msgstr "" -#: ../../library/doctest.rst:992 +#: ../../library/doctest.rst:996 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: ../../library/doctest.rst:999 +#: ../../library/doctest.rst:1003 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: ../../library/doctest.rst:1002 +#: ../../library/doctest.rst:1006 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:1004 +#: ../../library/doctest.rst:1008 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:1007 +#: ../../library/doctest.rst:1011 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: ../../library/doctest.rst:1010 +#: ../../library/doctest.rst:1014 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -1526,16 +1526,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:1014 +#: ../../library/doctest.rst:1018 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:1020 +#: ../../library/doctest.rst:1024 msgid "Unittest API" msgstr "" -#: ../../library/doctest.rst:1022 +#: ../../library/doctest.rst:1026 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1545,7 +1545,7 @@ msgid "" "your test module::" msgstr "" -#: ../../library/doctest.rst:1028 +#: ../../library/doctest.rst:1032 msgid "" "import unittest\n" "import doctest\n" @@ -1563,19 +1563,19 @@ msgstr "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" -#: ../../library/doctest.rst:1036 +#: ../../library/doctest.rst:1040 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:1042 +#: ../../library/doctest.rst:1046 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: ../../library/doctest.rst:1045 +#: ../../library/doctest.rst:1049 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " @@ -1586,21 +1586,21 @@ msgid "" "marked as skipped." msgstr "" -#: ../../library/doctest.rst:1052 +#: ../../library/doctest.rst:1056 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1054 +#: ../../library/doctest.rst:1058 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1056 +#: ../../library/doctest.rst:1060 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1059 +#: ../../library/doctest.rst:1063 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1611,14 +1611,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1067 +#: ../../library/doctest.rst:1071 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1071 +#: ../../library/doctest.rst:1075 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1628,7 +1628,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1078 +#: ../../library/doctest.rst:1082 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1636,7 +1636,7 @@ msgid "" "the test globals as the :attr:`~DocTest.globs` attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1083 +#: ../../library/doctest.rst:1087 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1645,14 +1645,14 @@ msgid "" "test passed." msgstr "" -#: ../../library/doctest.rst:1089 +#: ../../library/doctest.rst:1093 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1093 +#: ../../library/doctest.rst:1097 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1660,17 +1660,17 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1105 +#: ../../library/doctest.rst:1109 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1115 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:1117 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. Each docstring is run as a " @@ -1681,50 +1681,50 @@ msgid "" "then the" msgstr "" -#: ../../library/doctest.rst:1121 +#: ../../library/doctest.rst:1125 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1125 +#: ../../library/doctest.rst:1129 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is the module's :attr:`~module.__dict__`." msgstr "" -#: ../../library/doctest.rst:1129 +#: ../../library/doctest.rst:1133 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1132 +#: ../../library/doctest.rst:1136 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1135 +#: ../../library/doctest.rst:1139 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above, but they are called for each " "docstring." msgstr "" -#: ../../library/doctest.rst:1138 +#: ../../library/doctest.rst:1142 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1140 +#: ../../library/doctest.rst:1144 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1144 +#: ../../library/doctest.rst:1148 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1733,14 +1733,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1150 +#: ../../library/doctest.rst:1154 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1154 +#: ../../library/doctest.rst:1158 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1753,23 +1753,23 @@ msgid "" "pass options through :mod:`!unittest` to :mod:`!doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1164 +#: ../../library/doctest.rst:1168 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`!doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1170 +#: ../../library/doctest.rst:1174 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1176 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1175 +#: ../../library/doctest.rst:1179 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1783,17 +1783,17 @@ msgid "" "`!doctest`'s :mod:`!unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1186 +#: ../../library/doctest.rst:1190 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1193 +#: ../../library/doctest.rst:1197 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1195 +#: ../../library/doctest.rst:1199 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1801,62 +1801,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1200 +#: ../../library/doctest.rst:1204 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1203 +#: ../../library/doctest.rst:1207 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1206 +#: ../../library/doctest.rst:1210 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1209 +#: ../../library/doctest.rst:1213 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1212 +#: ../../library/doctest.rst:1216 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1216 +#: ../../library/doctest.rst:1220 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1219 +#: ../../library/doctest.rst:1223 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1222 +#: ../../library/doctest.rst:1226 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1225 +#: ../../library/doctest.rst:1229 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1228 +#: ../../library/doctest.rst:1232 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1876,30 +1876,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1241 +#: ../../library/doctest.rst:1245 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1246 +#: ../../library/doctest.rst:1250 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1250 +#: ../../library/doctest.rst:1254 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1256 +#: ../../library/doctest.rst:1260 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1262 +#: ../../library/doctest.rst:1266 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1907,57 +1907,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1270 +#: ../../library/doctest.rst:1274 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1276 +#: ../../library/doctest.rst:1280 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`!DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1283 +#: ../../library/doctest.rst:1287 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1290 +#: ../../library/doctest.rst:1294 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1297 +#: ../../library/doctest.rst:1301 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1302 +#: ../../library/doctest.rst:1306 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1307 +#: ../../library/doctest.rst:1311 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1313 +#: ../../library/doctest.rst:1317 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1320 +#: ../../library/doctest.rst:1324 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1965,7 +1965,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1328 +#: ../../library/doctest.rst:1332 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1974,20 +1974,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1337 +#: ../../library/doctest.rst:1341 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1344 +#: ../../library/doctest.rst:1348 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1350 +#: ../../library/doctest.rst:1354 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1996,11 +1996,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1360 +#: ../../library/doctest.rst:1364 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1365 +#: ../../library/doctest.rst:1369 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -2008,48 +2008,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1370 +#: ../../library/doctest.rst:1374 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1373 +#: ../../library/doctest.rst:1377 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1376 +#: ../../library/doctest.rst:1380 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1379 +#: ../../library/doctest.rst:1383 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1383 +#: ../../library/doctest.rst:1387 msgid ":class:`DocTestFinder` defines the following method:" msgstr ":class:`DocTestFinder` 定義了以下方法:" -#: ../../library/doctest.rst:1388 +#: ../../library/doctest.rst:1392 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1391 +#: ../../library/doctest.rst:1395 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1395 +#: ../../library/doctest.rst:1399 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2057,26 +2057,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1399 +#: ../../library/doctest.rst:1403 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1401 +#: ../../library/doctest.rst:1405 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1405 +#: ../../library/doctest.rst:1409 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1407 +#: ../../library/doctest.rst:1411 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1409 +#: ../../library/doctest.rst:1413 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2085,7 +2085,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1415 +#: ../../library/doctest.rst:1419 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2095,34 +2095,34 @@ msgid "" "is not specified, then it defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1426 +#: ../../library/doctest.rst:1430 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1431 +#: ../../library/doctest.rst:1435 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1435 +#: ../../library/doctest.rst:1439 msgid ":class:`DocTestParser` defines the following methods:" msgstr ":class:`DocTestParser` 定義了以下方法:" -#: ../../library/doctest.rst:1440 +#: ../../library/doctest.rst:1444 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1443 +#: ../../library/doctest.rst:1447 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`!DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1450 +#: ../../library/doctest.rst:1454 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2130,7 +2130,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1457 +#: ../../library/doctest.rst:1461 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2138,33 +2138,33 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1464 +#: ../../library/doctest.rst:1468 msgid "TestResults objects" msgstr "TestResults 物件" -#: ../../library/doctest.rst:1471 +#: ../../library/doctest.rst:1475 msgid "Number of failed tests." msgstr "" -#: ../../library/doctest.rst:1475 +#: ../../library/doctest.rst:1479 msgid "Number of attempted tests." msgstr "" -#: ../../library/doctest.rst:1479 +#: ../../library/doctest.rst:1483 msgid "Number of skipped tests." msgstr "" -#: ../../library/doctest.rst:1487 +#: ../../library/doctest.rst:1491 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1492 +#: ../../library/doctest.rst:1496 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1495 +#: ../../library/doctest.rst:1499 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2174,7 +2174,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1501 +#: ../../library/doctest.rst:1505 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2185,14 +2185,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1509 +#: ../../library/doctest.rst:1513 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1513 +#: ../../library/doctest.rst:1517 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2201,14 +2201,14 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1519 +#: ../../library/doctest.rst:1523 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1523 +#: ../../library/doctest.rst:1527 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " "failed and skipped examples is also available via the :attr:`tries`, :attr:" @@ -2216,53 +2216,53 @@ msgid "" "`summarize` methods return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1528 +#: ../../library/doctest.rst:1532 msgid ":class:`DocTestRunner` defines the following methods:" msgstr ":class:`DocTestRunner` 定義了以下方法:" -#: ../../library/doctest.rst:1533 +#: ../../library/doctest.rst:1537 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1537 +#: ../../library/doctest.rst:1541 msgid "" "*example* is the example about to be processed. *test* is the test " "containing *example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1544 +#: ../../library/doctest.rst:1548 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1548 ../../library/doctest.rst:1559 +#: ../../library/doctest.rst:1552 ../../library/doctest.rst:1563 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1555 +#: ../../library/doctest.rst:1559 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1566 +#: ../../library/doctest.rst:1570 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1574 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2270,14 +2270,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1578 +#: ../../library/doctest.rst:1582 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*. Return a :class:`TestResults` " "instance." msgstr "" -#: ../../library/doctest.rst:1582 +#: ../../library/doctest.rst:1586 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2285,54 +2285,54 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1587 +#: ../../library/doctest.rst:1591 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1591 +#: ../../library/doctest.rst:1595 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1598 +#: ../../library/doctest.rst:1602 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1601 +#: ../../library/doctest.rst:1605 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1605 +#: ../../library/doctest.rst:1609 msgid ":class:`DocTestParser` has the following attributes:" msgstr ":class:`DocTestParser` 有以下屬性:" -#: ../../library/doctest.rst:1609 +#: ../../library/doctest.rst:1613 msgid "Number of attempted examples." msgstr "" -#: ../../library/doctest.rst:1613 +#: ../../library/doctest.rst:1617 msgid "Number of failed examples." msgstr "" -#: ../../library/doctest.rst:1617 +#: ../../library/doctest.rst:1621 msgid "Number of skipped examples." msgstr "" -#: ../../library/doctest.rst:1625 +#: ../../library/doctest.rst:1629 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1630 +#: ../../library/doctest.rst:1634 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2341,11 +2341,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1637 +#: ../../library/doctest.rst:1641 msgid ":class:`OutputChecker` defines the following methods:" msgstr ":class:`OutputChecker` 定義了以下方法:" -#: ../../library/doctest.rst:1641 +#: ../../library/doctest.rst:1645 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2354,28 +2354,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1650 +#: ../../library/doctest.rst:1654 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1658 +#: ../../library/doctest.rst:1662 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1660 +#: ../../library/doctest.rst:1664 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1662 +#: ../../library/doctest.rst:1666 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1665 +#: ../../library/doctest.rst:1669 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2383,13 +2383,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1670 +#: ../../library/doctest.rst:1674 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1673 +#: ../../library/doctest.rst:1677 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2397,7 +2397,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1678 +#: ../../library/doctest.rst:1682 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2419,11 +2419,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1688 +#: ../../library/doctest.rst:1692 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1690 +#: ../../library/doctest.rst:1694 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2485,17 +2485,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1721 +#: ../../library/doctest.rst:1725 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1727 +#: ../../library/doctest.rst:1731 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1729 +#: ../../library/doctest.rst:1733 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2503,7 +2503,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1734 +#: ../../library/doctest.rst:1738 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2516,11 +2516,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1744 +#: ../../library/doctest.rst:1748 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1746 +#: ../../library/doctest.rst:1750 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2531,18 +2531,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1754 +#: ../../library/doctest.rst:1758 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1761 +#: ../../library/doctest.rst:1765 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1763 +#: ../../library/doctest.rst:1767 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2552,7 +2552,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1770 +#: ../../library/doctest.rst:1774 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2560,17 +2560,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1773 +#: ../../library/doctest.rst:1777 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1779 +#: ../../library/doctest.rst:1783 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1781 +#: ../../library/doctest.rst:1785 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2578,13 +2578,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1786 +#: ../../library/doctest.rst:1790 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1789 +#: ../../library/doctest.rst:1793 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2596,30 +2596,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1800 +#: ../../library/doctest.rst:1804 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1802 +#: ../../library/doctest.rst:1806 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1805 +#: ../../library/doctest.rst:1809 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1807 +#: ../../library/doctest.rst:1811 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1812 +#: ../../library/doctest.rst:1816 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2627,7 +2627,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1820 +#: ../../library/doctest.rst:1824 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2637,89 +2637,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1827 +#: ../../library/doctest.rst:1831 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1830 +#: ../../library/doctest.rst:1834 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1835 +#: ../../library/doctest.rst:1839 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1839 +#: ../../library/doctest.rst:1843 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1844 ../../library/doctest.rst:1868 +#: ../../library/doctest.rst:1848 ../../library/doctest.rst:1872 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1849 ../../library/doctest.rst:1873 +#: ../../library/doctest.rst:1853 ../../library/doctest.rst:1877 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1854 +#: ../../library/doctest.rst:1858 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1859 +#: ../../library/doctest.rst:1863 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1863 +#: ../../library/doctest.rst:1867 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr ":exc:`UnexpectedException` 定義了以下屬性:" -#: ../../library/doctest.rst:1878 +#: ../../library/doctest.rst:1882 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1885 +#: ../../library/doctest.rst:1889 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1887 +#: ../../library/doctest.rst:1891 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1890 +#: ../../library/doctest.rst:1894 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1892 +#: ../../library/doctest.rst:1896 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1894 +#: ../../library/doctest.rst:1898 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1896 +#: ../../library/doctest.rst:1900 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1900 +#: ../../library/doctest.rst:1904 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2731,7 +2731,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1908 +#: ../../library/doctest.rst:1912 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2752,13 +2752,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1926 +#: ../../library/doctest.rst:1930 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1929 +#: ../../library/doctest.rst:1933 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2766,7 +2766,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1934 +#: ../../library/doctest.rst:1938 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2774,13 +2774,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1938 +#: ../../library/doctest.rst:1942 msgid "" "Define a :attr:`~module.__test__` dictionary mapping from regression test " "topics to docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1941 +#: ../../library/doctest.rst:1945 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2788,7 +2788,7 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1946 +#: ../../library/doctest.rst:1950 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2820,54 +2820,54 @@ msgstr "" " fail, total = doctest.testmod(optionflags=flags)\n" " print(f\"{fail} failures out of {total} tests\")" -#: ../../library/doctest.rst:1963 +#: ../../library/doctest.rst:1967 msgid "Footnotes" msgstr "註腳" -#: ../../library/doctest.rst:1964 +#: ../../library/doctest.rst:1968 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" -#: ../../library/doctest.rst:372 +#: ../../library/doctest.rst:376 msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:372 +#: ../../library/doctest.rst:376 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/doctest.rst:372 ../../library/doctest.rst:607 +#: ../../library/doctest.rst:376 ../../library/doctest.rst:611 msgid "..." msgstr "..." -#: ../../library/doctest.rst:538 +#: ../../library/doctest.rst:542 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/doctest.rst:538 +#: ../../library/doctest.rst:542 msgid "marker" msgstr "marker(標記)" -#: ../../library/doctest.rst:587 +#: ../../library/doctest.rst:591 msgid "" msgstr "" -#: ../../library/doctest.rst:607 ../../library/doctest.rst:732 +#: ../../library/doctest.rst:611 ../../library/doctest.rst:736 msgid "in doctests" msgstr "於 doctests 中" -#: ../../library/doctest.rst:732 +#: ../../library/doctest.rst:736 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/doctest.rst:732 +#: ../../library/doctest.rst:736 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/doctest.rst:732 +#: ../../library/doctest.rst:736 msgid "- (minus)" msgstr "- (減號)" diff --git a/library/email.parser.po b/library/email.parser.po index c89f7718a9..9bcf691477 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-11 10:17+0000\n" +"POT-Creation-Date: 2025-07-14 11:31+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -80,10 +80,10 @@ msgstr "" #: ../../library/email.parser.rst:51 msgid "" -"The :class:`BytesFeedParser`, imported from the :mod:`email.parser." -"FeedParser` module, provides an API that is conducive to incremental parsing " -"of email messages, such as would be necessary when reading the text of an " -"email message from a source that can block (such as a socket). The :class:" +"The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " +"module, provides an API that is conducive to incremental parsing of email " +"messages, such as would be necessary when reading the text of an email " +"message from a source that can block (such as a socket). The :class:" "`BytesFeedParser` can of course be used to parse an email message fully " "contained in a :term:`bytes-like object`, string, or file, but the :class:" "`BytesParser` API may be more convenient for such use cases. The semantics " @@ -206,7 +206,7 @@ msgstr "" msgid "" "Read all the data from the binary file-like object *fp*, parse the resulting " "bytes, and return the message object. *fp* must support both the :meth:`~io." -"IOBase.readline` and the :meth:`~io.TextIOBase.read` methods." +"IOBase.readline` and the :meth:`~io.IOBase.read` methods." msgstr "" #: ../../library/email.parser.rst:161 diff --git a/library/hmac.po b/library/hmac.po index cbad165573..1fa7d828ed 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2025-07-16 00:16+0000\n" "PO-Revision-Date: 2022-03-30 00:16+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,10 +29,16 @@ msgid "**Source code:** :source:`Lib/hmac.py`" msgstr "**原始碼:**\\ :source:`Lib/hmac.py`" #: ../../library/hmac.rst:14 -msgid "This module implements the HMAC algorithm as described by :rfc:`2104`." -msgstr "此模組 (module) 實現了 :rfc:`2014` 所描述的 HMAC 演算法。" +msgid "" +"This module implements the HMAC algorithm as described by :rfc:`2104`. The " +"interface allows to use any hash function with a *fixed* digest size. In " +"particular, extendable output functions such as SHAKE-128 or SHAKE-256 " +"cannot be used with HMAC." +msgstr "" +"此模組實作了 :rfc:`2014` 所描述的 HMAC 演算法。此介面允許使用具有\\ *固定*\\ 摘要 (digest) 長" +"度的任意雜湊函式。要特別注意的是擴充輸出函式(如 SHAKE-128 或 SHAKE-256)不能與 HMAC 一起使用。" -#: ../../library/hmac.rst:19 +#: ../../library/hmac.rst:22 msgid "" "Return a new hmac object. *key* is a bytes or bytearray object giving the " "secret key. If *msg* is present, the method call ``update(msg)`` is made. " @@ -46,7 +51,7 @@ msgstr "" "所用的摘要名稱、摘要建構函式 (constructor) 或模組。它可以是適用於 :func:" "`hashlib.new` 的任何名稱。儘管該引數的位置在後,但它卻是必須的。" -#: ../../library/hmac.rst:25 +#: ../../library/hmac.rst:28 msgid "" "Parameter *key* can be a bytes or bytearray object. Parameter *msg* can be " "of any type supported by :mod:`hashlib`. Parameter *digestmod* can be the " @@ -55,7 +60,7 @@ msgstr "" "參數 *key* 可以為 bytes 或 bytearray 物件。參數 *msg* 可以為 :mod:`hashlib` " "所支援的任意型別。參數 *digestmod* 可以為雜湊演算法的名稱。" -#: ../../library/hmac.rst:30 +#: ../../library/hmac.rst:33 msgid "" "The *digestmod* argument is now required. Pass it as a keyword argument to " "avoid awkwardness when you do not have an initial *msg*." @@ -63,7 +68,7 @@ msgstr "" "*digestmod* 引數現在是必須的。請將其作為關鍵字引數傳入以避免當你沒有初始 " "*msg* 時導致的麻煩。" -#: ../../library/hmac.rst:37 +#: ../../library/hmac.rst:40 msgid "" "Return digest of *msg* for given secret *key* and *digest*. The function is " "equivalent to ``HMAC(key, msg, digest).digest()``, but uses an optimized C " @@ -76,7 +81,7 @@ msgstr "" "implementation),對放入記憶體的訊息能處理得更快。參數 *key*、*msg* 和 " "*digest* 在 :func:`~hmac.new` 中具有相同含義。" -#: ../../library/hmac.rst:43 +#: ../../library/hmac.rst:46 msgid "" "CPython implementation detail, the optimized C implementation is only used " "when *digest* is a string and name of a digest algorithm, which is supported " @@ -85,11 +90,11 @@ msgstr "" "作為 CPython 的實現細節,C 的優化實作只有當 *digest* 為字串並且是一個 " "OpenSSL 所支持的摘要演算法的名稱時才會被使用。" -#: ../../library/hmac.rst:50 +#: ../../library/hmac.rst:53 msgid "An HMAC object has the following methods:" msgstr "HMAC 物件具有下列方法 (method):" -#: ../../library/hmac.rst:54 +#: ../../library/hmac.rst:57 msgid "" "Update the hmac object with *msg*. Repeated calls are equivalent to a " "single call with the concatenation of all the arguments: ``m.update(a); m." @@ -98,11 +103,11 @@ msgstr "" "用 *msg* 來更新 hmac 物件。重複呼叫相當於單次呼叫並傳入所有引數的拼接結果:" "``m.update(a); m.update(b)`` 等價於 ``m.update(a + b)``。" -#: ../../library/hmac.rst:58 +#: ../../library/hmac.rst:61 msgid "Parameter *msg* can be of any type supported by :mod:`hashlib`." msgstr "參數 *msg* 可以是 :mod:`hashlib` 所支援的任何型別。" -#: ../../library/hmac.rst:64 +#: ../../library/hmac.rst:67 msgid "" "Return the digest of the bytes passed to the :meth:`update` method so far. " "This bytes object will be the same length as the *digest_size* of the digest " @@ -113,7 +118,7 @@ msgstr "" "給建構函式的摘要 *digest_size* 的長度相同。它可以包含 NUL bytes 以及 non-" "ASCII bytes。" -#: ../../library/hmac.rst:71 +#: ../../library/hmac.rst:74 msgid "" "When comparing the output of :meth:`digest` to an externally supplied digest " "during a verification routine, it is recommended to use the :func:" @@ -124,7 +129,7 @@ msgstr "" "較時,建議使用 :func:`compare_digest` 函式而不是 ``==`` 運算子以減少被定時攻" "擊時的漏洞。" -#: ../../library/hmac.rst:79 +#: ../../library/hmac.rst:82 msgid "" "Like :meth:`digest` except the digest is returned as a string twice the " "length containing only hexadecimal digits. This may be used to exchange the " @@ -133,7 +138,7 @@ msgstr "" "像是 :meth:`digest` 但摘要的回傳形式為兩倍長度的字串,且此字串只包含十六進位" "數位。這可以被用於在電子郵件或其他非二進位制環境中安全地交換數據。" -#: ../../library/hmac.rst:85 +#: ../../library/hmac.rst:88 msgid "" "When comparing the output of :meth:`hexdigest` to an externally supplied " "digest during a verification routine, it is recommended to use the :func:" @@ -144,7 +149,7 @@ msgstr "" "比較時,建議使用 :func:`compare_digest` 函式而不是 ``==`` 運算子以減少被定時" "攻擊時的漏洞。" -#: ../../library/hmac.rst:93 +#: ../../library/hmac.rst:96 msgid "" "Return a copy (\"clone\") of the hmac object. This can be used to " "efficiently compute the digests of strings that share a common initial " @@ -153,23 +158,23 @@ msgstr "" "回傳 hmac 物件的拷貝 (\"clone\")。這可以被用來有效率地計算那些共享相同初始子" "字串的字串的摘要。" -#: ../../library/hmac.rst:97 +#: ../../library/hmac.rst:100 msgid "A hash object has the following attributes:" msgstr "一個 hash 物件具有以下屬性:" -#: ../../library/hmac.rst:101 +#: ../../library/hmac.rst:104 msgid "The size of the resulting HMAC digest in bytes." msgstr "以 bytes 表示最終 HMAC 摘要的大小。" -#: ../../library/hmac.rst:105 +#: ../../library/hmac.rst:108 msgid "The internal block size of the hash algorithm in bytes." msgstr "以 bytes 表示雜湊演算法的內部區塊大小。" -#: ../../library/hmac.rst:111 +#: ../../library/hmac.rst:114 msgid "The canonical name of this HMAC, always lowercase, e.g. ``hmac-md5``." msgstr "HMAC 的正準名稱總是為小寫形式,例如 ``hmac-md5``。" -#: ../../library/hmac.rst:116 +#: ../../library/hmac.rst:119 msgid "" "Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, " "and ``HMAC.outer``." @@ -177,11 +182,11 @@ msgstr "" "未寫入文件的屬性 ``HMAC.digest_cons``,``HMAC.inner`` 和 ``HMAC.outer`` 已被" "移除。" -#: ../../library/hmac.rst:120 +#: ../../library/hmac.rst:123 msgid "This module also provides the following helper function:" msgstr "這個模組還提供了下列輔助函式:" -#: ../../library/hmac.rst:124 +#: ../../library/hmac.rst:127 msgid "" "Return ``a == b``. This function uses an approach designed to prevent " "timing analysis by avoiding content-based short circuiting behaviour, making " @@ -194,7 +199,7 @@ msgstr "" "`str`\\ (僅限 ASCII,如 :meth:`HMAC.hexdigest` 的回傳值),或者是 :term:" "`bytes-like object`。" -#: ../../library/hmac.rst:132 +#: ../../library/hmac.rst:135 msgid "" "If *a* and *b* are of different lengths, or if an error occurs, a timing " "attack could theoretically reveal information about the types and lengths of " @@ -203,15 +208,15 @@ msgstr "" "如果 *a* 和 *b* 具有不同的長度,或者如果發生了錯誤,定時攻擊在理論上可以取得" "有關 *a* 和 *b* 的型別和長度的訊息 — 但不能取得他們的值。" -#: ../../library/hmac.rst:140 +#: ../../library/hmac.rst:143 msgid "" "The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when available." msgstr "此函式在可能的情況下會在內部使用 OpenSSL 的 ``CRYPTO_memcmp()``。" -#: ../../library/hmac.rst:146 +#: ../../library/hmac.rst:149 msgid "Module :mod:`hashlib`" msgstr ":mod:`hashlib` 模組" -#: ../../library/hmac.rst:147 +#: ../../library/hmac.rst:150 msgid "The Python module providing secure hash functions." msgstr "Python 模組提供安全的雜湊函式。" diff --git a/library/importlib.po b/library/importlib.po index 5b13da4ec6..1f0fe603e1 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -179,7 +179,7 @@ msgstr ":pep:`489`" #: ../../library/importlib.rst:82 msgid "Multi-phase extension module initialization" -msgstr "" +msgstr "多階段擴充模組初始化" #: ../../library/importlib.rst:84 msgid ":pep:`552`" diff --git a/library/os.path.po b/library/os.path.po index 4383cdef76..40cc7fa38e 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-07-10 00:16+0000\n" +"POT-Creation-Date: 2025-07-16 00:16+0000\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,8 +119,8 @@ msgstr "" #: ../../library/os.path.rst:381 ../../library/os.path.rst:401 #: ../../library/os.path.rst:441 ../../library/os.path.rst:470 #: ../../library/os.path.rst:486 ../../library/os.path.rst:497 -#: ../../library/os.path.rst:511 ../../library/os.path.rst:527 -#: ../../library/os.path.rst:552 ../../library/os.path.rst:616 +#: ../../library/os.path.rst:524 ../../library/os.path.rst:549 +#: ../../library/os.path.rst:613 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" @@ -398,10 +398,10 @@ msgstr "" "案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目錄 :" "file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* 是否" "指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的掛載" -"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Linux 系統上," -"即使它們不是掛載點,也會始終回傳 ``True`` 給 btrfs 子卷(subvolumes)。在 Windows " -"上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" -"呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" +"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Linux 系統" +"上,即使它們不是掛載點,也會始終回傳 ``True`` 給 btrfs 子卷(subvolumes)。" +"在 Windows 上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何" +"其他路徑,會呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" #: ../../library/os.path.rst:306 msgid "Added support for detecting non-root mount points on Windows." @@ -664,7 +664,7 @@ msgstr "" "能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使用 :" "func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" -#: ../../library/os.path.rst:517 +#: ../../library/os.path.rst:514 msgid "" "Split the pathname *path* into a pair, ``(head, tail)`` where *tail* is the " "last pathname component and *head* is everything leading up to that. The " @@ -684,7 +684,7 @@ msgstr "" "傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函式 :func:" "`dirname` 和 :func:`basename`。" -#: ../../library/os.path.rst:533 +#: ../../library/os.path.rst:530 msgid "" "Split the pathname *path* into a pair ``(drive, tail)`` where *drive* is " "either a mount point or the empty string. On systems which do not use drive " @@ -695,12 +695,12 @@ msgstr "" "串。在不使用驅動機規範的系統上,*drive* 將始終為空字串。在所有情況下," "``drive + tail`` 將與 *path* 相同。" -#: ../../library/os.path.rst:538 +#: ../../library/os.path.rst:535 msgid "" "On Windows, splits a pathname into drive/UNC sharepoint and relative path." msgstr "在 Windows 上,將路徑名拆分為驅動機或 UNC 共享點以及相對路徑。" -#: ../../library/os.path.rst:540 +#: ../../library/os.path.rst:537 msgid "" "If the path contains a drive letter, drive will contain everything up to and " "including the colon::" @@ -708,7 +708,7 @@ msgstr "" "如果路徑包含驅動機字母,則 *drive* 將包含從頭到冒號(包括冒號)的所有內" "容: ::" -#: ../../library/os.path.rst:543 +#: ../../library/os.path.rst:540 msgid "" ">>> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" @@ -716,12 +716,12 @@ msgstr "" ">>> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" -#: ../../library/os.path.rst:546 +#: ../../library/os.path.rst:543 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "如果路徑包含 UNC 路徑,則驅動機將包含主機名和共享名: ::" -#: ../../library/os.path.rst:549 +#: ../../library/os.path.rst:546 msgid "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" @@ -729,7 +729,7 @@ msgstr "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" -#: ../../library/os.path.rst:558 +#: ../../library/os.path.rst:555 msgid "" "Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where " "*drive* is a device name or mount point, *root* is a string of separators " @@ -742,7 +742,7 @@ msgstr "" "這些項目中的任何一個都可能是空字串。在所有情況下,``drive + root + tail`` 將" "與 *path* 相同。" -#: ../../library/os.path.rst:564 +#: ../../library/os.path.rst:561 msgid "" "On POSIX systems, *drive* is always empty. The *root* may be empty (if " "*path* is relative), a single forward slash (if *path* is absolute), or two " @@ -756,7 +756,7 @@ msgstr "" "onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_ 的實作定義)。例" "如: ::" -#: ../../library/os.path.rst:570 +#: ../../library/os.path.rst:567 msgid "" ">>> splitroot('/home/sam')\n" "('', '/', 'home/sam')\n" @@ -772,7 +772,7 @@ msgstr "" ">>> splitroot('///home/sam')\n" "('', '/', '//home/sam')" -#: ../../library/os.path.rst:577 +#: ../../library/os.path.rst:574 msgid "" "On Windows, *drive* may be empty, a drive-letter name, a UNC share, or a " "device name. The *root* may be empty, a forward slash, or a backward slash. " @@ -781,7 +781,7 @@ msgstr "" "在 Windows 上,*drive* 可能為空、驅動機名稱、UNC 共享或設備名稱。*root* 可能" "為空,斜線或反斜線。例如: ::" -#: ../../library/os.path.rst:581 +#: ../../library/os.path.rst:578 msgid "" ">>> splitroot('C:/Users/Sam')\n" "('C:', '/', 'Users/Sam')\n" @@ -793,7 +793,7 @@ msgstr "" ">>> splitroot('//Server/Share/Users/Sam')\n" "('//Server/Share', '/', 'Users/Sam')" -#: ../../library/os.path.rst:591 +#: ../../library/os.path.rst:588 msgid "" "Split the pathname *path* into a pair ``(root, ext)`` such that ``root + " "ext == path``, and the extension, *ext*, is empty or begins with a period " @@ -802,11 +802,11 @@ msgstr "" "將路徑名 *path* 拆分為一對 ``(root, ext)``,使得 ``root + ext == path``,且副" "檔名 *ext* 為空或以點開頭且最多包含一個點 (period)。" -#: ../../library/os.path.rst:595 +#: ../../library/os.path.rst:592 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "如果路徑不包含副檔名,則 *ext* 將為 ``''``: ::" -#: ../../library/os.path.rst:597 +#: ../../library/os.path.rst:594 msgid "" ">>> splitext('bar')\n" "('bar', '')" @@ -814,7 +814,7 @@ msgstr "" ">>> splitext('bar')\n" "('bar', '')" -#: ../../library/os.path.rst:600 +#: ../../library/os.path.rst:597 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" @@ -822,7 +822,7 @@ msgstr "" "如果路徑包含副檔名,則 *ext* 將設置為該副檔名,包括前導的點。請注意,前面的點" "將被忽略: ::" -#: ../../library/os.path.rst:603 +#: ../../library/os.path.rst:600 msgid "" ">>> splitext('foo.bar.exe')\n" "('foo.bar', '.exe')\n" @@ -834,13 +834,13 @@ msgstr "" ">>> splitext('/foo/bar.exe')\n" "('/foo/bar', '.exe')" -#: ../../library/os.path.rst:608 +#: ../../library/os.path.rst:605 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "路徑的最後一個部份的前導點被認為是根的一部分: ::" -#: ../../library/os.path.rst:611 +#: ../../library/os.path.rst:608 msgid "" ">>> splitext('.cshrc')\n" "('.cshrc', '')\n" @@ -852,7 +852,7 @@ msgstr "" ">>> splitext('/foo/....jpg')\n" "('/foo/....jpg', '')" -#: ../../library/os.path.rst:622 +#: ../../library/os.path.rst:619 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." diff --git a/library/warnings.po b/library/warnings.po index 98fa8f8903..dac5cbe821 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -816,7 +816,7 @@ msgid "" "order to receive timely notifications of future breaking API changes " "(whether in the standard library or third party packages)." msgstr "" -"值得注意的是,這個「預設忽略」串列包括 :exc:`DeprecationWarning`(除了 " +"值得注意的是,這個「預設忽略」串列包括 :exc:`DeprecationWarning`\\ (除了 " "``__main__`` 以外的所有模組),這意味著開發者應該確保在測試他們的程式碼時,讓" "通常被忽略的警告可見,以便及時收到未來 API 破壞性變更的通知(無論是在標準函式" "庫還是第三方套件中)。" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index f4610820ad..aaa0953c25 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -1093,7 +1093,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:695 msgid ":pep:`489` -- Multi-phase extension module initialization" -msgstr "" +msgstr ":pep:`489` -- 多階段擴充模組初始化" #: ../../whatsnew/3.5.rst:696 msgid ""